Added support for color tinting
This commit is contained in:
@@ -140,8 +140,7 @@ private:
|
||||
glm::vec3 scale = testTransform["Scale"];
|
||||
ComponentWrapper testModel = GetComponent(entityTranslationWidget, "Model");
|
||||
std::string file = testModel["ModelFile"];
|
||||
file = "Models/TranslationWidget.obj";
|
||||
testModel["ModelFile"] = file;
|
||||
testModel["ModelFile"] = "Models/TranslationWidget.obj";
|
||||
glm::vec4 col = testModel["Color"];
|
||||
}
|
||||
{
|
||||
@@ -149,15 +148,11 @@ private:
|
||||
AttachComponent(entityScaleWidget, "Transform");
|
||||
AttachComponent(entityScaleWidget, "Model");
|
||||
ComponentWrapper testTransform = GetComponent(entityScaleWidget, "Transform");
|
||||
glm::vec3 pos = testTransform["Position"];
|
||||
pos = glm::vec3(-1.5f, 0.f, 0.f);
|
||||
testTransform["Position"] = pos;
|
||||
testTransform["Position"] = glm::vec3(-1.5f, 0.f, 0.f);
|
||||
glm::quat ori = testTransform["Orientation"];
|
||||
glm::vec3 scale = testTransform["Scale"];
|
||||
ComponentWrapper testModel = GetComponent(entityScaleWidget, "Model");
|
||||
std::string file = testModel["ModelFile"];
|
||||
file = "Models/ScaleWidget.obj";
|
||||
testModel["ModelFile"] = file;
|
||||
testModel["ModelFile"] = "Models/ScaleWidget.obj";
|
||||
glm::vec4 col = testModel["Color"];
|
||||
}
|
||||
{
|
||||
@@ -165,16 +160,11 @@ private:
|
||||
AttachComponent(entityRotationWidget, "Transform");
|
||||
AttachComponent(entityRotationWidget, "Model");
|
||||
ComponentWrapper testTransform = GetComponent(entityRotationWidget, "Transform");
|
||||
glm::vec3 pos = testTransform["Position"];
|
||||
pos = glm::vec3(1.5f, 0.f, 0.f);
|
||||
testTransform["Position"] = pos;
|
||||
testTransform["Position"] = glm::vec3(1.5f, 0.f, 0.f);
|
||||
glm::quat ori = testTransform["Orientation"];
|
||||
glm::vec3 scale = testTransform["Scale"];
|
||||
ComponentWrapper testModel = GetComponent(entityRotationWidget, "Model");
|
||||
std::string file = testModel["ModelFile"];
|
||||
file = "Models/RotationWidget.obj";
|
||||
testModel["ModelFile"] = file;
|
||||
glm::vec4 col = testModel["Color"];
|
||||
testModel["ModelFile"] = "Models/RotationWidget.obj";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform vec4 Color;
|
||||
|
||||
uniform sampler2D texture0;
|
||||
|
||||
@@ -21,7 +22,7 @@ out vec4 fragmentColor;
|
||||
void main()
|
||||
{
|
||||
vec4 texel = texture2D(texture0, Input.TextureCoordinate);
|
||||
fragmentColor = texel * Input.DiffuseColor;
|
||||
fragmentColor = texel * Input.DiffuseColor * Color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@ void Renderer::DrawScene(RenderQueueCollection& rq)
|
||||
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->ModelMatrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(m_Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(m_Camera->ProjectionMatrix()));
|
||||
glUniform4fv(glGetUniformLocation(ShaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||
|
||||
//TODO: Renderer: bättre textur felhantering samt fler texturer stöd
|
||||
if (modelJob->DiffuseTexture != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user