History

more tweaks to particles with models rendering to make space invaders work

ZappoMan committed 12 years ago

Commit 305e34e1 parent 29af3d71 file · +13 −8Browse files

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

Unified · Split

interface/src/ParticleTreeRenderer.cpp+13−8
@@ -84,12 +84,11 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 83 unmodified lines
8484 const float alpha = 1.0f;
8585
8686 Model* model = getModel(particle.getModelURL());
87−
88− glm::vec3 translationAdjustment = particle.getModelTranslation();
89−
87+ glm::vec3 translationAdjustment = particle.getModelTranslation() * radius;
88+
9089 // set the position
91− glm::vec3 translation(position.x, position.y, position.z);
92− model->setTranslation(translation + translationAdjustment);
90+ glm::vec3 translation = position + translationAdjustment;
91+ model->setTranslation(translation);
9392
9493 // set the rotation
9594 glm::quat rotation = particle.getModelRotation();
@@ -100,14 +99,20 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 4 unmodified lines
10099 const float MODEL_SCALE = 0.00575f;
101100 glm::vec3 scale(1.0f,1.0f,1.0f);
102101
103− // TODO: There is some kind of a bug in packing of the particle packets which is causing modelscale to
104− // sometimes be garbage.
105− float modelScale = 2.0f; /// particle.getModelScale()
102+ float modelScale = particle.getModelScale();
106103 model->setScale(scale * MODEL_SCALE * radius * modelScale);
107104
108105 model->simulate(0.0f);
109106 model->render(alpha); // TODO: should we allow particles to have alpha on their models?
110107
108+ const bool wantDebugSphere = false;
109+ if (wantDebugSphere) {
110+ glPushMatrix();
111+ glTranslatef(position.x, position.y, position.z);
112+ glutWireSphere(radius, 15, 15);
113+ glPopMatrix();
114+ }
115+
111116 glPopMatrix();
112117 } else {
113118 glPushMatrix();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t