VedaLib3DEngine/Object3DScene.h

Go to the documentation of this file.
00001 /*! \file 
00002     \author victorien ferry & www.m4nkind.com
00003     \brief This file applies the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 , read file COPYING.
00004 */
00005 #ifndef COM_M4NKIND_Object3DScene_H
00006 #define COM_M4NKIND_Object3DScene_H
00007 
00008 //#include "VirtualMedia.h"
00009 #include "PackDynamicFloat.h"
00010 #include "PackDynamicFloat.h"
00011 #include "Object3DVirtual.h"
00012 #include "VirtualEquation.h"
00013 #include "PackTreeCell.h"
00014 #include "PackULong_Enums.h"
00015 #include "PackList.h"
00016 #include "PackLong_WithLimits.h"
00017 
00018 /*!
00019     \class  Object3DScene
00020     \ingroup BaseObjectInherited_VedaLib3DEngine
00021     \brief  Base class for all class that stands for a 3D Scene, which means
00022             an ensemble of Object3DVirtual, as a Object3DVirtual. It should look like
00023             an Object list, and some cinematic informations about how they move. 
00024 */
00025 
00026 class Object3DScene : public Object3DVirtual
00027 {
00028 /*==================================================================
00029                                 PUBLIC
00030 ==================================================================*/
00031 public:
00032     /*!
00033         \brief  Constructor. There should only be members initialisation there.
00034     */
00035     Object3DScene(void);
00036 
00037     /*!
00038         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00039     */
00040     BASEOBJECT_DEFINE_CLASS(Object3DScene);
00041     /*!
00042         \brief  Process a real time computing and drawing. Can be extended.
00043         \param  _frameDate a date, in second, which defines the effect cinematic.
00044         \param  _pViewPort description of the viewport where to render.
00045         \param  _rgba red green blue alpha component.
00046         \param  _shapeIndex optional index for multiple shape objects. def to zero.
00047         \param _pModifierList optional ShapeModifierList pointer, to modify objects.
00048     */
00049     virtual void    RenderObject( double _frameDate, 
00050                                     VirtualMachine::InternalViewPort *_pViewPort,
00051                                     const float _rgba[4],
00052                                     unsigned int _shapeIndex=0,
00053                                     ShapeModifierList *_pModifierList=0L );
00054 
00055 #ifdef _ENGINE_EDITABLE_
00056     /*!
00057         \brief  a GUI could need to play, draw, print, or output from any way, a preview of a 
00058                 created object. This is done with this method. sub classes can implement it (or not) in
00059                 any way, to explicit current shape of an object.<br>
00060 
00061         \param  _frameDate a date, in second, which defines the effect cinematic.
00062         \param  _pPreviewViewPort the viewport to render. Can't be 0L.
00063         \param  _pPreviewConfiguration
00064     */
00065     virtual void ProcessPreview(double _frameDate,VirtualMachine::InternalViewPort *_pPreviewViewPort,const PreviewConfiguration *_pPreviewConfiguration);
00066 #endif
00067     /*
00068         \typedef eOb3DChannel
00069         \brief define possible manner a refered object can be positionned,
00070             recolored, shaded in any form when drawn. All channels
00071             use a 1,2,3 or 4-dimensionned floats as parameters.
00072             this is used by nested class Object3DReference.
00073     */
00074     typedef enum {
00075         //! Move the object in the scene space according to its father in the tree hierarchy.
00076         eOb3DChannel_Position=0,
00077         //! Rotate the object in the scene space according to its father in the tree hierarchy.
00078         eOb3DChannel_Rotation,
00079         //! Scale the object in the scene space according to its father in the tree hierarchy.
00080         eOb3DChannel_Scale,
00081         //! change all object's color, including alpha
00082         eOb3DChannel_Color,
00083         //! Transparency
00084         eOb3DChannel_Transparency
00085     } eOb3DChannel ;
00086 
00087     /*!
00088         \brief   Nested class that describes a reference to Object3DVirtual, used as element in the list.
00089     */
00090     class ChannelModifier : public PackStruct
00091     {
00092     public:
00093         //! \brief constructor . It registers the members.
00094         ChannelModifier(void);
00095         //! idenify the channel to modify
00096         PackULong_Enums     mSer_ChannelID;
00097         //! give  a static or dynamic value:
00098         PackDynamicFloat    mSer_Value;
00099     };
00100     /*!
00101         \brief  static method passed to the list to create new elements.
00102         \return a new PartToPlay object.
00103     */
00104     static BaseType *NewChannelModifier();
00105 
00106     /*!
00107         \brief   Nested class that describes a reference to Object3DVirtual, used as element in the list.
00108     */
00109     class Object3DReference : public PackStruct
00110     {
00111     public:
00112         //! \brief constructor . It registers the members.
00113         Object3DReference(void);
00114         //! the reference to an object:
00115         PackObjectReference mSer_Object3DReference;
00116         //! layer on the refered object:
00117         PackULong   mSer_Object3DLayerIndex;
00118         //! 
00119         PackLong_WithLimits mSer_BeginAtNumber;
00120         //! recursion
00121         PackLong_WithLimits mSer_RecursionNumber;
00122         //! list of channels to modify or dynamise:
00123         PackList    mSer_ChannelModifierList;
00124         //! list of channels to modify or dynamise:
00125         ShapeModifierList mSer_ShapeModifierList;
00126     };
00127     /*!
00128         \brief  static method passed to the list to create new elements.
00129         \return a new PartToPlay object.
00130     */
00131     static BaseType *NewObject3DReference();
00132 
00133 /*==================================================================
00134                                 PROTECTED
00135 ==================================================================*/
00136 protected:
00137     //! list of objects in the scenes. According to the type of class, it can be serialized (Scene3D) or created ( Scene3DText )
00138     PackTreeCell        mSer_ObjectTree;
00139     /*!
00140         \brief  Recursive processing of the tree.
00141         \param  _pCell tree cell.
00142         \param  _pVp viewport
00143         \param  _rgba shadable color state.
00144         \param  _frameDate a date, in second, which defines the effect cinematic.
00145     */
00146     void    ProcessObject( PackTreeCell* _pCell,VirtualMachine::InternalViewPort *_pVp
00147                             ,const float _rgba[4]
00148                             ,double _frameDate );
00149 };
00150 
00151 #endif
00152 

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/