water radius now changeable in config file, also improved the look of the water
This commit is contained in:
@@ -123,7 +123,8 @@ void dd::Renderer::CreateBuffers()
|
||||
m_UnitSphere = ResourceManager::Load<Model>("Models/Core/UnitSphere.obj");
|
||||
m_StandardNormal = ResourceManager::Load<Texture>("Textures/Core/NeutralNormalMap.png");
|
||||
m_StandardSpecular = ResourceManager::Load<Texture>("Textures/Core/NeutralSpecularMap.png");
|
||||
m_WhiteSphereTexture = ResourceManager::Load<Texture>("Textures/Test/Water.png");
|
||||
//m_WhiteSphereTexture = ResourceManager::Load<Texture>("Textures/Test/Water.png");
|
||||
m_WhiteSphereTexture = ResourceManager::Load<Texture>("Textures/Particles/FadeBall.png");
|
||||
|
||||
glGenRenderbuffers(1, &m_RbDepthBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_RbDepthBuffer);
|
||||
@@ -207,8 +208,8 @@ void dd::Renderer::CreateBuffers()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Resolution.Width, m_Resolution.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
//Fill water pass
|
||||
glGenFramebuffers(1, &m_FbWater);
|
||||
@@ -557,7 +558,9 @@ void dd::Renderer::DrawWater(RenderQueue &rq)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
m_SpWater2->Bind();
|
||||
//TODO: Add this in water particle component. Blurradius
|
||||
float radius = 3.f;
|
||||
|
||||
float radius = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Water.Radius", 0.2f);
|
||||
radius *= 35;
|
||||
|
||||
glUniform2fv(glGetUniformLocation(shaderProgramHandle, "dir"), 1, glm::value_ptr(glm::vec2(1.0f, 0.0f)));
|
||||
glUniform1f(glGetUniformLocation(shaderProgramHandle, "res"), m_Resolution.Width);
|
||||
|
||||
@@ -29,7 +29,7 @@ void dd::Systems::PhysicsSystem::Initialize()
|
||||
|
||||
void dd::Systems::PhysicsSystem::InitializeWater()
|
||||
{
|
||||
float radius = 0.13f;
|
||||
float radius = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Water.Radius", 0.2f);
|
||||
float gravityScale = 1.0f;
|
||||
|
||||
b2ParticleSystemDef m_ParticleSystemDef;
|
||||
@@ -477,6 +477,7 @@ void dd::Systems::PhysicsSystem::CreateParticleGroup(EntityID e)
|
||||
|
||||
transformChild->Position = glm::vec3(t_ParticlePositions[i].x - transform->Position.x, t_ParticlePositions[i].y - transform->Position.y, -9.5f);
|
||||
transformChild->Scale = glm::vec3(m_WaterParticleSystem->GetRadius())/transform->Scale;
|
||||
transformChild->Scale *= 2;
|
||||
m_World->CommitEntity(t_waterparticle);
|
||||
|
||||
m_EntitiesToWaterParticleHandle.insert(std::make_pair(t_waterparticle, m_WaterParticleSystem->GetParticleHandleFromIndex(i)));
|
||||
|
||||
Reference in New Issue
Block a user