Changed color values from floats to glm::vec4
This commit is contained in:
@@ -24,6 +24,10 @@ struct ModelJob : RenderJob
|
||||
DiffuseTexture = matGroup.Texture.get();
|
||||
NormalTexture = matGroup.NormalMap.get();
|
||||
SpecularTexture = matGroup.SpecularMap.get();
|
||||
IncandescenceTexture = matGroup.IncandescenceMap.get();
|
||||
DiffuseColor = matGroup.DiffuseColor;
|
||||
SpecularColor = matGroup.SpecularColor;
|
||||
IncandescenceColor = matGroup.IncandescenceColor;
|
||||
StartIndex = matGroup.StartIndex;
|
||||
EndIndex = matGroup.EndIndex;
|
||||
Matrix = matrix;
|
||||
@@ -43,9 +47,13 @@ struct ModelJob : RenderJob
|
||||
const Texture* DiffuseTexture;
|
||||
const Texture* NormalTexture;
|
||||
const Texture* SpecularTexture;
|
||||
const Texture* IncandescenceTexture;
|
||||
float Shininess = 0.f;
|
||||
glm::vec4 Color;
|
||||
const ::Model* Model = nullptr;
|
||||
glm::vec4 DiffuseColor;
|
||||
glm::vec4 SpecularColor;
|
||||
glm::vec4 IncandescenceColor;
|
||||
unsigned int StartIndex = 0;
|
||||
unsigned int EndIndex = 0;
|
||||
World* World;
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
{
|
||||
float SpecularExponent;
|
||||
float ReflectionFactor;
|
||||
float DiffuseColor[3];
|
||||
float SpecularColor[3];
|
||||
float IncandescenceColor[3];
|
||||
glm::vec4 DiffuseColor{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
glm::vec4 SpecularColor{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
glm::vec4 IncandescenceColor{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
unsigned int StartIndex;
|
||||
unsigned int EndIndex;
|
||||
//float Transparency;
|
||||
|
||||
@@ -4,6 +4,7 @@ uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform vec4 Color;
|
||||
uniform vec4 DiffuseColor;
|
||||
uniform vec2 ScreenDimensions;
|
||||
uniform sampler2D texture0;
|
||||
|
||||
@@ -129,7 +130,7 @@ void main()
|
||||
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 * (totalLighting.Diffuse) * texel * Color;
|
||||
//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
|
||||
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, "DiffuseColor"), 1, glm::value_ptr(modelJob->DiffuseColor));
|
||||
|
||||
if(modelJob->DiffuseTexture != nullptr) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
@@ -138,11 +138,11 @@ void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, un
|
||||
newMaterial.ReflectionFactor = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
memcpy(newMaterial.DiffuseColor, fileData + offset, sizeof(float) * 3);
|
||||
memcpy(&newMaterial.DiffuseColor[0], fileData + 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;
|
||||
memcpy(newMaterial.IncandescenceColor, fileData + offset, sizeof(float) * 3);
|
||||
memcpy(&newMaterial.IncandescenceColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
|
||||
newMaterial.StartIndex = *(unsigned int*)(fileData + offset);
|
||||
|
||||
@@ -90,7 +90,7 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation::Keyf
|
||||
int k = 0;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user