Move smoothing variable to stk_config
This commit is contained in:
parent
ff71592d49
commit
022e0777bd
@ -548,4 +548,12 @@
|
||||
-->
|
||||
<network-ports server-discovery-port="2757" client-port="2758" server-port="2759"/>
|
||||
|
||||
<!-- Configurable values used in SmoothNetworkBody class.
|
||||
-->
|
||||
<network-smoothing min-adjust-length="0.1"
|
||||
max-adjust-length="4.0"
|
||||
min-adjust-speed="0.3"
|
||||
max-adjust-time="2.0"
|
||||
adjust-length-threshold="2.0"/>
|
||||
|
||||
</config>
|
||||
|
@ -157,6 +157,11 @@ void STKConfig::load(const std::string &filename)
|
||||
CHECK_NEG(m_default_moveable_friction, "physics default-moveable-friction");
|
||||
CHECK_NEG(m_solver_iterations, "physics: solver-iterations" );
|
||||
CHECK_NEG(m_solver_split_impulse_thresh,"physics: solver-split-impulse-threshold");
|
||||
CHECK_NEG(m_snb_min_adjust_length, "network smoothing: min-adjust-length");
|
||||
CHECK_NEG(m_snb_max_adjust_length, "network smoothing: max-adjust-length");
|
||||
CHECK_NEG(m_snb_min_adjust_speed, "network smoothing: min-adjust-speed");
|
||||
CHECK_NEG(m_snb_max_adjust_time, "network smoothing: max-adjust-time");
|
||||
CHECK_NEG(m_snb_adjust_length_threshold, "network smoothing: adjust-length-threshold");
|
||||
|
||||
// Square distance to make distance checks cheaper (no sqrt)
|
||||
m_default_kart_properties->checkAllSet(filename);
|
||||
@ -217,6 +222,9 @@ void STKConfig::init_defaults()
|
||||
m_server_discovery_port = 2757;
|
||||
m_client_port = 2758;
|
||||
m_server_port = 2759;
|
||||
m_snb_min_adjust_length = m_snb_max_adjust_length =
|
||||
m_snb_min_adjust_speed = m_snb_max_adjust_time =
|
||||
m_snb_adjust_length_threshold = UNDEFINED;
|
||||
|
||||
m_score_increase.clear();
|
||||
m_leader_intervals.clear();
|
||||
@ -492,6 +500,15 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
m_server_port = (uint16_t)server_port;
|
||||
}
|
||||
|
||||
if (const XMLNode *ns = root->getNode("network-smoothing"))
|
||||
{
|
||||
ns->get("min-adjust-length", &m_snb_min_adjust_length);
|
||||
ns->get("max-adjust-length", &m_snb_max_adjust_length);
|
||||
ns->get("min-adjust-speed", &m_snb_min_adjust_speed);
|
||||
ns->get("max-adjust-time", &m_snb_max_adjust_time);
|
||||
ns->get("adjust-length-threshold", &m_snb_adjust_length_threshold);
|
||||
}
|
||||
|
||||
// Get the default KartProperties
|
||||
// ------------------------------
|
||||
const XMLNode *node = root -> getNode("general-kart-defaults");
|
||||
|
@ -206,6 +206,11 @@ public:
|
||||
std::vector<std::string> m_normal_ttf;
|
||||
std::vector<std::string> m_digit_ttf;
|
||||
|
||||
/** Configurable values used in SmoothNetworkBody class. */
|
||||
float m_snb_min_adjust_length, m_snb_max_adjust_length,
|
||||
m_snb_min_adjust_speed, m_snb_max_adjust_time,
|
||||
m_snb_adjust_length_threshold;
|
||||
|
||||
private:
|
||||
/** True if stk_config has been loaded. This is necessary if the
|
||||
* --stk-config command line parameter has been specified to avoid
|
||||
|
@ -17,6 +17,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "network/smooth_network_body.hpp"
|
||||
#include "config/stk_config.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -27,11 +28,11 @@ SmoothNetworkBody::SmoothNetworkBody(bool enable)
|
||||
m_enabled = enable;
|
||||
m_smooth_rotation = true;
|
||||
m_adjust_vertical_offset = true;
|
||||
m_min_adjust_length = 0.1f;
|
||||
m_max_adjust_length = 4.0f;
|
||||
m_min_adjust_speed = 0.3f;
|
||||
m_max_adjust_time = 2.0f;
|
||||
m_adjust_length_threshold = 2.0f;
|
||||
m_min_adjust_length = stk_config->m_snb_min_adjust_length;
|
||||
m_max_adjust_length = stk_config->m_snb_max_adjust_length;
|
||||
m_min_adjust_speed = stk_config->m_snb_min_adjust_speed;
|
||||
m_max_adjust_time = stk_config->m_snb_max_adjust_time;
|
||||
m_adjust_length_threshold = stk_config->m_snb_adjust_length_threshold;
|
||||
} // SmoothNetworkBody
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user