Cogs.Core
ParameterBuffers.h
1#pragma once
2
3#include <glm/vec2.hpp>
4#include <glm/vec3.hpp>
5#include <glm/vec4.hpp>
6#include <glm/mat4x4.hpp>
7
8#include "Constants.h"
9
10#define COGS_SCENEFLAGS_NONE ( 0)
11#define COGS_SCENEFLAGS_OUTPUT_SRGB (1<<0)
12#define COGS_SCENEFLAGS_SUBMERGED (1<<1)
13
14namespace Cogs
15{
16 namespace Core
17 {
19 {
20 glm::mat4 projectionMatrix;
21 glm::mat4 viewMatrix;
22 glm::mat4 inverseViewMatrix;
23 glm::mat4 inverseProjectionMatrix;
24 glm::mat4 worldToClipMatrix;
25 glm::mat4 viewFromViewportMatrix;
26 glm::mat4 viewportFromViewMatrix;
27 glm::vec4 projectionParameters;
28 glm::vec4 clippingPlanes[6];
29 glm::vec4 originHigh;
30 glm::vec4 originLow;
31 glm::uvec4 blueNoiseOffset;
32 glm::vec2 viewportOrigin;
33 glm::vec2 viewportSize;
34 glm::vec2 viewportSizeRcp;
35 float shadowDepthClamp;
36 float animationTime;
37 float exposure;
38 unsigned sceneFlags;
39 unsigned clientFlags;
40 float numEnvironmentRadianceMips;
41 float numEnvironmentIrradianceMips;
42
43 float pack0;
44 float pack1;
45 float pack2;
46 };
47
49 glm::mat4 clipFromView;
50 glm::mat4 clipFromWorld;
51 glm::mat4 viewFromWorld;
52 glm::mat4 viewFromClip;
53 glm::mat4 worldFromView;
54 glm::mat4 viewFromViewport;
55 };
56
58 {
59 glm::vec4 _worldMatrix_row0;
60 glm::vec4 _worldMatrix_row1;
61 glm::vec4 _worldMatrix_row2;
62 uint32_t _objectId;
63 uint32_t _padding1;
64 uint32_t _padding2;
65 uint32_t _padding3;
66
67 void encodeWorldMatrix(const glm::mat4& worldMatrix)
68 {
69 _worldMatrix_row0 = glm::vec4(worldMatrix[0][0], worldMatrix[1][0], worldMatrix[2][0], worldMatrix[3][0]);
70 _worldMatrix_row1 = glm::vec4(worldMatrix[0][1], worldMatrix[1][1], worldMatrix[2][1], worldMatrix[3][1]);
71 _worldMatrix_row2 = glm::vec4(worldMatrix[0][2], worldMatrix[1][2], worldMatrix[2][2], worldMatrix[3][2]);
72 }
73
74 void encodeObjectId(uint32_t objectId)
75 {
76 _objectId = objectId;
77 }
78 };
79 static_assert(sizeof(ObjectBuffer) == 64);
80
82 {
83 glm::mat4 boneTransforms[256];
84 };
85
87 {
88 glm::vec4 lightPositions[kMaxLights];
89 glm::vec4 lightDirections[kMaxLights];
90 glm::vec4 lightColorIntensity[kMaxLights];
91 glm::vec4 lightParameters[kMaxLights];
92 uint32_t numLights[4];
93 glm::vec4 eyePosition;
94 glm::vec4 fogColor;
95 float fogDistance;
96 float fogAmount;
97 int fogEnabled;
98 float ambientIntensity;
99 glm::vec3 ambientColor;
100 float environmentBrightness;
101 float skyMultiplier;
102 int seaFlags;
103 int flags;
104
105 int pack3;
106 };
107
109 {
110 glm::vec4 cascadeLine;
111 glm::vec4 nearSplits;
112 glm::vec4 farSplits;
113 glm::mat4 lightMatrix[Cogs::Core::kMaxCascades];
114 float shadowSampleBias;
115 uint32_t numCascades;
116 int shadowsEnabled;
117 float texelSize;
118 };
119
121 {
122 glm::vec4 softShadowJitter[36]; // 36-tap samples in xy, 9-tap samples in zw.
123 ShadowData shadowData[kMaxLights];
124 glm::uvec4 cascadeOffsets[kMaxLights]; // hlsl array elements starts on 4*32-bit offsets.
125 };
126
128 {
129 SceneParameters scene;
130 LightBuffer light;
131 ShadowBuffer shadow;
132 };
133 }
134}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
unsigned clientFlags
Application defined, camera specific flags.