mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 09:23:17 +02:00
initial add of ModelEntityItem::_shapeType
This commit is contained in:
parent
a233551ec3
commit
12543cae75
4 changed files with 13 additions and 15 deletions
|
@ -282,6 +282,7 @@ public:
|
|||
void updateIgnoreForCollisions(bool value);
|
||||
void updateCollisionsWillMove(bool value);
|
||||
void updateLifetime(float value);
|
||||
virtual void updateShapeType(ShapeType type) { /* do nothing */ }
|
||||
|
||||
uint32_t getDirtyFlags() const { return _dirtyFlags; }
|
||||
void clearDirtyFlags(uint32_t mask = 0xffff) { _dirtyFlags &= ~mask; }
|
||||
|
|
|
@ -91,6 +91,7 @@ enum EntityPropertyList {
|
|||
PROP_TEXT = PROP_MODEL_URL,
|
||||
PROP_LINE_HEIGHT = PROP_ANIMATION_URL,
|
||||
PROP_BACKGROUND_COLOR = PROP_ANIMATION_FPS,
|
||||
PROP_SHAPE_TYPE,
|
||||
};
|
||||
|
||||
typedef PropertyFlags<EntityPropertyList> EntityPropertyFlags;
|
||||
|
|
|
@ -245,20 +245,6 @@ bool ModelEntityItem::needsToCallUpdate() const {
|
|||
return isAnimatingSomething() ? true : EntityItem::needsToCallUpdate();
|
||||
}
|
||||
|
||||
ShapeType ModelEntityItem::getShapeType() 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());
|
||||
ShapeType shapeType = SHAPE_TYPE_NONE;
|
||||
if (diagonal < MAX_SIZE_FOR_BOXIFICATION_HACK) {
|
||||
shapeType = SHAPE_TYPE_BOX;
|
||||
}
|
||||
return shapeType;
|
||||
}
|
||||
|
||||
void ModelEntityItem::update(const quint64& now) {
|
||||
// only advance the frame index if we're playing
|
||||
if (getAnimationIsPlaying()) {
|
||||
|
@ -279,6 +265,13 @@ void ModelEntityItem::debugDump() const {
|
|||
qDebug() << " model URL:" << getModelURL();
|
||||
}
|
||||
|
||||
void ModelEntityItem::updateShapeType(ShapeType type) {
|
||||
if (type != _shapeType) {
|
||||
_shapeType = type;
|
||||
_dirtyFlags |= EntityItem::DIRTY_SHAPE;
|
||||
}
|
||||
}
|
||||
|
||||
void ModelEntityItem::setAnimationURL(const QString& url) {
|
||||
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||
_animationURL = url;
|
||||
|
|
|
@ -46,9 +46,11 @@ public:
|
|||
|
||||
virtual void update(const quint64& now);
|
||||
virtual bool needsToCallUpdate() const;
|
||||
ShapeType getShapeType() const;
|
||||
virtual void debugDump() const;
|
||||
|
||||
void updateShapeType(ShapeType type);
|
||||
ShapeType getShapeType() const { return _shapeType; }
|
||||
|
||||
|
||||
// TODO: Move these to subclasses, or other appropriate abstraction
|
||||
// getters/setters applicable to models and particles
|
||||
|
@ -126,6 +128,7 @@ protected:
|
|||
AnimationLoop _animationLoop;
|
||||
QString _animationSettings;
|
||||
QString _textures;
|
||||
ShapeType _shapeType = SHAPE_TYPE_NONE;
|
||||
|
||||
// used on client side
|
||||
bool _jointMappingCompleted;
|
||||
|
|
Loading…
Reference in a new issue