The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
Public Member Functions | List of all members
dune::simple_mesh Class Reference

A very simple mesh class with position-only vertex attributes. More...

#include <simple_mesh.h>

Inheritance diagram for dune::simple_mesh:
dune::d3d_mesh dune::mesh< DirectX::XMFLOAT3 > dune::aabb< DirectX::XMFLOAT3 >

Public Member Functions

void push_back (DirectX::XMFLOAT3 &p)
 Add a new vertex p to the mesh.
 
virtual void create (ID3D11Device *device, const tstring &name)
 Create a new simple_mesh. More...
 
virtual void render (ID3D11DeviceContext *context, DirectX::XMFLOAT4X4 *to_clip=nullptr)
 Renders the mesh using the shaders previously set. More...
 
virtual size_t num_vertices ()
 Returns the number of vertices of a mesh.
 
virtual size_t num_faces ()
 Returns the number of faces of a mesh.
 
virtual void destroy ()
 Destroy a mesh and free all its resources.
 
- Public Member Functions inherited from dune::d3d_mesh
virtual 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 normal_tex=-1, INT specular_tex=-1)
 Sets three register numbers to identify the slots the pixel shader is looking for surface textures.
 
- 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.
 
virtual void set_world (const DirectX::XMFLOAT4X4 &world)
 Update the world matrix of this mesh.
 
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...
 

Detailed Description

A very simple mesh class with position-only vertex attributes.

This class represents a very simple implementation of a d3d_mesh. A simple_mesh only contains vertices with a position attribute. Use this class if you want to specify simple geometry for which fixed attributes will be declared in a shader. An example usage of this class is the fullscreen triangle used for a deferred renderer.

Note
Yes I know you can use SV_VertexID as well to generate a fullscreen triangle, but PIX didn't like it and since then I didn't care...

Member Function Documentation

virtual void dune::simple_mesh::create ( ID3D11Device *  device,
const tstring &  name 
)
inlinevirtual

Create a new simple_mesh.

This function creates a new, empty simple_mesh.

Parameters
deviceThe Direct3D device.
nameInstead of a filename, a name is used to write the creating of a simple_mesh into a log. This parameter serves no other purpose.

Implements dune::d3d_mesh.

References assert_hr, and num_faces().

virtual void dune::simple_mesh::render ( ID3D11DeviceContext *  context,
DirectX::XMFLOAT4X4 *  to_clip = nullptr 
)
inlinevirtual

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.

Parameters
contextA Direct3D context.
to_clipA clip-space matrix against which the mesh is being culled.

Implements dune::d3d_mesh.

References num_vertices().


The documentation for this class was generated from the following file: