Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / src / 3d / ps_attrib_maker_helper.cpp
blobaaa6b5a4d4f8e2133c7a9db0fb04a4283bce78d7
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"
18 #include "nel/3d/ps_attrib_maker_helper.h"
20 #ifdef DEBUG_NEW
21 #define new DEBUG_NEW
22 #endif
24 namespace NL3D
28 // ***********************************************************************************
29 void CPSAttribMakerMemory<uint32>::serial(NLMISC::IStream &f)
31 CPSAttribMakerMemoryBase<uint32>::serial(f);
32 if (f.isReading())
34 if (_T.getSize() != 0)
36 _MinValue = _MaxValue = _T[0];
37 for(uint k = 1; k < _T.getSize(); ++k)
39 _MinValue = std::min(_MinValue, _T[k]);
40 _MaxValue = std::max(_MaxValue, _T[k]);
46 // ***********************************************************************************
47 void CPSAttribMakerMemory<uint32>::newElement(const CPSEmitterInfo &info)
49 CPSAttribMakerMemoryBase<uint32>::newElement(info);
50 if (_T.getSize() > 1)
52 _MinValue = std::min(_MinValue, _T.back());
53 _MaxValue = std::max(_MaxValue, _T.back());
55 else
57 _MinValue = _MaxValue = _T[0];
61 // ***********************************************************************************
62 void CPSAttribMakerMemory<sint32>::serial(NLMISC::IStream &f)
64 CPSAttribMakerMemoryBase<sint32>::serial(f);
65 if (f.isReading())
67 if (_T.getSize() != 0)
69 _MinValue = _MaxValue = _T[0];
70 for(uint k = 1; k < _T.getSize(); ++k)
72 _MinValue = std::min(_MinValue, _T[k]);
73 _MaxValue = std::max(_MaxValue, _T[k]);
79 // ***********************************************************************************
80 void CPSAttribMakerMemory<sint32>::newElement(const CPSEmitterInfo &info)
82 CPSAttribMakerMemoryBase<sint32>::newElement(info);
83 if (_T.getSize() > 1)
85 _MinValue = std::min(_MinValue, _T.back());
86 _MaxValue = std::max(_MaxValue, _T.back());
88 else
90 _MinValue = _MaxValue = _T[0];
94 // ***********************************************************************************
95 void CPSAttribMakerMemory<float>::serial(NLMISC::IStream &f)
97 CPSAttribMakerMemoryBase<float>::serial(f);
98 if (f.isReading())
100 if (_T.getSize() != 0)
102 _MinValue = _MaxValue = _T[0];
103 for(uint k = 1; k < _T.getSize(); ++k)
105 _MinValue = std::min(_MinValue, _T[k]);
106 _MaxValue = std::max(_MaxValue, _T[k]);
112 // ***********************************************************************************
113 void CPSAttribMakerMemory<float>::newElement(const CPSEmitterInfo &info)
115 CPSAttribMakerMemoryBase<float>::newElement(info);
116 if (_T.getSize() > 1)
118 _MinValue = std::min(_MinValue, _T.back());
119 _MaxValue = std::max(_MaxValue, _T.back());
121 else
123 _MinValue = _MaxValue = _T[0];
128 } // NL3D