mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 23:27:38 +02:00
include particle radius in model scaling
This commit is contained in:
parent
dc25868403
commit
64afd17d14
2 changed files with 13 additions and 11 deletions
|
@ -12,21 +12,23 @@ var count = 0;
|
||||||
var stopAfter = 100;
|
var stopAfter = 100;
|
||||||
|
|
||||||
var modelProperties = {
|
var modelProperties = {
|
||||||
position: { x: 0, y: 1, z: 0 },
|
position: { x: 1, y: 1, z: 1 },
|
||||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||||
gravity: { x: 0, y: 0, z: 0 },
|
gravity: { x: 0, y: 0, z: 0 },
|
||||||
damping: 0,
|
damping: 0,
|
||||||
radius : 0.1,
|
radius : 0.25,
|
||||||
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
||||||
|
lifetime: 20
|
||||||
};
|
};
|
||||||
|
|
||||||
var ballProperties = {
|
var ballProperties = {
|
||||||
position: { x: 0, y: 0.75, z: 0 },
|
position: { x: 1, y: 0.5, z: 1 },
|
||||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||||
gravity: { x: 0, y: 0, z: 0 },
|
gravity: { x: 0, y: 0, z: 0 },
|
||||||
damping: 0,
|
damping: 0,
|
||||||
radius : 0.1,
|
radius : 0.25,
|
||||||
color: { red: 255, green: 0, blue: 0 },
|
color: { red: 255, green: 0, blue: 0 },
|
||||||
|
lifetime: 20
|
||||||
};
|
};
|
||||||
|
|
||||||
var modelParticleID = Particles.addParticle(modelProperties);
|
var modelParticleID = Particles.addParticle(modelProperties);
|
||||||
|
|
|
@ -72,7 +72,7 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg
|
||||||
// render particle aspoints
|
// render particle aspoints
|
||||||
glm::vec3 position = particle.getPosition() * (float)TREE_SCALE;
|
glm::vec3 position = particle.getPosition() * (float)TREE_SCALE;
|
||||||
glColor3ub(particle.getColor()[RED_INDEX],particle.getColor()[GREEN_INDEX],particle.getColor()[BLUE_INDEX]);
|
glColor3ub(particle.getColor()[RED_INDEX],particle.getColor()[GREEN_INDEX],particle.getColor()[BLUE_INDEX]);
|
||||||
float sphereRadius = particle.getRadius() * (float)TREE_SCALE;
|
float radius = particle.getRadius() * (float)TREE_SCALE;
|
||||||
|
|
||||||
bool drawAsModel = particle.hasModel();
|
bool drawAsModel = particle.hasModel();
|
||||||
|
|
||||||
|
@ -90,24 +90,24 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg
|
||||||
glm::vec3 translation(position.x, position.y, position.z);
|
glm::vec3 translation(position.x, position.y, position.z);
|
||||||
model->setTranslation(translation + translationAdjustment);
|
model->setTranslation(translation + translationAdjustment);
|
||||||
|
|
||||||
// glm::angleAxis(-90.0f, 1.0f, 0.0f, 0.0f)
|
|
||||||
// set the rotation
|
// set the rotation
|
||||||
glm::quat rotation = particle.getModelRotation();
|
glm::quat rotation = particle.getModelRotation();
|
||||||
model->setRotation(rotation);
|
model->setRotation(rotation);
|
||||||
|
|
||||||
// scale
|
// scale
|
||||||
const float MODEL_SCALE = 0.0006f; // need to figure out correct scale adjust
|
// TODO: need to figure out correct scale adjust, this was arbitrarily set to make a couple models work
|
||||||
|
const float MODEL_SCALE = 0.00575f;
|
||||||
glm::vec3 scale(1.0f,1.0f,1.0f);
|
glm::vec3 scale(1.0f,1.0f,1.0f);
|
||||||
model->setScale(scale * MODEL_SCALE);
|
model->setScale(scale * MODEL_SCALE * radius * particle.getModelScale());
|
||||||
|
|
||||||
model->simulate(0.0f);
|
model->simulate(0.0f);
|
||||||
model->render(alpha);
|
model->render(alpha); // TODO: should we allow particles to have alpha on their models?
|
||||||
//qDebug() << "called _testModel->render(alpha);";
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
} else {
|
} else {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
glutSolidSphere(sphereRadius, 15, 15);
|
glutSolidSphere(radius, 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue