Jump to content
moechofe

Question about camera

Recommended Posts

While trying to getting a camera present in a Map from the C++ side, I found there is 2 cameras (according to world->cameras.size().

  1. What is the second camera ?
  2. How leadweaks choose the camera to render the scene ?

Share this post


Link to post

As I recall the C++ default template creates a camera in code. Then if you put a camera in your scene via the editor you'd have 2 cameras.

Share this post


Link to post

As I recall the C++ default template creates a camera in code.

I have removed the camera from the default C++ template.

 

Also every lightsource is a camera

I confirm this.

 

So, how leadwerk manage to find the good one?

Changing extern Camera* ActiveCamera; don't seem to work for me.

Share this post


Link to post

I use

   std::list<Camera*>::const_iterator camIter = world->cameras.begin();
   while(camIter != world->cameras.end() ){
       if ( (*camIter)->GetClassName() == "Camera" ){
           camera=(*camIter);
       }
       camIter++;
   }
   if ( camera == NULL ) { // if the map did not provide a camera we create our own
       camera = Camera::Create();
       camera->Move(0,2,-5);
   }

 

In place of the create camera code in App.cpp ( after loading the map ).

 

That last camera seems to be the one used, how ever there is no guarantee for this.

Share this post


Link to post

I always add my camera to the scene and then I personally just look at the name field myself as I control that.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...