mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:17:29 +02:00
materials on client only entities
This commit is contained in:
parent
d8f0cfa89a
commit
bba47ba2b4
4 changed files with 4 additions and 26 deletions
|
@ -18,7 +18,7 @@ bool MaterialEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityP
|
||||||
if (entity->getMaterial() != _drawMaterial) {
|
if (entity->getMaterial() != _drawMaterial) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (entity->getParentID() != _parentID || entity->getClientOnly() != _clientOnly || entity->getOwningAvatarID() != _owningAvatarID) {
|
if (entity->getParentID() != _parentID) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (entity->getMaterialMappingPos() != _materialMappingPos || entity->getMaterialMappingScale() != _materialMappingScale || entity->getMaterialMappingRot() != _materialMappingRot) {
|
if (entity->getMaterialMappingPos() != _materialMappingPos || entity->getMaterialMappingScale() != _materialMappingScale || entity->getMaterialMappingRot() != _materialMappingRot) {
|
||||||
|
@ -31,8 +31,6 @@ void MaterialEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer&
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_drawMaterial = entity->getMaterial();
|
_drawMaterial = entity->getMaterial();
|
||||||
_parentID = entity->getParentID();
|
_parentID = entity->getParentID();
|
||||||
_clientOnly = entity->getClientOnly();
|
|
||||||
_owningAvatarID = entity->getOwningAvatarID();
|
|
||||||
_materialMappingPos = entity->getMaterialMappingPos();
|
_materialMappingPos = entity->getMaterialMappingPos();
|
||||||
_materialMappingScale = entity->getMaterialMappingScale();
|
_materialMappingScale = entity->getMaterialMappingScale();
|
||||||
_materialMappingRot = entity->getMaterialMappingRot();
|
_materialMappingRot = entity->getMaterialMappingRot();
|
||||||
|
@ -102,7 +100,7 @@ void MaterialEntityRenderer::doRender(RenderArgs* args) {
|
||||||
graphics::MaterialPointer drawMaterial;
|
graphics::MaterialPointer drawMaterial;
|
||||||
Transform textureTransform;
|
Transform textureTransform;
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
parentID = _clientOnly ? _owningAvatarID : _parentID;
|
parentID = _parentID;
|
||||||
renderTransform = _renderTransform;
|
renderTransform = _renderTransform;
|
||||||
drawMaterial = _drawMaterial;
|
drawMaterial = _drawMaterial;
|
||||||
textureTransform.setTranslation(glm::vec3(_materialMappingPos, 0));
|
textureTransform.setTranslation(glm::vec3(_materialMappingPos, 0));
|
||||||
|
|
|
@ -32,8 +32,6 @@ private:
|
||||||
ShapeKey getShapeKey() override;
|
ShapeKey getShapeKey() override;
|
||||||
|
|
||||||
QUuid _parentID;
|
QUuid _parentID;
|
||||||
bool _clientOnly;
|
|
||||||
QUuid _owningAvatarID;
|
|
||||||
glm::vec2 _materialMappingPos;
|
glm::vec2 _materialMappingPos;
|
||||||
glm::vec2 _materialMappingScale;
|
glm::vec2 _materialMappingScale;
|
||||||
float _materialMappingRot;
|
float _materialMappingRot;
|
||||||
|
|
|
@ -249,28 +249,12 @@ void MaterialEntityItem::setParentID(const QUuid& parentID) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialEntityItem::setClientOnly(bool clientOnly) {
|
|
||||||
if (getClientOnly() != clientOnly) {
|
|
||||||
removeMaterial();
|
|
||||||
EntityItem::setClientOnly(clientOnly);
|
|
||||||
applyMaterial();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaterialEntityItem::setOwningAvatarID(const QUuid& owningAvatarID) {
|
|
||||||
if (getOwningAvatarID() != owningAvatarID) {
|
|
||||||
removeMaterial();
|
|
||||||
EntityItem::setOwningAvatarID(owningAvatarID);
|
|
||||||
applyMaterial();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaterialEntityItem::removeMaterial() {
|
void MaterialEntityItem::removeMaterial() {
|
||||||
graphics::MaterialPointer material = getMaterial();
|
graphics::MaterialPointer material = getMaterial();
|
||||||
if (!material) {
|
if (!material) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QUuid parentID = getClientOnly() ? getOwningAvatarID() : getParentID();
|
QUuid parentID = getParentID();
|
||||||
if (parentID.isNull()) {
|
if (parentID.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -294,7 +278,7 @@ void MaterialEntityItem::removeMaterial() {
|
||||||
void MaterialEntityItem::applyMaterial() {
|
void MaterialEntityItem::applyMaterial() {
|
||||||
_retryApply = false;
|
_retryApply = false;
|
||||||
graphics::MaterialPointer material = getMaterial();
|
graphics::MaterialPointer material = getMaterial();
|
||||||
QUuid parentID = getClientOnly() ? getOwningAvatarID() : getParentID();
|
QUuid parentID = getParentID();
|
||||||
if (!material || parentID.isNull()) {
|
if (!material || parentID.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,6 @@ public:
|
||||||
|
|
||||||
void setUserData(const QString& userData) override;
|
void setUserData(const QString& userData) override;
|
||||||
void setParentID(const QUuid& parentID) override;
|
void setParentID(const QUuid& parentID) override;
|
||||||
void setClientOnly(bool clientOnly) override;
|
|
||||||
void setOwningAvatarID(const QUuid& owningAvatarID) override;
|
|
||||||
|
|
||||||
void applyMaterial();
|
void applyMaterial();
|
||||||
void removeMaterial();
|
void removeMaterial();
|
||||||
|
|
Loading…
Reference in a new issue