Пример #1
0
void ImageRAM::update(bool editable) {
    colorLayersRAM_.clear();
    depthLayerRAM_ = nullptr;
    pickingLayerRAM_ = nullptr;

    if (editable) {
        auto owner = static_cast<Image*>(this->getOwner());
        for (size_t i = 0; i < owner->getNumberOfColorLayers(); ++i) {
            colorLayersRAM_.push_back(
                owner->getColorLayer(i)->getEditableRepresentation<LayerRAM>());
        }

        if (auto depthLayer = owner->getDepthLayer()) {
            depthLayerRAM_ = depthLayer->getEditableRepresentation<LayerRAM>();
        }

        if (auto pickingLayer = owner->getPickingLayer()) {
            pickingLayerRAM_ = pickingLayer->getEditableRepresentation<LayerRAM>();
        }
    } else {
        auto owner = static_cast<const Image*>(this->getOwner());
        for (size_t i = 0; i < owner->getNumberOfColorLayers(); ++i) {
            colorLayersRAM_.push_back(
                const_cast<LayerRAM*>(owner->getColorLayer(i)->getRepresentation<LayerRAM>()));
        }

        if (auto depthLayer = owner->getDepthLayer()) {
            depthLayerRAM_ = const_cast<LayerRAM*>(depthLayer->getRepresentation<LayerRAM>());
        }

        if (auto pickingLayer = owner->getPickingLayer()) {
            pickingLayerRAM_ = const_cast<LayerRAM*>(pickingLayer->getRepresentation<LayerRAM>());
        }
    }
}
Пример #2
0
void ImageDisk::update(bool editable) {
    auto owner = static_cast<Image*>(this->getOwner());
    if (editable) {
        for (size_t i=0; i<owner->getNumberOfColorLayers(); ++i)
            owner->getColorLayer(i)->getEditableRepresentation<LayerDisk>();

        Layer* depthLayer = owner->getDepthLayer();

        if (depthLayer)
            depthLayer->getEditableRepresentation<LayerDisk>();

        Layer* pickingLayer = owner->getPickingLayer();

        if (pickingLayer)
            pickingLayer->getEditableRepresentation<LayerDisk>();
    }
    else {
        for (size_t i=0; i<owner->getNumberOfColorLayers(); ++i)
            owner->getColorLayer(i)->getRepresentation<LayerDisk>();

        Layer* depthLayer = owner->getDepthLayer();

        if (depthLayer)
            depthLayer->getRepresentation<LayerDisk>();

        Layer* pickingLayer = owner->getPickingLayer();

        if (pickingLayer)
            pickingLayer->getRepresentation<LayerDisk>();
    }
}
Пример #3
0
void ImageGL::update(bool editable) {
    colorLayersGL_.clear();
    depthLayerGL_ = nullptr;
    pickingLayerGL_ = nullptr;

    if (editable) {
        auto owner = static_cast<Image*>(this->getOwner());

        for (size_t i = 0; i < owner->getNumberOfColorLayers(); ++i) {
            colorLayersGL_.push_back(owner->getColorLayer(i)->getEditableRepresentation<LayerGL>());
        }

        Layer* depthLayer = owner->getDepthLayer();
        if (depthLayer) {
            depthLayerGL_ = depthLayer->getEditableRepresentation<LayerGL>();
        }

        Layer* pickingLayer = owner->getPickingLayer();
        if (pickingLayer) {
            pickingLayerGL_ = pickingLayer->getEditableRepresentation<LayerGL>();
        }

    } else {
        auto owner = static_cast<const Image*>(this->getOwner());

        for (size_t i = 0; i < owner->getNumberOfColorLayers(); ++i) {
            colorLayersGL_.push_back(
                const_cast<LayerGL*>(owner->getColorLayer(i)->getRepresentation<LayerGL>()));
        }

        const Layer* depthLayer = owner->getDepthLayer();
        if (depthLayer) {
            depthLayerGL_ = const_cast<LayerGL*>(depthLayer->getRepresentation<LayerGL>());
        }

        const Layer* pickingLayer = owner->getPickingLayer();
        if (pickingLayer) {
            pickingLayerGL_ = const_cast<LayerGL*>(pickingLayer->getRepresentation<LayerGL>());
        }
    }

    // Attach all targets
    reAttachAllLayers(ImageType::AllLayers);
}
Пример #4
0
void ImageGL::updateExistingLayers() const {
    auto owner = static_cast<const Image*>(this->getOwner());

    for (size_t i = 0; i < owner->getNumberOfColorLayers(); ++i) {
        owner->getColorLayer(i)->getRepresentation<LayerGL>();
    }

    const Layer* depthLayer = owner->getDepthLayer();

    if (depthLayer) depthLayer->getRepresentation<LayerGL>();

    const Layer* pickingLayer = owner->getPickingLayer();

    if (pickingLayer) pickingLayer->getRepresentation<LayerGL>();
}