Removed unused final camera.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4843 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -150,30 +150,8 @@ void Camera::setMode(Mode mode)
|
||||
m_camera->setPosition(wanted_position.toIrrVector());
|
||||
m_camera->setTarget(wanted_target.toIrrVector());
|
||||
}
|
||||
if(mode==CM_FINAL)
|
||||
{
|
||||
const Track* track = world->getTrack();
|
||||
core::vector3df wanted_position(track->getCameraPosition().toIrrVector());
|
||||
core::vector3df curr_position(m_camera->getPosition());
|
||||
m_lin_velocity = (wanted_position-curr_position)
|
||||
/ stk_config->m_final_camera_time;
|
||||
float distance = (m_kart->getXYZ() - curr_position).length();
|
||||
core::vector3df hpr = track->getCameraHPR().toIrrHPR();
|
||||
core::vector3df target = hpr.rotationToDirection(core::vector3df(0, 0, 1)*distance)
|
||||
+ wanted_position;
|
||||
core::vector3df curr_hpr = m_camera->getRotation();
|
||||
m_target_velocity = (target - m_camera->getTarget())
|
||||
/ stk_config->m_final_camera_time;
|
||||
m_final_time = 0.0f;
|
||||
}
|
||||
|
||||
// If the camera is set to final mode but there is no camera
|
||||
// end position defined, ignore this request and leave the camera
|
||||
// in normal mode.
|
||||
if(mode!=CM_FINAL || world->getTrack()->hasFinalCamera())
|
||||
{
|
||||
m_mode = mode;
|
||||
}
|
||||
m_mode = mode;
|
||||
} // setMode
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -326,19 +304,6 @@ void Camera::update(float dt)
|
||||
smoothMoveCamera(dt, wanted_position, wanted_target);
|
||||
break;
|
||||
}
|
||||
case CM_FINAL:
|
||||
{
|
||||
m_final_time +=dt;
|
||||
if(m_final_time < stk_config->m_final_camera_time)
|
||||
{
|
||||
core::vector3df new_pos = m_camera->getPosition()+m_lin_velocity*dt;
|
||||
m_camera->setPosition(new_pos);
|
||||
core::vector3df new_target = m_camera->getTarget()+m_target_velocity*dt;
|
||||
m_camera->setTarget(new_target);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case CM_SIMPLE_REPLAY:
|
||||
// TODO: Implement
|
||||
break;
|
||||
|
||||
@@ -36,7 +36,6 @@ public:
|
||||
CM_CLOSEUP, // Closer to kart
|
||||
CM_REVERSE, // Looking backwards
|
||||
CM_LEADER_MODE, // for deleted player karts in follow the leader
|
||||
CM_FINAL, // Final camera to show the end of the race
|
||||
CM_SIMPLE_REPLAY
|
||||
};
|
||||
|
||||
@@ -87,10 +86,6 @@ private:
|
||||
/** Velocity of the target of the camera, only used for end camera. */
|
||||
core::vector3df m_target_velocity;
|
||||
|
||||
/** Counts the time for the end camera only, to indicate when
|
||||
* the end camera should stop moving. */
|
||||
float m_final_time;
|
||||
|
||||
void setupCamera();
|
||||
void smoothMoveCamera(float dt, const Vec3 &wanted_position,
|
||||
const Vec3 &wanted_target);
|
||||
|
||||
@@ -275,17 +275,13 @@ void PlayerController::update(float dt)
|
||||
m_kart->beep();
|
||||
}
|
||||
|
||||
// Camera looks back when reversing
|
||||
if(m_kart->getCamera()->getMode()!=Camera::CM_FINAL)
|
||||
{
|
||||
// look backward when the player requests or
|
||||
// if automatic reverse camera is active
|
||||
if (m_controls->m_look_back || (UserConfigParams::m_reverse_look_threshold>0 &&
|
||||
m_kart->getSpeed()<-UserConfigParams::m_reverse_look_threshold))
|
||||
m_kart->getCamera()->setMode(Camera::CM_REVERSE);
|
||||
else
|
||||
m_kart->getCamera()->setMode(Camera::CM_NORMAL);
|
||||
}
|
||||
// look backward when the player requests or
|
||||
// if automatic reverse camera is active
|
||||
if (m_controls->m_look_back || (UserConfigParams::m_reverse_look_threshold>0 &&
|
||||
m_kart->getSpeed()<-UserConfigParams::m_reverse_look_threshold))
|
||||
m_kart->getCamera()->setMode(Camera::CM_REVERSE);
|
||||
else
|
||||
m_kart->getCamera()->setMode(Camera::CM_NORMAL);
|
||||
|
||||
// We can't restrict rescue to fulfil isOnGround() (which would be more like
|
||||
// MK), since e.g. in the City track it is possible for the kart to end
|
||||
@@ -330,10 +326,6 @@ void PlayerController::setPosition(int p)
|
||||
*/
|
||||
void PlayerController::finishedRace(float time)
|
||||
{
|
||||
// Set race over camera (but not in follow the leader mode, since the kart
|
||||
// will most likely not be at the starting line at the end of the race
|
||||
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
m_kart->getCamera()->setMode(Camera::CM_FINAL);
|
||||
|
||||
RaceGUI* m=World::getWorld()->getRaceGUI();
|
||||
if(m)
|
||||
|
||||
@@ -70,7 +70,6 @@ Track::Track(std::string filename)
|
||||
m_non_collision_mesh = new TriangleMesh();
|
||||
m_all_nodes.clear();
|
||||
m_all_meshes.clear();
|
||||
m_has_final_camera = false;
|
||||
m_is_arena = false;
|
||||
m_camera_far = 1000.0f;
|
||||
m_quad_graph = NULL;
|
||||
@@ -214,8 +213,7 @@ void Track::loadTrackInfo()
|
||||
root->get("gravity", &m_gravity);
|
||||
root->get("arena", &m_is_arena);
|
||||
root->get("groups", &m_groups);
|
||||
|
||||
for (unsigned int i=0; i<root->getNumNodes(); i++)
|
||||
for(unsigned int i=0; i<root->getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *mode=root->getNode(i);
|
||||
if(mode->getName()!="mode") continue;
|
||||
@@ -226,20 +224,20 @@ void Track::loadTrackInfo()
|
||||
mode->get("scene", &tm.m_scene );
|
||||
m_all_modes.push_back(tm);
|
||||
}
|
||||
|
||||
// If no mode is specified, add a default mode.
|
||||
if (m_all_modes.size()==0)
|
||||
if(m_all_modes.size()==0)
|
||||
{
|
||||
TrackMode tm;
|
||||
m_all_modes.push_back(tm);
|
||||
}
|
||||
|
||||
if (m_groups.size()==0) m_groups.push_back("standard");
|
||||
|
||||
if(m_groups.size()==0)
|
||||
m_groups.push_back("standard");
|
||||
const XMLNode *xml_node = root->getNode("curves");
|
||||
if (xml_node) loadCurves(*xml_node);
|
||||
if(xml_node)
|
||||
loadCurves(*xml_node);
|
||||
|
||||
// Set the correct paths
|
||||
// Set the correct paths
|
||||
m_screenshot = m_root+"/"+m_screenshot;
|
||||
delete root;
|
||||
|
||||
@@ -248,11 +246,11 @@ void Track::loadTrackInfo()
|
||||
//-----------------------------------------------------------------------------
|
||||
void Track::loadCurves(const XMLNode &node)
|
||||
{
|
||||
for (unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *curve = node.getNode(i);
|
||||
m_all_curves.push_back(new BezierCurve(*curve));
|
||||
} // for i<node.getNumNodes
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *curve = node.getNode(i);
|
||||
m_all_curves.push_back(new BezierCurve(*curve));
|
||||
} // for i<node.getNumNodes
|
||||
} // loadCurves
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -357,12 +355,10 @@ void Track::convertTrackToBullet(const scene::IMesh *mesh,
|
||||
core::matrix4 mat;
|
||||
mat.setRotationDegrees(hpr);
|
||||
mat.setTranslation(pos);
|
||||
for(unsigned int i=0; i<mesh->getMeshBufferCount(); i++)
|
||||
{
|
||||
for(unsigned int i=0; i<mesh->getMeshBufferCount(); i++) {
|
||||
scene::IMeshBuffer *mb = mesh->getMeshBuffer(i);
|
||||
// FIXME: take translation/rotation into account
|
||||
if(mb->getVertexType()!=video::EVT_STANDARD)
|
||||
{
|
||||
if(mb->getVertexType()!=video::EVT_STANDARD) {
|
||||
fprintf(stderr, "WARNING: Physics::convertTrack: Ignoring type '%d'!",
|
||||
mb->getVertexType());
|
||||
continue;
|
||||
@@ -372,8 +368,7 @@ void Track::convertTrackToBullet(const scene::IMesh *mesh,
|
||||
|
||||
const Material* material=0;
|
||||
TriangleMesh *tmesh = m_track_mesh;
|
||||
if(t)
|
||||
{
|
||||
if(t) {
|
||||
#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR == 7)
|
||||
std::string image = std::string(core::stringc(t->getName()).c_str());
|
||||
#else
|
||||
@@ -391,10 +386,8 @@ void Track::convertTrackToBullet(const scene::IMesh *mesh,
|
||||
u16 *mbIndices = mb->getIndices();
|
||||
Vec3 vertices[3];
|
||||
irr::video::S3DVertex* mbVertices=(video::S3DVertex*)mb->getVertices();
|
||||
for(unsigned int j=0; j<mb->getIndexCount(); j+=3)
|
||||
{
|
||||
for(unsigned int k=0; k<3; k++)
|
||||
{
|
||||
for(unsigned int j=0; j<mb->getIndexCount(); j+=3) {
|
||||
for(unsigned int k=0; k<3; k++) {
|
||||
int indx=mbIndices[j+k];
|
||||
core::vector3df v = mbVertices[indx].Pos;
|
||||
mat.transformVect(v);
|
||||
@@ -620,8 +613,7 @@ void Track::createWater(const XMLNode &node)
|
||||
*/
|
||||
void Track::loadTrackModel(unsigned int mode_id)
|
||||
{
|
||||
m_has_final_camera = false;
|
||||
//m_is_arena = false;
|
||||
m_is_arena = false;
|
||||
m_track_object_manager = new TrackObjectManager();
|
||||
|
||||
// Load the graph only now: this function is called from world, after
|
||||
@@ -756,10 +748,6 @@ void Track::loadTrackModel(unsigned int mode_id)
|
||||
{
|
||||
handleSky(*node, path);
|
||||
}
|
||||
else if (name=="camera")
|
||||
{
|
||||
handleCamera(*node);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Warning: element '%s' not found.\n",
|
||||
@@ -877,18 +865,6 @@ void Track::handleSky(const XMLNode &xml_node, const std::string &filename)
|
||||
} // if sky-box
|
||||
} // handleSky
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Reads the final camera position.
|
||||
* \param root The XML node with the camera node.
|
||||
*/
|
||||
void Track::handleCamera(const XMLNode &root)
|
||||
{
|
||||
m_has_final_camera = true;
|
||||
root.get("final-position", &m_camera_final_position);
|
||||
root.get("final-hpr", &m_camera_final_hpr );
|
||||
m_camera_final_hpr.degreeToRad();
|
||||
} // handleCamera
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Handle creation and placement of an item.
|
||||
* \param xyz The position of the item.
|
||||
|
||||
@@ -74,12 +74,6 @@ private:
|
||||
scene::ILightSceneNode *m_sun;
|
||||
TriangleMesh* m_track_mesh;
|
||||
TriangleMesh* m_non_collision_mesh;
|
||||
/** True if the track/scene has a final camera position. */
|
||||
bool m_has_final_camera;
|
||||
/** The final xyz coordinates of the camera. */
|
||||
Vec3 m_camera_final_position;
|
||||
/** The final hpr rotation of the camera. */
|
||||
Vec3 m_camera_final_hpr;
|
||||
/** Minimum coordinates of this track. */
|
||||
Vec3 m_aabb_min;
|
||||
/** Maximum coordinates of this track. */
|
||||
@@ -175,7 +169,6 @@ private:
|
||||
void loadCurves(const XMLNode &node);
|
||||
void handleAnimatedTextures(scene::ISceneNode *node, const XMLNode &xml);
|
||||
void handleSky(const XMLNode &root, const std::string &filename);
|
||||
void handleCamera(const XMLNode &root);
|
||||
|
||||
public:
|
||||
|
||||
@@ -222,9 +215,6 @@ public:
|
||||
const std::string& getScreenshotFile () const {return m_screenshot; }
|
||||
|
||||
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;}
|
||||
const Vec3& getCameraHPR () const {return m_camera_final_hpr; }
|
||||
btTransform getStartTransform (unsigned int pos) const;
|
||||
void getTerrainInfo(const Vec3 &pos, float *hot, Vec3* normal,
|
||||
const Material **material) const;
|
||||
|
||||
Reference in New Issue
Block a user