Bit of cleanup.

This commit is contained in:
2023-11-01 23:08:20 -05:00
parent d530210bed
commit c4032b4a84
32 changed files with 212 additions and 162 deletions

View File

@ -18,21 +18,28 @@ RenderManager::RenderManager(DawnGame *game) :
void RenderManager::init() {
// Lock the common shaders
this->lockSimpleTextured = this->shaderManager.lockShader<SimpleTexturedShader>();
this->simpleTexturedShader = this->shaderManager.getShader<SimpleTexturedShader>(this->lockSimpleTextured);
lockSimpleTextured = shaderManager.lockShader<SimpleTexturedShader>();
simpleTexturedShader = shaderManager.getShader<SimpleTexturedShader>(
lockSimpleTextured
);
this->lockUIShaderProgram = this->shaderManager.lockShader<UIShader>();
this->uiShader = this->shaderManager.getShader<UIShader>(this->lockUIShaderProgram);
lockUIShaderProgram = shaderManager.lockShader<UIShader>();
uiShader = shaderManager.getShader<UIShader>(lockUIShaderProgram);
this->lockFontShader = this->shaderManager.lockShader<FontShader>();
this->fontShader = this->shaderManager.getShader<FontShader>(this->lockFontShader);
this->renderPipeline.init();
lockFontShader = shaderManager.lockShader<FontShader>();
fontShader = shaderManager.getShader<FontShader>(lockFontShader);
renderPipeline.init();
assertNoGLError();
// Prepare the initial values
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
assertNoGLError();
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendFuncSeparate(
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA,
GL_ONE,
GL_ONE_MINUS_SRC_ALPHA
);
assertNoGLError();
glDepthMask(GL_TRUE);
assertNoGLError();
@ -41,19 +48,19 @@ void RenderManager::init() {
}
RenderTarget * RenderManager::getBackBuffer() {
return &this->backBuffer;
return &backBuffer;
}
RenderPipeline * RenderManager::getRenderPipeline() {
return &this->renderPipeline;
return &renderPipeline;
}
ShaderManager * RenderManager::getShaderManager() {
return &this->shaderManager;
return &shaderManager;
}
void RenderManager::setRenderFlags(renderflag_t flags) {
this->renderFlags = flags;
renderFlags = flags;
if((flags & RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST) == 0) {
glDisable(GL_DEPTH_TEST);
@ -75,7 +82,7 @@ void RenderManager::update() {
}
RenderManager::~RenderManager() {
this->shaderManager.releaseShader<SimpleTexturedShader>(this->lockSimpleTextured);
this->shaderManager.releaseShader<UIShader>(this->lockUIShaderProgram);
this->shaderManager.releaseShader<FontShader>(this->lockFontShader);
shaderManager.releaseShader<SimpleTexturedShader>(lockSimpleTextured);
shaderManager.releaseShader<UIShader>(lockUIShaderProgram);
shaderManager.releaseShader<FontShader>(lockFontShader);
}

View File

@ -4,6 +4,8 @@
// https://opensource.org/licenses/MIT
#include "Texture.hpp"
#include "assert/assertgl.hpp"
#include "util/memory.hpp"
using namespace Dawn;
@ -18,7 +20,7 @@ Texture::Texture() : ITexture() {
}
void Texture::bind(textureslot_t slot) {
assertTrue(this->id != -1, "Texture::bind: Texture is not ready!");
assertTrue(this->id != -1, "Texture is not ready!");
glActiveTexture(GL_TEXTURE0 + slot);
assertNoGLError();
glBindTexture(GL_TEXTURE_2D, this->id);
@ -50,12 +52,10 @@ void Texture::setSize(
this->id = -1;
}
#if DAWN_DEBUG_BUILD
int32_t maxSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize);
assertTrue(width > 0 && width <= maxSize, "Texture::setSize: Width is out of bounds!");
assertTrue(height > 0 && height <= maxSize, "Texture::setSize: Height is out of bounds!");
#endif
int32_t maxSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize);
assertTrue(width > 0 && width <= maxSize, "Width is out of bounds!");
assertTrue(height > 0 && height <= maxSize, "Height is out of bounds!");
this->width = width;
this->height = height;
@ -64,8 +64,8 @@ void Texture::setSize(
glGenTextures(1, &this->id);
assertNoGLError();
if(this->id <= 0) throw "Texture generation failed!";
if(this->id <= 0) assertUnreachable("Texture generation failed!");
// Initialize the texture to blank
glActiveTexture(GL_TEXTURE0);
assertNoGLError();
@ -112,7 +112,7 @@ void Texture::updateTextureProperties() {
break;
default:
assertUnreachable("Texture::updateTextureProperties: Unknown wrap mode!");
assertUnreachable("Unknown wrap mode!");
}
assertNoGLError();
};
@ -128,51 +128,31 @@ void Texture::updateTextureProperties() {
switch(filter) {
case TEXTURE_FILTER_MODE_NEAREST: {
glTexParameteri(GL_TEXTURE_2D, minMag, GL_NEAREST);
// switch(mapFilterMode) {
// case TEXTURE_FILTER_MODE_NEAREST:
// glTexParameteri(GL_TEXTURE_2D, minMag, GL_NEAREST_MIPMAP_NEAREST);
// break;
// case TEXTURE_FILTER_MODE_LINEAR:
// glTexParameteri(GL_TEXTURE_2D, minMag, GL_LINEAR_MIPMAP_NEAREST);
// break;
// default:
// assertUnreachable();
// }
break;
}
case TEXTURE_FILTER_MODE_LINEAR: {
glTexParameteri(GL_TEXTURE_2D, minMag, GL_LINEAR);
// switch(mapFilterMode) {
// case TEXTURE_FILTER_MODE_NEAREST:
// glTexParameteri(GL_TEXTURE_2D, minMag, GL_NEAREST_MIPMAP_LINEAR);
// break;
// case TEXTURE_FILTER_MODE_LINEAR:
// glTexParameteri(GL_TEXTURE_2D, minMag, GL_LINEAR_MIPMAP_LINEAR);
// break;
// default:
// assertUnreachable();
// }
break;
}
default: {
assertUnreachable("Texture::updateTextureProperties: Unknown filter mode!");
assertUnreachable("Unknown filter mode!");
}
}
assertNoGLError();
};
setFilterMode(GL_TEXTURE_MIN_FILTER, this->filterModeMin, this->mipmapFilterModeMin);
setFilterMode(GL_TEXTURE_MAG_FILTER, this->filterModeMag, this->mipmapFilterModeMag);
setFilterMode(
GL_TEXTURE_MIN_FILTER, this->filterModeMin, this->mipmapFilterModeMin
);
setFilterMode(
GL_TEXTURE_MAG_FILTER, this->filterModeMag, this->mipmapFilterModeMag
);
}
void Texture::bufferRaw(void *data) {
assertTrue(this->isReady(), "Texture::bufferRaw: Texture is not ready!");
assertTrue(this->isReady(), "Texture is not ready!");
GLenum format;
switch(this->format) {
@ -193,7 +173,7 @@ void Texture::bufferRaw(void *data) {
break;
default:
assertUnreachable("Texture::bufferRaw: Unknown texture format!");
assertUnreachable("Unknown texture format!");
}
GLenum dataFormat;
@ -207,7 +187,7 @@ void Texture::bufferRaw(void *data) {
break;
default:
assertUnreachable("Texture::bufferRaw: Unknown texture data format!");
assertUnreachable("Unknown texture data format!");
}
glBindTexture(GL_TEXTURE_2D, this->id);
@ -224,18 +204,30 @@ void Texture::bufferRaw(void *data) {
}
void Texture::buffer(struct ColorU8 pixels[]) {
assertTrue(this->dataFormat == TEXTURE_DATA_FORMAT_UNSIGNED_BYTE, "Texture::buffer: Texture data format must be unsigned byte!");
assertTrue(
this->dataFormat == TEXTURE_DATA_FORMAT_UNSIGNED_BYTE,
"Texture data format must be unsigned byte!"
);
this->bufferRaw((void*)pixels);
}
void Texture::buffer(struct Color pixels[]) {
assertTrue(this->dataFormat == TEXTURE_DATA_FORMAT_FLOAT, "Texture::buffer: Texture data format must be float!");
assertTrue(this->format == TEXTURE_FORMAT_RGBA, "Texture::buffer: Texture format must be RGBA!");
assertTrue(
this->dataFormat == TEXTURE_DATA_FORMAT_FLOAT,
"Texture data format must be float!"
);
assertTrue(
this->format == TEXTURE_FORMAT_RGBA,
"Texture format must be RGBA!"
);
this->bufferRaw((void*)pixels);
}
void Texture::buffer(uint8_t pixels[]) {
assertTrue(this->dataFormat == TEXTURE_DATA_FORMAT_UNSIGNED_BYTE, "Texture::buffer: Texture data format must be unsigned byte!");
assertTrue(
this->dataFormat == TEXTURE_DATA_FORMAT_UNSIGNED_BYTE,
"Texture data format must be unsigned byte!"
);
this->bufferRaw((void*)pixels);
}

View File

@ -5,9 +5,7 @@
#pragma once
#include "dawnopengl.hpp"
#include "assert/assertgl.hpp"
#include "display/_Texture.hpp"
#include "util/memory.hpp"
#include "display/ITexture.hpp"
namespace Dawn {
class TextureRenderTarget;

View File

@ -4,6 +4,7 @@
// https://opensource.org/licenses/MIT
#include "TextureRenderTarget.hpp"
#include "assert/assertgl.hpp"
using namespace Dawn;

View File

@ -98,12 +98,12 @@ void Mesh::disposeBuffers() {
}
void Mesh::bufferPositions(int32_t pos, glm::vec3 *positions, int32_t len) {
assertNotNull(positions, "Mesh::bufferPositions: Positions cannot be null");
assertTrue(pos >= 0 && pos < this->verticeCount, "Mesh::bufferPositions: Position must be within range");
assertTrue(pos+len <= this->verticeCount, "Mesh::bufferPositions: Position + Length must be within range");
assertTrue(len > 0, "Mesh::bufferPositions: Length must be greater than zero");
assertNotNull(positions, "Positions cannot be null");
assertTrue(pos >= 0 && pos < verticeCount, "Position must be within range");
assertTrue(pos+len <= verticeCount, "Position + Length must be within range");
assertTrue(len > 0, "Length must be greater than zero");
glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
assertNoGLError();
glBufferSubData(
GL_ARRAY_BUFFER,
@ -115,10 +115,10 @@ void Mesh::bufferPositions(int32_t pos, glm::vec3 *positions, int32_t len) {
}
void Mesh::bufferCoordinates(int32_t pos, glm::vec2 *coordinates, int32_t len) {
assertNotNull(coordinates, "Mesh::bufferCoordinates: Coordinates cannot be null");
assertTrue(pos >= 0 && pos < this->verticeCount, "Mesh::bufferCoordinates: Position must be within range");
assertTrue(pos+len <= this->verticeCount, "Mesh::bufferCoordinates: Position + Length must be within range");
assertTrue(len > 0, "Mesh::bufferCoordinates: Length must be greater than zero");
assertNotNull(coordinates, "Coordinates cannot be null");
assertTrue(pos >= 0 && pos < verticeCount, "Position must be within range");
assertTrue(pos+len <= verticeCount, "Position + Length must be within range");
assertTrue(len > 0, "Length must be greater than zero");
auto offsetCoordinates = (
(sizeof(glm::vec3) * this->verticeCount) +
@ -137,12 +137,12 @@ void Mesh::bufferCoordinates(int32_t pos, glm::vec2 *coordinates, int32_t len) {
}
void Mesh::bufferIndices(int32_t pos, meshindice_t *indices, int32_t len) {
assertNotNull(indices, "Mesh::bufferIndices: Indices cannot be null");
assertTrue(pos >= 0 && pos < this->indiceCount, "Mesh::bufferIndices: Position must be within range");
assertTrue(pos+len <= this->indiceCount, "Mesh::bufferIndices: Position + Length must be within range");
assertTrue(len > 0, "Mesh::bufferIndices: Length must be greater than zero");
assertNotNull(indices, "Indices cannot be null");
assertTrue(pos >= 0 && pos < indiceCount, "Position must be within range");
assertTrue(pos+len <= indiceCount, "Position + Length must be within range");
assertTrue(len > 0, "Length must be greater than zero");
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
assertNoGLError();
glBufferSubData(
GL_ELEMENT_ARRAY_BUFFER,

View File

@ -30,8 +30,7 @@ void Shader::compileShader(
if(!isSuccess) {
glGetShaderiv(this->shaderVertex, GL_INFO_LOG_LENGTH, &maxLength);
glGetShaderInfoLog(this->shaderVertex, maxLength, &maxLength, error);
debugMessage("Error compiling vert shader");
debugMessage(error);
assertUnreachable("Error compiling vert shader %s", error);
throw error;
}
assertNoGLError();
@ -46,16 +45,15 @@ void Shader::compileShader(
glGetShaderiv(this->shaderFrag, GL_INFO_LOG_LENGTH, &maxLength);
glGetShaderInfoLog(this->shaderFrag, maxLength, &maxLength, error);
glDeleteShader(this->shaderVertex);
debugMessage("Error compiling frag shader");
debugMessage(error);
assertUnreachable("Error compiling frag shader %s", error);
throw error;
}
assertNoGLError();
// Now create the shader program.
this->shaderProgram = glCreateProgram();
glAttachShader(this->shaderProgram, this->shaderVertex);
glAttachShader(this->shaderProgram, this->shaderFrag);
shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, shaderVertex);
glAttachShader(shaderProgram, shaderFrag);
assertNoGLError();
// Now parse out the variables.
@ -75,8 +73,7 @@ void Shader::compileShader(
glGetProgramInfoLog(this->shaderProgram, maxLength, &maxLength, error);
glDeleteShader(this->shaderVertex);
glDeleteShader(this->shaderFrag);
debugMessage("Error compiling shader program");
debugMessage(error);
assertUnreachable("Error compiling shader program %s", error);
throw error;
}
assertNoGLError();
@ -101,7 +98,10 @@ shaderbufferlocation_t Shader::getBufferLocationByName(std::string name) {
return glGetUniformBlockIndex(this->shaderProgram, name.c_str());
}
void Shader::setParameterBuffer(shaderbufferlocation_t location, shaderbufferslot_t slot) {
void Shader::setParameterBuffer(
shaderbufferlocation_t location,
shaderbufferslot_t slot
) {
glUniformBlockBinding(this->shaderProgram, location, slot);
assertNoGLError();
}
@ -132,13 +132,13 @@ void Shader::setFloat(shaderparameter_t param, float_t value) {
}
void Shader::bind() {
assertTrue(this->shaderProgram != -1, "Shader::bind: Cannot bind a program that is not ready");
glUseProgram(this->shaderProgram);
assertTrue(shaderProgram != -1, "Cannot bind a program that is not ready");
glUseProgram(shaderProgram);
assertNoGLError();
}
Shader::~Shader() {
if(this->shaderProgram != -1) glDeleteProgram(this->shaderProgram);
if(this->shaderVertex != -1) glDeleteShader(this->shaderVertex);
if(this->shaderFrag != -1) glDeleteShader(this->shaderFrag);
if(shaderProgram != -1) glDeleteProgram(shaderProgram);
if(shaderVertex != -1) glDeleteShader(shaderVertex);
if(shaderFrag != -1) glDeleteShader(shaderFrag);
}

View File

@ -4,10 +4,8 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "display/shader/_Shader.hpp"
#include "display/shader/IShader.hpp"
#include "dawnopengl.hpp"
#include "display/Color.hpp"
#include "debug/debug.hpp"
typedef GLuint shaderparameter_t;
@ -66,12 +64,18 @@ namespace Dawn {
virtual void compile() override = 0;
void bind() override;
void setParameterBuffer(shaderbufferlocation_t location, shaderbufferslot_t slot);
void setParameterBuffer(
shaderbufferlocation_t location,
shaderbufferslot_t slot
);
void setMatrix(shaderparameter_t parameter, glm::mat4 matrix) override;
void setBoolean(shaderparameter_t parameter, bool_t value) override;
void setColor(shaderparameter_t parameter, struct Color color) override;
void setVector3(shaderparameter_t parameter, glm::vec3 vector) override;
void setTexture(shaderparameter_t parameter, textureslot_t texture) override;
void setTexture(
shaderparameter_t parameter,
textureslot_t texture
) override;
void setFloat(shaderparameter_t parameter, float_t value) override;
/**

View File

@ -5,7 +5,7 @@
#pragma once
#include "dawnopengl.hpp"
#include "display/shader/_ShaderParameterBuffer.hpp"
#include "display/shader/IShaderParameterBuffer.hpp"
#include "ShaderParameterBufferTypes.hpp"
namespace Dawn {
@ -13,14 +13,19 @@ namespace Dawn {
typedef GLuint shaderbufferlocation_t;
template<typename T>
class ShaderParameterBuffer : public IShaderParameterBuffer<shaderbufferslot_t> {
class ShaderParameterBuffer :
public IShaderParameterBuffer<shaderbufferslot_t>
{
protected:
shaderbufferlocation_t id = -1;
size_t size;
public:
void init() {
assertTrue(this->id == -1, "ShaderParameterBuffer::init: ShaderParameterBuffer is already initialized!");
assertTrue(
this->id == -1,
"ShaderParameterBuffer is already initialized!"
);
this->size = sizeof(T);
glGenBuffers(1, &this->id);
assertNoGLError();
@ -46,7 +51,7 @@ namespace Dawn {
}
void bind(shaderbufferslot_t location) override {
assertTrue(this->isReady(), "ShaderParameterBuffer::bind: ShaderParameterBuffer is not ready!");
assertTrue(this->isReady(), "ShaderParameterBuffer is not ready!");
glBindBuffer(GL_UNIFORM_BUFFER, this->id);
assertNoGLError();
glBindBufferBase(GL_UNIFORM_BUFFER, location, this->id);
@ -71,10 +76,12 @@ namespace Dawn {
* @param length Length of the data to buffer.
*/
void bufferRaw(void *data, size_t start, size_t length) {
assertTrue(this->isReady(), "ShaderParameterBuffer::bufferRaw: ShaderParameterBuffer is not ready!");
assertTrue(this->isReady(), "ShaderParameterBuffer is not ready!");
glBindBuffer(GL_UNIFORM_BUFFER, this->id);
assertNoGLError();
glBufferSubData(GL_UNIFORM_BUFFER, start, length, (void*)((size_t)data + start));
glBufferSubData(
GL_UNIFORM_BUFFER, start, length, (void*)((size_t)data + start)
);
assertNoGLError();
}

View File

@ -63,7 +63,9 @@ void SimpleTexturedShader::compile() {
"float4 out gl_Position : POSITION\n"
") {\n"
"o_TextCoord = aTexCoord;\n"
"gl_Position = mul(mul(mul(float4(aPos, 1.0), u_Model), u_View), u_Proj);\n"
"gl_Position = mul(\n"
"mul(mul(float4(aPos, 1.0), u_Model), u_View), u_Proj\n"
");\n"
"}",
// Fragment Shader
@ -91,5 +93,7 @@ void SimpleTexturedShader::compile() {
this->paramColor = this->getParameterByName("u_Color");
this->paramTexture = this->getParameterByName("u_Text");
this->paramHasTexture = this->getParameterByName("u_HasTexture");
this->bufferRenderPipeline = this->getBufferLocationByName(RenderPipelineShaderBuffer::getShaderUniformName());
this->bufferRenderPipeline = this->getBufferLocationByName(
RenderPipelineShaderBuffer::getShaderUniformName()
);
}

View File

@ -15,27 +15,31 @@ SimpleBillboardedMaterial::SimpleBillboardedMaterial(SceneItem *i) :
}
void SimpleBillboardedMaterial::onStart() {
this->shaderLock = this->getGame()->renderManager.getShaderManager()->lockShader<SimpleBillboardedShader>();
this->shaderLock = getShaderManager().lockShader<SimpleBillboardedShader>();
}
void SimpleBillboardedMaterial::onDispose() {
this->getGame()->renderManager.getShaderManager()->releaseShader<SimpleBillboardedShader>(this->shaderLock);
getShaderManager().releaseShader<SimpleBillboardedShader>(this->shaderLock);
}
std::vector<struct ShaderPassItem> SimpleBillboardedMaterial::getRenderPasses(IRenderableContext &context) {
auto mesh = this->item->getComponent<MeshRenderer>();
auto shader = this->getGame()->renderManager.getShaderManager()->getShader<SimpleBillboardedShader>(this->shaderLock);
std::vector<struct ShaderPassItem>
SimpleBillboardedMaterial::getRenderPasses(IRenderableContext &context)
{
auto mesh = item->getComponent<MeshRenderer>();
auto shader = getShaderManager().getShader<SimpleBillboardedShader>(this->shaderLock);
assertNotNull(mesh, "SimpleBillboardedMaterial::getRenderPasses: Mesh cannot be null");
assertNotNull(mesh->mesh, "SimpleBillboardedMaterial::getRenderPasses: Mesh cannot be null");
assertNotNull(shader, "SimpleBillboardedMaterial::getRenderPasses: Shader cannot be null");
assertNotNull(mesh, "Mesh cannot be null");
assertNotNull(mesh->mesh, "Mesh cannot be null");
assertNotNull(shader, "Shader cannot be null");
struct ShaderPassItem onlyPass;
onlyPass.mesh = mesh->mesh;
onlyPass.shader = shader;
onlyPass.colorValues[shader->paramColor] = this->color;
onlyPass.matrixValues[shader->paramModel] = this->transform->getWorldTransform();
onlyPass.parameterBuffers[shader->bufferRenderPipeline] = &context.renderPipeline->shaderBuffer;
onlyPass.parameterBuffers[shader->bufferRenderPipeline] =
&context.renderPipeline->shaderBuffer
;
onlyPass.renderFlags = (
RENDER_MANAGER_RENDER_FLAG_BLEND

View File

@ -27,6 +27,8 @@ namespace Dawn {
void onStart() override;
void onDispose() override;
std::vector<struct ShaderPassItem> getRenderPasses(IRenderableContext &context) override;
std::vector<struct ShaderPassItem>
getRenderPasses(IRenderableContext &context) override
;
};
}

View File

@ -14,27 +14,35 @@ SimpleTexturedMaterial::SimpleTexturedMaterial(SceneItem *i) :
}
void SimpleTexturedMaterial::onStart() {
this->shaderLock = this->getGame()->renderManager.getShaderManager()->lockShader<SimpleTexturedShader>();
this->shaderLock = getShaderManager().lockShader<SimpleTexturedShader>();
}
void SimpleTexturedMaterial::onDispose() {
this->getGame()->renderManager.getShaderManager()->releaseShader<SimpleTexturedShader>(this->shaderLock);
getShaderManager().releaseShader<SimpleTexturedShader>(this->shaderLock);
}
std::vector<struct ShaderPassItem> SimpleTexturedMaterial::getRenderPasses(IRenderableContext &context) {
std::vector<struct ShaderPassItem>
SimpleTexturedMaterial::getRenderPasses(IRenderableContext &context)
{
auto mesh = this->item->getComponent<MeshRenderer>();
auto shader = this->getGame()->renderManager.getShaderManager()->getShader<SimpleTexturedShader>(this->shaderLock);
auto shader = getShaderManager()
.getShader<SimpleTexturedShader>(this->shaderLock)
;
assertNotNull(mesh, "SimpleTexturedMaterial::getRenderPasses: Mesh cannot be null");
assertNotNull(mesh->mesh, "SimpleTexturedMaterial::getRenderPasses: Mesh cannot be null");
assertNotNull(shader, "SimpleTexturedMaterial::getRenderPasses: Shader cannot be null");
assertNotNull(mesh, "Mesh cannot be null");
assertNotNull(mesh->mesh, "Mesh cannot be null");
assertNotNull(shader, "Shader cannot be null");
struct ShaderPassItem onlyPass;
onlyPass.mesh = mesh->mesh;
onlyPass.shader = shader;
onlyPass.colorValues[shader->paramColor] = this->color;
onlyPass.matrixValues[shader->paramModel] = this->transform->getWorldTransform();
onlyPass.parameterBuffers[shader->bufferRenderPipeline] = &context.renderPipeline->shaderBuffer;
onlyPass.matrixValues[shader->paramModel] =
this->transform->getWorldTransform()
;
onlyPass.parameterBuffers[
shader->bufferRenderPipeline
] = &context.renderPipeline->shaderBuffer;
if(this->opaque) {
onlyPass.renderFlags = (

View File

@ -29,6 +29,8 @@ namespace Dawn {
void onStart() override;
void onDispose() override;
std::vector<struct ShaderPassItem> getRenderPasses(IRenderableContext &context) override;
std::vector<struct ShaderPassItem>
getRenderPasses(IRenderableContext &context) override
;
};
}