# 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  

meshvp_per_pixel_light.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000-2002 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_MESHVP_PER_PIXEL_LIGHT_H
00027 #define NL_MESHVP_PER_PIXEL_LIGHT_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "3d/mesh_vertex_program.h"
00031 #include "3d/vertex_program.h"
00032 
00033 
00034 #include <memory>
00035 
00036 
00037 namespace NL3D {
00038 
00039 
00058 class CMeshVPPerPixelLight : public IMeshVertexProgram
00059 {
00060 public:
00062         bool            SpecularLighting;
00063 public:
00064         CMeshVPPerPixelLight() : SpecularLighting(true), _Enabled(false) {}     
00066         // @{   
00067                 virtual void    initInstance(CMeshBaseInstance *mbi);
00068                 virtual bool    begin(IDriver *drv,
00069                                                           CScene *scene,
00070                                                           CMeshBaseInstance *mbi,
00071                                                           const NLMISC::CMatrix &invertedModelMat,
00072                                                           const NLMISC::CVector &viewerPos);                    
00073                 virtual void    end(IDriver *drv);                              
00074                 virtual void    serial(NLMISC::IStream &f) throw(NLMISC::EStream);                              
00075                 virtual void    setupForMaterial(const CMaterial &mat,
00076                                                                                  IDriver *drv,
00077                                                                                  CScene *scene,
00078                                                                                  CVertexBuffer *vb
00079                                                                                 );
00080                 virtual void    setupForMaterial(const CMaterial &mat,
00081                                                                          IDriver *drv,
00082                                                                          CScene *scene,
00083                                                                          IVertexBufferHard *vb);
00084                 virtual bool    needTangentSpace() const { return true; }
00085                 NLMISC_DECLARE_CLASS(CMeshVPPerPixelLight);
00086         // @}                   
00087 private:
00088         // enable / disable this v.p
00089         void    enable(bool enabled, IDriver *drv);
00090 private:        
00091         // this setup the material, and returns true if the v.p has been enabled / disabled
00092         virtual bool    setupForMaterial(const CMaterial &mat,
00093                                                                          IDriver *drv,
00094                                                                          CScene *scene
00095                                                                         );
00096         bool    _Enabled;       
00097         bool    _IsPointLight;
00098         //
00099         enum { NumVp = 8};      
00100         static  std::auto_ptr<CVertexProgram>   _VertexProgram[NumVp];
00101 };
00102 
00103 } // NL3D
00104 
00105 
00106 #endif // NL_MESHVP_PER_PIXEL_LIGHT_H
00107 
00108 /* End of meshvp_per_pixel_light.h */