mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 22:42:31 +02:00
fix non-procedural material entity crash
This commit is contained in:
parent
b73a608094
commit
2eb0ec18fc
5 changed files with 11 additions and 10 deletions
|
@ -2107,7 +2107,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
}
|
||||
return false;
|
||||
});
|
||||
EntityTree::setGetUnscaledDimensionsForEntityIDOperator([this](const QUuid& id) {
|
||||
EntityTree::setGetUnscaledDimensionsForIDOperator([this](const QUuid& id) {
|
||||
if (_aboutToQuit) {
|
||||
return glm::vec3(1.0f);
|
||||
}
|
||||
|
|
|
@ -396,7 +396,8 @@ void MaterialEntityRenderer::applyMaterial(const TypedEntityPointer& entity) {
|
|||
|
||||
graphics::MaterialLayer materialLayer = graphics::MaterialLayer(material, _priority);
|
||||
|
||||
if (auto procedural = std::static_pointer_cast<graphics::ProceduralMaterial>(material)) {
|
||||
if (material->isProcedural()) {
|
||||
auto procedural = std::static_pointer_cast<graphics::ProceduralMaterial>(material);
|
||||
procedural->setBoundOperator([this] { return getBound(); });
|
||||
entity->setHasVertexShader(procedural->hasVertexShader());
|
||||
}
|
||||
|
|
|
@ -3154,7 +3154,7 @@ std::function<QObject*(const QUuid&)> EntityTree::_getEntityObjectOperator = nul
|
|||
std::function<QSizeF(const QUuid&, const QString&)> EntityTree::_textSizeOperator = nullptr;
|
||||
std::function<bool()> EntityTree::_areEntityClicksCapturedOperator = nullptr;
|
||||
std::function<void(const QUuid&, const QVariant&)> EntityTree::_emitScriptEventOperator = nullptr;
|
||||
std::function<glm::vec3(const QUuid&)> EntityTree::_getUnscaledDimensionsForEntityIDOperator = nullptr;
|
||||
std::function<glm::vec3(const QUuid&)> EntityTree::_getUnscaledDimensionsForIDOperator = nullptr;
|
||||
|
||||
QObject* EntityTree::getEntityObject(const QUuid& id) {
|
||||
if (_getEntityObjectOperator) {
|
||||
|
@ -3183,9 +3183,9 @@ void EntityTree::emitScriptEvent(const QUuid& id, const QVariant& message) {
|
|||
}
|
||||
}
|
||||
|
||||
glm::vec3 EntityTree::getUnscaledDimensionsForEntityID(const QUuid& id) {
|
||||
if (_getUnscaledDimensionsForEntityIDOperator) {
|
||||
return _getUnscaledDimensionsForEntityIDOperator(id);
|
||||
glm::vec3 EntityTree::getUnscaledDimensionsForID(const QUuid& id) {
|
||||
if (_getUnscaledDimensionsForIDOperator) {
|
||||
return _getUnscaledDimensionsForIDOperator(id);
|
||||
}
|
||||
return glm::vec3(1.0f);
|
||||
}
|
||||
|
|
|
@ -273,8 +273,8 @@ public:
|
|||
static void setEmitScriptEventOperator(std::function<void(const QUuid&, const QVariant&)> emitScriptEventOperator) { _emitScriptEventOperator = emitScriptEventOperator; }
|
||||
static void emitScriptEvent(const QUuid& id, const QVariant& message);
|
||||
|
||||
static void setGetUnscaledDimensionsForEntityIDOperator(std::function<glm::vec3(const QUuid&)> getUnscaledDimensionsForEntityIDOperator) { _getUnscaledDimensionsForEntityIDOperator = getUnscaledDimensionsForEntityIDOperator; }
|
||||
static glm::vec3 getUnscaledDimensionsForEntityID(const QUuid& id);
|
||||
static void setGetUnscaledDimensionsForIDOperator(std::function<glm::vec3(const QUuid&)> getUnscaledDimensionsForIDOperator) { _getUnscaledDimensionsForIDOperator = getUnscaledDimensionsForIDOperator; }
|
||||
static glm::vec3 getUnscaledDimensionsForID(const QUuid& id);
|
||||
|
||||
std::map<QString, QString> getNamedPaths() const { return _namedPaths; }
|
||||
|
||||
|
@ -392,7 +392,7 @@ private:
|
|||
static std::function<QSizeF(const QUuid&, const QString&)> _textSizeOperator;
|
||||
static std::function<bool()> _areEntityClicksCapturedOperator;
|
||||
static std::function<void(const QUuid&, const QVariant&)> _emitScriptEventOperator;
|
||||
static std::function<glm::vec3(const QUuid&)> _getUnscaledDimensionsForEntityIDOperator;
|
||||
static std::function<glm::vec3(const QUuid&)> _getUnscaledDimensionsForIDOperator;
|
||||
|
||||
std::vector<int32_t> _staleProxies;
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ void MaterialEntityItem::setHasVertexShader(bool hasVertexShader) {
|
|||
if (hasVertexShader && !prevHasVertexShader) {
|
||||
setLocalPosition(glm::vec3(0.0f));
|
||||
setLocalOrientation(glm::quat());
|
||||
setUnscaledDimensions(EntityTree::getUnscaledDimensionsForEntityID(getParentID()));
|
||||
setUnscaledDimensions(EntityTree::getUnscaledDimensionsForID(getParentID()));
|
||||
} else if (!hasVertexShader && prevHasVertexShader) {
|
||||
setUnscaledDimensions(_desiredDimensions);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue