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/texture__blend_8cpp-source.html | 208 +++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 docs/doxygen/nel/texture__blend_8cpp-source.html (limited to 'docs/doxygen/nel/texture__blend_8cpp-source.html') diff --git a/docs/doxygen/nel/texture__blend_8cpp-source.html b/docs/doxygen/nel/texture__blend_8cpp-source.html new file mode 100644 index 00000000..20291191 --- /dev/null +++ b/docs/doxygen/nel/texture__blend_8cpp-source.html @@ -0,0 +1,208 @@ + + + + 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  
+

texture_blend.cpp

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000, 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 #include "std3d.h"
+00027 
+00028 #include "3d/texture_blend.h"
+00029 #include "nel/misc/common.h"
+00030 
+00031 namespace NL3D {
+00032 
+00033 
+00034 
+00035 CTextureBlend::CTextureBlend() : _BlendFactor(0), _SharingEnabled(true)
+00036 {
+00037 }
+00038 
+00039 
+00040 //************************************************************************
+00041 bool    CTextureBlend::supportSharing() const
+00042 {
+00043         return _BlendTex[0] && _BlendTex[0]->supportSharing()
+00044                         && _BlendTex[1] && _BlendTex[1]->supportSharing();
+00045 }
+00046 
+00047 //************************************************************************
+00048 std::string             CTextureBlend::getShareName() const
+00049 {
+00050         nlassert(supportSharing());
+00051         char fmt[1024];
+00052         NLMISC::smprintf(fmt, 1024, "BlendTex0:%s:BlendTex1:%s:blendFactor:%d",
+00053                          _BlendTex[0]->getShareName().c_str(), _BlendTex[1]->getShareName().c_str(),
+00054                          (uint) _BlendFactor
+00055                          );
+00056         return fmt;
+00057 }
+00058 
+00059 
+00060 //************************************************************************
+00061 void CTextureBlend::enableSharing(bool enabled /*= false*/)
+00062 {
+00063         _SharingEnabled = enabled;
+00064 }
+00065 
+00066 
+00067 //************************************************************************
+00068 void CTextureBlend::release()
+00069 { 
+00070         if (_BlendTex[0] && _BlendTex[0]->getReleasable()) _BlendTex[0]->release();
+00071         if (_BlendTex[1] && _BlendTex[1]->getReleasable()) _BlendTex[1]->release();
+00072         ITexture::release();
+00073 }
+00074 
+00075 //************************************************************************
+00076 bool CTextureBlend::setBlendFactor(uint16 factor)
+00077 {
+00078         nlassert(factor <= 256);
+00079         if (factor != _BlendFactor)
+00080         {
+00081                 _BlendFactor = factor;
+00082                 touch(); // need to recompute blending
+00083                 return true;
+00084         }
+00085         return false;
+00086 }
+00087 
+00088 
+00089 //************************************************************************
+00090 void CTextureBlend::setBlendTexture(uint index, ITexture *tex)
+00091 {
+00092         nlassert(index < 2);
+00093         if (tex != _BlendTex[index])
+00094         {
+00095                 _BlendTex[index] = tex;
+00096                 touch(); // need to recompute blending
+00097         }
+00098 }
+00099 
+00100 
+00101 //************************************************************************
+00102 void CTextureBlend::doGenerate()
+00103 {
+00104         if (!_BlendTex[0] || !_BlendTex[1])
+00105         {
+00106                 makeDummy();
+00107                 return;
+00108         }
+00109         
+00110         _BlendTex[0]->generate();
+00111         _BlendTex[1]->generate();
+00112         this->blend(*_BlendTex[0], *_BlendTex[1], _BlendFactor);                
+00113 }
+00114 
+00115 
+00116 //************************************************************************
+00117 void    CTextureBlend::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
+00118 {
+00119         f.serialVersion(0);
+00120         ITexture::serial(f);
+00121         for (uint k = 0; k < 2; ++k)
+00122         {
+00123                 ITexture *tex = NULL;   
+00124                 if (f.isReading())
+00125                 {               
+00126                         f.serialPolyPtr(tex);
+00127                         _BlendTex[k] = tex;
+00128                         touch();
+00129                 }
+00130                 else
+00131                 {
+00132                         tex = _BlendTex[k];
+00133                         f.serialPolyPtr(tex);
+00134                 }
+00135         }
+00136         f.serial(_SharingEnabled, _BlendFactor);
+00137 }
+00138 
+00139 } // NL3D
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1