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/>.
18 #include "nel/3d/ps_attrib_maker_helper.h"
28 // ***********************************************************************************
29 void CPSAttribMakerMemory
<uint32
>::serial(NLMISC::IStream
&f
)
31 CPSAttribMakerMemoryBase
<uint32
>::serial(f
);
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
);
52 _MinValue
= std::min(_MinValue
, _T
.back());
53 _MaxValue
= std::max(_MaxValue
, _T
.back());
57 _MinValue
= _MaxValue
= _T
[0];
61 // ***********************************************************************************
62 void CPSAttribMakerMemory
<sint32
>::serial(NLMISC::IStream
&f
)
64 CPSAttribMakerMemoryBase
<sint32
>::serial(f
);
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
);
85 _MinValue
= std::min(_MinValue
, _T
.back());
86 _MaxValue
= std::max(_MaxValue
, _T
.back());
90 _MinValue
= _MaxValue
= _T
[0];
94 // ***********************************************************************************
95 void CPSAttribMakerMemory
<float>::serial(NLMISC::IStream
&f
)
97 CPSAttribMakerMemoryBase
<float>::serial(f
);
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());
123 _MinValue
= _MaxValue
= _T
[0];