mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
enforce dimensions for Light and Text entities
This commit is contained in:
parent
2bf93bd9f0
commit
cf98bff28b
5 changed files with 21 additions and 1 deletions
|
@ -160,7 +160,7 @@ public:
|
||||||
float getLargestDimension() const { return glm::length(_dimensions); } /// get the largest possible dimension
|
float getLargestDimension() const { return glm::length(_dimensions); } /// get the largest possible dimension
|
||||||
|
|
||||||
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
||||||
void setDimensions(const glm::vec3& value) { _dimensions = value; recalculateCollisionShape(); }
|
virtual void setDimensions(const glm::vec3& value) { _dimensions = value; recalculateCollisionShape(); }
|
||||||
|
|
||||||
/// set dimensions in meter units (0.0 - TREE_SCALE) this will also reset radius appropriately
|
/// set dimensions in meter units (0.0 - TREE_SCALE) this will also reset radius appropriately
|
||||||
void setDimensionsInMeters(const glm::vec3& value) { setDimensions(value / (float) TREE_SCALE); }
|
void setDimensionsInMeters(const glm::vec3& value) { setDimensions(value / (float) TREE_SCALE); }
|
||||||
|
|
|
@ -47,6 +47,13 @@ LightEntityItem::LightEntityItem(const EntityItemID& entityItemID, const EntityI
|
||||||
_emptyShape.setRadius(0.0f);
|
_emptyShape.setRadius(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LightEntityItem::setDimensions(const glm::vec3& value) {
|
||||||
|
float maxDimension = glm::max(value.x, value.y, value.z);
|
||||||
|
_dimensions = glm::vec3(maxDimension, maxDimension, maxDimension);
|
||||||
|
recalculateCollisionShape();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityItemProperties LightEntityItem::getProperties() const {
|
EntityItemProperties LightEntityItem::getProperties() const {
|
||||||
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
|
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ public:
|
||||||
LightEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
|
LightEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
ALLOW_INSTANTIATION // This class can be instantiated
|
ALLOW_INSTANTIATION // This class can be instantiated
|
||||||
|
|
||||||
|
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
||||||
|
virtual void setDimensions(const glm::vec3& value);
|
||||||
|
|
||||||
// methods for getting/setting all properties of an entity
|
// methods for getting/setting all properties of an entity
|
||||||
virtual EntityItemProperties getProperties() const;
|
virtual EntityItemProperties getProperties() const;
|
||||||
|
|
|
@ -40,6 +40,13 @@ TextEntityItem::TextEntityItem(const EntityItemID& entityItemID, const EntityIte
|
||||||
setProperties(properties, true);
|
setProperties(properties, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextEntityItem::setDimensions(const glm::vec3& value) {
|
||||||
|
// NOTE: Text Entities always have a "depth" of 1cm.
|
||||||
|
float fixedDepth = 0.01f / (float)TREE_SCALE;
|
||||||
|
_dimensions = glm::vec3(value.x, value.y, fixedDepth);
|
||||||
|
recalculateCollisionShape();
|
||||||
|
}
|
||||||
|
|
||||||
EntityItemProperties TextEntityItem::getProperties() const {
|
EntityItemProperties TextEntityItem::getProperties() const {
|
||||||
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
|
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ public:
|
||||||
TextEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
|
TextEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
ALLOW_INSTANTIATION // This class can be instantiated
|
ALLOW_INSTANTIATION // This class can be instantiated
|
||||||
|
|
||||||
|
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
||||||
|
virtual void setDimensions(const glm::vec3& value);
|
||||||
|
|
||||||
// methods for getting/setting all properties of an entity
|
// methods for getting/setting all properties of an entity
|
||||||
virtual EntityItemProperties getProperties() const;
|
virtual EntityItemProperties getProperties() const;
|
||||||
|
|
Loading…
Reference in a new issue