2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
2015-04-29 20:33:26 +00:00
|
|
|
#ifndef COMMON_EXAMPLE_INTERFACE_H
|
|
|
|
#define COMMON_EXAMPLE_INTERFACE_H
|
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
struct CommonExampleOptions
|
|
|
|
{
|
|
|
|
struct GUIHelperInterface* m_guiHelper;
|
|
|
|
|
|
|
|
//Those are optional, some examples will use them others don't. Each example should work with them being 0.
|
|
|
|
int m_option;
|
|
|
|
const char* m_fileName;
|
2016-03-10 22:36:46 +00:00
|
|
|
class SharedMemoryInterface* m_sharedMem;
|
2015-05-01 18:42:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
CommonExampleOptions(struct GUIHelperInterface* helper, int option=0)
|
|
|
|
:m_guiHelper(helper),
|
|
|
|
m_option(option),
|
2016-03-10 22:36:46 +00:00
|
|
|
m_fileName(0),
|
|
|
|
m_sharedMem(0)
|
2015-05-01 18:42:14 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2015-04-29 20:33:26 +00:00
|
|
|
|
|
|
|
class CommonExampleInterface
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
typedef class CommonExampleInterface* (CreateFunc)(CommonExampleOptions& options);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-04-29 20:33:26 +00:00
|
|
|
virtual ~CommonExampleInterface()
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-04-29 21:02:50 +00:00
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void initPhysics()=0;
|
|
|
|
virtual void exitPhysics()=0;
|
|
|
|
virtual void stepSimulation(float deltaTime)=0;
|
|
|
|
virtual void renderScene()=0;
|
|
|
|
virtual void physicsDebugDraw(int debugFlags)=0;//for now we reuse the flags in Bullet/src/LinearMath/btIDebugDraw.h
|
2015-05-01 18:42:14 +00:00
|
|
|
//reset camera is only called when switching demo. this way you can restart (initPhysics) and watch in a specific location easier
|
|
|
|
virtual void resetCamera(){};
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual bool mouseMoveCallback(float x,float y)=0;
|
|
|
|
virtual bool mouseButtonCallback(int button, int state, float x, float y)=0;
|
|
|
|
virtual bool keyboardCallback(int key, int state)=0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-05-13 06:03:12 +00:00
|
|
|
class ExampleEntries
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual ~ExampleEntries() {}
|
|
|
|
|
|
|
|
|
|
|
|
virtual void initExampleEntries()=0;
|
|
|
|
|
|
|
|
virtual void initOpenCLExampleEntries()=0;
|
|
|
|
|
|
|
|
virtual int getNumRegisteredExamples()=0;
|
|
|
|
|
|
|
|
virtual CommonExampleInterface::CreateFunc* getExampleCreateFunc(int index)=0;
|
|
|
|
|
|
|
|
virtual const char* getExampleName(int index)=0;
|
|
|
|
|
|
|
|
virtual const char* getExampleDescription(int index)=0;
|
|
|
|
|
|
|
|
virtual int getExampleOption(int index)=0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-05-01 21:52:27 +00:00
|
|
|
CommonExampleInterface* StandaloneExampleCreateFunc(CommonExampleOptions& options);
|
|
|
|
|
|
|
|
#ifdef B3_USE_STANDALONE_EXAMPLE
|
|
|
|
#define B3_STANDALONE_EXAMPLE(ExampleFunc) CommonExampleInterface* StandaloneExampleCreateFunc(CommonExampleOptions& options)\
|
|
|
|
{\
|
|
|
|
return ExampleFunc(options);\
|
|
|
|
}
|
|
|
|
#else//B3_USE_STANDALONE_EXAMPLE
|
|
|
|
#define B3_STANDALONE_EXAMPLE(ExampleFunc)
|
|
|
|
#endif //B3_USE_STANDALONE_EXAMPLE
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
2015-04-29 20:33:26 +00:00
|
|
|
#endif //COMMON_EXAMPLE_INTERFACE_H
|