Panda3D
 All Classes Functions Variables Enumerations
fltGeometry.h
1 // Filename: fltGeometry.h
2 // Created by: drose (28Feb01)
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 FLTGEOMETRY_H
16 #define FLTGEOMETRY_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltBeadID.h"
21 #include "fltPackedColor.h"
22 #include "fltHeader.h"
23 
24 #include "luse.h"
25 
26 class FltTexture;
27 class FltMaterial;
28 
29 ////////////////////////////////////////////////////////////////////
30 // Class : FltGeometry
31 // Description : This is a base class for both FltFace and FltMesh,
32 // which are two different kinds of geometric primitives
33 // that might be encountered in a MultiGen file. They
34 // have similar properties.
35 ////////////////////////////////////////////////////////////////////
36 class FltGeometry : public FltBeadID {
37 public:
38  FltGeometry(FltHeader *header);
39 
40  enum DrawType {
41  DT_solid_cull_backface = 0,
42  DT_solid_no_cull = 1,
43  DT_wireframe = 2,
44  DT_wireframe_close = 3,
45  DT_wireframe_highlight = 4,
46  DT_omni_light = 8,
47  DT_uni_light = 9,
48  DT_bi_light = 10
49  };
50 
51  enum BillboardType {
52  BT_none = 0,
53  BT_fixed = 1,
54  BT_axial = 2,
55  BT_point = 4
56  };
57 
58  enum Flags {
59  F_terrain = 0x80000000,
60  F_no_color = 0x40000000,
61  F_no_alt_color = 0x20000000,
62  F_packed_color = 0x10000000,
63  F_terrain_footprint = 0x08000000,
64  F_hidden = 0x04000000
65  };
66 
67  enum LightMode {
68  LM_face_no_normal = 0,
69  LM_vertex_no_normal = 1,
70  LM_face_with_normal = 2,
71  LM_vertex_with_normal = 3
72  };
73 
74  int _ir_color;
75  int _relative_priority;
76  DrawType _draw_type;
77  bool _texwhite;
78  int _color_name_index;
79  int _alt_color_name_index;
80  BillboardType _billboard_type;
81  int _detail_texture_index;
82  int _texture_index;
83  int _material_index;
84  int _dfad_material_code;
85  int _dfad_feature_id;
86  int _ir_material_code;
87  int _transparency;
88  int _lod_generation_control;
89  int _line_style_index;
90  unsigned int _flags;
91  LightMode _light_mode;
92  FltPackedColor _packed_color;
93  FltPackedColor _alt_packed_color;
94  int _texture_mapping_index;
95  int _color_index;
96  int _alt_color_index;
97 
98 public:
99  INLINE bool has_texture() const;
100  INLINE FltTexture *get_texture() const;
101  INLINE void set_texture(FltTexture *texture);
102 
103  INLINE bool has_material() const;
104  INLINE FltMaterial *get_material() const;
105  INLINE void set_material(FltMaterial *material);
106 
107  INLINE bool has_color() const;
108  LColor get_color() const;
109  void set_color(const LColor &color);
110  LRGBColor get_rgb() const;
111  void set_rgb(const LRGBColor &rgb);
112 
113  bool has_alt_color() const;
114  LColor get_alt_color() const;
115  LRGBColor get_alt_rgb() const;
116 
117 
118 protected:
119  virtual bool extract_record(FltRecordReader &reader);
120  virtual bool build_record(FltRecordWriter &writer) const;
121 
122 public:
123  virtual TypeHandle get_type() const {
124  return get_class_type();
125  }
126  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
127  static TypeHandle get_class_type() {
128  return _type_handle;
129  }
130  static void init_type() {
131  FltBeadID::init_type();
132  register_type(_type_handle, "FltGeometry",
133  FltBeadID::get_class_type());
134  }
135 
136 private:
137  static TypeHandle _type_handle;
138 };
139 
140 #include "fltGeometry.I"
141 
142 #endif
143 
144 
LRGBColor get_rgb() const
Returns the primary color of the face, as a three-component value ignoring transparency.
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly...
A base class for any of a broad family of flt beads that include an ID.
Definition: fltBeadID.h:27
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
bool has_alt_color() const
Returns true if the face has an alternate color indicated, false otherwise.
bool has_material() const
Returns true if the face has a material applied, false otherwise.
Definition: fltGeometry.I:61
void set_color(const LColor &color)
Sets the primary color of the face, using the packed color convention.
Represents a single material in the material palette.
Definition: fltMaterial.h:30
This is a base class for both FltFace and FltMesh, which are two different kinds of geometric primiti...
Definition: fltGeometry.h:36
bool has_texture() const
Returns true if the face has a texture applied, false otherwise.
Definition: fltGeometry.I:23
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
void set_material(FltMaterial *material)
Applies the indicated material to this face, or if the material is NULL, clears it.
Definition: fltGeometry.I:83
Represents a single texture in the texture palette.
Definition: fltTexture.h:29
FltTexture * get_texture() const
Returns the texture applied to this face, or NULL if no texture was applied.
Definition: fltGeometry.I:34
A packed color record, A, B, G, R.
FltMaterial * get_material() const
Returns the material applied to this face, or NULL if no material was applied.
Definition: fltGeometry.I:72
LRGBColor get_alt_rgb() const
If has_alt_color() indicates true, returns the alternate color of the face, as a three-component valu...
bool has_color() const
Returns true if the face has a primary color indicated, false otherwise.
Definition: fltGeometry.I:99
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
LColor get_alt_color() const
If has_alt_color() indicates true, returns the alternate color of the face, as a four-component value...
LColor get_color() const
Returns the primary color of the face, as a four-component value (including alpha as the transparency...
Definition: fltGeometry.cxx:65
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
void set_rgb(const LRGBColor &rgb)
Sets the primary color of the face, using the packed color convention; does not affect transparency...
void set_texture(FltTexture *texture)
Applies the indicated texture to this face, or if the texture is NULL, clears it. ...
Definition: fltGeometry.I:45