Add complexity option
This commit is contained in:
parent
00042ac82e
commit
a5ec4f5026
@ -172,6 +172,7 @@ IrrDriver::IrrDriver()
|
||||
m_skinning_joint = 0;
|
||||
m_recording = false;
|
||||
m_sun_interposer = NULL;
|
||||
m_scene_complexity = 0;
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
for (unsigned i = 0; i < Q_LAST; i++)
|
||||
@ -1787,8 +1788,8 @@ void IrrDriver::displayFPS()
|
||||
{
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
fps_string = _("FPS: %d/%d/%d - %d KTris, Ping: %dms", min, fps,
|
||||
max, SP::sp_solid_poly_count / 1000, ping);
|
||||
fps_string = _("FPS: %d/%d/%d - %d KTris\n Complexity %d, Ping: %dms", min, fps,
|
||||
max, SP::sp_solid_poly_count / 1000, ping, irr_driver->getSceneComplexity());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,6 +150,9 @@ private:
|
||||
/** Whether the mouse cursor is currently shown */
|
||||
bool m_pointer_shown;
|
||||
|
||||
/** Store if the scene is complex (based on polycount, etc) */
|
||||
int m_scene_complexity;
|
||||
|
||||
/** Internal method that applies the resolution in user settings. */
|
||||
void applyResolutionSettings();
|
||||
void createListOfVideoModes();
|
||||
@ -369,6 +372,13 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool getBoundingBoxesViz() { return m_boundingboxesviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
int getSceneComplexity() { return m_scene_complexity; }
|
||||
void resetSceneComplexity() { m_scene_complexity = 0; }
|
||||
void addSceneComplexity(int complexity)
|
||||
{
|
||||
if (complexity > 1) m_scene_complexity += (complexity - 1.0);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
bool isRecording() const { return m_recording; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setRecording(bool val);
|
||||
|
@ -179,6 +179,7 @@ void LODNode::updateVisibility()
|
||||
{
|
||||
m_nodes[i]->setVisible(true);
|
||||
float size = m_timer / 20.f;
|
||||
/*
|
||||
if (i == m_current_level)
|
||||
{
|
||||
m_nodes[i]->setScale( core::vector3df(size, size, size) );
|
||||
@ -186,7 +187,7 @@ void LODNode::updateVisibility()
|
||||
else
|
||||
{
|
||||
m_nodes[i]->setScale( core::vector3df(-size, -size, -size) );
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -243,31 +244,33 @@ void LODNode::OnRegisterSceneNode()
|
||||
|
||||
void LODNode::autoComputeLevel(float scale)
|
||||
{
|
||||
printf("Scale2 %f\n", scale);
|
||||
m_volume *= scale;
|
||||
printf("Factor %f\n", m_volume);
|
||||
|
||||
// This will be set based on the amount of objects in a scene.
|
||||
// Amount of details based on user's input
|
||||
float agressivity = 1.0;
|
||||
if(UserConfigParams::m_geometry_level == 0) agressivity = 1.0;
|
||||
if(UserConfigParams::m_geometry_level == 1) agressivity = 0.75;
|
||||
if(UserConfigParams::m_geometry_level == 2) agressivity = 0.5;
|
||||
|
||||
// First we try to estimate how far away we need to draw
|
||||
float max_draw = 0.0;
|
||||
if (m_volume < 2.0)
|
||||
max_draw = sqrtf((0.5 * m_volume + 10) * 200) - 10;
|
||||
// If the draw distance is too big we artificially reduce it
|
||||
if(max_draw > 250)
|
||||
{
|
||||
max_draw = (m_volume * 1.3) + 50.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
max_draw = (m_volume * 0.05) + 100;
|
||||
max_draw = 250 + (max_draw * 0.05);
|
||||
}
|
||||
|
||||
max_draw *= agressivity;
|
||||
|
||||
int step = (int) max_draw / m_detail.size();
|
||||
int step = (int) (max_draw * max_draw) / m_detail.size();
|
||||
|
||||
// Then we recompute the level of detail culling distance
|
||||
int biais = m_detail.size();
|
||||
for(int i = 0; i < m_detail.size(); i++)
|
||||
{
|
||||
m_detail[i] = step * step * (i + 1);
|
||||
m_detail[i] = ((step / biais) * (i + 1));
|
||||
biais--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,11 +278,6 @@ void LODNode::add(int level, scene::ISceneNode* node, bool reparent)
|
||||
{
|
||||
Box = node->getBoundingBox();
|
||||
m_volume = Box.getArea();
|
||||
printf("\nLod\n==========================\n");
|
||||
printf("Level %d\n", level);
|
||||
printf("Area %f\n", Box.getArea());
|
||||
printf("Volume %f\n", Box.getVolume());
|
||||
printf("Scale %f, %f, %f \n", node->getScale().X, node->getScale().Y, node->getScale().Z);
|
||||
|
||||
// samuncle suggested to put a slight randomisation in LOD
|
||||
// I'm not convinced (Auria) but he's the artist pro, so I listen ;P
|
||||
|
@ -302,6 +302,7 @@ void Track::reset()
|
||||
*/
|
||||
void Track::cleanup()
|
||||
{
|
||||
irr_driver->resetSceneComplexity();
|
||||
m_physical_object_uid = 0;
|
||||
#ifdef USE_RESIZE_CACHE
|
||||
if (!UserConfigParams::m_high_definition_textures)
|
||||
@ -2018,6 +2019,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
|
||||
loadObjects(root, path, model_def_loader, true, NULL, NULL);
|
||||
main_loop->renderGUI(5000);
|
||||
|
||||
Log::info("Track", "Overall scene complexity estimated at %d", irr_driver->getSceneComplexity());
|
||||
// Correct the parenting of meta library
|
||||
for (auto& p : m_meta_library)
|
||||
{
|
||||
@ -2258,6 +2260,8 @@ void Track::loadObjects(const XMLNode* root, const std::string& path,
|
||||
const bool is_mode_ctf = m_is_ctf && race_manager->getMinorMode() ==
|
||||
RaceManager::MINOR_MODE_CAPTURE_THE_FLAG;
|
||||
|
||||
// We keep track of the complexity of the scene (amount of objects loaded, etc)
|
||||
irr_driver->addSceneComplexity(node_count);
|
||||
for (unsigned int i = 0; i < node_count; i++)
|
||||
{
|
||||
main_loop->renderGUI(4950, i, node_count);
|
||||
|
Loading…
Reference in New Issue
Block a user