![]() |
Bullet Physics 3D Block Toy
|
The renderer. More...
#include <Renderer.h>
Public Member Functions | |
| CRenderer () | |
| Constructor. | |
| ~CRenderer () | |
| Destructor. | |
| void | Initialize () |
| Initialize. More... | |
| void | LoadGeometricPrimitives () |
| Load meshes. More... | |
| void | LoadModel (eModel, const std::wstring &) |
| Load model from file. More... | |
| void | Render (CObject *) |
| Render an object. More... | |
| LBaseCamera * | GetCameraPtr () const |
| Get the camera pointer. More... | |
| ID3D12Device * | GetD3DDevice () const |
| Get the D3D device pointer. More... | |
| const Vector3 & | GetExtents (const eModel) const |
| Get model extents. More... | |
| CMeshDesc * | GetPrimitiveDesc (const eMesh) const |
| Get mesh descriptor. More... | |
Private Member Functions | |
| void | BeginResourceUpload () |
| Begin resource upload. | |
| void | EndResourceUpload () |
| End resource upload. More... | |
| void | UploadTexture (char *, eMesh) |
| Upload texture to GPU. More... | |
| void | UploadDefaultEffect (CMeshDesc *) |
| Upload default effect to GPU. More... | |
| void | UploadSphereMesh (CMeshDesc *) |
| Upload sphere mesh to GPU. More... | |
| void | UploadBoxMesh (CMeshDesc *) |
| Upload box mesh to GPU. More... | |
| void | UploadPrimitiveMesh (CMeshDesc *) |
| Upload geometric primitive mesh to GPU. More... | |
Private Attributes | |
| CMeshDesc ** | m_pPrimitive |
| Array of primitive descriptors. | |
| LTextureDesc * | m_pTextureDesc = nullptr |
| Array of texture descriptors. | |
| size_t | m_nNumTextures = 0 |
| Number of textures. | |
| std::map< eModel, CModelDesc * > | m_mapModelDesc |
| Model descriptor map. | |
Additional Inherited Members | |
Protected Attributes inherited from CCommon | |
| const float | m_fFloorHt = 0.5f |
| Floor height. | |
| const Vector3 | m_vPlanePos = Vector3(0.0f, 0.0f, 100.0f) |
| Plane position. | |
| const Vector3 | m_vPlaneSize = Vector3(600.0f, 2.0f*m_fFloorHt, 600.0f) |
| Plane size. | |
| const float | m_fMoonRadius = 25.0f |
| Moon radius. | |
| const float | m_fBallRadius = 2.0f |
| Ball radius. | |
| const Vector3 | m_vBoxSize = Vector3(9.0f, 6.0f, 6.0f) |
| Box size. | |
| const float | m_fTetrahedronSize = 16.0f |
| Tetrahedron size. | |
| const float | m_fIcosahedronSize = 16.0f |
| Icosahedron size. | |
| const float | m_fDodecahedronSize = 16.0f |
| Dodecahedron size. | |
| const float | m_fTeapotSize = 8.0f |
| Teapot size. | |
Static Protected Attributes inherited from CCommon | |
| static CRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static LBaseCamera * | m_pCamera = nullptr |
| Pointer to the camera. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to object manager. | |
| static btDiscreteDynamicsWorld * | m_pPhysicsWorld = nullptr |
| Pointer to physics engine. | |
| static btDefaultCollisionConfiguration * | m_pConfig = nullptr |
| Bullet physics configuration. | |
| static btCollisionDispatcher * | m_pDispatcher = nullptr |
| Bullet physics dispatcher. | |
| static btBroadphaseInterface * | m_pBroadphase = nullptr |
| Bullet physics broadphase. | |
| static btSequentialImpulseConstraintSolver * | m_pSolver = nullptr |
| Bullet physics constraint solver. | |
| static btAlignedObjectArray< btCollisionShape * > | m_btCollisionShapes |
| Collision shapes. | |
| static bool | m_bCollisionSoundsMuted = false |
| Mute collision sounds. | |
CRenderer handles the game-specific rendering tasks, relying on the base class to do all of the actual API-specific rendering.
|
private |
Wait for the upload thread to terminate.
| LBaseCamera * CRenderer::GetCameraPtr | ( | ) | const |
Reader function for the camera pointer.
| ID3D12Device * CRenderer::GetD3DDevice | ( | ) | const |
Reader function for the D3D device pointer.
| const Vector3 & CRenderer::GetExtents | ( | const eModel | t | ) | const |
Reader function for the model extents (half width, height, and depth).
| t | Model type. |
Get a pointer to the geometric primitive descriptor for a mesh type.
| t | Mesh type. |
| void CRenderer::Initialize | ( | ) |
Initialize the renderer, set the background color, and create a perspective camera.
| void CRenderer::LoadGeometricPrimitives | ( | ) |
Load meshes, textures, and effects for geometric primitives.
| void CRenderer::LoadModel | ( | eModel | t, |
| const std::wstring & | strPath | ||
| ) |
Load a model mesh and texture from a file to the GPU.
| t | Model type. |
| strPath | Wide string containing path and file name. |
| void CRenderer::Render | ( | CObject * | pObj | ) |
Render an object.
| pObj | Pointer to the object to be rendered. May be nullptr. |
|
private |
Upload box mesh to GPU. This gets its own function because we will be repeating the texture across each face.
| pDesc | Pointer to geometric primitive descriptor. |
|
private |
Upload default effect to GPU.
| pDesc | Pointer to geometric primitive descriptor. |
|
private |
General function for uploading a geometric primitive mesh. Creates a new primitive mesh descriptor and fills it with mesh information including a local copy of vertices, and stores a pointer to it in m_vecPrimitives[t] for later use, for example, in physics calculations such as collision detection and response.
| pDesc | Pointer to geometric primitive descriptor. |
|
private |
Upload sphere mesh to GPU. The sphere gets its own function because it has its own level of triangulation, which will be larger for large spheres.
| pDesc | Pointer to geometric primitive descriptor. |
|
private |
Upload texture to GPU.
| name | Name string found in gamesettings.xml. |
| t | Texture type. |