Further clean up and fixes in registration module

parent 11eb6032
......@@ -61,7 +61,6 @@ namespace campvis {
void VisualizationProcessor::deinit() {
_viewportSizeProperty->s_changed.disconnect(this);
_fbo->detachAll();
delete _fbo;
AbstractProcessor::deinit();
}
......
......@@ -71,6 +71,7 @@ void FramebufferObject::attachTexture(Texture* texture, GLenum attachment, int m
glFramebufferTexture2D( GL_FRAMEBUFFER, attachment, texture->getType(), texture->getId(), mipLevel );
break;
}
LGL_ERROR;
size_t index = decodeAttachment(attachment);
attachments_[index] = texture;
......@@ -100,6 +101,7 @@ void FramebufferObject::detachTexture(GLenum attachment) {
break;
}
attachments_[index] = 0;
LGL_ERROR;
if (index < TGT_FRAMEBUFFEROBJECT_MAX_SUPPORTED_COLOR_ATTACHMENTS)
--numColorAttachments_;
......
......@@ -206,7 +206,6 @@ int Texture::calcBpp(GLint internalformat) {
case GL_RGB10:
case GL_R11F_G11F_B10F:
case GL_RGB9_E5:
case GL_R32F:
case GL_RGBA:
case GL_RGBA8:
case GL_RGBA8_SNORM:
......
......@@ -59,11 +59,11 @@ void main() {
vec4 movingLookupTexCoord = _registrationInverse * vec4(referenceLookupTexCoord, 1.0);
// fetch texels
float referenceValue = texture(_referenceTexture, referenceLookupTexCoord).a;
float referenceValue = texture(_referenceTexture, referenceLookupTexCoord).r;
float movingValue = 0.0;
if (!_applyMask || referenceValue > 0.0)
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).a;
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).r;
// compute differences
difference = referenceValue - movingValue;
......
......@@ -64,7 +64,7 @@ void main() {
for (float z = zStart; z < zEnd; z += _referenceTextureParams._sizeRCP.z) {
// fetch value from reference volume
vec3 referenceLookupTexCoord = vec3(ex_TexCoord.xy, z);
float referenceValue = texture(_referenceTexture, referenceLookupTexCoord).a;
float referenceValue = texture(_referenceTexture, referenceLookupTexCoord).r;
// apply mask if requested
if (!_applyMask || referenceValue > 0.0) {
......@@ -75,7 +75,7 @@ void main() {
// fetch value from moving volume
float movingValue = 0.0;
if (all(greaterThanEqual(movingLookupTexCoord.xyz, vec3(0.0))) && all(lessThanEqual(movingLookupTexCoord.xyz, vec3(1.0)))) {
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).a;
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).r;
}
float avg = (referenceValue + movingValue) / 2.0;
......
......@@ -58,7 +58,7 @@ void main() {
for (float z = zStart; z < zEnd; z += _referenceTextureParams._sizeRCP.z) {
// fetch value from reference volume
vec3 referenceLookupTexCoord = vec3(ex_TexCoord.xy, z);
float referenceValue = texture(_referenceTexture, referenceLookupTexCoord).a;
float referenceValue = texture(_referenceTexture, referenceLookupTexCoord).r;
// apply mask if requested
if (!_applyMask || referenceValue > 0.0) {
......@@ -69,7 +69,7 @@ void main() {
// fetch value from moving volume
float movingValue = 0.0;
if (all(greaterThanEqual(movingLookupTexCoord.xyz, vec3(0.0))) && all(lessThanEqual(movingLookupTexCoord.xyz, vec3(1.0)))) {
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).a;
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).r;
}
// compute difference metrics
......
......@@ -45,13 +45,11 @@ namespace campvis {
, _movingReader()
, _sm()
, _ve(&_canvasSize)
, _se(&_canvasSize)
{
addProcessor(&_referenceReader);
addProcessor(&_movingReader);
addProcessor(&_sm);
addProcessor(&_ve);
addProcessor(&_se);
addEventListenerToBack(&_ve);
}
......@@ -71,23 +69,15 @@ namespace campvis {
_movingReader.p_targetImageID.addSharedProperty(&_sm.p_movingId);
_sm.p_differenceImageId.addSharedProperty(&_ve.p_inputVolume);
_sm.p_differenceImageId.addSharedProperty(&_se.p_sourceImageID);
_ve.p_outputImage.setValue("volumeexplorer");
_se.p_targetImageID.setValue("sliceexplorer");
_renderTargetID.setValue("sliceexplorer");
_renderTargetID.setValue("volumeexplorer");
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(-1.f, 1.f));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, .5f), tgt::col4(0, 0, 255, 255), tgt::col4(255, 255, 255, 0)));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(255, 255, 255, 0), tgt::col4(255, 0, 0, 255)));
MetaProperty* mp = static_cast<MetaProperty*>(_ve.getProperty("SliceExtractorProperties"));
static_cast<TransferFunctionProperty*>(mp->getProperty("transferFunction"))->replaceTF(dvrTF);
Geometry1DTransferFunction* seTF = new Geometry1DTransferFunction(128, tgt::vec2(-1.f, 1.f));
seTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, .5f), tgt::col4(0, 0, 255, 255), tgt::col4(255, 255, 255, 255)));
seTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(255, 255, 255, 255), tgt::col4(255, 0, 0, 255)));
_se.p_transferFunction.replaceTF(seTF);
}
void ReducerTest::onProcessorValidated(AbstractProcessor* processor) {
......
......@@ -75,8 +75,7 @@ namespace campvis {
SimilarityMeasure _sm;
VolumeExplorer _ve;
SliceExtractor _se;
};
}
......
......@@ -405,7 +405,7 @@ namespace campvis {
referenceUnit.activate();
// create temporary texture for result
tgt::Texture* similarityTex = new tgt::Texture(0, tgt::ivec3(size), GL_ALPHA, GL_ALPHA32F_ARB, GL_FLOAT, tgt::Texture::NEAREST);
tgt::Texture* similarityTex = new tgt::Texture(0, tgt::ivec3(size), GL_RED, GL_R32F, GL_FLOAT, tgt::Texture::NEAREST);
similarityTex->uploadTexture();
similarityTex->setWrapping(tgt::Texture::CLAMP);
......
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