Skip to content

Commit e94f584

Browse files
committed
Added debug info
1 parent b79a2e0 commit e94f584

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/vsg/state/ViewDependentState.cpp

+21-9
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
471471
return bounds;
472472
};
473473

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

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

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

558-
#if 0
559-
info(" lookAt = ", lookAt);
560-
info(" ortho = ", ortho);
561-
#endif
562558
auto ws_bounds = computeFrustumBounds(clip_near_z, clip_far_z, clipToWorld);
563559
auto center = (ws_bounds.min + ws_bounds.max) * 0.5;
564560

@@ -591,12 +587,28 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
591587
ortho->nearDistance = ls_bounds.min.z;
592588
ortho->farDistance = ls_bounds.max.z;
593589
}
590+
#if 0
591+
ortho->left = -1;
592+
ortho->right = 1;
593+
ortho->nearDistance = -30.0;
594+
ortho->farDistance = 10.0;
595+
#endif
596+
#if 1
597+
info("updateCamera( clip_near_z = ", clip_near_z, ", clip_far_z = ", clip_far_z);
598+
info(" ws_bounds = ", ws_bounds);
599+
info(" ls_bounds = ", ls_bounds);
600+
info(" lookAt : eye [", lookAt->eye, "], center [", lookAt->center,"], up [", lookAt->up,"]");
601+
info(" ortho : left = ", ortho->left, ", left = ", ortho->right, ", bottom = ", ortho->left, ", top = ", ortho->top, ", near = ", ortho->nearDistance, ", far = ", ortho->farDistance);
602+
#endif
603+
594604

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

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

599609
// convert tex gen matrix to float matrix and assign to light data
610+
611+
600612
mat4 m(shadowMapTM);
601613

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

613-
#if 0
625+
#if 1
614626
info(" light_x = ", light_x);
615627
info(" light_y = ", light_y);
616628
info(" light_z = ", light_z);
617629
#endif
618630

619-
#if 0
631+
#if 1
620632
double range = f - n;
621633
info(" n = ", n, ", f = ", f, ", range = ", range);
622634
#endif
@@ -668,7 +680,7 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
668680

669681
if (requiresPerRenderShadowMaps && preRenderCommandGraph)
670682
{
671-
// info("ViewDependentState::traverse(RecordTraversal&) doing pre render command graph. shadowMapIndex = ", shadowMapIndex);
683+
info("ViewDependentState::traverse(RecordTraversal&) doing pre render command graph. shadowMapIndex = ", shadowMapIndex);
672684
preRenderCommandGraph->accept(rt);
673685
}
674686
}

0 commit comments

Comments
 (0)