Fix intro cutscene
This commit is contained in:
parent
e1d879a1f2
commit
a063d23b37
@ -54,12 +54,22 @@ Camera::Camera(int camera_index, AbstractKart* kart) : m_kart(NULL)
|
||||
m_camera = irr_driver->addCameraSceneNode();
|
||||
|
||||
#ifdef DEBUG
|
||||
m_camera->setName(core::stringc("Camera for ") + kart->getKartProperties()->getName());
|
||||
if (kart != NULL)
|
||||
m_camera->setName(core::stringc("Camera for ") + kart->getKartProperties()->getName());
|
||||
else
|
||||
m_camera->setName("Camera");
|
||||
#endif
|
||||
|
||||
setupCamera();
|
||||
m_distance = kart->getKartProperties()->getCameraDistance();
|
||||
setKart(kart);
|
||||
if (kart != NULL)
|
||||
{
|
||||
m_distance = kart->getKartProperties()->getCameraDistance();
|
||||
setKart(kart);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_distance = 1000.0f;
|
||||
}
|
||||
m_ambient_light = World::getWorld()->getTrack()->getDefaultAmbientColor();
|
||||
|
||||
// TODO: Put these values into a config file
|
||||
@ -264,7 +274,9 @@ void Camera::reset()
|
||||
{
|
||||
m_kart = m_original_kart;
|
||||
setMode(CM_NORMAL);
|
||||
setInitialTransform();
|
||||
|
||||
if (m_kart != NULL)
|
||||
setInitialTransform();
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -273,6 +285,8 @@ void Camera::reset()
|
||||
*/
|
||||
void Camera::setInitialTransform()
|
||||
{
|
||||
if (m_kart == NULL) return;
|
||||
|
||||
Vec3 start_offset(0, 25, -50);
|
||||
Vec3 xx = m_kart->getTrans()(start_offset);
|
||||
m_camera->setPosition( xx.toIrrVector());
|
||||
@ -431,6 +445,8 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
|
||||
*/
|
||||
void Camera::update(float dt)
|
||||
{
|
||||
if (m_kart == NULL) return; // cameras not attached to kart must be positioned manually
|
||||
|
||||
float above_kart, cam_angle, side_way, distance;
|
||||
bool smoothing;
|
||||
|
||||
@ -472,7 +488,6 @@ void Camera::update(float dt)
|
||||
|
||||
m_camera->setTarget(current_target);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
getCameraSettings(&above_kart, &cam_angle, &side_way, &distance, &smoothing);
|
||||
|
@ -86,7 +86,9 @@ private:
|
||||
float m_rotation_range;
|
||||
|
||||
/** The kart that the camera follows. It can't be const,
|
||||
* since in profile mode the camera might change its owner. */
|
||||
* since in profile mode the camera might change its owner.
|
||||
* May be NULL (example: cutscene camera)
|
||||
*/
|
||||
AbstractKart *m_kart;
|
||||
|
||||
/** A pointer to the original kart the camera was pointing at when it
|
||||
|
@ -211,7 +211,7 @@ GLuint LoadShader(const char * file, unsigned type) {
|
||||
}
|
||||
GLint Result = GL_FALSE;
|
||||
int InfoLogLength;
|
||||
printf("Compiling shader : %s\n", file);
|
||||
Log::info("GLWrap", "Compiling shader : %s", file);
|
||||
char const * SourcePointer = Code.c_str();
|
||||
int length = strlen(SourcePointer);
|
||||
glShaderSource(Id, 1, &SourcePointer, &length);
|
||||
|
@ -1803,18 +1803,7 @@ void IrrDriver::update(float dt)
|
||||
|
||||
World *world = World::getWorld();
|
||||
|
||||
// Handle cut scenes (which do not have any karts in it)
|
||||
// =====================================================
|
||||
if (world && world->getNumKarts() == 0)
|
||||
{
|
||||
m_video_driver->beginScene(/*backBuffer clear*/true, /*zBuffer*/true,
|
||||
world->getClearColor());
|
||||
m_scene_manager->drawAll();
|
||||
GUIEngine::render(dt);
|
||||
m_video_driver->endScene();
|
||||
return;
|
||||
}
|
||||
else if (GUIEngine::getCurrentScreen() != NULL &&
|
||||
if (GUIEngine::getCurrentScreen() != NULL &&
|
||||
GUIEngine::getCurrentScreen()->needs3D())
|
||||
{
|
||||
//printf("Screen that needs 3D\n");
|
||||
@ -1827,10 +1816,10 @@ void IrrDriver::update(float dt)
|
||||
}
|
||||
else if (!world)
|
||||
{
|
||||
m_video_driver->beginScene(/*backBuffer clear*/ true, /*zBuffer*/ true,
|
||||
m_video_driver->beginScene(/*backBuffer clear*/ true, /*zBuffer*/ true,
|
||||
video::SColor(255,100,101,140));
|
||||
|
||||
GUIEngine::render(dt);
|
||||
GUIEngine::render(dt);
|
||||
|
||||
m_video_driver->endScene();
|
||||
return;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "graphics/camera.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
@ -73,9 +74,11 @@ void CutsceneWorld::init()
|
||||
|
||||
//const btTransform &s = getTrack()->getStartTransform(0);
|
||||
//const Vec3 &v = s.getOrigin();
|
||||
m_camera = irr_driver->getSceneManager()
|
||||
->addCameraSceneNode(NULL, core::vector3df(0.0f, 0.0f, 0.0f),
|
||||
core::vector3df(0.0f, 0.0f, 0.0f));
|
||||
Camera* stk_cam = Camera::createCamera(NULL);
|
||||
m_camera = stk_cam->getCameraSceneNode();
|
||||
//m_camera = irr_driver->getSceneManager()
|
||||
// ->addCameraSceneNode(NULL, core::vector3df(0.0f, 0.0f, 0.0f),
|
||||
// core::vector3df(0.0f, 0.0f, 0.0f));
|
||||
m_camera->setFOV(0.61f);
|
||||
m_camera->bindTargetAndRotation(true); // no "look-at"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user