Panda3D
vertexElementArray.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file vertexElementArray.h
10  * @author aignacio
11  * @date 2006-01
12  */
13 
14 #ifndef VERTEX_ELEMENT_ARRAY_H
15 #define VERTEX_ELEMENT_ARRAY_H
16 
17 /**
18  * This class gives the ability for a user-friendly way of creating a vertex
19  * declaration for DirectX 9. Since a vertex shader has a fixed input, the
20  * vertex element array can be cached so that a new vertex declaration for
21  * different vertex buffers can be quickly created. Be sure to call
22  * add_end_vertex_element ( ) when finished creating a vertex element array.
23  * VERTEX_ELEMENT_TYPE is used for a simplified mapping of vertex buffer data
24  * to vertex shader inputs. This class is used with DXShaderContext9 and in
25  * conjunction with DXVertexBufferContext9.
26  */
28 {
29 public:
30 
31  VertexElementArray (int maximum_vertex_elements);
32  ~VertexElementArray ( );
33 
34  void add_position_xyz_vertex_element (int stream_index, int offset);
35  void add_position_xyzw_vertex_element (int stream_index, int offset);
36 
37  void add_normal_vertex_element (int stream_index, int offset);
38  void add_binormal_vertex_element (int stream_index, int offset);
39  void add_tangent_vertex_element (int stream_index, int offset);
40 
41  void add_diffuse_color_vertex_element (int stream_index, int offset);
42  void add_specular_color_vertex_element (int stream_index, int offset);
43 
44  void add_u_vertex_element (int stream_index, int offset, int texture_stage);
45  void add_uv_vertex_element (int stream_index, int offset, int texture_stage);
46  void add_uvw_vertex_element (int stream_index, int offset, int texture_stage);
47  void add_xyzw_vertex_element (int stream_index, int offset, int texture_stage);
48 
49  bool add_end_vertex_element (void);
50 
51  int _total_elements;
52  int _maximum_vertex_elements;
53 
54  LPD3DVERTEXELEMENT9 _vertex_element_array;
55 };
56 
57 #endif
This class gives the ability for a user-friendly way of creating a vertex declaration for DirectX 9.