mirror of
https://github.com/molstar/molstar.git
synced 2026-06-04 13:30:24 +08:00
Fix head rotation for clip-space billboard offset
This commit is contained in:
@@ -103,12 +103,13 @@ void main(void){
|
||||
cornerOffset.y += offsetY;
|
||||
|
||||
if (uHasHeadRotation) {
|
||||
cornerOffset = (uInvHeadRotation * vec4(cornerOffset, 0.0, 0.0)).xy;
|
||||
vec3 rotatedOffset = (uInvHeadRotation * vec4(cornerOffset, 0.0, 0.0)).xyz;
|
||||
clip += uProjection * vec4(rotatedOffset, 0.0);
|
||||
} else {
|
||||
// apply offset in clip space to avoid perspective distortion on the quad
|
||||
clip.xy += vec2(uProjection[0][0], uProjection[1][1]) * cornerOffset;
|
||||
}
|
||||
|
||||
// apply offset in clip space to avoid perspective distortion on the quad
|
||||
clip.xy += vec2(uProjection[0][0], uProjection[1][1]) * cornerOffset;
|
||||
|
||||
gl_Position = clip;
|
||||
|
||||
vViewPosition = -mvCenter.xyz;
|
||||
|
||||
Reference in New Issue
Block a user