WIP
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
uniform mat4 M;
|
uniform mat4 PVM;
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
layout(location = 5) in vec4 BoneIndices;
|
layout(location = 5) in vec4 BoneIndices;
|
||||||
@@ -15,7 +13,7 @@ out VertexData{
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = P * V * M * vec4(Position, 1.0);
|
gl_Position = PVM * vec4(Position, 1.0);
|
||||||
|
|
||||||
Output.Position = Position;
|
Output.Position = Position;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
uniform mat4 M;
|
uniform mat4 PVM;
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
|
||||||
uniform mat4 Bones[100];
|
uniform mat4 Bones[100];
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +25,7 @@ void main()
|
|||||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
gl_Position = PVM*boneTransform * vec4(Position, 1.0);
|
||||||
|
|
||||||
Output.Position = vec3(0.0);
|
Output.Position = vec3(0.0);
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#define MIN_AMBIENT_LIGHT 0.3
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
uniform mat4 VM;
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -11,7 +12,7 @@ uniform vec2 ScreenDimensions;
|
|||||||
uniform vec4 FillColor;
|
uniform vec4 FillColor;
|
||||||
uniform vec4 AmbientColor;
|
uniform vec4 AmbientColor;
|
||||||
uniform float FillPercentage;
|
uniform float FillPercentage;
|
||||||
uniform float GlowIntensity = 10;
|
uniform float GlowIntensity;
|
||||||
uniform vec3 CameraPosition;
|
uniform vec3 CameraPosition;
|
||||||
uniform int SSAOQuality;
|
uniform int SSAOQuality;
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ void main()
|
|||||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
vec4 position = VM * vec4(Input.Position, 1.0);
|
||||||
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
||||||
normal = normalize(normal);
|
normal = normalize(normal);
|
||||||
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
uniform mat4 PVM;
|
||||||
|
uniform mat4 TIM;
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -22,8 +23,8 @@ out VertexData{
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = P*V*M * vec4(Position, 1.0);
|
gl_Position = PVM * vec4(Position, 1.0);
|
||||||
mat4 TIM = transpose(inverse(M));
|
//mat4 TIM = transpose(inverse(M));
|
||||||
Output.Position = Position;
|
Output.Position = Position;
|
||||||
Output.TextureCoordinate = TextureCoords;
|
Output.TextureCoordinate = TextureCoords;
|
||||||
Output.Normal = vec3(TIM * vec4(Normal, 0.0));
|
Output.Normal = vec3(TIM * vec4(Normal, 0.0));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#define MIN_AMBIENT_LIGHT 0.3
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
uniform mat4 VM;
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -11,7 +12,7 @@ uniform vec2 ScreenDimensions;
|
|||||||
uniform vec4 FillColor;
|
uniform vec4 FillColor;
|
||||||
uniform vec4 AmbientColor;
|
uniform vec4 AmbientColor;
|
||||||
uniform float FillPercentage;
|
uniform float FillPercentage;
|
||||||
uniform float GlowIntensity = 10;
|
uniform float GlowIntensity;
|
||||||
uniform vec3 CameraPosition;
|
uniform vec3 CameraPosition;
|
||||||
uniform int SSAOQuality;
|
uniform int SSAOQuality;
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ void main()
|
|||||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
vec4 position = VM * vec4(Input.Position, 1.0);
|
||||||
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
||||||
normal = normalize(normal);
|
normal = normalize(normal);
|
||||||
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
|
uniform mat4 PVM;
|
||||||
|
uniform mat4 TIM;
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -34,7 +36,7 @@ void main()
|
|||||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
gl_Position = PVM*boneTransform * vec4(Position, 1.0);
|
||||||
|
|
||||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||||
Output.TextureCoordinate = TextureCoords;
|
Output.TextureCoordinate = TextureCoords;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#define MIN_AMBIENT_LIGHT 0.3
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
uniform mat4 VM;
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -189,7 +190,7 @@ void main()
|
|||||||
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
||||||
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
||||||
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
||||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
vec4 position = VM * vec4(Input.Position, 1.0);
|
||||||
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
||||||
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
||||||
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#define MIN_AMBIENT_LIGHT 0.3
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
uniform mat4 VM;
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -190,7 +191,7 @@ void main()
|
|||||||
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
||||||
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
||||||
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
||||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
vec4 position = VM * vec4(Input.Position, 1.0);
|
||||||
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
||||||
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
||||||
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
#include "StandarUniform.glsl"
|
||||||
uniform mat4 M;
|
layout(location = PVM_UNIFORM_LOCATION) uniform mat4 PVM;
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
layout(location = 1) in vec3 Normal;
|
layout(location = 1) in vec3 Normal;
|
||||||
@@ -16,6 +14,6 @@ out VertexData{
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = P*V*M * vec4(Position, 1.0);
|
gl_Position = PVM * vec4(Position, 1.0);
|
||||||
Output.Position = Position, 1.0;
|
Output.Position = Position, 1.0;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
#include "StandarUniform.glsl"
|
||||||
uniform mat4 M;
|
layout(location = PVM_UNIFORM_LOCATION) uniform mat4 PVM;
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
|
||||||
uniform mat4 Bones[100];
|
uniform mat4 Bones[100];
|
||||||
|
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
@@ -27,6 +25,6 @@ void main()
|
|||||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
gl_Position = PVM*boneTransform * vec4(Position, 1.0);
|
||||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,6 @@
|
|||||||
uniform vec4 Color;
|
uniform vec4 Color;
|
||||||
uniform vec4 FillColor;
|
uniform vec4 FillColor;
|
||||||
uniform float FillPercentage;
|
uniform float FillPercentage;
|
||||||
uniform mat4 M;
|
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
|
|
||||||
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
uniform mat4 M;
|
uniform mat4 PVM;
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
layout(location = 1) in vec3 Normal;
|
layout(location = 1) in vec3 Normal;
|
||||||
@@ -17,7 +15,7 @@ out VertexData{
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
||||||
gl_Position = P * V * M * vec4(Position, 1.0);
|
gl_Position = PVM* vec4(Position, 1.0);
|
||||||
|
|
||||||
Output.Position = Position;
|
Output.Position = Position;
|
||||||
Output.TextureCoordinate = TextureCoords;
|
Output.TextureCoordinate = TextureCoords;
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
//----- SHADER DEFINES -----
|
||||||
|
#define MAX_BONES 100
|
||||||
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
//----- UNIFORM LOCATION -----
|
||||||
|
#define PVM_UNIFORM_LOCATION 100
|
||||||
|
#define VM_UNIFORM_LOCATION 101
|
||||||
|
#define VP_UNIFORM_LOCATION 102
|
||||||
|
#define TIM_UNIFORM_LOCATION 103
|
||||||
|
#define M_UNIFORM_LOCATION 104
|
||||||
|
#define V_UNIFORM_LOCATION 105
|
||||||
|
#define P_UNIFORM_LOCATION 106
|
||||||
|
|
||||||
|
#define BONES_LOCATION 200
|
||||||
|
|
||||||
|
#define AMBIENT_COLOR_UNIFORM_LOCATION 300
|
||||||
|
#define COLOR_UNIFORM_LOCATION 301
|
||||||
|
#define DIFFUSE_COLOR_UNIFORM_LOCATION 302
|
||||||
|
#define SCREEN_DIMENSIONS_UNIFORM_LOCATION 303
|
||||||
|
#define FILL_COLOR_UNIFORM_LOCATION 304
|
||||||
|
#define FILL_PERCENTAGE_UNIFORM_LOCATION 305
|
||||||
|
#define GLOW_INTENSITY_UNIFORM_LOCATION 306
|
||||||
|
#define CAMERA_POSITION_UNIFORM_LOCATION 306
|
||||||
|
#define SSAO_QUALITY_UNIFORM_LOCATION 308
|
||||||
|
|
||||||
|
#define LOCAL_UNIFORM_LOCATION1;
|
||||||
|
|
||||||
|
//----- TEXTURE LOCATION -----
|
||||||
|
#define SSAO_TEXTURE_LOCATION 0
|
||||||
|
#define SHADOW_TEXTURE_LOCATION 1
|
||||||
|
#define LOCAL_TEXTURE_LOCATION1 2
|
||||||
|
#define LOCAL_TEXTURE_LOCATION2 3
|
||||||
|
#define LOCAL_TEXTURE_LOCATION3 4
|
||||||
|
#define LOCAL_TEXTURE_LOCATION4 5
|
||||||
|
#define LOCAL_TEXTURE_LOCATION5 6
|
||||||
|
#define LOCAL_TEXTURE_LOCATION6 7
|
||||||
|
#define LOCAL_TEXTURE_LOCATION7 8
|
||||||
|
#define LOCAL_TEXTURE_LOCATION8 9
|
||||||
|
#define LOCAL_TEXTURE_LOCATION9 10
|
||||||
|
#define LOCAL_TEXTURE_LOCATION10 11
|
||||||
|
#define LOCAL_TEXTURE_LOCATION11 12
|
||||||
|
#define LOCAL_TEXTURE_LOCATION12 13
|
||||||
|
#define LOCAL_TEXTURE_LOCATION13 14
|
||||||
|
#define LOCAL_TEXTURE_LOCATION14 15
|
||||||
|
#define LOCAL_TEXTURE_LOCATION15 16
|
||||||
|
#define LOCAL_TEXTURE_LOCATION16 17
|
||||||
|
#define LOCAL_TEXTURE_LOCATION17 18
|
||||||
|
#define LOCAL_TEXTURE_LOCATION18 19
|
||||||
|
#define LOCAL_TEXTURE_LOCATION19 20
|
||||||
|
#define LOCAL_TEXTURE_LOCATION20 21
|
||||||
|
#define LOCAL_TEXTURE_LOCATION21 22
|
||||||
|
#define LOCAL_TEXTURE_LOCATION22 23
|
||||||
|
#define LOCAL_TEXTURE_LOCATION23 24
|
||||||
|
#define LOCAL_TEXTURE_LOCATION24 25
|
||||||
|
#define LOCAL_TEXTURE_LOCATION25 26
|
||||||
@@ -961,9 +961,8 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
|
|||||||
if(modelJob->Model->IsSkinned()) {
|
if(modelJob->Model->IsSkinned()) {
|
||||||
m_FillDepthStencilBufferSkinnedProgram->Bind();
|
m_FillDepthStencilBufferSkinnedProgram->Bind();
|
||||||
GLuint shaderHandle = m_FillDepthStencilBufferSkinnedProgram->GetHandle();
|
GLuint shaderHandle = m_FillDepthStencilBufferSkinnedProgram->GetHandle();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
GLERROR("Bind PVM uniform");
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->BlendTree != nullptr) {
|
if (modelJob->BlendTree != nullptr) {
|
||||||
@@ -976,9 +975,8 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
|
|||||||
} else {
|
} else {
|
||||||
m_FillDepthStencilBufferProgram->Bind();
|
m_FillDepthStencilBufferProgram->Bind();
|
||||||
GLuint shaderHandle = m_FillDepthStencilBufferProgram->GetHandle();
|
GLuint shaderHandle = m_FillDepthStencilBufferProgram->GetHandle();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
GLERROR("Bind PVM uniform");
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1008,8 +1006,8 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
|
|||||||
if(spriteJob->Depth == 0) {
|
if(spriteJob->Depth == 0) {
|
||||||
jobState.Disable(GL_DEPTH_TEST);
|
jobState.Disable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * spriteJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform3fv(glGetUniformLocation(shaderHandle, "CameraPos"), 1, glm::value_ptr(scene.Camera->Position()));
|
glUniform3fv(glGetUniformLocation(shaderHandle, "CameraPos"), 1, glm::value_ptr(scene.Camera->Position()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(spriteJob->Color));
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(spriteJob->Color));
|
||||||
@@ -1049,6 +1047,12 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
GLERROR("Bind 3 uniform");
|
GLERROR("Bind 3 uniform");
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
GLERROR("Bind 4 uniform");
|
GLERROR("Bind 4 uniform");
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * job->Matrix));
|
||||||
|
GLERROR("Bind PVM uniform");
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "VM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix() * job->Matrix));
|
||||||
|
GLERROR("Bind VM uniform");
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "TIM"), 1, GL_FALSE, glm::value_ptr(glm::transpose(glm::inverse(job->Matrix))));
|
||||||
|
GLERROR("Bind TIM uniform");
|
||||||
|
|
||||||
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
GLERROR("Bind 5 uniform");
|
GLERROR("Bind 5 uniform");
|
||||||
@@ -1101,6 +1105,12 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
GLint Location_P = glGetUniformLocation(shaderHandle, "P");
|
GLint Location_P = glGetUniformLocation(shaderHandle, "P");
|
||||||
glUniformMatrix4fv(Location_P, 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(Location_P, 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
GLERROR("Bind 4 uniform");
|
GLERROR("Bind 4 uniform");
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * job->Matrix));
|
||||||
|
GLERROR("Bind PVM uniform");
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "VM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix() * job->Matrix));
|
||||||
|
GLERROR("Bind VM uniform");
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "TIM"), 1, GL_FALSE, glm::value_ptr(glm::transpose(glm::inverse(job->Matrix))));
|
||||||
|
GLERROR("Bind TIM uniform");
|
||||||
|
|
||||||
GLint Location_ScreenDimensions = glGetUniformLocation(shaderHandle, "ScreenDimensions");
|
GLint Location_ScreenDimensions = glGetUniformLocation(shaderHandle, "ScreenDimensions");
|
||||||
glUniform2f(Location_ScreenDimensions, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glUniform2f(Location_ScreenDimensions, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
GLuint shaderHandle = m_PickingProgram->GetHandle();
|
GLuint shaderHandle = m_PickingProgram->GetHandle();
|
||||||
GLuint shaderSkinnedHandle = m_PickingSkinnedProgram->GetHandle();
|
GLuint shaderSkinnedHandle = m_PickingSkinnedProgram->GetHandle();
|
||||||
m_PickingProgram->Bind();
|
m_PickingProgram->Bind();
|
||||||
|
|
||||||
if (scene.ClearDepth) {
|
if (scene.ClearDepth) {
|
||||||
//glClear(GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
state->Disable(GL_DEPTH_TEST);
|
state->Disable(GL_DEPTH_TEST);
|
||||||
@@ -100,9 +99,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
|
|
||||||
if (modelJob->Model->IsSkinned()) {
|
if (modelJob->Model->IsSkinned()) {
|
||||||
m_PickingSkinnedProgram->Bind();
|
m_PickingSkinnedProgram->Bind();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(100, 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
@@ -116,9 +113,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_PickingProgram->Bind();
|
m_PickingProgram->Bind();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(100, 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user