Allowed to enable smooth-normals per track, and added this flag as an
example to lighthouse track. Note atm both needs to be set: smooth-normals in the track.xml file and in stk_config. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11217 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
<news max-display="10"/>
|
||||
|
||||
<!-- If the normals (for wheel raycasts) should be smoothened -->
|
||||
<physics smooth-normals="false"/>
|
||||
<physics smooth-normals="true"/>
|
||||
|
||||
<!-- The title music. -->
|
||||
<music title="main_theme.music"/>
|
||||
@@ -188,7 +188,7 @@
|
||||
but you will always keep on doing a left turn, just more or less. -->
|
||||
|
||||
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
|
||||
visual="1.0" visual-time="0"
|
||||
visual="1.0" visual-time="0.5"
|
||||
time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
post-skid-rotate-factor="1" jump-time="0.4"
|
||||
|
||||
@@ -577,7 +577,9 @@ void Kart::createPhysics()
|
||||
// Create the actual vehicle
|
||||
// -------------------------
|
||||
m_vehicle_raycaster =
|
||||
new btKartRaycaster(World::getWorld()->getPhysics()->getPhysicsWorld());
|
||||
new btKartRaycaster(World::getWorld()->getPhysics()->getPhysicsWorld(),
|
||||
stk_config->m_smooth_normals &&
|
||||
World::getWorld()->getTrack()->smoothNormals());
|
||||
m_vehicle = new btKart(m_body, m_vehicle_raycaster, this);
|
||||
|
||||
// never deactivate the vehicle
|
||||
|
||||
@@ -72,7 +72,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to,
|
||||
result.m_distFraction = rayCallback.m_closestHitFraction;
|
||||
const TriangleMesh &tm =
|
||||
World::getWorld()->getTrack()->getTriangleMesh();
|
||||
if(stk_config->m_smooth_normals &&
|
||||
if(m_smooth_normals &&
|
||||
rayCallback.getTriangleIndex()>-1)
|
||||
{
|
||||
btVector3 n=result.m_hitNormalInWorld;
|
||||
|
||||
@@ -22,10 +22,14 @@ class btDynamicsWorld;
|
||||
|
||||
class btKartRaycaster : public btVehicleRaycaster
|
||||
{
|
||||
private:
|
||||
btDynamicsWorld* m_dynamicsWorld;
|
||||
/** True if the normals should be smoothed. Not all tracks support this,
|
||||
* so this flag is set depending on track when constructing this object. */
|
||||
bool m_smooth_normals;
|
||||
public:
|
||||
btKartRaycaster(btDynamicsWorld* world)
|
||||
:m_dynamicsWorld(world)
|
||||
btKartRaycaster(btDynamicsWorld* world, bool smooth_normals=false)
|
||||
:m_dynamicsWorld(world), m_smooth_normals(smooth_normals)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@ void Track::loadTrackInfo()
|
||||
m_fog_start = 0.0f;
|
||||
m_fog_end = 1000.0f;
|
||||
m_gravity = 9.80665f;
|
||||
m_smooth_normals = false;
|
||||
/* ARGB */
|
||||
m_fog_color = video::SColor(255, 77, 179, 230);
|
||||
m_default_ambient_color = video::SColor(255, 120, 120, 120);
|
||||
@@ -303,6 +304,7 @@ void Track::loadTrackInfo()
|
||||
root->get("groups", &m_groups);
|
||||
root->get("internal", &m_internal);
|
||||
root->get("reverse", &m_reverse_available);
|
||||
root->get("smooth-normals", &m_smooth_normals);
|
||||
// Reverse is meaningless in arena
|
||||
m_reverse_available = !m_is_arena && m_reverse_available;
|
||||
|
||||
|
||||
@@ -293,6 +293,9 @@ private:
|
||||
std::string m_name;
|
||||
|
||||
bool m_use_fog;
|
||||
/** True if this track supports using smoothed normals. */
|
||||
bool m_smooth_normals;
|
||||
|
||||
float m_fog_density;
|
||||
float m_fog_start;
|
||||
float m_fog_end;
|
||||
@@ -458,14 +461,19 @@ public:
|
||||
ParticleKind* getSkyParticles () { return m_sky_particles; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isFogEnabled() const { return m_use_fog; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getFogStart() const { return m_fog_start; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getFogEnd() const { return m_fog_end; }
|
||||
// ------------------------------------------------------------------------
|
||||
video::SColor getFogColor() const { return m_fog_color; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Whether this is an "internal" track. If so it won't be offered
|
||||
* in the track seelction screen. */
|
||||
bool isInternal() const { return m_internal; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the normals of this track can be smoothed. */
|
||||
bool smoothNormals() const { return m_smooth_normals; }
|
||||
// ------------------------------------------------------------------------
|
||||
TrackObjectManager* getTrackObjectManager() {return m_track_object_manager;}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user