Shadows are pretty much done.
This commit is contained in:
@@ -19,12 +19,14 @@ struct DirectionalLightJob : RenderJob
|
|||||||
Direction = glm::vec4(0,0,-1,0) * glm::inverse(Orientation);
|
Direction = glm::vec4(0,0,-1,0) * glm::inverse(Orientation);
|
||||||
Color = (glm::vec4)directionalLightComponent["Color"];
|
Color = (glm::vec4)directionalLightComponent["Color"];
|
||||||
Intensity = (double)directionalLightComponent["Intensity"];
|
Intensity = (double)directionalLightComponent["Intensity"];
|
||||||
|
//TextureAlphaShadows = (bool)directionalLightComponent["TextureAlphaShadows"];
|
||||||
};
|
};
|
||||||
|
|
||||||
glm::quat Orientation;
|
glm::quat Orientation;
|
||||||
glm::vec4 Direction;
|
glm::vec4 Direction;
|
||||||
glm::vec4 Color;
|
glm::vec4 Color;
|
||||||
float Intensity;
|
float Intensity;
|
||||||
|
bool TextureAlphaShadows = false;
|
||||||
|
|
||||||
void CalculateHash() override
|
void CalculateHash() override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,5 +2,6 @@
|
|||||||
<DirectionalLight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DirectionalLight.xsd">
|
<DirectionalLight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DirectionalLight.xsd">
|
||||||
<Color R="1" G="1" B="1" A="1"/>
|
<Color R="1" G="1" B="1" A="1"/>
|
||||||
<Intensity>0.8</Intensity>
|
<Intensity>0.8</Intensity>
|
||||||
|
<!--<TextureAlphaShadows>false</TextureAlphaShadows>-->
|
||||||
<Visible>true</Visible>
|
<Visible>true</Visible>
|
||||||
</DirectionalLight>
|
</DirectionalLight>
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
<xs:all>
|
<xs:all>
|
||||||
<xs:element name="Color" type="t:Color" minOccurs="0"/>
|
<xs:element name="Color" type="t:Color" minOccurs="0"/>
|
||||||
<xs:element name="Intensity" type="t:double" minOccurs="0"/>
|
<xs:element name="Intensity" type="t:double" minOccurs="0"/>
|
||||||
|
<!--<xs:element name="TextureAlphaShadows" type="t:bool" minOccurs="0"/>-->
|
||||||
<xs:element name="Visible" type="t:bool" minOccurs="0"/>
|
<xs:element name="Visible" type="t:bool" minOccurs="0"/>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#define MAX_SPLITS 4
|
#define MAX_SPLITS 4
|
||||||
#define MIN_AMBIENT_LIGHT 0.3
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
#define SHADOW_STRENGTH 0.3 //Should be ambient
|
|
||||||
|
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
|
|||||||
@@ -254,28 +254,31 @@ void ShadowPass::Draw(RenderScene & scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniform1f(glGetUniformLocation(shaderHandle, "Alpha"), modelJob->Color.a);
|
glUniform1f(glGetUniformLocation(shaderHandle, "Alpha"), modelJob->Color.a);
|
||||||
|
|
||||||
/*switch (modelJob->Type) {
|
if (directionalLightJob->TextureAlphaShadows) {
|
||||||
case RawModel::MaterialType::SingleTextures:
|
switch (modelJob->Type) {
|
||||||
case RawModel::MaterialType::Basic:
|
case RawModel::MaterialType::SingleTextures:
|
||||||
{
|
case RawModel::MaterialType::Basic:
|
||||||
glActiveTexture(GL_TEXTURE24);
|
{
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
glActiveTexture(GL_TEXTURE24);
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
case RawModel::MaterialType::SplatMapping:
|
||||||
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE24);
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case RawModel::MaterialType::SplatMapping:
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||||
@@ -288,7 +291,8 @@ void ShadowPass::Draw(RenderScene & scene)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_ShadowProgram->Unbind();
|
glActiveTexture(GL_TEXTURE24);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
m_DepthBuffer.Unbind();
|
m_DepthBuffer.Unbind();
|
||||||
delete state;
|
delete state;
|
||||||
|
|||||||
Reference in New Issue
Block a user