|
@@ -21,6 +21,7 @@ using namespace WallpaperEngine::Render::Shaders::Variables;
|
|
|
using namespace WallpaperEngine::Render::Objects::Effects;
|
|
using namespace WallpaperEngine::Render::Objects::Effects;
|
|
|
|
|
|
|
|
extern float g_Time;
|
|
extern float g_Time;
|
|
|
|
|
+extern float g_Daytime;
|
|
|
|
|
|
|
|
CPass::CPass (CMaterial* material, Core::Objects::Images::Materials::CPass* pass) :
|
|
CPass::CPass (CMaterial* material, Core::Objects::Images::Materials::CPass* pass) :
|
|
|
Helpers::CContextAware (material),
|
|
Helpers::CContextAware (material),
|
|
@@ -201,6 +202,9 @@ void CPass::render ()
|
|
|
case Matrix4:
|
|
case Matrix4:
|
|
|
glUniformMatrix4fv (entry->id, 1, GL_FALSE, glm::value_ptr (*reinterpret_cast <const glm::mat4*> (entry->value)));
|
|
glUniformMatrix4fv (entry->id, 1, GL_FALSE, glm::value_ptr (*reinterpret_cast <const glm::mat4*> (entry->value)));
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case Matrix3:
|
|
|
|
|
+ glUniformMatrix3fv (entry->id, 1, GL_FALSE, glm::value_ptr (*reinterpret_cast <const glm::mat3*> (entry->value)));
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// add reference uniforms
|
|
// add reference uniforms
|
|
@@ -231,6 +235,9 @@ void CPass::render ()
|
|
|
case Matrix4:
|
|
case Matrix4:
|
|
|
glUniformMatrix4fv (entry->id, 1, GL_FALSE, glm::value_ptr (*reinterpret_cast <const glm::mat4*> (*entry->value)));
|
|
glUniformMatrix4fv (entry->id, 1, GL_FALSE, glm::value_ptr (*reinterpret_cast <const glm::mat4*> (*entry->value)));
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case Matrix3:
|
|
|
|
|
+ glUniformMatrix3fv (entry->id, 1, GL_FALSE, glm::value_ptr (*reinterpret_cast <const glm::mat3*> (*entry->value)));
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -301,11 +308,16 @@ void CPass::setModelViewProjectionMatrix (const glm::mat4* projection)
|
|
|
this->m_modelViewProjectionMatrix = projection;
|
|
this->m_modelViewProjectionMatrix = projection;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void CPass::setModelMatrix (glm::mat4 model)
|
|
|
|
|
|
|
+void CPass::setModelMatrix (const glm::mat4* model)
|
|
|
{
|
|
{
|
|
|
this->m_modelMatrix = model;
|
|
this->m_modelMatrix = model;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void CPass::setViewProjectionMatrix (const glm::mat4* viewProjection)
|
|
|
|
|
+{
|
|
|
|
|
+ this->m_viewProjectionMatrix = viewProjection;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void CPass::setTexCoord (GLuint texcoord)
|
|
void CPass::setTexCoord (GLuint texcoord)
|
|
|
{
|
|
{
|
|
|
this->a_TexCoord = texcoord;
|
|
this->a_TexCoord = texcoord;
|
|
@@ -579,6 +591,9 @@ void CPass::setupUniforms ()
|
|
|
|
|
|
|
|
auto projection = this->getMaterial ()->getImage ()->getScene ()->getScene ()->getOrthogonalProjection ();
|
|
auto projection = this->getMaterial ()->getImage ()->getScene ()->getScene ()->getOrthogonalProjection ();
|
|
|
|
|
|
|
|
|
|
+ // lighting variables
|
|
|
|
|
+ this->addUniform ("g_LightAmbientColor", this->m_material->getImage ()->getScene ()->getScene ()->getAmbientColor ());
|
|
|
|
|
+ this->addUniform ("g_LightSkylightColor", this->m_material->getImage ()->getScene ()->getScene ()->getSkylightColor ());
|
|
|
// register variables like brightness and alpha with some default value
|
|
// register variables like brightness and alpha with some default value
|
|
|
this->addUniform ("g_Brightness", this->m_material->getImage ()->getImage ()->getBrightness ());
|
|
this->addUniform ("g_Brightness", this->m_material->getImage ()->getImage ()->getBrightness ());
|
|
|
this->addUniform ("g_UserAlpha", this->m_material->getImage ()->getImage ()->getAlpha ());
|
|
this->addUniform ("g_UserAlpha", this->m_material->getImage ()->getImage ()->getAlpha ());
|
|
@@ -588,8 +603,12 @@ void CPass::setupUniforms ()
|
|
|
this->addUniform ("g_CompositeColor", this->m_material->getImage ()->getImage ()->getColor ());
|
|
this->addUniform ("g_CompositeColor", this->m_material->getImage ()->getImage ()->getColor ());
|
|
|
// add some external variables
|
|
// add some external variables
|
|
|
this->addUniform ("g_Time", &g_Time);
|
|
this->addUniform ("g_Time", &g_Time);
|
|
|
|
|
+ this->addUniform ("g_Daytime", &g_Daytime);
|
|
|
// add model-view-projection matrix
|
|
// add model-view-projection matrix
|
|
|
this->addUniform ("g_ModelViewProjectionMatrix", &this->m_modelViewProjectionMatrix);
|
|
this->addUniform ("g_ModelViewProjectionMatrix", &this->m_modelViewProjectionMatrix);
|
|
|
|
|
+ this->addUniform ("g_ModelMatrix", &this->m_modelMatrix);
|
|
|
|
|
+ this->addUniform ("g_NormalModelMatrix", glm::identity <glm::mat3> ());
|
|
|
|
|
+ this->addUniform ("g_ViewProjectionMatrix", &this->m_viewProjectionMatrix);
|
|
|
this->addUniform ("g_PointerPosition", this->m_material->getImage ()->getScene ()->getMousePosition ());
|
|
this->addUniform ("g_PointerPosition", this->m_material->getImage ()->getScene ()->getMousePosition ());
|
|
|
this->addUniform ("g_PointerPositionLast", this->m_material->getImage ()->getScene ()->getMousePositionLast ());
|
|
this->addUniform ("g_PointerPositionLast", this->m_material->getImage ()->getScene ()->getMousePositionLast ());
|
|
|
this->addUniform ("g_EffectTextureProjectionMatrix", glm::mat4(1.0));
|
|
this->addUniform ("g_EffectTextureProjectionMatrix", glm::mat4(1.0));
|
|
@@ -899,6 +918,21 @@ void CPass::addUniform (const std::string& name, const glm::vec4** value)
|
|
|
this->addUniform (name, UniformType::Vector4, value);
|
|
this->addUniform (name, UniformType::Vector4, value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void CPass::addUniform (const std::string& name, glm::mat3 value)
|
|
|
|
|
+{
|
|
|
|
|
+ this->addUniform (name, UniformType::Matrix3, value);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CPass::addUniform (const std::string& name, const glm::mat3* value)
|
|
|
|
|
+{
|
|
|
|
|
+ this->addUniform (name, UniformType::Matrix3, value, 1);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CPass::addUniform (const std::string& name, const glm::mat3** value)
|
|
|
|
|
+{
|
|
|
|
|
+ this->addUniform (name, UniformType::Matrix3, value);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void CPass::addUniform (const std::string& name, glm::mat4 value)
|
|
void CPass::addUniform (const std::string& name, glm::mat4 value)
|
|
|
{
|
|
{
|
|
|
this->addUniform (name, UniformType::Matrix4, value);
|
|
this->addUniform (name, UniformType::Matrix4, value);
|