29#ifndef PHYSX_SNIPPET_RENDER_H
30#define PHYSX_SNIPPET_RENDER_H
32#include "PxPhysicsAPI.h"
33#include "foundation/PxPreprocessor.h"
37 #pragma warning(disable: 4505)
39 #include <GL/freeglut.h>
42 #pragma clang diagnostic push
43 #pragma clang diagnostic ignored "-Wreserved-identifier"
46 #include <GL/freeglut.h>
48 #pragma clang diagnostic pop
52 #include <GLUT/glut.h>
54 #error platform not supported.
58typedef void (*RenderCallback) ();
59typedef void (*ExitCallback) ();
64 void setupDefault(
const char* name,
Camera* camera, KeyboardCallback kbcb, RenderCallback rdcb, ExitCallback excb);
69 return computeWorldRayF(
float(xs),
float(ys), camDir);
72 physx::PxU32 getScreenWidth();
73 physx::PxU32 getScreenHeight();
75 void enableVSync(
bool vsync);
77 void startRender(
const Camera* camera,
float nearClip = 1.0f,
float farClip = 10000.0f,
float fov=60.0f,
bool setupLighting=
true);
79 void print(
const char* text);
87#if PX_SUPPORT_GPU_PHYSX
93 void initialize(physx::PxCudaContextManager* contextManager);
94 void allocate(physx::PxU32 sizeInBytes);
100 physx::PxCudaContextManager* cudaContextManager;
110 void showFPS(
int updateIntervalMS = 30,
const char* info = NULL);
113 void renderActors(
physx::PxRigidActor** actors,
const physx::PxU32 numActors,
bool shadows =
false,
const physx::PxVec3& color =
physx::PxVec3(0.0f, 0.75f, 0.0f), TriggerRender* cb = NULL,
bool changeColorForSleepingActors =
true,
bool wireframePass=
true);
116 void renderMesh(physx::PxU32 nbVerts,
const physx::PxVec3* verts, physx::PxU32 nbTris,
const physx::PxU32* indices,
const physx::PxVec3& color,
const physx::PxVec3* normals = NULL,
bool flipFaceOrientation =
false);
117 void renderMesh(physx::PxU32 nbVerts,
const physx::PxVec4* verts, physx::PxU32 nbTris,
const physx::PxU32* indices,
const physx::PxVec3& color,
const physx::PxVec4* normals = NULL,
bool flipFaceOrientation =
false);
118 void renderHairSystem(physx::PxHairSystem* hairSystem,
const physx::PxVec4* vertexPositionInvMass, physx::PxU32 numVertices);
125 void DrawPoints(GLuint vbo, physx::PxU32 numPoints,
const physx::PxVec3& color,
float scale, physx::PxU32 coordinatesPerPoint = 3, physx::PxU32 stride = 4 *
sizeof(
float),
size_t offset = 0);
127 void DrawLines(GLuint vbo, physx::PxU32 numPoints,
const physx::PxVec3& color,
float scale, physx::PxU32 coordinatesPerPoint = 3, physx::PxU32 stride = 4 *
sizeof(
float),
size_t offset = 0);
133 void DrawMeshIndexedNoNormals(GLuint vbo, GLuint elementbuffer, GLuint numTriangles,
const physx::PxVec3& color, physx::PxU32 stride = 4 *
sizeof(
float));
134 void DrawMeshIndexed(GLuint vbo, GLuint elementbuffer, GLuint numTriangles,
const physx::PxVec3& color, physx::PxU32 stride = 6 *
sizeof(
float));
136 GLuint CreateTexture(physx::PxU32 width, physx::PxU32 height,
const GLubyte* buffer,
bool createMipmaps);
137 void UpdateTexture(GLuint texId, physx::PxU32 width, physx::PxU32 height,
const GLubyte* buffer,
bool createMipmaps);
138 void ReleaseTexture(GLuint texId);
139 void DrawRectangle(
float x_start,
float x_end,
float y_start,
float y_end,
const physx::PxVec3& color_top,
const physx::PxVec3& color_bottom,
float alpha, physx::PxU32 screen_width, physx::PxU32 screen_height,
bool draw_outline,
bool texturing);
140 void DisplayTexture(GLuint texId, physx::PxU32 size, physx::PxU32 margin);
Definition SnippetRender.h:82
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
Geometry holder class.
Definition PxGeometryHelpers.h:66
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition PxRigidActor.h:53
Abstract class for collision shapes.
Definition PxShape.h:146
Represents a FEM softbody including everything to calculate its definition like geometry and material...
Definition PxSoftBody.h:104
3 Element vector class.
Definition PxVec3.h:50
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335