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

animated_material.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_ANIMATED_MATERIAL_H
+00027 #define NL_ANIMATED_MATERIAL_H
+00028 
+00029 
+00030 #include "nel/misc/types_nl.h"
+00031 #include "nel/misc/smart_ptr.h"
+00032 #include "3d/animatable.h"
+00033 #include "3d/material.h"
+00034 #include "3d/track.h"
+00035 #include <map>
+00036 
+00037 
+00038 namespace NL3D 
+00039 {
+00040 
+00041 
+00042 
+00043 // ***************************************************************************
+00051 class CMaterialBase : public NLMISC::CRefCount
+00052 {
+00053 public:
+00054 
+00055         CMaterialBase();
+00056 
+00064         void                    copyFromMaterial(CMaterial *pMat);
+00065 
+00066 
+00067         // Name of this material, for Animation access.
+00068         std::string                             Name;
+00069 
+00070 
+00071         // Default tracks.
+00072         CTrackDefaultRGBA               DefaultAmbient;
+00073         CTrackDefaultRGBA               DefaultDiffuse;
+00074         CTrackDefaultRGBA               DefaultSpecular;
+00075         CTrackDefaultFloat              DefaultShininess;
+00076         CTrackDefaultRGBA               DefaultEmissive;
+00077         CTrackDefaultFloat              DefaultOpacity;
+00078         CTrackDefaultInt                DefaultTexture;
+00079         
+00080         // Texture animation
+00081         struct CTexAnimTracks
+00082         {
+00083 
+00084                 CTrackDefaultFloat DefaultUTrans; // u translation
+00085                 CTrackDefaultFloat DefaultVTrans; // v translation
+00086                 CTrackDefaultFloat DefaultUScale; // u scale
+00087                 CTrackDefaultFloat DefaultVScale; // u scale
+00088                 CTrackDefaultFloat DefaultWRot; // v scale
+00089 
+00090 
+00091                 // number of default tracks
+00092                 enum { NumTexAnimatedValues = 5 }; 
+00093                 
+00094 
+00095                 void setDefaultValue() 
+00096                 { 
+00097                         DefaultUTrans.setValue(0);
+00098                         DefaultVTrans.setValue(0);
+00099                         DefaultUScale.setValue(1);
+00100                         DefaultVScale.setValue(1);
+00101                 }
+00102 
+00103                 void                    serial(NLMISC::IStream &f)
+00104                 {
+00105                         (void)f.serialVersion(0);
+00106                         f.serial(DefaultUTrans, DefaultVTrans, DefaultUScale, DefaultVScale);
+00107                 }
+00108         };
+00109         CTexAnimTracks                  DefaultTexAnimTracks[IDRV_MAT_MAXTEXTURES];
+00110 
+00112         void                    serial(NLMISC::IStream &f);
+00113 
+00114 
+00116 
+00122         // @{
+00124         void                    setAnimatedTexture(uint32 id, CSmartPtr<ITexture>  pText);
+00126         bool                    validAnimatedTexture(uint32 id);
+00128         ITexture*               getAnimatedTexture(uint32 id);
+00129 
+00130         // @}
+00131 
+00132 // *********************
+00133 private:
+00134         
+00135         struct  CAnimatedTexture
+00136         {
+00137                 CSmartPtr<ITexture>                     Texture;
+00138 
+00139                 // serial.
+00140                 void    serial(NLMISC::IStream &f);
+00141         };
+00142 
+00143         typedef std::map<uint32, CAnimatedTexture>      TAnimatedTextureMap;
+00144         TAnimatedTextureMap                     _AnimatedTextures;
+00145 
+00146 };
+00147 
+00148 
+00149 
+00150 // ***************************************************************************
+00159 class CAnimatedMaterial : public IAnimatable
+00160 {
+00161 public:
+00162 
+00164         // @{
+00170         CAnimatedMaterial(CMaterialBase *baseMat);
+00171 
+00172 
+00177         void                    setMaterial(CMaterial *pMat);
+00178 
+00181         std::string             getMaterialName() const;
+00182         // @}
+00183 
+00184 
+00190         void                    update();
+00191 
+00192 
+00194         // @{
+00195         static const char *getAmbientValueName() {return "ambient";}
+00196         static const char *getDiffuseValueName() {return "diffuse";}
+00197         static const char *getSpecularValueName() {return "specular";}
+00198         static const char *getShininessValueName() {return "shininess";}
+00199         static const char *getEmissiveValueName() {return "emissive";}
+00200         static const char *getOpacityValueName() {return "opacity";}
+00201         static const char *getTextureValueName() {return "texture";}
+00202         //
+00203         static const char *getTexMatUTransName(uint stage);
+00204         static const char *getTexMatVTransName(uint stage);
+00205         static const char *getTexMatUScaleName(uint stage);
+00206         static const char *getTexMatVScaleName(uint stage);
+00207         static const char *getTexMatWRotName(uint stage);
+00208 
+00209         // @}
+00210 
+00212         enum { NumTexAnimatedValues = CMaterialBase::CTexAnimTracks::NumTexAnimatedValues   };
+00213 
+00215         // @{
+00217         enum    TAnimValues
+00218         {
+00219                 OwnerBit= IAnimatable::AnimValueLast,
+00220                 AmbientValue, 
+00221                 DiffuseValue,
+00222                 SpecularValue,
+00223                 ShininessValue,
+00224                 EmissiveValue,
+00225                 OpacityValue,
+00226                 TextureValue,
+00227                 TextureMatValues,
+00228                 AnimValueLast = TextureMatValues + NumTexAnimatedValues * IDRV_MAT_MAXTEXTURES /* texture matrix anim */
+00229         };
+00230 
+00232         virtual IAnimatedValue* getValue (uint valueId);
+00233 
+00235         virtual const char *getValueName (uint valueId) const;
+00236 
+00238         virtual ITrack* getDefaultTrack (uint valueId);
+00239 
+00241         virtual void    registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
+00242 
+00243         // @}
+00244 
+00245 
+00246 // ********************
+00247 private:
+00248 
+00249         // The material instantiator.
+00250         CRefPtr<CMaterialBase>  _MaterialBase;
+00251         // The material.
+00252         CRefPtr<CMaterial>              _Material;
+00253 
+00254         // AnimValues.
+00255         CAnimatedValueRGBA              _Ambient;
+00256         CAnimatedValueRGBA              _Diffuse;
+00257         CAnimatedValueRGBA              _Specular;
+00258         CAnimatedValueFloat             _Shininess;
+00259         CAnimatedValueRGBA              _Emissive;
+00260         CAnimatedValueFloat             _Opacity;
+00261         CAnimatedValueInt               _Texture;
+00262                 
+00263         struct CTexAnimatedMatValues
+00264         {
+00265                 CAnimatedValueFloat _UTrans;
+00266                 CAnimatedValueFloat _VTrans;
+00267                 CAnimatedValueFloat _UScale;
+00268                 CAnimatedValueFloat _VScale;
+00269                 CAnimatedValueFloat _WRot;
+00270 
+00271                 void affect(CMaterialBase::CTexAnimTracks &at)
+00272                 {
+00273                         _UTrans.affect(at.DefaultUTrans.getValue());
+00274                         _VTrans.affect(at.DefaultVTrans.getValue());
+00275                         _UScale.affect(at.DefaultUScale.getValue());
+00276                         _VScale.affect(at.DefaultVScale.getValue());
+00277                         _WRot.affect(at.DefaultWRot.getValue());
+00278 
+00279                 }
+00280         };
+00281         CTexAnimatedMatValues           _TexAnimatedMatValues[IDRV_MAT_MAXTEXTURES];
+00282 };
+00283 
+00284 
+00285 } // NL3D
+00286 
+00287 
+00288 #endif // NL_ANIMATED_MATERIAL_H
+00289 
+00290 /* End of animated_material.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1