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
84 const float alpha = 1.0f;84 const float alpha = 1.0f;
85 85
86 Model* model = getModel(particle.getModelURL());86 Model* model = getModel(particle.getModelURL());
87 87 glm::vec3 translationAdjustment = particle.getModelTranslation() * radius;
88 glm::vec3 translationAdjustment = particle.getModelTranslation();88
89
90 // set the position89 // set the position
91 glm::vec3 translation(position.x, position.y, position.z);90 glm::vec3 translation = position + translationAdjustment;
92 model->setTranslation(translation + translationAdjustment);91 model->setTranslation(translation);
93 92
94 // set the rotation93 // set the rotation
95 glm::quat rotation = particle.getModelRotation();94 glm::quat rotation = particle.getModelRotation();
@@ -100,14 +99,20 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 4 unmodified lines
100 const float MODEL_SCALE = 0.00575f;99 const float MODEL_SCALE = 0.00575f;
101 glm::vec3 scale(1.0f,1.0f,1.0f);100 glm::vec3 scale(1.0f,1.0f,1.0f);
102 101
103 // TODO: There is some kind of a bug in packing of the particle packets which is causing modelscale to102 float modelScale = particle.getModelScale();
104 // sometimes be garbage.
105 float modelScale = 2.0f; /// particle.getModelScale()
106 model->setScale(scale * MODEL_SCALE * radius * modelScale);103 model->setScale(scale * MODEL_SCALE * radius * modelScale);
107 104
108 model->simulate(0.0f);105 model->simulate(0.0f);
109 model->render(alpha); // TODO: should we allow particles to have alpha on their models?106 model->render(alpha); // TODO: should we allow particles to have alpha on their models?
110 107
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
111 glPopMatrix();116 glPopMatrix();
112 } else {117 } else {
113 glPushMatrix();118 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