15 #ifndef EGGPRIMITIVE_H 16 #define EGGPRIMITIVE_H 18 #include "pandabase.h" 21 #include "eggAttributes.h" 22 #include "eggVertex.h" 23 #include "eggTexture.h" 24 #include "eggMaterial.h" 25 #include "eggRenderMode.h" 26 #include "pt_EggTexture.h" 27 #include "pt_EggMaterial.h" 28 #include "vector_PT_EggVertex.h" 29 #include "vector_PT_EggTexture.h" 31 #include "pointerTo.h" 60 typedef vector_PT_EggVertex Vertices;
75 INLINE EggPrimitive(
const EggPrimitive ©);
76 INLINE EggPrimitive &operator = (
const EggPrimitive ©);
77 INLINE ~EggPrimitive();
87 INLINE
string get_sort_name()
const;
89 virtual Shading get_shading()
const;
90 INLINE
void clear_connected_shading();
91 INLINE Shading get_connected_shading()
const;
94 INLINE
bool has_texture()
const;
95 INLINE
bool has_texture(
EggTexture *texture)
const;
99 INLINE
void clear_texture();
100 INLINE
int get_num_textures()
const;
102 MAKE_SEQ(get_textures, get_num_textures, get_texture);
105 INLINE
void clear_material();
107 INLINE
bool has_material()
const;
109 INLINE
void set_bface_flag(
bool flag);
110 INLINE
bool get_bface_flag()
const;
113 void copy_attributes(
const EggPrimitive &other);
115 bool has_vertex_normal()
const;
116 bool has_vertex_color()
const;
118 virtual void unify_attributes(Shading shading);
119 virtual void apply_last_attribute();
120 virtual void apply_first_attribute();
121 virtual void post_apply_flat_attribute();
122 virtual void reverse_vertex_ordering();
123 virtual bool cleanup();
125 void remove_doubled_verts(
bool closed);
126 void remove_nonunique_verts();
127 virtual bool has_primitives()
const;
128 virtual bool joint_has_primitives()
const;
129 virtual bool has_normals()
const;
137 #if defined(WIN32_VC) || defined(WIN64_VC) 138 typedef PT_EggVertex *pointer;
139 typedef PT_EggVertex *const_pointer;
141 typedef Vertices::const_pointer pointer;
142 typedef Vertices::const_pointer const_pointer;
144 typedef Vertices::const_reference reference;
145 typedef Vertices::const_reference const_reference;
146 typedef Vertices::const_iterator iterator;
147 typedef Vertices::const_iterator const_iterator;
148 typedef Vertices::const_reverse_iterator reverse_iterator;
149 typedef Vertices::const_reverse_iterator const_reverse_iterator;
150 typedef Vertices::size_type size_type;
151 typedef Vertices::difference_type difference_type;
153 INLINE iterator begin()
const;
154 INLINE iterator end()
const;
155 INLINE reverse_iterator rbegin()
const;
156 INLINE reverse_iterator rend()
const;
157 INLINE
bool empty()
const;
158 INLINE size_type size()
const;
160 INLINE
EggVertex *operator [] (
int index)
const;
162 INLINE iterator insert(iterator position,
EggVertex *x);
163 INLINE iterator erase(iterator position);
164 iterator erase(iterator first, iterator last);
165 INLINE
void replace(iterator position,
EggVertex *vertex);
173 void copy_vertices(
const EggPrimitive &other);
176 INLINE
int get_num_vertices()
const;
177 INLINE
void set_vertex(
int index,
EggVertex *vertex);
178 INLINE
EggVertex *get_vertex(
int index)
const;
179 MAKE_SEQ(get_vertices, get_num_vertices, get_vertex);
183 virtual void write(ostream &out,
int indent_level)
const=0;
186 void test_vref_integrity()
const;
188 void test_vref_integrity()
const { }
197 virtual void prepare_add_vertex(
EggVertex *vertex,
int i,
int n);
198 virtual void prepare_remove_vertex(
EggVertex *vertex,
int i,
int n);
201 void write_body(ostream &out,
int indent_level)
const;
203 virtual bool egg_start_parse_body();
205 CoordinateSystem to_cs);
206 virtual void r_flatten_transforms();
209 void do_apply_flat_attribute(
int vertex_index,
EggAttributes *attrib);
212 void set_connected_shading(Shading shading,
const EggAttributes *neighbor);
214 class ConnectedShadingNode {
221 void r_set_connected_shading(
int depth_count,
223 ConnectedShadingNodes &connected_nodes);
226 typedef vector_PT_EggTexture Textures;
228 PT_EggMaterial _material;
230 Shading _connected_shading;
237 static void init_type() {
238 EggNode::init_type();
239 EggAttributes::init_type();
240 EggRenderMode::get_class_type();
241 register_type(_type_handle,
"EggPrimitive",
242 EggNode::get_class_type(),
243 EggAttributes::get_class_type(),
244 EggRenderMode::get_class_type());
247 return get_class_type();
249 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
257 #include "eggPrimitive.I" A base class for any of a number of kinds of geometry primitives: polygons, point lights...
This is a 4-by-4 transform matrix.
Defines a texture map that may be applied to geometry.
virtual EggRenderMode * determine_draw_order()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_depth_test_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
This is a collection of textures by TRef name.
This is our own Panda specialization on the default STL vector.
This class stores miscellaneous rendering properties that is associated with geometry, and which may be set on the geometry primitive level, on the group above it, or indirectly via a texture.
The set of attributes that may be applied to vertices as well as polygons, such as surface normal and...
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
void write(ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
A base class for things that may be directly added into the egg hierarchy.
TypeHandle is the identifier used to differentiate C++ class types.
virtual EggRenderMode * determine_depth_offset()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
A collection of vertices.