فهرست منبع

Merge pull request #3766 from NasimiAsl/master

append some Terms for custom Material
David Catuhe 7 سال پیش
والد
کامیت
49f38c9573
2فایلهای تغییر یافته به همراه37 افزوده شده و 2 حذف شده
  1. 23 1
      src/Shaders/default.fragment.fx
  2. 14 1
      src/Shaders/default.vertex.fx

+ 23 - 1
src/Shaders/default.fragment.fx

@@ -4,6 +4,8 @@
 #extension GL_OES_standard_derivatives : enable
 #extension GL_OES_standard_derivatives : enable
 #endif
 #endif
 
 
+#define CUSTOM_FRAGMENT_BEGIN
+
 #ifdef LOGARITHMICDEPTH
 #ifdef LOGARITHMICDEPTH
 #extension GL_EXT_frag_depth : enable
 #extension GL_EXT_frag_depth : enable
 #endif
 #endif
@@ -152,14 +154,23 @@ varying vec3 vDirectionW;
 #include<logDepthDeclaration>
 #include<logDepthDeclaration>
 #include<fogFragmentDeclaration>
 #include<fogFragmentDeclaration>
 
 
+#define CUSTOM_FRAGMENT_DEFINITIONS
+
 void main(void) {
 void main(void) {
+
+#define CUSTOM_FRAGMENT_MAIN_BEGIN
+
 #include<clipPlaneFragment>
 #include<clipPlaneFragment>
 
 
+
+
 	vec3 viewDirectionW = normalize(vEyePosition - vPositionW);
 	vec3 viewDirectionW = normalize(vEyePosition - vPositionW);
 
 
 	// Base color
 	// Base color
 	vec4 baseColor = vec4(1., 1., 1., 1.);
 	vec4 baseColor = vec4(1., 1., 1., 1.);
 	vec3 diffuseColor = vDiffuseColor.rgb;
 	vec3 diffuseColor = vDiffuseColor.rgb;
+	
+	
 
 
 	// Alpha
 	// Alpha
 	float alpha = vDiffuseColor.a;
 	float alpha = vDiffuseColor.a;
@@ -188,16 +199,22 @@ void main(void) {
 	#ifdef ALPHAFROMDIFFUSE
 	#ifdef ALPHAFROMDIFFUSE
 		alpha *= baseColor.a;
 		alpha *= baseColor.a;
 	#endif
 	#endif
+	
+	#define CUSTOM_FRAGMENT_UPDATE_ALPHA
 
 
 	baseColor.rgb *= vDiffuseInfos.y;
 	baseColor.rgb *= vDiffuseInfos.y;
 #endif
 #endif
 
 
+
+
 #include<depthPrePass>
 #include<depthPrePass>
 
 
 #ifdef VERTEXCOLOR
 #ifdef VERTEXCOLOR
 	baseColor.rgb *= vColor.rgb;
 	baseColor.rgb *= vColor.rgb;
 #endif
 #endif
 
 
+#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE
+
 	// Ambient color
 	// Ambient color
 	vec3 baseAmbientColor = vec3(1., 1., 1.);
 	vec3 baseAmbientColor = vec3(1., 1., 1.);
 
 
@@ -205,6 +222,8 @@ void main(void) {
 	baseAmbientColor = texture2D(ambientSampler, vAmbientUV + uvOffset).rgb * vAmbientInfos.y;
 	baseAmbientColor = texture2D(ambientSampler, vAmbientUV + uvOffset).rgb * vAmbientInfos.y;
 #endif
 #endif
 
 
+#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
+
 	// Specular map
 	// Specular map
 #ifdef SPECULARTERM
 #ifdef SPECULARTERM
 	float glossiness = vSpecularColor.a;
 	float glossiness = vSpecularColor.a;
@@ -398,6 +417,8 @@ void main(void) {
     #endif
     #endif
 #endif
 #endif
 
 
+#define CUSTOM_FRAGMENT_BEFORE_FOG
+
 #include<logDepthFragment>
 #include<logDepthFragment>
 #include<fogFragment>
 #include<fogFragment>
 
 
@@ -417,5 +438,6 @@ void main(void) {
 	color.rgb *= color.a;
 	color.rgb *= color.a;
 #endif
 #endif
 
 
+#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
 	gl_FragColor = color;
 	gl_FragColor = color;
-}
+}

+ 14 - 1
src/Shaders/default.vertex.fx

@@ -1,5 +1,8 @@
 #include<__decl__defaultVertex>
 #include<__decl__defaultVertex>
 // Attributes
 // Attributes
+
+#define CUSTOM_VERTEX_BEGIN
+
 attribute vec3 position;
 attribute vec3 position;
 #ifdef NORMAL
 #ifdef NORMAL
 attribute vec3 normal;
 attribute vec3 normal;
@@ -89,8 +92,12 @@ varying vec3 vDirectionW;
 #endif
 #endif
 
 
 #include<logDepthDeclaration>
 #include<logDepthDeclaration>
+#define CUSTOM_VERTEX_DEFINITIONS
 
 
 void main(void) {
 void main(void) {
+	
+	#define CUSTOM_VERTEX_MAIN_BEGIN
+	
 	vec3 positionUpdated = position;
 	vec3 positionUpdated = position;
 #ifdef NORMAL	
 #ifdef NORMAL	
 	vec3 normalUpdated = normal;
 	vec3 normalUpdated = normal;
@@ -105,6 +112,10 @@ void main(void) {
 	vPositionUVW = positionUpdated;
 	vPositionUVW = positionUpdated;
 #endif 
 #endif 
 
 
+#define CUSTOM_VERTEX_UPDATE_POSITION
+
+#define CUSTOM_VERTEX_UPDATE_NORMAL
+
 #include<instancesVertex>
 #include<instancesVertex>
 #include<bonesVertex>
 #include<bonesVertex>
 
 
@@ -233,4 +244,6 @@ void main(void) {
 #include<pointCloudVertex>
 #include<pointCloudVertex>
 #include<logDepthVertex>
 #include<logDepthVertex>
 
 
-}
+#define CUSTOM_VERTEX_MAIN_END
+
+}