Change Encyclo button name and macros icon
[ryzomcore.git] / nel / src / 3d / noise_3d.cpp
blob3c5257c49b604f67ede0711f921cf6ccd3e38181
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/noise_3d.h"
19 #include "nel/3d/driver.h"
21 using namespace NLMISC;
23 #ifdef DEBUG_NEW
24 #define new DEBUG_NEW
25 #endif
27 namespace NL3D
30 // ------------------------------------------------------------------------------------------------
31 CNoise3d::CNoise3d (IDriver *pDriver)
33 _Mem = NULL;
34 _Mat = NULL;
35 _OffS = NULL;
36 _Driver = pDriver;
37 _NbVertices = 0;
38 _IsDriverSupportCloudSinglePass = pDriver->supportCloudRenderSinglePass();
41 // ------------------------------------------------------------------------------------------------
42 CNoise3d::~CNoise3d ()
44 // delete _Mem; // done by CTertureMem destructor
45 delete _Mat;
46 delete [] _OffS;
49 // ------------------------------------------------------------------------------------------------
50 void CNoise3d::init (uint32 w, uint32 h, uint32 d)
52 uint32 i;
54 if (_Mem != NULL)
55 return;
57 w = raiseToNextPowerOf2 (w);
58 h = raiseToNextPowerOf2 (h);
59 d = raiseToNextPowerOf2 (d);
60 if (w > 64) w = 64;
61 if (h > 64) h = 64;
62 if (d > 64) d = 64;
63 if (w < 4) w = 4;
64 if (h < 4) h = 4;
65 if (d < 4) d = 4;
66 _Width = w;
67 _Height = h;
68 _Depth = d;
69 uint32 vdpo2 = getPowerOf2(_Depth);
71 _NbSliceW = 1 << (vdpo2 / 2);
72 if ((vdpo2 & 1) != 0)
73 _NbSliceH = 2 << (vdpo2 / 2);
74 else
75 _NbSliceH = 1 << (vdpo2 / 2);
77 _ScaleW = 1.0f / _NbSliceW;
78 _ScaleH = 1.0f / _NbSliceH;
80 _Mem = new uint8[w*h*d];
82 // Create initial noise
83 for (i = 0; i < (w*h*d); i++)
84 _Mem[i] = (uint8)(256.0f*rand()/RAND_MAX);
86 _OffS = new CUV [_Depth];
87 for (i = 0; i < _Depth; i++)
89 _OffS[i].U = ((float)rand())/RAND_MAX;
90 _OffS[i].V = ((float)rand())/RAND_MAX;
93 _Tex = new CTextureMem (_Mem, _Width*_NbSliceW*_Height*_NbSliceH, true, false, _Width*_NbSliceW, _Height*_NbSliceH,
94 CBitmap::Alpha);
95 _Tex->setWrapS(ITexture::Repeat);
96 _Tex->setWrapT(ITexture::Repeat);
97 _Tex->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff);
98 _Tex->touch();
99 _Tex->generate();
101 if (_IsDriverSupportCloudSinglePass)
103 _Mat = new CMaterial();
104 _Mat->initUnlit();
105 _Mat->setShader (CMaterial::Cloud);
106 _Mat->setTexture (0, _Tex);
107 _Mat->setTexture (1, _Tex);
108 _Mat->setColor (CRGBA(255,255,255,255));
109 _Mat->setBlend (true);
110 _Mat->setBlendFunc(CMaterial::one, CMaterial::one);
111 _Mat->setZFunc (CMaterial::always);
112 _Mat->setZWrite (false);
113 _VertexBuffer.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::PrimaryColorFlag |
114 CVertexBuffer::TexCoord0Flag | CVertexBuffer::TexCoord1Flag);
116 else
118 _Mat = new CMaterial();
119 _Mat->initUnlit();
120 _Mat->setShader (CMaterial::Normal);
121 _Mat->setTexture (0, _Tex);
122 _Mat->setColor (CRGBA(255,255,255,255));
123 _Mat->setBlend (true);
124 _Mat->setBlendFunc(CMaterial::one, CMaterial::one);
125 _Mat->setZFunc (CMaterial::always);
126 _Mat->setZWrite (false);
127 _VertexBuffer.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::PrimaryColorFlag |
128 CVertexBuffer::TexCoord0Flag);
132 // ------------------------------------------------------------------------------------------------
133 void CNoise3d::render2passes (CQuadUV &qc, float wpos, float alpha)
135 // For the moment we do it in 2 passes : because wpos is a position between slice we have to do :
136 // [ At0*wpos+At1*(1-wpos) ] * alpha
137 // this is done like that :
138 // At0*[wpos*alpha] + At1*[(1-wpos)*alpha]
140 wpos = fmodf (wpos, 1.0f);
141 uint32 nSlice1 = (uint32)(wpos * _Depth), nSlice2;
142 if (nSlice1 == (_Depth-1))
143 nSlice2 = 0;
144 else
145 nSlice2 = 1 + nSlice1;
146 // If wpos is just on slice1 alpha must be one
147 float alphaPos = 1.0f - _Depth*(wpos - (((float)nSlice1) / _Depth));
149 if (_NbVertices == _VertexBuffer.getNumVertices())
151 _VertexBuffer.setNumVertices(_NbVertices+8);
154 CVertexBufferReadWrite vba;
155 _VertexBuffer.lock (vba);
157 uint32 nVSize = _VertexBuffer.getVertexSize ();
158 CVector *pVertices = vba.getVertexCoordPointer(_NbVertices);
159 *pVertices = qc.V0; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
160 *pVertices = qc.V1; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
161 *pVertices = qc.V2; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
162 *pVertices = qc.V3; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
163 *pVertices = qc.V0; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
164 *pVertices = qc.V1; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
165 *pVertices = qc.V2; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
166 *pVertices = qc.V3;
168 CUV *pUV = vba.getTexCoordPointer (_NbVertices, 0);
169 *pUV = CUV(qc.Uv0.U*_ScaleW+_OffS[nSlice1].U, qc.Uv0.V*_ScaleH+_OffS[nSlice1].V);
170 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
171 *pUV = CUV(qc.Uv1.U*_ScaleW+_OffS[nSlice1].U, qc.Uv1.V*_ScaleH+_OffS[nSlice1].V);
172 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
173 *pUV = CUV(qc.Uv2.U*_ScaleW+_OffS[nSlice1].U, qc.Uv2.V*_ScaleH+_OffS[nSlice1].V);
174 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
175 *pUV = CUV(qc.Uv3.U*_ScaleW+_OffS[nSlice1].U, qc.Uv3.V*_ScaleH+_OffS[nSlice1].V);
176 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
178 *pUV = CUV(qc.Uv0.U*_ScaleW+_OffS[nSlice2].U, qc.Uv0.V*_ScaleH+_OffS[nSlice2].V);
179 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
180 *pUV = CUV(qc.Uv1.U*_ScaleW+_OffS[nSlice2].U, qc.Uv1.V*_ScaleH+_OffS[nSlice2].V);
181 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
182 *pUV = CUV(qc.Uv2.U*_ScaleW+_OffS[nSlice2].U, qc.Uv2.V*_ScaleH+_OffS[nSlice2].V);
183 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
184 *pUV = CUV(qc.Uv3.U*_ScaleW+_OffS[nSlice2].U, qc.Uv3.V*_ScaleH+_OffS[nSlice2].V);
186 uint8 finalAlpha = (uint8)(255*alphaPos*alpha);
188 // todo hulud d3d vertex color RGBA / BGRA
189 uint8 *pColA = (uint8*)vba.getColorPointer(_NbVertices) + 3;
190 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
191 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
192 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
193 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
195 finalAlpha = (uint8)(255*(1.0f-alphaPos)*alpha);
197 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
198 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
199 *pColA = finalAlpha; pColA = ((uint8*)pColA) + nVSize;
200 *pColA = finalAlpha;
202 _NbVertices += 8;
205 // ------------------------------------------------------------------------------------------------
206 void CNoise3d::render (CQuadUV &qc, float wpos, float intensity)
208 // [ At0*wpos+At1*(1-wpos) ] * alpha
210 if (!_IsDriverSupportCloudSinglePass)
212 render2passes (qc, wpos, intensity);
213 return;
216 _Intensity = intensity;
218 wpos = wpos - floorf (wpos);
219 uint32 nSlice1 = (uint32)(wpos * _Depth), nSlice2;
220 if (nSlice1 == (_Depth-1))
221 nSlice2 = 0;
222 else
223 nSlice2 = 1 + nSlice1;
224 // If wpos is just on slice1 alpha must be one
225 float alphaPos = 1.0f - _Depth*(wpos - (((float)nSlice1) / _Depth));
227 uint8 nAlphaPos = (uint8)(255*alphaPos);
229 uint32 nVSize = _VertexBuffer.getVertexSize ();
231 if (_NbVertices == _VertexBuffer.getNumVertices())
233 _VertexBuffer.setNumVertices (_NbVertices+4);
236 CVertexBufferReadWrite vba;
237 _VertexBuffer.lock (vba);
239 CVector *pVertices = vba.getVertexCoordPointer(_NbVertices);
240 *pVertices = qc.V0; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
241 *pVertices = qc.V1; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
242 *pVertices = qc.V2; pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
243 *pVertices = qc.V3;
245 CUV *pUV = vba.getTexCoordPointer (_NbVertices, 0);
246 *pUV = CUV(qc.Uv0.U/_NbSliceW+_OffS[nSlice1].U, qc.Uv0.V*_ScaleH+_OffS[nSlice1].V);
247 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
248 *pUV = CUV(qc.Uv1.U/_NbSliceW+_OffS[nSlice1].U, qc.Uv1.V*_ScaleH+_OffS[nSlice1].V);
249 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
250 *pUV = CUV(qc.Uv2.U/_NbSliceW+_OffS[nSlice1].U, qc.Uv2.V*_ScaleH+_OffS[nSlice1].V);
251 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
252 *pUV = CUV(qc.Uv3.U/_NbSliceW+_OffS[nSlice1].U, qc.Uv3.V*_ScaleH+_OffS[nSlice1].V);
254 pUV = vba.getTexCoordPointer (_NbVertices, 1);
255 *pUV = CUV(qc.Uv0.U*_ScaleW+_OffS[nSlice2].U, qc.Uv0.V*_ScaleH+_OffS[nSlice2].V);
256 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
257 *pUV = CUV(qc.Uv1.U*_ScaleW+_OffS[nSlice2].U, qc.Uv1.V*_ScaleH+_OffS[nSlice2].V);
258 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
259 *pUV = CUV(qc.Uv2.U*_ScaleW+_OffS[nSlice2].U, qc.Uv2.V*_ScaleH+_OffS[nSlice2].V);
260 pUV = (CUV*)( ((uint8*)pUV) + nVSize );
261 *pUV = CUV(qc.Uv3.U*_ScaleW+_OffS[nSlice2].U, qc.Uv3.V*_ScaleH+_OffS[nSlice2].V);
263 // todo hulud d3d vertex color RGBA / BGRA
264 uint8 *pColA = (uint8*)vba.getColorPointer(_NbVertices) + 3;
265 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
266 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
267 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
268 *pColA = nAlphaPos;
270 _NbVertices += 4;
273 // ------------------------------------------------------------------------------------------------
274 void CNoise3d::renderGrid (uint32 nbw, uint32 nbh, uint32 w, uint32 h,
275 float UStart, float VStart, float WStart, float dU, float dV, float dW, float intensity)
278 if (!_IsDriverSupportCloudSinglePass)
280 renderGrid2passes (nbw, nbh, w, h, UStart, VStart, WStart, dU, dV, dW, intensity);
281 return;
284 _Intensity = intensity;
286 uint32 i, j, nSlice1, nSlice2;
287 float wpos, oneOverNbWNbH = 1.0f / (nbw*nbh);
288 CVector *pVertices;
289 CUV *pUV0, *pUV1;
290 uint8 *pColA, nAlphaPos;
291 uint32 nVSize = _VertexBuffer.getVertexSize ();
293 if (_VertexBuffer.getNumVertices() < nbw*nbh*4)
295 _VertexBuffer.setNumVertices (nbw*nbh*4);
298 dU = (UStart+dU) /_NbSliceW;
299 dV = (VStart+dV) /_NbSliceH;
300 UStart = UStart / _NbSliceW;
301 VStart = VStart / _NbSliceH;
303 CVertexBufferReadWrite vba;
304 _VertexBuffer.lock (vba);
306 pVertices = vba.getVertexCoordPointer(0);
307 pUV0 = vba.getTexCoordPointer (0, 0);
308 pUV1 = vba.getTexCoordPointer (0, 1);
309 // todo hulud d3d vertex color RGBA / BGRA
310 pColA = (uint8*)vba.getColorPointer(0) + 3;
312 for (j = 0; j < nbh; ++j)
314 for (i = 0; i < nbw; ++i)
316 wpos = (float)WStart+dW*(i+(float)j*nbw)*oneOverNbWNbH;
317 wpos = wpos - floorf (wpos);
318 nSlice1 = (uint32)(wpos * _Depth);
319 if (nSlice1 == (_Depth-1))
320 nSlice2 = 0;
321 else
322 nSlice2 = 1 + nSlice1;
323 // If wpos is just on slice1 alpha must be one
324 nAlphaPos = (uint8)( 255*(1.0f - _Depth*(wpos - (((float)nSlice1) / _Depth))) );
326 *pVertices = CVector((float)i*w, (float)j*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
327 *pVertices = CVector((float)(i+1)*w, (float)j*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
328 *pVertices = CVector((float)(i+1)*w, (float)(j+1)*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
329 *pVertices = CVector((float)i*w, (float)(j+1)*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
331 pUV0->U = UStart+_OffS[nSlice1].U; pUV0->V = VStart+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
332 pUV0->U = dU+_OffS[nSlice1].U; pUV0->V = VStart+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
333 pUV0->U = dU+_OffS[nSlice1].U; pUV0->V = dV+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
334 pUV0->U = UStart+_OffS[nSlice1].U; pUV0->V = dV+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
336 pUV1->U = UStart+_OffS[nSlice2].U; pUV1->V = VStart+_OffS[nSlice2].V; pUV1 = (CUV*)( ((uint8*)pUV1) + nVSize );
337 pUV1->U = dU+_OffS[nSlice2].U; pUV1->V = VStart+_OffS[nSlice2].V; pUV1 = (CUV*)( ((uint8*)pUV1) + nVSize );
338 pUV1->U = dU+_OffS[nSlice2].U; pUV1->V = dV+_OffS[nSlice2].V; pUV1 = (CUV*)( ((uint8*)pUV1) + nVSize );
339 pUV1->U = UStart+_OffS[nSlice2].U; pUV1->V = dV+_OffS[nSlice2].V; pUV1 = (CUV*)( ((uint8*)pUV1) + nVSize );
341 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
342 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
343 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
344 *pColA = nAlphaPos; pColA = ((uint8*)pColA) + nVSize;
348 _NbVertices = nbw*nbh*4;
351 // ------------------------------------------------------------------------------------------------
352 void CNoise3d::renderGrid2passes (uint32 nbw, uint32 nbh, uint32 w, uint32 h,
353 float UStart, float VStart, float WStart, float dU, float dV, float dW, float intensity)
355 uint32 i, j, nSlice1, nSlice2;
356 float wpos, oneOverNbWNbH = 1.0f / (nbw*nbh);
357 CVector *pVertices;
358 CUV *pUV0;
359 uint8 *pColA, nFinalAlpha;
360 uint32 nVSize = _VertexBuffer.getVertexSize ();
362 if (_VertexBuffer.getNumVertices() < 2*nbw*nbh*4)
364 _VertexBuffer.setNumVertices (2*nbw*nbh*4);
367 dU = (UStart+dU) /_NbSliceW;
368 dV = (VStart+dV) /_NbSliceH;
369 UStart = UStart / _NbSliceW;
370 VStart = VStart / _NbSliceH;
372 CVertexBufferReadWrite vba;
373 _VertexBuffer.lock (vba);
375 pVertices = vba.getVertexCoordPointer(0);
376 pUV0 = vba.getTexCoordPointer (0, 0);
377 // todo hulud d3d vertex color RGBA / BGRA
378 pColA = (uint8*)vba.getColorPointer(0) + 3;
380 for (j = 0; j < nbh; ++j)
382 for (i = 0; i < nbw; ++i)
384 wpos = (float)WStart+dW*(i+(float)j*nbw)*oneOverNbWNbH;
385 wpos = fmodf (wpos, 1.0f);
386 nSlice1 = (uint32)(wpos * _Depth);
387 if (nSlice1 == (_Depth-1))
388 nSlice2 = 0;
389 else
390 nSlice2 = 1 + nSlice1;
391 // If wpos is just on slice1 alpha must be one
392 float alphaPos = 1.0f - _Depth*(wpos - (((float)nSlice1) / _Depth));
394 *pVertices = CVector((float)i*w, (float)j*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
395 *pVertices = CVector((float)(i+1)*w, (float)j*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
396 *pVertices = CVector((float)(i+1)*w, (float)(j+1)*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
397 *pVertices = CVector((float)i*w, (float)(j+1)*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
398 *pVertices = CVector((float)i*w, (float)j*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
399 *pVertices = CVector((float)(i+1)*w, (float)j*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
400 *pVertices = CVector((float)(i+1)*w, (float)(j+1)*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
401 *pVertices = CVector((float)i*w, (float)(j+1)*h, 0.0f); pVertices = (CVector*)( ((uint8*)pVertices) + nVSize );
403 pUV0->U = UStart+_OffS[nSlice1].U; pUV0->V = VStart+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
404 pUV0->U = dU+_OffS[nSlice1].U; pUV0->V = VStart+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
405 pUV0->U = dU+_OffS[nSlice1].U; pUV0->V = dV+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
406 pUV0->U = UStart+_OffS[nSlice1].U; pUV0->V = dV+_OffS[nSlice1].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
408 pUV0->U = UStart+_OffS[nSlice2].U; pUV0->V = VStart+_OffS[nSlice2].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
409 pUV0->U = dU+_OffS[nSlice2].U; pUV0->V = VStart+_OffS[nSlice2].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
410 pUV0->U = dU+_OffS[nSlice2].U; pUV0->V = dV+_OffS[nSlice2].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
411 pUV0->U = UStart+_OffS[nSlice2].U; pUV0->V = dV+_OffS[nSlice2].V; pUV0 = (CUV*)( ((uint8*)pUV0) + nVSize );
413 nFinalAlpha = (uint8)(255*alphaPos*intensity);
415 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
416 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
417 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
418 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
420 nFinalAlpha = (uint8)(255*(1.0f-alphaPos)*intensity);
422 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
423 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
424 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
425 *pColA = nFinalAlpha; pColA = ((uint8*)pColA) + nVSize;
428 _NbVertices = 2*4*nbw*nbh;
431 // ------------------------------------------------------------------------------------------------
432 void CNoise3d::flush ()
434 if (!_IsDriverSupportCloudSinglePass)
436 flush2passes ();
437 return;
440 _Mat->setColor(CRGBA(0,0,0,(uint8)(255*_Intensity)));
441 _Driver->activeVertexBuffer (_VertexBuffer);
442 _Driver->renderRawQuads (*_Mat, 0, _NbVertices/4);
443 _NbVertices = 0;
446 // ------------------------------------------------------------------------------------------------
447 void CNoise3d::flush2passes ()
449 _Driver->activeVertexBuffer (_VertexBuffer);
450 _Driver->renderRawQuads (*_Mat, 0, _NbVertices/4);
451 _NbVertices = 0;
454 // Accessors
455 // ------------------------------------------------------------------------------------------------
456 uint32 CNoise3d::getWidth ()
458 return _Width;
461 // ------------------------------------------------------------------------------------------------
462 uint32 CNoise3d::getHeight ()
464 return _Height;
467 // ------------------------------------------------------------------------------------------------
468 uint32 CNoise3d::getDepth ()
470 return _Depth;
473 } // namespace NL3D