Simple question regarding an array of camera objects

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Simple question regarding an array of camera objects

Post by WhytWulf »

Here is my problem.
I'm trying to create an array of cameras..This is what I am trying, but I'm missing something.. and I hate pointers, and hate pointers to an object more, and pointers to an array of objects the worst...

Code: Select all

scene::ISceneManager* sm = device->getSceneManager();
scene::ICameraSceneNode* camera[5] = sm->getActiveCamera();
what is wrong with it??

I know that in all my boks I can do this

Code: Select all

Class *obj=new Class[5];
From what I understand

scene::ICameraSceneNode* camera = sm->getActiveCamera();

The above will create 1 object with the address of the camear??? (I think)
Project Admin -
http://shadowrunonline.sourceforge.net

------------------------------------
There are 10 kinds of people, those that understand binary and those that don't.
hearsedriver
Posts: 81
Joined: Fri Aug 22, 2003 12:06 pm
Location: Germany
Contact:

Post by hearsedriver »

Nope, getActiveCamera simply returns the currently active camera, as the name suggests. sm->createCameraSceneNode() creates a camera. To create an array of 5 cameras, use something like this:

Code: Select all

ICameraSceneNode* ArrayOfPointersToCameraSceneNodes[ 5 ];
for( int i = 0; i < 5; ++i )
{
    ArrayOfPointersToCameraSceneNodes[ i ] = sm->createCameraSceneNode();
}
But I'd prefer using a std::vector.

Cheers.
matthias gall, lead programmer at sechsta sinn - email matthias@sechsta-sinn.de
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post by WhytWulf »

Thanks.. I didn't think about dumping it in a for loop :)

But now I think about it, using the STL might be just as useful. too :)
Project Admin -
http://shadowrunonline.sourceforge.net

------------------------------------
There are 10 kinds of people, those that understand binary and those that don't.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Or, if you want STL functionality but stay more Irrlicht data object/collection pure. There is the array.

Code: Select all

irr::core::array<MyPointerType*> ObjectList;
[/code
Crud, how do I do this again?
dr34mr
Posts: 10
Joined: Fri Apr 21, 2006 5:19 pm
Location: poland
Contact:

Re: Simple question regarding an array of camera objects

Post by dr34mr »

WhytWulf wrote:I hate pointers, and hate pointers to an object more, and pointers to an array of objects the worst...
well, whytwulf, think about pointer to an array of pointers to objects or an array of pointers to arrays of pointers to objects or even a pointer to an array of pointers to arrays of pointers to objects :lol:
i don't have a drinking problem.
i drink.
i get drunk.
i pass out.
no problem.
Post Reply