mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:37:46 +02:00
use SmartPointer for Zone _model
This commit is contained in:
parent
7b879a7964
commit
bb4d366c40
3 changed files with 20 additions and 25 deletions
|
@ -5348,6 +5348,7 @@ bool Application::nearbyEntitiesAreReadyForPhysics() {
|
|||
qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName();
|
||||
// don't break here because we want all the relevant entities to start their downloads
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -41,10 +41,12 @@ void RenderableZoneEntityItem::changeProperties(Lambda setNewProperties) {
|
|||
|
||||
if (oldShapeURL != getCompoundShapeURL()) {
|
||||
if (_model) {
|
||||
delete _model;
|
||||
_model.reset();
|
||||
}
|
||||
|
||||
_model = getModel();
|
||||
_model = std::make_shared<Model>();
|
||||
_model->setIsWireframe(true);
|
||||
_model->init();
|
||||
_needsInitialSimulation = true;
|
||||
_model->setURL(getCompoundShapeURL());
|
||||
}
|
||||
|
@ -80,13 +82,6 @@ int RenderableZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned ch
|
|||
return bytesRead;
|
||||
}
|
||||
|
||||
Model* RenderableZoneEntityItem::getModel() {
|
||||
Model* model = new Model();
|
||||
model->setIsWireframe(true);
|
||||
model->init();
|
||||
return model;
|
||||
}
|
||||
|
||||
void RenderableZoneEntityItem::initialSimulation() {
|
||||
_model->setScaleToFit(true, getDimensions());
|
||||
_model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
RenderableZoneEntityItem(const EntityItemID& entityItemID) :
|
||||
ZoneEntityItem(entityItemID),
|
||||
_model(NULL),
|
||||
_model(nullptr),
|
||||
_needsInitialSimulation(true)
|
||||
{ }
|
||||
|
||||
|
@ -48,14 +48,13 @@ private:
|
|||
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
||||
void notifyBoundChanged();
|
||||
|
||||
Model* getModel();
|
||||
void initialSimulation();
|
||||
void updateGeometry();
|
||||
|
||||
template<typename Lambda>
|
||||
void changeProperties(Lambda functor);
|
||||
|
||||
Model* _model;
|
||||
ModelPointer _model;
|
||||
bool _needsInitialSimulation;
|
||||
|
||||
render::ItemID _myMetaItem{ render::Item::INVALID_ITEM_ID };
|
||||
|
|
Loading…
Reference in a new issue