Skip to content

Commit

Permalink
SPH
Browse files Browse the repository at this point in the history
  • Loading branch information
AsulconS committed Aug 17, 2020
1 parent ac8e7ba commit 31f88f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ void initGLParams(const SIM_State& sim, const gil::RenderingWindow& window, gil:
particleShader.use();
particleShader.setMat4("view", view);
particleShader.setMat4("projection", projection);
particleShader.setVec3("particleColor", {1.0f, 0.13f, 0.0f});

volcanoShader.use();
volcanoShader.setMat4("view", view);
Expand All @@ -151,9 +150,9 @@ void initSPH(SIM_State& sim)
sim.vertexData.push_back(0.0f);
sim.vertexData.push_back(0.0f);
// Colors
sim.vertexData.push_back(1.0f);
sim.vertexData.push_back(0.13f);
sim.vertexData.push_back(0.0f);
sim.vertexData.push_back(0.5f);
sim.vertexData.push_back(1.0f);
}
}
}
Expand Down Expand Up @@ -186,7 +185,7 @@ void initSPH(SIM_State& sim)

int main()
{
gil::RenderingWindow window {800, 600, "SPH"};
gil::RenderingWindow window {1600, 900, "SPH"};
if(!window.isReady())
{
return EXIT_FAILURE;
Expand Down Expand Up @@ -226,9 +225,9 @@ int main()
// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
gil::Timer timer(true);

glm::vec3 viewPos {0.4f, 0.8f, 1.6f};
glm::vec3 viewPos {0.2f, 0.4f, 0.8f};

gil::Shader shader("shader");
gil::Shader shader("water");
gil::Shader volcanoShader("volcano");
initGLParams(sim, window, shader, volcanoShader, viewPos);
// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions shaders/water.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ void main()
{
discard;
}
if(dot(circCoord, circCoord) > 0.5f)
{
FragColor = vec4(0.0f, 0.0f, 0.5f, 1.0f);
}
//if(dot(circCoord, circCoord) > 0.5f)
//{
//FragColor = vec4(0.6f, 0.85f, 0.91f, 1.0f);
//}
else
{
FragColor = vec4(colorDepth * color, 1.0f);
Expand Down
2 changes: 1 addition & 1 deletion shaders/water.vs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

#define pointSize 32.0f
#define pointSize 64.0f

void main()
{
Expand Down

0 comments on commit 31f88f7

Please sign in to comment.