得到了制服在e.g腳本着色器轉換爲JS着色
uniforms: {
"time": { type: "f", value: 0.0 }
},
其中例如不
屬性float customFrequency; 屬性vec3 customColor;走? TIA(剛纔添加的代碼,我想轉換)
<script type="x-shader/x-vertex" id="vertexshader">
uniform float time;
attribute float customFrequency;
attribute vec3 customColor;
varying vec3 vColor;
void main()
{
vColor = customColor;
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
gl_PointSize = size;
gl_Position = projectionMatrix * mvPosition;
}
</script>
<script type="x-shader/x-fragment" id="fragmentshader">
varying vec3 vColor;
void main()
{
gl_FragColor = vec4(vColor, 1.0);
gl_FragColor = gl_FragColor * texture2D(texture, gl_PointCoord);
}
</script>
道歉不制定這個問題非常好 - 想在
THREE.BasicShader = {
uniforms: {},
vertexShader: [
"void main() {",
"gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);",
"}"
].join("\n"),
fragmentShader: [
"void main() {",
"gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);",
"}"
].join("\n")
};
的形式來從上面的腳本threejs着色器,並不能找到一個使用頂點屬性的例子。 tia
這裏沒有問題。 – gaitat