VedaLib3DEngine/Object3DVirtual.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_Object3DVirtual_H
00006 #define COM_M4NKIND_Object3DVirtual_H
00007 
00008 #include "BaseObject.h"
00009 #include "VirtualMachine.h"
00010 #include "PackULong_Flags.h"
00011 #include "PackObjectReference.h"
00012 #include "PackStruct.h"
00013 #include "PackList.h"
00014 #include "PackDynamicFloat.h"
00015 /*!
00016     \class  Object3DVirtual
00017     \ingroup BaseObjectInherited_VedaLib3DEngine
00018     \brief   Virtual Class defining a generic renderable Object3D, 
00019             it can be a polygon mesh, or even a whole scene.
00020             RenderObject() handles the rendering. for some classes,
00021             SetColor() can be used to define a general color for the object,
00022             before a call to RenderObject().
00023 */
00024 
00025 class Object3DVirtual : public BaseObject
00026 {
00027 /*==================================================================
00028                                 PUBLIC
00029 ==================================================================*/
00030 public:
00031     /*!
00032         \brief  Constructor. There should only be members initialisation there.
00033     */
00034     Object3DVirtual(void);
00035 
00036     /*!
00037         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00038     */
00039     BASEOBJECT_DEFINE_VIRTUALCLASS(Object3DVirtual);
00040 
00041     /*!
00042         \brief  Change a main color to render the object.
00043                 An object cn use it or not according to the class.
00044         \param  _rgba red green blue , float table. alpha may be used for transparency.
00045     */
00046     //old virtual void  SetColor( const float _rgba[4] );
00047     /*!
00048         \brief   Nested class that describes
00049                 a list of ShapeModifier to apply to a 3D object to 
00050                 modify its shape.
00051     */
00052     class ShapeModifierList : public PackList
00053     {
00054     public:
00055         //! \brief constructor . It registers the members.
00056         ShapeModifierList(void);
00057         /*!
00058             \brief  Apply the Modifier from mSer_ModifierList To a VertexList.
00059             \param  _pFirstVertex   pointer to the first.
00060             \param  _NumberOfVertex number of vertex in the table.
00061             \param  _date In Seconds.
00062         */
00063         void    ModifyVertexList(VirtualMachine::InternalVertex *_pFirstVertex,const unsigned int _NumberOfVertex,float _date);
00064     };
00065     /*!
00066         \brief  Process a real time computing and drawing. Can be extended.
00067         \param  _frameDate a date, in second, which defines the effect cinematic.
00068         \param  _pViewPort description of the viewport where to render.
00069         \param  _rgba red green blue alpha component.
00070         \param  _shapeIndex optional index for multiple shape objects. def to zero.
00071         \param _pModifierList optional ShapeModifierList pointer, to modify objects.
00072     */
00073     virtual void    RenderObject( double _frameDate, 
00074                                     VirtualMachine::InternalViewPort *_pViewPort,
00075                                     const float _rgba[4],
00076                                     unsigned int _shapeIndex=0,
00077                                     ShapeModifierList *_pModifierList=0L )=0;
00078 #ifdef _ENGINE_EDITABLE_
00079     /*!
00080         \brief  a GUI could need to play, draw, print, or output from any way, a preview of a 
00081                 created object. This is done with this method. sub classes can implement it (or not) in
00082                 any way, to explicit current shape of an object.<br>
00083 
00084         \param  _frameDate a date, in second, which defines the effect cinematic.
00085         \param  _pPreviewViewPort the viewport to render. Can't be 0L.
00086         \param  _pPreviewConfiguration
00087     */
00088     virtual void ProcessPreview(double _frameDate,VirtualMachine::InternalViewPort *_pPreviewViewPort,const PreviewConfiguration *_pPreviewConfiguration);
00089 #endif
00090     /*!
00091         \brief   Nested class that describes a vertex shape modifier
00092         , used as element in the list.
00093     */
00094     class ShapeModifier : public PackStruct
00095     {
00096     public:
00097         //! \brief constructor . It registers the members.
00098         ShapeModifier(void);
00099         //! identify the channel to modify
00100         PackObjectReference mSer_ModifierReference;
00101         //! give  a static or dynamic value:
00102         PackDynamicFloat    mSer_Value;
00103     };
00104     /*!
00105         \brief  static method passed to the list to create new elements.
00106         \return a new PartToPlay object.
00107     */
00108     static BaseType *NewShapeModifier();
00109 
00110 /*==================================================================
00111                                 PROTECTED
00112 ==================================================================*/
00113 protected:
00114     //! current general color.
00115     //float m_rgba[4];
00116     //! bool true if m_rgba used.
00117     //bool  m_RGBAUsed;
00118 #ifdef _ENGINE_EDITABLE_
00119     /*!
00120         \brief  Preview Tool: Create a preview line 3D Object.
00121         \param  _ppVertexAndPolygonBufferOut object to create.
00122         \param  _nbPoint number of point in the line. minimum=2.
00123     */
00124     void ProcessPreview_CreateLine(VirtualMachine::InternalObject3DBuffer **_ppVertexAndPolygonBufferOut, unsigned int _nbPoint=2);
00125 #endif  
00126 #ifdef _ENGINE_EDITABLE_
00127     /*!
00128         \brief  Preview Tool: draw a grid 10x10 axis grid in the viewport's matrix state.
00129         \param  _pPreviewViewPort where to draw.
00130     */
00131     void ProcessPreview_DrawGrid(VirtualMachine::InternalViewPort *_pPreviewViewPort );
00132 #endif
00133 };
00134 
00135 #endif

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