/* * layout (std140, binding = 0) uniform Uniforms { * * mat4 viewProjection; * mat4 view; * mat4 projection; * * vec3 cameraPosition; * ivec3 floorCameraPosition; * vec3 decimalCameraPosition; * * vec3 sunlightDirection; * float viewDistanceSquared; * float viewDistanceOffsetSquared; * bool waterShader; * int millis; * float normalizedSpriteSize; * int spriteTextureLength; * vec2 windowsSize; * }; */ public void SetData(Camera camera, Vector3 sd, float vds, float vdos, bool ws, long ticks, float normalizedSpriteSize, int spriteTextureLength, Vector2i windowSize) { var cameraPos = camera.Position; var cameraPosI = new Vector3i((int)cameraPos.X, (int)cameraPos.Y, (int)cameraPos.Z); var cameraPosF = new Vector3((float)cameraPos.X, (float)cameraPos.Y, (float)cameraPos.Z); var offset = cameraPos - cameraPosI.ToDouble(); var offsetF = new Vector3((float)offset.X, (float)offset.Y, (float)offset.Z); _millis += (int)(ticks * 1000 / CMine.TicksPerSecond); _millis %= 1000000; _ubo.Orphan(); _ubo.Set(camera.Matrix * camera.Frustum.Matrix, 0); _ubo.Set(camera.Matrix, 1); _ubo.Set(camera.Frustum.Matrix, 2); _ubo.Set(cameraPosF, 3); _ubo.Set(cameraPosI, 4); _ubo.Set(offsetF, 5); _ubo.Set(sd, 6); _ubo.Set(vds, 7); _ubo.Set(vdos, 8); _ubo.Set(ws, 9); _ubo.Set(_millis, 10); _ubo.Set(normalizedSpriteSize, 11); _ubo.Set(spriteTextureLength, 12); _ubo.Set(windowSize.ToFloat(), 13); }