This commit is contained in:
you2xie
2018-11-27 11:06:44 +01:00
parent 43628b8f74
commit 2fb9a6be67
4 changed files with 152 additions and 94 deletions

View File

@@ -0,0 +1,49 @@
#ifndef SPHSYSTEMSIMULATOR_h
#define SPHSYSTEMSIMULATOR_h
#include "Simulator.h"
//#include "spheresystem.h", add your sphere system header file
#define NAIVEACC 0
#define GRIDACC 1
class SphereSystemSimulator:public Simulator{
public:
// Construtors
SphereSystemSimulator();
// Functions
const char * getTestCasesStr();
void initUI(DrawingUtilitiesClass * DUC);
void reset();
void drawFrame(ID3D11DeviceContext* pd3dImmediateContext);
void notifyCaseChanged(int testCase);
void externalForcesCalculations(float timeElapsed);
void simulateTimestep(float timeStep);
void onClick(int x, int y);
void onMouse(int x, int y);
protected:
// Attributes
Vec3 externalForce;
Point2D m_mouse;
Point2D m_trackmouse;
Point2D m_oldtrackmouse;
float m_fMass;
float m_fRadius;
float m_fForceScaling;
float m_fDamping;
int m_iNumSpheres;
int m_iKernel; // index of the m_Kernels[5], more detials in SphereSystemSimulator.cpp
static std::function<float(float)> m_Kernels[5];
int m_iAccelerator; // switch between NAIVEACC and GRIDACC, (optionally, KDTREEACC, 2)
//SphereSystem * m_pSphereSystem; // add your own sphere system member!
// for Demo 3 only:
// you will need multiple SphereSystem objects to do comparisons in Demo 3
// m_iAccelerator should be ignored.
// SphereSystem * m_pSphereSystemGrid;
};
#endif