mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +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 updateIgnoreForCollisions(bool value);
|
||||||
void updateCollisionsWillMove(bool value);
|
void updateCollisionsWillMove(bool value);
|
||||||
void updateLifetime(float value);
|
void updateLifetime(float value);
|
||||||
|
virtual void updateShapeType(ShapeType type) { /* do nothing */ }
|
||||||
|
|
||||||
uint32_t getDirtyFlags() const { return _dirtyFlags; }
|
uint32_t getDirtyFlags() const { return _dirtyFlags; }
|
||||||
void clearDirtyFlags(uint32_t mask = 0xffff) { _dirtyFlags &= ~mask; }
|
void clearDirtyFlags(uint32_t mask = 0xffff) { _dirtyFlags &= ~mask; }
|
||||||
|
|
|
@ -91,6 +91,7 @@ enum EntityPropertyList {
|
||||||
PROP_TEXT = PROP_MODEL_URL,
|
PROP_TEXT = PROP_MODEL_URL,
|
||||||
PROP_LINE_HEIGHT = PROP_ANIMATION_URL,
|
PROP_LINE_HEIGHT = PROP_ANIMATION_URL,
|
||||||
PROP_BACKGROUND_COLOR = PROP_ANIMATION_FPS,
|
PROP_BACKGROUND_COLOR = PROP_ANIMATION_FPS,
|
||||||
|
PROP_SHAPE_TYPE,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef PropertyFlags<EntityPropertyList> EntityPropertyFlags;
|
typedef PropertyFlags<EntityPropertyList> EntityPropertyFlags;
|
||||||
|
|
|
@ -245,20 +245,6 @@ bool ModelEntityItem::needsToCallUpdate() const {
|
||||||
return isAnimatingSomething() ? true : EntityItem::needsToCallUpdate();
|
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) {
|
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()) {
|
||||||
|
@ -279,6 +265,13 @@ void ModelEntityItem::debugDump() const {
|
||||||
qDebug() << " model URL:" << getModelURL();
|
qDebug() << " model URL:" << getModelURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelEntityItem::updateShapeType(ShapeType type) {
|
||||||
|
if (type != _shapeType) {
|
||||||
|
_shapeType = type;
|
||||||
|
_dirtyFlags |= EntityItem::DIRTY_SHAPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationURL(const QString& url) {
|
void ModelEntityItem::setAnimationURL(const QString& url) {
|
||||||
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||||
_animationURL = url;
|
_animationURL = url;
|
||||||
|
|
|
@ -46,9 +46,11 @@ public:
|
||||||
|
|
||||||
virtual void update(const quint64& now);
|
virtual void update(const quint64& now);
|
||||||
virtual bool needsToCallUpdate() const;
|
virtual bool needsToCallUpdate() const;
|
||||||
ShapeType getShapeType() const;
|
|
||||||
virtual void debugDump() const;
|
virtual void debugDump() const;
|
||||||
|
|
||||||
|
void updateShapeType(ShapeType type);
|
||||||
|
ShapeType getShapeType() const { return _shapeType; }
|
||||||
|
|
||||||
|
|
||||||
// TODO: Move these to subclasses, or other appropriate abstraction
|
// TODO: Move these to subclasses, or other appropriate abstraction
|
||||||
// getters/setters applicable to models and particles
|
// getters/setters applicable to models and particles
|
||||||
|
@ -126,6 +128,7 @@ protected:
|
||||||
AnimationLoop _animationLoop;
|
AnimationLoop _animationLoop;
|
||||||
QString _animationSettings;
|
QString _animationSettings;
|
||||||
QString _textures;
|
QString _textures;
|
||||||
|
ShapeType _shapeType = SHAPE_TYPE_NONE;
|
||||||
|
|
||||||
// used on client side
|
// used on client side
|
||||||
bool _jointMappingCompleted;
|
bool _jointMappingCompleted;
|
||||||
|
|
Loading…
Reference in a new issue