Panda3D
Loading...
Searching...
No Matches
eggRenderState.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 eggRenderState.h
10 * @author drose
11 * @date 2005-03-12
12 */
13
14#ifndef EGGRENDERSTATE_H
15#define EGGRENDERSTATE_H
16
17#include "pandabase.h"
18
19#include "eggUserData.h"
20#include "eggLoader.h"
21#include "renderState.h"
22#include "renderAttrib.h"
23#include "internalName.h"
24#include "geomPrimitive.h"
25#include "luse.h"
26#include "pointerTo.h"
27#include "pvector.h"
28#include "pmap.h"
29
30class EggPrimitive;
31class EggTexture;
32class EggMaterial;
33
34/**
35 * This class is used within this package only to record the render state that
36 * should be assigned to each primitive. It is assigned to EggPrimitive
37 * objects via the EggBinner.
38 */
39class EXPCL_PANDA_EGG2PG EggRenderState : public EggUserData {
40public:
41 INLINE EggRenderState(EggLoader &loader);
42 INLINE void add_attrib(const RenderAttrib *attrib);
43
44 void fill_state(EggPrimitive *egg_prim);
45
46 int compare_to(const EggRenderState &other) const;
47
48private:
49 CPT(RenderAttrib) get_material_attrib(const EggMaterial *egg_mat,
50 bool bface);
51 static TexGenAttrib::Mode get_tex_gen(const EggTexture *egg_tex);
52
53 CPT(RenderAttrib)
54 apply_tex_mat(CPT(RenderAttrib) tex_mat_attrib,
55 TextureStage *stage, const EggTexture *egg_tex);
56
57public:
58 CPT(RenderState) _state;
59 bool _hidden;
60 bool _flat_shaded;
61 Geom::PrimitiveType _primitive_type;
62
63 typedef EggLoader::BakeInUVs BakeInUVs;
64 typedef EggLoader::TextureDef TextureDef;
65 typedef EggLoader::Materials Materials;
66
67 BakeInUVs _bake_in_uvs;
68
69private:
70 EggLoader &_loader;
71
72 typedef pvector<const TextureDef *> TexMatTextures;
73 typedef pmap<LMatrix4d, TexMatTextures> TexMatTransforms;
74 typedef pmap<CPT(InternalName), TexMatTransforms> TexMats;
75};
76
77#include "eggRenderState.I"
78
79#endif
Converts an egg data structure, possibly read from an egg file but not necessarily,...
Definition eggLoader.h:67
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
void add_attrib(const RenderAttrib *attrib)
A convenience function to add the indicated render attribute to the aggregate state.
void fill_state(EggPrimitive *egg_prim)
Sets up the state as appropriate for the indicated primitive.
int compare_to(const EggRenderState &other) const
Provides a unique ordering for different EggRenderState objects, so that primitives of similar state ...
Defines a texture map that may be applied to geometry.
Definition eggTexture.h:30
Encodes a string name in a hash table, mapping it to a pointer.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition renderState.h:47
Defines the properties of a named stage of the multitexture pipeline.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.