14 #ifndef EGGPRIMITIVE_H 15 #define EGGPRIMITIVE_H 56 typedef vector_PT_EggVertex Vertices;
70 INLINE
explicit EggPrimitive(
const std::string &name =
"");
85 INLINE std::string get_sort_name()
const;
87 virtual Shading get_shading()
const;
88 INLINE
void clear_connected_shading();
89 INLINE Shading get_connected_shading()
const;
92 INLINE
bool has_texture()
const;
93 INLINE
bool has_texture(
EggTexture *texture)
const;
97 INLINE
void clear_texture();
98 INLINE
int get_num_textures()
const;
100 MAKE_SEQ(get_textures, get_num_textures, get_texture);
103 INLINE
void clear_material();
105 INLINE
bool has_material()
const;
107 INLINE
void set_bface_flag(
bool flag);
108 INLINE
bool get_bface_flag()
const;
110 MAKE_PROPERTY(sort_name, get_sort_name);
111 MAKE_PROPERTY(shading, get_shading);
112 MAKE_PROPERTY(connected_shading, get_connected_shading);
114 MAKE_SEQ_PROPERTY(textures, get_num_textures, get_texture);
115 MAKE_PROPERTY2(material, has_material, get_material, set_material, clear_material);
116 MAKE_PROPERTY(bface_flag, get_bface_flag, set_bface_flag);
121 bool has_vertex_normal()
const;
122 bool has_vertex_color()
const;
124 virtual void unify_attributes(Shading shading);
125 virtual void apply_last_attribute();
126 virtual void apply_first_attribute();
127 virtual void post_apply_flat_attribute();
128 virtual void reverse_vertex_ordering();
129 virtual bool cleanup();
131 void remove_doubled_verts(
bool closed);
132 void remove_nonunique_verts();
133 virtual bool has_primitives()
const;
134 virtual bool joint_has_primitives()
const;
135 virtual bool has_normals()
const;
143 #if defined(WIN32_VC) || defined(WIN64_VC) 144 typedef PT_EggVertex *pointer;
145 typedef PT_EggVertex *const_pointer;
147 typedef Vertices::const_pointer pointer;
148 typedef Vertices::const_pointer const_pointer;
150 typedef Vertices::const_reference reference;
151 typedef Vertices::const_reference const_reference;
152 typedef Vertices::const_iterator iterator;
153 typedef Vertices::const_iterator const_iterator;
154 typedef Vertices::const_reverse_iterator reverse_iterator;
155 typedef Vertices::const_reverse_iterator const_reverse_iterator;
156 typedef Vertices::size_type size_type;
157 typedef Vertices::difference_type difference_type;
159 INLINE iterator begin()
const;
160 INLINE iterator end()
const;
161 INLINE reverse_iterator rbegin()
const;
162 INLINE reverse_iterator rend()
const;
163 INLINE
bool empty()
const;
164 INLINE size_type size()
const;
166 INLINE
EggVertex *operator [] (
int index)
const;
168 INLINE iterator insert(iterator position,
EggVertex *x);
169 INLINE iterator erase(iterator position);
170 iterator erase(iterator first, iterator last);
171 INLINE
void replace(iterator position,
EggVertex *vertex);
179 void remove_vertex(
size_t index);
183 INLINE
size_t get_num_vertices()
const;
184 INLINE
EggVertex *get_vertex(
size_t index)
const;
185 INLINE
void set_vertex(
size_t index,
EggVertex *vertex);
186 INLINE
void insert_vertex(
size_t index,
EggVertex *vertex);
187 MAKE_SEQ(get_vertices, get_num_vertices, get_vertex);
191 MAKE_SEQ_PROPERTY(vertices, get_num_vertices, get_vertex, set_vertex, remove_vertex, insert_vertex);
192 MAKE_PROPERTY(pool, get_pool);
194 virtual void write(std::ostream &out,
int indent_level)
const=0;
197 void test_vref_integrity()
const;
199 void test_vref_integrity()
const { }
208 virtual void prepare_add_vertex(
EggVertex *vertex,
int i,
int n);
209 virtual void prepare_remove_vertex(
EggVertex *vertex,
int i,
int n);
212 void write_body(std::ostream &out,
int indent_level)
const;
214 virtual bool egg_start_parse_body();
215 virtual void r_transform(
const LMatrix4d &mat,
const LMatrix4d &inv,
216 CoordinateSystem to_cs);
217 virtual void r_flatten_transforms();
220 void do_apply_flat_attribute(
int vertex_index,
EggAttributes *attrib);
223 void set_connected_shading(Shading shading,
const EggAttributes *neighbor);
225 class ConnectedShadingNode {
232 void r_set_connected_shading(
int depth_count,
234 ConnectedShadingNodes &connected_nodes);
237 typedef vector_PT_EggTexture Textures;
239 PT_EggMaterial _material;
241 Shading _connected_shading;
248 static void init_type() {
249 EggNode::init_type();
250 EggAttributes::init_type();
251 EggRenderMode::get_class_type();
253 EggNode::get_class_type(),
254 EggAttributes::get_class_type(),
255 EggRenderMode::get_class_type());
258 return get_class_type();
260 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
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...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
void write(std::ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class stores miscellaneous rendering properties that is associated with geometry,...
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for things that may be directly added into the egg hierarchy.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.