9 #ifndef DUNE_COMPOSITE_MESH
10 #define DUNE_COMPOSITE_MESH
31 typedef std::shared_ptr<d3d_mesh> mesh_ptr;
32 std::vector<mesh_ptr> meshes_;
40 void set_shader(ID3D11Device* device, ID3DBlob* input_binary, ID3D11VertexShader* vs, ID3D11PixelShader* ps);
42 virtual void set_shader_slots(INT diffuse_tex = -1, INT specular_tex = -1, INT normal_tex = -1);
44 void create(ID3D11Device* device,
const tstring& file);
60 void render(ID3D11DeviceContext* context, DirectX::XMFLOAT4X4* to_clip =
nullptr);
66 inline size_t size() {
return meshes_.size(); }
72 #endif // COMPOSITE_MESH
void push_back(mesh_ptr &m)
Add a new mesh m to the composite_mesh.
Definition: composite_mesh.cpp:107
A mesh composed from other meshes.
Definition: composite_mesh.h:28
virtual void set_world(const DirectX::XMFLOAT4X4 &world)
Update the world matrix of this mesh.
Definition: composite_mesh.cpp:18
void render(ID3D11DeviceContext *context, DirectX::XMFLOAT4X4 *to_clip=nullptr)
Renders the mesh using the shaders previously set.
Definition: composite_mesh.cpp:80
void create_from_dir(ID3D11Device *device, const tstring &pattern)
Create a composite_mesh from a filename pattern.
Definition: composite_mesh.cpp:51
mesh_ptr operator[](size_t i)
Returns the mesh at index i.
Definition: composite_mesh.cpp:117
const DirectX::XMFLOAT4X4 & world()
Returns the current world matrix of this mesh.
Definition: mesh.h:79
virtual void destroy()
Destroy a mesh and free all its resources.
Definition: composite_mesh.cpp:85
size_t size()
Returns the number of submeshes.
Definition: composite_mesh.h:66
void create(ID3D11Device *device, const tstring &file)
Create a mesh from a given filename.
Definition: composite_mesh.cpp:32
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...
Definition: composite_mesh.cpp:112
A basic pattern.
Definition: tracker.h:28
Main D3D mesh interface class.
Definition: mesh.h:129
size_t num_vertices()
Returns the number of vertices of a mesh.
Definition: composite_mesh.cpp:93
size_t num_faces()
Returns the number of faces of a mesh.
Definition: composite_mesh.cpp:100
void set_shader(ID3D11Device *device, ID3DBlob *input_binary, ID3D11VertexShader *vs, ID3D11PixelShader *ps)
Sets the input layout, vertex- and pixel shader of this mesh.
Definition: composite_mesh.cpp:24