Skip to content

Commit

Permalink
merged crydalch fork into redpawfx (partview with color/alpha support)
Browse files Browse the repository at this point in the history
This doesn't work yet
  • Loading branch information
redpawfx authored and aselle committed Jan 10, 2012
1 parent 2b1df0a commit 52a8b8c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/tools/partview.cpp
Expand Up @@ -51,6 +51,8 @@ using namespace Partio;
ParticlesData* particles=0;
Camera camera;
ParticleAttribute positionAttr;
ParticleAttribute colorAttr;
ParticleAttribute alphaAttr;
static const double fov=60;

static void render()
Expand Down Expand Up @@ -105,10 +107,21 @@ static void render()
glColor3f(0,0,1);glVertex3f(0,0,0);glVertex3f(0,0,1);
glEnd();

glColor3f(1,1,1);
//glColor3f(1,1,1);
glPointSize(1.5);
glBegin(GL_POINTS);
for(int i=0;i<particles->numParticles();i++){
const float* pos=particles->data<float>(positionAttr,i);
const float* color=particles->data<float>(colorAttr,i);
const float* alpha=particles->data<float>(alphaAttr,i);
if( color[0] + color[1] + color[2] < .01)
{
glColor3f(1,1,1);
}
else
{
glColor4f(color[0],color[1],color[2],alpha[0]);
}
glVertex3f(pos[0],pos[1],pos[2]);
}
glEnd();
Expand Down Expand Up @@ -151,7 +164,7 @@ int main(int argc,char *argv[])
if(particles){
glutInitWindowSize(1024,768);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutCreateWindow("papi view");
glutCreateWindow("partview");
glutDisplayFunc(render);
glutMotionFunc(motionFunc);
glutMouseFunc(mouseFunc);
Expand Down

0 comments on commit 52a8b8c

Please sign in to comment.