This commit is contained in:
elon
2021-02-19 11:48:32 -05:00
parent 8ea0f245d3
commit 055a9b4fa3
3 changed files with 19 additions and 17 deletions

View File

@@ -76,7 +76,7 @@ public:
void setVolumeTexture(std::shared_ptr<ghoul::opengl::Texture> texture);
std::shared_ptr<ghoul::opengl::Texture> volumeTexture() const;
void setTransferFunction(std::shared_ptr<TransferFunction> transferFunction);
void setTransferFunction(std::shared_ptr<openspace::TransferFunction> transferFunction);
void setStepSize(float stepSize);
float opacity() const;
@@ -94,7 +94,7 @@ private:
std::shared_ptr<VolumeClipPlanes> _clipPlanes;
std::shared_ptr<ghoul::opengl::Texture> _volumeTexture;
std::shared_ptr<TransferFunction> _transferFunction;
std::shared_ptr<openspace::TransferFunction> _transferFunction;
BoxGeometry _boundingBox;
VolumeGridType _gridType;
glm::mat4 _modelTransform = glm::mat4(1.f);

View File

@@ -219,30 +219,32 @@ namespace openspace::volume {
});
_gridType = static_cast<int>(volume::VolumeGridType::Cartesian);
if (dictionary.hasKeyAndValue<float>(KeyStepSize)) {
_stepSize = dictionary.value<float>(KeyStepSize);
if (dictionary.hasValue<double>(KeyStepSize)) {
_stepSize = static_cast<float>(dictionary.value<double>(KeyStepSize));
}
if (dictionary.hasValue<float>(KeyOpacity)) {
_opacity = dictionary.value<float>(KeyOpacity) * VolumeMaxOpacity;
if (dictionary.hasValue<double>(KeyOpacity)) {
_opacity = static_cast<float>(dictionary.value<double>(KeyOpacity) * VolumeMaxOpacity);
}
if (dictionary.hasKeyAndValue<float>(KeySecondsBefore)) {
_secondsBefore = dictionary.value<float>(KeySecondsBefore);
if (dictionary.hasValue<double>(KeySecondsBefore)) {
_secondsBefore = static_cast<float>(dictionary.value<double>(KeySecondsBefore));
}
_secondsAfter = dictionary.value<float>(KeySecondsAfter);
_secondsAfter = static_cast<float>(dictionary.value<double>(KeySecondsAfter));
if (dictionary.hasKey(KeyInvertDataAtZ)) {
if (dictionary.hasKey(static_cast<std::string>(KeyInvertDataAtZ))) {
_invertDataAtZ = dictionary.value<bool>(KeyInvertDataAtZ);
}
ghoul::Dictionary clipPlanesDictionary;
dictionary.getValue(KeyClipPlanes, clipPlanesDictionary);
if (dictionary.hasValue<ghoul::Dictionary>(KeyClipPlanes)) {
clipPlanesDictionary = dictionary.value<ghoul::Dictionary>(KeyClipPlanes);
}
_clipPlanes = std::make_shared<volume::VolumeClipPlanes>(clipPlanesDictionary);
_clipPlanes->setIdentifier("clipPlanes");
_clipPlanes->setGuiName("Clip Planes");
if (dictionary.hasKeyAndValue<std::string>(KeyGridType)) {
if (dictionary.hasValue<std::string>(KeyGridType)) {
VolumeGridType gridType = volume::parseGridType(
dictionary.value<std::string>(KeyGridType)
);
@@ -363,9 +365,9 @@ namespace openspace::volume {
_transferFunctionPath.onChange([this] {
_transferFunction = std::make_shared<openspace::TransferFunction>(
_transferFunctionPath
);
);
_raycaster->setTransferFunction(_transferFunction);
});
});
}
void RenderableTimeVaryingVolume::loadTimestepMetadata(const std::string& path) {

View File

@@ -34,7 +34,7 @@
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/triggerproperty.h>
// #include <modules/volume/rawvolume.h>
#include <modules/volume/rawvolumemetadata.h>
// #include <modules/volume/rawvolumemetadata.h>
// #include <modules/volume/rendering/basicvolumeraycaster.h>
// #include <modules/volume/rendering/volumeclipplanes.h>
@@ -43,16 +43,16 @@
// #include <openspace/properties/stringproperty.h>
// #include <openspace/util/boxgeometry.h>
// #include <openspace/util/histogram.h>
// #include <openspace/rendering/transferfunction.h>
#include <openspace/rendering/transferfunction.h>
namespace openspace {
class Histogram;
struct RenderData;
class TransferFunction;
} // namespace openspace
namespace openspace::volume {
//class TransferFunction;
class BasicVolumeRaycaster;
template <typename T> class RawVolume;
class VolumeClipPlanes;