mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
Enable GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
This commit is contained in:
21
gl/ubo.h
21
gl/ubo.h
@@ -3,9 +3,18 @@
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
#include "buffer.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#define UBS_PAD(x) uint8_t PAD[x]
|
||||
|
||||
// 12-byte vec3 for structs that must match an exact binary layout (UBOs, vertex data).
|
||||
// Stays packed regardless of GLM_FORCE_DEFAULT_ALIGNED_GENTYPES.
|
||||
// Guard prevents redefinition when stdafx.h also defines it.
|
||||
#ifndef PACKED_VEC3_DEFINED
|
||||
#define PACKED_VEC3_DEFINED
|
||||
using packed_vec3 = glm::vec<3, float, glm::packed_highp>;
|
||||
#endif
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class ubo : public buffer
|
||||
@@ -43,7 +52,7 @@ namespace gl
|
||||
glm::mat4 projection;
|
||||
glm::mat4 inv_view;
|
||||
glm::mat4 lightview[MAX_CASCADES];
|
||||
glm::vec3 cascade_end;
|
||||
packed_vec3 cascade_end;
|
||||
float time;
|
||||
glm::vec4 rain_params;
|
||||
glm::vec4 wiper_pos;
|
||||
@@ -88,13 +97,13 @@ namespace gl
|
||||
HEADLIGHTS
|
||||
};
|
||||
|
||||
glm::vec3 pos;
|
||||
packed_vec3 pos;
|
||||
type_e type;
|
||||
|
||||
glm::vec3 dir;
|
||||
packed_vec3 dir;
|
||||
float in_cutoff;
|
||||
|
||||
glm::vec3 color;
|
||||
packed_vec3 color;
|
||||
float out_cutoff;
|
||||
|
||||
float linear;
|
||||
@@ -113,10 +122,10 @@ namespace gl
|
||||
|
||||
struct light_ubs
|
||||
{
|
||||
glm::vec3 ambient;
|
||||
packed_vec3 ambient;
|
||||
UBS_PAD(4);
|
||||
|
||||
glm::vec3 fog_color;
|
||||
packed_vec3 fog_color;
|
||||
uint32_t lights_count;
|
||||
|
||||
light_element_ubs lights[MAX_LIGHTS];
|
||||
|
||||
Reference in New Issue
Block a user