Titan
v1.0
A high-performance CUDA-based physics simulation sandbox for robotics, physics, and reinforcement learning.
|
Go to the documentation of this file.
15 #include <thrust/host_vector.h>
16 #include <thrust/device_vector.h>
31 #define MAX_BLOCKS 65535 // max number of CUDA blocks
32 #define THREADS_PER_BLOCK 1024
63 void createPlane(
const Vec &abc,
double d,
double FRICTION_K,
double FRICTION_S);
120 void setViewport(
const Vec & camera_position,
const Vec & target_location,
const Vec & up_vector);
121 void moveViewport(
const Vec & displacement);
122 glm::mat4 & getProjectionMatrix();
144 static bool GPU_DONE;
146 std::vector<Constraint *> constraints;
148 thrust::device_vector<CUDA_MASS *> d_masses;
149 thrust::device_vector<CUDA_SPRING *> d_springs;
151 thrust::device_vector<CudaContactPlane> d_planes;
152 thrust::device_vector<CudaBall> d_balls;
155 bool update_constraints;
157 void updateCudaParameters();
159 std::set<double> bpts;
164 int massBlocksPerGrid;
165 int springBlocksPerGrid;
169 void constraintsToArray();
172 void massFromArray();
173 void springFromArray();
174 void constraintsFromArray();
177 std::thread gpu_thread;
183 static SDL_Window * window;
184 static SDL_GLContext context;
185 void createSDLWindow();
187 static GLFWwindow * window;
188 void createGLFWWindow();
191 static GLuint VertexArrayID;
192 static GLuint programID;
193 static GLuint MatrixID;
194 static glm::mat4 MVP;
196 static GLuint vertices;
197 static GLuint colors;
198 static GLuint indices;
202 void updateBuffers();
203 void generateBuffers();
204 void resizeBuffers();
207 static bool update_indices;
208 static bool update_colors;
209 static bool resize_buffers;
211 static int lineWidth;
212 static int pointSize;
Spring * createSpring(Mass *m1, Mass *m2)
void createBall(const Vec ¢er, double r)
void createPlane(const Vec &abc, double d)
void deleteContainer(Container *c)
Container * getContainerByIndex(int i)
void createPlane(const Vec &abc, double d, double FRICTION_K, double FRICTION_S)
Container * importFromSTL(const std::string &path, double density=10.0, int num_rays=5)
std::vector< Container * > containers
Definition: sim.h:117
Spring * getSpringByIndex(int i)
std::vector< Mass * > masses
Definition: sim.h:115
void setAllMassValues(double m)
Beam * createBeam(const Vec ¢er, const Vec &dims, int nx=10, int ny=10, int nz=10)
Mass * getMassByIndex(int i)
void setGlobalAcceleration(const Vec &global_acc)
void setAllSpringConstantValues(double k)
Cube * createCube(const Vec ¢er, double side_length)
void deleteSpring(Spring *s)
void setBreakpoint(double time)
Container * createContainer()
std::vector< Spring * > springs
Definition: sim.h:116
Mass * createMass(const Vec &pos)
void defaultRestLengths()
Lattice * createLattice(const Vec ¢er, const Vec &dims, int nx=10, int ny=10, int nz=10)
void setTimeStep(double delta_t)