Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / src / 3d / tile_far_bank.cpp
blobe86f18389a5233de55ad88ae000b1dd0832b9eb3
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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/>.
17 #include "std3d.h"
19 #include "nel/3d/tile_far_bank.h"
21 using namespace NLMISC;
23 // Define this to force white far texture (debug)
24 // #define NEL_FORCE_WHITE_FAR_TEXTURE
26 #ifdef DEBUG_NEW
27 #define new DEBUG_NEW
28 #endif
30 namespace NL3D {
33 // ***************************************************************************
34 // ***************************************************************************
35 // CTileFarBank::CTileFar.
36 // ***************************************************************************
37 // ***************************************************************************
39 // ***************************************************************************
40 const sint CTileFarBank::CTileFar::_Version=0x0;
41 // ***************************************************************************
42 void CTileFarBank::CTileFar::serial(NLMISC::IStream &f)
44 // Serial version
45 (void)f.serialVersion(_Version);
47 // Serial pixels
48 f.serialCont (_Pixels[diffuse][order0]);
49 f.serialCont (_Pixels[diffuse][order1]);
50 f.serialCont (_Pixels[diffuse][order2]);
51 f.serialCont (_Pixels[additive][order0]);
52 f.serialCont (_Pixels[additive][order1]);
53 f.serialCont (_Pixels[additive][order2]);
55 #ifdef NEL_FORCE_WHITE_FAR_TEXTURE
56 int size = _Pixels[diffuse][order0].size ();
57 _Pixels[diffuse][order0].resize (0);
58 _Pixels[diffuse][order0].resize (size, CRGBA::White);
59 size = _Pixels[diffuse][order1].size ();
60 _Pixels[diffuse][order1].resize (0);
61 _Pixels[diffuse][order1].resize (size, CRGBA::White);
62 size = _Pixels[diffuse][order2].size ();
63 _Pixels[diffuse][order2].resize (0);
64 _Pixels[diffuse][order2].resize (size, CRGBA::White);
65 #endif // NEL_FORCE_WHITE_FAR_TEXTURE
67 // ***************************************************************************
68 void CTileFarBank::CTileFar::setPixels (TFarType type, TFarOrder order, NLMISC::CRGBA* pixels, uint size)
70 // Mode alpha ?
71 if (type==alpha)
73 _Pixels[diffuse][order].resize (size);
74 _Pixels[additive][order].resize (size);
76 // Copy only the alpha channel
77 for (uint p=0; p<size; p++)
79 _Pixels[diffuse][order][p].A=pixels[p].A;
80 _Pixels[additive][order][p].A=pixels[p].A;
83 else
85 // Resize this array
86 _Pixels[type][order].resize (size);
88 // Copy all the channels
89 memcpy (&_Pixels[type][order][0], pixels, size*sizeof(NLMISC::CRGBA));
94 // ***************************************************************************
95 // ***************************************************************************
96 // CTileFarBank.
97 // ***************************************************************************
98 // ***************************************************************************
100 // ***************************************************************************
101 CTileFarBank::CTileFarBank()
105 // ***************************************************************************
106 const sint CTileFarBank::_Version=0x0;
107 // ***************************************************************************
108 void CTileFarBank::serial(NLMISC::IStream &f)
110 // Write/Check "FAR_BANK" in header of the stream
111 f.serialCheck (NELID("_RAF"));
112 f.serialCheck (NELID("KNAB"));
114 // Serial version
115 (void)f.serialVersion(_Version);
117 // Serial tiles
118 f.serialCont (_TileVector);
122 } // NL3D