Skip to content

Commit

Permalink
The spinning lights can be moved in and out by using [u] and [i].
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadlinger committed Feb 17, 2010
1 parent 6294fde commit f18a077
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/SpinningLights.d
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ public:
renderer.worldMatrix.inversed().transformLinear( m_light1Position );
}

void moveLight0( float factor ) {
m_light0Position *= ( 1 + factor );
}

void moveLight1( float factor ) {
m_light1Position *= ( 1 + factor );
}

private:
Vector3 m_light0Position;
Vector3 m_light1Position;
Expand Down Expand Up @@ -223,8 +231,27 @@ protected:
override void render( float deltaTime ) {
super.render( deltaTime );

// Update light positions.
m_material.updatePositions( deltaTime );

int direction = 1;
if ( isKeyDown( Key.LALT ) || isKeyDown( Key.RALT ) ) {
direction *= -1;
}

uint speed = 1;
if ( isKeyDown( Key.LSHIFT ) || isKeyDown( Key.RSHIFT ) ) {
speed *= 4;
}

if ( isKeyDown( Key.u ) ) {
m_material.moveLight0( deltaTime * direction * speed );
}
if ( isKeyDown( Key.i ) ) {
m_material.moveLight1( deltaTime * direction * speed );
}

// Render the scene.
renderer().beginScene();

if ( m_wireframeMode != WireframeMode.ONLY ) {
Expand Down

0 comments on commit f18a077

Please sign in to comment.