The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit 9183ad5f authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Removed dimensionality <-> size assertion checks for ImageData and ImageRepresentationGL.

Now it is possible to create CAMPVis images with three dimensions but only a single slice (formerly automatically deduced as 2D image). Adapted/fixed some further code.

refs #613
parent 3df24932
......@@ -225,7 +225,7 @@ namespace campvis {
return;
_paintShader->setIgnoreUniformLocationError(true);
if (texture->getDimensions().z == 1) {
if (texture->getType() == GL_TEXTURE_2D) {
unit2d.activate();
texture->bind();
_paintShader->setUniform("_is3d", false);
......@@ -234,7 +234,7 @@ namespace campvis {
_paintShader->setUniform("_2dTextureParams._sizeRCP", cgt::vec2(1.f) / cgt::vec2(texture->getDimensions().xy()));
_paintShader->setUniform("_2dTextureParams._numChannels", static_cast<int>(texture->getNumChannels()));
}
else {
else if (texture->getType() == GL_TEXTURE_3D) {
unit3d.activate();
texture->bind();
_paintShader->setUniform("_is3d", true);
......
......@@ -36,8 +36,6 @@ namespace campvis {
, _mappingInformation(size, cgt::vec3(0.f), cgt::vec3(1.f)) // TODO: get offset/voxel size as parameter or put default values into ImageMappingInformation ctor.
{
cgtAssert(numChannels > 0, "Number of channels must be greater than 0!");
cgtAssert(_dimensionality >= 3 || _size.z == 1, "Dimensionality and size mismatch: A 2D image must have size.z = 1!");
cgtAssert(_dimensionality >= 2 || _size.y == 1, "Dimensionality and size mismatch: A 1D image must have size.y = 1!");
}
ImageData::~ImageData() {
......
......@@ -52,8 +52,6 @@ namespace campvis {
, _texture(texture)
{
cgtAssert(texture != 0, "Given texture must not be 0.");
cgtAssert(parent->getDimensionality() >= 3 || texture->getDimensions().z == 1, "Dimensionality of Parent and texture mismatch!");
cgtAssert(parent->getDimensionality() >= 2 || texture->getDimensions().y == 1, "Dimensionality of Parent and texture mismatch!");
cgtAssert(parent->getNumChannels() == texture->getNumChannels(), "Number of Channels of parent and texture mismatch!");
}
......
......@@ -115,7 +115,7 @@ namespace campvis {
// put resulting image into DataContainer
if (outputTexture != 0) {
ImageData* id = new ImageData(3, img->getSize(), 1);
ImageData* id = new ImageData(3, img->getSize(), img->getParent()->getNumChannels());
ImageRepresentationGL::create(id, outputTexture);
id->setMappingInformation(img->getParent()->getMappingInformation());
data.addData(p_outputImage.getValue(), id);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment