Convert tabs to spaces and remove some trailing space.

computerfreak97 should check the editor settings, r9194 was full of noise.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9203 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mbjornstk 2011-07-09 02:20:43 +00:00
parent 9d9ca9a3f4
commit 35a3e78b94
2 changed files with 126 additions and 126 deletions

View File

@ -79,142 +79,142 @@ void SkidMarks::reset()
*/
void SkidMarks::update(float dt)
{
//if the kart is gnu, then dont skid because he floats!
if (m_kart.getKartProperties()->getNonTranslatedName() != "Gnu") {
float f = dt/stk_config->m_skid_fadeout_time*m_start_alpha;
for(unsigned int i=0; i<m_left.size(); i++)
{
m_left[i]->fade(f);
m_right[i]->fade(f);
}
//if the kart is gnu, then dont skid because he floats!
if (m_kart.getKartProperties()->getNonTranslatedName() != "Gnu") {
float f = dt/stk_config->m_skid_fadeout_time*m_start_alpha;
for(unsigned int i=0; i<m_left.size(); i++)
{
m_left[i]->fade(f);
m_right[i]->fade(f);
}
if(m_skid_marking)
{
// Get raycast information
// -----------------------
const btWheelInfo::RaycastInfo &raycast_right =
m_kart.getVehicle()->getWheelInfo(2).m_raycastInfo;
const btWheelInfo::RaycastInfo raycast_left =
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
Vec3 delta = raycast_right.m_contactPointWS - raycast_left.m_contactPointWS;
if(m_skid_marking)
{
// Get raycast information
// -----------------------
const btWheelInfo::RaycastInfo &raycast_right =
m_kart.getVehicle()->getWheelInfo(2).m_raycastInfo;
const btWheelInfo::RaycastInfo raycast_left =
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
Vec3 delta = raycast_right.m_contactPointWS - raycast_left.m_contactPointWS;
// We were skid marking, but not anymore (either because the
// wheels don't touch the ground, or the kart has stopped
// skidding). One special case: the physics force both wheels
// on one axis to touch the ground. If only one wheel touches
// the ground, the 2nd one gets the same raycast result -->
// delta is 0, and the behaviour is undefined. In this case
// just stop doing skid marks as well.
// ---------------------------------------------------------
if(!raycast_right.m_isInContact || !m_kart.getControls().m_drift ||
fabsf(m_kart.getControls().m_steer) < 0.001f ||
delta.length2()<0.0001)
{
m_skid_marking = false;
// The vertices and indices will not change anymore (till these
// skid mark quads are deleted)
m_left[m_current]->setHardwareMappingHint(scene::EHM_STATIC);
m_right[m_current]->setHardwareMappingHint(scene::EHM_STATIC);
return;
}
// We were skid marking, but not anymore (either because the
// wheels don't touch the ground, or the kart has stopped
// skidding). One special case: the physics force both wheels
// on one axis to touch the ground. If only one wheel touches
// the ground, the 2nd one gets the same raycast result -->
// delta is 0, and the behaviour is undefined. In this case
// just stop doing skid marks as well.
// ---------------------------------------------------------
if(!raycast_right.m_isInContact || !m_kart.getControls().m_drift ||
fabsf(m_kart.getControls().m_steer) < 0.001f ||
delta.length2()<0.0001)
{
m_skid_marking = false;
// The vertices and indices will not change anymore (till these
// skid mark quads are deleted)
m_left[m_current]->setHardwareMappingHint(scene::EHM_STATIC);
m_right[m_current]->setHardwareMappingHint(scene::EHM_STATIC);
return;
}
// We are still skid marking, so add the latest quad
// -------------------------------------------------
// We are still skid marking, so add the latest quad
// -------------------------------------------------
delta.normalize();
delta *= m_width;
m_left [m_current]->add(raycast_left.m_contactPointWS,
raycast_left.m_contactPointWS + delta);
m_right[m_current]->add(raycast_right.m_contactPointWS-delta,
raycast_right.m_contactPointWS);
// Adjust the boundary box of the mesh to include the
// adjusted aabb of its buffers.
core::aabbox3df aabb=m_nodes[m_current]->getMesh()->getBoundingBox();
aabb.addInternalBox(m_left[m_current]->getAABB());
aabb.addInternalBox(m_right[m_current]->getAABB());
m_nodes[m_current]->getMesh()->setBoundingBox(aabb);
return;
}
delta.normalize();
delta *= m_width;
// Currently no skid marking
// -------------------------
if((!m_kart.getControls().m_drift) ||
(fabsf(m_kart.getControls().m_steer) < 0.001f)) return; // no skidmarking
// not turning enough, don't draw skidmarks if kart is going straight ahead
// this is even stricter for Ai karts, since they tend to use LOTS of skidding
const float min_skid_angle = m_kart.getController()->isPlayerController() ? 0.55f : 0.95f;
if( fabsf(m_kart.getSteerPercent()) < min_skid_angle) return;
// Start new skid marks
// --------------------
const btWheelInfo::RaycastInfo &raycast_right =
m_kart.getVehicle()->getWheelInfo(2).m_raycastInfo;
// No skidmarking if wheels don't have contact
if(!raycast_right.m_isInContact) return;
m_left [m_current]->add(raycast_left.m_contactPointWS,
raycast_left.m_contactPointWS + delta);
m_right[m_current]->add(raycast_right.m_contactPointWS-delta,
raycast_right.m_contactPointWS);
// Adjust the boundary box of the mesh to include the
// adjusted aabb of its buffers.
core::aabbox3df aabb=m_nodes[m_current]->getMesh()->getBoundingBox();
aabb.addInternalBox(m_left[m_current]->getAABB());
aabb.addInternalBox(m_right[m_current]->getAABB());
m_nodes[m_current]->getMesh()->setBoundingBox(aabb);
return;
}
const btWheelInfo::RaycastInfo raycast_left =
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
// Currently no skid marking
// -------------------------
if((!m_kart.getControls().m_drift) ||
(fabsf(m_kart.getControls().m_steer) < 0.001f)) return; // no skidmarking
Vec3 delta = raycast_right.m_contactPointWS - raycast_left.m_contactPointWS;
// Special case: only one wheel on one axis touches the ground --> physics
// set both wheels to touch the same spot --> delta = 0. In this case,
// don't start skidmarks.
if(delta.length2()<0.0001) return;
delta.normalize();
delta *= m_width;
// not turning enough, don't draw skidmarks if kart is going straight ahead
// this is even stricter for Ai karts, since they tend to use LOTS of skidding
const float min_skid_angle = m_kart.getController()->isPlayerController() ? 0.55f : 0.95f;
if( fabsf(m_kart.getSteerPercent()) < min_skid_angle) return;
SkidMarkQuads *smq_left = new SkidMarkQuads(raycast_left.m_contactPointWS,
raycast_left.m_contactPointWS + delta,
m_material, m_avoid_z_fighting);
scene::SMesh *new_mesh = new scene::SMesh();
new_mesh->addMeshBuffer(smq_left);
// Start new skid marks
// --------------------
const btWheelInfo::RaycastInfo &raycast_right =
m_kart.getVehicle()->getWheelInfo(2).m_raycastInfo;
// No skidmarking if wheels don't have contact
if(!raycast_right.m_isInContact) return;
SkidMarkQuads *smq_right = new SkidMarkQuads(raycast_right.m_contactPointWS
- delta,
raycast_right.m_contactPointWS,
m_material,
m_avoid_z_fighting);
new_mesh->addMeshBuffer(smq_right);
scene::IMeshSceneNode *new_node = irr_driver->addMesh(new_mesh);
#ifdef DEBUG
std::string debug_name = m_kart.getIdent()+" (skid-mark)";
new_node->setName(debug_name.c_str());
#endif
// We don't keep a reference to the mesh here, so we have to decrement
// the reference count (which is set to 1 when doing "new SMesh()".
// The scene node will keep the mesh alive.
new_mesh->drop();
m_current++;
if(m_current>=stk_config->m_max_skidmarks)
m_current = 0;
if(m_current>=(int)m_left.size())
{
m_left. push_back (smq_left );
m_right.push_back (smq_right);
m_nodes.push_back (new_node);
}
else
{
irr_driver->removeNode(m_nodes[m_current]);
// Not necessary to delete m_nodes: removeNode
// deletes the node since its refcount reaches zero.
m_left[m_current]->drop();
m_right[m_current]->drop();
const btWheelInfo::RaycastInfo raycast_left =
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
m_left [m_current] = smq_left;
m_right [m_current] = smq_right;
m_nodes [m_current] = new_node;
}
Vec3 delta = raycast_right.m_contactPointWS - raycast_left.m_contactPointWS;
// Special case: only one wheel on one axis touches the ground --> physics
// set both wheels to touch the same spot --> delta = 0. In this case,
// don't start skidmarks.
if(delta.length2()<0.0001) return;
delta.normalize();
delta *= m_width;
m_skid_marking = true;
// More triangles are added each frame, so for now leave it
// to stream.
m_left[m_current]->setHardwareMappingHint(scene::EHM_STREAM);
m_right[m_current]->setHardwareMappingHint(scene::EHM_STREAM);
}
SkidMarkQuads *smq_left = new SkidMarkQuads(raycast_left.m_contactPointWS,
raycast_left.m_contactPointWS + delta,
m_material, m_avoid_z_fighting);
scene::SMesh *new_mesh = new scene::SMesh();
new_mesh->addMeshBuffer(smq_left);
SkidMarkQuads *smq_right = new SkidMarkQuads(raycast_right.m_contactPointWS
- delta,
raycast_right.m_contactPointWS,
m_material,
m_avoid_z_fighting);
new_mesh->addMeshBuffer(smq_right);
scene::IMeshSceneNode *new_node = irr_driver->addMesh(new_mesh);
#ifdef DEBUG
std::string debug_name = m_kart.getIdent()+" (skid-mark)";
new_node->setName(debug_name.c_str());
#endif
// We don't keep a reference to the mesh here, so we have to decrement
// the reference count (which is set to 1 when doing "new SMesh()".
// The scene node will keep the mesh alive.
new_mesh->drop();
m_current++;
if(m_current>=stk_config->m_max_skidmarks)
m_current = 0;
if(m_current>=(int)m_left.size())
{
m_left. push_back (smq_left );
m_right.push_back (smq_right);
m_nodes.push_back (new_node);
}
else
{
irr_driver->removeNode(m_nodes[m_current]);
// Not necessary to delete m_nodes: removeNode
// deletes the node since its refcount reaches zero.
m_left[m_current]->drop();
m_right[m_current]->drop();
m_left [m_current] = smq_left;
m_right [m_current] = smq_right;
m_nodes [m_current] = new_node;
}
m_skid_marking = true;
// More triangles are added each frame, so for now leave it
// to stream.
m_left[m_current]->setHardwareMappingHint(scene::EHM_STREAM);
m_right[m_current]->setHardwareMappingHint(scene::EHM_STREAM);
}
} // update
//=============================================================================

View File

@ -334,7 +334,7 @@ public:
*/
const wchar_t* getName() const {return translations->w_gettext(m_name.c_str()); }
const std::string getNonTranslatedName() const {return m_name;}
const std::string getNonTranslatedName() const {return m_name;}
/** Returns the internal identifier of this kart. */
const std::string& getIdent () const {return m_ident; }