mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 13:43:49 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into emojiAppAdd
This commit is contained in:
commit
c64da85344
77 changed files with 981 additions and 963 deletions
|
@ -121,9 +121,6 @@ void SafeLanding::updateTracking() {
|
|||
if (isEntityPhysicsReady(entity) && isVisuallyReady) {
|
||||
entityMapIter = _trackedEntities.erase(entityMapIter);
|
||||
} else {
|
||||
if (!isVisuallyReady) {
|
||||
entity->requestRenderUpdate();
|
||||
}
|
||||
entityMapIter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ void RenderScriptingInterface::forceRenderMethod(RenderMethod renderMethod) {
|
|||
_renderMethod = (int)renderMethod;
|
||||
_renderMethodSetting.set((int)renderMethod);
|
||||
|
||||
auto config = dynamic_cast<task::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch"));
|
||||
auto config = dynamic_cast<render::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch"));
|
||||
if (config) {
|
||||
config->setBranch((int)renderMethod);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,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;
|
||||
|
||||
|
|
|
@ -52,12 +52,14 @@ void PolyLineEntityRenderer::buildPipelines() {
|
|||
gpu::ShaderPointer program = gpu::Shader::createProgram(key.first == render::Args::DEFERRED ? shader::entities_renderer::program::paintStroke : shader::entities_renderer::program::paintStroke_forward);
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
|
||||
state->setCullMode(gpu::State::CullMode::CULL_NONE);
|
||||
state->setDepthTest(true, !key.second, gpu::LESS_EQUAL);
|
||||
PrepareStencil::testMask(*state);
|
||||
state->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
|
||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||
|
||||
_pipelines[key] = gpu::Pipeline::create(program, state);
|
||||
}
|
||||
}
|
||||
|
@ -75,11 +77,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 +91,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,69 +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 (_font != entity->getFont()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_effect != entity->getTextEffect()) {
|
||||
return true;
|
||||
}
|
||||
if (_effectColor != toGlm(entity->getTextEffectColor())) {
|
||||
return true;
|
||||
}
|
||||
if (_effectThickness != entity->getTextEffectThickness()) {
|
||||
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;
|
||||
|
|
|
@ -31,7 +31,7 @@ layout(location=3) in float _distanceFromCenter;
|
|||
void main(void) {
|
||||
vec4 texel = texture(_texture, _texCoord);
|
||||
texel *= _color;
|
||||
texel.a *= mix(1.0, pow(1.0 - abs(_distanceFromCenter), 10.0), _polylineData.faceCameraGlow.y);
|
||||
texel.a *= mix(1.0, pow(1.0 - min(1.0, abs(_distanceFromCenter)), 10.0), _polylineData.faceCameraGlow.y);
|
||||
|
||||
<@if not HIFI_USE_FORWARD@>
|
||||
packDeferredFragmentTranslucent((2.0 * float(gl_FrontFacing) - 1.0) * _normalWS, texel.a, texel.rgb, DEFAULT_ROUGHNESS);
|
||||
|
|
|
@ -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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_visible = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
bumpAncestorChainRenderableVersion();
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2966,17 +2964,10 @@ bool EntityItem::isVisibleInSecondaryCamera() const {
|
|||
}
|
||||
|
||||
void EntityItem::setIsVisibleInSecondaryCamera(bool value) {
|
||||
bool changed = false;
|
||||
withWriteLock([&] {
|
||||
if (_isVisibleInSecondaryCamera != value) {
|
||||
changed = true;
|
||||
_isVisibleInSecondaryCamera = value;
|
||||
}
|
||||
_needsRenderUpdate |= _isVisibleInSecondaryCamera != value;
|
||||
_isVisibleInSecondaryCamera = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
RenderLayer EntityItem::getRenderLayer() const {
|
||||
|
@ -2986,17 +2977,10 @@ RenderLayer EntityItem::getRenderLayer() const {
|
|||
}
|
||||
|
||||
void EntityItem::setRenderLayer(RenderLayer value) {
|
||||
bool changed = false;
|
||||
withWriteLock([&] {
|
||||
if (_renderLayer != value) {
|
||||
changed = true;
|
||||
_renderLayer = value;
|
||||
}
|
||||
_needsRenderUpdate |= _renderLayer != value;
|
||||
_renderLayer = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
PrimitiveMode EntityItem::getPrimitiveMode() const {
|
||||
|
@ -3006,17 +2990,10 @@ PrimitiveMode EntityItem::getPrimitiveMode() const {
|
|||
}
|
||||
|
||||
void EntityItem::setPrimitiveMode(PrimitiveMode value) {
|
||||
bool changed = false;
|
||||
withWriteLock([&] {
|
||||
if (_primitiveMode != value) {
|
||||
changed = true;
|
||||
_primitiveMode = value;
|
||||
}
|
||||
_needsRenderUpdate |= _primitiveMode != value;
|
||||
_primitiveMode = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
bool EntityItem::getCauterized() const {
|
||||
|
@ -3026,17 +3003,10 @@ bool EntityItem::getCauterized() const {
|
|||
}
|
||||
|
||||
void EntityItem::setCauterized(bool value) {
|
||||
bool changed = false;
|
||||
withWriteLock([&] {
|
||||
if (_cauterized != value) {
|
||||
changed = true;
|
||||
_cauterized = value;
|
||||
}
|
||||
_needsRenderUpdate |= _cauterized != value;
|
||||
_cauterized = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
bool EntityItem::getIgnorePickIntersection() const {
|
||||
|
@ -3060,17 +3030,10 @@ bool EntityItem::getCanCastShadow() const {
|
|||
}
|
||||
|
||||
void EntityItem::setCanCastShadow(bool value) {
|
||||
bool changed = false;
|
||||
withWriteLock([&] {
|
||||
if (_canCastShadow != value) {
|
||||
changed = true;
|
||||
_canCastShadow = value;
|
||||
}
|
||||
_needsRenderUpdate |= _canCastShadow != value;
|
||||
_canCastShadow = value;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
bool EntityItem::isChildOfMyAvatar() const {
|
||||
|
|
|
@ -571,8 +571,10 @@ public:
|
|||
|
||||
bool stillHasMyGrabAction() const;
|
||||
|
||||
bool needsRenderUpdate() const { return resultWithReadLock<bool>([&] { return _needsRenderUpdate; }); }
|
||||
void setNeedsRenderUpdate(bool needsRenderUpdate) { withWriteLock([&] { _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) {
|
||||
|
@ -185,6 +186,7 @@ bool GizmoEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin,
|
|||
|
||||
void GizmoEntityItem::setGizmoType(GizmoType value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _gizmoType != value;
|
||||
_gizmoType = value;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
@ -136,6 +137,7 @@ void GridEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
|
|||
|
||||
void GridEntityItem::setColor(const glm::u8vec3& color) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _color != color;
|
||||
_color = color;
|
||||
});
|
||||
}
|
||||
|
@ -148,6 +150,7 @@ glm::u8vec3 GridEntityItem::getColor() const {
|
|||
|
||||
void GridEntityItem::setAlpha(float alpha) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
}
|
||||
|
@ -160,6 +163,7 @@ float GridEntityItem::getAlpha() const {
|
|||
|
||||
void GridEntityItem::setFollowCamera(bool followCamera) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _followCamera != followCamera;
|
||||
_followCamera = followCamera;
|
||||
});
|
||||
}
|
||||
|
@ -171,9 +175,12 @@ 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);
|
||||
|
||||
withWriteLock([&] {
|
||||
const uint32_t MAJOR_GRID_EVERY_MIN = 1;
|
||||
_majorGridEvery = std::max(majorGridEvery, MAJOR_GRID_EVERY_MIN);
|
||||
_needsRenderUpdate |= _majorGridEvery != majorGridEvery;
|
||||
_majorGridEvery = majorGridEvery;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -184,9 +191,12 @@ 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);
|
||||
|
||||
withWriteLock([&] {
|
||||
const float MINOR_GRID_EVERY_MIN = 0.01f;
|
||||
_minorGridEvery = std::max(minorGridEvery, MINOR_GRID_EVERY_MIN);
|
||||
_needsRenderUpdate |= _minorGridEvery != minorGridEvery;
|
||||
_minorGridEvery = minorGridEvery;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -214,6 +215,7 @@ QString ImageEntityItem::getImageURL() const {
|
|||
|
||||
void ImageEntityItem::setImageURL(const QString& url) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _imageURL != url;
|
||||
_imageURL = url;
|
||||
});
|
||||
}
|
||||
|
@ -228,6 +230,7 @@ bool ImageEntityItem::getEmissive() const {
|
|||
|
||||
void ImageEntityItem::setEmissive(bool emissive) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _emissive != emissive;
|
||||
_emissive = emissive;
|
||||
});
|
||||
}
|
||||
|
@ -242,6 +245,7 @@ bool ImageEntityItem::getKeepAspectRatio() const {
|
|||
|
||||
void ImageEntityItem::setKeepAspectRatio(bool keepAspectRatio) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _keepAspectRatio != keepAspectRatio;
|
||||
_keepAspectRatio = keepAspectRatio;
|
||||
});
|
||||
}
|
||||
|
@ -256,6 +260,7 @@ BillboardMode ImageEntityItem::getBillboardMode() const {
|
|||
|
||||
void ImageEntityItem::setBillboardMode(BillboardMode value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _billboardMode != value;
|
||||
_billboardMode = value;
|
||||
});
|
||||
}
|
||||
|
@ -270,12 +275,14 @@ QRect ImageEntityItem::getSubImage() const {
|
|||
|
||||
void ImageEntityItem::setSubImage(const QRect& subImage) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _subImage != subImage;
|
||||
_subImage = subImage;
|
||||
});
|
||||
}
|
||||
|
||||
void ImageEntityItem::setColor(const glm::u8vec3& color) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _color != color;
|
||||
_color = color;
|
||||
});
|
||||
}
|
||||
|
@ -288,6 +295,7 @@ glm::u8vec3 ImageEntityItem::getColor() const {
|
|||
|
||||
void ImageEntityItem::setAlpha(float alpha) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -58,14 +58,14 @@ 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,12 +85,10 @@ EntityItemProperties LightEntityItem::getProperties(const EntityPropertyFlags& d
|
|||
|
||||
void LightEntityItem::setFalloffRadius(float value) {
|
||||
value = glm::max(value, 0.0f);
|
||||
if (value == getFalloffRadius()) {
|
||||
return;
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _falloffRadius != value;
|
||||
_falloffRadius = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -110,8 +108,8 @@ void LightEntityItem::setIsSpotlight(bool value) {
|
|||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = true;
|
||||
_isSpotlight = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
setScaledDimensions(newDimensions);
|
||||
}
|
||||
|
@ -123,6 +121,7 @@ void LightEntityItem::setCutoff(float value) {
|
|||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = true;
|
||||
_cutoff = value;
|
||||
});
|
||||
|
||||
|
@ -133,10 +132,6 @@ void LightEntityItem::setCutoff(float value) {
|
|||
const float width = length * glm::sin(glm::radians(_cutoff));
|
||||
setScaledDimensions(glm::vec3(width, width, length));
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
}
|
||||
|
||||
bool LightEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||
|
@ -223,8 +218,8 @@ glm::u8vec3 LightEntityItem::getColor() const {
|
|||
|
||||
void LightEntityItem::setColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _color != value;
|
||||
_color = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -246,8 +241,8 @@ float LightEntityItem::getIntensity() const {
|
|||
|
||||
void LightEntityItem::setIntensity(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _intensity != value;
|
||||
_intensity = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -269,8 +264,8 @@ float LightEntityItem::getExponent() const {
|
|||
|
||||
void LightEntityItem::setExponent(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _exponent != value;
|
||||
_exponent = value;
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -282,10 +277,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;
|
||||
};
|
||||
|
|
|
@ -76,9 +76,10 @@ bool LineEntityItem::appendPoint(const glm::vec3& point) {
|
|||
return false;
|
||||
}
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = true;
|
||||
_points << point;
|
||||
_pointsChanged = true;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -96,9 +97,10 @@ bool LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
|||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = true;
|
||||
_points = points;
|
||||
_pointsChanged = true;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -155,6 +157,7 @@ glm::u8vec3 LineEntityItem::getColor() const {
|
|||
|
||||
void LineEntityItem::setColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _color != value;
|
||||
_color = value;
|
||||
});
|
||||
}
|
||||
|
@ -165,10 +168,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
|
||||
|
|
|
@ -154,6 +154,7 @@ QString MaterialEntityItem::getMaterialURL() const {
|
|||
|
||||
void MaterialEntityItem::setMaterialURL(const QString& materialURL) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialURL != materialURL;
|
||||
_materialURL = materialURL;
|
||||
});
|
||||
}
|
||||
|
@ -166,6 +167,7 @@ QString MaterialEntityItem::getMaterialData() const {
|
|||
|
||||
void MaterialEntityItem::setMaterialData(const QString& materialData) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialData != materialData;
|
||||
_materialData = materialData;
|
||||
});
|
||||
}
|
||||
|
@ -178,6 +180,7 @@ MaterialMappingMode MaterialEntityItem::getMaterialMappingMode() const {
|
|||
|
||||
void MaterialEntityItem::setMaterialMappingMode(MaterialMappingMode mode) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialMappingMode != mode;
|
||||
_materialMappingMode = mode;
|
||||
});
|
||||
setUnscaledDimensions(_desiredDimensions);
|
||||
|
@ -191,6 +194,7 @@ quint16 MaterialEntityItem::getPriority() const {
|
|||
|
||||
void MaterialEntityItem::setPriority(quint16 priority) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _priority != priority;
|
||||
_priority = priority;
|
||||
});
|
||||
}
|
||||
|
@ -203,6 +207,7 @@ QString MaterialEntityItem::getParentMaterialName() const {
|
|||
|
||||
void MaterialEntityItem::setParentMaterialName(const QString& parentMaterialName) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _parentMaterialName != parentMaterialName;
|
||||
_parentMaterialName = parentMaterialName;
|
||||
});
|
||||
}
|
||||
|
@ -215,6 +220,7 @@ glm::vec2 MaterialEntityItem::getMaterialMappingPos() const {
|
|||
|
||||
void MaterialEntityItem::setMaterialMappingPos(const glm::vec2& materialMappingPos) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialMappingPos != materialMappingPos;
|
||||
_materialMappingPos = materialMappingPos;
|
||||
});
|
||||
}
|
||||
|
@ -227,6 +233,7 @@ glm::vec2 MaterialEntityItem::getMaterialMappingScale() const {
|
|||
|
||||
void MaterialEntityItem::setMaterialMappingScale(const glm::vec2& materialMappingScale) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialMappingScale != materialMappingScale;
|
||||
_materialMappingScale = materialMappingScale;
|
||||
});
|
||||
}
|
||||
|
@ -239,10 +246,24 @@ float MaterialEntityItem::getMaterialMappingRot() const {
|
|||
|
||||
void MaterialEntityItem::setMaterialMappingRot(float materialMappingRot) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialMappingRot != materialMappingRot;
|
||||
_materialMappingRot = materialMappingRot;
|
||||
});
|
||||
}
|
||||
|
||||
bool MaterialEntityItem::getMaterialRepeat() const {
|
||||
return resultWithReadLock<bool>([&] {
|
||||
return _materialRepeat;
|
||||
});
|
||||
}
|
||||
|
||||
void MaterialEntityItem::setMaterialRepeat(bool value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _materialRepeat != value;
|
||||
_materialRepeat = value;
|
||||
});
|
||||
}
|
||||
|
||||
AACube MaterialEntityItem::calculateInitialQueryAACube(bool& success) {
|
||||
AACube aaCube = EntityItem::calculateInitialQueryAACube(success);
|
||||
// A Material entity's queryAACube contains its parent's queryAACube
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -50,6 +50,7 @@ const QString ModelEntityItem::getTextures() const {
|
|||
|
||||
void ModelEntityItem::setTextures(const QString& textures) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _textures != textures;
|
||||
_textures = textures;
|
||||
});
|
||||
}
|
||||
|
@ -295,6 +296,7 @@ void ModelEntityItem::setModelURL(const QString& url) {
|
|||
if (_modelURL != url) {
|
||||
_modelURL = url;
|
||||
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||
_needsRenderUpdate = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -576,6 +578,7 @@ bool ModelEntityItem::getRelayParentJoints() const {
|
|||
|
||||
void ModelEntityItem::setGroupCulled(bool value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _groupCulled != value;
|
||||
_groupCulled = value;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -167,211 +167,446 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
|
|||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAlpha(float alpha) {
|
||||
alpha = glm::clamp(alpha, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.gradient.target = glm::clamp(alpha, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
_needsRenderUpdate |= _particleProperties.alpha.gradient.target != alpha;
|
||||
_particleProperties.alpha.gradient.target = alpha;
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.range.start = glm::isnan(alphaStart) ? alphaStart : glm::clamp(alphaStart, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
_needsRenderUpdate |= _particleProperties.alpha.range.start != alphaStart;
|
||||
_particleProperties.alpha.range.start = alphaStart;
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.range.finish = glm::isnan(alphaFinish) ? alphaFinish : glm::clamp(alphaFinish, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
_needsRenderUpdate |= _particleProperties.alpha.range.finish != alphaFinish;
|
||||
_particleProperties.alpha.range.finish = alphaFinish;
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.alpha.gradient.spread = glm::clamp(alphaSpread, MINIMUM_ALPHA, MAXIMUM_ALPHA);
|
||||
_needsRenderUpdate |= _particleProperties.alpha.gradient.spread != alphaSpread;
|
||||
_particleProperties.alpha.gradient.spread = alphaSpread;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.lifespan = lifespan;
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.emission.rate = glm::clamp(emitRate, MINIMUM_EMIT_RATE, MAXIMUM_EMIT_RATE);
|
||||
_needsRenderUpdate |= _particleProperties.emission.rate != emitRate;
|
||||
_particleProperties.emission.rate = emitRate;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.emission.speed.target = emitSpeed;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.emission.speed.spread = speedSpread;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.emission.orientation = emitOrientation;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.emission.dimensions = emitDimensions;
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.radiusStart = glm::clamp(emitRadiusStart, MINIMUM_EMIT_RADIUS_START, MAXIMUM_EMIT_RADIUS_START);
|
||||
_needsRenderUpdate |= _particleProperties.radiusStart != emitRadiusStart;
|
||||
_particleProperties.radiusStart = emitRadiusStart;
|
||||
});
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getEmitRadiusStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.radiusStart;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setPolarStart(float polarStart) {
|
||||
polarStart = glm::clamp(polarStart, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.polar.start = glm::clamp(polarStart, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
_needsRenderUpdate |= _particleProperties.polar.start != polarStart;
|
||||
_particleProperties.polar.start = polarStart;
|
||||
});
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getPolarStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.polar.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setPolarFinish(float polarFinish) {
|
||||
polarFinish = glm::clamp(polarFinish, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.polar.finish = glm::clamp(polarFinish, MINIMUM_POLAR, MAXIMUM_POLAR);
|
||||
_needsRenderUpdate |= _particleProperties.polar.finish != polarFinish;
|
||||
_particleProperties.polar.finish = polarFinish;
|
||||
});
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getPolarFinish() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.polar.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAzimuthStart(float azimuthStart) {
|
||||
azimuthStart = glm::clamp(azimuthStart, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.azimuth.start = glm::clamp(azimuthStart, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
_needsRenderUpdate |= _particleProperties.azimuth.start != azimuthStart;
|
||||
_particleProperties.azimuth.start = azimuthStart;
|
||||
});
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getAzimuthStart() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.azimuth.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setAzimuthFinish(float azimuthFinish) {
|
||||
azimuthFinish = glm::clamp(azimuthFinish, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
|
||||
withWriteLock([&] {
|
||||
_particleProperties.azimuth.finish = glm::clamp(azimuthFinish, MINIMUM_AZIMUTH, MAXIMUM_AZIMUTH);
|
||||
_needsRenderUpdate |= _particleProperties.azimuth.finish != azimuthFinish;
|
||||
_particleProperties.azimuth.finish = azimuthFinish;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.emission.acceleration.target = emitAcceleration;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.emission.acceleration.spread = accelerationSpread;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.radius.gradient.target = particleRadius;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.radius.range.start = radiusStart;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.radius.range.finish = radiusFinish;
|
||||
});
|
||||
|
||||
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;
|
||||
_needsRenderUpdate |= changed;
|
||||
_particleProperties.radius.gradient.spread = radiusSpread;
|
||||
});
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.spin.gradient.target != particleSpin;
|
||||
_particleProperties.spin.gradient.target = particleSpin;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.spin.range.start != spinStart;
|
||||
_particleProperties.spin.range.start = spinStart;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.spin.range.finish != spinFinish;
|
||||
_particleProperties.spin.range.finish = spinFinish;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.spin.gradient.spread != spinSpread;
|
||||
_particleProperties.spin.gradient.spread = spinSpread;
|
||||
});
|
||||
}
|
||||
|
||||
float ParticleEffectEntityItem::getSpinSpread() const {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _particleProperties.spin.gradient.spread;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::computeAndUpdateDimensions() {
|
||||
|
@ -471,6 +706,7 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures);
|
||||
|
||||
|
@ -529,10 +765,17 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
|
|||
|
||||
void ParticleEffectEntityItem::setColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.color.gradient.target != glm::vec3(value);
|
||||
_particleProperties.color.gradient.target = value;
|
||||
});
|
||||
}
|
||||
|
||||
glm::u8vec3 ParticleEffectEntityItem::getColor() const {
|
||||
return resultWithReadLock<glm::u8vec3>([&] {
|
||||
return _particleProperties.color.gradient.target;
|
||||
});
|
||||
}
|
||||
|
||||
int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||
ReadBitstreamToTreeParams& args,
|
||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||
|
@ -740,6 +983,7 @@ void ParticleEffectEntityItem::setShapeType(ShapeType type) {
|
|||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _shapeType != type;
|
||||
_shapeType = type;
|
||||
});
|
||||
}
|
||||
|
@ -752,6 +996,7 @@ ShapeType ParticleEffectEntityItem::getShapeType() const {
|
|||
|
||||
void ParticleEffectEntityItem::setCompoundShapeURL(const QString& compoundShapeURL) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _compoundShapeURL != compoundShapeURL;
|
||||
_compoundShapeURL = compoundShapeURL;
|
||||
});
|
||||
}
|
||||
|
@ -762,44 +1007,90 @@ QString ParticleEffectEntityItem::getCompoundShapeURL() const {
|
|||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setMaxParticles(quint32 maxParticles) {
|
||||
void ParticleEffectEntityItem::setIsEmitting(bool isEmitting) {
|
||||
withWriteLock([&] {
|
||||
_particleProperties.maxParticles = glm::clamp(maxParticles, MINIMUM_MAX_PARTICLES, MAXIMUM_MAX_PARTICLES);
|
||||
_needsRenderUpdate |= _isEmitting != isEmitting;
|
||||
_isEmitting = isEmitting;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setMaxParticles(quint32 maxParticles) {
|
||||
maxParticles = glm::clamp(maxParticles, MINIMUM_MAX_PARTICLES, MAXIMUM_MAX_PARTICLES);
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.maxParticles != maxParticles;
|
||||
_particleProperties.maxParticles = maxParticles;
|
||||
});
|
||||
}
|
||||
|
||||
quint32 ParticleEffectEntityItem::getMaxParticles() const {
|
||||
return resultWithReadLock<quint32>([&] {
|
||||
return _particleProperties.maxParticles;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setTextures(const QString& textures) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.textures != textures;
|
||||
_particleProperties.textures = textures;
|
||||
});
|
||||
}
|
||||
|
||||
QString ParticleEffectEntityItem::getTextures() const {
|
||||
return resultWithReadLock<QString>([&] {
|
||||
return _particleProperties.textures;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColorStart(const vec3& colorStart) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.color.range.start != colorStart;
|
||||
_particleProperties.color.range.start = colorStart;
|
||||
});
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getColorStart() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.color.range.start;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColorFinish(const vec3& colorFinish) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.color.range.finish != colorFinish;
|
||||
_particleProperties.color.range.finish = colorFinish;
|
||||
});
|
||||
}
|
||||
|
||||
glm::vec3 ParticleEffectEntityItem::getColorFinish() const {
|
||||
return resultWithReadLock<glm::vec3>([&] {
|
||||
return _particleProperties.color.range.finish;
|
||||
});
|
||||
}
|
||||
|
||||
void ParticleEffectEntityItem::setColorSpread(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _particleProperties.color.gradient.spread != glm::vec3(value);
|
||||
_particleProperties.color.gradient.spread = value;
|
||||
});
|
||||
}
|
||||
|
||||
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 +1099,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,24 @@ glm::u8vec3 PolyLineEntityItem::getColor() const {
|
|||
return _color;
|
||||
});
|
||||
}
|
||||
|
||||
void PolyLineEntityItem::setIsUVModeStretch(bool isUVModeStretch) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = _isUVModeStretch != isUVModeStretch;
|
||||
_isUVModeStretch = isUVModeStretch;
|
||||
});
|
||||
}
|
||||
|
||||
void PolyLineEntityItem::setGlow(bool glow) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = _glow != glow;
|
||||
_glow = glow;
|
||||
});
|
||||
}
|
||||
|
||||
void PolyLineEntityItem::setFaceCamera(bool faceCamera) {
|
||||
withWriteLock([&] {
|
||||
_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,37 +70,12 @@ 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));
|
||||
|
||||
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;
|
||||
}
|
||||
_needsRenderUpdate |= _voxelVolumeSize != voxelVolumeSize;
|
||||
_voxelVolumeSize = voxelVolumeSize;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -247,13 +222,14 @@ QByteArray PolyVoxEntityItem::getVoxelData() const {
|
|||
}
|
||||
|
||||
|
||||
void PolyVoxEntityItem::setXTextureURL(const QString& xTextureURL) {
|
||||
void PolyVoxEntityItem::setXTextureURL(const QString& xTextureURL) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _xTextureURL != xTextureURL;
|
||||
_xTextureURL = xTextureURL;
|
||||
});
|
||||
}
|
||||
|
||||
QString PolyVoxEntityItem::getXTextureURL() const {
|
||||
QString PolyVoxEntityItem::getXTextureURL() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _xTextureURL;
|
||||
|
@ -263,11 +239,12 @@ QString PolyVoxEntityItem::getXTextureURL() const {
|
|||
|
||||
void PolyVoxEntityItem::setYTextureURL(const QString& yTextureURL) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _yTextureURL != yTextureURL;
|
||||
_yTextureURL = yTextureURL;
|
||||
});
|
||||
}
|
||||
|
||||
QString PolyVoxEntityItem::getYTextureURL() const {
|
||||
QString PolyVoxEntityItem::getYTextureURL() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _yTextureURL;
|
||||
|
@ -277,10 +254,11 @@ QString PolyVoxEntityItem::getYTextureURL() const {
|
|||
|
||||
void PolyVoxEntityItem::setZTextureURL(const QString& zTextureURL) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _zTextureURL != zTextureURL;
|
||||
_zTextureURL = zTextureURL;
|
||||
});
|
||||
}
|
||||
QString PolyVoxEntityItem::getZTextureURL() const {
|
||||
QString PolyVoxEntityItem::getZTextureURL() const {
|
||||
QString result;
|
||||
withReadLock([&] {
|
||||
result = _zTextureURL;
|
||||
|
@ -288,13 +266,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 +280,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 +294,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 +308,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 +322,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 +336,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;
|
||||
|
|
|
@ -129,9 +129,7 @@ EntityItemProperties ShapeEntityItem::getProperties(const EntityPropertyFlags& d
|
|||
}
|
||||
|
||||
void ShapeEntityItem::setShape(const entity::Shape& shape) {
|
||||
const entity::Shape prevShape = _shape;
|
||||
_shape = shape;
|
||||
switch (_shape) {
|
||||
switch (shape) {
|
||||
case entity::Shape::Cube:
|
||||
_type = EntityTypes::Box;
|
||||
break;
|
||||
|
@ -151,12 +149,22 @@ void ShapeEntityItem::setShape(const entity::Shape& shape) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (_shape != prevShape) {
|
||||
if (shape != getShape()) {
|
||||
// Internally grabs writeLock
|
||||
markDirtyFlags(Simulation::DIRTY_SHAPE);
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate = true;
|
||||
_shape = shape;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
entity::Shape ShapeEntityItem::getShape() const {
|
||||
return resultWithReadLock<entity::Shape>([&] {
|
||||
return _shape;
|
||||
});
|
||||
}
|
||||
|
||||
bool ShapeEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||
bool somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class
|
||||
|
||||
|
@ -165,6 +173,7 @@ bool ShapeEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(shape, setShape);
|
||||
|
||||
|
@ -232,6 +241,7 @@ void ShapeEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
|||
|
||||
void ShapeEntityItem::setColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _color != value;
|
||||
_color = value;
|
||||
});
|
||||
}
|
||||
|
@ -244,6 +254,7 @@ glm::u8vec3 ShapeEntityItem::getColor() const {
|
|||
|
||||
void ShapeEntityItem::setAlpha(float alpha) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||
bool& somethingChanged) override;
|
||||
|
||||
entity::Shape getShape() const { return _shape; }
|
||||
entity::Shape getShape() const;
|
||||
void setShape(const entity::Shape& shape);
|
||||
void setShape(const QString& shape) { setShape(entity::shapeFromString(shape)); }
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ bool TextEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
withWriteLock([&] {
|
||||
bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);
|
||||
somethingChanged |= pulsePropertiesChanged;
|
||||
_needsRenderUpdate |= pulsePropertiesChanged;
|
||||
});
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(billboardMode, setBillboardMode);
|
||||
|
||||
|
@ -180,7 +181,7 @@ void TextEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
|
|||
EntityPropertyFlags& propertyFlags,
|
||||
EntityPropertyFlags& propertiesDidntFit,
|
||||
int& propertyCount,
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
|
||||
bool successPropertyFits = true;
|
||||
|
||||
|
@ -272,6 +273,7 @@ bool TextEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, c
|
|||
|
||||
void TextEntityItem::setText(const QString& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _text != value;
|
||||
_text = value;
|
||||
});
|
||||
}
|
||||
|
@ -282,13 +284,14 @@ QString TextEntityItem::getText() const {
|
|||
});
|
||||
}
|
||||
|
||||
void TextEntityItem::setLineHeight(float value) {
|
||||
void TextEntityItem::setLineHeight(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _lineHeight != value;
|
||||
_lineHeight = value;
|
||||
});
|
||||
}
|
||||
|
||||
float TextEntityItem::getLineHeight() const {
|
||||
float TextEntityItem::getLineHeight() const {
|
||||
float result;
|
||||
withReadLock([&] {
|
||||
result = _lineHeight;
|
||||
|
@ -298,6 +301,7 @@ float TextEntityItem::getLineHeight() const {
|
|||
|
||||
void TextEntityItem::setTextColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _textColor != value;
|
||||
_textColor = value;
|
||||
});
|
||||
}
|
||||
|
@ -310,6 +314,7 @@ glm::u8vec3 TextEntityItem::getTextColor() const {
|
|||
|
||||
void TextEntityItem::setTextAlpha(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _textAlpha != value;
|
||||
_textAlpha = value;
|
||||
});
|
||||
}
|
||||
|
@ -322,6 +327,7 @@ float TextEntityItem::getTextAlpha() const {
|
|||
|
||||
void TextEntityItem::setBackgroundColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _backgroundColor != value;
|
||||
_backgroundColor = value;
|
||||
});
|
||||
}
|
||||
|
@ -334,6 +340,7 @@ glm::u8vec3 TextEntityItem::getBackgroundColor() const {
|
|||
|
||||
void TextEntityItem::setBackgroundAlpha(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _backgroundAlpha != value;
|
||||
_backgroundAlpha = value;
|
||||
});
|
||||
}
|
||||
|
@ -354,12 +361,14 @@ BillboardMode TextEntityItem::getBillboardMode() const {
|
|||
|
||||
void TextEntityItem::setBillboardMode(BillboardMode value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _billboardMode != value;
|
||||
_billboardMode = value;
|
||||
});
|
||||
}
|
||||
|
||||
void TextEntityItem::setLeftMargin(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _leftMargin != value;
|
||||
_leftMargin = value;
|
||||
});
|
||||
}
|
||||
|
@ -372,6 +381,7 @@ float TextEntityItem::getLeftMargin() const {
|
|||
|
||||
void TextEntityItem::setRightMargin(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _rightMargin != value;
|
||||
_rightMargin = value;
|
||||
});
|
||||
}
|
||||
|
@ -384,6 +394,7 @@ float TextEntityItem::getRightMargin() const {
|
|||
|
||||
void TextEntityItem::setTopMargin(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _topMargin != value;
|
||||
_topMargin = value;
|
||||
});
|
||||
}
|
||||
|
@ -396,6 +407,7 @@ float TextEntityItem::getTopMargin() const {
|
|||
|
||||
void TextEntityItem::setBottomMargin(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _bottomMargin != value;
|
||||
_bottomMargin = value;
|
||||
});
|
||||
}
|
||||
|
@ -408,6 +420,7 @@ float TextEntityItem::getBottomMargin() const {
|
|||
|
||||
void TextEntityItem::setUnlit(bool value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _unlit != value;
|
||||
_unlit = value;
|
||||
});
|
||||
}
|
||||
|
@ -420,6 +433,7 @@ bool TextEntityItem::getUnlit() const {
|
|||
|
||||
void TextEntityItem::setFont(const QString& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _font != value;
|
||||
_font = value;
|
||||
});
|
||||
}
|
||||
|
@ -432,6 +446,7 @@ QString TextEntityItem::getFont() const {
|
|||
|
||||
void TextEntityItem::setTextEffect(TextEffect value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _effect != value;
|
||||
_effect = value;
|
||||
});
|
||||
}
|
||||
|
@ -444,6 +459,7 @@ TextEffect TextEntityItem::getTextEffect() const {
|
|||
|
||||
void TextEntityItem::setTextEffectColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _effectColor != value;
|
||||
_effectColor = value;
|
||||
});
|
||||
}
|
||||
|
@ -456,6 +472,7 @@ glm::u8vec3 TextEntityItem::getTextEffectColor() const {
|
|||
|
||||
void TextEntityItem::setTextEffectThickness(float value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _effectThickness != value;
|
||||
_effectThickness = value;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -229,6 +230,7 @@ bool WebEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, co
|
|||
|
||||
void WebEntityItem::setColor(const glm::u8vec3& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _color != value;
|
||||
_color = value;
|
||||
});
|
||||
}
|
||||
|
@ -241,6 +243,7 @@ glm::u8vec3 WebEntityItem::getColor() const {
|
|||
|
||||
void WebEntityItem::setAlpha(float alpha) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _alpha != alpha;
|
||||
_alpha = alpha;
|
||||
});
|
||||
}
|
||||
|
@ -259,12 +262,14 @@ BillboardMode WebEntityItem::getBillboardMode() const {
|
|||
|
||||
void WebEntityItem::setBillboardMode(BillboardMode value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _billboardMode != value;
|
||||
_billboardMode = value;
|
||||
});
|
||||
}
|
||||
|
||||
void WebEntityItem::setSourceUrl(const QString& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _sourceUrl != value;
|
||||
_sourceUrl = value;
|
||||
});
|
||||
}
|
||||
|
@ -277,6 +282,7 @@ QString WebEntityItem::getSourceUrl() const {
|
|||
|
||||
void WebEntityItem::setDPI(uint16_t value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _dpi != value;
|
||||
_dpi = value;
|
||||
});
|
||||
}
|
||||
|
@ -288,16 +294,18 @@ 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();
|
||||
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _scriptURL != urlString;
|
||||
_scriptURL = urlString;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -309,6 +317,7 @@ QString WebEntityItem::getScriptURL() const {
|
|||
|
||||
void WebEntityItem::setMaxFPS(uint8_t value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _maxFPS != value;
|
||||
_maxFPS = value;
|
||||
});
|
||||
}
|
||||
|
@ -321,6 +330,7 @@ uint8_t WebEntityItem::getMaxFPS() const {
|
|||
|
||||
void WebEntityItem::setInputMode(const WebInputMode& value) {
|
||||
withWriteLock([&] {
|
||||
_needsRenderUpdate |= _inputMode != value;
|
||||
_inputMode = value;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -584,6 +584,7 @@ protected:
|
|||
friend class GLState;
|
||||
friend class GLTexture;
|
||||
friend class GLShader;
|
||||
friend class GLPipeline;
|
||||
};
|
||||
|
||||
}} // namespace gpu::gl
|
||||
|
|
|
@ -202,7 +202,7 @@ GLint GLBackend::getRealUniformLocation(GLint location) const {
|
|||
|
||||
void GLBackend::postLinkProgram(ShaderObject& shaderObject, const Shader& program) const {
|
||||
const auto& glprogram = shaderObject.glprogram;
|
||||
const auto& expectedUniforms = program.getReflection().uniforms;
|
||||
auto expectedUniforms = program.getReflection(getShaderDialect(), getShaderVariant()).uniforms;
|
||||
|
||||
auto& uniformRemap = shaderObject.uniformRemap;
|
||||
// initialize all the uniforms with an invalid location
|
||||
|
|
|
@ -52,7 +52,8 @@ GLPipeline* GLPipeline::sync(GLBackend& backend, const Pipeline& pipeline) {
|
|||
// Special case for view correction matrices, any pipeline that declares the correction buffer
|
||||
// uniform will automatically have it provided without any client code necessary.
|
||||
// Required for stable lighting in the HMD.
|
||||
object->_cameraCorrection = shader->getReflection().validUniformBuffer(gpu::slot::buffer::CameraCorrection);
|
||||
auto reflection = shader->getReflection(backend.getShaderDialect(), backend.getShaderVariant());
|
||||
object->_cameraCorrection = reflection.validUniformBuffer(gpu::slot::buffer::CameraCorrection);
|
||||
object->_program = programObject;
|
||||
object->_state = stateObject;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace gpu::gl41;
|
|||
void GL41Backend::postLinkProgram(ShaderObject& programObject, const Shader& program) const {
|
||||
Parent::postLinkProgram(programObject, program);
|
||||
const auto& glprogram = programObject.glprogram;
|
||||
const auto& reflection = program.getReflection();
|
||||
auto reflection = program.getReflection(getShaderDialect(), getShaderVariant());
|
||||
// For the UBOs, use glUniformBlockBinding to fixup the locations based on the reflection
|
||||
{
|
||||
const auto& expectedUbos = reflection.uniformBuffers;
|
||||
|
@ -43,25 +43,23 @@ void GL41Backend::postLinkProgram(ShaderObject& programObject, const Shader& pro
|
|||
}
|
||||
|
||||
// For the resource buffers, do the same as for the textures, since in GL 4.1 that's how they're implemented
|
||||
static const std::string TRANSFORM_OBJECT_BUFFER = "transformObjectBuffer";
|
||||
{
|
||||
const auto& expectedResourceBuffers = reflection.resourceBuffers;
|
||||
const auto names = Shader::Reflection::getNames(expectedResourceBuffers);
|
||||
const auto resourceBufferUniforms = ::gl::Uniform::loadByName(glprogram, names);
|
||||
for (const auto& resourceBuffer : resourceBufferUniforms) {
|
||||
|
||||
// Special case for the transformObjectBuffer, which is filtered out of the reflection data at shader load time
|
||||
if (resourceBuffer.name == TRANSFORM_OBJECT_BUFFER) {
|
||||
glProgramUniform1i(glprogram, resourceBuffer.binding, ::gpu::slot::texture::ObjectTransforms);
|
||||
continue;
|
||||
}
|
||||
const auto& targetBinding = expectedResourceBuffers.at(resourceBuffer.name);
|
||||
glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding);
|
||||
}
|
||||
}
|
||||
|
||||
// Special case for the transformObjectBuffer, which is filtered out of the reflection data at shader load time
|
||||
//
|
||||
{
|
||||
static const std::string TRANSFORM_OBJECT_BUFFER = "transformObjectBuffer";
|
||||
const auto uniform = ::gl::Uniform::loadByName(glprogram, TRANSFORM_OBJECT_BUFFER);
|
||||
if (-1 != uniform.binding) {
|
||||
glProgramUniform1i(glprogram, uniform.binding, ::gpu::slot::texture::ObjectTransforms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,17 +43,34 @@ Shader::Shader(Type type, const Pointer& vertex, const Pointer& geometry, const
|
|||
shaders[VERTEX] = vertex;
|
||||
shaders[PIXEL] = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
auto& reflection = const_cast<Reflection&>(getReflection());
|
||||
for (const auto& subShader : _shaders) {
|
||||
reflection.merge(subShader->getReflection());
|
||||
}
|
||||
if (_shaders[VERTEX]) {
|
||||
reflection.inputs = _shaders[VERTEX]->getReflection().inputs;
|
||||
}
|
||||
if (_shaders[PIXEL]) {
|
||||
reflection.outputs = _shaders[PIXEL]->getReflection().outputs;
|
||||
Shader::Reflection Shader::getReflection(shader::Dialect dialect, shader::Variant variant) const {
|
||||
if (_type == Shader::Type::PROGRAM) {
|
||||
Reflection reflection;
|
||||
for (const auto& subShader : _shaders) {
|
||||
reflection.merge(subShader->getReflection(dialect, variant));
|
||||
}
|
||||
if (_shaders[VERTEX]) {
|
||||
reflection.inputs = _shaders[VERTEX]->getReflection(dialect, variant).inputs;
|
||||
}
|
||||
if (_shaders[PIXEL]) {
|
||||
reflection.outputs = _shaders[PIXEL]->getReflection(dialect, variant).outputs;
|
||||
}
|
||||
|
||||
return reflection;
|
||||
}
|
||||
|
||||
return _source.getReflection(dialect, variant);
|
||||
}
|
||||
|
||||
|
||||
Shader::Reflection Shader::getReflection() const {
|
||||
// For sake of convenience i would like to be able to use a "default" dialect that represents the reflection
|
||||
// of the source of the shader
|
||||
// What i really want, is a reflection that is designed for the gpu lib interface but we don't have that yet (glsl45 is the closest to that)
|
||||
// Until we have an implementation for this, we will return such default reflection from the one available and platform specific
|
||||
return getReflection(shader::DEFAULT_DIALECT, shader::Variant::Mono);
|
||||
}
|
||||
|
||||
Shader::~Shader()
|
||||
|
|
|
@ -91,7 +91,8 @@ public:
|
|||
|
||||
const Shaders& getShaders() const { return _shaders; }
|
||||
|
||||
const Reflection& getReflection() const { return _source.reflection; }
|
||||
Reflection getReflection(shader::Dialect dialect, shader::Variant variant) const;
|
||||
Reflection getReflection() const; // get the default version of the reflection
|
||||
|
||||
// Compilation Handler can be passed while compiling a shader (in the makeProgram call) to be able to give the hand to
|
||||
// the caller thread if the compilation fails and to provide a different version of the source for it
|
||||
|
|
|
@ -306,6 +306,7 @@ void MultiSphereShape::spheresFromAxes(const std::vector<glm::vec3>& points, con
|
|||
float distance = glm::length(axis);
|
||||
float correntionRatio = radiusRatio * (spheres[j]._radius / maxAverageRadius);
|
||||
float radius = (correntionRatio < 0.8f * radiusRatio ? 0.8f * radiusRatio : correntionRatio) * spheres[j]._radius;
|
||||
maxRadius = radius > maxRadius ? radius : maxRadius;
|
||||
if (sphereCount > 3) {
|
||||
distance = contractionRatio * distance;
|
||||
}
|
||||
|
@ -317,15 +318,28 @@ void MultiSphereShape::spheresFromAxes(const std::vector<glm::vec3>& points, con
|
|||
}
|
||||
}
|
||||
// Collapse spheres if too close
|
||||
if (sphereCount == 2) {
|
||||
int maxRadiusIndex = spheres[0]._radius > spheres[1]._radius ? 0 : 1;
|
||||
if (glm::length(spheres[0]._position - spheres[1]._position) < 0.2f * spheres[maxRadiusIndex]._radius) {
|
||||
SphereShapeData newSphere;
|
||||
newSphere._position = 0.5f * (spheres[0]._position + spheres[1]._position);
|
||||
newSphere._radius = spheres[maxRadiusIndex]._radius;
|
||||
spheres.clear();
|
||||
spheres.push_back(newSphere);
|
||||
if (sphereCount > 1) {
|
||||
bool collapsed = false;
|
||||
for (size_t i = 0; i < spheres.size() - 1; i++) {
|
||||
for (size_t j = i + 1; j < spheres.size(); j++) {
|
||||
if (i != j) {
|
||||
size_t maxRadiusIndex = spheres[i]._radius > spheres[j]._radius ? i : j;
|
||||
if (glm::length(spheres[i]._position - spheres[j]._position) < 0.2f * spheres[maxRadiusIndex]._radius) {
|
||||
SphereShapeData newSphere;
|
||||
newSphere._position = _midPoint;
|
||||
newSphere._radius = maxRadius;
|
||||
spheres.clear();
|
||||
spheres.push_back(newSphere);
|
||||
collapsed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (collapsed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,21 +58,31 @@ bool filterOnComputer(const platform::json& computer, Profiler::Tier& tier) {
|
|||
// tier filter on computer MACOS
|
||||
bool filterOnComputerMACOS(const platform::json& computer, Profiler::Tier& tier) {
|
||||
|
||||
// it s a macos computer, probably can tell from the model name:
|
||||
if (computer.count(keys::computer::model)) {
|
||||
const auto model = computer[keys::computer::model].get<std::string>();
|
||||
if (model.find("MacBookAir") != std::string::npos) {
|
||||
// it s a macos computer, probably can tell from the model name but...
|
||||
// The simple rule for mac is
|
||||
// if it s an intel gpu then LOW
|
||||
// else go mid
|
||||
auto gpu = platform::getGPU(platform::getMasterGPU());
|
||||
if (gpu.count(keys::gpu::vendor)) {
|
||||
std::string gpuVendor = gpu[keys::gpu::vendor].get<std::string>();
|
||||
|
||||
// intel integrated graphics
|
||||
if (gpuVendor.find(keys::gpu::vendor_Intel) != std::string::npos) {
|
||||
// go LOW because Intel GPU
|
||||
tier = Profiler::Tier::LOW;
|
||||
return true;
|
||||
} else if (model.find("MacBookPro") != std::string::npos) {
|
||||
} else {
|
||||
// else go mid
|
||||
tier = Profiler::Tier::MID;
|
||||
return true;
|
||||
} else if (model.find("MacBook") != std::string::npos) {
|
||||
tier = Profiler::Tier::LOW;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// no gpuinfo ?
|
||||
// Go low in doubt
|
||||
// go LOW because Intel GPU
|
||||
tier = Profiler::Tier::LOW;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool filterOnProcessors(const platform::json& computer, const platform::json& cpu, const platform::json& gpu, Profiler::Tier& tier) {
|
||||
|
@ -133,30 +143,6 @@ bool filterOnProcessors(const platform::json& computer, const platform::json& cp
|
|||
// YES on macos EXCEPT for macbookair with gpu intel iris or intel HD 6000
|
||||
bool Profiler::isRenderMethodDeferredCapable() {
|
||||
#if defined(Q_OS_MAC)
|
||||
// Deferred works correctly on every supported macos platform at the moment, let s enable it
|
||||
/*
|
||||
auto computer = platform::getComputer();
|
||||
const auto computerModel = (computer.count(keys::computer::model) ? computer[keys::computer::model].get<std::string>() : "");
|
||||
|
||||
auto gpuInfo = platform::getGPU(getMasterGPU());
|
||||
const auto gpuModel = (gpuInfo.count(keys::gpu::model) ? gpuInfo[keys::gpu::model].get<std::string>() : "");
|
||||
|
||||
|
||||
// Macbook air 2018 are a problem
|
||||
if ((computerModel.find("MacBookAir7,2") != std::string::npos) && (gpuModel.find("Intel HD Graphics 6000") != std::string::npos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We know for fact that the Mac BOok Pro 13 from Mid 2014 INtel Iris is problematic,
|
||||
if ((computerModel.find("MacBookPro11,1") != std::string::npos) && (gpuModel.find("Intel Iris") != std::string::npos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TO avoid issues for the next few days, we are excluding all of intel chipset...
|
||||
if ((gpuModel.find("Intel ") != std::string::npos)) {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
return false;
|
||||
|
|
|
@ -264,12 +264,24 @@ void Procedural::prepare(gpu::Batch& batch,
|
|||
fragmentSource.replacements[PROCEDURAL_VERSION] = "#define PROCEDURAL_V" + std::to_string(_data.version);
|
||||
fragmentSource.replacements[PROCEDURAL_BLOCK] = _shaderSource.toStdString();
|
||||
|
||||
// Set any userdata specified uniforms
|
||||
int customSlot = procedural::slot::uniform::Custom;
|
||||
for (const auto& key : _data.uniforms.keys()) {
|
||||
std::string uniformName = key.toLocal8Bit().data();
|
||||
fragmentSource.reflection.uniforms[uniformName] = customSlot;
|
||||
++customSlot;
|
||||
// Set any userdata specified uniforms (if any)
|
||||
if (!_data.uniforms.empty()) {
|
||||
// First grab all the possible dialect/variant/Reflections
|
||||
std::vector<shader::Reflection*> allReflections;
|
||||
for (auto dialectIt = fragmentSource.dialectSources.begin(); dialectIt != fragmentSource.dialectSources.end(); ++dialectIt) {
|
||||
for (auto variantIt = (*dialectIt).second.variantSources.begin(); variantIt != (*dialectIt).second.variantSources.end(); ++variantIt) {
|
||||
allReflections.push_back(&(*variantIt).second.reflection);
|
||||
}
|
||||
}
|
||||
// Then fill in every reflections the new custom bindings
|
||||
int customSlot = procedural::slot::uniform::Custom;
|
||||
for (const auto& key : _data.uniforms.keys()) {
|
||||
std::string uniformName = key.toLocal8Bit().data();
|
||||
for (auto reflection : allReflections) {
|
||||
reflection->uniforms[uniformName] = customSlot;
|
||||
}
|
||||
++customSlot;
|
||||
}
|
||||
}
|
||||
|
||||
// Leave this here for debugging
|
||||
|
|
|
@ -136,7 +136,6 @@ void RenderEventHandler::qmlRender(bool sceneGraphSync) {
|
|||
|
||||
resize();
|
||||
|
||||
|
||||
if (_currentSize != QSize()) {
|
||||
PROFILE_RANGE(render_qml_gl, "render");
|
||||
GLuint texture = SharedObject::getTextureCache().acquireTexture(_currentSize);
|
||||
|
@ -148,7 +147,15 @@ void RenderEventHandler::qmlRender(bool sceneGraphSync) {
|
|||
} else {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
_shared->setRenderTarget(_fbo, _currentSize);
|
||||
_shared->_renderControl->render();
|
||||
|
||||
// workaround for https://highfidelity.atlassian.net/browse/BUGZ-1119
|
||||
{
|
||||
// Serialize QML rendering because of a crash caused by Qt bug
|
||||
// https://bugreports.qt.io/browse/QTBUG-77469
|
||||
static std::mutex qmlRenderMutex;
|
||||
std::unique_lock<std::mutex> qmlRenderLock{ qmlRenderMutex };
|
||||
_shared->_renderControl->render();
|
||||
}
|
||||
}
|
||||
_shared->_lastRenderTime = usecTimestampNow();
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
|
|
@ -48,6 +48,17 @@ using namespace render;
|
|||
|
||||
extern void initForwardPipelines(ShapePlumber& plumber);
|
||||
|
||||
void PreparePrimaryFramebufferMSAAConfig::setResolutionScale(float scale) {
|
||||
const float SCALE_RANGE_MIN = 0.1f;
|
||||
const float SCALE_RANGE_MAX = 2.0f;
|
||||
resolutionScale = std::max(SCALE_RANGE_MIN, std::min(SCALE_RANGE_MAX, scale));
|
||||
}
|
||||
|
||||
void PreparePrimaryFramebufferMSAAConfig::setNumSamples(int num) {
|
||||
numSamples = std::max(1, std::min(32, num));
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
void RenderForwardTask::configure(const Config& config) {
|
||||
// Propagate resolution scale to sub jobs who need it
|
||||
auto preparePrimaryBufferConfig = config.getConfig<PreparePrimaryFramebufferMSAA>("PreparePrimaryBufferForward");
|
||||
|
|
|
@ -42,22 +42,14 @@ public:
|
|||
|
||||
class PreparePrimaryFramebufferMSAAConfig : public render::Job::Config {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale)
|
||||
Q_PROPERTY(int numSamples WRITE setNumSamples READ getNumSamples)
|
||||
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale NOTIFY dirty)
|
||||
Q_PROPERTY(int numSamples WRITE setNumSamples READ getNumSamples NOTIFY dirty)
|
||||
public:
|
||||
float getResolutionScale() const { return resolutionScale; }
|
||||
void setResolutionScale(float scale) {
|
||||
const float SCALE_RANGE_MIN = 0.1f;
|
||||
const float SCALE_RANGE_MAX = 2.0f;
|
||||
resolutionScale = std::max(SCALE_RANGE_MIN, std::min(SCALE_RANGE_MAX, scale));
|
||||
//emit dirty();
|
||||
}
|
||||
void setResolutionScale(float scale);
|
||||
|
||||
int getNumSamples() const { return numSamples; }
|
||||
void setNumSamples(int num) {
|
||||
numSamples = std::max(1, std::min(32, num));
|
||||
emit dirty();
|
||||
}
|
||||
void setNumSamples(int num);
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace render {
|
|||
|
||||
|
||||
GPUTaskConfig() = default;
|
||||
GPUTaskConfig(bool enabled) : TaskConfig(enabled) {}
|
||||
GPUTaskConfig(bool enabled) : render::TaskConfig(enabled) {}
|
||||
|
||||
// Running Time measurement on GPU and for Batch execution
|
||||
void setGPUBatchRunTime(double msGpuTime, double msBatchTime) { _msGPURunTime = msGpuTime; _msBatchRunTime = msBatchTime; }
|
||||
|
|
|
@ -86,7 +86,7 @@ void ShapePlumber::addPipeline(const Key& key, const gpu::ShaderPointer& program
|
|||
void ShapePlumber::addPipeline(const Filter& filter, const gpu::ShaderPointer& program, const gpu::StatePointer& state,
|
||||
BatchSetter batchSetter, ItemSetter itemSetter) {
|
||||
ShapeKey key{ filter._flags };
|
||||
const auto& reflection = program->getReflection();
|
||||
auto reflection = program->getReflection();
|
||||
auto locations = std::make_shared<Locations>();
|
||||
locations->albedoTextureUnit = reflection.validTexture(graphics::slot::texture::MaterialAlbedo);
|
||||
locations->roughnessTextureUnit = reflection.validTexture(graphics::slot::texture::MaterialRoughness);
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace shader {
|
|||
|
||||
#if defined(USE_GLES)
|
||||
|
||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl310es;
|
||||
const Dialect DEFAULT_DIALECT = Dialect::glsl310es;
|
||||
|
||||
const std::vector<Dialect>& allDialects() {
|
||||
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl310es } };
|
||||
|
@ -41,7 +41,7 @@ const std::vector<Dialect>& allDialects() {
|
|||
|
||||
#elif defined(Q_OS_MAC)
|
||||
|
||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl410;
|
||||
const Dialect DEFAULT_DIALECT = Dialect::glsl410;
|
||||
|
||||
const std::vector<Dialect>& allDialects() {
|
||||
static const std::vector<Dialect> ALL_DIALECTS{ Dialect::glsl410 };
|
||||
|
@ -50,7 +50,7 @@ const std::vector<Dialect>& allDialects() {
|
|||
|
||||
#else
|
||||
|
||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl450;
|
||||
const Dialect DEFAULT_DIALECT = Dialect::glsl450;
|
||||
|
||||
const std::vector<Dialect> & allDialects() {
|
||||
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl450, Dialect::glsl410 } };
|
||||
|
@ -131,7 +131,6 @@ Source::Pointer Source::loadSource(uint32_t shaderId) {
|
|||
for (const auto& dialect : dialects) {
|
||||
result->dialectSources[dialect] = loadDialectSource(dialect, shaderId);
|
||||
}
|
||||
result->reflection = result->dialectSources[DEFAULT_DIALECT].variantSources[Variant::Mono].reflection;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -140,7 +139,6 @@ Source& Source::operator=(const Source& other) {
|
|||
name = other.name;
|
||||
dialectSources = other.dialectSources;
|
||||
replacements = other.replacements;
|
||||
reflection = other.reflection;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ enum class Dialect
|
|||
#endif
|
||||
};
|
||||
|
||||
extern const Dialect DEFAULT_DIALECT;
|
||||
|
||||
const std::vector<Dialect>& allDialects();
|
||||
const std::string& dialectPath(Dialect dialect);
|
||||
|
||||
|
@ -140,9 +142,6 @@ struct Source {
|
|||
// The name of the shader file, with extension, i.e. DrawColor.frag
|
||||
std::string name;
|
||||
|
||||
// Generic reflection, copied from the 450 dialect / mono variant
|
||||
Reflection reflection;
|
||||
|
||||
// Map of platforms to their specific shaders
|
||||
std::unordered_map<Dialect, DialectSource, EnumClassHash> dialectSources;
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ void JobConfig::refresh() {
|
|||
_jobConcept->applyConfiguration();
|
||||
}
|
||||
|
||||
TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& jobName) const {
|
||||
TaskConfig* root = const_cast<TaskConfig*> (this);
|
||||
JobConfig* JobConfig::getRootConfig(const std::string& jobPath, std::string& jobName) const {
|
||||
JobConfig* root = const_cast<JobConfig*> (this);
|
||||
|
||||
std::list<std::string> tokens;
|
||||
std::size_t pos = 0, sepPos;
|
||||
|
@ -105,7 +105,7 @@ TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& j
|
|||
while (tokens.size() > 1) {
|
||||
auto taskName = tokens.front();
|
||||
tokens.pop_front();
|
||||
root = root->findChild<TaskConfig*>((taskName.empty() ? QString() : QString(taskName.c_str())));
|
||||
root = root->findChild<JobConfig*>((taskName.empty() ? QString() : QString(taskName.c_str())));
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& j
|
|||
return root;
|
||||
}
|
||||
|
||||
JobConfig* TaskConfig::getJobConfig(const std::string& jobPath) const {
|
||||
JobConfig* JobConfig::getJobConfig(const std::string& jobPath) const {
|
||||
std::string jobName;
|
||||
auto root = getRootConfig(jobPath, jobName);
|
||||
|
||||
|
@ -134,10 +134,10 @@ JobConfig* TaskConfig::getJobConfig(const std::string& jobPath) const {
|
|||
}
|
||||
}
|
||||
|
||||
void SwitchConfig::setBranch(uint8_t branch) {
|
||||
void JobConfig::setBranch(uint8_t branch) {
|
||||
if (_branch != branch) {
|
||||
_branch = branch;
|
||||
// We can re-use this signal here
|
||||
emit dirtyEnabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,11 +83,19 @@ protected:
|
|||
Setting::Handle<QString> _preset;
|
||||
};
|
||||
|
||||
class JobConfig;
|
||||
|
||||
class TConfigProxy {
|
||||
public:
|
||||
using Config = JobConfig;
|
||||
};
|
||||
|
||||
// A default Config is always on; to create an enableable Config, use the ctor JobConfig(bool enabled)
|
||||
class JobConfig : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(double cpuRunTime READ getCPURunTime NOTIFY newStats()) //ms
|
||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY dirtyEnabled())
|
||||
Q_PROPERTY(int branch READ getBranch WRITE setBranch NOTIFY dirtyEnabled)
|
||||
|
||||
double _msCPURunTime{ 0.0 };
|
||||
|
||||
|
@ -96,7 +104,11 @@ protected:
|
|||
|
||||
bool _isEnabled{ true };
|
||||
|
||||
uint8_t _branch { 0 };
|
||||
public:
|
||||
bool _isTask{ false };
|
||||
bool _isSwitch{ false };
|
||||
|
||||
using Persistent = PersistentConfig<JobConfig>;
|
||||
|
||||
JobConfig() = default;
|
||||
|
@ -121,44 +133,83 @@ public:
|
|||
*/
|
||||
Q_INVOKABLE void load(const QVariantMap& map) { qObjectFromJsonValue(QJsonObject::fromVariantMap(map), *this); emit loaded(); }
|
||||
|
||||
Q_INVOKABLE QObject* getConfig(const QString& name) { return nullptr; }
|
||||
|
||||
// Running Time measurement
|
||||
// The new stats signal is emitted once per run time of a job when stats (cpu runtime) are updated
|
||||
void setCPURunTime(const std::chrono::nanoseconds& runtime) { _msCPURunTime = std::chrono::duration<double, std::milli>(runtime).count(); emit newStats(); }
|
||||
double getCPURunTime() const { return _msCPURunTime; }
|
||||
|
||||
// Describe the node graph data connections of the associated Job/Task
|
||||
/**jsdoc
|
||||
* @function Workload.isTask
|
||||
* @function Render.getConfig
|
||||
* @param {string} name
|
||||
* @returns {object}
|
||||
*/
|
||||
// Get a sub job config through task.getConfig(path)
|
||||
// where path can be:
|
||||
// - <job_name> search for the first job named job_name traversing the the sub graph of task and jobs (from this task as root)
|
||||
// - <parent_name>.[<sub_parent_names>.]<job_name>
|
||||
// Allowing to first look for the parent_name job (from this task as root) and then search from there for the
|
||||
// optional sub_parent_names and finally from there looking for the job_name (assuming every job in the path were found)
|
||||
//
|
||||
// getter for qml integration, prefer the templated getter
|
||||
Q_INVOKABLE QObject* getConfig(const QString& name) { return getConfig<TConfigProxy>(name.toStdString()); }
|
||||
|
||||
// getter for cpp (strictly typed), prefer this getter
|
||||
JobConfig* getRootConfig(const std::string& jobPath, std::string& jobName) const;
|
||||
JobConfig* getJobConfig(const std::string& jobPath) const;
|
||||
template <class T> typename T::Config* getConfig(std::string jobPath = "") const {
|
||||
return dynamic_cast<typename T::Config*>(getJobConfig(jobPath));
|
||||
}
|
||||
|
||||
// Describe the node graph data connections of the associated Job/Task
|
||||
/**jsdoc
|
||||
* @function JobConfig.isTask
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Q_INVOKABLE bool isTask() const { return _isTask; }
|
||||
|
||||
/**jsdoc
|
||||
* @function JobConfig.isSwitch
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Q_INVOKABLE virtual bool isTask() const { return false; }
|
||||
Q_INVOKABLE bool isSwitch() const { return _isSwitch; }
|
||||
|
||||
/**jsdoc
|
||||
* @function Workload.getSubConfigs
|
||||
* @function JobConfig.getSubConfigs
|
||||
* @returns {object[]}
|
||||
*/
|
||||
Q_INVOKABLE virtual QObjectList getSubConfigs() const { return QObjectList(); }
|
||||
Q_INVOKABLE QObjectList getSubConfigs() const {
|
||||
auto list = findChildren<JobConfig*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
|
||||
QObjectList returned;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
returned.push_back(list[i]);
|
||||
}
|
||||
return returned;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* @function Workload.getNumSubs
|
||||
* @function JobConfig.getNumSubs
|
||||
* @returns {number}
|
||||
*/
|
||||
Q_INVOKABLE virtual int getNumSubs() const { return 0; }
|
||||
Q_INVOKABLE int getNumSubs() const { return getSubConfigs().size(); }
|
||||
|
||||
/**jsdoc
|
||||
* @function Workload.getSubConfig
|
||||
* @function JobConfig.getSubConfig
|
||||
* @param {number} index
|
||||
* @returns {object}
|
||||
*/
|
||||
Q_INVOKABLE virtual QObject* getSubConfig(int i) const { return nullptr; }
|
||||
|
||||
Q_INVOKABLE QObject* getSubConfig(int i) const {
|
||||
auto subs = getSubConfigs();
|
||||
return ((i < 0 || i >= subs.size()) ? nullptr : subs[i]);
|
||||
}
|
||||
|
||||
void connectChildConfig(std::shared_ptr<JobConfig> childConfig, const std::string& name);
|
||||
void transferChildrenConfigs(std::shared_ptr<JobConfig> source);
|
||||
|
||||
JobConcept* _jobConcept;
|
||||
|
||||
uint8_t getBranch() const { return _branch; }
|
||||
void setBranch(uint8_t index);
|
||||
|
||||
public slots:
|
||||
|
||||
/**jsdoc
|
||||
|
@ -195,82 +246,6 @@ signals:
|
|||
|
||||
using QConfigPointer = std::shared_ptr<JobConfig>;
|
||||
|
||||
class TConfigProxy {
|
||||
public:
|
||||
using Config = JobConfig;
|
||||
};
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* @namespace Workload
|
||||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} cpuRunTime - <em>Read-only.</em>
|
||||
* @property {boolean} enabled
|
||||
*/
|
||||
class TaskConfig : public JobConfig {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using Persistent = PersistentConfig<TaskConfig>;
|
||||
|
||||
TaskConfig() = default;
|
||||
TaskConfig(bool enabled) : JobConfig(enabled) {}
|
||||
|
||||
/**jsdoc
|
||||
* @function Workload.getConfig
|
||||
* @param {string} name
|
||||
* @returns {object}
|
||||
*/
|
||||
// Get a sub job config through task.getConfig(path)
|
||||
// where path can be:
|
||||
// - <job_name> search for the first job named job_name traversing the the sub graph of task and jobs (from this task as root)
|
||||
// - <parent_name>.[<sub_parent_names>.]<job_name>
|
||||
// Allowing to first look for the parent_name job (from this task as root) and then search from there for the
|
||||
// optional sub_parent_names and finally from there looking for the job_name (assuming every job in the path were found)
|
||||
//
|
||||
// getter for qml integration, prefer the templated getter
|
||||
Q_INVOKABLE QObject* getConfig(const QString& name) { return getConfig<TConfigProxy>(name.toStdString()); }
|
||||
|
||||
// getter for cpp (strictly typed), prefer this getter
|
||||
TaskConfig* getRootConfig(const std::string& jobPath, std::string& jobName) const;
|
||||
JobConfig* getJobConfig(const std::string& jobPath) const;
|
||||
|
||||
template <class T> typename T::Config* getConfig(std::string jobPath = "") const {
|
||||
return dynamic_cast<typename T::Config*>(getJobConfig(jobPath));
|
||||
}
|
||||
|
||||
Q_INVOKABLE bool isTask() const override { return true; }
|
||||
Q_INVOKABLE QObjectList getSubConfigs() const override {
|
||||
auto list = findChildren<JobConfig*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
|
||||
QObjectList returned;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
returned.push_back(list[i]);
|
||||
}
|
||||
return returned;
|
||||
}
|
||||
Q_INVOKABLE int getNumSubs() const override { return getSubConfigs().size(); }
|
||||
Q_INVOKABLE QObject* getSubConfig(int i) const override {
|
||||
auto subs = getSubConfigs();
|
||||
return ((i < 0 || i >= subs.size()) ? nullptr : subs[i]);
|
||||
}
|
||||
};
|
||||
|
||||
class SwitchConfig : public JobConfig {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int branch READ getBranch WRITE setBranch NOTIFY dirtyEnabled)
|
||||
|
||||
public:
|
||||
uint8_t getBranch() const { return _branch; }
|
||||
void setBranch(uint8_t index);
|
||||
|
||||
protected:
|
||||
uint8_t _branch { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // hifi_task_Config_h
|
||||
|
|
|
@ -69,7 +69,7 @@ class JobConcept {
|
|||
public:
|
||||
using Config = JobConfig;
|
||||
|
||||
JobConcept(const std::string& name, QConfigPointer config) : _config(config), _name(name) {}
|
||||
JobConcept(const std::string& name, QConfigPointer config) : _config(config), _name(name) { config->_jobConcept = this; }
|
||||
virtual ~JobConcept() = default;
|
||||
|
||||
const std::string& getName() const { return _name; }
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
virtual QConfigPointer& getConfiguration() { return _config; }
|
||||
virtual void applyConfiguration() = 0;
|
||||
void setCPURunTime(const std::chrono::nanoseconds& runtime) { std::static_pointer_cast<Config>(_config)->setCPURunTime(runtime); }
|
||||
void setCPURunTime(const std::chrono::nanoseconds& runtime) { (_config)->setCPURunTime(runtime); }
|
||||
|
||||
QConfigPointer _config;
|
||||
protected:
|
||||
|
@ -94,9 +94,6 @@ template <class T, class C> void jobConfigure(T& data, const C& configuration) {
|
|||
template<class T> void jobConfigure(T&, const JobConfig&) {
|
||||
// nop, as the default JobConfig was used, so the data does not need a configure method
|
||||
}
|
||||
template<class T> void jobConfigure(T&, const TaskConfig&) {
|
||||
// nop, as the default TaskConfig was used, so the data does not need a configure method
|
||||
}
|
||||
|
||||
template <class T, class JC> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, JobNoIO& output) {
|
||||
data.run(jobContext);
|
||||
|
@ -158,7 +155,17 @@ public:
|
|||
return std::make_shared<Model>(name, input, std::make_shared<C>(), std::forward<A>(args)...);
|
||||
}
|
||||
|
||||
|
||||
void createConfiguration() {
|
||||
// A brand new config
|
||||
auto config = std::make_shared<C>();
|
||||
// Make sure we transfer the former children configs to the new config
|
||||
config->transferChildrenConfigs(Concept::_config);
|
||||
// swap
|
||||
Concept::_config = config;
|
||||
// Capture this
|
||||
Concept::_config->_jobConcept = this;
|
||||
}
|
||||
|
||||
void applyConfiguration() override {
|
||||
TimeProfiler probe(("configure::" + JobConcept::getName()));
|
||||
|
||||
|
@ -228,7 +235,7 @@ public:
|
|||
using Context = JC;
|
||||
using TimeProfiler = TP;
|
||||
using ContextPointer = std::shared_ptr<Context>;
|
||||
using Config = TaskConfig;
|
||||
using Config = JobConfig; //TaskConfig;
|
||||
using JobType = Job<JC, TP>;
|
||||
using None = typename JobType::None;
|
||||
using Concept = typename JobType::Concept;
|
||||
|
@ -247,14 +254,14 @@ public:
|
|||
const Varying getOutput() const override { return _output; }
|
||||
Varying& editInput() override { return _input; }
|
||||
|
||||
TaskConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input) {}
|
||||
TaskConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input) {config->_isTask = true;}
|
||||
|
||||
// Create a new job in the container's queue; returns the job's output
|
||||
template <class NT, class... NA> const Varying addJob(std::string name, const Varying& input, NA&&... args) {
|
||||
_jobs.emplace_back((NT::JobModel::create(name, input, std::forward<NA>(args)...)));
|
||||
|
||||
// Conect the child config to this task's config
|
||||
std::static_pointer_cast<TaskConfig>(Concept::getConfiguration())->connectChildConfig(_jobs.back().getConfiguration(), name);
|
||||
std::static_pointer_cast<JobConfig>(Concept::getConfiguration())->connectChildConfig(_jobs.back().getConfiguration(), name);
|
||||
|
||||
return _jobs.back().getOutput();
|
||||
}
|
||||
|
@ -284,9 +291,6 @@ public:
|
|||
TimeProfiler probe("build::" + model->getName());
|
||||
model->_data.build(*(model), model->_input, model->_output, std::forward<A>(args)...);
|
||||
}
|
||||
// Recreate the Config to use the templated type
|
||||
model->createConfiguration();
|
||||
model->applyConfiguration();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
@ -369,7 +373,7 @@ public:
|
|||
using Context = JC;
|
||||
using TimeProfiler = TP;
|
||||
using ContextPointer = std::shared_ptr<Context>;
|
||||
using Config = SwitchConfig;
|
||||
using Config = JobConfig; //SwitchConfig;
|
||||
using JobType = Job<JC, TP>;
|
||||
using None = typename JobType::None;
|
||||
using Concept = typename JobType::Concept;
|
||||
|
@ -388,14 +392,15 @@ public:
|
|||
const Varying getOutput() const override { return _output; }
|
||||
Varying& editInput() override { return _input; }
|
||||
|
||||
SwitchConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input) {}
|
||||
SwitchConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input)
|
||||
{config->_isTask = true; config->_isSwitch = true; }
|
||||
|
||||
template <class NT, class... NA> const Varying addBranch(std::string name, uint8_t index, const Varying& input, NA&&... args) {
|
||||
auto& branch = _branches[index];
|
||||
branch = JobType(NT::JobModel::create(name, input, std::forward<NA>(args)...));
|
||||
|
||||
// Conect the child config to this task's config
|
||||
std::static_pointer_cast<SwitchConfig>(Concept::getConfiguration())->connectChildConfig(branch.getConfiguration(), name);
|
||||
std::static_pointer_cast<JobConfig>(Concept::getConfiguration())->connectChildConfig(branch.getConfiguration(), name);
|
||||
|
||||
return branch.getOutput();
|
||||
}
|
||||
|
@ -405,7 +410,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T, class C = SwitchConfig, class I = None, class O = None> class SwitchModel : public SwitchConcept {
|
||||
template <class T, class C = Config, class I = None, class O = None> class SwitchModel : public SwitchConcept {
|
||||
public:
|
||||
using Data = T;
|
||||
using Input = I;
|
||||
|
@ -426,9 +431,6 @@ public:
|
|||
TimeProfiler probe("build::" + model->getName());
|
||||
model->_data.build(*(model), model->_input, model->_output, std::forward<A>(args)...);
|
||||
}
|
||||
// Recreate the Config to use the templated type
|
||||
model->createConfiguration();
|
||||
model->applyConfiguration();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
@ -475,8 +477,8 @@ public:
|
|||
}
|
||||
}
|
||||
};
|
||||
template <class T, class C = SwitchConfig> using Model = SwitchModel<T, C, None, None>;
|
||||
template <class T, class I, class C = SwitchConfig> using ModelI = SwitchModel<T, C, I, None>;
|
||||
template <class T, class C = Config> using Model = SwitchModel<T, C, None, None>;
|
||||
template <class T, class I, class C = Config> using ModelI = SwitchModel<T, C, I, None>;
|
||||
// TODO: Switches don't support Outputs yet
|
||||
//template <class T, class O, class C = SwitchConfig> using ModelO = SwitchModel<T, C, None, O>;
|
||||
//template <class T, class I, class O, class C = SwitchConfig> using ModelIO = SwitchModel<T, C, I, O>;
|
||||
|
@ -500,7 +502,7 @@ class Engine : public Task<JC, TP> {
|
|||
public:
|
||||
using Context = JC;
|
||||
using ContextPointer = std::shared_ptr<Context>;
|
||||
using Config = TaskConfig;
|
||||
using Config = JobConfig; //TaskConfig;
|
||||
|
||||
using TaskType = Task<JC, TP>;
|
||||
using ConceptPointer = typename TaskType::ConceptPointer;
|
||||
|
@ -526,10 +528,11 @@ protected:
|
|||
|
||||
}
|
||||
|
||||
|
||||
#define Task_DeclareTypeAliases(ContextType, TimeProfiler) \
|
||||
using JobConfig = task::JobConfig; \
|
||||
using TaskConfig = task::TaskConfig; \
|
||||
using SwitchConfig = task::SwitchConfig; \
|
||||
using TaskConfig = task::JobConfig; \
|
||||
using SwitchConfig = task::JobConfig; \
|
||||
template <class T> using PersistentConfig = task::PersistentConfig<T>; \
|
||||
using Job = task::Job<ContextType, TimeProfiler>; \
|
||||
using Switch = task::Switch<ContextType, TimeProfiler>; \
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// @param depth: the depth of the recurse loop since the initial call.
|
||||
function task_traverse(root, functor, depth) {
|
||||
if (root.isTask()) {
|
||||
depth++;
|
||||
depth++;
|
||||
for (var i = 0; i <root.getNumSubs(); i++) {
|
||||
var sub = root.getSubConfig(i);
|
||||
if (functor(sub, depth, i)) {
|
||||
|
@ -41,15 +41,19 @@ function task_traverseTree(root, functor) {
|
|||
function job_propKeys(job) {
|
||||
var keys = Object.keys(job)
|
||||
var propKeys = [];
|
||||
if (job.isSwitch()) {
|
||||
propKeys.push("branch")
|
||||
}
|
||||
for (var k=0; k < keys.length;k++) {
|
||||
// Filter for relevant property
|
||||
var key = keys[k]
|
||||
if ((typeof job[key]) !== "function") {
|
||||
if ((key !== "objectName") && (key !== "cpuRunTime") && (key !== "enabled")) {
|
||||
if ((key !== "objectName") && (key !== "cpuRunTime") && (key !== "enabled") && (key !== "branch")) {
|
||||
propKeys.push(keys[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return propKeys;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@ import QtQuick 2.7
|
|||
import QtQuick.Controls 1.4 as Original
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import stylesUit 1.0
|
||||
import controlsUit 1.0 as HifiControls
|
||||
|
||||
import "../../prop" as Prop
|
||||
|
||||
import "../jet.js" as Jet
|
||||
|
@ -23,6 +20,8 @@ Prop.PropGroup {
|
|||
|
||||
id: root;
|
||||
|
||||
Prop.Global { id: global;}
|
||||
|
||||
property var rootConfig : Render
|
||||
property var jobPath: ""
|
||||
property alias label: root.label
|
||||
|
@ -30,7 +29,7 @@ Prop.PropGroup {
|
|||
|
||||
property var showProps: true
|
||||
property var showSubs: true
|
||||
property var jobEnabled: rootConfig.getConfig(jobPath).enabled
|
||||
property bool jobEnabled: rootConfig.getConfig(jobPath).enabled
|
||||
property var jobCpuTime: pullCpuTime()
|
||||
|
||||
function pullCpuTime() {
|
||||
|
@ -72,8 +71,8 @@ Prop.PropGroup {
|
|||
id: enabledIcon
|
||||
anchors.right:parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
filled: root.jobEnabled
|
||||
fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorOrangeAccent)
|
||||
filled: true
|
||||
fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorRedAccent)
|
||||
icon: 5
|
||||
|
||||
MouseArea{
|
||||
|
@ -92,7 +91,7 @@ Prop.PropGroup {
|
|||
// console.log(JSON.stringify(props));
|
||||
if (showProps) {
|
||||
for (var p in props) {
|
||||
propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] })
|
||||
propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p]})
|
||||
}
|
||||
root.updatePropItems(root.propItemsPanel, propsModel);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ PropFolderPanel {
|
|||
"min": (proItem["min"] !== undefined ? proItem.min : 0.0),
|
||||
"max": (proItem["max"] !== undefined ? proItem.max : 1.0),
|
||||
"integer": (proItem["integral"] !== undefined ? proItem.integral : false),
|
||||
"readOnly": (proItem["readOnly"] !== undefined ? proItem["readOnly"] : false),
|
||||
"readOnly": (proItem["readOnly"] !== undefined ? proItem["readOnly"] : true),
|
||||
})
|
||||
} break;
|
||||
case 'PropEnum': {
|
||||
|
@ -136,30 +136,32 @@ PropFolderPanel {
|
|||
function populateFromObjectProps(object) {
|
||||
var propsModel = []
|
||||
|
||||
var props = Object.keys(object);
|
||||
for (var p in props) {
|
||||
var o = {};
|
||||
o["object"] = object
|
||||
o["property"] = props[p];
|
||||
// o["readOnly"] = true;
|
||||
|
||||
var thePropThing = object[props[p]];
|
||||
if ((thePropThing !== undefined) && (thePropThing !== null)) {
|
||||
var theType = typeof(thePropThing)
|
||||
switch(theType) {
|
||||
case 'object': {
|
||||
o["type"] = "object";
|
||||
propsModel.push(o)
|
||||
} break;
|
||||
default: {
|
||||
o["type"] = "string";
|
||||
propsModel.push(o)
|
||||
} break;
|
||||
}
|
||||
if (object !== undefined) {
|
||||
var props = Object.keys(object);
|
||||
for (var p in props) {
|
||||
var o = {};
|
||||
o["object"] = object
|
||||
o["property"] = props[p];
|
||||
// o["readOnly"] = true;
|
||||
|
||||
} else {
|
||||
o["type"] = "string";
|
||||
propsModel.push(o)
|
||||
var thePropThing = object[props[p]];
|
||||
if ((thePropThing !== undefined) && (thePropThing !== null)) {
|
||||
var theType = typeof(thePropThing)
|
||||
switch(theType) {
|
||||
case 'object': {
|
||||
o["type"] = "object";
|
||||
propsModel.push(o)
|
||||
} break;
|
||||
default: {
|
||||
o["type"] = "string";
|
||||
propsModel.push(o)
|
||||
} break;
|
||||
}
|
||||
|
||||
} else {
|
||||
o["type"] = "string";
|
||||
propsModel.push(o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ Item {
|
|||
property alias labelControl: labelControl
|
||||
property alias label: labelControl.text
|
||||
|
||||
property var labelAreaWidth: root.width * global.splitterRightWidthScale - global.splitterWidth
|
||||
|
||||
property var labelAreaWidth: root.width * global.splitterLeftWidthScale - global.splitterWidth
|
||||
|
||||
PropText {
|
||||
id: labelControl
|
||||
text: root.label
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// PropItem.qml
|
||||
// PropScalar.qml
|
||||
//
|
||||
// Created by Sam Gateau on 3/2/2019
|
||||
// Copyright 2019 High Fidelity, Inc.
|
||||
|
@ -42,8 +42,8 @@ PropItem {
|
|||
enabled: root.showValue
|
||||
|
||||
anchors.left: root.splitter.right
|
||||
anchors.right: (root.readOnly ? root.right : sliderControl.left)
|
||||
anchors.verticalCenter: root.verticalCenter
|
||||
width: root.width * (root.readOnly ? 1.0 : global.valueAreaWidthScale)
|
||||
horizontalAlignment: global.valueTextAlign
|
||||
height: global.slimHeight
|
||||
|
||||
|
@ -55,17 +55,25 @@ PropItem {
|
|||
border.width: global.valueBorderWidth
|
||||
radius: global.valueBorderRadius
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
id: mousearea
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: { sliderControl.visible = !sliderControl.visible }
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.Slider {
|
||||
id: sliderControl
|
||||
visible: !root.readOnly
|
||||
|
||||
stepSize: root.integral ? 1.0 : 0.0
|
||||
anchors.left: valueLabel.right
|
||||
anchors.right: root.right
|
||||
anchors.verticalCenter: root.verticalCenter
|
||||
value: root.sourceValueVar
|
||||
onValueChanged: { applyValueVarFromWidgets(value) }
|
||||
|
||||
width: root.width * (root.readOnly ? 0.0 : global.handleAreaWidthScale)
|
||||
anchors.right: root.right
|
||||
anchors.verticalCenter: root.verticalCnter
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,16 +31,17 @@ Item {
|
|||
readonly property color colorBorderHighight: hifi.colors.blueHighlight
|
||||
readonly property color colorBorderLighter: hifi.colors.faintGray
|
||||
|
||||
readonly property color colorOrangeAccent: "#FF6309"
|
||||
readonly property color colorRedAccent: "#C62147"
|
||||
readonly property color colorGreenHighlight: "#1ac567"
|
||||
readonly property color colorOrangeAccent: hifi.colors.orangeAccent
|
||||
readonly property color colorRedAccent: hifi.colors.redAccent
|
||||
readonly property color colorGreenHighlight: hifi.colors.greenHighlight
|
||||
|
||||
readonly property real fontSize: 12
|
||||
readonly property var fontFamily: "Raleway"
|
||||
readonly property var fontWeight: Font.DemiBold
|
||||
readonly property color fontColor: hifi.colors.faintGray
|
||||
|
||||
readonly property var splitterRightWidthScale: 0.45
|
||||
readonly property var splitterLeftWidthScale: 0.45
|
||||
readonly property var splitterRightWidthScale: 1.0 - splitterLeftWidthScale
|
||||
readonly property real splitterWidth: 8
|
||||
|
||||
readonly property real iconWidth: fontSize
|
||||
|
@ -49,8 +50,9 @@ Item {
|
|||
readonly property var labelTextAlign: Text.AlignRight
|
||||
readonly property var labelTextElide: Text.ElideMiddle
|
||||
|
||||
readonly property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale)
|
||||
readonly property var valueAreaWidthScale: 0.3 * (splitterRightWidthScale)
|
||||
readonly property var handleAreaWidthScale: 0.7 * (splitterRightWidthScale)
|
||||
readonly property var valueTextAlign: Text.AlignHCenter
|
||||
readonly property real valueBorderWidth: 1
|
||||
readonly property real valueBorderRadius: 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,57 +1,5 @@
|
|||
(function() {
|
||||
var TABLET_BUTTON_NAME = "Inspector";
|
||||
var QMLAPP_URL = Script.resolvePath("./engineInspector.qml");
|
||||
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
|
||||
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg");
|
||||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
text: TABLET_BUTTON_NAME,
|
||||
icon: ICON_URL,
|
||||
activeIcon: ACTIVE_ICON_URL
|
||||
});
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
killWindow()
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
});
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
|
||||
var onScreen = false;
|
||||
var window;
|
||||
|
||||
function onClicked() {
|
||||
if (onScreen) {
|
||||
killWindow()
|
||||
} else {
|
||||
createWindow()
|
||||
}
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
var qml = Script.resolvePath(QMLAPP_URL);
|
||||
window = new OverlayWindow({
|
||||
title: 'Render Engine Inspector',
|
||||
source: qml,
|
||||
width: 250,
|
||||
height: 500
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
window.closed.connect(killWindow);
|
||||
onScreen = true
|
||||
button.editProperties({isActive: true});
|
||||
}
|
||||
|
||||
function killWindow() {
|
||||
if (window !== undefined) {
|
||||
window.closed.disconnect(killWindow);
|
||||
window.close()
|
||||
window = undefined
|
||||
}
|
||||
onScreen = false
|
||||
button.editProperties({isActive: false})
|
||||
}
|
||||
}());
|
||||
|
||||
var window = Desktop.createWindow(Script.resolvePath('./engineInspector.qml'), {
|
||||
title: "Render Engine Inspector",
|
||||
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||
size: {x: 350, y: 700}
|
||||
});
|
|
@ -8,23 +8,32 @@
|
|||
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import stylesUit 1.0
|
||||
import controlsUit 1.0 as HifiControls
|
||||
|
||||
import "../lib/jet/qml" as Jet
|
||||
|
||||
Item {
|
||||
HifiConstants { id: hifi;}
|
||||
anchors.fill: parent
|
||||
id: root;
|
||||
anchors.fill: parent
|
||||
|
||||
|
||||
property var rootConfig: Render.getConfig("")
|
||||
|
||||
Jet.TaskListView {
|
||||
rootConfig: root.rootConfig
|
||||
anchors.fill: root
|
||||
ScrollView {
|
||||
id: scrollView
|
||||
anchors.fill: parent
|
||||
contentWidth: parent.width
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Jet.TaskPropView {
|
||||
rootConfig: root.rootConfig
|
||||
anchors.fill: root
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,5 @@
|
|||
function openEngineTaskView() {
|
||||
// Set up the qml ui
|
||||
var qml = Script.resolvePath('engineList.qml');
|
||||
var window = new OverlayWindow({
|
||||
title: 'Render Engine',
|
||||
source: qml,
|
||||
width: 300,
|
||||
height: 400
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
//window.closed.connect(function() { Script.stop(); });
|
||||
}
|
||||
openEngineTaskView();
|
||||
var window = Desktop.createWindow(Script.resolvePath('./engineList.qml'), {
|
||||
title: "Render Engine Inspector",
|
||||
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||
size: {x: 350, y: 700}
|
||||
});
|
|
@ -24,7 +24,7 @@ Item {
|
|||
property var mainViewTask: Render.getConfig("RenderMainView")
|
||||
|
||||
Jet.TaskList {
|
||||
rootConfig: Render
|
||||
rootConfig: Render.getConfig("")
|
||||
anchors.fill: render
|
||||
}
|
||||
}
|
|
@ -32,7 +32,16 @@ Rectangle {
|
|||
clip: true
|
||||
|
||||
Column {
|
||||
id: column
|
||||
width: parent.width
|
||||
Prop.PropFolderPanel {
|
||||
label: "Render Settings"
|
||||
isUnfold: false
|
||||
panelFrameData: Component {
|
||||
RenderSettings {
|
||||
}
|
||||
}
|
||||
}
|
||||
Prop.PropFolderPanel {
|
||||
label: "Shading Model"
|
||||
panelFrameData: Component {
|
||||
|
@ -73,17 +82,26 @@ Rectangle {
|
|||
label: "Tools"
|
||||
panelFrameData: Component {
|
||||
Row {
|
||||
HifiControls.Button {
|
||||
text: "Engine"
|
||||
onClicked: {
|
||||
sendToScript({method: "openEngineInspectorView"});
|
||||
}
|
||||
width:column.width / 3
|
||||
}
|
||||
HifiControls.Button {
|
||||
text: "LOD"
|
||||
onClicked: {
|
||||
sendToScript({method: "openEngineLODView"});
|
||||
}
|
||||
width:column.width / 3
|
||||
}
|
||||
HifiControls.Button {
|
||||
text: "Material"
|
||||
onClicked: {
|
||||
sendToScript({method: "openMaterialInspectorView"});
|
||||
}
|
||||
width:column.width / 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import controlsUit 1.0 as HifiControls
|
|||
import "../configSlider"
|
||||
import "../../lib/plotperf"
|
||||
|
||||
import "../../lib/prop" as Prop
|
||||
|
||||
|
||||
Column{
|
||||
HifiConstants { id: hifi; }
|
||||
|
@ -28,7 +30,14 @@ Column{
|
|||
anchors.right: parent.right
|
||||
|
||||
spacing: 10
|
||||
|
||||
Prop.PropScalar {
|
||||
label: "MSAA"
|
||||
object: Render.getConfig("RenderMainView.PreparePrimaryBufferForward")
|
||||
property: "numSamples"
|
||||
min: 1
|
||||
max: 32
|
||||
integral: true
|
||||
}
|
||||
Row {
|
||||
spacing: 10
|
||||
id: fxaaOnOff
|
||||
|
|
|
@ -69,6 +69,7 @@ function openView() {
|
|||
}
|
||||
|
||||
pages.addPage('Luci', 'Luci', '../luci.qml', 300, 420, openLuciWindow, closeLuciWindow);
|
||||
pages.addPage('openEngineInspectorView', 'Render Engine Inspector', '../engineInspector.qml', 300, 400);
|
||||
pages.addPage('openEngineLODView', 'Render LOD', '../lod.qml', 300, 400);
|
||||
pages.addPage('openMaterialInspectorView', 'Material Inspector', '../materialInspector.qml', 300, 400, MaterialInspector.setWindow, MaterialInspector.setWindow);
|
||||
|
||||
|
|
Loading…
Reference in a new issue