mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
5388ed1c4a
3 changed files with 19 additions and 2 deletions
|
@ -148,7 +148,8 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat rotation = getRotation();
|
glm::quat rotation = getRotation();
|
||||||
if (needsToCallUpdate() && _model->isActive()) {
|
bool movingOrAnimating = isMoving() || isAnimatingSomething();
|
||||||
|
if ((movingOrAnimating || _needsInitialSimulation) && _model->isActive()) {
|
||||||
_model->setScaleToFit(true, dimensions);
|
_model->setScaleToFit(true, dimensions);
|
||||||
_model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
_model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
||||||
_model->setRotation(rotation);
|
_model->setRotation(rotation);
|
||||||
|
@ -168,7 +169,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
PerformanceTimer perfTimer("model->render");
|
PerformanceTimer perfTimer("model->render");
|
||||||
// filter out if not needed to render
|
// filter out if not needed to render
|
||||||
if (args && (args->_renderMode == RenderArgs::SHADOW_RENDER_MODE)) {
|
if (args && (args->_renderMode == RenderArgs::SHADOW_RENDER_MODE)) {
|
||||||
if (isMoving() || isAnimatingSomething()) {
|
if (movingOrAnimating) {
|
||||||
_model->renderInScene(alpha, args);
|
_model->renderInScene(alpha, args);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -245,6 +245,21 @@ bool ModelEntityItem::needsToCallUpdate() const {
|
||||||
return isAnimatingSomething() ? true : EntityItem::needsToCallUpdate();
|
return isAnimatingSomething() ? true : EntityItem::needsToCallUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelEntityItem::computeShapeInfo(ShapeInfo& info) const {
|
||||||
|
// HACK: Default first first approximation is to boxify the entity... but only if it is small enough.
|
||||||
|
// The limit here is chosen to something that most avatars could not comfortably fit inside
|
||||||
|
// to prevent houses from getting boxified... we don't want the things inside houses to
|
||||||
|
// collide with a house as if it were a giant solid block.
|
||||||
|
const float MAX_SIZE_FOR_BOXIFICATION_HACK = 3.0f;
|
||||||
|
float diagonal = glm::length(getDimensionsInMeters());
|
||||||
|
if (diagonal < MAX_SIZE_FOR_BOXIFICATION_HACK) {
|
||||||
|
glm::vec3 halfExtents = 0.5f * getDimensionsInMeters();
|
||||||
|
info.setBox(halfExtents);
|
||||||
|
} else {
|
||||||
|
info.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelEntityItem::update(const quint64& now) {
|
void ModelEntityItem::update(const quint64& now) {
|
||||||
// only advance the frame index if we're playing
|
// only advance the frame index if we're playing
|
||||||
if (getAnimationIsPlaying()) {
|
if (getAnimationIsPlaying()) {
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
|
|
||||||
virtual void update(const quint64& now);
|
virtual void update(const quint64& now);
|
||||||
virtual bool needsToCallUpdate() const;
|
virtual bool needsToCallUpdate() const;
|
||||||
|
void computeShapeInfo(ShapeInfo& info) const;
|
||||||
virtual void debugDump() const;
|
virtual void debugDump() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue