The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
|
A mesh composed from other meshes. More...
#include <composite_mesh.h>
Public Member Functions | |
size_t | num_vertices () |
Returns the number of vertices of a mesh. | |
size_t | num_faces () |
Returns the number of faces of a mesh. | |
virtual void | set_world (const DirectX::XMFLOAT4X4 &world) |
Update the world matrix of this mesh. | |
void | set_shader (ID3D11Device *device, ID3DBlob *input_binary, ID3D11VertexShader *vs, ID3D11PixelShader *ps) |
Sets the input layout, vertex- and pixel shader of this mesh. | |
virtual void | set_shader_slots (INT diffuse_tex=-1, INT specular_tex=-1, INT normal_tex=-1) |
Sets three register numbers to identify the slots the pixel shader is looking for surface textures. | |
void | create (ID3D11Device *device, const tstring &file) |
Create a mesh from a given filename. | |
void | create_from_dir (ID3D11Device *device, const tstring &pattern) |
Create a composite_mesh from a filename pattern. More... | |
void | push_back (mesh_ptr &m) |
Add a new mesh m to the composite_mesh. | |
void | render (ID3D11DeviceContext *context, DirectX::XMFLOAT4X4 *to_clip=nullptr) |
Renders the mesh using the shaders previously set. More... | |
mesh_ptr | operator[] (size_t i) |
Returns the mesh at index i. | |
size_t | size () |
Returns the number of submeshes. | |
virtual void | destroy () |
Destroy a mesh and free all its resources. | |
Public Member Functions inherited from dune::aabb< DirectX::XMFLOAT3 > | |
DirectX::XMFLOAT3 | center () const |
Returns the center of the bounding-box. | |
DirectX::XMFLOAT3 | bb_max () const |
Returns the maximum (upper/right/back) of the bounding-box. | |
DirectX::XMFLOAT3 | bb_min () const |
Returns the minimum (lower/left/front) of the bounding-box. | |
const DirectX::XMFLOAT4X4 & | world () |
Returns the current world matrix of this mesh. | |
Additional Inherited Members | |
Protected Member Functions inherited from dune::aabb< DirectX::XMFLOAT3 > | |
void | init_bb (const DirectX::XMFLOAT3 &p) |
Initialize the bounding-box with a first point. More... | |
void | update_bb (const DirectX::XMFLOAT3 &p) |
Update the bounding-box with a new point. More... | |
A mesh composed from other meshes.
A composite_mesh object is simply a collection of other d3d_mesh objects. It can be used to group up objects together or simply have one representative for many loaded meshes.
This is not a scenegraph node!
void dune::composite_mesh::create_from_dir | ( | ID3D11Device * | device, |
const tstring & | pattern | ||
) |
Create a composite_mesh from a filename pattern.
Calling this function will search a directory for a pattern and load all hits into as separate meshes to group them up in a composite_mesh.
device | The Direct3D device. |
pattern | A string representing a file pattern, e.g. C:/models/*.obj. |
References create(), dune::extract_path(), and dune::make_absolute_path().
|
virtual |
Renders the mesh using the shaders previously set.
When calling render, the mesh will be rendered using the shaders set with set_shaders(). Additionally, a clip-space matrix can be set to clip away unseen geometry.
context | A Direct3D context. |
to_clip | A clip-space matrix against which the mesh is being culled. |
Implements dune::d3d_mesh.
Referenced by dc::rsm_renderer< dune::differential_directional_light >::do_render_rsm(), and dc::common_renderer::do_render_scene().