Changed color values from floats to glm::vec4
This commit is contained in:
@@ -24,6 +24,10 @@ struct ModelJob : RenderJob
|
|||||||
DiffuseTexture = matGroup.Texture.get();
|
DiffuseTexture = matGroup.Texture.get();
|
||||||
NormalTexture = matGroup.NormalMap.get();
|
NormalTexture = matGroup.NormalMap.get();
|
||||||
SpecularTexture = matGroup.SpecularMap.get();
|
SpecularTexture = matGroup.SpecularMap.get();
|
||||||
|
IncandescenceTexture = matGroup.IncandescenceMap.get();
|
||||||
|
DiffuseColor = matGroup.DiffuseColor;
|
||||||
|
SpecularColor = matGroup.SpecularColor;
|
||||||
|
IncandescenceColor = matGroup.IncandescenceColor;
|
||||||
StartIndex = matGroup.StartIndex;
|
StartIndex = matGroup.StartIndex;
|
||||||
EndIndex = matGroup.EndIndex;
|
EndIndex = matGroup.EndIndex;
|
||||||
Matrix = matrix;
|
Matrix = matrix;
|
||||||
@@ -43,9 +47,13 @@ struct ModelJob : RenderJob
|
|||||||
const Texture* DiffuseTexture;
|
const Texture* DiffuseTexture;
|
||||||
const Texture* NormalTexture;
|
const Texture* NormalTexture;
|
||||||
const Texture* SpecularTexture;
|
const Texture* SpecularTexture;
|
||||||
|
const Texture* IncandescenceTexture;
|
||||||
float Shininess = 0.f;
|
float Shininess = 0.f;
|
||||||
glm::vec4 Color;
|
glm::vec4 Color;
|
||||||
const ::Model* Model = nullptr;
|
const ::Model* Model = nullptr;
|
||||||
|
glm::vec4 DiffuseColor;
|
||||||
|
glm::vec4 SpecularColor;
|
||||||
|
glm::vec4 IncandescenceColor;
|
||||||
unsigned int StartIndex = 0;
|
unsigned int StartIndex = 0;
|
||||||
unsigned int EndIndex = 0;
|
unsigned int EndIndex = 0;
|
||||||
World* World;
|
World* World;
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public:
|
|||||||
{
|
{
|
||||||
float SpecularExponent;
|
float SpecularExponent;
|
||||||
float ReflectionFactor;
|
float ReflectionFactor;
|
||||||
float DiffuseColor[3];
|
glm::vec4 DiffuseColor{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
float SpecularColor[3];
|
glm::vec4 SpecularColor{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
float IncandescenceColor[3];
|
glm::vec4 IncandescenceColor{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
unsigned int StartIndex;
|
unsigned int StartIndex;
|
||||||
unsigned int EndIndex;
|
unsigned int EndIndex;
|
||||||
//float Transparency;
|
//float Transparency;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ uniform mat4 M;
|
|||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
uniform vec4 Color;
|
uniform vec4 Color;
|
||||||
|
uniform vec4 DiffuseColor;
|
||||||
uniform vec2 ScreenDimensions;
|
uniform vec2 ScreenDimensions;
|
||||||
uniform sampler2D texture0;
|
uniform sampler2D texture0;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ void main()
|
|||||||
totalLighting.Specular += result.Specular;
|
totalLighting.Specular += result.Specular;
|
||||||
}
|
}
|
||||||
|
|
||||||
fragmentColor += (totalLighting.Diffuse + totalLighting.Specular) * texel * Color;
|
fragmentColor += DiffuseColor * (totalLighting.Diffuse + totalLighting.Specular) * texel * Color;
|
||||||
//fragmentColor += Input.DiffuseColor;
|
//fragmentColor += Input.DiffuseColor;
|
||||||
//fragmentColor += Input.DiffuseColor * (totalLighting.Diffuse) * texel * Color;
|
//fragmentColor += Input.DiffuseColor * (totalLighting.Diffuse) * texel * Color;
|
||||||
//fragmentColor += Input.DiffuseColor + vec4(0.0, LightGrids.Data[currentTile].Amount/3, 0, 1);
|
//fragmentColor += Input.DiffuseColor + vec4(0.0, LightGrids.Data[currentTile].Amount/3, 0, 1);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
|||||||
//TODO: Kolla upp "header/include/common" shader saken så man slipper skicka in asmycket uniforms
|
//TODO: Kolla upp "header/include/common" shader saken så man slipper skicka in asmycket uniforms
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(modelJob->DiffuseColor));
|
||||||
|
|
||||||
if(modelJob->DiffuseTexture != nullptr) {
|
if(modelJob->DiffuseTexture != nullptr) {
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|||||||
@@ -138,11 +138,11 @@ void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, un
|
|||||||
newMaterial.ReflectionFactor = *(float*)(fileData + offset);
|
newMaterial.ReflectionFactor = *(float*)(fileData + offset);
|
||||||
offset += sizeof(float);
|
offset += sizeof(float);
|
||||||
|
|
||||||
memcpy(newMaterial.DiffuseColor, fileData + offset, sizeof(float) * 3);
|
memcpy(&newMaterial.DiffuseColor[0], fileData + offset, sizeof(float) * 3);
|
||||||
offset += sizeof(float) * 3;
|
offset += sizeof(float) * 3;
|
||||||
memcpy(newMaterial.SpecularColor, fileData + offset, sizeof(float) * 3);
|
memcpy(&newMaterial.SpecularColor[0], fileData + offset, sizeof(float) * 3);
|
||||||
offset += sizeof(float) * 3;
|
offset += sizeof(float) * 3;
|
||||||
memcpy(newMaterial.IncandescenceColor, fileData + offset, sizeof(float) * 3);
|
memcpy(&newMaterial.IncandescenceColor[0], fileData + offset, sizeof(float) * 3);
|
||||||
offset += sizeof(float) * 3;
|
offset += sizeof(float) * 3;
|
||||||
|
|
||||||
newMaterial.StartIndex = *(unsigned int*)(fileData + offset);
|
newMaterial.StartIndex = *(unsigned int*)(fileData + offset);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation::Keyf
|
|||||||
int k = 0;
|
int k = 0;
|
||||||
} else {
|
} else {
|
||||||
if (bone->Parent) {
|
if (bone->Parent) {
|
||||||
boneMatrix = parentMatrix * bone->Parent->OffsetMatrix * glm::translate(glm::vec3(1.718, 0, 0)); // * glm::inverse(bone->OffsetMatrix);
|
boneMatrix = parentMatrix; // * glm::inverse(bone->OffsetMatrix);
|
||||||
}
|
}
|
||||||
boneMatrices[bone->ID] = boneMatrix; // * bone->OffsetMatrix;
|
boneMatrices[bone->ID] = boneMatrix; // * bone->OffsetMatrix;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user