00001 /* 00002 * Copyright 1993-2006 NVIDIA Corporation. All rights reserved. 00003 * 00004 * NOTICE TO USER: 00005 * 00006 * This source code is subject to NVIDIA ownership rights under U.S. and 00007 * international Copyright laws. 00008 * 00009 * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE 00010 * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR 00011 * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH 00012 * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF 00013 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. 00014 * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, 00015 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00016 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00017 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 00018 * OR PERFORMANCE OF THIS SOURCE CODE. 00019 * 00020 * U.S. Government End Users. This source code is a "commercial item" as 00021 * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of 00022 * "commercial computer software" and "commercial computer software 00023 * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) 00024 * and is provided to the U.S. Government only as a commercial end item. 00025 * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 00026 * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the 00027 * source code with only those rights set forth herein. 00028 */ 00029 00030 /* 00031 * Slightly adapted 2009 by Ph. Robert wrt the Equalizer port 00032 */ 00033 00034 #ifndef EQNBODY_RENDER_PARTICLES_H 00035 #define EQNBODY_RENDER_PARTICLES_H 00036 00037 namespace eqNbody 00038 { 00039 enum DisplayMode 00040 { 00041 PARTICLE_POINTS, 00042 PARTICLE_SPRITES, 00043 PARTICLE_SPRITES_COLOR, 00044 PARTICLE_NUM_MODES 00045 }; 00046 00047 class ParticleRenderer 00048 { 00049 public: 00050 ParticleRenderer(); 00051 ~ParticleRenderer(); 00052 00053 void init(); 00054 00055 void setPositions(float *pos, int numParticles); 00056 void setColors(float *color, int numParticles); 00057 void setPBO(unsigned int pbo, int numParticles); 00058 00059 void draw(DisplayMode mode = PARTICLE_POINTS); 00060 00061 void setPointSize(float size) { m_pointSize = size; } 00062 void setSpriteSize(float size) { m_spriteSize = size; } 00063 00064 protected: // methods 00065 void _createTexture(int resolution); 00066 void _drawPoints(bool color = false); 00067 00068 protected: // data 00069 float *m_pos; 00070 int m_numParticles; 00071 00072 float m_pointSize; 00073 float m_spriteSize; 00074 00075 unsigned int m_vertexShader; 00076 unsigned int m_pixelShader; 00077 unsigned int m_program; 00078 unsigned int m_texture; 00079 unsigned int m_pbo; 00080 unsigned int m_vboColor; 00081 }; 00082 } 00083 #endif // EQNBODY_RENDER_PARTICLES_H
0.9 by
1.5.8