export default /* glsl */ ` #define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include attribute vec3 offset; attribute vec4 rotation; attribute vec3 size; #include #include #include #include #include #include #include #include #include #include void main() { #include 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 particleMatrix = 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); #include #include #include #include #include #include #include #include // replace defaultnormal_vertex vec3 transformedNormal = objectNormal; mat3 m = mat3( particleMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); transformedNormal = m * transformedNormal; transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif #include #include #include #include #include // replace include vec4 mvPosition = vec4( transformed, 1.0 ); mvPosition = modelViewMatrix * (particleMatrix * mvPosition); gl_Position = projectionMatrix * mvPosition; #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif } `;