This commit is contained in:
2026-03-05 01:42:40 +03:00
parent 2815369bb8
commit 4290e99c61
31 changed files with 2285 additions and 99 deletions

View File

@@ -12,7 +12,7 @@
#include "modelsystem.h"
#include "texturesmanager.h"
extern Shader* g_litShader;
extern Shader* g_unlitShader;
static std::string getFileNameWithoutExtension(const std::string& filename)
{
@@ -220,7 +220,7 @@ void Model::LoadMtl(const char* filename)
void Model::Draw(const glm::mat4& model, bool isTransparent /*= false*/)
{
SDL_assert(g_litShader);
SDL_assert(g_unlitShader);
glFrontFace(GL_CCW);
glDepthFunc(GL_LESS);
@@ -236,20 +236,20 @@ void Model::Draw(const glm::mat4& model, bool isTransparent /*= false*/)
g_renderDevice->SetBlendingFunction(BF_SRC_ALPHA, BF_ONE_MINUS_SRC_ALPHA);
glm::vec4 color = glm::vec4(1.f, 1.f, 1.f, .5f);
g_shaderSystem->SetUniformFloat4(g_litShader, UNIFORM_CUSTOM_COLOR, glm::value_ptr(color));
g_shaderSystem->SetUniformFloat4(g_unlitShader, UNIFORM_CUSTOM_COLOR, glm::value_ptr(color));
}
else
{
g_renderDevice->SetBlending(false);
//glm::vec4 color = glm::vec4(1.f, 1.f, 1.f, 1.f);
//g_shaderSystem->SetUniformFloat4(g_litShader, UNIFORM_CUSTOM_COLOR, glm::value_ptr(color));
//g_shaderSystem->SetUniformFloat4(g_unlitShader, UNIFORM_CUSTOM_COLOR, glm::value_ptr(color));
}
g_renderDevice->SetVerticesBuffer(m_data.vb);
g_shaderSystem->SetShader(g_litShader);
g_shaderSystem->SetUniformMatrix(g_litShader, UNIFORM_MODEL_MATRIX, &model[0]);
g_shaderSystem->SetShader(g_unlitShader);
g_shaderSystem->SetUniformMatrix(g_unlitShader, UNIFORM_MODEL_MATRIX, &model[0]);
//static float test = 0.0f;
//test += g_systemTimer->GetDelta() * 6.0f;
@@ -277,10 +277,10 @@ void Model::Draw(const glm::mat4& model, bool isTransparent /*= false*/)
glm::mat4 mvp = glm::identity<glm::mat4>();
mvp = g_render->GetProjectionMatrix() * g_render->GetViewMatrix() * model;
g_shaderSystem->SetUniformMatrix(g_litShader, UNIFORM_MVP_MATRIX, &mvp[0]);
g_shaderSystem->SetUniformMatrix(g_unlitShader, UNIFORM_MVP_MATRIX, &mvp[0]);
g_texturesManager->SetTexture(0, m_AlbedoTexture);
g_shaderSystem->SetUniformSampler(g_litShader, SAMPLER_ALBEDO, 0);
g_shaderSystem->SetUniformSampler(g_unlitShader, SAMPLER_ALBEDO, 0);
g_renderDevice->DrawArrays(PT_TRIANGLES, 0, m_data.vbcount);