1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "nel/3d/texture.h"
20 #include "nel/3d/driver.h"
31 /*==================================================================*\
33 \*==================================================================*/
36 // ***************************************************************************
40 _FilterOrWrapModeTouched
= false;
44 _WrapS
= _WrapT
= Repeat
;
47 _MinFilter
= LinearMipMapLinear
;
51 // ***************************************************************************
54 // Must kill the drv mirror of this texture.
59 // ***************************************************************************
60 void ITexture::releaseDriverSetup()
62 // Must kill the drv mirror of this texture.
63 if (TextureDrvShare
) TextureDrvShare
.kill();
67 // ***************************************************************************
68 ITexture
&ITexture::operator=(const ITexture
&tex
)
70 // The operator= do not copy drv info
71 // set touched=true. _Releasable is copied.
72 _UploadFormat
= tex
._UploadFormat
;
73 _Releasable
= tex
._Releasable
;
76 _MagFilter
= tex
._MagFilter
;
77 _MinFilter
= tex
._MinFilter
;
78 _RenderTarget
= tex
._RenderTarget
;
79 _FilterOrWrapModeTouched
= tex
._FilterOrWrapModeTouched
;
85 // ***************************************************************************
86 void ITexture::setUploadFormat(TUploadFormat pf
)
91 // All the texture may be reloaded...
97 // ***************************************************************************
98 void ITexture::setFilterMode(TMagFilter magf
, TMinFilter minf
)
100 if (_MagFilter
!= magf
)
103 _FilterOrWrapModeTouched
= true;
105 // If the MipMap mode has switched Off/On, then must recompute...
106 bool precOff
= mipMapOff();
107 if (_MinFilter
!= minf
)
110 _FilterOrWrapModeTouched
= true;
112 bool nowOff
= mipMapOff();
116 // Must recompute mipmaps!!
123 // ***************************************************************************
124 CTextureDrvShare::~CTextureDrvShare()
126 _Driver
->removeTextureDrvSharePtr(_DriverIterator
);
128 // ***************************************************************************
129 ITextureDrvInfos::~ITextureDrvInfos()
131 // NB: _Driver may be NULL because texture may not be stored in the share texture map.
132 // so there is no need to remove it from this map!!
134 _Driver
->removeTextureDrvInfoPtr(_DriverIterator
);
138 // ***************************************************************************
139 void ITexture::serial(NLMISC::IStream
&f
)
143 - _LoadGrayscaleAsAlpha
148 sint ver
= f
.serialVersion(1);
150 f
.serialEnum(_UploadFormat
);
151 f
.serialEnum(_WrapS
);
152 f
.serialEnum(_WrapT
);
153 f
.serialEnum(_MinFilter
);
154 f
.serialEnum(_MagFilter
);
156 f
.serial(_LoadGrayscaleAsAlpha
);
159 // ***************************************************************************
161 void ITexture::setRenderTarget (bool enable
)
163 _RenderTarget
= enable
;
167 // ***************************************************************************