mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-16 09:19:21 -06:00
Only print the error for missing shadow caster once (closes #1594)
This commit is contained in:
@@ -350,7 +350,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& data, const Deferred
|
||||
|
||||
// Shadow calculations..
|
||||
_shadowDataArrayCache.clear();
|
||||
for (const ShadowConfiguration& shadowConf : _shadowConfArray) {
|
||||
for (ShadowConfiguration& shadowConf : _shadowConfArray) {
|
||||
// TO REMEMBER: all distances and lengths in world coordinates are in
|
||||
// meters!!! We need to move this to view space...
|
||||
double lt;
|
||||
@@ -374,10 +374,19 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& data, const Deferred
|
||||
casterPos *= KM_TO_M; // converting to meters
|
||||
|
||||
SceneGraphNode* sourceNode = sceneGraphNode(shadowConf.source.first);
|
||||
if (!sourceNode) {
|
||||
if (!shadowConf.printedSourceError) {
|
||||
LERROR("Invalid scenegraph node for the shadow's receiver");
|
||||
shadowConf.printedSourceError = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
SceneGraphNode* casterNode = sceneGraphNode(shadowConf.caster.first);
|
||||
|
||||
if (!sourceNode || !casterNode) {
|
||||
LERROR("Invalid scenegraph node for the shadow's caster or receiver");
|
||||
if (!casterNode) {
|
||||
if (!shadowConf.printedCasterError) {
|
||||
LERROR("Invalid scenegraph node for the shadow's caster");
|
||||
shadowConf.printedCasterError = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ struct TransformData;
|
||||
struct ShadowConfiguration {
|
||||
std::pair<std::string, double> source;
|
||||
std::pair<std::string, double> caster;
|
||||
// Set to 'true' if we printed an error because we couldn't find the source or caster.
|
||||
// We only want to print a message once
|
||||
bool printedSourceError = false;
|
||||
bool printedCasterError = false;
|
||||
};
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
Submodule support/coding/codegen updated: f511a93fdd...c6178634f7
Reference in New Issue
Block a user