Commit 2917a988 authored by hybrid's avatar hybrid

Add possibility to add cameras without immediately making them active. Feature request by kkrizka.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2745 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 07280fa0
......@@ -537,11 +537,14 @@ namespace scene
\param parent: Parent scene node of the camera. Can be null. If the parent moves,
the camera will move too.
\param id: id of the camera. This id can be used to identify the camera.
\param makeActive Flag whether this camera should become the active one.
Make sure you always have one active camera.
\return Pointer to interface to camera if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0;
const core::vector3df& lookat = core::vector3df(0,0,100),
s32 id=-1, bool makeActive=true) = 0;
//! Adds a maya style user controlled camera scene node to the scene graph.
/** This is a standard camera with an animator that provides mouse control similar
......@@ -551,11 +554,14 @@ namespace scene
\param zoomSpeed: Zoom speed of the camera.
\param translationSpeed: TranslationSpeed of the camera.
\param id: id of the camera. This id can be used to identify the camera.
\param makeActive Flag whether this camera should become the active one.
Make sure you always have one active camera.
\return Returns a pointer to the interface of the camera if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
f32 translationSpeed = 1500.0f, s32 id=-1) = 0;
f32 translationSpeed = 1500.0f, s32 id=-1,
bool makeActive=true) = 0;
//! Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS).
/** This FPS camera is intended to provide a demonstration of a
......@@ -616,13 +622,16 @@ namespace scene
up when the mouse is moved down and down when the mouse is
moved up, the default is 'false' which means it will follow the
movement of the mouse cursor.
\param makeActive Flag whether this camera should become the active one.
Make sure you always have one active camera.
\return Pointer to the interface of the camera if successful,
otherwise 0. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
f32 jumpSpeed = 0.f, bool invertMouse=false) = 0;
f32 jumpSpeed = 0.f, bool invertMouse=false,
bool makeActive=true) = 0;
//! Adds a dynamic light scene node to the scene graph.
/** The light will cast dynamic light on all
......
......@@ -662,13 +662,15 @@ IMeshSceneNode* CSceneManager::addOctTreeSceneNode(IMesh* mesh, ISceneNode* pare
//! the camera will move too.
//! \return Returns pointer to interface to camera
ICameraSceneNode* CSceneManager::addCameraSceneNode(ISceneNode* parent,
const core::vector3df& position, const core::vector3df& lookat, s32 id)
const core::vector3df& position, const core::vector3df& lookat, s32 id,
bool makeActive)
{
if (!parent)
parent = this;
ICameraSceneNode* node = new CCameraSceneNode(parent, this, id, position, lookat);
if (makeActive)
setActiveCamera(node);
node->drop();
......@@ -680,10 +682,11 @@ ICameraSceneNode* CSceneManager::addCameraSceneNode(ISceneNode* parent,
//! to in the 3D Software Maya by Alias Wavefront.
//! The returned pointer must not be dropped.
ICameraSceneNode* CSceneManager::addCameraSceneNodeMaya(ISceneNode* parent,
f32 rotateSpeed, f32 zoomSpeed, f32 translationSpeed, s32 id)
f32 rotateSpeed, f32 zoomSpeed, f32 translationSpeed, s32 id,
bool makeActive)
{
ICameraSceneNode* node = addCameraSceneNode(parent, core::vector3df(),
core::vector3df(0,0,100), id);
core::vector3df(0,0,100), id, makeActive);
if (node)
{
ISceneNodeAnimator* anm = new CSceneNodeAnimatorCameraMaya(CursorControl,
......@@ -700,11 +703,12 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeMaya(ISceneNode* parent,
//! Adds a camera scene node which is able to be controlled with the mouse and keys
//! like in most first person shooters (FPS):
ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
f32 rotateSpeed, f32 moveSpeed, s32 id,
SKeyMap* keyMapArray, s32 keyMapSize, bool noVerticalMovement, f32 jumpSpeed, bool invertMouseY)
f32 rotateSpeed, f32 moveSpeed, s32 id, SKeyMap* keyMapArray,
s32 keyMapSize, bool noVerticalMovement, f32 jumpSpeed,
bool invertMouseY, bool makeActive)
{
ICameraSceneNode* node = addCameraSceneNode(parent, core::vector3df(),
core::vector3df(0,0,100), id);
core::vector3df(0,0,100), id, makeActive);
if (node)
{
ISceneNodeAnimator* anm = new CSceneNodeAnimatorCameraFPS(CursorControl,
......
......@@ -133,20 +133,24 @@ namespace scene
//! \return Pointer to interface to camera
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1);
const core::vector3df& lookat = core::vector3df(0,0,100),
s32 id=-1, bool makeActive=true);
//! Adds a camera scene node which is able to be controlle with the mouse similar
//! like in the 3D Software Maya by Alias Wavefront.
//! The returned pointer must not be dropped.
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f, f32 translationSpeed = 1500.0f, s32 id=-1);
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
f32 translationSpeed = 1500.0f, s32 id=-1,
bool makeActive=true);
//! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS):
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
f32 jumpSpeed = 0.f, bool invertMouseY=false);
SKeyMap* keyMapArray=0, s32 keyMapSize=0,
bool noVerticalMovement=false, f32 jumpSpeed = 0.f,
bool invertMouseY=false, bool makeActive=true);
//! Adds a dynamic light scene node. The light will cast dynamic light on all
//! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment