Last active
January 22, 2023 18:59
-
-
Save mohsenheydari/099eaca26af77af4b9e47281710c0953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attribute vec4 instancePosition; | |
attribute float instanceAngle; | |
varying vec2 vUV; | |
void main(){ | |
vUV = uv; | |
vec3 rotatedPosition = position; | |
rotatedPosition.x = cos( instanceAngle ) * position.x - sin( instanceAngle ) * position.y; | |
rotatedPosition.y = sin( instanceAngle ) * position.x + cos( instanceAngle ) * position.y; | |
float scale = instancePosition.w; | |
rotatedPosition *= scale; | |
vec4 mvPosition = modelViewMatrix * vec4(instancePosition.xyz, 1); | |
mvPosition.xyz += rotatedPosition; | |
gl_Position = projectionMatrix * mvPosition; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment