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
2727
2828 uint16_t numberOfParticles = particles.size();
2929
30− glPointSize(20.0f);
31− glBegin(GL_POINTS);
30+ bool drawAsSphere = true;
31+
32+ if (!drawAsSphere) {
33+ glPointSize(20.0f);
34+ glBegin(GL_POINTS);
35+ }
36+
3237 for (uint16_t i = 0; i < numberOfParticles; i++) {
3338 const Particle& particle = particles[i];
3439 // render particle aspoints
3540 glm::vec3 position = particle.getPosition() * (float)TREE_SCALE;
3641
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]);
3843
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();
4058 }
41− glEnd();
4259 }