Browse Source

Mojo3d forward renderer fixes.

Mark Sibly 7 years ago
parent
commit
2f8c1c365b

+ 1 - 1
modules/mojo3d/assets/shaders/imports/std.glsl

@@ -362,7 +362,7 @@ vec3 sampleEnv( vec3 viewVec,float roughness ){
 	}
 }
 
-#if MX2_FORWARDPASS
+#if MX2_FORWARDRENDERER || MX2_FORWARDPASS
 
 void emitLinearFragment( vec4 color ){
 

+ 1 - 1
modules/mojo3d/assets/shaders/materials/pbr-default.glsl

@@ -1,5 +1,5 @@
 
-//@renderpasses 1,7,11,15,2,6,10,14
+//@renderpasses 1,7,11,15,2,6,10,14,22,26,30
 
 //@import "pbr"
 

+ 1 - 1
modules/mojo3d/assets/shaders/misc/skybox.glsl

@@ -40,6 +40,6 @@ void main(){
 	gl_FragData[1]=vec4( 0.0,0.0,0.0,1.0 );				//color_m
 	gl_FragData[2]=vec4( 0.5,0.5,0.5,1.0 );				//normal_r
 #else
-	emitLinearFragment( frag,1.0 );
+	emitLinearFragment( vec4( frag,1.0 ) );
 #endif
 }

+ 8 - 1
modules/mojo3d/render/renderer.monkey2

@@ -249,9 +249,16 @@ When a new renderer is created, the config setting `MOJO3D\_RENDERER` can be use
 				renderPass|=12
 			End
 			
+			Local lvmatrix:=_viewMatrix * light.Matrix
+			
+			_runiforms.SetMat4f( "LightViewMatrix",lvmatrix )
+			_runiforms.SetMat4f( "InverseLightViewMatrix",-lvmatrix )
 			_runiforms.SetColor( "LightColor",light.Color )
 			_runiforms.SetFloat( "LightRange",light.Range )
-			_runiforms.SetMat4f( "LightViewMatrix",_viewMatrix * light.Matrix )
+			_runiforms.SetFloat( "LightInnerAngle",light.InnerAngle*Pi/180.0 )
+			_runiforms.SetFloat( "LightOuterAngle",light.OuterAngle*Pi/180.0 )
+			_runiforms.SetTexture( "LightCubeTexture",light.Texture ?Else _whiteCubeTexture )
+			_runiforms.SetTexture( "LightTexture",light.Texture ?Else _whiteTexture )
 
 			_gdevice.ColorMask=ColorMask.All
 			_gdevice.DepthMask=first