Panda3D
geomEnums.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 geomEnums.h
10  * @author drose
11  * @date 2005-04-14
12  */
13 
14 #ifndef GEOMENUMS_H
15 #define GEOMENUMS_H
16 
17 #include "pandabase.h"
18 
19 /**
20  * This class exists just to provide scoping for the various enumerated types
21  * used by Geom, GeomVertexData, GeomVertexArrayData, GeomPrimitive, and other
22  * related classes.
23  */
24 class EXPCL_PANDA_GOBJ GeomEnums {
25 PUBLISHED:
26 
27  // The usage hint describes to the rendering backend how often the data in
28  // question will be modified andor rendered. It allows the backend to make
29  // appropriate choices about what part of memory the data should be stored
30  // in.
31 
32  // The hint is provided as a performance optimization only, and does not
33  // constrain actual usage; although it may be an important optimization.
34 
35  enum UsageHint {
36  // The following are intentionally ordered from most dynamic to most
37  // static. In general, if usage_a < usage_b, then usage_a is more dynamic
38  // than usage_b.
39 
40  // UH_client: don't attempt to upload the data; always keep it on the
41  // client.
42  UH_client,
43 
44  // UH_stream: the data will be created once, used to render a few times,
45  // and then discarded. This should be used for short-lived temporary
46  // objects.
47  UH_stream,
48 
49  // UH_dynamic: the data will be repeatedly modified and re-rendered. This
50  // is for data that will be modified at runtime, such as animated or soft-
51  // skinned vertices.
52  UH_dynamic,
53 
54  // UH_static: the data will be created once, and used to render many
55  // times, without modification. This is the most common case, since
56  // typically vertex data is not directly animated (this is not related to
57  // scene graph animation, e.g. from adjusting transforms on a node).
58  UH_static,
59 
60  // UH_unspecified: the usage is unspecified. This is intended as a "don't
61  // care" option for abstract objects; it should not be applied to any
62  // actual geometry to be rendered. You take your chances if a geom
63  // actually gets into the scene graph with this set.
64  UH_unspecified,
65  };
66 
67  // This type specifies a number of bits that are used to represent the
68  // rendering requirements of a particular Geom, as well as the rendering
69  // capabilities of the GSG. The difference between the two indicates
70  // whether the Geom needs to be munged for the GSG.
71  enum GeomRendering {
72  // If there are indexed points.
73  GR_indexed_point = 0x00001,
74 
75  // If there is indexed geometry of any other type.
76  GR_indexed_other = 0x10000,
77 
78  // The union of all of the indexed attributes.
79  GR_indexed_bits = 0x10001,
80 
81  // If there are any points at all.
82  GR_point = 0x00002,
83 
84  // If the points are all the same size, other than 1 pixel.
85  GR_point_uniform_size = 0x00004,
86 
87  // If the points have a per-vertex size designation.
88  GR_per_point_size = 0x00008,
89 
90  // If the points' size is specified in camera units rather than screen
91  // pixels.
92  GR_point_perspective = 0x00010,
93 
94  // If the points have a non-square aspect ratio.
95  GR_point_aspect_ratio = 0x00020,
96 
97  // If the points are under a scale transform, uniform or non-uniform.
98  GR_point_scale = 0x00040,
99 
100  // If the points are rotated off the orthonormal axis.
101  GR_point_rotate = 0x00080,
102 
103  // If the points require texture coordinates interpolated across their
104  // face, to render textures as sprites.
105  GR_point_sprite = 0x00100,
106 
107  // If there is a texture matrix applied to the sprite's generated texture
108  // coordinates.
109  GR_point_sprite_tex_matrix = 0x00200,
110 
111  // The union of all the above point attributes, except GR_indexed_point.
112  GR_point_bits = 0x003fe,
113 
114  // If there are any of these composite types.
115  GR_triangle_strip = 0x00400,
116  GR_triangle_fan = 0x00800,
117  GR_line_strip = 0x01000,
118 
119  // The union of all of the above composite types.
120  GR_composite_bits = 0x01c00,
121 
122  // If strip-cut indices are used to restart a composite primitive.
123  GR_strip_cut_index = 0x20000,
124 
125  // If the shade model requires a particular vertex for flat shading.
126  GR_flat_first_vertex = 0x02000,
127  GR_flat_last_vertex = 0x04000,
128 
129  // The union of the above shade model types.
130  GR_shade_model_bits = 0x06000,
131 
132  // If a particular non-fill polygon mode is used.
133  GR_render_mode_wireframe= 0x40000,
134  GR_render_mode_point = 0x80000,
135 
136  // The primitive has adjacency information.
137  GR_adjacency = 0x100000,
138  };
139 
140  // The shade model specifies whether the per-vertex colors and normals
141  // indexed by a given primitive truly represent per-vertex colors and
142  // normals, or whether they actually represent per-triangle flat-shaded
143  // colors and normals.
144  enum ShadeModel {
145  // SM_uniform: all vertices across all faces have the same colors and
146  // normals. It doesn't really matter which ShadeModelAttrib mode is used
147  // to render this primitive.
148  SM_uniform,
149 
150  // SM_smooth: vertices within a single face have different colorsnormals
151  // that should be smoothed across the face. This primitive should be
152  // rendered with SmoothModelAttrib::M_smooth.
153  SM_smooth,
154 
155  // SM_flat_(first,last)_vertex: each face within the primitive might have
156  // a different colornormal than the other faces, but across a particular
157  // face there is only one colornormal. Each face's colornormal is taken
158  // from the (first, last) vertex of the face. This primitive should be
159  // rendered with SmoothModelAttrib::M_flat.
160  SM_flat_first_vertex,
161  SM_flat_last_vertex,
162  };
163 
164  // The primitive type represents the core primitive type of a particular
165  // GeomPrimitive. It's used for determining what kind of antialiasing
166  // should be enabled.
167  enum PrimitiveType {
168  PT_none,
169  PT_polygons,
170  PT_lines,
171  PT_points,
172  PT_patches
173  };
174 
175  // The numeric type determines what physical representation is used to
176  // encode a numeric value within the vertex data.
177  enum NumericType {
178  NT_uint8, // An integer 0..255
179  NT_uint16, // An integer 0..65535
180  NT_uint32, // An integer 0..4294967295
181  NT_packed_dcba, // DirectX style, four byte values packed in a uint32
182  NT_packed_dabc, // DirectX packed color order (ARGB)
183  NT_float32, // A single-precision float
184  NT_float64, // A double-precision float
185  NT_stdfloat, // Either single- or double-precision, according to vertices-float64.
186  NT_int8, // An integer -128..127
187  NT_int16, // An integer -32768..32767
188  NT_int32, // An integer -2147483648..2147483647
189  NT_packed_ufloat,// Three 10/11-bit float components packed in a uint32
190  };
191 
192  // The contents determine the semantic meaning of a numeric value within the
193  // vertex data. This is also used to determine what automatic transforms
194  // might be applied to the various columns.
195  enum Contents {
196  C_other, // Arbitrary meaning, leave it alone
197  C_point, // A point in 3-space or 4-space
198  C_clip_point, // A point pre-transformed into clip coordinates
199  C_vector, // A surface tangent or binormal (see C_normal for normals)
200  C_texcoord, // A texture coordinate
201  C_color, // 3- or 4-component color, ordered R, G, B, [A]
202  C_index, // An index value into some other table
203  C_morph_delta, // A delta from some base value, defining a blend shape
204 
205  // A transformation matrix. This is typically three or four columns, but
206  // we pretend it's only one for convenience.
207  C_matrix,
208 
209  // A special version of C_vector that should be used for normal vectors,
210  // which are scaled differently from other vectors.
211  C_normal,
212  };
213 
214  // The type of animation data that is represented by a particular
215  // GeomVertexFormat.
216  enum AnimationType {
217  AT_none, // No vertex animation.
218  AT_panda, // Vertex animation calculated on the CPU by Panda.
219  AT_hardware, // Hardware-accelerated animation on the graphics card.
220  };
221 };
222 
223 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, GeomEnums::UsageHint usage_hint);
224 EXPCL_PANDA_GOBJ std::istream &operator >> (std::istream &in, GeomEnums::UsageHint &usage_hint);
225 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, GeomEnums::NumericType numeric_type);
226 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, GeomEnums::Contents contents);
227 
228 #endif
This class exists just to provide scoping for the various enumerated types used by Geom,...
Definition: geomEnums.h:24
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.