From 305e34e834ab03e750be6e7499784b520dd5fcc5 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 4 Feb 2014 20:18:45 -0800 Subject: [PATCH] more tweaks to particles with models rendering to make space invaders work --- interface/src/ParticleTreeRenderer.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/interface/src/ParticleTreeRenderer.cpp b/interface/src/ParticleTreeRenderer.cpp index 7ba714ae93..7a1991ca93 100644 --- a/interface/src/ParticleTreeRenderer.cpp +++ b/interface/src/ParticleTreeRenderer.cpp @@ -84,12 +84,11 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg const float alpha = 1.0f; Model* model = getModel(particle.getModelURL()); - - glm::vec3 translationAdjustment = particle.getModelTranslation(); - + glm::vec3 translationAdjustment = particle.getModelTranslation() * radius; + // set the position - glm::vec3 translation(position.x, position.y, position.z); - model->setTranslation(translation + translationAdjustment); + glm::vec3 translation = position + translationAdjustment; + model->setTranslation(translation); // set the rotation glm::quat rotation = particle.getModelRotation(); @@ -100,14 +99,20 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg const float MODEL_SCALE = 0.00575f; glm::vec3 scale(1.0f,1.0f,1.0f); - // TODO: There is some kind of a bug in packing of the particle packets which is causing modelscale to - // sometimes be garbage. - float modelScale = 2.0f; /// particle.getModelScale() + float modelScale = particle.getModelScale(); model->setScale(scale * MODEL_SCALE * radius * modelScale); model->simulate(0.0f); model->render(alpha); // TODO: should we allow particles to have alpha on their models? + const bool wantDebugSphere = false; + if (wantDebugSphere) { + glPushMatrix(); + glTranslatef(position.x, position.y, position.z); + glutWireSphere(radius, 15, 15); + glPopMatrix(); + } + glPopMatrix(); } else { glPushMatrix();