History

make particles spheres for now

ZappoMan committed 12 years ago

Commit d0944b01 parent 27837702 files · +22 −15Browse files

Showing the changes to interface/src/ParticleTreeRenderer.cpp (1 of 2 files). Show all

Unified · Split

interface/src/ParticleTreeRenderer.cpp+22−5
@@ -27,16 +27,33 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element) { · 26 unmodified lines
27 27
28 uint16_t numberOfParticles = particles.size();28 uint16_t numberOfParticles = particles.size();
29 29
30 glPointSize(20.0f);30 bool drawAsSphere = true;
31 glBegin(GL_POINTS);31
32 if (!drawAsSphere) {
33 glPointSize(20.0f);
34 glBegin(GL_POINTS);
35 }
36
32 for (uint16_t i = 0; i < numberOfParticles; i++) {37 for (uint16_t i = 0; i < numberOfParticles; i++) {
33 const Particle& particle = particles[i];38 const Particle& particle = particles[i];
34 // render particle aspoints39 // render particle aspoints
35 glm::vec3 position = particle.getPosition() * (float)TREE_SCALE;40 glm::vec3 position = particle.getPosition() * (float)TREE_SCALE;
36 41
37 printf("glVertex3f(%f, %f, %f)\n", position.x, position.y, position.z);42 glColor3ub(particle.getColor()[RED_INDEX],particle.getColor()[GREEN_INDEX],particle.getColor()[BLUE_INDEX]);
38 43
39 glVertex3f(position.x, position.y, position.z);44 //printf("particle at... (%f, %f, %f)\n", position.x, position.y, position.z);
45
46 if (drawAsSphere) {
47 float sphereRadius = particle.getRadius() * (float)TREE_SCALE;
48 glPushMatrix();
49 glTranslatef(position.x, position.y, position.z);
50 glutSolidSphere(sphereRadius, 15, 15);
51 glPopMatrix();
52 } else {
53 glVertex3f(position.x, position.y, position.z);
54 }
55 }
56 if (!drawAsSphere) {
57 glEnd();
40 }58 }
41 glEnd();
42}59}