28class EXPCL_PANDA_PGRAPHNODES LODNode :
public PandaNode {
30 INLINE
explicit LODNode(
const std::string &name);
32 static PT(LODNode) make_default_lod(
const std::string &name);
35 INLINE LODNode(
const LODNode ©);
40 virtual void xform(
const LMatrix4 &mat);
43 virtual void output(std::ostream &out)
const;
53 INLINE
void add_switch(PN_stdfloat in, PN_stdfloat out);
54 INLINE
bool set_switch(
int index, PN_stdfloat in, PN_stdfloat out);
58 INLINE PN_stdfloat
get_in(
int index)
const;
60 INLINE PN_stdfloat
get_out(
int index)
const;
95 int compute_child(
CullTraverser *trav, CullTraverserData &data);
97 bool show_switches_cull_callback(
CullTraverser *trav, CullTraverserData &data);
98 virtual void compute_internal_bounds(CPT(
BoundingVolume) &internal_bounds,
99 int &internal_vertices,
101 Thread *current_thread)
const;
103 INLINE
void consider_verify_lods(
CullTraverser *trav, CullTraverserData &data);
109 void do_show_switch(CData *cdata,
int index,
const LColor &color);
110 void do_hide_switch(CData *cdata,
int index);
111 bool do_verify_child_bounds(
const CData *cdata,
int index,
112 PN_stdfloat &suggested_radius)
const;
113 void do_auto_verify_lods(
CullTraverser *trav, CullTraverserData &data);
115 static const LColor &get_default_show_color(
int index);
120 INLINE Switch(PN_stdfloat in, PN_stdfloat out);
121 INLINE PN_stdfloat
get_in()
const;
122 INLINE PN_stdfloat
get_out()
const;
124 INLINE
void set_range(PN_stdfloat in, PN_stdfloat out);
125 INLINE
bool in_range(PN_stdfloat dist)
const;
126 INLINE
bool in_range_2(PN_stdfloat dist2)
const;
128 INLINE
void rescale(PN_stdfloat factor);
130 INLINE
bool is_shown()
const;
131 INLINE
void show(
const LColor &color);
134 INLINE PandaNode *get_ring_viz()
const;
135 INLINE PandaNode *get_spindle_viz()
const;
136 INLINE
const RenderState *get_viz_model_state()
const;
142 INLINE
void clear_ring_viz();
144 void compute_ring_viz();
145 void compute_spindle_viz();
146 void compute_viz_model_state();
152 UnalignedLVecBase4 _show_color;
153 PT(PandaNode) _ring_viz;
154 PT(PandaNode) _spindle_viz;
161 typedef pvector<Switch> SwitchVector;
164 class EXPCL_PANDA_PGRAPHNODES CData :
public CycleData {
167 INLINE CData(
const CData ©);
175 return LODNode::get_class_type();
179 SwitchVector _switch_vector;
180 size_t _lowest, _highest;
181 UpdateSeq _bounds_seq;
183 bool _got_force_switch;
186 PN_stdfloat _lod_scale;
189 PipelineCycler<CData> _cycler;
190 typedef CycleDataReader<CData> CDReader;
191 typedef CycleDataWriter<CData> CDWriter;
192 typedef CycleDataLockedReader<CData> CDLockedReader;
193 typedef CycleDataStageReader<CData> CDStageReader;
194 typedef CycleDataStageWriter<CData> CDStageWriter;
201 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
202 void fillin(DatagramIterator &scan, BamReader *manager);
205 static TypeHandle get_class_type() {
208 static void init_type() {
209 PandaNode::init_type();
211 PandaNode::get_class_type());
213 virtual TypeHandle get_type()
const {
214 return get_class_type();
216 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
219 static TypeHandle _type_handle;
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
A single page of data maintained by a PipelineCycler.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
get_lowest_switch
Returns the index number of the child with the lowest level of detail; that is, the one that is desig...
get_out
Returns the "out" distance of the indicated switch range.
bool set_switch(int index, PN_stdfloat in, PN_stdfloat out)
Changes the switching range of a particular child of the LODNode.
get_in
Returns the "in" distance of the indicated switch range.
void show_all_switches()
Shows all levels in their default colors.
void hide_all_switches()
Hides all levels, restoring the LODNode to normal operation.
bool is_any_shown() const
Returns true if any switch has been shown with show_switch(), indicating the LODNode is in debug show...
set_center
Specifies the center of the LOD.
void hide_switch(int index)
Disables a previous call to show_switch().
get_center
Returns the center of the LOD.
void add_switch(PN_stdfloat in, PN_stdfloat out)
Adds a switch range to the LODNode.
void clear_force_switch()
Undoes the effect of a previous call to force_switch() and releases the LODNode to once again display...
get_highest_switch
Returns the index number of the child with the highest level of detail; that is, the one that is desi...
get_lod_scale
Returns the multiplier for lod distances.
get_num_switches
Returns the number of switch ranges added to the LODNode.
void clear_switches()
Removes the set of switching ranges for the LODNode, presumably in conjunction with removing all of i...
void force_switch(int index)
Forces the LODNode to show the indicated level instead of the level that would normally be shown base...
bool verify_child_bounds() const
Returns true if the bounding volumes for the geometry of each fhild node entirely fits within the swi...
set_lod_scale
Sets the multiplier for lod distances.
void show_switch(int index)
This is provided as a debugging aid.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
virtual bool safe_to_combine() const
Returns true if it is generally safe to combine this particular kind of PandaNode with other kinds of...
virtual bool safe_to_combine_children() const
Returns true if it is generally safe to combine the children of this PandaNode with each other.
static void register_with_read_factory()
Tells the BamReader how to create objects of type PandaNode.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
virtual bool is_lod_node() const
A simple downcast check.
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
This is a sequence number that increments monotonically.
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(),...