// This file contains declared uniform and part attributes // needed for all MetarealObject things. It's the spatial, 3d part, // so that multiple materials will align dimensionally. // // This is included by the Vertex Shaders. uniform float yRatio; // height/width uniform float eyePos; uniform mat4 cameraMatrix; uniform float zNear = 0.1; uniform float zFar = 500.0; in vec3 pos; // part attrs uniform sampler2D partValues; uniform float partIndex_translate; // vec4 as x, y, z, scale uniform float partIndex_rotate; // quaternion in float partSlot; out vec3 modelPosV; // raw model coordinates, xyz as given out vec3 worldPosV; // model coordinates after part transformation out vec3 viewPosV; // model coordinates relative to camera vec3 rotateByQuaternion(vec3 p, vec4 q) { return p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p); }