From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/instance__material__user_8h-source.html | 408 +++++++++++++++++++++ 1 file changed, 408 insertions(+) create mode 100644 docs/doxygen/nel/instance__material__user_8h-source.html (limited to 'docs/doxygen/nel/instance__material__user_8h-source.html') diff --git a/docs/doxygen/nel/instance__material__user_8h-source.html b/docs/doxygen/nel/instance__material__user_8h-source.html new file mode 100644 index 00000000..4b7b95cd --- /dev/null +++ b/docs/doxygen/nel/instance__material__user_8h-source.html @@ -0,0 +1,408 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

instance_material_user.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2001 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_INSTANCE_MATERIAL_USER_H
+00027 #define NL_INSTANCE_MATERIAL_USER_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/3d/u_instance_material.h"
+00031 #include "3d/material.h"
+00032 #include "3d/texture_file.h"
+00033 #include "3d/texture_multi_file.h"
+00034 
+00035 #define NL3D_MEM_MATERIAL_INSTANCE                                              NL_ALLOC_CONTEXT( 3dMatI )
+00036 
+00037 namespace NL3D
+00038 {
+00039 
+00040 
+00041 class CMeshBaseInstance;
+00042 class CInstanceUser;
+00043 class CAsyncTextureBlock;
+00044 
+00045 
+00046 // ***************************************************************************
+00053 class CInstanceMaterialUser : public UInstanceMaterial
+00054 {
+00055 public:
+00057         CInstanceMaterialUser(CMeshBaseInstance *mbi, CMaterial *mat, CAsyncTextureBlock *asyncTextBlock)
+00058         {
+00059                 NL3D_MEM_MATERIAL_INSTANCE
+00060                 nlassert(mat && mbi && asyncTextBlock);
+00061                 _MBI= mbi;
+00062                 _Material= mat;
+00063                 _AsyncTextureBlock= asyncTextBlock;
+00064         }
+00066         virtual ~CInstanceMaterialUser()
+00067         {
+00068                 NL3D_MEM_MATERIAL_INSTANCE
+00069         }
+00070 
+00071 
+00072 
+00074         // @{
+00075         virtual bool                            isLighted() const 
+00076         {
+00077                 NL3D_MEM_MATERIAL_INSTANCE
+00078                 return _Material->isLighted();
+00079         }
+00080         virtual bool                            isUserColor() const 
+00081         {
+00082                 NL3D_MEM_MATERIAL_INSTANCE
+00083                 return _Material->getShader()==CMaterial::UserColor;
+00084         }
+00085         // @}
+00086 
+00087 
+00089         // @{
+00090 
+00091         virtual void                            setEmissive( CRGBA emissive=CRGBA(0,0,0) )
+00092         {
+00093                 NL3D_MEM_MATERIAL_INSTANCE
+00094                 _Material->setEmissive(emissive);
+00095         }
+00096         virtual void                            setAmbient( CRGBA ambient=CRGBA(0,0,0) )
+00097         {
+00098                 NL3D_MEM_MATERIAL_INSTANCE
+00099                 _Material->setAmbient( ambient);
+00100         }
+00101         virtual void                            setDiffuse( CRGBA diffuse=CRGBA(0,0,0) )
+00102         {
+00103                 NL3D_MEM_MATERIAL_INSTANCE
+00104                 _Material->setDiffuse( diffuse);
+00105         }
+00106         virtual void                            setOpacity( uint8       opa )
+00107         {
+00108                 NL3D_MEM_MATERIAL_INSTANCE
+00109                 _Material->setOpacity( opa );
+00110         }
+00111         virtual void                            setSpecular( CRGBA specular=CRGBA(0,0,0) )
+00112         {
+00113                 NL3D_MEM_MATERIAL_INSTANCE
+00114                 _Material->setSpecular( specular);
+00115         }
+00116         virtual void                            setShininess( float shininess )
+00117         {
+00118                 NL3D_MEM_MATERIAL_INSTANCE
+00119                 _Material->setShininess( shininess );
+00120         }
+00121 
+00122         virtual CRGBA                           getEmissive() const 
+00123         {
+00124                 NL3D_MEM_MATERIAL_INSTANCE
+00125                 return _Material->getEmissive();
+00126         }
+00127         virtual CRGBA                           getAmbient() const 
+00128         {
+00129                 NL3D_MEM_MATERIAL_INSTANCE
+00130                 return _Material->getAmbient();
+00131         }
+00132         virtual CRGBA                           getDiffuse() const 
+00133         {
+00134                 NL3D_MEM_MATERIAL_INSTANCE
+00135                 return _Material->getDiffuse();
+00136         }
+00137         virtual uint8                           getOpacity() const 
+00138         {
+00139                 NL3D_MEM_MATERIAL_INSTANCE
+00140                 return _Material->getOpacity();
+00141         }
+00142         virtual CRGBA                           getSpecular() const 
+00143         {
+00144                 NL3D_MEM_MATERIAL_INSTANCE
+00145                 return _Material->getSpecular();
+00146         }
+00147         virtual float                           getShininess() const 
+00148         {
+00149                 NL3D_MEM_MATERIAL_INSTANCE
+00150                 return _Material->getShininess();
+00151         }
+00152 
+00153         // @}
+00154 
+00155 
+00157         // @{
+00158         virtual void                            setColor(CRGBA rgba) 
+00159         {
+00160                 NL3D_MEM_MATERIAL_INSTANCE
+00161                 _Material->setColor(rgba) ;
+00162         }
+00163         virtual CRGBA                           getColor(void) const 
+00164         {
+00165                 NL3D_MEM_MATERIAL_INSTANCE
+00166                 return _Material->getColor();
+00167         }
+00168         // @}
+00169 
+00170 
+00172         // @{
+00173         virtual void                            setUserColor(CRGBA userColor)
+00174         {
+00175                 NL3D_MEM_MATERIAL_INSTANCE
+00176                 if(isUserColor())
+00177                         _Material->setUserColor(userColor);
+00178         }
+00179         virtual CRGBA                           getUserColor() const 
+00180         {
+00181                 NL3D_MEM_MATERIAL_INSTANCE
+00182                 if(isUserColor())
+00183                         return _Material->getUserColor();
+00184                 else
+00185                         return CRGBA(0,0,0,0);
+00186         }
+00187         // @}
+00188 
+00190         // @{
+00191         virtual void                            setConstantColor(uint stage, NLMISC::CRGBA color)
+00192         {
+00193                 NL3D_MEM_MATERIAL_INSTANCE
+00194                 if (stage >= IDRV_MAT_MAXTEXTURES)
+00195                 {
+00196                         nlwarning("UInstanceMaterialUser::setConstantColor : invalid stage");
+00197                         return;
+00198                 }
+00199                 _Material->texConstantColor(stage, color);
+00200         }
+00201         virtual NLMISC::CRGBA           getConstantColor(uint stage) const
+00202         {
+00203                 NL3D_MEM_MATERIAL_INSTANCE
+00204                 if (stage >= IDRV_MAT_MAXTEXTURES)
+00205                 {
+00206                         nlwarning("UInstanceMaterialUser::getConstantColor : invalid stage");
+00207                         return NLMISC::CRGBA::Black;
+00208                 }
+00209                 return _Material->getTexConstantColor(stage);
+00210 
+00211         }
+00212         // @}
+00213 
+00215         // @{   
+00216         virtual bool                            isTextureFile(uint stage = 0) const;
+00217         virtual std::string getTextureFileName(uint stage = 0) const;
+00218         virtual void                            setTextureFileName(const std::string &fileName, uint stage = 0);
+00219         // @}
+00220 
+00221         virtual void                            emptyTexture(uint stage = 0);
+00222 
+00223 
+00224         virtual sint                            getLastTextureStage() const
+00225         {
+00226                 NL3D_MEM_MATERIAL_INSTANCE
+00227                 sint lastStage = -1;
+00228                 for(uint k = 0; k < IDRV_MAT_MAXTEXTURES; ++k)
+00229                 {
+00230                         if (_Material->getTexture(k) != NULL)
+00231                         {
+00232                                 lastStage = k;
+00233                         }
+00234                 }
+00235                 return lastStage;
+00236         }
+00237 
+00239         // @{
+00240         virtual void                    setBlend(bool active) 
+00241         {
+00242                 NL3D_MEM_MATERIAL_INSTANCE
+00243                 _Material->setBlend(active);
+00244         }
+00245         virtual void                    setBlendFunc(TBlend src, TBlend dst) 
+00246         {
+00247                 NL3D_MEM_MATERIAL_INSTANCE
+00248                 _Material->setBlendFunc((CMaterial::TBlend)(uint32)src, (CMaterial::TBlend)(uint32)dst);
+00249         }
+00250         virtual void                    setSrcBlend(TBlend val) 
+00251         {
+00252                 NL3D_MEM_MATERIAL_INSTANCE
+00253                 _Material->setSrcBlend((CMaterial::TBlend)(uint32)val);
+00254         }
+00255         virtual void                    setDstBlend(TBlend val) 
+00256         {
+00257                 NL3D_MEM_MATERIAL_INSTANCE
+00258                 _Material->setDstBlend((CMaterial::TBlend)(uint32)val);
+00259         }
+00260 
+00261         virtual bool                    getBlend() const 
+00262         {
+00263                 NL3D_MEM_MATERIAL_INSTANCE
+00264                 return _Material->getBlend();
+00265         }
+00266         virtual TBlend                  getSrcBlend(void)  const 
+00267         {
+00268                 NL3D_MEM_MATERIAL_INSTANCE
+00269                 return (UInstanceMaterial::TBlend)(uint32)_Material->getSrcBlend();
+00270         }
+00271         virtual TBlend                  getDstBlend(void)  const 
+00272         {
+00273                 NL3D_MEM_MATERIAL_INSTANCE
+00274                 return (UInstanceMaterial::TBlend)(uint32)_Material->getDstBlend();
+00275         }
+00276         // @}
+00277 
+00278 
+00279 
+00281         // @{
+00282         virtual void                    enableUserTexMat(uint stage, bool enabled = true)
+00283         {
+00284                 NL3D_MEM_MATERIAL_INSTANCE
+00285                 if (stage >= IDRV_MAT_MAXTEXTURES)
+00286                 {
+00287                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
+00288                         return;
+00289                 }
+00290                 _Material->enableUserTexMat(stage, enabled);
+00291         }
+00292         virtual bool                    isUserTexMatEnabled(uint stage) const
+00293         {
+00294                 NL3D_MEM_MATERIAL_INSTANCE
+00295                 if (stage >= IDRV_MAT_MAXTEXTURES)
+00296                 {
+00297                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
+00298                         return false;
+00299                 }
+00300                 return _Material->isUserTexMatEnabled(stage);
+00301         }
+00302         virtual void                                    setUserTexMat(uint stage, const NLMISC::CMatrix &m)
+00303         {
+00304                 NL3D_MEM_MATERIAL_INSTANCE
+00305                 if (stage >= IDRV_MAT_MAXTEXTURES)
+00306                 {
+00307                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
+00308                         return;
+00309                 }
+00310                 if (!_Material->isUserTexMatEnabled(stage))
+00311                 {
+00312                         nlwarning("UInstanceMaterial::setUserTexMat : texture stage %d has no user matrix.", stage);
+00313                 }
+00314                 _Material->setUserTexMat(stage, m);
+00315         }
+00316         virtual const NLMISC::CMatrix  &getUserTexMat(uint stage) const
+00317         {
+00318                 NL3D_MEM_MATERIAL_INSTANCE
+00319                 if (stage >= IDRV_MAT_MAXTEXTURES)
+00320                 {
+00321                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
+00322                         return CMatrix::Identity;
+00323                 }
+00324                 if (!_Material->isUserTexMatEnabled(stage))
+00325                 {
+00326                         nlwarning("UInstanceMaterial::setUserTexMat : texture stage %d has no user matrix.", stage);
+00327                         return CMatrix::Identity;
+00328                 }
+00329                 return _Material->getUserTexMat(stage);
+00330         }
+00331         // @}
+00332 
+00333 private:
+00334         CMeshBaseInstance       *_MBI;
+00335         CMaterial                       *_Material;
+00336         CAsyncTextureBlock      *_AsyncTextureBlock;
+00337 
+00338 public:
+00339 
+00340         // Internal Use only.
+00341         CMaterial       *getMaterial() const 
+00342         {
+00343                 NL3D_MEM_MATERIAL_INSTANCE
+00344                 return _Material;
+00345         }
+00346 
+00347 };
+00348 
+00349 
+00350 } // NL3D
+00351 
+00352 
+00353 #endif // NL_INSTANCE_MATERIAL_USER_H
+00354 
+00355 /* End of instance_material_user.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1