mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
tentative lod scale support
This commit is contained in:
parent
f4e55629fa
commit
34a80d821b
@ -119,6 +119,30 @@ get_num_switches() const {
|
||||
return cdata->_switch_vector.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LODNode::get_lod_scale
|
||||
// Access: Published
|
||||
// Description: Returns the multiplier for lod distances
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float LODNode::
|
||||
get_lod_scale() const {
|
||||
CDReader cdata(_cycler);
|
||||
return cdata->_lod_scale;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LODNode::set_lod_scale
|
||||
// Access: Published
|
||||
// Description: Sets the multiplier for lod distances. A higher
|
||||
// value means you'll see farther switchs than normal
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void LODNode::
|
||||
set_lod_scale(float value) {
|
||||
CDWriter cdata(_cycler);
|
||||
cdata->_lod_scale = value;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LODNode::get_in
|
||||
// Access: Published
|
||||
@ -274,7 +298,8 @@ CData() :
|
||||
_highest(0),
|
||||
_got_force_switch(false),
|
||||
_force_switch(0),
|
||||
_num_shown(0)
|
||||
_num_shown(0),
|
||||
_lod_scale(1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -292,7 +317,8 @@ CData(const LODNode::CData ©) :
|
||||
_bounds_seq(UpdateSeq::old()),
|
||||
_got_force_switch(copy._got_force_switch),
|
||||
_force_switch(copy._force_switch),
|
||||
_num_shown(copy._num_shown)
|
||||
_num_shown(copy._num_shown),
|
||||
_lod_scale(copy._lod_scale)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
|
||||
if (cdata->_got_force_switch) {
|
||||
in_range = (cdata->_force_switch == index);
|
||||
} else {
|
||||
in_range = sw.in_range_2(dist2);
|
||||
in_range = sw.in_range_2(dist2*cdata->_lod_scale);
|
||||
}
|
||||
|
||||
if (in_range) {
|
||||
|
@ -69,6 +69,12 @@ PUBLISHED:
|
||||
INLINE void force_switch(int index);
|
||||
INLINE void clear_force_switch();
|
||||
|
||||
//for performance tuning, increasing this value should improve performance
|
||||
//at the cost of model quality
|
||||
INLINE void set_lod_scale(float value);
|
||||
INLINE float get_lod_scale() const;
|
||||
|
||||
|
||||
INLINE void set_center(const LPoint3f ¢er);
|
||||
INLINE const LPoint3f &get_center() const;
|
||||
|
||||
@ -173,6 +179,7 @@ private:
|
||||
bool _got_force_switch;
|
||||
int _force_switch;
|
||||
int _num_shown;
|
||||
float _lod_scale;
|
||||
};
|
||||
|
||||
PipelineCycler<CData> _cycler;
|
||||
|
Loading…
x
Reference in New Issue
Block a user