export default /* glsl */ ` #include #include #include #include #include #include attribute vec3 offset; attribute vec4 rotation; attribute vec3 size; // attribute vec4 color; void main() { float x2 = rotation.x + rotation.x, y2 = rotation.y + rotation.y, z2 = rotation.z + rotation.z; float xx = rotation.x * x2, xy = rotation.x * y2, xz = rotation.x * z2; float yy = rotation.y * y2, yz = rotation.y * z2, zz = rotation.z * z2; float wx = rotation.w * x2, wy = rotation.w * y2, wz = rotation.w * z2; float sx = size.x, sy = size.y, sz = size.z; mat4 matrix = mat4(( 1.0 - ( yy + zz ) ) * sx, ( xy + wz ) * sx, ( xz - wy ) * sx, 0.0, // 1. column ( xy - wz ) * sy, ( 1.0 - ( xx + zz ) ) * sy, ( yz + wx ) * sy, 0.0, // 2. column ( xz + wy ) * sz, ( yz - wx ) * sz, ( 1.0 - ( xx + yy ) ) * sz, 0.0, // 3. column offset.x, offset.y, offset.z, 1.0); vec4 mvPosition = modelViewMatrix * (matrix * vec4( position, 1.0 )); vColor = color; gl_Position = projectionMatrix * mvPosition; #include #include #include #include } `;