Working on shader stuff

This commit is contained in:
2025-02-25 16:30:35 -06:00
parent 4ff3cf6c5c
commit c29d435b06
17 changed files with 157 additions and 22 deletions

View File

@ -0,0 +1,16 @@
// Copyright (c) 2025 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../fragments/quad.glsl"
#include "../../../../dusk/overworld/overworlddefs.h"
struct Entity {
vec2 position;
};
layout(std140) uniform b_Entities {
Entity entities[OVERWORLD_ENTITY_COUNT_MAX];
uint entityCount;
};

View File

@ -1,4 +1,10 @@
// Copyright (c) 2025 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../fragments/header.glsl"
#include "entity.glsl"
// Inputs from vertex shader
in vec2 v_TextureCoord;

View File

@ -1,6 +1,12 @@
// Copyright (c) 2025 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../fragments/header.glsl"
#include "../fragments/transforms.glsl"
#include "../fragments/quad.glsl"
#include "entity.glsl"
// Outputs to fragment shader
out vec2 v_TextureCoord;

View File

@ -10,7 +10,7 @@
#include "entityshader.h"
#include "entity_vert.glsl.h"
#include "entity_frag.glsl.h"
#include "display/shader/fragments/transforms.h"
#include "display/shader/data/transforms.h"
entityshader_t ENTITY_SHADER;
@ -30,11 +30,13 @@ void entityShaderInit() {
);
// Uniforms
// Bind
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, ENTITY_SHADER.transformsBlock);
}
void entityShaderUse() {
shaderUse(&ENTITY_SHADER.shader);
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, ENTITY_SHADER.transformsBlock);
}
void entityShaderDispose() {

View File

@ -11,7 +11,7 @@
typedef struct {
shader_t shader;
// GLuint dataBlock;
GLuint entitiesBlock;
GLuint transformsBlock;
// GLuint tilesetsBlock;