File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ add_subdirectory(src/examples/particles2obj)
8181add_subdirectory (src/examples/particles2xml )
8282add_subdirectory (src/examples/smoke_sim )
8383add_subdirectory (src/examples/sph_sim )
84+ add_subdirectory (src/examples/playground )
8485
8586add_subdirectory (external/pybind11 )
8687if (BUILD_FROM_PIP)
Original file line number Diff line number Diff line change 1+ #
2+ # Copyright (c) 2017 Doyub Kim
3+ #
4+ # I am making my contributions/submissions to this project solely in my personal
5+ # capacity and am not conveying any rights to any intellectual property of any
6+ # third parties.
7+ #
8+
9+ # Target name
10+ set (target sandbox)
11+
12+ # Includes
13+ include_directories (${CMAKE_CURRENT_SOURCE_DIR} )
14+
15+ # Sources
16+ file (GLOB sources
17+ ${CMAKE_CURRENT_SOURCE_DIR} /*.cpp )
18+
19+ # Build executable
20+ add_executable (${target}
21+ ${sources} )
22+
23+ # Project options
24+ set_target_properties (${target}
25+ PROPERTIES
26+ ${DEFAULT_PROJECT_OPTIONS} )
27+
28+ # Compile options
29+ target_compile_options (${target}
30+ PRIVATE
31+
32+ PUBLIC
33+ ${DEFAULT_COMPILE_OPTIONS}
34+
35+ INTERFACE )
36+
37+ # Link libraries
38+ target_link_libraries (${target}
39+ PRIVATE
40+ ${DEFAULT_LINKER_OPTIONS}
41+ jet )
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2017 Doyub Kim
2+ //
3+ // I am making my contributions/submissions to this project solely in my
4+ // personal capacity and am not conveying any rights to any intellectual
5+ // property of any third parties.
6+
7+ #include " my_physics_solver.h"
8+
9+ #include < fstream>
10+
11+ using namespace jet ;
12+
13+ void runSimulation (MyPhysicsSolver& solver, double frameIntervalInSeconds,
14+ int numberOfFrames) {
15+ for (Frame frame (0 , frameIntervalInSeconds); frame.index < numberOfFrames;
16+ ++frame) {
17+ printf (" Updating frame %u\n " , frame.index );
18+ solver.update (frame);
19+ }
20+ }
21+
22+ int main () {
23+ // Set up output log file
24+ std::ofstream logFile (" playground.log" );
25+ if (logFile) {
26+ Logging::setAllStream (&logFile);
27+ }
28+
29+ // Set up simulation
30+ MyPhysicsSolver solver;
31+ double frameIntervalInSeconds = 0.01 ;
32+ unsigned int numberOfFrames = 300 ;
33+
34+ // Run the sim
35+ runSimulation (solver, frameIntervalInSeconds, numberOfFrames);
36+
37+ return 0 ;
38+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2017 Doyub Kim
2+ //
3+ // I am making my contributions/submissions to this project solely in my
4+ // personal capacity and am not conveying any rights to any intellectual
5+ // property of any third parties.
6+
7+ #include " my_physics_solver.h"
8+
9+ using namespace jet ;
10+
11+ MyPhysicsSolver::MyPhysicsSolver () {}
12+
13+ MyPhysicsSolver::~MyPhysicsSolver () {}
14+
15+ void MyPhysicsSolver::onInitialize () {
16+ // This function is called at frame 0
17+ // TODO: Perform initialization here
18+ }
19+
20+ void MyPhysicsSolver::onAdvanceTimeStep (double timeIntervalInSeconds) {
21+ // This function is called at frames greater than 0
22+
23+ (void )timeIntervalInSeconds;
24+
25+ // TODO: Perform simulation update here
26+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2017 Doyub Kim
2+ //
3+ // I am making my contributions/submissions to this project solely in my
4+ // personal capacity and am not conveying any rights to any intellectual
5+ // property of any third parties.
6+
7+ #ifndef MY_PHYSICS_SOLVER_H_
8+ #define MY_PHYSICS_SOLVER_H_
9+
10+ #include < jet/jet.h>
11+
12+ class MyPhysicsSolver : public jet ::PhysicsAnimation {
13+ public:
14+ MyPhysicsSolver ();
15+ virtual ~MyPhysicsSolver ();
16+
17+ protected:
18+ void onInitialize () override ;
19+
20+ void onAdvanceTimeStep (double timeIntervalInSeconds) override ;
21+ };
22+
23+ #endif // MY_PHYSICS_SOLVER_H_
You can’t perform that action at this time.
0 commit comments