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