removed 95% remaining dependencies on plib
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3479 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -150,7 +150,7 @@ void SFXManager::loadSfx()
|
||||
// based on a routine by Peter Mulholland, used with permission (quote : "Feel free to use")
|
||||
bool loadVorbisBuffer(const char *name, ALuint buffer)
|
||||
{
|
||||
bool success = FALSE;
|
||||
bool success = false;
|
||||
FILE *file;
|
||||
vorbis_info *info;
|
||||
OggVorbis_File oggFile;
|
||||
@@ -187,7 +187,7 @@ bool loadVorbisBuffer(const char *name, ALuint buffer)
|
||||
}
|
||||
|
||||
alBufferData(buffer, (info->channels == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, data, len, info->rate);
|
||||
success = TRUE;
|
||||
success = true;
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ Nitro::Nitro(Kart* kart)
|
||||
: ParticleSystem(200, 0.0f, true, 0.5f),
|
||||
m_kart(kart)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
|
||||
#ifdef DEBUG
|
||||
setName("nitro");
|
||||
#endif
|
||||
@@ -53,13 +55,13 @@ Nitro::Nitro(Kart* kart)
|
||||
m_nitro_fire->ref();
|
||||
|
||||
setState(m_nitro_fire);
|
||||
|
||||
#endif
|
||||
} // KartParticleSystem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Nitro::~Nitro()
|
||||
{
|
||||
ssgDeRefDelete(m_nitro_fire);
|
||||
//ssgDeRefDelete(m_nitro_fire);
|
||||
} // ~Nitro
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -71,6 +73,7 @@ void Nitro::update(float t)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Nitro::particle_create(int, Particle *p)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
sgSetVec4(p->m_col, 1, 1, 1, 1 ); /* initially white */
|
||||
sgSetVec3(p->m_vel, 0, 0, 0 );
|
||||
sgSetVec3(p->m_acc, 0, 0, 2.0f ); /* Gravity */
|
||||
@@ -84,14 +87,17 @@ void Nitro::particle_create(int, Particle *p)
|
||||
p->m_vel[0] += 2*cos(DEGREE_TO_RAD(rand()% 180));
|
||||
p->m_vel[1] += 2*sin(DEGREE_TO_RAD(rand()% 180));
|
||||
p->m_vel[2] = 0;
|
||||
#endif
|
||||
} // particle_create
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Nitro::particle_update(float delta, int,
|
||||
Particle * particle)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
particle->m_size -= delta*.2f;
|
||||
particle->m_col[3] -= delta * 2.0f;
|
||||
#endif
|
||||
} // particle_update
|
||||
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef HEADER_NITRO_HPP
|
||||
#define HEADER_NITRO_HPP
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/sg.h>
|
||||
#include "particle_system.hpp"
|
||||
|
||||
class Kart;
|
||||
@@ -32,7 +30,7 @@ private:
|
||||
/** The kart to which this smoke belongs. */
|
||||
Kart *m_kart;
|
||||
/** The texture to use. */
|
||||
ssgSimpleState *m_nitro_fire;
|
||||
//ssgSimpleState *m_nitro_fire;
|
||||
|
||||
public:
|
||||
Nitro (Kart* kart);
|
||||
|
||||
@@ -27,24 +27,24 @@
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
ParticleSystem::ParticleSystem ( int num, float create_rate, int ttf, float sz)
|
||||
: ssgVtxTable(GL_QUADS,
|
||||
new ssgVertexArray (num*4, new sgVec3[num*4] ),
|
||||
new ssgNormalArray (num*4, new sgVec3[num*4] ),
|
||||
new ssgTexCoordArray(num*4, new sgVec2[num*4] ),
|
||||
new ssgColourArray (num*4, new sgVec4[num*4] )
|
||||
)
|
||||
// : ssgVtxTable(GL_QUADS,
|
||||
// new ssgVertexArray (num*4, new sgVec3[num*4] ),
|
||||
// new ssgNormalArray (num*4, new sgVec3[num*4] ),
|
||||
// new ssgTexCoordArray(num*4, new sgVec2[num*4] ),
|
||||
// new ssgColourArray (num*4, new sgVec4[num*4] )
|
||||
// )
|
||||
//FIXME LEAK: these arrays are never freed!
|
||||
{
|
||||
#ifdef DEBUG
|
||||
setName("particle-system");
|
||||
//setName("particle-system");
|
||||
#endif
|
||||
m_turn_to_face = ttf;
|
||||
m_create_error = 0 ;
|
||||
m_create_rate = create_rate;
|
||||
m_size = sz;
|
||||
|
||||
bsphere.setRadius(100); // a better value is computed in update
|
||||
bsphere.setCenter(0, 0, 0);
|
||||
//bsphere.setRadius(100); // a better value is computed in update
|
||||
//bsphere.setCenter(0, 0, 0);
|
||||
|
||||
m_num_particles = num ;
|
||||
m_num_verts = num * 4 ;
|
||||
@@ -55,21 +55,21 @@ ParticleSystem::ParticleSystem ( int num, float create_rate, int ttf, float sz)
|
||||
|
||||
for ( i = 0 ; i < m_num_verts ; i++ )
|
||||
{
|
||||
sgSetVec3 (getNormal(i), 0, -1, 0 );
|
||||
sgSetVec4 (getColour(i), 1, 1, 1, 1 );
|
||||
sgZeroVec3(getVertex(i) );
|
||||
//sgSetVec3 (getNormal(i), 0, -1, 0 );
|
||||
//sgSetVec4 (getColour(i), 1, 1, 1, 1 );
|
||||
//sgZeroVec3(getVertex(i) );
|
||||
}
|
||||
|
||||
for ( i = 0 ; i < m_num_particles ; i++ )
|
||||
{
|
||||
sgSetVec2(getTexCoord(i*4+0), 0, 0 );
|
||||
sgSetVec2(getTexCoord(i*4+1), 1, 0 );
|
||||
sgSetVec2(getTexCoord(i*4+2), 1, 1 );
|
||||
sgSetVec2(getTexCoord(i*4+3), 0, 1 );
|
||||
//sgSetVec2(getTexCoord(i*4+0), 0, 0 );
|
||||
//sgSetVec2(getTexCoord(i*4+1), 1, 0 );
|
||||
//sgSetVec2(getTexCoord(i*4+2), 1, 1 );
|
||||
//sgSetVec2(getTexCoord(i*4+3), 0, 1 );
|
||||
}
|
||||
|
||||
m_num_active = 0 ;
|
||||
stk_scene->add(this);
|
||||
//stk_scene->add(this);
|
||||
} // ParticleSystem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -87,13 +87,14 @@ void ParticleSystem::init(int initial_num)
|
||||
*/
|
||||
void ParticleSystem::recalcBSphere()
|
||||
{
|
||||
bsphere.setRadius( 1000.0f );
|
||||
bsphere.setCenter( 0, 0, 0 );
|
||||
//bsphere.setRadius( 1000.0f );
|
||||
//bsphere.setCenter( 0, 0, 0 );
|
||||
} // recalcBSphere
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ParticleSystem::draw_geometry ()
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
sgVec3 nxny, xxny, xxyy, nxyy ;
|
||||
|
||||
float SZ = m_size / 2.0f ;
|
||||
@@ -159,6 +160,7 @@ void ParticleSystem::draw_geometry ()
|
||||
glDepthMask ( 1 ) ;
|
||||
glEnable ( GL_CULL_FACE ) ;
|
||||
}
|
||||
#endif
|
||||
} // draw_geometry
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -173,6 +175,7 @@ ParticleSystem::~ParticleSystem ()
|
||||
//-----------------------------------------------------------------------------
|
||||
void ParticleSystem::update ( float t )
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
int i ;
|
||||
|
||||
m_create_error += m_create_rate * t ;
|
||||
@@ -233,6 +236,7 @@ void ParticleSystem::update ( float t )
|
||||
// add the size of the actual quad to the radius on both ends
|
||||
bsphere.setRadius((diameter*0.5f+2*m_size)*1.733f); // 1.733 approx. sqrt(3)
|
||||
bsphere_is_invalid = 0;
|
||||
#endif
|
||||
} // update
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef PARTICLE_SYSTEM_HPP
|
||||
#define PARTICLE_SYSTEM_HPP
|
||||
|
||||
#include <plib/ssg.h>
|
||||
|
||||
/** This is basically the ssgaParticle, but this implementation supports
|
||||
* methods to be used to create, update and delete the objects instead
|
||||
* of function pointer as the original plib.
|
||||
@@ -31,10 +29,10 @@ class Particle
|
||||
{
|
||||
public:
|
||||
|
||||
sgVec4 m_col ;
|
||||
sgVec3 m_pos ;
|
||||
sgVec3 m_vel ;
|
||||
sgVec3 m_acc ;
|
||||
//sgVec4 m_col ;
|
||||
//sgVec3 m_pos ;
|
||||
//sgVec3 m_vel ;
|
||||
//sgVec3 m_acc ;
|
||||
|
||||
float m_size ;
|
||||
|
||||
@@ -43,17 +41,17 @@ public:
|
||||
|
||||
void update ( float dt )
|
||||
{
|
||||
sgAddScaledVec3 ( m_vel, m_acc, dt ) ;
|
||||
sgAddScaledVec3 ( m_pos, m_vel, dt ) ;
|
||||
//sgAddScaledVec3 ( m_vel, m_acc, dt ) ;
|
||||
//sgAddScaledVec3 ( m_pos, m_vel, dt ) ;
|
||||
m_time_to_live -= dt ;
|
||||
}
|
||||
|
||||
Particle ()
|
||||
{
|
||||
sgSetVec4 ( m_col, 1, 1, 1, 1 ) ;
|
||||
sgZeroVec3 ( m_pos ) ;
|
||||
sgZeroVec3 ( m_vel ) ;
|
||||
sgZeroVec3 ( m_acc ) ;
|
||||
//sgSetVec4 ( m_col, 1, 1, 1, 1 ) ;
|
||||
//sgZeroVec3 ( m_pos ) ;
|
||||
//sgZeroVec3 ( m_vel ) ;
|
||||
//sgZeroVec3 ( m_acc ) ;
|
||||
m_time_to_live = 0 ;
|
||||
m_user_data = 0 ;
|
||||
m_size = 1.0f ;
|
||||
@@ -67,7 +65,7 @@ public:
|
||||
* of function pointer as the original plib.
|
||||
*/
|
||||
|
||||
class ParticleSystem : public ssgVtxTable
|
||||
class ParticleSystem //: public ssgVtxTable
|
||||
{
|
||||
int m_num_particles ;
|
||||
int m_num_verts ;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ssg.h>
|
||||
#include "material_manager.hpp"
|
||||
#include "material.hpp"
|
||||
#include "camera.hpp"
|
||||
@@ -31,23 +29,23 @@
|
||||
|
||||
Scene *stk_scene = 0;
|
||||
|
||||
Scene::Scene() : m_scenegraph(new ssgRoot)
|
||||
Scene::Scene() //: m_scenegraph(new ssgRoot)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Scene::~Scene ()
|
||||
{
|
||||
delete m_scenegraph;
|
||||
// delete m_scenegraph;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Scene::clear ()
|
||||
{
|
||||
if(m_scenegraph != 0)
|
||||
{
|
||||
m_scenegraph->removeAllKids();
|
||||
}
|
||||
// if(m_scenegraph != 0)
|
||||
// {
|
||||
// m_scenegraph->removeAllKids();
|
||||
// }
|
||||
|
||||
for (Cameras::iterator i = m_cameras.begin(); i != m_cameras.end(); ++i)
|
||||
delete *i;
|
||||
@@ -67,6 +65,7 @@ Camera *Scene::createCamera(int playerId, const Kart* kart)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
void Scene::add(ssgEntity *kid)
|
||||
{
|
||||
m_scenegraph->addKid( kid );
|
||||
@@ -76,7 +75,7 @@ void Scene::add(ssgEntity *kid)
|
||||
void Scene::remove(ssgEntity *kid)
|
||||
{
|
||||
m_scenegraph->removeKid( kid );
|
||||
}
|
||||
}*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Scene::reset()
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
#include <vector>
|
||||
#include "LinearMath/btVector3.h"
|
||||
|
||||
class ssgRoot;
|
||||
class ssgEntity;
|
||||
//class ssgRoot;
|
||||
//class ssgEntity;
|
||||
class Camera;
|
||||
class Kart;
|
||||
|
||||
class Scene
|
||||
{
|
||||
ssgRoot *m_scenegraph;
|
||||
// ssgRoot *m_scenegraph;
|
||||
typedef std::vector<Camera*> Cameras;
|
||||
Cameras m_cameras;
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
~Scene ();
|
||||
void reset();
|
||||
|
||||
void add(ssgEntity *kid);
|
||||
void remove(ssgEntity *kid);
|
||||
//void add(ssgEntity *kid);
|
||||
//void remove(ssgEntity *kid);
|
||||
void draw(float dt);
|
||||
|
||||
Camera *createCamera(int playerId, const Kart* kart);
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <plib/ssg.h>
|
||||
#include "material_manager.hpp"
|
||||
#include "material.hpp"
|
||||
#include "shadow.hpp"
|
||||
|
||||
#ifndef HAVE_IRRLICHT
|
||||
ssgTransform* createShadow( const std::string& name,
|
||||
float x1, float x2, float y1, float y2 )
|
||||
{
|
||||
@@ -49,16 +49,14 @@ ssgTransform* createShadow( const std::string& name,
|
||||
|
||||
result -> setName ( "Shadow" ) ;
|
||||
|
||||
#ifndef HAVE_IRRLICHT
|
||||
ssgVtxTable *gs = new ssgVtxTable ( GL_TRIANGLE_STRIP, va, na, ta, ca ) ;
|
||||
// FIXME LEAK: va, na, ta, and ca are most likely leaked, since plib
|
||||
// will mark them as 'not owned' and therefore not free them!
|
||||
gs -> clrTraversalMaskBits ( SSGTRAV_ISECT|SSGTRAV_HOT ) ;
|
||||
gs -> setState ( material_manager->getMaterial ( name.c_str() ) -> getState () ) ;
|
||||
result -> addKid ( gs ) ;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* EOF */
|
||||
|
||||
@@ -30,6 +30,7 @@ const float SkidMarks::m_start_alpha = 0.5f;
|
||||
/** Initialises empty skid marks. */
|
||||
SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
m_width = width;
|
||||
m_skid_state = new ssgSimpleState();
|
||||
m_skid_state->ref();
|
||||
@@ -38,6 +39,7 @@ SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart)
|
||||
m_skid_state->setShininess(0.0f);
|
||||
m_skid_marking = false;
|
||||
m_current = -1;
|
||||
#endif
|
||||
} // SkidMark
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -45,7 +47,7 @@ SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart)
|
||||
SkidMarks::~SkidMarks()
|
||||
{
|
||||
reset(); // remove all skid marks
|
||||
ssgDeRefDelete(m_skid_state);
|
||||
//ssgDeRefDelete(m_skid_state);
|
||||
} // ~SkidMarks
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -55,8 +57,8 @@ void SkidMarks::reset()
|
||||
{
|
||||
for(unsigned int i=0; i<m_left.size(); i++)
|
||||
{
|
||||
stk_scene->remove(m_left[i]);
|
||||
stk_scene->remove(m_right[i]);
|
||||
//stk_scene->remove(m_left[i]);
|
||||
//stk_scene->remove(m_right[i]);
|
||||
}
|
||||
m_left.clear();
|
||||
m_right.clear();
|
||||
@@ -71,6 +73,7 @@ void SkidMarks::reset()
|
||||
*/
|
||||
void SkidMarks::update(float dt)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
float f = dt/stk_config->m_skid_fadeout_time;
|
||||
for(int i=0; i<m_current; i++)
|
||||
{
|
||||
@@ -180,10 +183,11 @@ void SkidMarks::update(float dt)
|
||||
|
||||
|
||||
m_skid_marking = true;
|
||||
|
||||
#endif
|
||||
} // update
|
||||
|
||||
//=============================================================================
|
||||
#ifndef HAVE_IRRLICHT
|
||||
SkidMarks::SkidMarkQuads::SkidMarkQuads(const Vec3 &left, const Vec3 &right,
|
||||
ssgSimpleState *state, float z_offset)
|
||||
: ssgVtxTable(GL_QUAD_STRIP,
|
||||
@@ -208,7 +212,7 @@ SkidMarks::SkidMarkQuads::SkidMarkQuads(const Vec3 &left, const Vec3 &right,
|
||||
m_aabb_max = Vec3(-10000);
|
||||
add(left, right);
|
||||
} // SkidMarkQuads
|
||||
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Fades the current skid marks.
|
||||
@@ -216,31 +220,36 @@ SkidMarks::SkidMarkQuads::SkidMarkQuads(const Vec3 &left, const Vec3 &right,
|
||||
*/
|
||||
void SkidMarks::SkidMarkQuads::fade(float f)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
m_fade_out += f;
|
||||
// Only actually change the alpha value every 0.1. Otherwise we can't use
|
||||
// display lists, which makes skid marks too slow
|
||||
if(m_fade_out>0.1f)
|
||||
{
|
||||
float *c=colours->get(0);
|
||||
//float *c=colours->get(0);
|
||||
c[3] -= m_fade_out;
|
||||
if(c[3]<0.0f) c[3]=0.0f;
|
||||
makeDList();
|
||||
//makeDList();
|
||||
m_fade_out = 0.0f;
|
||||
}
|
||||
#endif
|
||||
} // fade
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SkidMarks::SkidMarkQuads::recalcBSphere()
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
Vec3 diff = m_aabb_max - m_aabb_min;
|
||||
bsphere.setRadius(diff.length()*0.5f);
|
||||
Vec3 center = (m_aabb_min + m_aabb_max)*0.5f;
|
||||
bsphere.setCenter(center.toFloat());
|
||||
#endif
|
||||
} // recalcBSphere
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SkidMarks::SkidMarkQuads::add(const Vec3 &left, const Vec3 &right)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
// The skid marks must be raised slightly higher, otherwise it blends
|
||||
// too much with the track.
|
||||
sgVec3 l;
|
||||
@@ -256,4 +265,5 @@ void SkidMarks::SkidMarkQuads::add(const Vec3 &left, const Vec3 &right)
|
||||
m_aabb_max.max(left);m_aabb_max.max(right);
|
||||
|
||||
dirtyBSphere();
|
||||
#endif
|
||||
} // add
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#define HEADER_SKID_MARK_HPP
|
||||
|
||||
#include <vector>
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ssg.h>
|
||||
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
@@ -45,7 +43,7 @@ private:
|
||||
/** Initial alpha value. */
|
||||
static const float m_start_alpha;
|
||||
|
||||
class SkidMarkQuads : public ssgVtxTable
|
||||
class SkidMarkQuads //: public ssgVtxTable
|
||||
{
|
||||
/** Used to move skid marks at the same location slightly on
|
||||
* top of each other to avoid a 'wobbling' effect when sometines
|
||||
@@ -58,8 +56,10 @@ private:
|
||||
* approximate this by maintaining an axis-aligned boundary box. */
|
||||
Vec3 m_aabb_min, m_aabb_max;
|
||||
public:
|
||||
#ifndef HAVE_IRRLICHT
|
||||
SkidMarkQuads (const Vec3 &left, const Vec3 &right,
|
||||
ssgSimpleState *state, float z_offset);
|
||||
#endif
|
||||
void recalcBSphere();
|
||||
void add (const Vec3 &left,
|
||||
const Vec3 &right);
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
/** Two skidmark objects for the left and right wheel. */
|
||||
std::vector <SkidMarkQuads *> m_left, m_right;
|
||||
/** The state for colour etc. */
|
||||
ssgSimpleState *m_skid_state;
|
||||
//ssgSimpleState *m_skid_state;
|
||||
static float m_avoid_z_fighting;
|
||||
public:
|
||||
SkidMarks(const Kart& kart, float width=0.2f);
|
||||
|
||||
@@ -28,6 +28,8 @@ Smoke::Smoke(Kart* kart)
|
||||
: ParticleSystem(200, 0.0f, true, 0.75f),
|
||||
m_kart(kart)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
|
||||
#ifdef DEBUG
|
||||
setName("smoke");
|
||||
#endif
|
||||
@@ -54,13 +56,13 @@ Smoke::Smoke(Kart* kart)
|
||||
m_smokepuff->ref();
|
||||
|
||||
setState(m_smokepuff);
|
||||
|
||||
#endif
|
||||
} // KartParticleSystem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Smoke::~Smoke()
|
||||
{
|
||||
ssgDeRefDelete(m_smokepuff);
|
||||
//ssgDeRefDelete(m_smokepuff);
|
||||
} // ~Smoke
|
||||
//-----------------------------------------------------------------------------
|
||||
void Smoke::update(float t)
|
||||
@@ -71,6 +73,7 @@ void Smoke::update(float t)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Smoke::particle_create(int, Particle *p)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
sgSetVec4(p->m_col, 1, 1, 1, 1 ); /* initially white */
|
||||
sgSetVec3(p->m_vel, 0, 0, 0 );
|
||||
sgSetVec3(p->m_acc, 0, 0, 2.0f ); /* Gravity */
|
||||
@@ -88,13 +91,16 @@ void Smoke::particle_create(int, Particle *p)
|
||||
p->m_vel[2] += sin(DEGREE_TO_RAD(rand()%100));
|
||||
|
||||
bsphere.setCenter ( xyz.getX(), xyz.getY(), xyz.getZ() ) ;
|
||||
#endif
|
||||
} // particle_create
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Smoke::particle_update(float delta, int,
|
||||
Particle * particle)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
particle->m_size -= delta*.2f;
|
||||
particle->m_col[3] -= delta * 2.0f;
|
||||
#endif
|
||||
} // particle_update
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef HEADER_SMOKE_H
|
||||
#define HEADER_SMOKE_H
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/sg.h>
|
||||
#include "particle_system.hpp"
|
||||
|
||||
class Kart;
|
||||
@@ -32,7 +30,7 @@ private:
|
||||
/** The kart to which this smoke belongs. */
|
||||
Kart *m_kart;
|
||||
/** The texture to use. */
|
||||
ssgSimpleState *m_smokepuff;
|
||||
//ssgSimpleState *m_smokepuff;
|
||||
public:
|
||||
Smoke (Kart* kart);
|
||||
~Smoke ();
|
||||
|
||||
@@ -102,9 +102,9 @@ RaceGUI::RaceGUI()
|
||||
|
||||
m_fps_counter = 0;
|
||||
m_fps_string[0]=0;
|
||||
m_fps_timer.reset();
|
||||
m_fps_timer.update();
|
||||
m_fps_timer.setMaxDelta(1000);
|
||||
//m_fps_timer.reset();
|
||||
//m_fps_timer.update();
|
||||
//m_fps_timer.setMaxDelta(1000);
|
||||
|
||||
} // RaceGUI
|
||||
|
||||
@@ -117,8 +117,9 @@ RaceGUI::~RaceGUI()
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceGUI::resetFPSCounter()
|
||||
{
|
||||
m_fps_timer.reset();
|
||||
m_fps_timer.setMaxDelta(1000);
|
||||
// TODO - FPS
|
||||
//m_fps_timer.reset();
|
||||
//m_fps_timer.setMaxDelta(1000);
|
||||
m_fps_counter=0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -134,6 +135,8 @@ void RaceGUI::update(float dt)
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceGUI::drawFPS ()
|
||||
{
|
||||
// TODO
|
||||
/*
|
||||
if (++m_fps_counter>=50)
|
||||
{
|
||||
m_fps_timer.update();
|
||||
@@ -143,6 +146,7 @@ void RaceGUI::drawFPS ()
|
||||
m_fps_timer.setMaxDelta(1000);
|
||||
}
|
||||
font_race->PrintShadow(m_fps_string,48, 0, user_config->m_height-50);
|
||||
*/
|
||||
} // drawFPS
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -189,6 +193,8 @@ void RaceGUI::drawMap ()
|
||||
const Vec3& xyz = kart->getXYZ();
|
||||
|
||||
/* If it's a player, draw a bigger sign */
|
||||
// TODO
|
||||
/*
|
||||
if (kart -> isPlayerKart ())
|
||||
{
|
||||
RaceManager::getTrack() -> glVtx ( xyz.toFloat(), (float)xLeft+3, (float)yTop+3);
|
||||
@@ -203,6 +209,7 @@ void RaceGUI::drawMap ()
|
||||
RaceManager::getTrack() -> glVtx ( xyz.toFloat(), (float)xLeft-1, (float)yTop-1);
|
||||
RaceManager::getTrack() -> glVtx ( xyz.toFloat(), (float)xLeft+2, (float)yTop-1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
glEnd () ;
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
gui::IGUIImage **m_icons;
|
||||
gui::IGUIImage *m_attachment_icon;
|
||||
#endif
|
||||
ulClock m_fps_timer;
|
||||
//ulClock m_fps_timer;
|
||||
int m_fps_counter;
|
||||
char m_fps_string[10];
|
||||
const char *m_pos_string [11];
|
||||
|
||||
@@ -2824,6 +2824,12 @@
|
||||
);
|
||||
OTHER_CFLAGS_QUOTED_FOR_TARGET_1 = "-DPACKAGE=\"\\\"supertuxkart\\\"\"";
|
||||
OTHER_LDFLAGS = (
|
||||
"-L/usr/local/lib",
|
||||
"-lopenal",
|
||||
"-lvorbisfile",
|
||||
"-lvorbis",
|
||||
"-logg",
|
||||
"-lintl",
|
||||
"-lplibjs",
|
||||
"-lplibsl",
|
||||
"-lplibssg",
|
||||
@@ -2832,12 +2838,6 @@
|
||||
"-lplibsg",
|
||||
"-lplibul",
|
||||
"-lplibssgaux",
|
||||
"-L/usr/local/lib",
|
||||
"-lopenal",
|
||||
"-lvorbisfile",
|
||||
"-lvorbis",
|
||||
"-logg",
|
||||
"-lintl",
|
||||
);
|
||||
PRODUCT_NAME = SuperTuxKart;
|
||||
SDKROOT = "";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <plib/ssg.h>
|
||||
#if 0
|
||||
#include "isect.hpp"
|
||||
|
||||
float getHeightAndNormal(ssgBranch* branch, sgVec3 my_position, sgVec3 normal)
|
||||
@@ -58,4 +58,5 @@ float getHeightAndNormal(ssgBranch* branch, sgVec3 my_position, sgVec3 normal)
|
||||
|
||||
return hot ;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef HEADER_ISECT_H
|
||||
#define HEADER_ISECT_H
|
||||
|
||||
/*
|
||||
class ssgBranch;
|
||||
|
||||
|
||||
@@ -29,7 +30,9 @@ inline float getHeight(ssgBranch* branch, sgVec3 my_position)
|
||||
{
|
||||
return getHeightAndNormal(branch, my_position, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -35,14 +35,15 @@
|
||||
/** Simple shadow class, only used here for default items. */
|
||||
class Shadow
|
||||
{
|
||||
ssgBranch *sh ;
|
||||
//ssgBranch *sh ;
|
||||
|
||||
public:
|
||||
Shadow ( float x1, float x2, float y1, float y2 ) ;
|
||||
ssgEntity *getRoot () { return sh ; }
|
||||
Shadow ( float x1, float x2, float y1, float y2 ) { /* TODO */ }
|
||||
// ssgEntity *getRoot () { return sh ; }
|
||||
}
|
||||
; // Shadow
|
||||
|
||||
#if 0
|
||||
//-----------------------------------------------------------------------------
|
||||
Shadow::Shadow ( float x1, float x2, float y1, float y2 )
|
||||
{
|
||||
@@ -78,7 +79,7 @@ Shadow::Shadow ( float x1, float x2, float y1, float y2 )
|
||||
sh -> addKid ( gs ) ;
|
||||
sh -> ref () ; /* Make sure it doesn't get deleted by mistake */
|
||||
} // Shadow
|
||||
|
||||
#endif
|
||||
//=============================================================================
|
||||
ItemManager* item_manager;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "network/network_manager.hpp"
|
||||
#include "network/race_state.hpp"
|
||||
|
||||
static ssgSelector *find_selector ( ssgBranch *b );
|
||||
//static ssgSelector *find_selector ( ssgBranch *b );
|
||||
|
||||
ProjectileManager *projectile_manager=0;
|
||||
|
||||
@@ -77,7 +77,9 @@ void ProjectileManager::cleanup()
|
||||
for(Explosions::iterator i = m_active_explosions.begin();
|
||||
i != m_active_explosions.end(); ++i)
|
||||
{
|
||||
#ifndef HAVE_IRRLICHT
|
||||
stk_scene->remove((ssgTransform*)*i);
|
||||
#endif
|
||||
//ssgDeRefDelete(*i);
|
||||
}
|
||||
m_active_explosions.clear();
|
||||
@@ -216,6 +218,7 @@ Explosion* ProjectileManager::newExplosion(const Vec3& coord, const int explosio
|
||||
/** A general function which is only needed here, but
|
||||
* it's not really a method, so I'll leave it here.
|
||||
*/
|
||||
/*
|
||||
static ssgSelector *find_selector ( ssgBranch *b )
|
||||
{
|
||||
if ( b == NULL )
|
||||
@@ -237,3 +240,4 @@ static ssgSelector *find_selector ( ssgBranch *b )
|
||||
|
||||
return NULL ;
|
||||
} // find_selector
|
||||
*/
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <math.h>
|
||||
#include <iostream>
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ssg.h>
|
||||
|
||||
#include "bullet/Demos/OpenGL/GL_ShapeDrawer.h"
|
||||
|
||||
@@ -245,10 +243,10 @@ Kart::~Kart()
|
||||
sfx_manager->deleteSFX(m_skid_sound );
|
||||
sfx_manager->deleteSFX(m_goo_sound );
|
||||
|
||||
if(m_smoke_system) ssgDeRefDelete(m_smoke_system);
|
||||
if(m_nitro) ssgDeRefDelete(m_nitro);
|
||||
//if(m_smoke_system) ssgDeRefDelete(m_smoke_system);
|
||||
//if(m_nitro) ssgDeRefDelete(m_nitro);
|
||||
|
||||
ssgDeRefDelete(m_shadow);
|
||||
//ssgDeRefDelete(m_shadow);
|
||||
|
||||
if(m_skidmarks) delete m_skidmarks ;
|
||||
|
||||
@@ -1012,9 +1010,9 @@ void Kart::loadData()
|
||||
|
||||
// Attach Particle System
|
||||
m_smoke_system = new Smoke(this);
|
||||
m_smoke_system->ref();
|
||||
//m_smoke_system->ref();
|
||||
m_nitro = new Nitro(this);
|
||||
m_nitro->ref();
|
||||
//m_nitro->ref();
|
||||
|
||||
if(m_kart_properties->hasSkidmarks())
|
||||
m_skidmarks = new SkidMarks(*this);
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef HEADER_KART_HPP
|
||||
#define HEADER_KART_HPP
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/sg.h>
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
|
||||
#include "items/attachment.hpp"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <plib/ssg.h>
|
||||
#include "material_manager.hpp"
|
||||
#include "stk_config.hpp"
|
||||
#include "user_config.hpp"
|
||||
@@ -186,7 +185,7 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("shadow-file", m_shadow_file);
|
||||
lisp->get("rgb", m_color);
|
||||
|
||||
lisp->get("engine-power", m_engine_power);
|
||||
lisp->get("engine-power", m_engine_power, 3);
|
||||
lisp->get("time-full-steer", m_time_full_steer);
|
||||
lisp->get("time-full-steer-ai", m_time_full_steer_ai);
|
||||
lisp->get("brake-factor", m_brake_factor);
|
||||
@@ -240,7 +239,7 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("chassis-linear-damping", m_chassis_linear_damping );
|
||||
lisp->get("chassis-angular-damping", m_chassis_angular_damping );
|
||||
lisp->get("max-speed-reverse-ratio", m_max_speed_reverse_ratio );
|
||||
lisp->get("max-speed", m_max_speed );
|
||||
lisp->get("max-speed", m_max_speed, 3 );
|
||||
lisp->get("gravity-center-shift", m_gravity_center_shift );
|
||||
lisp->get("suspension-rest", m_suspension_rest );
|
||||
lisp->get("suspension-travel-cm", m_suspension_travel_cm );
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#define _WINSOCKAPI_
|
||||
#include "plib/ssg.h"
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
@@ -90,14 +88,14 @@ private:
|
||||
kart length. */
|
||||
m_max_radius; /**< Largest turn radius. */
|
||||
|
||||
ssgEntity *m_wheel_model[4]; /**< The four wheel models. */
|
||||
//ssgEntity *m_wheel_model[4]; /**< The four wheel models. */
|
||||
std::string m_wheel_filename[4]; /**< Filename of the wheel models. */
|
||||
/** Radius of the graphical wheels. */
|
||||
float m_wheel_graphics_radius[4];
|
||||
ssgTransform
|
||||
*m_wheel_transform[4]; /**< The transform for the wheels, used
|
||||
* to rotate the wheels and display
|
||||
* the suspension in the race. */
|
||||
//ssgTransform
|
||||
// *m_wheel_transform[4]; /**< The transform for the wheels, used
|
||||
// * to rotate the wheels and display
|
||||
// * the suspension in the race. */
|
||||
float m_rubber_band_max_length;/**< Max. length of plunger rubber band.*/
|
||||
float m_rubber_band_force; /**< Force of an attached rubber band.*/
|
||||
float m_rubber_band_duration;/**< Duration a rubber band works. */
|
||||
|
||||
@@ -76,7 +76,7 @@ void Moveable::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
|
||||
{
|
||||
Vec3 xyz=getXYZ()+off_xyz;
|
||||
Vec3 hpr=getHPR()+off_hpr;
|
||||
sgCoord c=Coord(xyz, hpr).toSgCoord();
|
||||
//sgCoord c=Coord(xyz, hpr).toSgCoord();
|
||||
if(m_node)
|
||||
{
|
||||
m_node->setPosition(xyz.toIrrVector());
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/sg.h>
|
||||
#ifdef HAVE_IRRLICHT
|
||||
#include "irrlicht.h"
|
||||
#endif
|
||||
@@ -112,25 +110,29 @@ namespace lisp
|
||||
return get(name.c_str(), val);
|
||||
}
|
||||
|
||||
bool get(const char* name, sgVec4& val) const
|
||||
{
|
||||
const Lisp* lisp = getLisp(name);
|
||||
if(!lisp)
|
||||
return false;
|
||||
|
||||
lisp = lisp->getCdr();
|
||||
if(!lisp)
|
||||
bool get(const char* name, float* val, int num) const
|
||||
{
|
||||
const Lisp* lisp = getLisp(name);
|
||||
if(!lisp)
|
||||
return false;
|
||||
|
||||
lisp = lisp->getCdr();
|
||||
if(!lisp)
|
||||
return false;
|
||||
for(int i = 0; i < num && lisp; ++i)
|
||||
{
|
||||
const Lisp* m_car = lisp->getCar();
|
||||
if(!m_car)
|
||||
return false;
|
||||
for(int i = 0; i < 4 && lisp; ++i)
|
||||
{
|
||||
const Lisp* m_car = lisp->getCar();
|
||||
if(!m_car)
|
||||
return false;
|
||||
m_car->get(val[i]);
|
||||
lisp = lisp->getCdr();
|
||||
}
|
||||
return true;
|
||||
m_car->get(val[i]);
|
||||
lisp = lisp->getCdr();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bool get(const char* name, sgVec3& val) const
|
||||
{
|
||||
const Lisp* lisp = getLisp(name);
|
||||
@@ -150,6 +152,8 @@ namespace lisp
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef HAVE_IRRLICHT
|
||||
bool get(const char* name, core::vector3df& val) const
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ World::~World()
|
||||
delete m_physics;
|
||||
|
||||
sound_manager -> stopMusic();
|
||||
|
||||
/*
|
||||
sgVec3 sun_pos;
|
||||
sgVec4 ambient_col, specular_col, diffuse_col;
|
||||
sgSetVec3 ( sun_pos, 0.0f, 0.0f, 1.0f );
|
||||
@@ -196,6 +196,7 @@ World::~World()
|
||||
ssgGetLight ( 0 ) -> setColour ( GL_AMBIENT , ambient_col ) ;
|
||||
ssgGetLight ( 0 ) -> setColour ( GL_DIFFUSE , diffuse_col ) ;
|
||||
ssgGetLight ( 0 ) -> setColour ( GL_SPECULAR, specular_col ) ;
|
||||
*/
|
||||
} // ~World
|
||||
//-----------------------------------------------------------------------------
|
||||
void World::terminateRace()
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#define HEADER_WORLD_HPP
|
||||
|
||||
#include <vector>
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ssg.h>
|
||||
|
||||
#include "highscores.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/sg.h>
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "bullet/Demos/OpenGL/GLDebugDrawer.h"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <plib/sg.h>
|
||||
|
||||
#include "replay_buffers.hpp"
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#ifdef HAVE_GHOST_REPLAY
|
||||
|
||||
#include <vector>
|
||||
#include <plib/ssg.h>
|
||||
|
||||
#include "replay_base.hpp"
|
||||
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
//won't be erased the next time the function is called.
|
||||
#define SHOW_NON_CRASHING_POINT //If defined, draws a green sphere where the
|
||||
//n farthest non-crashing point is.
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ssgAux.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "default_robot.hpp"
|
||||
@@ -192,7 +191,7 @@ void DefaultRobot::update(float dt)
|
||||
/ (getSpeed()-m_kart_ahead->getSpeed());
|
||||
target += m_kart_ahead->getVelocity()*time_till_hit;
|
||||
}
|
||||
float steer_angle = steerToPoint(m_kart_ahead->getXYZ().toFloat(),
|
||||
float steer_angle = steerToPoint(m_kart_ahead->getXYZ(),
|
||||
dt);
|
||||
setSteering(steer_angle, dt);
|
||||
commands_set = true;
|
||||
@@ -368,7 +367,7 @@ void DefaultRobot::handleSteering(float dt)
|
||||
{
|
||||
case FT_FAREST_POINT:
|
||||
{
|
||||
sgVec2 straight_point;
|
||||
Vec2 straight_point;
|
||||
findNonCrashingPoint( straight_point );
|
||||
steer_angle = steerToPoint(straight_point, dt);
|
||||
}
|
||||
@@ -737,7 +736,7 @@ float DefaultRobot::steerToAngle(const size_t SECTOR, const float ANGLE)
|
||||
* \param point Point to steer towards.
|
||||
* \param dt Time step.
|
||||
*/
|
||||
float DefaultRobot::steerToPoint(const sgVec2 point, float dt)
|
||||
float DefaultRobot::steerToPoint(const Vec2 point, float dt)
|
||||
{
|
||||
// No sense steering if we are not driving.
|
||||
if(getSpeed()==0) return 0.0f;
|
||||
@@ -876,8 +875,7 @@ void DefaultRobot::checkCrashes( const int STEPS, const Vec3& pos )
|
||||
scene->add( sphere );
|
||||
#endif
|
||||
|
||||
m_future_location[0] = step_coord[0];
|
||||
m_future_location[1] = step_coord[1];
|
||||
m_future_location = Vec3( step_coord[0], step_coord[1], 0 );
|
||||
|
||||
if( m_sector == Track::UNKNOWN_SECTOR )
|
||||
{
|
||||
@@ -901,7 +899,7 @@ void DefaultRobot::checkCrashes( const int STEPS, const Vec3& pos )
|
||||
* the two edges of the track is closest to the next curve after wards,
|
||||
* and return the position of that edge.
|
||||
*/
|
||||
void DefaultRobot::findNonCrashingPoint( sgVec2 result )
|
||||
void DefaultRobot::findNonCrashingPoint( Vec2 result )
|
||||
{
|
||||
const unsigned int DRIVELINE_SIZE = (unsigned int)m_track->m_driveline.size();
|
||||
|
||||
@@ -948,7 +946,8 @@ void DefaultRobot::findNonCrashingPoint( sgVec2 result )
|
||||
//If we are outside, the previous sector is what we are looking for
|
||||
if ( distance + m_kart_width * 0.5f > m_track->getWidth()[sector] )
|
||||
{
|
||||
sgCopyVec2( result, m_track->m_driveline[sector] );
|
||||
result = m_track->m_driveline[sector];
|
||||
//sgCopyVec2( result, m_track->m_driveline[sector] );
|
||||
|
||||
#ifdef SHOW_NON_CRASHING_POINT
|
||||
ssgaSphere *sphere = new ssgaSphere;
|
||||
@@ -990,8 +989,7 @@ void DefaultRobot::reset()
|
||||
m_inner_curve = 0;
|
||||
m_curve_target_speed = getMaxSpeedOnTerrain();
|
||||
m_curve_angle = 0.0;
|
||||
m_future_location[0] = 0.0;
|
||||
m_future_location[1] = 0.0;
|
||||
m_future_location = Vec3( 0.0, 0.0, 0.0 );
|
||||
m_future_sector = 0;
|
||||
m_time_till_start = -1.0f;
|
||||
m_crash_time = 0.0f;
|
||||
@@ -1176,7 +1174,12 @@ void DefaultRobot::findCurve()
|
||||
for(i = m_track_sector; total_dist < getVelocityLC().getY(); i = next_hint)
|
||||
{
|
||||
next_hint = i + 1 < DRIVELINE_SIZE ? i + 1 : 0;
|
||||
total_dist += sgDistanceVec2(m_track->m_driveline[i], m_track->m_driveline[next_hint]);
|
||||
|
||||
const int x_diff = m_track->m_driveline[i][0] - m_track->m_driveline[next_hint][0];
|
||||
const int y_diff = m_track->m_driveline[i][1] - m_track->m_driveline[next_hint][1];
|
||||
const float length_2d = sqrt( x_diff*x_diff + y_diff*y_diff );
|
||||
|
||||
total_dist += length_2d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#define HEADER_DEFAULT_H
|
||||
|
||||
#include "karts/auto_kart.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
/* third coord won't be used */
|
||||
typedef Vec3 Vec2;
|
||||
|
||||
class Track;
|
||||
class LinearWorld;
|
||||
@@ -102,7 +106,7 @@ private:
|
||||
/** Time an item has been collected and not used. */
|
||||
float m_time_since_last_shot;
|
||||
int m_future_sector;
|
||||
sgVec2 m_future_location;
|
||||
Vec2 m_future_location;
|
||||
|
||||
float m_time_till_start; //Used to simulate a delay at the start of the
|
||||
//race, since human players don't accelerate
|
||||
@@ -163,10 +167,10 @@ private:
|
||||
|
||||
/*Lower level functions not called directly from update()*/
|
||||
float steerToAngle(const size_t SECTOR, const float ANGLE);
|
||||
float steerToPoint(const sgVec2 point, float dt);
|
||||
float steerToPoint(const Vec2 point, float dt);
|
||||
|
||||
void checkCrashes(const int STEPS, const Vec3& pos);
|
||||
void findNonCrashingPoint(sgVec2 result);
|
||||
void checkCrashes(const int STEPS, const Vec2& pos);
|
||||
void findNonCrashingPoint(Vec2 result);
|
||||
|
||||
float normalizeAngle(float angle);
|
||||
int calcSteps();
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ssgAux.h>
|
||||
#include "irrlicht.h"
|
||||
|
||||
#include "stk_config.hpp"
|
||||
@@ -48,6 +46,8 @@
|
||||
#include "utils/ssg_help.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include <plib/ssg.h>
|
||||
|
||||
const float Track::NOHIT = -99999.9f;
|
||||
const int Track::QUAD_TRI_NONE = -1;
|
||||
const int Track::QUAD_TRI_FIRST = 1;
|
||||
@@ -524,8 +524,9 @@ bool Track::isShortcut(const int OLDSEC, const int NEWSEC) const
|
||||
//-----------------------------------------------------------------------------
|
||||
void Track::addDebugToScene(int type) const
|
||||
{
|
||||
if(type&1)
|
||||
if(type & 1)
|
||||
{
|
||||
/*
|
||||
ssgaSphere *sphere;
|
||||
sgVec3 center;
|
||||
sgVec4 colour;
|
||||
@@ -549,10 +550,12 @@ void Track::addDebugToScene(int type) const
|
||||
sphere->setColour(colour);
|
||||
stk_scene->add(sphere);
|
||||
} // for i
|
||||
*/
|
||||
} /// type ==1
|
||||
// 2: drivelines, 4: driveline with tolerance
|
||||
if(type&6)
|
||||
if(type & 6)
|
||||
{
|
||||
/*
|
||||
ssgVertexArray* v_array = new ssgVertexArray();
|
||||
ssgColourArray* c_array = new ssgColourArray();
|
||||
const std::vector<Vec3> &left = type&2 ? m_left_driveline
|
||||
@@ -583,6 +586,7 @@ void Track::addDebugToScene(int type) const
|
||||
(ssgTexCoordArray*)NULL,
|
||||
c_array);
|
||||
stk_scene->add(l);
|
||||
*/
|
||||
}
|
||||
} // addDebugToScene
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
# endif
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
#include <plib/sg.h>
|
||||
#include <plib/ssg.h>
|
||||
|
||||
#include "irrlicht.h"
|
||||
using namespace irr;
|
||||
#include <string>
|
||||
@@ -138,9 +137,9 @@ public:
|
||||
* to widen the road (to make shortcut detection less severe). */
|
||||
std::vector<Vec3> m_dl_with_tolerance_left;
|
||||
std::vector<Vec3> m_dl_with_tolerance_right;
|
||||
std::vector<SGfloat> m_distance_from_start;
|
||||
std::vector<SGfloat> m_path_width;
|
||||
std::vector<SGfloat> m_angle;
|
||||
std::vector<float> m_distance_from_start;
|
||||
std::vector<float> m_path_width;
|
||||
std::vector<float> m_angle;
|
||||
|
||||
/** Start positions for arenas (unused in linear races) */
|
||||
std::vector<Vec3> m_start_positions;
|
||||
@@ -211,7 +210,7 @@ public:
|
||||
const std::string& getDescription () const {return m_description; }
|
||||
const std::string& getDesigner () const {return m_designer; }
|
||||
const std::string& getScreenshotFile () const {return m_screenshot; }
|
||||
const std::vector<SGfloat>& getWidth () const {return m_path_width; }
|
||||
const std::vector<float>& getWidth () const {return m_path_width; }
|
||||
const std::string& getItemStyle () const {return m_item_style; }
|
||||
bool hasFinalCamera () const {return m_has_final_camera; }
|
||||
const Vec3& getCameraPosition () const {return m_camera_final_position;}
|
||||
@@ -223,12 +222,13 @@ public:
|
||||
void createPhysicsModel();
|
||||
void update(float dt);
|
||||
void handleExplosion(const Vec3 &pos, const PhysicalObject *mp) const;
|
||||
/*
|
||||
void glVtx (sgVec2 v, float x_offset, float y_offset) const
|
||||
{
|
||||
glVertex2f(
|
||||
x_offset+(v[0]-m_driveline_min[0])*m_scale_x,
|
||||
y_offset+(v[1]-m_driveline_min[1])*m_scale_y);
|
||||
}
|
||||
}*/
|
||||
|
||||
private:
|
||||
void loadTrack(const std::string &filename);
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
// ul.h includes windows.h, so this define is necessary
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ul.h>
|
||||
|
||||
// for mkdir:
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
# include <sys/stat.h>
|
||||
@@ -33,9 +37,6 @@
|
||||
# include <direct.h>
|
||||
#endif
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/ul.h>
|
||||
|
||||
#include "stk_config.hpp"
|
||||
//#include "actionmap.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#ifndef HEADER_COORD_H
|
||||
#define HEADER_COORD_H
|
||||
#include <plib/sg.h>
|
||||
|
||||
#include "LinearMath/btTransform.h"
|
||||
|
||||
@@ -37,10 +36,11 @@ private:
|
||||
Vec3 m_xyz;
|
||||
/** Rotation as Eulerian HPR value. */
|
||||
Vec3 m_hpr;
|
||||
/** The correspondig plib data structure. */
|
||||
sgCoord m_coord;
|
||||
|
||||
//sgCoord m_coord;
|
||||
|
||||
/** Sets the sgCoord data structures (and converts radians to degrees). */
|
||||
/*
|
||||
void setSgCoord()
|
||||
{
|
||||
sgSetCoord(&m_coord, m_xyz.toFloat(), m_hpr.toFloat());
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
{
|
||||
m_coord.hpr[i] = RAD_TO_DEGREE(m_coord.hpr[i]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public:
|
||||
/** Constructor.
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
{
|
||||
m_xyz = xyz;
|
||||
m_hpr = hpr;
|
||||
setSgCoord();
|
||||
//setSgCoord();
|
||||
} // Coord
|
||||
// ------------------------------------------------------------------------
|
||||
/** Constructor based on a bullet transformation (which is a translation
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
{
|
||||
m_xyz = t.getOrigin();
|
||||
m_hpr.setHPR(t.getBasis());
|
||||
setSgCoord();
|
||||
//setSgCoord();
|
||||
} // Coord
|
||||
// ------------------------------------------------------------------------
|
||||
/** Default constructor. Sets xyz and hpr to 0. */
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the corresponding plib data structure. */
|
||||
const sgCoord& toSgCoord() const { return m_coord; }
|
||||
//const sgCoord& toSgCoord() const { return m_coord; }
|
||||
/** Returns the translation. */
|
||||
const Vec3& getXYZ() const { return m_xyz; }
|
||||
/** Returns heading, pitch, rolll. */
|
||||
@@ -97,9 +97,9 @@ public:
|
||||
float getHeading() const { return m_hpr.getHeading(); }
|
||||
|
||||
/** Sets hpr. \param a Heading, pitch and roll. */
|
||||
void setHPR(const Vec3& a) { m_hpr = a; setSgCoord(); }
|
||||
void setHPR(const Vec3& a) { m_hpr = a; /*setSgCoord();*/ }
|
||||
/** Sets xyz. \param a Coordinates. */
|
||||
void setXYZ(const Vec3& a) { m_xyz = a; setSgCoord(); }
|
||||
void setXYZ(const Vec3& a) { m_xyz = a; /*setSgCoord();*/ }
|
||||
/** Sets X. \param x New X value. */
|
||||
void setX(float x) { m_xyz.setX(x); }
|
||||
/** Sets Y. \param y New Y value. */
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include "utils/ssg_help.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if 0
|
||||
|
||||
#include <plib/ssg.h>
|
||||
|
||||
namespace SSGHelp
|
||||
@@ -172,4 +175,5 @@ namespace SSGHelp
|
||||
} // Minmax
|
||||
|
||||
} // namespace SSGHelp
|
||||
/* EOF */
|
||||
#endif
|
||||
/* EOF */
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef HEADER_SSG_HELP_H
|
||||
#define HEADER_SSG_HELP_H
|
||||
|
||||
#include <plib/ssg.h>
|
||||
#if 0
|
||||
#include "vec3.hpp"
|
||||
|
||||
namespace SSGHelp {
|
||||
@@ -33,6 +33,7 @@ namespace SSGHelp {
|
||||
Vec3 *min, Vec3 *max);
|
||||
}; // namespace SSGHelp
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void Vec3::setHPR(const btMatrix3x3& m)
|
||||
|
||||
setY(asin(CLAMPTO1(m.getRow(2).getY())));
|
||||
|
||||
SGfloat cp = cos(getY());
|
||||
float cp = cos(getY());
|
||||
|
||||
/* If pointing nearly vertically up - then heading is ill-defined */
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
#include "irrlicht.h"
|
||||
using namespace irr;
|
||||
#endif
|
||||
#define _WINSOCKAPI_
|
||||
#include <plib/sg.h>
|
||||
|
||||
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "LinearMath/btMatrix3x3.h"
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
*/
|
||||
inline Vec3(const core::vector3df &v) : btVector3(v.X, v.Z, v.Y) {}
|
||||
#endif
|
||||
inline Vec3(sgVec3 a) : btVector3(a[0], a[1], a[2]) {}
|
||||
//inline Vec3(sgVec3 a) : btVector3(a[0], a[1], a[2]) {}
|
||||
inline Vec3(const btVector3& a) : btVector3(a) {}
|
||||
inline Vec3() : btVector3() {}
|
||||
inline Vec3(float x, float y, float z) : btVector3(x,y,z) {}
|
||||
|
||||
Reference in New Issue
Block a user