Mark Sibly 7 лет назад
Родитель
Сommit
5bed2f1ed0

+ 3 - 0
modules/mojo/graphics/shader.monkey2

@@ -423,6 +423,9 @@ Class Shader
 		
 			Local defs:="#define MX2_RENDERPASS "+rpass+"~n"
 			
+'			Print "~n~n*************** Vertex Shader ***************~n"+defs+vs
+'			Print "~n~n*************** Fragment Shader ****************~n"+defs+fs
+			
 			Local vshader:=glCompile( GL_VERTEX_SHADER,defs+vs )
 			Local fshader:=glCompile( GL_FRAGMENT_SHADER,defs+fs )
 				

+ 10 - 3
modules/mojo3d/assets/shaders/imports/pbr.glsl

@@ -7,9 +7,12 @@
 
 float pointAtten( float d,float r ){
 
-	float atten=max( 1.0-d*d/(r*r),0.0 );atten*=atten;
+//	Doesn't work on ANGLE!
+//	float atten=1.0-min( (d*d)/(r*r),1.0 );atten*=atten;
+
+	float atten=1.0-min( d/r,1.0 );atten*=atten;
 	
-//	float d=length( lvec ),atten=1.0/(1.0+d*d);
+//	float atten=1.0/(1.0+d*d);
 
 	return atten;
 }
@@ -34,7 +37,11 @@ void emitPbrFragment( vec3 color,float metalness,float roughness,vec3 position,v
 	vec3 lvec=r_LightViewMatrix[3].xyz-position;
 
 	float atten=pointAtten( length( lvec ),r_LightRange );
-
+	
+#ifdef GL_ES
+	if( atten!=atten ) return;
+#endif
+	
 	lvec=normalize( lvec );
 	
 #elif MX2_SPOTLIGHT

+ 2 - 0
modules/mojo3d/tests/room.monkey2

@@ -13,6 +13,8 @@ Using mojo3d..
 
 Function Main()
 	
+	SetConfig( "MOJO_OPENGL_PROFILE","es" )
+	
 	New AppInstance
 	
 	New MyWindow