History

include particle radius in model scaling

ZappoMan committed 12 years ago

Commit 64afd171 parent dc258682 files · +13 −11Browse files

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

Unified · Split

interface/src/ParticleTreeRenderer.cpp+7−7
@@ -72,7 +72,7 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 71 unmodified lines
7272 // render particle aspoints
7373 glm::vec3 position = particle.getPosition() * (float)TREE_SCALE;
7474 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;
7676
7777 bool drawAsModel = particle.hasModel();
7878
@@ -90,24 +90,24 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg · 11 unmodified lines
9090 glm::vec3 translation(position.x, position.y, position.z);
9191 model->setTranslation(translation + translationAdjustment);
9292
93− // glm::angleAxis(-90.0f, 1.0f, 0.0f, 0.0f)
9493 // set the rotation
9594 glm::quat rotation = particle.getModelRotation();
9695 model->setRotation(rotation);
9796
9897 // 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;
100100 glm::vec3 scale(1.0f,1.0f,1.0f);
101− model->setScale(scale * MODEL_SCALE);
101+ model->setScale(scale * MODEL_SCALE * radius * particle.getModelScale());
102102
103103 model->simulate(0.0f);
104− model->render(alpha);
105− //qDebug() << "called _testModel->render(alpha);";
104+ model->render(alpha); // TODO: should we allow particles to have alpha on their models?
105+
106106 glPopMatrix();
107107 } else {
108108 glPushMatrix();
109109 glTranslatef(position.x, position.y, position.z);
110− glutSolidSphere(sphereRadius, 15, 15);
110+ glutSolidSphere(radius, 15, 15);
111111 glPopMatrix();
112112 }
113113 }

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