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

Default implementation of assimp_mesh (pun intended). More...

#include <assimp_mesh.h>

Inheritance diagram for dune::gilga_mesh:
dune::assimp_mesh dune::d3d_mesh dune::mesh< DirectX::XMFLOAT3 > dune::aabb< DirectX::XMFLOAT3 > skydome

Classes

struct  gilga_vertex
 A gilga_vertex comes with position, normal, one texture coordinate and a tanget. More...
 
struct  mesh_data
 Mesh data for CPU side useage. More...
 
struct  mesh_data_ps
 Mesh constant buffer data uploaded to the pixel shader. More...
 
struct  mesh_data_vs
 Mesh constant buffer data uploaded to the vertex shader. More...
 

Public Member Functions

virtual void create (ID3D11Device *device, const tstring &file)
 Create a mesh from a given filename.
 
virtual void render (ID3D11DeviceContext *context, DirectX::XMFLOAT4X4 *to_clip=nullptr)
 Renders the mesh using the shaders previously set. More...
 
virtual void destroy ()
 Destroy a mesh and free all its resources.
 
void prepare_context (ID3D11DeviceContext *context)
 Prepares the context for rendering a gilga_mesh with the correct shader.
 
void render_direct (ID3D11DeviceContext *context, DirectX::XMFLOAT4X4 *to_clip)
 Render the gilga_mesh without touching the current state, which is useful if the shader has been set externally.
 
void set_alpha_slot (INT alpha_tex=-1)
 Set the texture register for alpha textures. More...
 
- Public Member Functions inherited from dune::assimp_mesh
size_t num_vertices ()
 Returns the number of vertices of a mesh.
 
size_t num_faces ()
 Returns the number of faces of a mesh.
 
- 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.
 

Protected Types

enum  
 gilga_mesh supports different shading modes to switch lighting.
 

Protected Member Functions

void push_back (vertex v)
 Push back a new vertex: this member needs to be overloaded in derived assimp_mesh objects.
 
- 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

Default implementation of assimp_mesh (pun intended).

This class is the default implementation for models loaded with an assimp_mesh. Vertices transported from assimp_mesh via push_back are internally copied into gilga_vertex vertices and uploaded to the GPU.

Member Function Documentation

void dune::gilga_mesh::render ( ID3D11DeviceContext *  context,
DirectX::XMFLOAT4X4 *  to_clip = nullptr 
)
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.

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

Implements dune::d3d_mesh.

References prepare_context(), and render_direct().

Referenced by drf_renderer::do_render_rsm(), and drf_renderer::do_render_scene().

void dune::gilga_mesh::set_alpha_slot ( INT  alpha_tex = -1)
inline

Set the texture register for alpha textures.

gilga_mesh objects can have alpha textures, hence this function can be used to set the texture register for a texture.

Parameters
alpha_texThe register of the alpha texture. Leaving the value at -1 is equal to ignoring the texture slot.

Referenced by dc::rsm_renderer< dune::differential_directional_light >::do_render_rsm(), and dc::common_renderer::do_render_scene().


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