Changeset 2883 for trunk/packages/vizservers/nanovis/NvParticleRenderer.cpp
- Timestamp:
- Mar 23, 2012, 5:50:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/NvParticleRenderer.cpp
r2870 r2883 27 27 #include "Trace.h" 28 28 29 #define NV_3230 31 29 NvParticleAdvectionShader *NvParticleRenderer::_advectionShader = NULL; 32 30 … … 39 37 ~NvParticleAdvectionShaderInstance() 40 38 { 41 42 43 39 if (NvParticleRenderer::_advectionShader) { 40 delete NvParticleRenderer::_advectionShader; 41 } 44 42 } 45 43 }; … … 47 45 NvParticleAdvectionShaderInstance shaderInstance; 48 46 49 NvParticleRenderer::NvParticleRenderer(int w, int h) : 47 NvParticleRenderer::NvParticleRenderer(int w, int h) : 48 _initPosTex(0), 49 _data(NULL), 50 _psysFrame(0), 51 _reborn(true), 52 _flip(true), 53 _maxLife(500), 50 54 _particleSize(1.2), 51 scale(1, 1, 1), 52 origin(0, 0, 0), 53 _activate(false) 54 { 55 psys_width = w; 56 psys_height = h; 57 58 psys_frame = 0; 59 reborn = true; 60 flip = true; 61 62 _color.set(0.2, 0.2, 1.0, 1.0); 63 max_life = 500; 64 65 _slice_axis = 0; 66 _slice_pos = 0.0; 67 68 data = new Particle[w*h]; 69 memset(data, 0, sizeof(Particle) * w * h); 70 71 _vertex_array = new RenderVertexArray(psys_width*psys_height, 3, GL_FLOAT); 55 _vertexArray(NULL), 56 _scale(1, 1, 1), 57 _origin(0, 0, 0), 58 _activate(false), 59 _slicePos(0.0), 60 _sliceAxis(0), 61 _color(0.2, 0.2, 1.0, 1.0), 62 _psysWidth(w), 63 _psysHeight(h) 64 { 65 _data = new Particle[w * h]; 66 memset(_data, 0, sizeof(Particle) * w * h); 67 68 _vertexArray = new RenderVertexArray(_psysWidth * _psysHeight, 3, GL_FLOAT); 72 69 73 70 assert(CheckGL(AT)); 74 71 75 glGenFramebuffersEXT(2, psys_fbo);76 glGenTextures(2, psys_tex);77 78 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[0]);79 80 glBindTexture(GL_TEXTURE_RECTANGLE_NV, psys_tex[0]);72 glGenFramebuffersEXT(2, _psysFbo); 73 glGenTextures(2, _psysTex); 74 75 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _psysFbo[0]); 76 77 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _psysTex[0]); 81 78 glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 82 79 glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 83 80 84 #ifdef NV_3285 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_ FLOAT_RGBA32_NV,86 psys_width, psys_height, 0, GL_RGBA, GL_FLOAT, NULL);87 #else 88 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, psys_width, psys_height,89 81 #ifdef HAVE_FLOAT_TEXTURES 82 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA32F_ARB, 83 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, NULL); 84 #else 85 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 86 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, NULL); 90 87 #endif 91 88 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 92 GL_TEXTURE_RECTANGLE_NV, psys_tex[0], 0);93 94 95 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[1]);96 97 glBindTexture(GL_TEXTURE_RECTANGLE_NV, psys_tex[1]);89 GL_TEXTURE_RECTANGLE_NV, _psysTex[0], 0); 90 91 92 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _psysFbo[1]); 93 94 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _psysTex[1]); 98 95 glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 99 96 glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 100 #ifdef NV_32101 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_ FLOAT_RGBA32_NV,102 psys_width, psys_height, 0, GL_RGBA, GL_FLOAT, NULL);103 #else 104 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, psys_width, psys_height,105 97 #ifdef HAVE_FLOAT_TEXTURES 98 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA32F_ARB, 99 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, NULL); 100 #else 101 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 102 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, NULL); 106 103 #endif 107 104 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 108 GL_TEXTURE_RECTANGLE_NV, psys_tex[1], 0);105 GL_TEXTURE_RECTANGLE_NV, _psysTex[1], 0); 109 106 110 107 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 111 108 112 glGenTextures(1, & initPosTex);113 glBindTexture(GL_TEXTURE_RECTANGLE_NV, initPosTex);109 glGenTextures(1, &_initPosTex); 110 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _initPosTex); 114 111 glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 115 112 glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 116 #ifdef NV_32117 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_ FLOAT_RGBA32_NV,118 psys_width, psys_height, 0, GL_RGBA, GL_FLOAT, NULL);119 #else 120 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, psys_width,121 psys_height, 0, GL_RGBA, GL_FLOAT, NULL);113 #ifdef HAVE_FLOAT_TEXTURES 114 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA32F_ARB, 115 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, NULL); 116 #else 117 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 118 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, NULL); 122 119 #endif 123 120 … … 125 122 126 123 if (_advectionShader == NULL) { 127 124 _advectionShader = new NvParticleAdvectionShader(); 128 125 } 129 126 } … … 131 128 NvParticleRenderer::~NvParticleRenderer() 132 129 { 133 glDeleteTextures(1, & initPosTex);134 135 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[0]);136 glDeleteTextures(1, psys_tex);137 138 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[1]);139 glDeleteTextures(1, psys_tex+1);140 141 glDeleteFramebuffersEXT(2, psys_fbo);142 143 delete _vertex _array;144 delete [] data;130 glDeleteTextures(1, &_initPosTex); 131 132 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _psysFbo[0]); 133 glDeleteTextures(1, _psysTex); 134 135 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _psysFbo[1]); 136 glDeleteTextures(1, _psysTex+1); 137 138 glDeleteFramebuffersEXT(2, _psysFbo); 139 140 delete _vertexArray; 141 delete [] _data; 145 142 } 146 143 147 144 void NvParticleRenderer::initializeDataArray() 148 145 { 149 size_t n = psys_width * psys_height * 4;150 memset( data, 0, sizeof(float)* n);146 size_t n = _psysWidth * _psysHeight * 4; 147 memset(_data, 0, sizeof(float)* n); 151 148 152 149 int index; 153 150 bool particle; 154 float *p = (float *) data;155 for (int i = 0; i < psys_width; i++) {156 for (int j = 0; j < psys_height; j++) {157 index = i + psys_height*j;158 particle = (rand() % 256) > 150; 159 if (particle) {151 float *p = (float *)_data; 152 for (int i = 0; i < _psysWidth; i++) { 153 for (int j = 0; j < _psysHeight; j++) { 154 index = i + _psysHeight*j; 155 particle = (rand() % 256) > 150; 156 if (particle) { 160 157 //assign any location (x,y,z) in range [0,1] 161 switch (_slice_axis) {162 case 0:163 p[4*index] = _slice_pos;164 p[4*index+1]= j/float(psys_height);165 p[4*index+2]= i/float(psys_width);166 167 case 1:168 p[4*index]= j/float(psys_height);169 p[4*index+1] = _slice_pos;170 p[4*index+2]= i/float(psys_width);171 172 case 2:173 p[4*index]= j/float(psys_height);174 p[4*index+1]= i/float(psys_width);175 p[4*index+2] = _slice_pos;176 177 default:178 179 180 181 182 183 184 185 158 switch (_sliceAxis) { 159 case 0: 160 p[4*index] = _slicePos; 161 p[4*index+1]= j/float(_psysHeight); 162 p[4*index+2]= i/float(_psysWidth); 163 break; 164 case 1: 165 p[4*index]= j/float(_psysHeight); 166 p[4*index+1] = _slicePos; 167 p[4*index+2]= i/float(_psysWidth); 168 break; 169 case 2: 170 p[4*index]= j/float(_psysHeight); 171 p[4*index+1]= i/float(_psysWidth); 172 p[4*index+2] = _slicePos; 173 break; 174 default: 175 p[4*index] = 0; 176 p[4*index+1]= 0; 177 p[4*index+2]= 0; 178 p[4*index+3]= 0; 179 } 180 181 //shorter life span, quicker iterations 182 p[4*index+3]= rand() / ((float) RAND_MAX) * 0.5 + 0.5f; 186 183 } else { 187 188 189 190 191 184 p[4*index] = 0; 185 p[4*index+1]= 0; 186 p[4*index+2]= 0; 187 p[4*index+3]= 0; 188 } 192 189 } 193 190 } … … 201 198 //memcpy(data, p, psys_width*psys_height*sizeof(Particle)); 202 199 203 glBindTexture(GL_TEXTURE_RECTANGLE_NV, psys_tex[0]); 204 // I need to find out why GL_FLOAT_RGBA32_NV doesn't work 205 #ifdef NV_32 206 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV, 207 psys_width, psys_height, 0, GL_RGBA, GL_FLOAT, (float*)data); 208 #else 209 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, psys_width, 210 psys_height, 0, GL_RGBA, GL_FLOAT, (float*)data); 200 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _psysTex[0]); 201 #ifdef HAVE_FLOAT_TEXTURES 202 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA32F_ARB, 203 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, (float*)_data); 204 #else 205 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 206 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, (float*)_data); 211 207 #endif 212 208 glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0); 213 214 flip = true; 215 reborn = false; 216 217 glBindTexture(GL_TEXTURE_RECTANGLE_NV, initPosTex); 218 // I need to find out why GL_FLOAT_RGBA32_NV doesn't work 219 #ifdef NV_32 220 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV, 221 psys_width, psys_height, 0, GL_RGBA, GL_FLOAT, (float*)data); 222 #else 223 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, psys_width, psys_height, 224 0, GL_RGBA, GL_FLOAT, (float*)p); 209 210 _flip = true; 211 _reborn = false; 212 213 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _initPosTex); 214 #ifdef HAVE_FLOAT_TEXTURES 215 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA32F_ARB, 216 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, (float*)_data); 217 #else 218 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 219 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, (float*)_data); 225 220 #endif 226 221 glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0); … … 231 226 void NvParticleRenderer::reset() 232 227 { 233 glBindTexture(GL_TEXTURE_RECTANGLE_NV, psys_tex[0]);234 #ifdef NV_32235 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_ FLOAT_RGBA32_NV,236 psys_width, psys_height, 0, GL_RGBA, GL_FLOAT, (float*)data);237 #else 238 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, psys_width, psys_height,239 0, GL_RGBA, GL_FLOAT, (float*)data);228 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _psysTex[0]); 229 #ifdef HAVE_FLOAT_TEXTURES 230 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA32F_ARB, 231 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, (float*)_data); 232 #else 233 glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 234 _psysWidth, _psysHeight, 0, GL_RGBA, GL_FLOAT, (float*)_data); 240 235 #endif 241 236 glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0); 242 flip = true;243 reborn = false;244 psys_frame = 0;237 _flip = true; 238 _reborn = false; 239 _psysFrame = 0; 245 240 } 246 241 … … 248 243 NvParticleRenderer::advect() 249 244 { 250 if ( reborn)245 if (_reborn) 251 246 reset(); 252 247 253 248 glDisable(GL_BLEND); 254 249 glDisable(GL_DEPTH_TEST); 255 256 if ( flip) {257 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[1]);258 259 glBindTexture(GL_TEXTURE_RECTANGLE_NV, psys_tex[0]);260 261 262 263 264 glViewport(0, 0, psys_width, psys_height);265 266 267 //gluOrtho2D(0, psys_width, 0, psys_height);268 glOrtho(0, psys_width, 0, psys_height, -10.0f, 10.0f);269 270 271 272 _advectionShader->bind(psys_tex[0],initPosTex);273 274 draw_quad(psys_width, psys_height, psys_width, psys_height);275 276 250 251 if (_flip) { 252 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _psysFbo[1]); 253 glEnable(GL_TEXTURE_RECTANGLE_NV); 254 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _psysTex[0]); 255 256 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 257 //glClear(GL_COLOR_BUFFER_BIT); 258 259 glViewport(0, 0, _psysWidth, _psysHeight); 260 glMatrixMode(GL_PROJECTION); 261 glLoadIdentity(); 262 //gluOrtho2D(0, _psysWidth, 0, _psysHeight); 263 glOrtho(0, _psysWidth, 0, _psysHeight, -10.0f, 10.0f); 264 glMatrixMode(GL_MODELVIEW); 265 glLoadIdentity(); 266 267 _advectionShader->bind(_psysTex[0], _initPosTex); 268 269 draw_quad(_psysWidth, _psysHeight, _psysWidth, _psysHeight); 270 271 glDisable(GL_TEXTURE_RECTANGLE_NV); 277 272 } else { 278 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[0]);279 glBindTexture(GL_TEXTURE_RECTANGLE_NV, psys_tex[1]);280 281 282 283 284 glViewport(0, 0, psys_width, psys_height);285 286 287 //gluOrtho2D(0, psys_width, 0, psys_height);288 glOrtho(0, psys_width, 0, psys_height, -10.0f, 10.0f);289 290 291 292 _advectionShader->bind(psys_tex[1],initPosTex);293 294 draw_quad(psys_width, psys_height, psys_width, psys_height);273 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _psysFbo[0]); 274 glBindTexture(GL_TEXTURE_RECTANGLE_NV, _psysTex[1]); 275 276 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 277 //glClear(GL_COLOR_BUFFER_BIT); 278 279 glViewport(0, 0, _psysWidth, _psysHeight); 280 glMatrixMode(GL_PROJECTION); 281 glLoadIdentity(); 282 //gluOrtho2D(0, _psysWidth, 0, _psysHeight); 283 glOrtho(0, _psysWidth, 0, _psysHeight, -10.0f, 10.0f); 284 glMatrixMode(GL_MODELVIEW); 285 glLoadIdentity(); 286 287 _advectionShader->bind(_psysTex[1], _initPosTex); 288 289 draw_quad(_psysWidth, _psysHeight, _psysWidth, _psysHeight); 295 290 } 296 291 297 292 _advectionShader->unbind(); 298 293 299 update _vertex_buffer();300 301 flip = (!flip);302 303 psys_frame++;304 if ( psys_frame == max_life) {305 psys_frame=0;306 //reborn = true;294 updateVertexBuffer(); 295 296 _flip = (!_flip); 297 298 _psysFrame++; 299 if (_psysFrame == _maxLife) { 300 _psysFrame = 0; 301 // _reborn = true; 307 302 } 308 303 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 309 304 } 310 305 306 void 307 NvParticleRenderer::updateVertexBuffer() 308 { 309 _vertexArray->Read(_psysWidth, _psysHeight); 310 311 //_vertexArray->LoadData(vert); //does not work?? 312 //assert(glGetError()==0); 313 } 314 315 void 316 NvParticleRenderer::render() 317 { 318 displayVertices(); 319 } 320 311 321 void 312 NvParticleRenderer::update_vertex_buffer() 313 { 314 _vertex_array->Read(psys_width, psys_height); 315 316 //_vertex_array->LoadData(vert); //does not work?? 317 //assert(glGetError()==0); 318 } 319 320 void 321 NvParticleRenderer::render() 322 { 323 display_vertices(); 324 } 325 326 void 327 NvParticleRenderer::draw_bounding_box(float x0, float y0, float z0, 328 float x1, float y1, float z1, 329 float r, float g, float b, 330 float line_width) 322 NvParticleRenderer::drawBoundingBox(float x0, float y0, float z0, 323 float x1, float y1, float z1, 324 float r, float g, float b, 325 float line_width) 331 326 { 332 327 glPushMatrix(); … … 340 335 glBegin(GL_LINE_LOOP); 341 336 { 342 343 344 345 337 glVertex3d(x0, y0, z0); 338 glVertex3d(x1, y0, z0); 339 glVertex3d(x1, y1, z0); 340 glVertex3d(x0, y1, z0); 346 341 } 347 342 glEnd(); … … 349 344 glBegin(GL_LINE_LOOP); 350 345 { 351 352 353 354 346 glVertex3d(x0, y0, z1); 347 glVertex3d(x1, y0, z1); 348 glVertex3d(x1, y1, z1); 349 glVertex3d(x0, y1, z1); 355 350 } 356 351 glEnd(); … … 358 353 glBegin(GL_LINE_LOOP); 359 354 { 360 361 362 363 355 glVertex3d(x0, y0, z0); 356 glVertex3d(x0, y0, z1); 357 glVertex3d(x0, y1, z1); 358 glVertex3d(x0, y1, z0); 364 359 } 365 360 glEnd(); … … 367 362 glBegin(GL_LINE_LOOP); 368 363 { 369 370 371 372 364 glVertex3d(x1, y0, z0); 365 glVertex3d(x1, y0, z1); 366 glVertex3d(x1, y1, z1); 367 glVertex3d(x1, y1, z0); 373 368 } 374 369 glEnd(); … … 380 375 } 381 376 382 void 383 NvParticleRenderer::display _vertices()377 void 378 NvParticleRenderer::displayVertices() 384 379 { 385 380 glDisable(GL_TEXTURE_2D); … … 391 386 glPushMatrix(); 392 387 393 glTranslatef(origin.x, origin.y, origin.z); 394 glScaled(scale.x, scale.y, scale.z); 395 396 // TBD... 397 /* 398 draw_bounding_box( 399 0, 0, 0, 400 1, 1, 1, 401 1, 1, 1, 2); 402 403 draw_bounding_box( 404 0, 0.5f / 4.5f, 0.5f / 4.5, 405 1, 4.0f / 4.5f, 4.0f / 4.5, 406 1, 0, 0, 2); 407 408 draw_bounding_box( 409 1/3.0f, 1.0f / 4.5f, 0.5f / 4.5, 410 2/3.0f, 3.5f / 4.5f, 3.5f / 4.5, 411 1, 1, 0, 2); 412 */ 388 glTranslatef(_origin.x, _origin.y, _origin.z); 389 glScaled(_scale.x, _scale.y, _scale.z); 390 391 // TBD... 392 /* 393 drawBoundingBox(0, 0, 0, 394 1, 1, 1, 395 1, 1, 1, 2); 396 397 drawBoundingBox(0, 0.5f / 4.5f, 0.5f / 4.5, 398 1, 4.0f / 4.5f, 4.0f / 4.5, 399 1, 0, 0, 2); 400 401 drawBoundingBox(1/3.0f, 1.0f / 4.5f, 0.5f / 4.5, 402 2/3.0f, 3.5f / 4.5f, 3.5f / 4.5, 403 1, 1, 0, 2); 404 */ 413 405 414 406 glPointSize(_particleSize); … … 416 408 glColor4f(_color.x, _color.y, _color.z, _color.w); 417 409 glEnableClientState(GL_VERTEX_ARRAY); 418 _vertex _array->SetPointer(0);419 glDrawArrays(GL_POINTS, 0, psys_width*psys_height);410 _vertexArray->SetPointer(0); 411 glDrawArrays(GL_POINTS, 0, _psysWidth * _psysHeight); 420 412 glDisableClientState(GL_VERTEX_ARRAY); 421 413 422 414 glPopMatrix(); 423 415 424 416 glDisable(GL_DEPTH_TEST); 425 417 … … 428 420 429 421 void 430 NvParticleRenderer::setVectorField(unsigned int texID, const Vector3& ori ,431 432 433 { 434 origin = ori;435 scale.set(scaleX, scaleY, scaleZ);436 _advectionShader->setScale( scale);422 NvParticleRenderer::setVectorField(unsigned int texID, const Vector3& origin, 423 float scaleX, float scaleY, float scaleZ, 424 float max) 425 { 426 _origin = origin; 427 _scale.set(scaleX, scaleY, scaleZ); 428 _advectionShader->setScale(_scale); 437 429 _advectionShader->setVelocityVolume(texID, max); 438 430 } … … 440 432 void NvParticleRenderer::setAxis(int axis) 441 433 { 442 _slice _axis = axis;434 _sliceAxis = axis; 443 435 initializeDataArray(); 444 436 } … … 446 438 void NvParticleRenderer::setPos(float pos) 447 439 { 448 _slice _pos = pos;440 _slicePos = pos; 449 441 initializeDataArray(); 450 442 }
Note: See TracChangeset
for help on using the changeset viewer.