Commit ceaff5fb authored by Jakob Weiss's avatar Jakob Weiss
Browse files

Necessary changes to get the default modules to build again

parent 22ef73e9
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -194,8 +194,8 @@ namespace campvis {
                    break;

                // gather image
                cgtAssert(dynamic_cast<const ImageData*>(_textures[index].getData()), "Found sth. else than ImageData in render texture vector. This should not happen!");
                const ImageData* id = static_cast<const ImageData*>(_textures[index].getData());
                cgtAssert(_textures[index].getData<ImageData>(), "Found sth. else than ImageData in render texture vector. This should not happen!");
                auto id = _textures[index].getData<ImageData>();

                // compute transformation matrices
                float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y);
@@ -281,7 +281,7 @@ namespace campvis {
            if (texIndx < 0 || texIndx >= static_cast<int>(_textures.size()))
                return;

            const ImageData* id = static_cast<const ImageData*>(_textures[texIndx].getData());
            auto id = _textures[texIndx].getData<ImageData>();
            const cgt::Texture* tex = id->getRepresentation<ImageRepresentationGL>()->getTexture();
            const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>();
            cgt::svec2 imageSize = id->getSize().xy();
@@ -394,13 +394,13 @@ namespace campvis {
        p_viewportSize.setValue(cgt::ivec2(width(), height()));

        for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
            if (const ImageData* img = dynamic_cast<const ImageData*>(it->second.getData())) {
            if (auto img = it->second.getData<ImageData>()) {
                if (const ImageRepresentationGL* imgGL = img->getRepresentation<ImageRepresentationGL>()) {
                    _textures.push_back(it->second);
                    maxSlices = std::max(maxSlices, imgGL->getTexture()->getDimensions().z);
                }
            }
            else if (const RenderData* rd = dynamic_cast<const RenderData*>(it->second.getData())) {
            else if (auto rd = it->second.getData<RenderData>()) {
                for (size_t i = 0; i < rd->getNumColorTextures(); ++i) {
                    const ImageRepresentationGL* imgGL = rd->getColorTexture(i)->getRepresentation<ImageRepresentationGL>();
                    if (imgGL) {
@@ -415,7 +415,7 @@ namespace campvis {

                }
            }
            else if (const GeometryData* gd = dynamic_cast<const GeometryData*>(it->second.getData())) {
            else if (auto gd = it->second.getData<GeometryData>()) {
                std::string name = it->first.toStdString();

                // copy geometry over to local 
@@ -481,7 +481,7 @@ namespace campvis {
        // check whether we have to render geometries
        cgt::Bounds unionBounds;
        for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
            if (const GeometryData* gd = dynamic_cast<const GeometryData*>(it->second.getData())) {
            if (auto gd = it->second.getData<GeometryData>()) {
                unionBounds.addVolume(gd->getWorldBounds());
            }
        }
+8 −8
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ namespace campvis {
            QModelIndex idxName = index->sibling(index->row(), 0);

            // only consider non-empty DataHandles
            if (handle.getData() != 0) {
            if (handle) {
                handles.push_back(std::make_pair(idxName.data(Qt::DisplayRole).toString(), handle));
                _localFootprint += handle.getData()->getLocalMemoryFootprint();
                _videoFootprint += handle.getData()->getVideoMemoryFootprint();
@@ -272,7 +272,7 @@ namespace campvis {
            _lblName->setText("Name: " + handles.front().first);
            _lblTimestamp->setText("Timestamp: " + QString::number(handles.front().second.getTimestamp()));

            if (const ImageData* tester = dynamic_cast<const ImageData*>(handles.front().second.getData())) {
            if (auto tester = handles.front().second.getData<ImageData>()) {
                _canvas->p_transferFunction.setImageHandle(handles.front().second);

                _lblNumChannels->setText(tr("Number of Channels: ") + QString::number(tester->getNumChannels()));
@@ -294,7 +294,7 @@ namespace campvis {
                _canvas->p_renderAChannel.setVisible(true);
                _canvas->p_geometryRendererProperties.setVisible(false);
            }
            else if (const GeometryData* tester = dynamic_cast<const GeometryData*>(handles.front().second.getData())) {
            else if (auto tester = handles.front().second.getData<GeometryData>()) {
                _lblSize->setText(tr("Size: n/a"));
                _lblNumChannels->setText(tr("Number of Channels: n/a"));

@@ -310,7 +310,7 @@ namespace campvis {
                _canvas->p_renderAChannel.setVisible(false);
                _canvas->p_geometryRendererProperties.setVisible(true);
            }
            else if (const RenderData* tester = dynamic_cast<const RenderData*>(handles.front().second.getData())) {
            else if (auto tester = handles.front().second.getData<RenderData>()) {
                const ImageData* id = tester->getNumColorTextures() > 0 ? tester->getColorTexture() : tester->getDepthTexture();
                if (id != 0) {
                    _lblNumChannels->setText(tr("Number of Channels: ") + QString::number(id->getNumChannels()));
@@ -445,7 +445,7 @@ namespace campvis {

            // only consider non-empty DataHandles that are ImageData and have render target representations
            if (handle.getData() != 0) {
                if (dynamic_cast<const ImageData*>(handle.getData()) && dynamic_cast<const ImageData*>(handle.getData())->getDimensionality() == 3) {
                if (handle.getData<ImageData>() && handle.getData<ImageData>()->getDimensionality() == 3) {
                    QString dialogCaption = "Export " + name + " as MHD Image";
                    QString directory = tr("");
                    const QString fileFilter = tr("*.mhd;;MHD images (*.mhd)");
@@ -458,7 +458,7 @@ namespace campvis {
                    writer.invalidate(AbstractProcessor::INVALID_RESULT);
                    writer.process(*_dataContainer);
                }
                else if (dynamic_cast<const ImageData*>(handle.getData()) || dynamic_cast<const RenderData*>(handle.getData())) {
                else if (handle.getData<ImageData>() || handle.getData<RenderData>()) {
                    QString dialogCaption = "Export " + name + " as Image";
                    QString directory = tr("");
                    const QString fileFilter = tr("*.png;;PNG images (*.png)");
@@ -484,10 +484,10 @@ namespace campvis {

        // get the ImageData object (either directly or from the RenderData)
        const ImageData* id = 0;
        if (const RenderData* tester = dynamic_cast<const RenderData*>(handle.getData())) {
        if (auto tester = handle.getData<RenderData>()) {
            id = tester->getColorTexture(0);
        }
        else if (const ImageData* tester = dynamic_cast<const ImageData*>(handle.getData())) {
        else if (auto tester = handle.getData<ImageData>()) {
            id = tester;
        }
        else {
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ namespace campvis {

        DataHandle dh = prop->getImageHandle();
        if (dh.getData() != 0) {
            const ImageRepresentationLocal* idl = static_cast<const ImageData*>(dh.getData())->getRepresentation<ImageRepresentationLocal>();
            const ImageRepresentationLocal* idl = dh.getData<ImageData>()->getRepresentation<ImageRepresentationLocal>();
            if (idl != 0) {
                Interval<float> intensityInterval = idl->getNormalizedIntensityRange();
                tf->setIntensityDomain(cgt::vec2(intensityInterval.getLeft(), intensityInterval.getRight()));
+4 −4
Original line number Diff line number Diff line
@@ -49,14 +49,14 @@ namespace campvis {
    size_t ImageSeries::getLocalMemoryFootprint() const {
        size_t toReturn = sizeof(DataHandle) * _images.capacity();
        for (size_t i = 0; i < _images.size(); ++i)
            toReturn += static_cast<const ImageData*>(_images[i].getData())->getLocalMemoryFootprint();
            toReturn += _images[i].getData()->getLocalMemoryFootprint();
        return toReturn;
    }

    size_t ImageSeries::getVideoMemoryFootprint() const {
        size_t toReturn = 0;
        for (size_t i = 0; i < _images.size(); ++i)
            toReturn += static_cast<const ImageData*>(_images[i].getData())->getVideoMemoryFootprint();
            toReturn += _images[i].getData()->getVideoMemoryFootprint();
        return toReturn;
    }

@@ -65,7 +65,7 @@ namespace campvis {
    }

    void ImageSeries::addImage(DataHandle dh) {
        cgtAssert(dynamic_cast<const ImageData*>(dh.getData()) != 0, "DataHandle must contain ImageData!");
        cgtAssert(dh.getData<ImageData>() != 0, "DataHandle must contain ImageData!");
        _images.push_back(dh);
    }

@@ -85,7 +85,7 @@ namespace campvis {
    cgt::Bounds ImageSeries::getWorldBounds() const {
        cgt::Bounds b;
        for (size_t i = 0; i < _images.size(); ++i) {
            b.addVolume(static_cast<const ImageData*>(_images[i].getData())->getWorldBounds());
            b.addVolume(_images[i].getData<ImageData>()->getWorldBounds());
        }
        return b;
    }
+8 −10
Original line number Diff line number Diff line
@@ -101,12 +101,12 @@ namespace campvis {
        return _colorTextures.size();
    }

    const ImageData* RenderData::getColorTexture(size_t index /*= 0*/) const {
    ScopedTypedData<ImageData> RenderData::getColorTexture(size_t index /*= 0*/) const {
        cgtAssert(index < _colorTextures.size(), "Index out of bounds.");
        if (index >= _colorTextures.size())
            return 0;
            return ScopedTypedData<ImageData>(DataHandle(nullptr), true);

        return static_cast<const ImageData*>(_colorTextures[index].getData());
        return _colorTextures[index].getData<ImageData>();
    }

    campvis::DataHandle RenderData::getColorDataHandle(size_t index /*= 0*/) const {
@@ -121,12 +121,10 @@ namespace campvis {
        return _depthTexture.getData() != 0;
    }

    const ImageData* RenderData::getDepthTexture() const {
        const AbstractData* d = _depthTexture.getData();
        if (d == 0)
            return 0;
    ScopedTypedData<ImageData> RenderData::getDepthTexture() const {
        auto d = _depthTexture.getData<ImageData>();

        return static_cast<const ImageData*>(d);
        return d;
    }

    campvis::DataHandle RenderData::getDepthDataHandle() const {
@@ -146,7 +144,7 @@ namespace campvis {
        if (index >= _colorTextures.size())
            return;

        const ImageData* id = static_cast<const ImageData*>(_colorTextures[index].getData());
        auto id = _colorTextures[index].getData<ImageData>();
        cgtAssert(id != 0, "WTF, color texture with 0 pointer?!");

        const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true);
@@ -158,7 +156,7 @@ namespace campvis {
        if (_depthTexture.getData() == 0)
            return;

        const ImageData* id = static_cast<const ImageData*>(_depthTexture.getData());
        const ImageData* id = _depthTexture.getData<ImageData>();
        const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true);
        rep->bind(shader, depthTexUnit, depthTexUniform, texParamsUniform);
    }
Loading