+cxr_mdl_shader = gpu.types.GPUShader("""
+uniform mat4 modelMatrix;
+uniform mat4 viewProjectionMatrix;
+
+in vec3 aPos;
+in vec3 aNormal;
+
+out vec3 lPos;
+out vec3 lNormal;
+
+void main()
+{
+ vec4 pWorldPos = modelMatrix * vec4(aPos, 1.0);
+ vec3 worldPos = pWorldPos.xyz;
+
+ gl_Position = viewProjectionMatrix * pWorldPos;
+ lNormal = aNormal; //mat3(transpose(inverse(modelMatrix))) * aNormal;
+ lPos = worldPos;
+}
+""","""
+
+uniform vec4 colour;
+uniform vec3 testLightDir;
+
+in vec3 lNormal;
+in vec3 lPos;
+
+out vec4 FragColor;
+
+float SoftenCosineTerm( float flDot )
+{
+ return ( flDot + ( flDot * flDot ) ) * 0.5;
+}
+
+vec3 DiffuseTerm( vec3 worldNormal, vec3 lightDir )
+{
+ float fResult = 0.0;
+ float NDotL = dot( worldNormal, lightDir );
+
+ fResult = clamp( NDotL, 0.0, 1.0 );
+ fResult = SoftenCosineTerm( fResult );
+
+ vec3 fOut = vec3( fResult, fResult, fResult );
+ return fOut;
+}
+
+vec3 PixelShaderDoLightingLinear( vec3 worldPos, vec3 worldNormal )
+{
+ vec3 linearColor = vec3(0.0,0.0,0.0);
+ linearColor += DiffuseTerm( worldNormal, testLightDir );
+
+ return linearColor;
+}
+
+vec3 LinearToGamma( vec3 f3linear )
+{
+ return pow( f3linear, vec3(1.0 / 2.2) );
+}
+
+void main()
+{
+ vec3 tangentSpaceNormal = vec3( 0.0, 0.0, 1.0 );
+ vec4 normalTexel = vec4(1.0,1.0,1.0,1.0);
+ vec4 baseColor = colour;
+
+ //normalTexel = tex2D( BumpmapSampler, i.detailOrBumpTexCoord );
+ //tangentSpaceNormal = 2.0 * normalTexel - 1.0;
+
+ vec3 diffuseLighting = vec3( 1.0, 1.0, 1.0 );
+
+ vec3 staticLightingColor = vec3( 0.0, 0.0, 0.0 );
+ diffuseLighting = PixelShaderDoLightingLinear( lPos, lNormal );
+
+ // multiply by .5 since we want a 50% (in gamma space) reflective surface)
+ diffuseLighting *= pow( 0.5, 2.2 );
+
+ vec3 result = diffuseLighting * baseColor.xyz;
+
+ FragColor = vec4( LinearToGamma(result), 1.0 );
+}
+""")
+