Showing the changes to interface/src/ParticleTreeRenderer.cpp (1 of 2 files). Show all
Unified · Split
| @@ -72,7 +72,7 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 71 unmodified lines | |||
| 72 | // render particle aspoints | 72 | // render particle aspoints |
| 73 | glm::vec3 position = particle.getPosition() * (float)TREE_SCALE; | 73 | glm::vec3 position = particle.getPosition() * (float)TREE_SCALE; |
| 74 | glColor3ub(particle.getColor()[RED_INDEX],particle.getColor()[GREEN_INDEX],particle.getColor()[BLUE_INDEX]); | 74 | glColor3ub(particle.getColor()[RED_INDEX],particle.getColor()[GREEN_INDEX],particle.getColor()[BLUE_INDEX]); |
| 75 | float sphereRadius = particle.getRadius() * (float)TREE_SCALE; | 75 | float radius = particle.getRadius() * (float)TREE_SCALE; |
| 76 | 76 | ||
| 77 | bool drawAsModel = particle.hasModel(); | 77 | bool drawAsModel = particle.hasModel(); |
| 78 | 78 | ||
| @@ -90,24 +90,24 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 11 unmodified lines | |||
| 90 | glm::vec3 translation(position.x, position.y, position.z); | 90 | glm::vec3 translation(position.x, position.y, position.z); |
| 91 | model->setTranslation(translation + translationAdjustment); | 91 | model->setTranslation(translation + translationAdjustment); |
| 92 | 92 | ||
| 93 | // glm::angleAxis(-90.0f, 1.0f, 0.0f, 0.0f) | ||
| 94 | // set the rotation | 93 | // set the rotation |
| 95 | glm::quat rotation = particle.getModelRotation(); | 94 | glm::quat rotation = particle.getModelRotation(); |
| 96 | model->setRotation(rotation); | 95 | model->setRotation(rotation); |
| 97 | 96 | ||
| 98 | // scale | 97 | // scale |
| 99 | const float MODEL_SCALE = 0.0006f; // need to figure out correct scale adjust | 98 | // TODO: need to figure out correct scale adjust, this was arbitrarily set to make a couple models work |
| 99 | const float MODEL_SCALE = 0.00575f; | ||
| 100 | glm::vec3 scale(1.0f,1.0f,1.0f); | 100 | glm::vec3 scale(1.0f,1.0f,1.0f); |
| 101 | model->setScale(scale * MODEL_SCALE); | 101 | model->setScale(scale * MODEL_SCALE * radius * particle.getModelScale()); |
| 102 | 102 | ||
| 103 | model->simulate(0.0f); | 103 | model->simulate(0.0f); |
| 104 | model->render(alpha); | 104 | model->render(alpha); // TODO: should we allow particles to have alpha on their models? |
| 105 | //qDebug() << "called _testModel->render(alpha);"; | 105 | |
| 106 | glPopMatrix(); | 106 | glPopMatrix(); |
| 107 | } else { | 107 | } else { |
| 108 | glPushMatrix(); | 108 | glPushMatrix(); |
| 109 | glTranslatef(position.x, position.y, position.z); | 109 | glTranslatef(position.x, position.y, position.z); |
| 110 | glutSolidSphere(sphereRadius, 15, 15); | 110 | glutSolidSphere(radius, 15, 15); |
| 111 | glPopMatrix(); | 111 | glPopMatrix(); |
| 112 | } | 112 | } |
| 113 | } | 113 | } |