更新2
我已经使用THREE.js实现了自定义属性,顶点着色器中的每次传递都会产生影响,并与position属性对齐,这是使用最少代码的最佳解决方案.
我稍后会添加这个例子
更新1
此方法将alpha设置为受边界框内速度范围影响的顶点.我需要提示处理GLSL代码重复变态,这对我来说有点奇怪吗?
我要用功能吗?怎么样?
https://jsfiddle.net/LeroyRon/uep9t1v1/#&togetherjs=MjBnNMFQFl
无论如何我有这个:
//for .x
if (position.x > 0.0) {
if (velocityPosition.x + (velocities.x*shutterSpeed) > boundingBoxMaxView.x) {
influence = position.x/boundingBoxMax.x;
velocityPosition.x += (velocities.x*shutterSpeed*influence);
}
} else if (position.x < 0.0) {
if (velocityPosition.x + (velocities.x*shutterSpeed) < boundingBoxMinView.x) {
influence = position.x/boundingBoxMin.x;
velocityPosition.x += (velocities.x*shutterSpeed);
}
}
//for .y
if (position.y > 0.0) {
//To-Do
} else if (position.y < 0.0) {
//To-Do
}
//for .z
if (position.z > 0.0) {
//To-Do
} else if (position.z …Run Code Online (Sandbox Code Playgroud)