47class EXPCL_PANDA_EGG EggPrimitive :
public EggNode,
public EggAttributes,
56 typedef vector_PT_EggVertex Vertices;
70 INLINE
explicit EggPrimitive(
const std::string &name =
"");
71 INLINE EggPrimitive(
const EggPrimitive ©);
72 INLINE EggPrimitive &operator = (
const EggPrimitive ©);
73 INLINE ~EggPrimitive();
75 virtual EggPrimitive *make_copy()
const=0;
142#if defined(WIN32_VC) || defined(WIN64_VC)
143 typedef PT_EggVertex *pointer;
144 typedef PT_EggVertex *const_pointer;
146 typedef Vertices::const_pointer pointer;
147 typedef Vertices::const_pointer const_pointer;
149 typedef Vertices::const_reference reference;
150 typedef Vertices::const_reference const_reference;
151 typedef Vertices::const_iterator iterator;
152 typedef Vertices::const_iterator const_iterator;
153 typedef Vertices::const_reverse_iterator reverse_iterator;
154 typedef Vertices::const_reverse_iterator const_reverse_iterator;
155 typedef Vertices::size_type size_type;
156 typedef Vertices::difference_type difference_type;
158 INLINE iterator begin()
const;
159 INLINE iterator end()
const;
160 INLINE reverse_iterator rbegin()
const;
161 INLINE reverse_iterator rend()
const;
162 INLINE
bool empty()
const;
163 INLINE size_type size()
const;
165 INLINE
EggVertex *operator [] (
int index)
const;
167 INLINE iterator insert(iterator position,
EggVertex *x);
168 INLINE iterator erase(iterator position);
169 iterator erase(iterator first, iterator last);
182 INLINE
size_t get_num_vertices()
const;
193 virtual void write(std::ostream &out,
int indent_level)
const=0;
196 void test_vref_integrity()
const;
198 void test_vref_integrity()
const { }
207 virtual void prepare_add_vertex(
EggVertex *vertex,
int i,
int n);
208 virtual void prepare_remove_vertex(
EggVertex *vertex,
int i,
int n);
211 void write_body(std::ostream &out,
int indent_level)
const;
213 virtual bool egg_start_parse_body();
214 virtual void r_transform(
const LMatrix4d &mat,
const LMatrix4d &inv,
215 CoordinateSystem to_cs);
216 virtual void r_flatten_transforms();
219 void do_apply_flat_attribute(
int vertex_index,
EggAttributes *attrib);
222 void set_connected_shading(Shading shading,
const EggAttributes *neighbor);
224 class ConnectedShadingNode {
229 typedef pvector<ConnectedShadingNode> ConnectedShadingNodes;
231 void r_set_connected_shading(
int depth_count,
232 Shading shading,
const EggAttributes *neighbor,
233 ConnectedShadingNodes &connected_nodes);
236 typedef vector_PT_EggTexture Textures;
238 PT_EggMaterial _material;
240 Shading _connected_shading;
244 static TypeHandle get_class_type() {
247 static void init_type() {
248 EggNode::init_type();
249 EggAttributes::init_type();
250 EggRenderMode::get_class_type();
252 EggNode::get_class_type(),
253 EggAttributes::get_class_type(),
254 EggRenderMode::get_class_type());
256 virtual TypeHandle get_type()
const {
257 return get_class_type();
259 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
262 static TypeHandle _type_handle;
264 friend class EggTextureCollection;
The set of attributes that may be applied to vertices as well as polygons, such as surface normal and...
void write(std::ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
virtual EggRenderMode * determine_bin()
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_depth_test_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_depth_offset()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
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_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_draw_order()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
set_bface_flag
Sets the backfacing flag of the polygon.
void clear_texture()
Removes any texturing from the primitive.
virtual void unify_attributes(Shading shading)
If the shading property is S_per_vertex, ensures that all vertices have a normal and a color,...
get_material
Returns a pointer to the applied material, or NULL if there is no material applied.
get_pool
Returns the vertex pool associated with the vertices of the primitive, or NULL if the primitive has n...
get_shading
Returns the shading properties apparent on this particular primitive.
void set_texture(EggTexture *texture)
Replaces the current list of textures with the indicated texture.
void copy_vertices(const EggPrimitive &other)
Replaces the current primitive's list of vertices with a copy of the list of vertices on the other pr...
set_material
Applies the indicated material to the primitive.
clear_material
Removes any material from the primitive.
bool has_texture() const
Returns true if the primitive has any textures specified, false otherwise.
bool has_vertex_normal() const
Returns true if any vertex on the primitive has a specific normal set, false otherwise.
get_vertex
Returns a particular index based on its index number.
virtual void apply_first_attribute()
Sets the first vertex of the triangle (or each component) to the primitive normal and/or color,...
get_connected_shading
Determines what sort of shading properties this primitive's connected neighbors have.
void copy_attributes(const EggAttributes &other)
Copies the rendering attributes from the indicated primitive.
virtual bool joint_has_primitives() const
Returns true if there are any primitives (e.g.
set_vertex
Replaces a particular vertex based on its index number in the list of vertices.
get_bface_flag
Retrieves the backfacing flag of the polygon.
EggVertex * add_vertex(EggVertex *vertex)
Adds the indicated vertex to the end of the primitive's list of vertices, and returns it.
void replace(iterator position, EggVertex *vertex)
Replaces the vertex at the indicated position with the indicated vertex.
virtual bool has_normals() const
Returns true if any of the primitives (e.g.
get_num_textures
Returns the number of textures applied to the primitive.
virtual void post_apply_flat_attribute()
Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices o...
virtual void reverse_vertex_ordering()
Reverses the ordering of the vertices in this primitive, if appropriate, in order to change the direc...
get_sort_name
Returns the name of the primitive for the purposes of sorting primitives into different groups,...
remove_vertex
Removes the indicated vertex from the primitive and returns it.
bool has_vertex_color() const
Returns true if any vertex on the primitive has a specific color set, false otherwise.
void remove_doubled_verts(bool closed)
Certain kinds of primitives, particularly polygons, don't like to have the same vertex repeated conse...
void clear()
Removes all of the vertices from the primitive.
void clear_connected_shading()
Resets the connected_shading member in this primitive, so that get_connected_shading() will recompute...
void remove_nonunique_verts()
Removes any multiple appearances of the same vertex from the primitive.
insert_vertex
Inserts a vertex at the given position.
iterator find(EggVertex *vertex)
Returns the iterator pointing to the indicated vertex, or end() if the vertex is not part of the prim...
get_texture
Returns the first texture on the primitive, if any, or NULL if there are no textures on the primitive...
virtual bool has_primitives() const
Returns true if there are any primitives (e.g.
virtual void apply_last_attribute()
Sets the last vertex of the triangle (or each component) to the primitive normal and/or color,...
void add_texture(EggTexture *texture)
Applies the indicated texture to the primitive.
virtual bool cleanup()
Cleans up modeling errors in whatever context this makes sense.
has_material
Returns true if the primitive is materiald (and get_material() will return a real pointer),...
This is a collection of textures by TRef name.
Defines a texture map that may be applied to geometry.
A collection of vertices.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.