Panda3D

geomEnums.h

00001 // Filename: geomEnums.h
00002 // Created by:  drose (14Apr05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef GEOMENUMS_H
00016 #define GEOMENUMS_H
00017 
00018 #include "pandabase.h"
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //       Class : GeomEnums
00022 // Description : This class exists just to provide scoping for the
00023 //               various enumerated types used by Geom,
00024 //               GeomVertexData, GeomVertexArrayData, GeomPrimitive,
00025 //               and other related classes.
00026 ////////////////////////////////////////////////////////////////////
00027 class EXPCL_PANDA_GOBJ GeomEnums {
00028 PUBLISHED:
00029 
00030   // The usage hint describes to the rendering backend how often the
00031   // data in question will be modified and/or rendered.  It allows the
00032   // backend to make appropriate choices about what part of memory the
00033   // data should be stored in.
00034 
00035   // The hint is provided as a performance optimization only, and does
00036   // not constrain actual usage; although it may be an important
00037   // optimization.
00038 
00039   enum UsageHint {
00040     // The following are intentionally ordered from most dynamic to
00041     // most static.  In general, if usage_a < usage_b, then usage_a is
00042     // more dynamic than usage_b.
00043 
00044     // UH_client: don't attempt to upload the data; always keep it on
00045     // the client.
00046     UH_client,
00047 
00048     // UH_stream: the data will be created once, used to render a few
00049     // times, and then discarded.  This should be used for short-lived
00050     // temporary objects.
00051     UH_stream,
00052 
00053     // UH_dynamic: the data will be repeatedly modified and
00054     // re-rendered.  This is for data that will be modified at
00055     // runtime, such as animated or soft-skinned vertices.
00056     UH_dynamic,
00057 
00058     // UH_static: the data will be created once, and used to render
00059     // many times, without modification.  This is the most common
00060     // case, since typically vertex data is not directly animated
00061     // (this is not related to scene graph animation, e.g. from
00062     // adjusting transforms on a node).
00063     UH_static,
00064 
00065     // UH_unspecified: the usage is unspecified.  This is intended as
00066     // a "don't care" option for abstract objects; it should not be
00067     // applied to any actual geometry to be rendered.  You take your
00068     // chances if a geom actually gets into the scene graph with this
00069     // set.
00070     UH_unspecified,
00071   };
00072 
00073   // This type specifies a number of bits that are used to represent
00074   // the rendering requirements of a particular Geom, as well as the
00075   // rendering capabilities of the GSG.  The difference between the
00076   // two indicates whether the Geom needs to be munged for the GSG.
00077   enum GeomRendering {
00078     // If there are indexed points.
00079     GR_indexed_point        = 0x00001,
00080 
00081     // If there is indexed geometry of any other type.
00082     GR_indexed_other        = 0x10000,
00083 
00084     // The union of all of the indexed attributes.
00085     GR_indexed_bits         = 0x10001,
00086 
00087     // If there are any points at all.
00088     GR_point                = 0x00002,
00089 
00090     // If the points are all the same size, other than 1 pixel.
00091     GR_point_uniform_size   = 0x00004,
00092 
00093     // If the points have a per-vertex size designation.
00094     GR_per_point_size       = 0x00008,
00095 
00096     // If the points' size is specified in camera units rather than
00097     // screen pixels.
00098     GR_point_perspective    = 0x00010,
00099 
00100     // If the points have a non-square aspect ratio.
00101     GR_point_aspect_ratio   = 0x00020,
00102 
00103     // If the points are under a scale transform, uniform or non-uniform.
00104     GR_point_scale          = 0x00040,
00105 
00106     // If the points are rotated off the orthonormal axis.
00107     GR_point_rotate         = 0x00080,
00108 
00109     // If the points require texture coordinates interpolated across
00110     // their face, to render textures as sprites.
00111     GR_point_sprite         = 0x00100,
00112 
00113     // If there is a texture matrix applied to the sprite's generated
00114     // texture coordinates.
00115     GR_point_sprite_tex_matrix = 0x00200,
00116 
00117     // The union of all the above point attributes, except GR_indexed_point.
00118     GR_point_bits           = 0x003fe,
00119 
00120     // If there are any of these composite types.
00121     GR_triangle_strip       = 0x00400,
00122     GR_triangle_fan         = 0x00800,
00123     GR_line_strip           = 0x01000,
00124 
00125     // The union of all of the above composite types.
00126     GR_composite_bits       = 0x01c00,
00127 
00128     // If the shade model requires a particular vertex for flat shading.
00129     GR_flat_first_vertex    = 0x02000,
00130     GR_flat_last_vertex     = 0x04000,
00131 
00132     // The union of the above shade model types.
00133     GR_shade_model_bits     = 0x06000,
00134 
00135     // If there is a TexGenAttrib in effect with M_light_vector
00136     // enabled, meaning we need to generate the tangent space light
00137     // vector as the texture coordinates.
00138     GR_texcoord_light_vector = 0x08000,
00139   };
00140 
00141   // The shade model specifies whether the per-vertex colors and
00142   // normals indexed by a given primitive truly represent per-vertex
00143   // colors and normals, or whether they actually represent
00144   // per-triangle flat-shaded colors and normals.
00145   enum ShadeModel {
00146     // SM_uniform: all vertices across all faces have the same colors
00147     // and normals.  It doesn't really matter which ShadeModelAttrib
00148     // mode is used to render this primitive.
00149     SM_uniform, 
00150 
00151     // SM_smooth: vertices within a single face have different
00152     // colors/normals that should be smoothed across the face.  This
00153     // primitive should be rendered with SmoothModelAttrib::M_smooth.
00154     SM_smooth,  
00155 
00156     // SM_flat_(first,last)_vertex: each face within the primitive
00157     // might have a different color/normal than the other faces, but
00158     // across a particular face there is only one color/normal.  Each
00159     // face's color/normal is taken from the (first, last) vertex of
00160     // the face.  This primitive should be rendered with
00161     // SmoothModelAttrib::M_flat.
00162     SM_flat_first_vertex,
00163     SM_flat_last_vertex,
00164   };
00165 
00166   // The primitive type represents the core primitive type of a
00167   // particular GeomPrimitive.  It's used for determining what kind of
00168   // antialiasing should be enabled.
00169   enum PrimitiveType {
00170     PT_none,
00171     PT_polygons,
00172     PT_lines,
00173     PT_points
00174   };
00175 
00176   // The numeric type determines what physical representation is used
00177   // to encode a numeric value within the vertex data.
00178   enum NumericType {
00179     NT_uint8,        // An integer 0..255
00180     NT_uint16,       // An integer 0..65535
00181     NT_uint32,       // An integer 0..4294967296
00182     NT_packed_dcba,  // DirectX style, four byte values packed in a uint32
00183     NT_packed_dabc,  // DirectX packed color order (ARGB)
00184     NT_float32,      // A single-precision float
00185     NT_float64,      // A double-precision float
00186     NT_stdfloat      // Either single- or double-precision, according to vertices-float64.
00187   };
00188 
00189   // The contents determine the semantic meaning of a numeric value
00190   // within the vertex data.  This is also used to determine what
00191   // automatic transforms might be applied to the various columns.
00192   enum Contents {
00193     C_other,        // Arbitrary meaning, leave it alone
00194     C_point,        // A point in 3-space or 4-space
00195     C_clip_point,   // A point pre-transformed into clip coordinates
00196     C_vector,       // A surface normal, tangent, or binormal
00197     C_texcoord,     // A texture coordinate
00198     C_color,        // 3- or 4-component color, ordered R, G, B, [A]
00199     C_index,        // An index value into some other table
00200     C_morph_delta,  // A delta from some base value, defining a blend shape
00201   };
00202 
00203   // The type of animation data that is represented by a particular
00204   // GeomVertexFormat.
00205   enum AnimationType {
00206     AT_none,     // No vertex animation.
00207     AT_panda,    // Vertex animation calculated on the CPU by Panda.
00208     AT_hardware, // Hardware-accelerated animation on the graphics card.
00209   };
00210 };
00211 
00212 EXPCL_PANDA_GOBJ ostream &operator << (ostream &out, GeomEnums::UsageHint usage_hint);
00213 EXPCL_PANDA_GOBJ istream &operator >> (istream &in, GeomEnums::UsageHint &usage_hint);
00214 EXPCL_PANDA_GOBJ ostream &operator << (ostream &out, GeomEnums::NumericType numeric_type);
00215 EXPCL_PANDA_GOBJ ostream &operator << (ostream &out, GeomEnums::Contents contents);
00216 
00217 #endif
00218 
 All Classes Functions Variables Enumerations