提交 abf63b05 编写于 作者: B bdysvik

Proper prefixing of uniforms and attributes. Add 'color' to the attribreplaceTHREEShaderAttributes.

上级 50b2d2f7
...@@ -486,6 +486,13 @@ THREE.GLTFLoader = ( function () { ...@@ -486,6 +486,13 @@ THREE.GLTFLoader = ( function () {
shaderText = shaderText.replace( regEx, 'uv' ); shaderText = shaderText.replace( regEx, 'uv' );
break; break;
case 'COLOR_0':
case 'COLOR0':
case 'COLOR':
shaderText = shaderText.replace( regEx, 'color' );
break;
case "WEIGHT": case "WEIGHT":
shaderText = shaderText.replace( regEx, 'skinWeight' ); shaderText = shaderText.replace( regEx, 'skinWeight' );
...@@ -1758,4 +1765,4 @@ THREE.GLTFLoader = ( function () { ...@@ -1758,4 +1765,4 @@ THREE.GLTFLoader = ( function () {
return GLTFLoader; return GLTFLoader;
} )(); } )();
\ No newline at end of file
precision highp float; precision highp float;
attribute vec3 position; attribute vec3 a_position;
attribute vec3 color; attribute vec3 a_color;
varying vec3 v_color; varying vec3 v_color;
uniform mat4 modelViewMatrix; uniform mat4 u_modelViewMatrix;
uniform mat4 projectionMatrix; uniform mat4 u_projectionMatrix;
void main(void) { void main(void) {
vec4 pos = modelViewMatrix * vec4(position,1.0); vec4 pos = u_modelViewMatrix * vec4(position,1.0);
v_color = color; v_color = a_color;
gl_Position = projectionMatrix * pos; gl_Position = u_projectionMatrix * pos;
} }
\ No newline at end of file
...@@ -158,8 +158,8 @@ ...@@ -158,8 +158,8 @@
}, },
"program": "meshProgram", "program": "meshProgram",
"uniforms": { "uniforms": {
"modelViewMatrix": "modelViewMatrixParameter", "u_modelViewMatrix": "modelViewMatrixParameter",
"projectionMatrix": "projectionMatrixParameter" "u_projectionMatrix": "projectionMatrixParameter"
}, },
"states": { "states": {
"enable": [ "enable": [
......
precision highp float; precision highp float;
attribute vec3 position; attribute vec3 a_position;
attribute vec3 color; attribute vec3 a_color;
varying vec3 v_color; varying vec3 v_color;
uniform mat4 modelViewMatrix; uniform mat4 u_modelViewMatrix;
uniform mat4 projectionMatrix; uniform mat4 u_projectionMatrix;
void main(void) { void main(void) {
vec4 pos = modelViewMatrix * vec4(position,1.0); vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
v_color = color; v_color = a_color;
gl_Position = projectionMatrix * pos; gl_Position = u_projectionMatrix * pos;
} }
\ No newline at end of file
...@@ -181,8 +181,8 @@ ...@@ -181,8 +181,8 @@
}, },
"program": "meshProgram", "program": "meshProgram",
"uniforms": { "uniforms": {
"modelViewMatrix": "modelViewMatrixParameter", "u_modelViewMatrix": "modelViewMatrixParameter",
"projectionMatrix": "projectionMatrixParameter" "u_projectionMatrix": "projectionMatrixParameter"
}, },
"states": { "states": {
"enable": [ "enable": [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册