Added texture data format support

This commit is contained in:
2023-06-20 08:35:28 -07:00
parent 9aa6a0f529
commit 0b26b5a06a
20 changed files with 156 additions and 43 deletions

View File

@ -17,10 +17,10 @@ void SimpleBillboardedShader::compile() {
// Vertex Shader
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"layout (location = 1) in vec2 aTexCoord;\n"
"layout (location = 1) in vec2 aTexCoord;\n" +
RenderPipelineShaderBuffer::getShaderUniform() + ""
"uniform mat4 u_Proj;\n"
"uniform mat4 u_View;\n"
"uniform mat4 u_Model;\n"
"out vec2 o_TextCoord;\n"
@ -31,7 +31,7 @@ void SimpleBillboardedShader::compile() {
"vec3 right = normalize(cross(up, viewDirection));\n"
"up = normalize(cross(viewDirection, right));\n"
"vec3 billboardPosCam = vec3(u_View * vec4(billboardPos, 1.0));\n"
"gl_Position = u_Proj * vec4(billboardPosCam + (right * aPos.x + up * aPos.y), 1.0);\n"
"gl_Position = u_Projection * vec4(billboardPosCam + (right * aPos.x + up * aPos.y), 1.0);\n"
"o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n"
"}",
@ -53,10 +53,10 @@ void SimpleBillboardedShader::compile() {
);
#endif
this->paramProjection = this->getParameterByName("u_Proj");
this->paramView = this->getParameterByName("u_View");
this->paramModel = this->getParameterByName("u_Model");
this->paramColor = this->getParameterByName("u_Color");
this->paramTexture = this->getParameterByName("u_Text");
this->paramHasTexture = this->getParameterByName("u_HasTexture");
this->bufferRenderPipeline = this->getBufferLocationByName(RenderPipelineShaderBuffer::getShaderUniformName());
}

View File

@ -5,12 +5,12 @@
#pragma once
#include "display/shader/Shader.hpp"
#include "display/shader/buffers/RenderPipelineShaderBuffer.hpp"
namespace Dawn {
class SimpleBillboardedShader : public Shader {
public:
shaderparameter_t paramProjection;
shaderparameter_t paramView;
shaderbufferlocation_t bufferRenderPipeline;
shaderparameter_t paramModel;
shaderparameter_t paramColor;
shaderparameter_t paramTexture;