bullet3/Demos3/GpuDemos/GpuDemo.h
erwin coumans 100449d76f faster scene construction when not using instancing (avoid copy individual vertices/shapes to GPU, but do it afterwards in a batch), copy GPU data in 'writeAllBodiesToGpu' method
add option --no_instanced_collision_shapes, this only applies to the 2 benchmark screnes at the moment
always use the user specified b3Config file, so the settings can be set at runtime, not just at compile time
adjust default constants in b3Config (needs more tweaking, ideally at run-time)
2013-06-08 11:08:44 -07:00

81 lines
1.8 KiB
C++

#ifndef GPU_DEMO_H
#define GPU_DEMO_H
class GLInstancingRenderer;
class GLPrimitiveRenderer;
class GpuDemo
{
protected:
struct GpuDemoInternalData* m_clData;
virtual void initCL(int preferredDeviceIndex, int preferredPlatformIndex);
virtual void exitCL();
public:
typedef class GpuDemo* (CreateFunc)();
struct ConstructionInfo
{
bool useOpenCL;
int preferredOpenCLPlatformIndex;
int preferredOpenCLDeviceIndex;
int arraySizeX;
int arraySizeY;
int arraySizeZ;
bool m_useConcaveMesh;
float gapX;
float gapY;
float gapZ;
bool m_useInstancedCollisionShapes;
GLInstancingRenderer* m_instancingRenderer;
GLPrimitiveRenderer* m_primRenderer;
class b3gWindowInterface* m_window;
class GwenUserInterface* m_gui;
ConstructionInfo()
:useOpenCL(true),
preferredOpenCLPlatformIndex(-1),
preferredOpenCLDeviceIndex(-1),
arraySizeX(30),
arraySizeY(30),
arraySizeZ(30),
m_useConcaveMesh(false),
gapX(14.3),
gapY(14.0),
gapZ(14.3),
m_useInstancedCollisionShapes(true),
m_instancingRenderer(0),
m_window(0),
m_gui(0)
{
}
};
GpuDemo();
virtual ~GpuDemo();
virtual const char* getName()=0;
virtual void initPhysics(const ConstructionInfo& ci)=0;
virtual void exitPhysics()=0;
virtual void renderScene()=0;
virtual void clientMoveAndDisplay()=0;
int registerGraphicsSphereShape(const ConstructionInfo& ci, float radius, bool usePointSprites=true, int largeSphereThreshold=100, int mediumSphereThreshold=10);
struct GpuDemoInternalData* getInternalData();
};
#endif