Skip to content

Commit

Permalink
Added debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Oct 2, 2023
1 parent b79a2e0 commit e94f584
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/vsg/state/ViewDependentState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
return bounds;
};

// info("\n\nViewDependentState::traverse(", &rt, ", ", &view, ") numShadowMaps = ", numShadowMaps);
//info("nViewDependentState::traverse(", &rt, ", ", &view, ") numShadowMaps = ", numShadowMaps);

// set up the light data
auto light_itr = lightData->begin();
Expand Down Expand Up @@ -518,7 +518,7 @@ void ViewDependentState::traverse(RecordTraversal& rt) const

// light direction in world coords
auto light_direction = normalize(light->direction * (inverse_3x3(mv * inverse_viewMatrix)));
#if 0
#if 1
info(" directional light : light direction in world = ", light_direction, ", light->shadowMaps = ", light->shadowMaps);
info(" light->direction in model = ", light->direction);
info(" view_direction in world = ", view_direction);
Expand Down Expand Up @@ -555,10 +555,6 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
auto lookAt = camera->viewMatrix.cast<LookAt>();
auto ortho = camera->projectionMatrix.cast<Orthographic>();

#if 0
info(" lookAt = ", lookAt);
info(" ortho = ", ortho);
#endif
auto ws_bounds = computeFrustumBounds(clip_near_z, clip_far_z, clipToWorld);
auto center = (ws_bounds.min + ws_bounds.max) * 0.5;

Expand Down Expand Up @@ -591,12 +587,28 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
ortho->nearDistance = ls_bounds.min.z;
ortho->farDistance = ls_bounds.max.z;
}
#if 0
ortho->left = -1;
ortho->right = 1;
ortho->nearDistance = -30.0;
ortho->farDistance = 10.0;
#endif
#if 1
info("updateCamera( clip_near_z = ", clip_near_z, ", clip_far_z = ", clip_far_z);
info(" ws_bounds = ", ws_bounds);
info(" ls_bounds = ", ls_bounds);
info(" lookAt : eye [", lookAt->eye, "], center [", lookAt->center,"], up [", lookAt->up,"]");
info(" ortho : left = ", ortho->left, ", left = ", ortho->right, ", bottom = ", ortho->left, ", top = ", ortho->top, ", near = ", ortho->nearDistance, ", far = ", ortho->farDistance);
#endif


dmat4 shadowMapProjView = camera->projectionMatrix->transform() * camera->viewMatrix->transform();

dmat4 shadowMapTM = scale(0.5, 0.5, 1.0) * translate(1.0, 1.0, shadowMapBias) * shadowMapProjView * inverse_viewMatrix;

// convert tex gen matrix to float matrix and assign to light data


mat4 m(shadowMapTM);

(*light_itr++) = m[0];
Expand All @@ -610,13 +622,13 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
shadowMapIndex++;
};

#if 0
#if 1
info(" light_x = ", light_x);
info(" light_y = ", light_y);
info(" light_z = ", light_z);
#endif

#if 0
#if 1
double range = f - n;
info(" n = ", n, ", f = ", f, ", range = ", range);
#endif
Expand Down Expand Up @@ -668,7 +680,7 @@ void ViewDependentState::traverse(RecordTraversal& rt) const

if (requiresPerRenderShadowMaps && preRenderCommandGraph)
{
// info("ViewDependentState::traverse(RecordTraversal&) doing pre render command graph. shadowMapIndex = ", shadowMapIndex);
info("ViewDependentState::traverse(RecordTraversal&) doing pre render command graph. shadowMapIndex = ", shadowMapIndex);
preRenderCommandGraph->accept(rt);
}
}
Expand Down

0 comments on commit e94f584

Please sign in to comment.