Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualL. Spiro

Posted 27 January 2013 - 05:33 PM

What members/methods do Camera and Model share? o_O

Orientation (rotation, scale, and position) and a child/parenting system.
I am not the original poster, but he mentioned the orientation part as well, and he is 100% correct.
If you have one, the same child/parenting system would also be shared by these 2 objects.


Here is one common implementation:
CEntity

  • Has a COrientation

CActor : public CEntity

  • Has a list of children and a single parent, all of type CActor *.

C3dModelInstance : public CActor
CCamera : public CActor

 

CEntity and CActor can be merged into one class (often done) as well.

 

I see a lot of people making camera classes where the position and rotation are directly part of the camera class itself.

As if the camera class exists in the game world magically different from the way everything else exists in the game world.  This is a mistake and the topic poster is 100% correct as far as the high-level view of his design in this part is concerned.  With proper design, the models and cameras should share the same low-level features as every single other object in the scene (except certain types of particles).

 

 

L. Spiro


#1L. Spiro

Posted 27 January 2013 - 05:31 PM

What members/methods do Camera and Model share? o_O

Orientation (rotation, scale, and position) and a child/parenting system.
I am not the original poster, but he mentioned the orientation part as well, and he is 100% correct.
If you have one, the same child/parenting system would also be shared by these 2 objects.


Here is one common implementation:
CEntity

  • Has a COrientation

CActor : public CEntity

  • Has a list of children and a single parent, all of type CActor.

C3dModelInstance : public CActor
CCamera : public CActor

 

CEntity and CActor can be merged into one class (often done) as well.

 

I see a lot of people making camera classes where the position and rotation are directly part of the camera class itself.

As if the camera class exists in the game world magically different from the way everything else exists in the game world.  This is a mistake and the topic poster is 100% correct as far as the high-level view of his design in this part is concerned.  With proper design, the models and cameras should share the same low-level features as every single other object in the scene (except certain types of particles).

 

 

L. Spiro


PARTNERS