コード例 #1
0
bool ShapeEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
    if (_lastUserData != entity->getUserData()) {
        return true;
    }

    if (_color != 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()) {
        return true;
    }

    return false;
}
コード例 #2
0
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;
}
コード例 #3
0
void GridEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
    withWriteLock([&] {
        _color = entity->getColor();
        _alpha = entity->getAlpha();
        _pulseProperties = entity->getPulseProperties();

        _followCamera = entity->getFollowCamera();
        _majorGridEvery = entity->getMajorGridEvery();
        _minorGridEvery = entity->getMinorGridEvery();
    });

    void* key = (void*)this;
    AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this, entity]() {
        withWriteLock([&] {
            _dimensions = entity->getScaledDimensions();
            updateModelTransformAndBound();
            _renderTransform = getModelTransform();
        });
    });
}
コード例 #4
0
void ShapeEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
    withReadLock([&] {
        if (_procedural.isEnabled() && _procedural.isFading()) {
            float isFading = Interpolate::calculateFadeRatio(_procedural.getFadeStartTime()) < 1.0f;
            _procedural.setIsFading(isFading);
        }
    });

    glm::u8vec3 color = entity->getColor();
    float alpha = entity->getAlpha();
    if (_color != color || _alpha != alpha) {
        _color = color;
        _alpha = alpha;
        _material->setAlbedo(toGlm(_color));
        _material->setOpacity(_alpha);

        auto materials = _materials.find("0");
        if (materials != _materials.end()) {
            materials->second.setNeedsUpdate(true);
        }
    }
}