Panda3D
 All Classes Functions Variables Enumerations
eggRenderState.h
1 // Filename: eggRenderState.h
2 // Created by: drose (12Mar05)
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 EGGRENDERSTATE_H
16 #define EGGRENDERSTATE_H
17 
18 #include "pandabase.h"
19 
20 #include "eggUserData.h"
21 #include "eggLoader.h"
22 #include "renderState.h"
23 #include "renderAttrib.h"
24 #include "internalName.h"
25 #include "geomPrimitive.h"
26 #include "luse.h"
27 #include "pointerTo.h"
28 #include "pvector.h"
29 #include "pmap.h"
30 
31 class EggPrimitive;
32 class EggTexture;
33 class EggMaterial;
34 
35 ////////////////////////////////////////////////////////////////////
36 // Class : EggRenderState
37 // Description : This class is used within this package only to record
38 // the render state that should be assigned to each
39 // primitive. It is assigned to EggPrimitive objects
40 // via the EggBinner.
41 ////////////////////////////////////////////////////////////////////
42 class EggRenderState : public EggUserData {
43 public:
44  INLINE EggRenderState(EggLoader &loader);
45  INLINE void add_attrib(const RenderAttrib *attrib);
46 
47  void fill_state(EggPrimitive *egg_prim);
48 
49  int compare_to(const EggRenderState &other) const;
50 
51 private:
52  CPT(RenderAttrib) get_material_attrib(const EggMaterial *egg_mat,
53  bool bface);
54  static TexGenAttrib::Mode get_tex_gen(const EggTexture *egg_tex);
55 
56  CPT(RenderAttrib)
57  apply_tex_mat(CPT(RenderAttrib) tex_mat_attrib,
58  TextureStage *stage, const EggTexture *egg_tex);
59 
60 public:
61  CPT(RenderState) _state;
62  bool _hidden;
63  bool _flat_shaded;
64  Geom::PrimitiveType _primitive_type;
65 
67  typedef EggLoader::TextureDef TextureDef;
69 
70  BakeInUVs _bake_in_uvs;
71 
72 private:
73  EggLoader &_loader;
74 
78 };
79 
80 #include "eggRenderState.I"
81 
82 #endif
83 
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
Definition: eggPrimitive.h:51
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
Defines a texture map that may be applied to geometry.
Definition: eggTexture.h:33
void fill_state(EggPrimitive *egg_prim)
Sets up the state as appropriate for the indicated primitive.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
This class is used within this package only to record the render state that should be assigned to eac...
void add_attrib(const RenderAttrib *attrib)
A convenience function to add the indicated render attribute to the aggregate state.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
int compare_to(const EggRenderState &other) const
Provides a unique ordering for different EggRenderState objects, so that primitives of similar state ...
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:38
This is a base class for a user-defined data type to extend egg structures in processing code...
Definition: eggUserData.h:34
Converts an egg data structure, possibly read from an egg file but not necessarily, into a scene graph suitable for rendering.
Definition: eggLoader.h:70