46class EXPCL_PANDA_EGG EggGroupNode :
public EggNode {
56 typedef plist< PT(EggNode) > Children;
61 explicit EggGroupNode(
const std::string &name =
"") : EggNode(name) { }
62 EggGroupNode(
const EggGroupNode ©);
63 EggGroupNode &operator = (
const EggGroupNode ©);
64 virtual ~EggGroupNode();
66 virtual void write(std::ostream &out,
int indent_level)
const;
73#if defined(WIN32_VC) || defined(WIN64_VC)
74 typedef const PT(EggNode) *pointer;
75 typedef const PT(EggNode) *const_pointer;
77 typedef Children::const_pointer pointer;
78 typedef Children::const_pointer const_pointer;
80 typedef Children::const_reference reference;
81 typedef Children::const_reference const_reference;
82 typedef Children::const_iterator iterator;
83 typedef Children::const_iterator const_iterator;
84 typedef Children::const_reverse_iterator reverse_iterator;
85 typedef Children::const_reverse_iterator const_reverse_iterator;
86 typedef Children::size_type size_type;
87 typedef Children::difference_type difference_type;
89 iterator begin()
const;
91 reverse_iterator rbegin()
const;
92 reverse_iterator rend()
const;
94 iterator insert(iterator position, PT(EggNode) x);
95 iterator erase(iterator position);
96 iterator erase(iterator first, iterator last);
97 void replace(iterator position, PT(EggNode) x);
101 size_type size()
const;
111 EXTENSION(PyObject *get_children()
const);
112 MAKE_PROPERTY(children, get_children);
115 PT(EggNode) remove_child(EggNode *node);
118 EggNode *
find_child(
const std::string &name)
const;
133 enum TriangulateFlags {
138 T_flat_shaded = 0x010,
145 int rename_nodes(vector_string strip_prefix,
bool recurse);
162 unsigned int max_vertices,
166 virtual void update_under(
int depth_offset);
168 virtual void r_transform(
const LMatrix4d &mat,
const LMatrix4d &inv,
169 CoordinateSystem to_cs);
170 virtual void r_transform_vertices(
const LMatrix4d &mat);
171 virtual void r_mark_coordsys(CoordinateSystem cs);
172 virtual void r_flatten_transforms();
173 virtual void r_apply_texmats(EggTextureCollection &textures);
176 CoordinateSystem find_coordsys_entry();
177 int find_textures(EggTextureCollection *collection);
178 int find_materials(EggMaterialCollection *collection);
179 bool r_load_externals(
const DSearchPath &searchpath,
180 CoordinateSystem coordsys,
184 INLINE
static bool is_right(
const LVector2d &v1,
const LVector2d &v2);
188 const_iterator _gnc_iterator;
193 void prepare_add_child(EggNode *node);
194 void prepare_remove_child(EggNode *node);
197 class NVertexReference {
203 typedef pvector<NVertexReference> NVertexGroup;
204 typedef pmap<LVertexd, NVertexGroup> NVertexCollection;
206 void r_collect_vertex_normals(NVertexCollection &collection,
207 double threshold, CoordinateSystem cs);
208 void do_compute_vertex_normals(
const NVertexGroup &group);
211 class TBNVertexReference {
218 class TBNVertexValue {
220 INLINE
bool operator < (
const TBNVertexValue &other)
const;
223 std::string _uv_name;
227 typedef pvector<TBNVertexReference> TBNVertexGroup;
228 typedef pmap<TBNVertexValue, TBNVertexGroup> TBNVertexCollection;
230 void r_collect_tangent_binormal(
const GlobPattern &uv_name,
231 TBNVertexCollection &collection);
232 void do_compute_tangent_binormal(
const TBNVertexValue &value,
233 const TBNVertexGroup &group);
239 static void init_type() {
240 EggNode::init_type();
242 EggNode::get_class_type());
245 return get_class_type();
247 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
252 friend class EggTextureCollection;
253 friend class EggMaterialCollection;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
This class stores a list of directories that can be searched, in order, to locate a particular file.
int triangulate_polygons(int flags)
Replace all higher-order polygons at this point in the scene graph and below with triangles.
int remove_unused_vertices(bool recurse)
Removes all vertices from VertexPools within this group or below that are not referenced by at least ...
virtual void write(std::ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
int remove_invalid_primitives(bool recurse)
Removes primitives at this level and below which appear to be degenerate; e.g.
void strip_normals()
Removes all normals from primitives, and the vertices they reference, at this node and below.
EggNode * find_child(const std::string &name) const
Returns the child of this node whose name is the indicated string, or NULL if there is no child of th...
void get_connected_shading()
Queries the connected_shading information on all primitives at this node and below,...
void resolve_filenames(const DSearchPath &searchpath)
Walks the tree and attempts to resolve any filenames encountered.
bool has_absolute_pathnames() const
Returns true if any nodes at this level and below include a reference to a file via an absolute pathn...
void apply_first_attribute(bool recurse)
Sets the first vertex of the triangle (or each component) to the primitive normal and/or color,...
EggNode * add_child(EggNode *node)
Adds the indicated child to the group and returns it.
int rename_nodes(vector_string strip_prefix, bool recurse)
Rename by stripping out the prefix.
bool recompute_tangent_binormal_auto()
This function recomputes the tangent and binormal for any texture coordinate set that affects a norma...
void post_apply_flat_attribute(bool recurse)
Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices o...
EggNode * get_next_child()
Returns the next child in the group's list of children since the last call to get_first_child() or ge...
void mesh_triangles(int flags)
Combine triangles together into triangle strips, at this group and below.
void rebuild_vertex_pools(EggVertexPools &vertex_pools, unsigned int max_vertices, bool recurse)
Copies vertices used by the primitives at this group node (and below, if recurse is true) into one or...
bool recompute_tangent_binormal(const GlobPattern &uv_name)
This function recomputes the tangent and binormal for the named texture coordinate set for all vertic...
void apply_last_attribute(bool recurse)
Sets the last vertex of the triangle (or each component) to the primitive normal and/or color,...
void make_point_primitives()
Creates PointLight primitives to reference any otherwise unreferences vertices discovered in this gro...
void unify_attributes(bool use_connected_shading, bool allow_per_primitive, bool recurse)
Applies per-vertex normal and color to all vertices, if they are in fact per-vertex (and different fo...
EggNode * get_first_child()
Returns the first child in the group's list of children, or NULL if the list of children is empty.
void recompute_polygon_normals(CoordinateSystem cs=CS_default)
Recomputes all the polygon normals for polygon geometry at this group node and below so that they acc...
void recompute_vertex_normals(double threshold, CoordinateSystem cs=CS_default)
Recomputes all the vertex normals for polygon geometry at this group node and below so that they accu...
virtual bool joint_has_primitives() const
Returns true if there are any primitives (e.g.
void force_filenames(const Filename &directory)
Similar to resolve_filenames, but each non-absolute filename encountered is arbitrarily taken to be i...
void clear_connected_shading()
Resets the connected_shading information on all primitives at this node and below,...
void replace(iterator position, PT(EggNode) x)
Replaces the node at the indicated position with the indicated node.
virtual bool has_primitives() const
Returns true if there are any primitives (e.g.
void steal_children(EggGroupNode &other)
Moves all the children from the other node to this one.
virtual bool has_normals() const
Returns true if any of the primitives (e.g.
void reverse_vertex_ordering()
Reverses the vertex ordering of all polygons defined at this node and below.
This is a collection of materials by MRef name.
This is a collection of textures by TRef name.
A collection of vertices.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
The name of a file, such as a texture file or an Egg file.
This class can be used to test for string matches against standard Unix- shell filename globbing conv...
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL list.
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.
bool is_right(const LVector2 &v1, const LVector2 &v2)
Returns true if the 2-d v1 is to the right of v2.
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.