Properly set the camera type in the constructor (which previously
was always 'CM_TYPE_NORMAL'). Fixes #2576.
This commit is contained in:
parent
c64733e3d0
commit
ba3497bb81
@ -73,7 +73,8 @@ Camera* Camera::createCamera(unsigned int index, CameraType type,
|
||||
Camera *camera = NULL;
|
||||
switch (type)
|
||||
{
|
||||
case CM_TYPE_NORMAL: camera = new CameraNormal(index, kart); break;
|
||||
case CM_TYPE_NORMAL: camera = new CameraNormal(CM_TYPE_NORMAL, index, kart);
|
||||
break;
|
||||
case CM_TYPE_DEBUG: camera = new CameraDebug (index, kart); break;
|
||||
case CM_TYPE_FPS: camera = new CameraFPS (index, kart); break;
|
||||
case CM_TYPE_END: camera = new CameraEnd (index, kart); break;
|
||||
@ -112,10 +113,11 @@ void Camera::resetAllCameras()
|
||||
} // resetAllCameras
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
Camera::Camera(int camera_index, AbstractKart* kart) : m_kart(NULL)
|
||||
Camera::Camera(CameraType type, int camera_index, AbstractKart* kart)
|
||||
: m_kart(NULL)
|
||||
{
|
||||
m_mode = CM_NORMAL;
|
||||
m_type = CameraType::CM_TYPE_NORMAL;
|
||||
m_type = type;
|
||||
m_index = camera_index;
|
||||
m_original_kart = kart;
|
||||
m_camera = irr_driver->addCameraSceneNode();
|
||||
|
@ -126,9 +126,9 @@ protected:
|
||||
AbstractKart *m_kart;
|
||||
|
||||
static Camera* createCamera(unsigned int index, CameraType type,
|
||||
AbstractKart* kart);
|
||||
AbstractKart* kart);
|
||||
|
||||
Camera(int camera_index, AbstractKart* kart);
|
||||
Camera(CameraType type, int camera_index, AbstractKart* kart);
|
||||
virtual ~Camera();
|
||||
virtual void reset();
|
||||
public:
|
||||
|
@ -32,7 +32,7 @@ CameraDebug::CameraDebugType CameraDebug::m_default_debug_Type =
|
||||
|
||||
// ============================================================================
|
||||
CameraDebug::CameraDebug(int camera_index, AbstractKart* kart)
|
||||
: CameraNormal(camera_index, kart)
|
||||
: CameraNormal(Camera::CM_TYPE_DEBUG, camera_index, kart)
|
||||
{
|
||||
reset();
|
||||
} // Camera
|
||||
|
@ -27,7 +27,7 @@
|
||||
AlignedArray<CameraEnd::EndCameraInformation> CameraEnd::m_end_cameras;
|
||||
// ============================================================================
|
||||
CameraEnd::CameraEnd(int camera_index, AbstractKart* kart)
|
||||
: CameraNormal(camera_index, kart)
|
||||
: CameraNormal(Camera::CM_TYPE_END, camera_index, kart)
|
||||
{
|
||||
reset();
|
||||
if(m_end_cameras.size()>0)
|
||||
|
@ -30,7 +30,7 @@ using namespace irr;
|
||||
|
||||
// ============================================================================
|
||||
CameraFPS::CameraFPS(int camera_index, AbstractKart* kart)
|
||||
: Camera(camera_index, kart)
|
||||
: Camera(Camera::CM_TYPE_FPS, camera_index, kart)
|
||||
{
|
||||
m_attached = false;
|
||||
|
||||
|
@ -28,8 +28,17 @@
|
||||
#include "tracks/track.hpp"
|
||||
|
||||
// ============================================================================
|
||||
CameraNormal::CameraNormal(int camera_index, AbstractKart* kart)
|
||||
: Camera(camera_index, kart)
|
||||
/** Constructor for the normal camera. This is the only camera constructor
|
||||
* except for the base class that takes a camera type as parameter. This is
|
||||
* because debug and end camera use the normal camera as their base class.
|
||||
* \param type The type of the camera that is created (can be CM_TYPE_END
|
||||
* or CM_TYPE_DEBUG).
|
||||
* \param camera_index Index of this camera.
|
||||
* \param Kart Pointer to the kart for which this camera is used.
|
||||
*/
|
||||
CameraNormal::CameraNormal(Camera::CameraType type, int camera_index,
|
||||
AbstractKart* kart)
|
||||
: Camera(type, camera_index, kart)
|
||||
{
|
||||
m_distance = kart ? kart->getKartProperties()->getCameraDistance() : 1000.0f;
|
||||
m_ambient_light = World::getWorld()->getTrack()->getDefaultAmbientColor();
|
||||
|
@ -61,7 +61,8 @@ private:
|
||||
friend class Camera;
|
||||
friend class CameraDebug;
|
||||
friend class CameraEnd;
|
||||
CameraNormal(int camera_index, AbstractKart* kart);
|
||||
CameraNormal(Camera::CameraType type, int camera_index,
|
||||
AbstractKart* kart);
|
||||
virtual ~CameraNormal() {}
|
||||
public:
|
||||
bool isDebug() { return false; }
|
||||
|
Loading…
Reference in New Issue
Block a user