我有大量随机放置的圆圈保存在单个缓冲区几何中。我正在尝试根据来自它们中心的音频输入来缩放每一个,但它们会一直在场景中心进行缩放。它们不会变得更大的半径并保持静止,而是会变得更大,但也会远离中心。
uniform float scale;
varying vec3 color;
void main()
{
mat4 sPos = mat4(vec4(scale,0.0,0.0,0.0),
vec4(0.0,scale,0.0,0.0),
vec4(0.0,0.0,1.0,0.0),
vec4(0.0,0.0,0.0,1.0));
vec3 pos = position * normal;
vec4 modelViewPosition = modelViewMatrix * sPos * vec4(pos, 1.0) ;
gl_Position = projectionMatrix * modelViewPosition;
}
这就是我正在尝试的。是否有一个矩阵变换可以将原点移动到每个圆的中心而不会弄乱场景的其他方面?