@@ -29,7 +29,7 @@ module Skylight # Namespace for java classes
2929
3030 include Skylight # so we don't need fully qualified names for java classes
3131
32- VIEWPORT_W = 1280
32+ VIEWPORT_W = 1_280
3333 VIEWPORT_H = 720
3434 VIEWPORT_X = 230
3535 VIEWPORT_Y = 0
@@ -43,13 +43,13 @@ def settings
4343 def setup
4444 surface . setLocation ( VIEWPORT_X , VIEWPORT_Y )
4545 # camera
46- @peasycam = PeasyCam . new ( self , -4.083 , -6.096 , 7.000 , 1500 )
46+ @peasycam = PeasyCam . new ( self , -4.083 , -6.096 , 7.000 , 1_500 )
4747 peasycam . set_rotations ( 1.085 , -0.477 , 2.910 )
4848 peasycam . set_distance ( 100 )
4949 @cam_pos = [ 0 , 0 , 0 ]
5050 @cam_active = false
5151 # projection
52- perspective ( 60 * DEG_TO_RAD , width / height . to_f , 2 , 5000 )
52+ perspective ( 60 * DEG_TO_RAD , width / height . to_f , 2 , 5_000 )
5353 # load obj file into shape-object
5454 @shape = load_shape ( data_path ( 'skylight_demo_scene.obj' ) )
5555 # record list of vertices of the given shape
@@ -64,12 +64,12 @@ def setup
6464 context . print
6565 context . printGL
6666 # callback for rendering scene, implements DwSceneDisplay interface
67- display = lambda do |canvas |
67+ scene_display = lambda do |canvas |
6868 canvas . background ( 32 ) if canvas == skylight . renderer . pg_render
6969 canvas . shape ( shape )
7070 end
7171 # init skylight renderer
72- @skylight = DwSkyLight . new ( context , display , mat_scene_bounds )
72+ @skylight = DwSkyLight . new ( context , scene_display , mat_scene_bounds )
7373 # parameters for sky-light
7474 param = skylight . sky . param
7575 param . iterations = 50
@@ -100,7 +100,7 @@ def draw
100100 peasycam . beginHUD
101101 # display result
102102 image ( skylight . renderer . pg_render , 0 , 0 )
103- # image(skylight.sky.getSrc, 0, 0)
103+ # image(skylight.sky.getSrc, 0, 0)
104104 peasycam . endHUD
105105 # some info, window title
106106 sun_pass = skylight . sun . RENDER_PASS
@@ -123,11 +123,11 @@ def print_camera
123123 rot = peasycam . get_rotations
124124 lat = peasycam . get_look_at
125125 dis = peasycam . get_distance
126- cam_format = '%s: (%7.3f, %7.3f, %7.3f)'
127- dist_format = 'distance: (%7.3f)'
128- puts format ( cam_format , 'position' , pos [ 0 ] , pos [ 1 ] , pos [ 2 ] )
129- puts format ( cam_format , 'rotation' , rot [ 0 ] , rot [ 1 ] , rot [ 2 ] )
130- puts format ( cam_format , 'look_at' , lat [ 0 ] , lat [ 1 ] , lat [ 2 ] )
126+ cam_format = '%s: (%7.3f, %7.3f, %7.3f)' . freeze
127+ dist_format = 'distance: (%7.3f)' . freeze
128+ puts format ( cam_format , 'position' , * pos ) # use splat operator on array
129+ puts format ( cam_format , 'rotation' , * rot )
130+ puts format ( cam_format , 'look_at' , * lat )
131131 puts format ( dist_format , dis )
132132 end
133133
0 commit comments