这是我的第一篇文章,所以如果我错过任何事情,请告诉我...
我试图在X3DOM中使用ComposedShader来更改点云中点的大小。我的着色器在PointSet或X3DOM示例BinaryGeometry上均可正常工作,但不适用于我自己的BinaryGeometry数据(点云未显示)。我的点云可以不使用着色器或使用“材质”来渲染。
控制台中没有显示任何消息,我真的不知道可能出什么问题了,除了我的点云中有很多点(1146222 ...实际上不是那么大...)。
Here is the shader's effect on X3DOM's demo data
这是我代码的核心部分:
<Appearance>
<ComposedShader>
<!-- The "display:none;" CSS attribute is just a trick to prevent the browser from rendering the shader code during page loading -->
<ShaderPart type='VERTEX' style="display:none;">
attribute vec3 position;
attribute vec3 color;
uniform mat4 modelViewProjectionmatrix;
varying vec3 col;
void main()
{
gl_Position = modelViewProjectionmatrix * vec4(position,1.0);
gl_PointSize = max( 200.0 / gl_Position.w,1.0);
col = color;
}
</ShaderPart>
<ShaderPart type='FRAGMENT' style="display:none;">
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform vec3 light0_Direction;
uniform sampler2D u_texture;
varying vec3 col;
void main()
{
gl_FragColor = vec4(col,1.0);
}
</ShaderPart>
</ComposedShader>
</Appearance>
<binaryGeometry id="bg0" DEF='BG_0'
vertexCount='1146222'
primType='"POINTS"'
position='247.080001831 126.869995117 -19.8899993896'
size='563.619995117 505.299987793 84.7600021362'
coord='aopt50BG_0_coordBinary.bin+8'
color='aopt50BG_0_colorBinary.bin+4'
coordType='Int16' colorType='Uint8'>
</binaryGeometry>
</shape>