Skip to content

Commit b8e0fca

Browse files
author
phillemann
committed
Sun is now visible in the sky
1 parent 44ba4ef commit b8e0fca

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

shadow/object.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ insula::shadow::object::update(
8585
time_delta const delta)
8686
{
8787
sun_angle_ += delta / 2;
88-
if (sun_angle_ >= fcppt::math::pi<graphics::scalar>())
89-
sun_angle_ = -fcppt::math::pi<graphics::scalar>();
88+
if (sun_angle_ >= fcppt::math::pi<graphics::scalar>()/2)
89+
sun_angle_ = -fcppt::math::pi<graphics::scalar>()/2;
9090
update_signal_(
9191
sun_angle_,
9292
gizmo());
@@ -128,7 +128,7 @@ insula::shadow::object::gizmo() const
128128
return
129129
graphics::gizmo(
130130
graphics::gizmo::init()
131-
.position(base_position_ + position)
131+
.position(base_position_ - position)
132132
.forward(forward)
133133
.up(up)
134134
.right(right));

skydome/object.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,17 @@ insula::skydome::object::render(
307307

308308
void
309309
insula::skydome::object::shadow_update(
310-
graphics::scalar,
311-
graphics::gizmo const &sun_gizmo)
310+
graphics::scalar const angle,
311+
graphics::gizmo const &)
312312
{
313313
sge::renderer::glsl::scoped_program scoped_shader_(
314314
renderer_,
315315
shader_.program());
316316

317317
shader_.set_uniform(
318318
"sun_position",
319-
fcppt::math::vector::normalize(
320-
sun_gizmo.position()));
319+
math::sphere_point(
320+
static_cast<graphics::scalar>(1),
321+
angle,
322+
static_cast<graphics::scalar>(0)));
321323
}

states/freelook.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ insula::states::freelook::react(
8585
context<game_inner>().react(
8686
t);
8787

88-
/*
88+
/*
8989
context<machine>().camera().gizmo() =
9090
context<game_outer>().shadow_object().gizmo();
91-
*/
91+
*/
9292

9393
return discard_event();
9494
}

0 commit comments

Comments
 (0)