mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
more tweaks to particles with models rendering to make space invaders work
This commit is contained in:
parent
29af3d7833
commit
305e34e834
1 changed files with 13 additions and 8 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue