# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

shape.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_SHAPE_H
00027 #define NL_SHAPE_H
00028 
00029 
00030 #include "nel/misc/types_nl.h"
00031 #include "nel/misc/smart_ptr.h"
00032 #include "nel/misc/matrix.h"
00033 #include "nel/misc/stream.h"
00034 #include "nel/misc/aabbox.h"
00035 
00036 
00037 namespace NL3D 
00038 {
00039 
00040 
00041 using NLMISC::CPlane;
00042 using NLMISC::CMatrix;
00043 
00044 
00045 class   CTransformShape;
00046 class   IDriver;
00047 class   CScene;
00048 
00049 // ***************************************************************************
00069 class IShape : public NLMISC::CRefCount, public NLMISC::IStreamable
00070 {
00071 public:
00072 
00074         IShape();
00076         virtual ~IShape() {}
00077 
00083         virtual CTransformShape         *createInstance(CScene &scene);
00084 
00091         virtual bool                            clip(const std::vector<CPlane>  &pyramid, const CMatrix &worldMatrix) {return true;}
00092 
00097         virtual void                            render(IDriver *drv, CTransformShape *trans, bool opaquePass)=0;
00098 
00101         virtual void                            flushTextures (IDriver &driver)=0;
00102 
00105         virtual void                            getAABBox(NLMISC::CAABBox &bbox) const;
00106 
00110         float                                           getDistMax() const {return _DistMax;}
00111 
00115         void                                            setDistMax(float distMax);
00116 
00117 
00119         // @{
00120 
00124         virtual float                           getNumTriangles (float distance)=0;
00125 
00126         // @}
00127 
00128 
00130         // @{
00131 
00134         virtual bool                            useLightingLocalAttenuation () const {return false;}
00135 
00136         // @}
00137 
00138 protected:
00139 
00141         float                   _DistMax;
00142 
00143 };
00144 
00145 // ***************************************************************************
00154 class CShapeStream
00155 {
00156 public:
00158         CShapeStream ();
00159 
00163         CShapeStream (IShape* shape);
00164 
00168         void                                            setShapePointer (IShape* shape);
00169 
00173         IShape*                                         getShapePointer () const;
00174 
00176         virtual void                            serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00177 private:
00178         IShape*                 _Shape;
00179 };
00180 
00181 } // NL3D
00182 
00183 
00184 #endif // NL_SHAPE_H
00185 
00186 /* End of shape.h */