Remove unused class
This commit is contained in:
parent
00a22a727a
commit
56b71e97ad
@ -1,5 +1,5 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -1,91 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "tracks/ambient_light_sphere.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "graphics/camera.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
||||
/** Constructor for a checksphere.
|
||||
* \param node XML node containing the parameters for this checkline.
|
||||
*/
|
||||
AmbientLightSphere::AmbientLightSphere(const XMLNode &node,
|
||||
unsigned int index)
|
||||
: CheckSphere(node, index)
|
||||
{
|
||||
m_ambient_color = video::SColor(255, 0, 255, 0); // green
|
||||
m_inner_radius2 = 1;
|
||||
node.get("inner-radius", &m_inner_radius2);
|
||||
m_inner_radius2 *= m_inner_radius2; // store the squared value
|
||||
node.get("color", &m_ambient_color);
|
||||
} // AmbientLightSphere
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void AmbientLightSphere::update(float dt)
|
||||
{
|
||||
CheckStructure::update(dt);
|
||||
|
||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||
{
|
||||
Camera *camera = Camera::getCamera(i);
|
||||
const AbstractKart *kart=camera->getKart();
|
||||
if(!kart) continue;
|
||||
if(isInside(i))
|
||||
{
|
||||
float d2=getDistance2ForKart(i);
|
||||
video::SColor color;
|
||||
Track *track=Track::getCurrentTrack();
|
||||
if(d2<m_inner_radius2)
|
||||
{ // Inside inner radius --> use new ambient color
|
||||
color = m_ambient_color;
|
||||
}
|
||||
else // Interpolate between default and this ambient color
|
||||
{
|
||||
float f = (getRadius2()-d2)/(getRadius2()-m_inner_radius2);
|
||||
const video::SColor &def = track->getDefaultAmbientColor();
|
||||
color = m_ambient_color.getInterpolated(def, f);
|
||||
}
|
||||
camera->setAmbientLight(color);
|
||||
} // if active
|
||||
} // for i<num_karts
|
||||
} // update
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Only calls the sphere check if the kart is a player kart, since other
|
||||
* karts won't change the ambient light.
|
||||
* \param old_pos Position in previous frame.
|
||||
* \param new_pos Position in current frame.
|
||||
* \param indx Index of the kart, can be used to store kart specific
|
||||
* additional data.
|
||||
*/
|
||||
bool AmbientLightSphere::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
unsigned int indx)
|
||||
{
|
||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||
{
|
||||
if(Camera::getCamera(i)->getKart()->getWorldKartId()==indx)
|
||||
return CheckSphere::isTriggered(old_pos, new_pos, indx);
|
||||
}
|
||||
return false;
|
||||
} // isTriggered
|
@ -1,60 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_AMBIENT_LIGHT_SPHERE_HPP
|
||||
#define HEADER_AMBIENT_LIGHT_SPHERE_HPP
|
||||
|
||||
#include <SColor.h>
|
||||
using namespace irr;
|
||||
|
||||
#include "tracks/check_sphere.hpp"
|
||||
|
||||
class XMLNode;
|
||||
class CheckManager;
|
||||
|
||||
/**
|
||||
* \brief This class implements a check sphere that is used to change the ambient
|
||||
* light if a kart is inside this sphere.
|
||||
*
|
||||
* Besides a normal radius this sphere also has a 2nd 'inner' radius: player karts
|
||||
* inside the inner radius will have the full new ambient light, karts outside the
|
||||
* default light, and karts in between will mix the light dependent on distance.
|
||||
*
|
||||
* \ingroup tracks
|
||||
*/
|
||||
class AmbientLightSphere : public CheckSphere
|
||||
{
|
||||
private:
|
||||
/** The inner radius defines the area during which the ambient light
|
||||
* is extrapolated. The square of the value specified in the scene
|
||||
* file is stored. */
|
||||
float m_inner_radius2;
|
||||
|
||||
/** THe full ambient color to use once the kart is inside the
|
||||
* inner radius. */
|
||||
video::SColor m_ambient_color;
|
||||
public:
|
||||
AmbientLightSphere(const XMLNode &node, unsigned int index);
|
||||
virtual ~AmbientLightSphere() {};
|
||||
virtual void update(float dt);
|
||||
virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
unsigned int indx);
|
||||
}; // AmbientLightSphere
|
||||
|
||||
#endif
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "tracks/ambient_light_sphere.hpp"
|
||||
#include "tracks/check_cannon.hpp"
|
||||
#include "tracks/check_goal.hpp"
|
||||
#include "tracks/check_lap.hpp"
|
||||
#include "tracks/check_line.hpp"
|
||||
#include "tracks/check_sphere.hpp"
|
||||
#include "tracks/check_structure.hpp"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user