mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-12 07:23:12 +02:00
reduce locking necessary for render updates
This commit is contained in:
parent
fe900cf55f
commit
7b29f0f718
42 changed files with 853 additions and 607 deletions
|
@ -121,9 +121,6 @@ void SafeLanding::updateTracking() {
|
|||
if (isEntityPhysicsReady(entity) && isVisuallyReady) {
|
||||
entityMapIter = _trackedEntities.erase(entityMapIter);
|
||||
} else {
|
||||
if (!isVisuallyReady) {
|
||||
entity->requestRenderUpdate();
|
||||
}
|
||||
entityMapIter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,12 +128,7 @@ std::shared_ptr<T> make_renderer(const EntityItemPointer& entity) {
|
|||
return std::shared_ptr<T>(new T(entity), [](T* ptr) { ptr->deleteLater(); });
|
||||
}
|
||||
|
||||
EntityRenderer::EntityRenderer(const EntityItemPointer& entity) : _created(entity->getCreated()), _entity(entity) {
|
||||
connect(entity.get(), &EntityItem::requestRenderUpdate, this, [&] {
|
||||
_needsRenderUpdate = true;
|
||||
emit requestRenderUpdate();
|
||||
});
|
||||
}
|
||||
EntityRenderer::EntityRenderer(const EntityItemPointer& entity) : _created(entity->getCreated()), _entity(entity) {}
|
||||
|
||||
EntityRenderer::~EntityRenderer() {}
|
||||
|
||||
|
@ -349,10 +344,6 @@ void EntityRenderer::updateInScene(const ScenePointer& scene, Transaction& trans
|
|||
// Returns true if the item needs to have updateInscene called because of internal rendering
|
||||
// changes (animation, fading, etc)
|
||||
bool EntityRenderer::needsRenderUpdate() const {
|
||||
if (_needsRenderUpdate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isFading()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -365,6 +356,14 @@ bool EntityRenderer::needsRenderUpdate() const {
|
|||
|
||||
// Returns true if the item in question needs to have updateInScene called because of changes in the entity
|
||||
bool EntityRenderer::needsRenderUpdateFromEntity(const EntityItemPointer& entity) const {
|
||||
if (entity->needsRenderUpdate()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!entity->isVisuallyReady()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
auto bound = _entity->getAABox(success);
|
||||
if (success && _bound != bound) {
|
||||
|
@ -403,7 +402,7 @@ void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transa
|
|||
withWriteLock([&] {
|
||||
auto transparent = isTransparent();
|
||||
auto fading = isFading();
|
||||
if (fading || _prevIsTransparent != transparent) {
|
||||
if (fading || _prevIsTransparent != transparent || !entity->isVisuallyReady()) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
if (fading) {
|
||||
|
@ -421,7 +420,7 @@ void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transa
|
|||
setPrimitiveMode(entity->getPrimitiveMode());
|
||||
_canCastShadow = entity->getCanCastShadow();
|
||||
_cauterized = entity->getCauterized();
|
||||
_needsRenderUpdate = false;
|
||||
entity->setNeedsRenderUpdate(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,6 @@ protected:
|
|||
PrimitiveMode _primitiveMode { PrimitiveMode::SOLID };
|
||||
bool _cauterized { false };
|
||||
bool _moving { false };
|
||||
bool _needsRenderUpdate { false };
|
||||
// Only touched on the rendering thread
|
||||
bool _renderUpdateQueued{ false };
|
||||
Transform _renderTransform;
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
using namespace render;
|
||||
using namespace render::entities;
|
||||
|
||||
GizmoEntityRenderer::GizmoEntityRenderer(const EntityItemPointer& entity) : Parent(entity)
|
||||
{
|
||||
}
|
||||
GizmoEntityRenderer::GizmoEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {}
|
||||
|
||||
GizmoEntityRenderer::~GizmoEntityRenderer() {
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
@ -41,22 +39,6 @@ bool GizmoEntityRenderer::isTransparent() const {
|
|||
return Parent::isTransparent() || ringTransparent;
|
||||
}
|
||||
|
||||
bool GizmoEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
bool needsUpdate = resultWithReadLock<bool>([&] {
|
||||
if (_gizmoType != entity->getGizmoType()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_ringProperties != entity->getRingProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
return needsUpdate;
|
||||
}
|
||||
|
||||
void GizmoEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||
bool dirty = false;
|
||||
RingGizmoPropertyGroup ringProperties = entity->getRingProperties();
|
||||
|
|
|
@ -29,7 +29,6 @@ protected:
|
|||
bool isTransparent() const override;
|
||||
|
||||
private:
|
||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
||||
virtual void doRender(RenderArgs* args) override;
|
||||
|
||||
|
|
|
@ -29,42 +29,6 @@ bool GridEntityRenderer::isTransparent() const {
|
|||
return Parent::isTransparent() || _alpha < 1.0f || _pulseProperties.getAlphaMode() != PulseMode::NONE;
|
||||
}
|
||||
|
||||
bool GridEntityRenderer::needsRenderUpdate() const {
|
||||
return Parent::needsRenderUpdate();
|
||||
}
|
||||
|
||||
bool GridEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
bool needsUpdate = resultWithReadLock<bool>([&] {
|
||||
if (_color != entity->getColor()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_alpha != entity->getAlpha()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_followCamera != entity->getFollowCamera()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_majorGridEvery != entity->getMajorGridEvery()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_minorGridEvery != entity->getMinorGridEvery()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pulseProperties != entity->getPulseProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
return needsUpdate;
|
||||
}
|
||||
|
||||
void GridEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
||||
withWriteLock([&] {
|
||||
_color = entity->getColor();
|
||||
|
|
|
@ -29,8 +29,6 @@ protected:
|
|||
bool isTransparent() const override;
|
||||
|
||||
private:
|
||||
virtual bool needsRenderUpdate() const override;
|
||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
||||
virtual void doRender(RenderArgs* args) override;
|
||||
|
||||
|
|
|
@ -41,46 +41,6 @@ bool ImageEntityRenderer::needsRenderUpdate() const {
|
|||
return Parent::needsRenderUpdate();
|
||||
}
|
||||
|
||||
bool ImageEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
bool needsUpdate = resultWithReadLock<bool>([&] {
|
||||
if (_imageURL != entity->getImageURL()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_emissive != entity->getEmissive()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_keepAspectRatio != entity->getKeepAspectRatio()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_billboardMode != entity->getBillboardMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_subImage != entity->getSubImage()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_color != entity->getColor()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_alpha != entity->getAlpha()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pulseProperties != entity->getPulseProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
return needsUpdate;
|
||||
}
|
||||
|
||||
void ImageEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
||||
withWriteLock([&] {
|
||||
auto imageURL = entity->getImageURL();
|
||||
|
|
|
@ -30,7 +30,6 @@ protected:
|
|||
|
||||
private:
|
||||
virtual bool needsRenderUpdate() const override;
|
||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
||||
virtual void doRender(RenderArgs* args) override;
|
||||
|
||||
|
|
|
@ -18,11 +18,6 @@ using namespace render;
|
|||
using namespace render::entities;
|
||||
|
||||
void LightEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||
// Reset the value before reading the data!
|
||||
// otherwise there could be a race condition where the value changes
|
||||
// after we read it but before we reset, and we never see the change
|
||||
entity->resetLightPropertiesChanged();
|
||||
|
||||
auto& lightPayload = *_lightPayload;
|
||||
|
||||
lightPayload.setVisible(_visible);
|
||||
|
@ -69,10 +64,6 @@ Item::Bound LightEntityRenderer::getBound() {
|
|||
return payloadGetBound(_lightPayload);
|
||||
}
|
||||
|
||||
bool LightEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
return entity->lightPropertiesChanged();
|
||||
}
|
||||
|
||||
void LightEntityRenderer::doRender(RenderArgs* args) {
|
||||
_lightPayload->render(args);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ public:
|
|||
LightEntityRenderer(const EntityItemPointer& entity) : Parent(entity) { }
|
||||
|
||||
protected:
|
||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
||||
|
||||
virtual ItemKey getKey() override;
|
||||
|
|
|
@ -26,12 +26,7 @@ void LineEntityRenderer::onRemoveFromSceneTyped(const TypedEntityPointer& entity
|
|||
}
|
||||
}
|
||||
|
||||
bool LineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
return entity->pointsChanged();
|
||||
}
|
||||
|
||||
void LineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||
entity->resetPointsChanged();
|
||||
_linePoints = entity->getLinePoints();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
if (_lineVerticesID == GeometryCache::UNKNOWN_ID) {
|
||||
|
|
|
@ -28,7 +28,6 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void onRemoveFromSceneTyped(const TypedEntityPointer& entity) override;
|
||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
||||
virtual void doRender(RenderArgs* args) override;
|
||||
|
||||
|
|
|
@ -26,37 +26,15 @@ bool MaterialEntityRenderer::needsRenderUpdate() const {
|
|||
|
||||
bool MaterialEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
if (resultWithReadLock<bool>([&] {
|
||||
if (entity->getMaterialMappingMode() != _materialMappingMode) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getMaterialRepeat() != _materialRepeat) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getMaterialMappingPos() != _materialMappingPos || entity->getMaterialMappingScale() != _materialMappingScale || entity->getMaterialMappingRot() != _materialMappingRot) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getTransform() != _transform) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getUnscaledDimensions() != _dimensions) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (entity->getMaterialURL() != _materialURL) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getMaterialData() != _materialData) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getParentMaterialName() != _parentMaterialName) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getParentID() != _parentID) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getPriority() != _priority) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})) {
|
||||
|
|
|
@ -1229,19 +1229,11 @@ bool ModelEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoin
|
|||
return true;
|
||||
}
|
||||
|
||||
if (_parsedModelURL != entity->getModelURL()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// No model to render, early exit
|
||||
if (!_hasModel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_textures != entity->getTextures()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_animating != entity->isAnimatingSomething()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1275,10 +1267,6 @@ bool ModelEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoin
|
|||
model->getRegistrationPoint() != entity->getRegistrationPoint()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (model->isGroupCulled() != entity->getGroupCulled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -64,32 +64,6 @@ ParticleEffectEntityRenderer::ParticleEffectEntityRenderer(const EntityItemPoint
|
|||
});
|
||||
}
|
||||
|
||||
bool ParticleEffectEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
entity->updateQueryAACube();
|
||||
|
||||
if (_emitting != entity->getIsEmitting()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_particleProperties != entity->getParticleProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pulseProperties != entity->getPulseProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_shapeType != entity->getShapeType()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_compoundShapeURL != entity->getCompoundShapeURL()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
||||
auto newParticleProperties = entity->getParticleProperties();
|
||||
if (!newParticleProperties.valid()) {
|
||||
|
|
|
@ -25,8 +25,6 @@ public:
|
|||
ParticleEffectEntityRenderer(const EntityItemPointer& entity);
|
||||
|
||||
protected:
|
||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||
|
||||
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
||||
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
||||
|
||||
|
|
|
@ -75,11 +75,9 @@ ShapeKey PolyLineEntityRenderer::getShapeKey() {
|
|||
}
|
||||
|
||||
bool PolyLineEntityRenderer::needsRenderUpdate() const {
|
||||
bool textureLoadedChanged = resultWithReadLock<bool>([&] {
|
||||
if (resultWithReadLock<bool>([&] {
|
||||
return (!_textureLoaded && _texture && _texture->isLoaded());
|
||||
});
|
||||
|
||||
if (textureLoadedChanged) {
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -91,10 +89,6 @@ bool PolyLineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityP
|
|||
return true;
|
||||
}
|
||||
|
||||
if (_isUVModeStretch != entity->getIsUVModeStretch() || _glow != entity->getGlow() || _faceCamera != entity->getFaceCamera()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Parent::needsRenderUpdateFromTypedEntity(entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1616,20 +1616,6 @@ ShapeKey PolyVoxEntityRenderer::getShapeKey() {
|
|||
}
|
||||
|
||||
bool PolyVoxEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
std::array<QString, 3> xyzTextureURLs{ {
|
||||
entity->getXTextureURL(),
|
||||
entity->getYTextureURL(),
|
||||
entity->getZTextureURL()
|
||||
} };
|
||||
|
||||
if (xyzTextureURLs != _xyzTextureUrls) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (entity->getVoxelVolumeSize() != _lastVoxelVolumeSize) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (entity->voxelToWorldMatrix() != _lastVoxelToWorldMatrix) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,26 +63,11 @@ bool ShapeEntityRenderer::needsRenderUpdate() const {
|
|||
}
|
||||
|
||||
bool ShapeEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
if (_lastUserData != entity->getUserData()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_color != toGlm(entity->getColor())) {
|
||||
return true;
|
||||
}
|
||||
if (_alpha != entity->getAlpha()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_shape != entity->getShape()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_dimensions != entity->getScaledDimensions()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pulseProperties != entity->getPulseProperties()) {
|
||||
if (_lastUserData != entity->getUserData()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,62 +93,10 @@ uint32_t TextEntityRenderer::metaFetchMetaSubItems(ItemIDs& subItems) const {
|
|||
}
|
||||
|
||||
bool TextEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||
if (_text != entity->getText()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_lineHeight != entity->getLineHeight()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_textColor != toGlm(entity->getTextColor())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_textAlpha != entity->getTextAlpha()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_backgroundColor != toGlm(entity->getBackgroundColor())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_backgroundAlpha != entity->getBackgroundAlpha()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_dimensions != entity->getScaledDimensions()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_billboardMode != entity->getBillboardMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_leftMargin != entity->getLeftMargin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_rightMargin != entity->getRightMargin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_topMargin != entity->getTopMargin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_bottomMargin != entity->getBottomMargin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_unlit != entity->getUnlit()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pulseProperties != entity->getPulseProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,42 +111,6 @@ bool WebEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointe
|
|||
return true;
|
||||
}
|
||||
|
||||
if (_color != entity->getColor()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_alpha != entity->getAlpha()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_billboardMode != entity->getBillboardMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_sourceURL != entity->getSourceUrl()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_dpi != entity->getDPI()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_scriptURL != entity->getScriptURL()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_maxFPS != entity->getMaxFPS()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_inputMode != entity->getInputMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pulseProperties != entity->getPulseProperties()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})) {
|
||||
return true;
|
||||
|
|
|
@ -2943,17 +2943,15 @@ bool EntityItem::getVisible() const {
|
|||
}
|
||||
|
||||
void EntityItem::setVisible(bool value) {
|
||||
bool changed = false;
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
if (_visible != value) {
|
||||
changed = true;
|
||||
_visible = value;
|
||||
}
|
||||
changed = _visible != value;
|
||||
_visible = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
if (changed) {
|
||||
bumpAncestorChainRenderableVersion();
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2966,17 +2964,13 @@ bool EntityItem::isVisibleInSecondaryCamera() const {
|
|||
}
|
||||
|
||||
void EntityItem::setIsVisibleInSecondaryCamera(bool value) {
|
||||
bool changed = false;
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
if (_isVisibleInSecondaryCamera != value) {
|
||||
changed = true;
|
||||
_isVisibleInSecondaryCamera = value;
|
||||
}
|
||||
changed = _isVisibleInSecondaryCamera != value;
|
||||
_isVisibleInSecondaryCamera = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
RenderLayer EntityItem::getRenderLayer() const {
|
||||
|
@ -2986,17 +2980,13 @@ RenderLayer EntityItem::getRenderLayer() const {
|
|||
}
|
||||
|
||||
void EntityItem::setRenderLayer(RenderLayer value) {
|
||||
bool changed = false;
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
if (_renderLayer != value) {
|
||||
changed = true;
|
||||
_renderLayer = value;
|
||||
}
|
||||
changed = _renderLayer != value;
|
||||
_renderLayer = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
PrimitiveMode EntityItem::getPrimitiveMode() const {
|
||||
|
@ -3008,15 +2998,11 @@ PrimitiveMode EntityItem::getPrimitiveMode() const {
|
|||
void EntityItem::setPrimitiveMode(PrimitiveMode value) {
|
||||
bool changed = false;
|
||||
withWriteLock([&] {
|
||||
if (_primitiveMode != value) {
|
||||
changed = true;
|
||||
_primitiveMode = value;
|
||||
}
|
||||
changed = _primitiveMode != value;
|
||||
_primitiveMode = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool EntityItem::getCauterized() const {
|
||||
|
@ -3026,17 +3012,13 @@ bool EntityItem::getCauterized() const {
|
|||
}
|
||||
|
||||
void EntityItem::setCauterized(bool value) {
|
||||
bool changed = false;
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
if (_cauterized != value) {
|
||||
changed = true;
|
||||
_cauterized = value;
|
||||
}
|
||||
changed = _cauterized != value;
|
||||
_cauterized = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool EntityItem::getIgnorePickIntersection() const {
|
||||
|
@ -3060,17 +3042,13 @@ bool EntityItem::getCanCastShadow() const {
|
|||
}
|
||||
|
||||
void EntityItem::setCanCastShadow(bool value) {
|
||||
bool changed = false;
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
if (_canCastShadow != value) {
|
||||
changed = true;
|
||||
_canCastShadow = value;
|
||||
}
|
||||
changed = _canCastShadow != value;
|
||||
_canCastShadow = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool EntityItem::isChildOfMyAvatar() const {
|
||||
|
|
|
@ -571,8 +571,10 @@ public:
|
|||
|
||||
bool stillHasMyGrabAction() const;
|
||||
|
||||
bool needsRenderUpdate() const { return _needsRenderUpdate; }
|
||||
void setNeedsRenderUpdate(bool needsRenderUpdate) { _needsRenderUpdate = needsRenderUpdate; }
|
||||
|
||||
signals:
|
||||
void requestRenderUpdate();
|
||||
void spaceUpdate(std::pair<int32_t, glm::vec4> data);
|
||||
|
||||
protected:
|
||||
|
@ -760,6 +762,8 @@ protected:
|
|||
|
||||
QHash<QUuid, EntityDynamicPointer> _grabActions;
|
||||
|
||||
mutable bool _needsRenderUpdate { false };
|
||||
|
||||
private:
|
||||
static std::function<glm::quat(const glm::vec3&, const glm::quat&, BillboardMode, const glm::vec3&)> _getBillboardRotationOperator;
|
||||
static std::function<glm::vec3()> _getPrimaryViewFrustumPositionOperator;
|
||||
|
|
|
@ -46,6 +46,7 @@ bool GizmoEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool ringPropertiesChanged = _ringProperties.setProperties(properties);
|
||||
somethingChanged |= ringPropertiesChanged;
|
||||
_needsRenderUpdate |= ringPropertiesChanged;
|
||||
});
|
||||
|
||||
if (somethingChanged) {
|
||||
|
@ -184,9 +185,13 @@ bool GizmoEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin,
|
|||
}
|
||||
|
||||
void GizmoEntityItem::setGizmoType(GizmoType value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _gizmoType != value;
|
||||
_gizmoType = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
GizmoType GizmoEntityItem::getGizmoType() const {
|
||||
|
|
|
@ -54,6 +54,7 @@ bool GridEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(followCamera, setFollowCamera);
|
||||
|
@ -135,9 +136,13 @@ void GridEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
|
|||
}
|
||||
|
||||
void GridEntityItem::setColor(const glm::u8vec3& color) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _color != color;
|
||||
_color = color;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 GridEntityItem::getColor() const {
|
||||
|
@ -147,9 +152,13 @@ glm::u8vec3 GridEntityItem::getColor() const {
|
|||
}
|
||||
|
||||
void GridEntityItem::setAlpha(float alpha) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float GridEntityItem::getAlpha() const {
|
||||
|
@ -159,9 +168,13 @@ float GridEntityItem::getAlpha() const {
|
|||
}
|
||||
|
||||
void GridEntityItem::setFollowCamera(bool followCamera) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _followCamera != followCamera;
|
||||
_followCamera = followCamera;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool GridEntityItem::getFollowCamera() const {
|
||||
|
@ -171,10 +184,16 @@ bool GridEntityItem::getFollowCamera() const {
|
|||
}
|
||||
|
||||
void GridEntityItem::setMajorGridEvery(uint32_t majorGridEvery) {
|
||||
const uint32_t MAJOR_GRID_EVERY_MIN = 1;
|
||||
majorGridEvery = std::max(majorGridEvery, MAJOR_GRID_EVERY_MIN);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
const uint32_t MAJOR_GRID_EVERY_MIN = 1;
|
||||
_majorGridEvery = std::max(majorGridEvery, MAJOR_GRID_EVERY_MIN);
|
||||
changed = _majorGridEvery != majorGridEvery;
|
||||
_majorGridEvery = majorGridEvery;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
uint32_t GridEntityItem::getMajorGridEvery() const {
|
||||
|
@ -184,10 +203,16 @@ uint32_t GridEntityItem::getMajorGridEvery() const {
|
|||
}
|
||||
|
||||
void GridEntityItem::setMinorGridEvery(float minorGridEvery) {
|
||||
const float MINOR_GRID_EVERY_MIN = 0.01f;
|
||||
minorGridEvery = std::max(minorGridEvery, MINOR_GRID_EVERY_MIN);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
const float MINOR_GRID_EVERY_MIN = 0.01f;
|
||||
_minorGridEvery = std::max(minorGridEvery, MINOR_GRID_EVERY_MIN);
|
||||
changed = _minorGridEvery != minorGridEvery;
|
||||
_minorGridEvery = minorGridEvery;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float GridEntityItem::getMinorGridEvery() const {
|
||||
|
|
|
@ -53,6 +53,7 @@ bool ImageEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(billboardMode, setBillboardMode);
|
||||
|
||||
|
@ -213,9 +214,13 @@ QString ImageEntityItem::getImageURL() const {
|
|||
}
|
||||
|
||||
void ImageEntityItem::setImageURL(const QString& url) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _imageURL != url;
|
||||
_imageURL = url;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool ImageEntityItem::getEmissive() const {
|
||||
|
@ -227,9 +232,13 @@ bool ImageEntityItem::getEmissive() const {
|
|||
}
|
||||
|
||||
void ImageEntityItem::setEmissive(bool emissive) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _emissive != emissive;
|
||||
_emissive = emissive;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool ImageEntityItem::getKeepAspectRatio() const {
|
||||
|
@ -241,9 +250,13 @@ bool ImageEntityItem::getKeepAspectRatio() const {
|
|||
}
|
||||
|
||||
void ImageEntityItem::setKeepAspectRatio(bool keepAspectRatio) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _keepAspectRatio != keepAspectRatio;
|
||||
_keepAspectRatio = keepAspectRatio;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
BillboardMode ImageEntityItem::getBillboardMode() const {
|
||||
|
@ -255,9 +268,13 @@ BillboardMode ImageEntityItem::getBillboardMode() const {
|
|||
}
|
||||
|
||||
void ImageEntityItem::setBillboardMode(BillboardMode value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _billboardMode != value;
|
||||
_billboardMode = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QRect ImageEntityItem::getSubImage() const {
|
||||
|
@ -269,15 +286,23 @@ QRect ImageEntityItem::getSubImage() const {
|
|||
}
|
||||
|
||||
void ImageEntityItem::setSubImage(const QRect& subImage) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _subImage != subImage;
|
||||
_subImage = subImage;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
void ImageEntityItem::setColor(const glm::u8vec3& color) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _color != color;
|
||||
_color = color;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 ImageEntityItem::getColor() const {
|
||||
|
@ -287,9 +312,13 @@ glm::u8vec3 ImageEntityItem::getColor() const {
|
|||
}
|
||||
|
||||
void ImageEntityItem::setAlpha(float alpha) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ImageEntityItem::getAlpha() const {
|
||||
|
|
|
@ -57,16 +57,12 @@ void LightEntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
|||
|
||||
void LightEntityItem::locationChanged(bool tellPhysics, bool tellChildren) {
|
||||
EntityItem::locationChanged(tellPhysics, tellChildren);
|
||||
withWriteLock([&] {
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
|
||||
void LightEntityItem::dimensionsChanged() {
|
||||
EntityItem::dimensionsChanged();
|
||||
withWriteLock([&] {
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,13 +81,14 @@ EntityItemProperties LightEntityItem::getProperties(const EntityPropertyFlags& d
|
|||
|
||||
void LightEntityItem::setFalloffRadius(float value) {
|
||||
value = glm::max(value, 0.0f);
|
||||
if (value == getFalloffRadius()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _falloffRadius != value;
|
||||
_falloffRadius = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
void LightEntityItem::setIsSpotlight(bool value) {
|
||||
|
@ -111,9 +108,10 @@ void LightEntityItem::setIsSpotlight(bool value) {
|
|||
|
||||
withWriteLock([&] {
|
||||
_isSpotlight = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
setScaledDimensions(newDimensions);
|
||||
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
|
||||
void LightEntityItem::setCutoff(float value) {
|
||||
|
@ -133,10 +131,8 @@ void LightEntityItem::setCutoff(float value) {
|
|||
const float width = length * glm::sin(glm::radians(_cutoff));
|
||||
setScaledDimensions(glm::vec3(width, width, length));
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
|
||||
bool LightEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||
|
@ -222,10 +218,13 @@ glm::u8vec3 LightEntityItem::getColor() const {
|
|||
}
|
||||
|
||||
void LightEntityItem::setColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _color != value;
|
||||
_color = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool LightEntityItem::getIsSpotlight() const {
|
||||
|
@ -245,10 +244,13 @@ float LightEntityItem::getIntensity() const {
|
|||
}
|
||||
|
||||
void LightEntityItem::setIntensity(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _intensity != value;
|
||||
_intensity = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float LightEntityItem::getFalloffRadius() const {
|
||||
|
@ -268,10 +270,13 @@ float LightEntityItem::getExponent() const {
|
|||
}
|
||||
|
||||
void LightEntityItem::setExponent(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _exponent != value;
|
||||
_exponent = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float LightEntityItem::getCutoff() const {
|
||||
|
@ -282,10 +287,6 @@ float LightEntityItem::getCutoff() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void LightEntityItem::resetLightPropertiesChanged() {
|
||||
withWriteLock([&] { _lightPropertiesChanged = false; });
|
||||
}
|
||||
|
||||
bool LightEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
OctreeElementPointer& element, float& distance,
|
||||
BoxFace& face, glm::vec3& surfaceNormal,
|
||||
|
|
|
@ -77,9 +77,6 @@ public:
|
|||
virtual void locationChanged(bool tellPhysics, bool tellChildren) override;
|
||||
virtual void dimensionsChanged() override;
|
||||
|
||||
bool lightPropertiesChanged() const { return _lightPropertiesChanged; }
|
||||
void resetLightPropertiesChanged();
|
||||
|
||||
virtual bool supportsDetailedIntersection() const override { return true; }
|
||||
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
OctreeElementPointer& element, float& distance,
|
||||
|
@ -98,8 +95,6 @@ private:
|
|||
float _falloffRadius { DEFAULT_FALLOFF_RADIUS };
|
||||
float _exponent { DEFAULT_EXPONENT };
|
||||
float _cutoff { DEFAULT_CUTOFF };
|
||||
// Dirty flag turn true when either light properties is changing values.
|
||||
bool _lightPropertiesChanged { false };
|
||||
|
||||
static bool _lightsArePickable;
|
||||
};
|
||||
|
|
|
@ -77,8 +77,10 @@ bool LineEntityItem::appendPoint(const glm::vec3& point) {
|
|||
}
|
||||
withWriteLock([&] {
|
||||
_points << point;
|
||||
_pointsChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -97,8 +99,10 @@ bool LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
|||
|
||||
withWriteLock([&] {
|
||||
_points = points;
|
||||
_pointsChanged = true;
|
||||
});
|
||||
|
||||
_needsRenderUpdate = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -154,9 +158,13 @@ glm::u8vec3 LineEntityItem::getColor() const {
|
|||
}
|
||||
|
||||
void LineEntityItem::setColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _color != value;
|
||||
_color = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QVector<glm::vec3> LineEntityItem::getLinePoints() const {
|
||||
|
@ -165,10 +173,4 @@ QVector<glm::vec3> LineEntityItem::getLinePoints() const {
|
|||
result = _points;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
void LineEntityItem::resetPointsChanged() {
|
||||
withWriteLock([&] {
|
||||
_pointsChanged = false;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -61,15 +61,13 @@ class LineEntityItem : public EntityItem {
|
|||
BoxFace& face, glm::vec3& surfaceNormal,
|
||||
QVariantMap& extraInfo,
|
||||
bool precisionPicking) const override { return false; }
|
||||
bool pointsChanged() const { return _pointsChanged; }
|
||||
void resetPointsChanged();
|
||||
|
||||
virtual void debugDump() const override;
|
||||
static const int MAX_POINTS_PER_LINE;
|
||||
|
||||
private:
|
||||
glm::u8vec3 _color;
|
||||
QVector<glm::vec3> _points;
|
||||
bool _pointsChanged { true };
|
||||
};
|
||||
|
||||
#endif // hifi_LineEntityItem_h
|
||||
|
|
|
@ -153,9 +153,13 @@ QString MaterialEntityItem::getMaterialURL() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialURL(const QString& materialURL) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _materialURL != materialURL;
|
||||
_materialURL = materialURL;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString MaterialEntityItem::getMaterialData() const {
|
||||
|
@ -165,9 +169,13 @@ QString MaterialEntityItem::getMaterialData() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialData(const QString& materialData) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _materialData != materialData;
|
||||
_materialData = materialData;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
MaterialMappingMode MaterialEntityItem::getMaterialMappingMode() const {
|
||||
|
@ -177,9 +185,12 @@ MaterialMappingMode MaterialEntityItem::getMaterialMappingMode() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialMappingMode(MaterialMappingMode mode) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _materialMappingMode != mode;
|
||||
_materialMappingMode = mode;
|
||||
});
|
||||
_needsRenderUpdate |= changed;
|
||||
setUnscaledDimensions(_desiredDimensions);
|
||||
}
|
||||
|
||||
|
@ -190,9 +201,13 @@ quint16 MaterialEntityItem::getPriority() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setPriority(quint16 priority) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _priority != priority;
|
||||
_priority = priority;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString MaterialEntityItem::getParentMaterialName() const {
|
||||
|
@ -202,9 +217,13 @@ QString MaterialEntityItem::getParentMaterialName() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setParentMaterialName(const QString& parentMaterialName) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _parentMaterialName != parentMaterialName;
|
||||
_parentMaterialName = parentMaterialName;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::vec2 MaterialEntityItem::getMaterialMappingPos() const {
|
||||
|
@ -214,9 +233,13 @@ glm::vec2 MaterialEntityItem::getMaterialMappingPos() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialMappingPos(const glm::vec2& materialMappingPos) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _materialMappingPos != materialMappingPos;
|
||||
_materialMappingPos = materialMappingPos;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::vec2 MaterialEntityItem::getMaterialMappingScale() const {
|
||||
|
@ -226,9 +249,13 @@ glm::vec2 MaterialEntityItem::getMaterialMappingScale() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialMappingScale(const glm::vec2& materialMappingScale) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _materialMappingScale != materialMappingScale;
|
||||
_materialMappingScale = materialMappingScale;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float MaterialEntityItem::getMaterialMappingRot() const {
|
||||
|
@ -238,9 +265,22 @@ float MaterialEntityItem::getMaterialMappingRot() const {
|
|||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialMappingRot(float materialMappingRot) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _materialMappingRot != materialMappingRot;
|
||||
_materialMappingRot = materialMappingRot;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool MaterialEntityItem::getMaterialRepeat() const {
|
||||
return _materialRepeat;
|
||||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialRepeat(bool value) {
|
||||
_needsRenderUpdate |= _materialRepeat != value;
|
||||
_materialRepeat = value;
|
||||
}
|
||||
|
||||
AACube MaterialEntityItem::calculateInitialQueryAACube(bool& success) {
|
||||
|
|
|
@ -55,8 +55,8 @@ public:
|
|||
MaterialMappingMode getMaterialMappingMode() const;
|
||||
void setMaterialMappingMode(MaterialMappingMode mode);
|
||||
|
||||
bool getMaterialRepeat() const { return _materialRepeat; }
|
||||
void setMaterialRepeat(bool repeat) { _materialRepeat = repeat; }
|
||||
bool getMaterialRepeat() const;
|
||||
void setMaterialRepeat(bool repeat);
|
||||
|
||||
quint16 getPriority() const;
|
||||
void setPriority(quint16 priority);
|
||||
|
|
|
@ -49,9 +49,13 @@ const QString ModelEntityItem::getTextures() const {
|
|||
}
|
||||
|
||||
void ModelEntityItem::setTextures(const QString& textures) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _textures != textures;
|
||||
_textures = textures;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
EntityItemProperties ModelEntityItem::getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const {
|
||||
|
@ -295,6 +299,7 @@ void ModelEntityItem::setModelURL(const QString& url) {
|
|||
if (_modelURL != url) {
|
||||
_modelURL = url;
|
||||
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -575,9 +580,13 @@ bool ModelEntityItem::getRelayParentJoints() const {
|
|||
}
|
||||
|
||||
void ModelEntityItem::setGroupCulled(bool value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _groupCulled != value;
|
||||
_groupCulled = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool ModelEntityItem::getGroupCulled() const {
|
||||
|
|
|
@ -167,211 +167,499 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
|
|||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAlpha(float alpha) {
|
||||
alpha = glm::clamp(alpha, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.gradient.target = glm::clamp(alpha, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
changed = _particleProperties.alpha.gradient.target != alpha;
|
||||
_particleProperties.alpha.gradient.target = alpha;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAlpha() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.alpha.gradient.target;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAlphaStart(float alphaStart) {
|
||||
alphaStart = glm::isnan(alphaStart) ? alphaStart : glm::clamp(alphaStart, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.range.start = glm::isnan(alphaStart) ? alphaStart : glm::clamp(alphaStart, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
changed = _particleProperties.alpha.range.start != alphaStart;
|
||||
_particleProperties.alpha.range.start = alphaStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAlphaStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.alpha.range.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAlphaFinish(float alphaFinish) {
|
||||
alphaFinish = glm::isnan(alphaFinish) ? alphaFinish : glm::clamp(alphaFinish, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.range.finish = glm::isnan(alphaFinish) ? alphaFinish : glm::clamp(alphaFinish, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
changed = _particleProperties.alpha.range.finish != alphaFinish;
|
||||
_particleProperties.alpha.range.finish = alphaFinish;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAlphaFinish() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.alpha.range.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAlphaSpread(float alphaSpread) {
|
||||
alphaSpread = glm::clamp(alphaSpread, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.gradient.spread = glm::clamp(alphaSpread, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
changed = _particleProperties.alpha.gradient.spread != alphaSpread;
|
||||
_particleProperties.alpha.gradient.spread = alphaSpread;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAlphaSpread() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.alpha.gradient.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setLifespan(float lifespan) {
|
||||
lifespan = glm::clamp(lifespan, MINIMUM_LIFESPAN, MAXIMUM_LIFESPAN);
|
||||
if (lifespan != _particleProperties.lifespan) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.lifespan = lifespan;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.lifespan != lifespan;
|
||||
_particleProperties.lifespan = lifespan;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getLifespan() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.lifespan;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitRate(float emitRate) {
|
||||
emitRate = glm::clamp(emitRate, MINIMUM_EMIT_RATE, MAXIMUM_EMIT_RATE);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.rate = glm::clamp(emitRate, MINIMUM_EMIT_RATE, MAXIMUM_EMIT_RATE);
|
||||
changed = _particleProperties.emission.rate != emitRate;
|
||||
_particleProperties.emission.rate = emitRate;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getEmitRate() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.emission.rate;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitSpeed(float emitSpeed) {
|
||||
emitSpeed = glm::clamp(emitSpeed, MINIMUM_EMIT_SPEED, MAXIMUM_EMIT_SPEED);
|
||||
if (emitSpeed != _particleProperties.emission.speed.target) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.speed.target = emitSpeed;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.emission.speed.target != emitSpeed;
|
||||
_particleProperties.emission.speed.target = emitSpeed;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getEmitSpeed() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.emission.speed.target;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setSpeedSpread(float speedSpread) {
|
||||
speedSpread = glm::clamp(speedSpread, MINIMUM_EMIT_SPEED, MAXIMUM_EMIT_SPEED);
|
||||
if (speedSpread != _particleProperties.emission.speed.spread) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.speed.spread = speedSpread;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.emission.speed.spread != speedSpread;
|
||||
_particleProperties.emission.speed.spread = speedSpread;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getSpeedSpread() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.emission.speed.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitOrientation(const glm::quat& emitOrientation_) {
|
||||
auto emitOrientation = glm::normalize(emitOrientation_);
|
||||
if (emitOrientation != _particleProperties.emission.orientation) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.orientation = emitOrientation;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.emission.orientation != emitOrientation;
|
||||
_particleProperties.emission.orientation = emitOrientation;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
glm::quat ParticleEffectEntityItem::getEmitOrientation() const {
|
||||
return resultWithReadLock<glm::quat>([&] {
|
||||
return _particleProperties.emission.orientation;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitDimensions(const glm::vec3& emitDimensions_) {
|
||||
auto emitDimensions = glm::clamp(emitDimensions_, vec3(MINIMUM_EMIT_DIMENSION), vec3(MAXIMUM_EMIT_DIMENSION));
|
||||
if (emitDimensions != _particleProperties.emission.dimensions) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.dimensions = emitDimensions;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.emission.dimensions != emitDimensions;
|
||||
_particleProperties.emission.dimensions = emitDimensions;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getEmitDimensions() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.emission.dimensions;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitRadiusStart(float emitRadiusStart) {
|
||||
emitRadiusStart = glm::clamp(emitRadiusStart, MINIMUM_EMIT_RADIUS_START, MAXIMUM_EMIT_RADIUS_START);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.radiusStart = glm::clamp(emitRadiusStart, MINIMUM_EMIT_RADIUS_START, MAXIMUM_EMIT_RADIUS_START);
|
||||
changed = _particleProperties.radiusStart != emitRadiusStart;
|
||||
_particleProperties.radiusStart = emitRadiusStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getEmitRadiusStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.radiusStart;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setPolarStart(float polarStart) {
|
||||
polarStart = glm::clamp(polarStart, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.polar.start = glm::clamp(polarStart, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
changed = _particleProperties.polar.start != polarStart;
|
||||
_particleProperties.polar.start = polarStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getPolarStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.polar.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setPolarFinish(float polarFinish) {
|
||||
polarFinish = glm::clamp(polarFinish, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.polar.finish = glm::clamp(polarFinish, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
changed = _particleProperties.polar.finish != polarFinish;
|
||||
_particleProperties.polar.finish = polarFinish;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getPolarFinish() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.polar.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAzimuthStart(float azimuthStart) {
|
||||
azimuthStart = glm::clamp(azimuthStart, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.azimuth.start = glm::clamp(azimuthStart, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
changed = _particleProperties.azimuth.start != azimuthStart;
|
||||
_particleProperties.azimuth.start = azimuthStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAzimuthStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.azimuth.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAzimuthFinish(float azimuthFinish) {
|
||||
azimuthFinish = glm::clamp(azimuthFinish, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.azimuth.finish = glm::clamp(azimuthFinish, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
changed = _particleProperties.azimuth.finish != azimuthFinish;
|
||||
_particleProperties.azimuth.finish = azimuthFinish;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAzimuthFinish() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.azimuth.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitAcceleration(const glm::vec3& emitAcceleration_) {
|
||||
auto emitAcceleration = glm::clamp(emitAcceleration_, vec3(MINIMUM_EMIT_ACCELERATION), vec3(MAXIMUM_EMIT_ACCELERATION));
|
||||
if (emitAcceleration != _particleProperties.emission.acceleration.target) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.acceleration.target = emitAcceleration;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.emission.acceleration.target != emitAcceleration;
|
||||
_particleProperties.emission.acceleration.target = emitAcceleration;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getEmitAcceleration() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.emission.acceleration.target;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAccelerationSpread(const glm::vec3& accelerationSpread_){
|
||||
auto accelerationSpread = glm::clamp(accelerationSpread_, vec3(MINIMUM_ACCELERATION_SPREAD), vec3(MAXIMUM_ACCELERATION_SPREAD));
|
||||
if (accelerationSpread != _particleProperties.emission.acceleration.spread) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.acceleration.spread = accelerationSpread;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.emission.acceleration.spread != accelerationSpread;
|
||||
_particleProperties.emission.acceleration.spread = accelerationSpread;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getAccelerationSpread() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.emission.acceleration.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setParticleRadius(float particleRadius) {
|
||||
particleRadius = glm::clamp(particleRadius, MINIMUM_PARTICLE_RADIUS, MAXIMUM_PARTICLE_RADIUS);
|
||||
if (particleRadius != _particleProperties.radius.gradient.target) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.radius.gradient.target = particleRadius;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.radius.gradient.target != particleRadius;
|
||||
_particleProperties.radius.gradient.target = particleRadius;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getParticleRadius() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.radius.gradient.target;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setRadiusStart(float radiusStart) {
|
||||
radiusStart = glm::isnan(radiusStart) ? radiusStart : glm::clamp(radiusStart, MINIMUM_PARTICLE_RADIUS, MAXIMUM_PARTICLE_RADIUS);
|
||||
if (radiusStart != _particleProperties.radius.range.start) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.radius.range.start = radiusStart;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.radius.range.start != radiusStart;
|
||||
_particleProperties.radius.range.start = radiusStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getRadiusStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.radius.range.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setRadiusFinish(float radiusFinish) {
|
||||
radiusFinish = glm::isnan(radiusFinish) ? radiusFinish : glm::clamp(radiusFinish, MINIMUM_PARTICLE_RADIUS, MAXIMUM_PARTICLE_RADIUS);
|
||||
if (radiusFinish != _particleProperties.radius.range.finish) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.radius.range.finish = radiusFinish;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.radius.range.finish != radiusFinish;
|
||||
_particleProperties.radius.range.finish = radiusFinish;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getRadiusFinish() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.radius.range.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setRadiusSpread(float radiusSpread) {
|
||||
radiusSpread = glm::clamp(radiusSpread, MINIMUM_PARTICLE_RADIUS, MAXIMUM_PARTICLE_RADIUS);
|
||||
if (radiusSpread != _particleProperties.radius.gradient.spread) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.radius.gradient.spread = radiusSpread;
|
||||
});
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.radius.gradient.spread != radiusSpread;
|
||||
_particleProperties.radius.gradient.spread = radiusSpread;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
|
||||
if (changed) {
|
||||
computeAndUpdateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getRadiusSpread() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.radius.gradient.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setParticleSpin(float particleSpin) {
|
||||
particleSpin = glm::clamp(particleSpin, MINIMUM_PARTICLE_SPIN, MAXIMUM_PARTICLE_SPIN);
|
||||
if (particleSpin != _particleProperties.spin.gradient.target) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.spin.gradient.target = particleSpin;
|
||||
});
|
||||
}
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.spin.gradient.target != particleSpin;
|
||||
_particleProperties.spin.gradient.target = particleSpin;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getParticleSpin() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.spin.gradient.target;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setSpinStart(float spinStart) {
|
||||
spinStart =
|
||||
glm::isnan(spinStart) ? spinStart : glm::clamp(spinStart, MINIMUM_PARTICLE_SPIN, MAXIMUM_PARTICLE_SPIN);
|
||||
if (spinStart != _particleProperties.spin.range.start) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.spin.range.start = spinStart;
|
||||
});
|
||||
}
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.spin.range.start != spinStart;
|
||||
_particleProperties.spin.range.start = spinStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getSpinStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.spin.range.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setSpinFinish(float spinFinish) {
|
||||
spinFinish =
|
||||
glm::isnan(spinFinish) ? spinFinish : glm::clamp(spinFinish, MINIMUM_PARTICLE_SPIN, MAXIMUM_PARTICLE_SPIN);
|
||||
if (spinFinish != _particleProperties.spin.range.finish) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.spin.range.finish = spinFinish;
|
||||
});
|
||||
}
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.spin.range.finish != spinFinish;
|
||||
_particleProperties.spin.range.finish = spinFinish;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getSpinFinish() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.spin.range.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setSpinSpread(float spinSpread) {
|
||||
spinSpread = glm::clamp(spinSpread, MINIMUM_PARTICLE_SPIN, MAXIMUM_PARTICLE_SPIN);
|
||||
if (spinSpread != _particleProperties.spin.gradient.spread) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.spin.gradient.spread = spinSpread;
|
||||
});
|
||||
}
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.spin.gradient.spread != spinSpread;
|
||||
_particleProperties.spin.gradient.spread = spinSpread;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getSpinSpread() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.spin.gradient.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::computeAndUpdateDimensions() {
|
||||
|
@ -471,6 +759,7 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures);
|
||||
|
||||
|
@ -528,9 +817,19 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
|
|||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.color.gradient.target != glm::vec3(value);
|
||||
_particleProperties.color.gradient.target = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 ParticleEffectEntityItem::getColor() const {
|
||||
return resultWithReadLock<glm::u8vec3>([&] {
|
||||
return _particleProperties.color.gradient.target;
|
||||
});
|
||||
}
|
||||
|
||||
int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||
|
@ -739,9 +1038,13 @@ void ParticleEffectEntityItem::setShapeType(ShapeType type) {
|
|||
break;
|
||||
}
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _shapeType != type;
|
||||
_shapeType = type;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
ShapeType ParticleEffectEntityItem::getShapeType() const {
|
||||
|
@ -751,9 +1054,13 @@ ShapeType ParticleEffectEntityItem::getShapeType() const {
|
|||
}
|
||||
|
||||
void ParticleEffectEntityItem::setCompoundShapeURL(const QString& compoundShapeURL) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _compoundShapeURL != compoundShapeURL;
|
||||
_compoundShapeURL = compoundShapeURL;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString ParticleEffectEntityItem::getCompoundShapeURL() const {
|
||||
|
@ -762,44 +1069,103 @@ QString ParticleEffectEntityItem::getCompoundShapeURL() const {
|
|||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setIsEmitting(bool isEmitting) {
|
||||
_needsRenderUpdate |= _isEmitting != isEmitting;
|
||||
_isEmitting = isEmitting;
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setMaxParticles(quint32 maxParticles) {
|
||||
maxParticles = glm::clamp(maxParticles, MINIMUM_MAX_PARTICLES, MAXIMUM_MAX_PARTICLES);
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
_particleProperties.maxParticles = glm::clamp(maxParticles, MINIMUM_MAX_PARTICLES, MAXIMUM_MAX_PARTICLES);
|
||||
changed = _particleProperties.maxParticles != maxParticles;
|
||||
_particleProperties.maxParticles = maxParticles;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
quint32 ParticleEffectEntityItem::getMaxParticles() const {
|
||||
return resultWithReadLock<quint32>([&] {
|
||||
return _particleProperties.maxParticles;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setTextures(const QString& textures) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.textures != textures;
|
||||
_particleProperties.textures = textures;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString ParticleEffectEntityItem::getTextures() const {
|
||||
return resultWithReadLock<QString>([&] {
|
||||
return _particleProperties.textures;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColorStart(const vec3& colorStart) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.color.range.start != colorStart;
|
||||
_particleProperties.color.range.start = colorStart;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getColorStart() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.color.range.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColorFinish(const vec3& colorFinish) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.color.range.finish != colorFinish;
|
||||
_particleProperties.color.range.finish = colorFinish;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getColorFinish() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.color.range.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColorSpread(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _particleProperties.color.gradient.spread != glm::vec3(value);
|
||||
_particleProperties.color.gradient.spread = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 ParticleEffectEntityItem::getColorSpread() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.color.gradient.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setEmitterShouldTrail(bool emitterShouldTrail) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.emission.shouldTrail != emitterShouldTrail;
|
||||
_particleProperties.emission.shouldTrail = emitterShouldTrail;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setRotateWithEntity(bool rotateWithEntity) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.rotateWithEntity != rotateWithEntity;
|
||||
_particleProperties.rotateWithEntity = rotateWithEntity;
|
||||
});
|
||||
}
|
||||
|
@ -808,34 +1174,34 @@ particle::Properties ParticleEffectEntityItem::getParticleProperties() const {
|
|||
particle::Properties result;
|
||||
withReadLock([&] {
|
||||
result = _particleProperties;
|
||||
|
||||
// Special case the properties that get treated differently if they're unintialized
|
||||
if (glm::any(glm::isnan(result.color.range.start))) {
|
||||
result.color.range.start = getColor();
|
||||
}
|
||||
if (glm::any(glm::isnan(result.color.range.finish))) {
|
||||
result.color.range.finish = getColor();
|
||||
}
|
||||
if (glm::isnan(result.alpha.range.start)) {
|
||||
result.alpha.range.start = getAlpha();
|
||||
}
|
||||
if (glm::isnan(result.alpha.range.finish)) {
|
||||
result.alpha.range.finish = getAlpha();
|
||||
}
|
||||
if (glm::isnan(result.radius.range.start)) {
|
||||
result.radius.range.start = getParticleRadius();
|
||||
}
|
||||
if (glm::isnan(result.radius.range.finish)) {
|
||||
result.radius.range.finish = getParticleRadius();
|
||||
}
|
||||
if (glm::isnan(result.spin.range.start)) {
|
||||
result.spin.range.start = getParticleSpin();
|
||||
}
|
||||
if (glm::isnan(result.spin.range.finish)) {
|
||||
result.spin.range.finish = getParticleSpin();
|
||||
}
|
||||
});
|
||||
|
||||
// Special case the properties that get treated differently if they're unintialized
|
||||
if (glm::any(glm::isnan(result.color.range.start))) {
|
||||
result.color.range.start = getColor();
|
||||
}
|
||||
if (glm::any(glm::isnan(result.color.range.finish))) {
|
||||
result.color.range.finish = getColor();
|
||||
}
|
||||
if (glm::isnan(result.alpha.range.start)) {
|
||||
result.alpha.range.start = getAlpha();
|
||||
}
|
||||
if (glm::isnan(result.alpha.range.finish)) {
|
||||
result.alpha.range.finish = getAlpha();
|
||||
}
|
||||
if (glm::isnan(result.radius.range.start)) {
|
||||
result.radius.range.start = getParticleRadius();
|
||||
}
|
||||
if (glm::isnan(result.radius.range.finish)) {
|
||||
result.radius.range.finish = getParticleRadius();
|
||||
}
|
||||
if (glm::isnan(result.spin.range.start)) {
|
||||
result.spin.range.start = getParticleSpin();
|
||||
}
|
||||
if (glm::isnan(result.spin.range.finish)) {
|
||||
result.spin.range.finish = getParticleSpin();
|
||||
}
|
||||
|
||||
if (!result.valid()) {
|
||||
qCWarning(entities) << "failed validation";
|
||||
}
|
||||
|
|
|
@ -233,29 +233,31 @@ public:
|
|||
|
||||
bool shouldBePhysical() const override { return false; }
|
||||
|
||||
virtual void debugDump() const override;
|
||||
|
||||
void setColor(const glm::u8vec3& value);
|
||||
glm::u8vec3 getColor() const { return _particleProperties.color.gradient.target; }
|
||||
glm::u8vec3 getColor() const;
|
||||
|
||||
void setColorStart(const vec3& colorStart);
|
||||
vec3 getColorStart() const { return _particleProperties.color.range.start; }
|
||||
vec3 getColorStart() const;
|
||||
|
||||
void setColorFinish(const vec3& colorFinish);
|
||||
vec3 getColorFinish() const { return _particleProperties.color.range.finish; }
|
||||
vec3 getColorFinish() const;
|
||||
|
||||
void setColorSpread(const glm::u8vec3& colorSpread);
|
||||
glm::u8vec3 getColorSpread() const { return _particleProperties.color.gradient.spread; }
|
||||
glm::u8vec3 getColorSpread() const;
|
||||
|
||||
void setAlpha(float alpha);
|
||||
float getAlpha() const { return _particleProperties.alpha.gradient.target; }
|
||||
float getAlpha() const;
|
||||
|
||||
void setAlphaStart(float alphaStart);
|
||||
float getAlphaStart() const { return _particleProperties.alpha.range.start; }
|
||||
float getAlphaStart() const;
|
||||
|
||||
void setAlphaFinish(float alphaFinish);
|
||||
float getAlphaFinish() const { return _particleProperties.alpha.range.finish; }
|
||||
float getAlphaFinish() const;
|
||||
|
||||
void setAlphaSpread(float alphaSpread);
|
||||
float getAlphaSpread() const { return _particleProperties.alpha.gradient.spread; }
|
||||
float getAlphaSpread() const;
|
||||
|
||||
void setShapeType(ShapeType type) override;
|
||||
virtual ShapeType getShapeType() const override;
|
||||
|
@ -263,76 +265,74 @@ public:
|
|||
QString getCompoundShapeURL() const;
|
||||
virtual void setCompoundShapeURL(const QString& url);
|
||||
|
||||
virtual void debugDump() const override;
|
||||
|
||||
bool getIsEmitting() const { return _isEmitting; }
|
||||
void setIsEmitting(bool isEmitting) { _isEmitting = isEmitting; }
|
||||
void setIsEmitting(bool isEmitting);
|
||||
|
||||
void setMaxParticles(quint32 maxParticles);
|
||||
quint32 getMaxParticles() const { return _particleProperties.maxParticles; }
|
||||
quint32 getMaxParticles() const;
|
||||
|
||||
void setLifespan(float lifespan);
|
||||
float getLifespan() const { return _particleProperties.lifespan; }
|
||||
float getLifespan() const;
|
||||
|
||||
void setEmitRate(float emitRate);
|
||||
float getEmitRate() const { return _particleProperties.emission.rate; }
|
||||
float getEmitRate() const;
|
||||
|
||||
void setEmitSpeed(float emitSpeed);
|
||||
float getEmitSpeed() const { return _particleProperties.emission.speed.target; }
|
||||
float getEmitSpeed() const;
|
||||
|
||||
void setSpeedSpread(float speedSpread);
|
||||
float getSpeedSpread() const { return _particleProperties.emission.speed.spread; }
|
||||
float getSpeedSpread() const;
|
||||
|
||||
void setEmitOrientation(const glm::quat& emitOrientation);
|
||||
const glm::quat& getEmitOrientation() const { return _particleProperties.emission.orientation; }
|
||||
glm::quat getEmitOrientation() const;
|
||||
|
||||
void setEmitDimensions(const glm::vec3& emitDimensions);
|
||||
const glm::vec3& getEmitDimensions() const { return _particleProperties.emission.dimensions; }
|
||||
glm::vec3 getEmitDimensions() const;
|
||||
|
||||
void setEmitRadiusStart(float emitRadiusStart);
|
||||
float getEmitRadiusStart() const { return _particleProperties.radiusStart; }
|
||||
float getEmitRadiusStart() const;
|
||||
|
||||
void setPolarStart(float polarStart);
|
||||
float getPolarStart() const { return _particleProperties.polar.start; }
|
||||
float getPolarStart() const;
|
||||
|
||||
void setPolarFinish(float polarFinish);
|
||||
float getPolarFinish() const { return _particleProperties.polar.finish; }
|
||||
float getPolarFinish() const;
|
||||
|
||||
void setAzimuthStart(float azimuthStart);
|
||||
float getAzimuthStart() const { return _particleProperties.azimuth.start; }
|
||||
float getAzimuthStart() const;
|
||||
|
||||
void setAzimuthFinish(float azimuthFinish);
|
||||
float getAzimuthFinish() const { return _particleProperties.azimuth.finish; }
|
||||
float getAzimuthFinish() const;
|
||||
|
||||
void setEmitAcceleration(const glm::vec3& emitAcceleration);
|
||||
const glm::vec3& getEmitAcceleration() const { return _particleProperties.emission.acceleration.target; }
|
||||
glm::vec3 getEmitAcceleration() const;
|
||||
|
||||
void setAccelerationSpread(const glm::vec3& accelerationSpread);
|
||||
const glm::vec3& getAccelerationSpread() const { return _particleProperties.emission.acceleration.spread; }
|
||||
glm::vec3 getAccelerationSpread() const;
|
||||
|
||||
void setParticleRadius(float particleRadius);
|
||||
float getParticleRadius() const { return _particleProperties.radius.gradient.target; }
|
||||
float getParticleRadius() const;
|
||||
|
||||
void setRadiusStart(float radiusStart);
|
||||
float getRadiusStart() const { return _particleProperties.radius.range.start; }
|
||||
float getRadiusStart() const;
|
||||
|
||||
void setRadiusFinish(float radiusFinish);
|
||||
float getRadiusFinish() const { return _particleProperties.radius.range.finish; }
|
||||
float getRadiusFinish() const;
|
||||
|
||||
void setRadiusSpread(float radiusSpread);
|
||||
float getRadiusSpread() const { return _particleProperties.radius.gradient.spread; }
|
||||
float getRadiusSpread() const;
|
||||
|
||||
void setParticleSpin(float particleSpin);
|
||||
float getParticleSpin() const { return _particleProperties.spin.gradient.target; }
|
||||
float getParticleSpin() const;
|
||||
|
||||
void setSpinStart(float spinStart);
|
||||
float getSpinStart() const { return _particleProperties.spin.range.start; }
|
||||
float getSpinStart() const;
|
||||
|
||||
void setSpinFinish(float spinFinish);
|
||||
float getSpinFinish() const { return _particleProperties.spin.range.finish; }
|
||||
float getSpinFinish() const;
|
||||
|
||||
void setSpinSpread(float spinSpread);
|
||||
float getSpinSpread() const { return _particleProperties.spin.gradient.spread; }
|
||||
float getSpinSpread() const;
|
||||
|
||||
void setRotateWithEntity(bool rotateWithEntity);
|
||||
bool getRotateWithEntity() const { return _particleProperties.rotateWithEntity; }
|
||||
|
@ -340,10 +340,10 @@ public:
|
|||
void computeAndUpdateDimensions();
|
||||
|
||||
void setTextures(const QString& textures);
|
||||
QString getTextures() const { return _particleProperties.textures; }
|
||||
QString getTextures() const;
|
||||
|
||||
bool getEmitterShouldTrail() const { return _particleProperties.emission.shouldTrail; }
|
||||
void setEmitterShouldTrail(bool emitterShouldTrail);
|
||||
bool getEmitterShouldTrail() const { return _particleProperties.emission.shouldTrail; }
|
||||
|
||||
virtual bool supportsDetailedIntersection() const override { return false; }
|
||||
|
||||
|
|
|
@ -247,3 +247,18 @@ glm::u8vec3 PolyLineEntityItem::getColor() const {
|
|||
return _color;
|
||||
});
|
||||
}
|
||||
|
||||
void PolyLineEntityItem::setIsUVModeStretch(bool isUVModeStretch) {
|
||||
_needsRenderUpdate = _isUVModeStretch != isUVModeStretch;
|
||||
_isUVModeStretch = isUVModeStretch;
|
||||
}
|
||||
|
||||
void PolyLineEntityItem::setGlow(bool glow) {
|
||||
_needsRenderUpdate = _glow != glow;
|
||||
_glow = glow;
|
||||
}
|
||||
|
||||
void PolyLineEntityItem::setFaceCamera(bool faceCamera) {
|
||||
_needsRenderUpdate = _faceCamera != faceCamera;
|
||||
_faceCamera = faceCamera;
|
||||
}
|
|
@ -58,16 +58,16 @@ class PolyLineEntityItem : public EntityItem {
|
|||
void setStrokeColors(const QVector<glm::vec3>& strokeColors);
|
||||
QVector<glm::vec3> getStrokeColors() const;
|
||||
|
||||
void setIsUVModeStretch(bool isUVModeStretch){ _isUVModeStretch = isUVModeStretch; }
|
||||
void setIsUVModeStretch(bool isUVModeStretch);
|
||||
bool getIsUVModeStretch() const{ return _isUVModeStretch; }
|
||||
|
||||
QString getTextures() const;
|
||||
void setTextures(const QString& textures);
|
||||
|
||||
void setGlow(bool glow) { _glow = glow; }
|
||||
void setGlow(bool glow);
|
||||
bool getGlow() const { return _glow; }
|
||||
|
||||
void setFaceCamera(bool faceCamera) { _faceCamera = faceCamera; }
|
||||
void setFaceCamera(bool faceCamera);
|
||||
bool getFaceCamera() const { return _faceCamera; }
|
||||
|
||||
bool pointsChanged() const { return _pointsChanged; }
|
||||
|
|
|
@ -70,38 +70,16 @@ PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID) : EntityI
|
|||
_type = EntityTypes::PolyVox;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setVoxelVolumeSize(const glm::vec3& voxelVolumeSize) {
|
||||
void PolyVoxEntityItem::setVoxelVolumeSize(const glm::vec3& voxelVolumeSize_) {
|
||||
auto voxelVolumeSize = glm::clamp(glm::round(voxelVolumeSize_), glm::vec3(1.0f), glm::vec3(MAX_VOXEL_DIMENSION));
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
assert(!glm::any(glm::isnan(voxelVolumeSize)));
|
||||
|
||||
_voxelVolumeSize = glm::vec3(roundf(voxelVolumeSize.x), roundf(voxelVolumeSize.y), roundf(voxelVolumeSize.z));
|
||||
if (_voxelVolumeSize.x < 1) {
|
||||
qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping x of" << _voxelVolumeSize.x << "to 1";
|
||||
_voxelVolumeSize.x = 1;
|
||||
}
|
||||
if (_voxelVolumeSize.x > MAX_VOXEL_DIMENSION) {
|
||||
qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping x of" << _voxelVolumeSize.x << "to max";
|
||||
_voxelVolumeSize.x = MAX_VOXEL_DIMENSION;
|
||||
}
|
||||
|
||||
if (_voxelVolumeSize.y < 1) {
|
||||
qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping y of" << _voxelVolumeSize.y << "to 1";
|
||||
_voxelVolumeSize.y = 1;
|
||||
}
|
||||
if (_voxelVolumeSize.y > MAX_VOXEL_DIMENSION) {
|
||||
qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping y of" << _voxelVolumeSize.y << "to max";
|
||||
_voxelVolumeSize.y = MAX_VOXEL_DIMENSION;
|
||||
}
|
||||
|
||||
if (_voxelVolumeSize.z < 1) {
|
||||
qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping z of" << _voxelVolumeSize.z << "to 1";
|
||||
_voxelVolumeSize.z = 1;
|
||||
}
|
||||
if (_voxelVolumeSize.z > MAX_VOXEL_DIMENSION) {
|
||||
qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping z of" << _voxelVolumeSize.z << "to max";
|
||||
_voxelVolumeSize.z = MAX_VOXEL_DIMENSION;
|
||||
}
|
||||
changed = _voxelVolumeSize != voxelVolumeSize;
|
||||
_voxelVolumeSize = voxelVolumeSize;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::vec3 PolyVoxEntityItem::getVoxelVolumeSize() const {
|
||||
|
@ -247,13 +225,17 @@ QByteArray PolyVoxEntityItem::getVoxelData() const {
|
|||
}
|
||||
|
||||
|
||||
void PolyVoxEntityItem::setXTextureURL(const QString& xTextureURL) {
|
||||
void PolyVoxEntityItem::setXTextureURL(const QString& xTextureURL) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _xTextureURL != xTextureURL;
|
||||
_xTextureURL = xTextureURL;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString PolyVoxEntityItem::getXTextureURL() const {
|
||||
QString PolyVoxEntityItem::getXTextureURL() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _xTextureURL;
|
||||
|
@ -262,12 +244,16 @@ QString PolyVoxEntityItem::getXTextureURL() const {
|
|||
}
|
||||
|
||||
void PolyVoxEntityItem::setYTextureURL(const QString& yTextureURL) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _yTextureURL != yTextureURL;
|
||||
_yTextureURL = yTextureURL;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString PolyVoxEntityItem::getYTextureURL() const {
|
||||
QString PolyVoxEntityItem::getYTextureURL() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _yTextureURL;
|
||||
|
@ -276,11 +262,15 @@ QString PolyVoxEntityItem::getYTextureURL() const {
|
|||
}
|
||||
|
||||
void PolyVoxEntityItem::setZTextureURL(const QString& zTextureURL) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _zTextureURL != zTextureURL;
|
||||
_zTextureURL = zTextureURL;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
QString PolyVoxEntityItem::getZTextureURL() const {
|
||||
QString PolyVoxEntityItem::getZTextureURL() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _zTextureURL;
|
||||
|
@ -288,13 +278,13 @@ QString PolyVoxEntityItem::getZTextureURL() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setXNNeighborID(const EntityItemID& xNNeighborID) {
|
||||
void PolyVoxEntityItem::setXNNeighborID(const EntityItemID& xNNeighborID) {
|
||||
withWriteLock([&] {
|
||||
_xNNeighborID = xNNeighborID;
|
||||
});
|
||||
}
|
||||
|
||||
EntityItemID PolyVoxEntityItem::getXNNeighborID() const {
|
||||
EntityItemID PolyVoxEntityItem::getXNNeighborID() const {
|
||||
EntityItemID result;
|
||||
withReadLock([&] {
|
||||
result = _xNNeighborID;
|
||||
|
@ -302,13 +292,13 @@ EntityItemID PolyVoxEntityItem::getXNNeighborID() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setYNNeighborID(const EntityItemID& yNNeighborID) {
|
||||
void PolyVoxEntityItem::setYNNeighborID(const EntityItemID& yNNeighborID) {
|
||||
withWriteLock([&] {
|
||||
_yNNeighborID = yNNeighborID;
|
||||
});
|
||||
}
|
||||
|
||||
EntityItemID PolyVoxEntityItem::getYNNeighborID() const {
|
||||
EntityItemID PolyVoxEntityItem::getYNNeighborID() const {
|
||||
EntityItemID result;
|
||||
withReadLock([&] {
|
||||
result = _yNNeighborID;
|
||||
|
@ -316,13 +306,13 @@ EntityItemID PolyVoxEntityItem::getYNNeighborID() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setZNNeighborID(const EntityItemID& zNNeighborID) {
|
||||
void PolyVoxEntityItem::setZNNeighborID(const EntityItemID& zNNeighborID) {
|
||||
withWriteLock([&] {
|
||||
_zNNeighborID = zNNeighborID;
|
||||
});
|
||||
}
|
||||
|
||||
EntityItemID PolyVoxEntityItem::getZNNeighborID() const {
|
||||
EntityItemID PolyVoxEntityItem::getZNNeighborID() const {
|
||||
EntityItemID result;
|
||||
withReadLock([&] {
|
||||
result = _zNNeighborID;
|
||||
|
@ -330,13 +320,13 @@ EntityItemID PolyVoxEntityItem::getZNNeighborID() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setXPNeighborID(const EntityItemID& xPNeighborID) {
|
||||
void PolyVoxEntityItem::setXPNeighborID(const EntityItemID& xPNeighborID) {
|
||||
withWriteLock([&] {
|
||||
_xPNeighborID = xPNeighborID;
|
||||
});
|
||||
}
|
||||
|
||||
EntityItemID PolyVoxEntityItem::getXPNeighborID() const {
|
||||
EntityItemID PolyVoxEntityItem::getXPNeighborID() const {
|
||||
EntityItemID result;
|
||||
withReadLock([&] {
|
||||
result = _xPNeighborID;
|
||||
|
@ -344,13 +334,13 @@ EntityItemID PolyVoxEntityItem::getXPNeighborID() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setYPNeighborID(const EntityItemID& yPNeighborID) {
|
||||
void PolyVoxEntityItem::setYPNeighborID(const EntityItemID& yPNeighborID) {
|
||||
withWriteLock([&] {
|
||||
_yPNeighborID = yPNeighborID;
|
||||
});
|
||||
}
|
||||
|
||||
EntityItemID PolyVoxEntityItem::getYPNeighborID() const {
|
||||
EntityItemID PolyVoxEntityItem::getYPNeighborID() const {
|
||||
EntityItemID result;
|
||||
withReadLock([&] {
|
||||
result = _yPNeighborID;
|
||||
|
@ -358,13 +348,13 @@ EntityItemID PolyVoxEntityItem::getYPNeighborID() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::setZPNeighborID(const EntityItemID& zPNeighborID) {
|
||||
void PolyVoxEntityItem::setZPNeighborID(const EntityItemID& zPNeighborID) {
|
||||
withWriteLock([&] {
|
||||
_zPNeighborID = zPNeighborID;
|
||||
});
|
||||
}
|
||||
|
||||
EntityItemID PolyVoxEntityItem::getZPNeighborID() const {
|
||||
EntityItemID PolyVoxEntityItem::getZPNeighborID() const {
|
||||
EntityItemID result;
|
||||
withReadLock([&] {
|
||||
result = _zPNeighborID;
|
||||
|
|
|
@ -154,6 +154,7 @@ void ShapeEntityItem::setShape(const entity::Shape& shape) {
|
|||
if (_shape != prevShape) {
|
||||
// Internally grabs writeLock
|
||||
markDirtyFlags(Simulation::DIRTY_SHAPE);
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,6 +166,7 @@ bool ShapeEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(shape, setShape);
|
||||
|
||||
|
@ -231,9 +233,13 @@ void ShapeEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
|||
}
|
||||
|
||||
void ShapeEntityItem::setColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _color != value;
|
||||
_color = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 ShapeEntityItem::getColor() const {
|
||||
|
@ -243,9 +249,13 @@ glm::u8vec3 ShapeEntityItem::getColor() const {
|
|||
}
|
||||
|
||||
void ShapeEntityItem::setAlpha(float alpha) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float ShapeEntityItem::getAlpha() const {
|
||||
|
|
|
@ -75,6 +75,7 @@ bool TextEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(billboardMode, setBillboardMode);
|
||||
|
||||
|
@ -163,7 +164,7 @@ void TextEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
|
|||
EntityPropertyFlags& propertyFlags,
|
||||
EntityPropertyFlags& propertiesDidntFit,
|
||||
int& propertyCount,
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
|
||||
bool successPropertyFits = true;
|
||||
|
||||
|
@ -250,12 +251,16 @@ bool TextEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, c
|
|||
}
|
||||
|
||||
void TextEntityItem::setText(const QString& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _text != value;
|
||||
_text = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString TextEntityItem::getText() const {
|
||||
QString TextEntityItem::getText() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _text;
|
||||
|
@ -263,13 +268,17 @@ QString TextEntityItem::getText() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void TextEntityItem::setLineHeight(float value) {
|
||||
void TextEntityItem::setLineHeight(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _lineHeight != value;
|
||||
_lineHeight = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getLineHeight() const {
|
||||
float TextEntityItem::getLineHeight() const {
|
||||
float result;
|
||||
withReadLock([&] {
|
||||
result = _lineHeight;
|
||||
|
@ -278,9 +287,13 @@ float TextEntityItem::getLineHeight() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setTextColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _textColor != value;
|
||||
_textColor = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 TextEntityItem::getTextColor() const {
|
||||
|
@ -290,9 +303,13 @@ glm::u8vec3 TextEntityItem::getTextColor() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setTextAlpha(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _textAlpha != value;
|
||||
_textAlpha = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getTextAlpha() const {
|
||||
|
@ -302,9 +319,13 @@ float TextEntityItem::getTextAlpha() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setBackgroundColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _backgroundColor != value;
|
||||
_backgroundColor = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 TextEntityItem::getBackgroundColor() const {
|
||||
|
@ -314,9 +335,13 @@ glm::u8vec3 TextEntityItem::getBackgroundColor() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setBackgroundAlpha(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _backgroundAlpha != value;
|
||||
_backgroundAlpha = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getBackgroundAlpha() const {
|
||||
|
@ -334,15 +359,23 @@ BillboardMode TextEntityItem::getBillboardMode() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setBillboardMode(BillboardMode value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _billboardMode != value;
|
||||
_billboardMode = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
void TextEntityItem::setLeftMargin(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _leftMargin != value;
|
||||
_leftMargin = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getLeftMargin() const {
|
||||
|
@ -352,9 +385,13 @@ float TextEntityItem::getLeftMargin() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setRightMargin(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _rightMargin != value;
|
||||
_rightMargin = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getRightMargin() const {
|
||||
|
@ -364,9 +401,13 @@ float TextEntityItem::getRightMargin() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setTopMargin(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _topMargin != value;
|
||||
_topMargin = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getTopMargin() const {
|
||||
|
@ -376,9 +417,13 @@ float TextEntityItem::getTopMargin() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setBottomMargin(float value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _bottomMargin != value;
|
||||
_bottomMargin = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float TextEntityItem::getBottomMargin() const {
|
||||
|
@ -388,9 +433,13 @@ float TextEntityItem::getBottomMargin() const {
|
|||
}
|
||||
|
||||
void TextEntityItem::setUnlit(bool value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _unlit != value;
|
||||
_unlit = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
bool TextEntityItem::getUnlit() const {
|
||||
|
|
|
@ -68,6 +68,7 @@ bool WebEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(billboardMode, setBillboardMode);
|
||||
|
||||
|
@ -228,9 +229,13 @@ bool WebEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, co
|
|||
}
|
||||
|
||||
void WebEntityItem::setColor(const glm::u8vec3& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _color != value;
|
||||
_color = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
glm::u8vec3 WebEntityItem::getColor() const {
|
||||
|
@ -240,9 +245,13 @@ glm::u8vec3 WebEntityItem::getColor() const {
|
|||
}
|
||||
|
||||
void WebEntityItem::setAlpha(float alpha) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
float WebEntityItem::getAlpha() const {
|
||||
|
@ -258,15 +267,23 @@ BillboardMode WebEntityItem::getBillboardMode() const {
|
|||
}
|
||||
|
||||
void WebEntityItem::setBillboardMode(BillboardMode value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _billboardMode != value;
|
||||
_billboardMode = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
void WebEntityItem::setSourceUrl(const QString& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _sourceUrl != value;
|
||||
_sourceUrl = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString WebEntityItem::getSourceUrl() const {
|
||||
|
@ -276,9 +293,13 @@ QString WebEntityItem::getSourceUrl() const {
|
|||
}
|
||||
|
||||
void WebEntityItem::setDPI(uint16_t value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _dpi != value;
|
||||
_dpi = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
uint16_t WebEntityItem::getDPI() const {
|
||||
|
@ -288,17 +309,22 @@ uint16_t WebEntityItem::getDPI() const {
|
|||
}
|
||||
|
||||
void WebEntityItem::setScriptURL(const QString& value) {
|
||||
withWriteLock([&] {
|
||||
if (_scriptURL != value) {
|
||||
auto newURL = QUrl::fromUserInput(value);
|
||||
auto newURL = QUrl::fromUserInput(value);
|
||||
|
||||
if (newURL.isValid()) {
|
||||
_scriptURL = newURL.toDisplayString();
|
||||
} else {
|
||||
if (!newURL.isValid()) {
|
||||
qCDebug(entities) << "Not setting web entity script URL since" << value << "cannot be parsed to a valid URL.";
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto urlString = newURL.toDisplayString();
|
||||
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _scriptURL != urlString;
|
||||
_scriptURL = urlString;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
QString WebEntityItem::getScriptURL() const {
|
||||
|
@ -308,9 +334,13 @@ QString WebEntityItem::getScriptURL() const {
|
|||
}
|
||||
|
||||
void WebEntityItem::setMaxFPS(uint8_t value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _maxFPS != value;
|
||||
_maxFPS = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
uint8_t WebEntityItem::getMaxFPS() const {
|
||||
|
@ -320,9 +350,13 @@ uint8_t WebEntityItem::getMaxFPS() const {
|
|||
}
|
||||
|
||||
void WebEntityItem::setInputMode(const WebInputMode& value) {
|
||||
bool changed;
|
||||
withWriteLock([&] {
|
||||
changed = _inputMode != value;
|
||||
_inputMode = value;
|
||||
});
|
||||
|
||||
_needsRenderUpdate |= changed;
|
||||
}
|
||||
|
||||
WebInputMode WebEntityItem::getInputMode() const {
|
||||
|
|
Loading…
Reference in a new issue