mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
what about...this
This commit is contained in:
parent
9142b7123d
commit
44b34e0341
4 changed files with 13 additions and 19 deletions
|
@ -51,12 +51,6 @@ ModelPointer ModelEntityWrapper::getModel() const {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelEntityWrapper::isModelLoaded() const {
|
|
||||||
return resultWithReadLock<bool>([&] {
|
|
||||||
return _model && _model->isLoaded();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
EntityItemPointer entity(new RenderableModelEntityItem(entityID, properties.getDimensionsInitialized()),
|
EntityItemPointer entity(new RenderableModelEntityItem(entityID, properties.getDimensionsInitialized()),
|
||||||
[](EntityItem* ptr) { ptr->deleteLater(); });
|
[](EntityItem* ptr) { ptr->deleteLater(); });
|
||||||
|
@ -261,7 +255,7 @@ bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& ori
|
||||||
OctreeElementPointer& element, float& distance, BoxFace& face,
|
OctreeElementPointer& element, float& distance, BoxFace& face,
|
||||||
glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const {
|
glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const {
|
||||||
auto model = getModel();
|
auto model = getModel();
|
||||||
if (!model || !isModelLoaded()) {
|
if (!model || !model->isLoaded()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +267,7 @@ bool RenderableModelEntityItem::findDetailedParabolaIntersection(const glm::vec3
|
||||||
const glm::vec3& acceleration, OctreeElementPointer& element, float& parabolicDistance, BoxFace& face,
|
const glm::vec3& acceleration, OctreeElementPointer& element, float& parabolicDistance, BoxFace& face,
|
||||||
glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const {
|
glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const {
|
||||||
auto model = getModel();
|
auto model = getModel();
|
||||||
if (!model || !isModelLoaded()) {
|
if (!model || !model->isLoaded()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +303,8 @@ void RenderableModelEntityItem::setCompoundShapeURL(const QString& url) {
|
||||||
auto currentCompoundShapeURL = getCompoundShapeURL();
|
auto currentCompoundShapeURL = getCompoundShapeURL();
|
||||||
ModelEntityItem::setCompoundShapeURL(url);
|
ModelEntityItem::setCompoundShapeURL(url);
|
||||||
if (getCompoundShapeURL() != currentCompoundShapeURL || !getModel()) {
|
if (getCompoundShapeURL() != currentCompoundShapeURL || !getModel()) {
|
||||||
if (getShapeType() == SHAPE_TYPE_COMPOUND) {
|
auto shapeType = getShapeType();
|
||||||
|
if (shapeType == SHAPE_TYPE_COMPOUND || shapeType == SHAPE_TYPE_SIMPLE_COMPOUND) {
|
||||||
fetchCollisionGeometryResource();
|
fetchCollisionGeometryResource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,7 +345,7 @@ bool RenderableModelEntityItem::isReadyToComputeShape() const {
|
||||||
// the model is still being downloaded.
|
// the model is still being downloaded.
|
||||||
return false;
|
return false;
|
||||||
} else if (type >= SHAPE_TYPE_SIMPLE_HULL && type <= SHAPE_TYPE_STATIC_MESH) {
|
} else if (type >= SHAPE_TYPE_SIMPLE_HULL && type <= SHAPE_TYPE_STATIC_MESH) {
|
||||||
return isModelLoaded();
|
return model && model->isLoaded();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1110,7 +1105,7 @@ void ModelEntityRenderer::animate(const TypedEntityPointer& entity, const ModelP
|
||||||
|
|
||||||
QVector<EntityJointData> jointsData;
|
QVector<EntityJointData> jointsData;
|
||||||
|
|
||||||
const QVector<HFMAnimationFrame>& frames = _animation->getFramesReference(); // NOTE: getFrames() is too heavy
|
const QVector<HFMAnimationFrame>& frames = _animation->getFramesReference(); // NOTE: getFrames() is too heavy
|
||||||
int frameCount = frames.size();
|
int frameCount = frames.size();
|
||||||
if (frameCount <= 0) {
|
if (frameCount <= 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -1203,8 +1198,9 @@ void ModelEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint
|
||||||
DETAILED_PROFILE_RANGE(simulation_physics, __FUNCTION__);
|
DETAILED_PROFILE_RANGE(simulation_physics, __FUNCTION__);
|
||||||
|
|
||||||
_hasModel = entity->hasModel();
|
_hasModel = entity->hasModel();
|
||||||
if (_parsedModelURL != entity->getModelURL()) {
|
QUrl modelURL = QUrl(entity->getModelURL());
|
||||||
_parsedModelURL = QUrl(entity->getModelURL());
|
if (_parsedModelURL != modelURL) {
|
||||||
|
_parsedModelURL = modelURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPointer model = resultWithReadLock<ModelPointer>([&] {
|
ModelPointer model = resultWithReadLock<ModelPointer>([&] {
|
||||||
|
@ -1248,6 +1244,7 @@ void ModelEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint
|
||||||
_model->setPrimitiveMode(_primitiveMode, scene);
|
_model->setPrimitiveMode(_primitiveMode, scene);
|
||||||
_model->setCullWithParent(_cullWithParent, scene);
|
_model->setCullWithParent(_cullWithParent, scene);
|
||||||
_model->setRenderWithZones(_renderWithZones, scene);
|
_model->setRenderWithZones(_renderWithZones, scene);
|
||||||
|
entity->markDirtyFlags(Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
||||||
entity->locationChanged();
|
entity->locationChanged();
|
||||||
entity->dimensionsChanged();
|
entity->dimensionsChanged();
|
||||||
});
|
});
|
||||||
|
@ -1259,6 +1256,7 @@ void ModelEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint
|
||||||
entity->_originalTexturesRead = false;
|
entity->_originalTexturesRead = false;
|
||||||
entity->_needsJointSimulation = true;
|
entity->_needsJointSimulation = true;
|
||||||
entity->_needsToRescaleModel = true;
|
entity->_needsToRescaleModel = true;
|
||||||
|
entity->updateModelBounds();
|
||||||
emit requestRenderUpdate();
|
emit requestRenderUpdate();
|
||||||
});
|
});
|
||||||
model->setLoadingPriority(EntityTreeRenderer::getEntityLoadingPriority(*entity));
|
model->setLoadingPriority(EntityTreeRenderer::getEntityLoadingPriority(*entity));
|
||||||
|
|
|
@ -41,7 +41,6 @@ protected:
|
||||||
ModelEntityWrapper(const EntityItemID& entityItemID) : Parent(entityItemID) {}
|
ModelEntityWrapper(const EntityItemID& entityItemID) : Parent(entityItemID) {}
|
||||||
void setModel(const ModelPointer& model);
|
void setModel(const ModelPointer& model);
|
||||||
ModelPointer getModel() const;
|
ModelPointer getModel() const;
|
||||||
bool isModelLoaded() const;
|
|
||||||
|
|
||||||
bool _needsInitialSimulation{ true };
|
bool _needsInitialSimulation{ true };
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1911,13 +1911,11 @@ void EntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
||||||
if (glm::length2(getUnscaledDimensions() - newDimensions) > MIN_SCALE_CHANGE_SQUARED) {
|
if (glm::length2(getUnscaledDimensions() - newDimensions) > MIN_SCALE_CHANGE_SQUARED) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_unscaledDimensions = newDimensions;
|
_unscaledDimensions = newDimensions;
|
||||||
});
|
|
||||||
locationChanged();
|
|
||||||
dimensionsChanged();
|
|
||||||
withWriteLock([&] {
|
|
||||||
_flags |= (Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
_flags |= (Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
||||||
_queryAACubeSet = false;
|
_queryAACubeSet = false;
|
||||||
});
|
});
|
||||||
|
locationChanged();
|
||||||
|
dimensionsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,6 @@ void ModelEntityItem::setModelURL(const QString& url) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_modelURL != url) {
|
if (_modelURL != url) {
|
||||||
_modelURL = url;
|
_modelURL = url;
|
||||||
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
|
||||||
_needsRenderUpdate = true;
|
_needsRenderUpdate = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue