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