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_Object3DLWOResource_H 00006 #define COM_M4NKIND_Object3DLWOResource_H 00007 #include "Object3DMeshVirtual.h" 00008 //#include "Object3DMeshVirtual.h" 00009 #include "PackResource.h" 00010 #include "lwo2reader.h" 00011 #include "PackList.h" 00012 00013 class Texture3D; 00014 //#include "PackFloatByte_Limits.h" 00015 00016 //#include "PackTreeCell.h" 00017 /*! 00018 \class Object3DLWOResource 00019 \ingroup BaseObjectInherited_VedaLib3DEngine 00020 \brief Define an object with a Lightwave File resource. 00021 Lightwave is a commercial 3D Modeler from NewTek. 00022 We support .lwo object files with this class. 00023 */ 00024 00025 class Object3DLWOResource : public Object3DMeshVirtual 00026 { 00027 /*================================================================== 00028 PUBLIC 00029 ==================================================================*/ 00030 public: 00031 /*! 00032 \brief Constructor. There should only be members initialisation there. 00033 */ 00034 Object3DLWOResource(void); 00035 00036 /*! 00037 \brief Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp 00038 */ 00039 BASEOBJECT_DEFINE_CLASS(Object3DLWOResource); 00040 #ifdef _ENGINE_EDITABLE_ 00041 /*! 00042 \brief a GUI could need to play, draw, print, or output from any way, a preview of a 00043 created object. This is done with this method. sub classes can implement it (or not) in 00044 any way, to explicit current shape of an object.<br> 00045 Extended to draw. 00046 \param _frameDate a date, in second, which defines the effect cinematic. 00047 \param _pPreviewViewPort the viewport to render. Can't be 0L. 00048 \param _pPreviewConfiguration 00049 */ 00050 virtual void ProcessPreview(double _frameDate,VirtualMachine::InternalViewPort *_pPreviewViewPort,const PreviewConfiguration *_pPreviewConfiguration); 00051 #endif 00052 /*! 00053 \brief Process a real time computing and drawing. Can be extended. 00054 \param _frameDate a date, in second, which defines the effect cinematic. 00055 \param _pViewPort description of the viewport where to render. 00056 \param _rgba red green blue alpha component. 00057 \param _shapeIndex optional index for multiple shape objects. def to zero. 00058 \param _pModifierList optional ShapeModifierList pointer, to modify objects. 00059 */ 00060 virtual void RenderObject( double _frameDate, 00061 VirtualMachine::InternalViewPort *_pViewPort, 00062 const float _rgba[4], 00063 unsigned int _shapeIndex=0, 00064 ShapeModifierList *_pModifierList=0L ); 00065 00066 /*================================================================== 00067 PROTECTED 00068 ==================================================================*/ 00069 protected: 00070 // the file describing one or more objects 00071 PackResource mSer_LWOFile; 00072 // remap the lightwave textures to context texture object: 00073 PackList mSer_TextureReferenceList; 00074 // the LWO reader engine: 00075 sLwoObject m_Lwo; 00076 //! \brief private nested struct used to index surface by texture at our level. 00077 typedef struct { 00078 //! object took in mSer_TextureReferenceList during CreateInternal() 00079 Texture3D *m_pTexture; 00080 //! First 0-based triangle index in the layer triangle list. 00081 unsigned int m_FirstTriangleIndex; 00082 //! number of triangle for this texture/layer set after m_FirstTriangleIndex. 00083 unsigned int m_NumberOfTriangle; 00084 } sSortedTriangleSurface; 00085 00086 //!\class LayerObject 00087 //!\brief private use. 00088 class LayerObject { public: 00089 //! the hardwareAbstracted vertex buffer for this object: 00090 VirtualMachine::InternalObject3DBuffer *m_pObject3DBuffer; 00091 //! each layer have 1 or more texture used. 00092 unsigned int m_NumberOfTextureLayer; 00093 //! base of texture layer, with triangle offset on the triangle list: 00094 sSortedTriangleSurface *m_pSurfaceSortedTriangleListIndex; 00095 }; 00096 //! 00097 unsigned int m_NbLayer; 00098 //! 00099 LayerObject *m_pLayerObjects; 00100 00101 /*! 00102 \brief Method that really build the object using the serializable parameters. 00103 Close() should close everything opened by CreateInternal(). 00104 */ 00105 virtual bool CreateInternal(void); 00106 #ifdef _ENGINE_EDITABLE_ 00107 /*! 00108 \brief that closes everything. Still, the object exist and can be rebuild the same using Create() 00109 */ 00110 virtual void CloseInternal(void); 00111 #endif 00112 /*! 00113 \brief static method passed to the list to create new elements. 00114 \return a new object. 00115 */ 00116 static BaseType *NewTextureReference(); 00117 /*! 00118 \brief update the shape of the object for this date, during 00119 the lifetime the object, when it is created. 00120 by defdault, does nothing, so static object can be created 00121 with CreateInternal() only. 00122 \param _newShapeTime the new date. 00123 \param _shapeIndex the index of the shape to modify. 00124 */ 00125 virtual void CreateShape(float _newShapeTime, unsigned int _shapeIndex=0); 00126 00127 }; 00128 00129 #endif
/\/\ 4 N k ! N D _______ _ __ ___ _____ ___ _ _ ____ ___________ __//___ /________ |/ / ___________\_______/ \ / _ _ \/ _ / _ / _/_/____/ _ __ / / / / / / / \ \/ / / \ \ / \\___/___/___/ ¯ _____/_____/ ______\___/_____/\________\\ \________/_ ___ __ l____\ /elD! http://www.m4nkind.com \____/