Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

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

Preparation for merge. Added check to IpsviRaycaster whether OpenGL 4.4 is...

Preparation for merge. Added check to IpsviRaycaster whether OpenGL 4.4 is supported to avoid crashes if this is not the case.
parent 7a6cdeb1
......@@ -45,6 +45,7 @@ namespace campvis {
, p_icTextureSize("IcTextureSize", "Illumination Cache Texture Size", cgt::ivec2(512), cgt::ivec2(32), cgt::ivec2(2048))
, p_shadowIntensity("ShadowIntensity", "Shadow Intensity", .75f, 0.f, 1.f)
, _vhm(nullptr)
, _gl44Supported(false)
{
_icTextures[0] = nullptr;
_icTextures[1] = nullptr;
......@@ -65,13 +66,25 @@ namespace campvis {
}
void IpsviRaycaster::init() {
RaycastingProcessor::init();
// get supported OpenGL version
// if OpenGL 4.4 is not supported, abort the initialization, since compiling the shader will fail.
_gl44Supported = (GpuCaps.getGlVersion() >= cgt::GpuCapabilities::GlVersion::CGT_GL_VERSION_4_4);
_gl44Supported &= (GpuCaps.getShaderVersion() >= cgt::GpuCapabilities::GlVersion::SHADER_VERSION_440);
if (! _gl44Supported) {
LERROR("This system does not support OpenGL 4.4, which is required for the IpsviRaycaster. Raycaster deactivated.");
return;
}
RaycastingProcessor::init();
_vhm = new VoxelHierarchyMapper();
invalidate(INVALID_BBV | INVALID_IC_TEXTURES);
}
void IpsviRaycaster::deinit() {
// nothing to deinitialize, if this processor has never been initialized.
if (!_gl44Supported)
return;
delete _vhm;
delete _icTextures[0];
delete _icTextures[1];
......@@ -79,6 +92,13 @@ namespace campvis {
RaycastingProcessor::deinit();
}
void IpsviRaycaster::updateResult(DataContainer& data) {
if (!_gl44Supported)
return;
RaycastingProcessor::updateResult(data);
}
void IpsviRaycaster::processImpl(DataContainer& data, ImageRepresentationGL::ScopedRepresentation& image) {
// (re)create Illumination Cache (IC) textures if needed
if (getInvalidationLevel() & INVALID_IC_TEXTURES) {
......@@ -174,7 +194,7 @@ namespace campvis {
corners[6] = cgt::vec3(worldBounds.getURB().x, worldBounds.getURB().y, worldBounds.getLLF().z);
corners[7] = cgt::vec3(worldBounds.getURB().x, worldBounds.getURB().y, worldBounds.getURB().z);
for (auto i = 0; i < corners.size(); ++i) {
for (size_t i = 0; i < corners.size(); ++i) {
const cgt::vec3 diag = corners[i];
const float distance = std::abs(cgt::dot(diag, icNormal));
const cgt::vec3 projected = diag - (-distance * icNormal);
......
......@@ -92,6 +92,8 @@ namespace campvis {
FloatProperty p_shadowIntensity; ///< Intensity of the shadowing effect
protected:
/// \see RaycastingProcessor::updateResult()
virtual void updateResult(DataContainer& data) override;
/// \see RaycastingProcessor::processImpl()
virtual void processImpl(DataContainer& data, ImageRepresentationGL::ScopedRepresentation& image);
......@@ -100,6 +102,7 @@ namespace campvis {
VoxelHierarchyMapper* _vhm; ///< for optimizing entry/exit points
cgt::Texture* _icTextures[2]; ///< Illumination cache textures
bool _gl44Supported; ///< Flag whether OpenGL 4.4 is supported.
static const std::string loggerCat_;
};
......
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