Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ endif()
# Add source files you want to compile (.cpp)
set(CORE_SRC
src/main.cpp
src/camera/camera.cpp
src/viewer/viewer.cpp
src/fluidSolver/fluidSolver.cpp
src/scene/scene.cpp
src/geom/geom.cpp
src/common/controls.cpp
src/common/texture.cpp
src/common/shader.cpp
src/box.cpp
)

add_executable(Thanda ${CORE_SRC})
Expand Down
Binary file added Debug/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions Debug/BoxFrag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#version 330 core

// Ouput data
out vec3 color;

void main()
{

// Output color = black
color = vec3(0.2,0.2,0.2);

}
21 changes: 21 additions & 0 deletions Debug/BoxVert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#version 330 core

// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexColor;

// Output data ; will be interpolated for each fragment.
// out vec3 fragmentColor;
// Values that stay constant for the whole mesh.
uniform mat4 MVP;

void main(){

// Output position of the vertex, in clip space : MVP * position
gl_Position = MVP * vec4(vertexPosition_modelspace,1);

// The color of each vertex will be interpolated
// to produce the color of each fragment
//fragmentColor = vertexColor;
}

19 changes: 19 additions & 0 deletions Debug/ParticleFrag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 330 core

// Interpolated values from the vertex shaders
in vec2 UV;
in vec4 particlecolor;

// Ouput data
out vec4 color;

uniform sampler2D myTextureSampler;

void main(){
// Output color = color of the texture at the specified UV

//for use after an OH consultation
color = texture( myTextureSampler, UV ) * particlecolor;
//color = texture( myTextureSampler, UV ) * vec4(0.2,0.4,0.8,1.0);

}
34 changes: 34 additions & 0 deletions Debug/ParticleVert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#version 330 core

// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 squareVertices;
layout(location = 1) in vec4 xyzs; // Position of the center of the particule and size of the square
layout(location = 2) in vec4 color; // Position of the center of the particule and size of the square

// Output data ; will be interpolated for each fragment.
out vec2 UV;
out vec4 particlecolor;

// Values that stay constant for the whole mesh.
uniform vec3 CameraRight_worldspace;
uniform vec3 CameraUp_worldspace;
uniform mat4 VP; // Model-View-Projection matrix, but without the Model (the position is in BillboardPos; the orientation depends on the camera)

void main()
{
float particleSize = xyzs.w; // because we encoded it this way.
vec3 particleCenter_wordspace = xyzs.xyz;

vec3 vertexPosition_worldspace =
particleCenter_wordspace
+ CameraRight_worldspace * squareVertices.x * particleSize
+ CameraUp_worldspace * squareVertices.y * particleSize;

// Output position of the vertex
gl_Position = VP * vec4(vertexPosition_worldspace, 1.0f);

// UV of the vertex. No special space for this one.
UV = squareVertices.xy + vec2(0.5, 0.5);
particlecolor = color;
}

Binary file added Debug/Thanda
Binary file not shown.
Binary file added Debug/particle.DDS
Binary file not shown.
8 changes: 4 additions & 4 deletions src/scene/scene.json → Debug/scene.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"scaleZ" : 5.0
},
"particleDim" : {
"boundX" : 3.7,
"boundY" : 3.7,
"boundZ" : 3.7
"boundX" : 1,
"boundY" : 1,
"boundZ" : 1
},
"particleSeparation" : 0.1
"particleSeparation" : 0.05
}
33 changes: 33 additions & 0 deletions Kernels.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Kernels.hpp
// Thanda
//
// Created by Alex Daley-Montgomery on 4/10/16.
//
//

#ifndef Kernels_hpp
#define Kernels_hpp

#include <stdio.h>
#include "constants.hpp"

class Kernels {
public:
static float poly6(float dist) {
if (dist > k_radius) return 0;
else return (315 / (64 * M_PI * pow(k_radius, 9))) * pow(pow(k_radius,2) - pow(dist,2),3);
};
static float spiky(float dist) {
if (dist > k_radius || dist == 0) return 0;
else {
return -(45 / (M_PI * pow(k_radius, 6))) * pow(k_radius - dist,2);
}
};
static float viscosity(float dist) {
if (dist > k_radius) return 0;
else return (45 / (M_PI * pow(k_radius, 6))) * (k_radius - dist);
};
};

#endif /* Kernels_hpp */
39 changes: 39 additions & 0 deletions PCISPHSolver.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// PCISPHSolver.cpp
// Thanda
//
// Created by Alex Daley-Montgomery on 4/11/16.
//
//

#include "PCISPHSolver.hpp"



void PCISPHSolver::update() {

}

void PCISPHSolver::getNeighbors() {

}

void PCISPHSolver::prepForces() {

}

void PCISPHSolver::predict() {

}

void PCISPHSolver::predict2() {

}

void PCISPHSolver::computePressure() {

}

void PCISPHSolver::updatePosition() {

}
27 changes: 27 additions & 0 deletions PCISPHSolver.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// PCISPHSolver.hpp
// Thanda
//
// Created by Alex Daley-Montgomery on 4/11/16.
//
//

#ifndef PCISPHSolver_hpp
#define PCISPHSolver_hpp

#include <stdio.h>
#include "SPHSolver.hpp"

class PCISPHSolver {
public:
void update();
void getNeighbors();
void prepForces();
void predict();
void predict2();
void computePressure();
void updatePosition();

};

#endif /* PCISPHSolver_hpp */
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# CIS563-FluidSolver
(Credit : CIS565 README)

Fluid Solver Submission guidelines:
My final project will be to implement a fully functional IISPH solver as outlined here:
http://cg.informatik.uni-freiburg.de/publications/2013_TVCG_IISPH.pdf


- If you have modified any of the CMakeLists.txt files at all (aside from the list of CORE_SRC), you must test that your project can build. Beware of any build issues.

- Open a GitHub pull request so that we can see that you have finished. The title should be "Submission: YOUR NAME".

- In the body of the pull request, include a link to your repository.

- Submit on canvas with a direct link to your pull request on GitHub


And you're done!
I would also like to implement a very simple property-tuning GUI. This would be purely drawn in OpenGL, and controlled by the arrow keys.
22 changes: 22 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CIS 563: 3D Viewer

For optimal clarity and organization, view the code by opening the 'Thanda.xcodeproject' file.

My 3D viewer builds the scene specified by a "scene.json" file located at the site of the build. By default, this is the DEBUG folder. This location is also where any shaders live.

Camera controls are identical to the tutorials reccommended by Debanshu, where UP and DOWN move the camera forward and backward along the camera's 'front' vector. LEFT and RIGHT move the camera along its 'right' vector. Mouse movements will change the direction of the camera, just like any FPS.

To my knowledge, all required features have been implemented. With regard to extra features, I'm going to go out on a limb and say that it's a little too late for any extra credit.

Documentation:

MAIN - The primary window and event loop {
SCENE - Reads the JSON file and composes the scene's bounding box and solver {
BOX (GEOM) - Self-drawing bounding box
FLUIDSOLVER (GEOM) - Self-drawing update mechanism containing all the particles {
PARTICLE - individual particle contained within fluidsolver.hpp/cpp
}
}
}

GEOM - Header from which all drawable objects inherit
Loading