this.material.updateShader = function(graphicsDevice) {
this.shader = new pc.Shader(graphicsDevice, {
attributes : {
vertex_position : “POSITION”
},
vshader : " attribute vec3 vertex_position;\n uniform mat4 matrix_model;\n uniform mat4 matrix_projection;\n uniform mat4 matrix_view;\n uniform mat3 matrix_normal;\n uniform float scale;\n varying vec2 vUv0;\n void main(void)\n {\n vec3 normal = normalize(matrix_normal * vec3(0, 1, 0));\n float d = max(0.0, (dot(vec3(matrix_view[0][2], matrix_view[1][2], matrix_view[2][2]), normal) - 0.6) * (1.0 / (1.0 - 0.6)));\n mat4 modelMatrix = matrix_view * matrix_model;\n modelMatrix[0][0] = 1.0;\n modelMatrix[0][1] = 0.0;\n modelMatrix[0][2] = 0.0;\n modelMatrix[1][0] = 0.0;\n modelMatrix[1][1] = 1.0;\n modelMatrix[1][2] = 0.0;\n modelMatrix[2][0] = 0.0;\n modelMatrix[2][1] = 0.0;\n modelMatrix[2][2] = 1.0;\n vec4 positionW = modelMatrix * vec4(vertex_position * scale * d, 1.0);\n gl_Position = matrix_projection * positionW;\n vUv0 = vertex_position.xy + vec2(0.5);\n vUv0.y = 1.0 - vUv0.y;\n }\n",
fshader : " precision highp float;\n varying vec2 vUv0;\n uniform float opacity;\n uniform sampler2D texture_diffuseMap;\n void main(void)\n {\n vec3 diffuse = texture2D(texture_diffuseMap, vUv0).rgb;\n if (diffuse.r * opacity < 0.001) discard;\n gl_FragColor = vec4(diffuse * opacity, 1.0);\n }\n"
});
};
Is there any compatibility between the vertex shader I wrote and the vertex shader invalidation in the latest basic library 1.65.3