18 LODNode(
const std::string &name) :
47 cdata->_switch_vector.push_back(Switch(in, out));
48 cdata->check_limits();
50 if (cdata->_num_shown != 0) {
51 mark_internal_bounds_stale();
61 nassertr(in >= out,
false);
64 nassertr(index >= 0 && index < (
int)cdata->_switch_vector.size(),
false);
65 cdata->_switch_vector[index].set_range(in, out);
66 cdata->check_limits();
68 if (cdata->_num_shown != 0) {
69 mark_internal_bounds_stale();
82 cdata->_switch_vector.clear();
86 if (cdata->_num_shown != 0) {
87 mark_internal_bounds_stale();
98 CDReader cdata(_cycler);
99 return cdata->_switch_vector.size();
107 CDReader cdata(_cycler);
108 return cdata->_lod_scale;
117 CDWriter cdata(_cycler);
118 cdata->_lod_scale = value;
128 CDReader cdata(_cycler);
129 nassertr(index >= 0 && index < (
int)cdata->_switch_vector.size(), 0.0);
130 return cdata->_switch_vector[index].get_in();
139 CDReader cdata(_cycler);
140 nassertr(index >= 0 && index < (
int)cdata->_switch_vector.size(), 0.0);
141 return cdata->_switch_vector[index].get_out();
151 CDReader cdata(_cycler);
152 return cdata->_lowest;
162 CDReader cdata(_cycler);
163 return cdata->_highest;
173 cdata->_force_switch = index;
174 cdata->_got_force_switch =
true;
184 cdata->_got_force_switch =
false;
194 CDWriter cdata(_cycler);
195 cdata->_center = center;
197 if (cdata->_num_shown != 0) {
198 mark_internal_bounds_stale();
209 CDReader cdata(_cycler);
210 return cdata->_center;
220 return (cdata->_num_shown != 0);
228 INLINE
void LODNode::
232 do_auto_verify_lods(trav, data);
240 INLINE LODNode::CData::
242 _center(0.0f, 0.0f, 0.0f),
245 _got_force_switch(false),
255 INLINE LODNode::CData::
256 CData(
const LODNode::CData ©) :
257 _center(copy._center),
258 _switch_vector(copy._switch_vector),
259 _lowest(copy._lowest),
260 _highest(copy._highest),
262 _got_force_switch(copy._got_force_switch),
263 _force_switch(copy._force_switch),
264 _num_shown(copy._num_shown),
265 _lod_scale(copy._lod_scale)
272 INLINE LODNode::Switch::
273 Switch(PN_stdfloat in, PN_stdfloat out) :
284 INLINE PN_stdfloat LODNode::Switch::
292 INLINE PN_stdfloat LODNode::Switch::
300 INLINE
void LODNode::Switch::
301 set_range(PN_stdfloat in, PN_stdfloat out) {
310 INLINE
bool LODNode::Switch::
311 in_range(PN_stdfloat dist)
const {
312 return (dist >= _out && dist < _in);
320 INLINE
bool LODNode::Switch::
321 in_range_2(PN_stdfloat dist2)
const {
322 return (dist2 >= _out * _out && dist2 < _in * _in);
328 INLINE
void LODNode::Switch::
329 rescale(PN_stdfloat factor) {
338 INLINE
bool LODNode::Switch::
346 INLINE
void LODNode::Switch::
347 show(
const LColor &color) {
355 INLINE
void LODNode::Switch::
365 get_ring_viz()
const {
366 if (_ring_viz.is_null()) {
367 ((Switch *)
this)->compute_ring_viz();
378 get_spindle_viz()
const {
379 if (_spindle_viz.is_null()) {
380 ((Switch *)
this)->compute_spindle_viz();
391 get_viz_model_state()
const {
392 if (_viz_model_state.is_null()) {
393 ((Switch *)
this)->compute_viz_model_state();
396 return _viz_model_state;
403 INLINE
void LODNode::Switch::
404 write_datagram(
Datagram &destination)
const {
413 INLINE
void LODNode::Switch::
423 INLINE
void LODNode::Switch::
426 _spindle_viz.clear();
427 _viz_model_state.clear();
428 _bounds_seq = UpdateSeq::old();