Make ::contains() back into a const

This commit is contained in:
Atlante45 2015-04-23 19:15:06 +02:00
parent b340cd06bf
commit b776ea8110
7 changed files with 8 additions and 8 deletions

View file

@ -324,7 +324,7 @@ void EntityTreeRenderer::checkEnterLeaveEntities() {
// create a list of entities that actually contain the avatar's position
foreach(const EntityItem* entity, foundEntities) {
if (const_cast<EntityItem*>(entity)->contains(avatarPosition)) {
if (entity->contains(avatarPosition)) {
entitiesContainingAvatar << entity->getEntityItemID();
}
}

View file

@ -415,7 +415,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
}
}
bool RenderableModelEntityItem::contains(const glm::vec3& point) {
bool RenderableModelEntityItem::contains(const glm::vec3& point) const {
if (EntityItem::contains(point) && _model && _model->getCollisionGeometry()) {
const QSharedPointer<NetworkGeometry> collisionNetworkGeometry = _model->getCollisionGeometry();
const FBXGeometry& collisionGeometry = collisionNetworkGeometry->getFBXGeometry();

View file

@ -57,7 +57,7 @@ public:
bool isReadyToComputeShape();
void computeShapeInfo(ShapeInfo& info);
virtual bool contains(const glm::vec3& point);
virtual bool contains(const glm::vec3& point) const;
private:
void remapTextures();

View file

@ -39,12 +39,12 @@ int RenderableZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned ch
return bytesRead;
}
bool RenderableZoneEntityItem::contains(const glm::vec3& point) {
bool RenderableZoneEntityItem::contains(const glm::vec3& point) const {
if (getShapeType() != SHAPE_TYPE_COMPOUND) {
return EntityItem::contains(point);
}
if (!_compoundShapeModel && hasCompoundShapeURL()) {
_compoundShapeModel = DependencyManager::get<GeometryCache>()->getGeometry(getCompoundShapeURL(), QUrl(), true);
const_cast<RenderableZoneEntityItem*>(this)->_compoundShapeModel = DependencyManager::get<GeometryCache>()->getGeometry(getCompoundShapeURL(), QUrl(), true);
}
if (EntityItem::contains(point) && _compoundShapeModel && _compoundShapeModel->isLoaded()) {

View file

@ -29,7 +29,7 @@ public:
ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData);
virtual bool contains(const glm::vec3& point);
virtual bool contains(const glm::vec3& point) const;
private:

View file

@ -1082,7 +1082,7 @@ float EntityItem::getRadius() const {
return 0.5f * glm::length(_dimensions);
}
bool EntityItem::contains(const glm::vec3& point) {
bool EntityItem::contains(const glm::vec3& point) const {
if (getShapeType() == SHAPE_TYPE_COMPOUND) {
return getAABox().contains(point);
} else {

View file

@ -253,7 +253,7 @@ public:
// TODO: get rid of users of getRadius()...
float getRadius() const;
virtual bool contains(const glm::vec3& point);
virtual bool contains(const glm::vec3& point) const;
virtual bool isReadyToComputeShape() { return true; }
virtual void computeShapeInfo(ShapeInfo& info);