<s> import pg <EOL> class SphereScene ( pg . Scene ) : <EOL> def setup ( self ) : <EOL> print '<STR_LIT>' <EOL> self . wasd = pg . WASD ( self ) <EOL> self . wasd . look_at ( ( - <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> self . context = pg . Context ( pg . DirectionalLightProgram ( ) ) <EOL> self . sphere = pg . Sphere ( <NUM_LIT:4> , <NUM_LIT:0.5> , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> def enter ( self ) : <EOL> print '<STR_LIT>' <EOL> def update ( self , t , dt ) : <EOL> matrix = self . wasd . get_matrix ( ) <EOL> matrix = matrix . perspective ( <NUM_LIT> , self . window . aspect , <NUM_LIT> , <NUM_LIT:100> ) <EOL> self . context . matrix = matrix <EOL> self . context . camera_position = self . wasd . position <EOL> def draw ( self ) : <EOL> self . window . clear ( ) <EOL> self . sphere . draw ( self . context ) <EOL> def exit ( self ) : <EOL> print '<STR_LIT>' <EOL> def teardown ( self ) : <EOL> print '<STR_LIT>' <EOL> def on_mouse_button ( self , button , action , mods ) : <EOL> if action == pg . PRESS : <EOL> self . window . set_scene ( self . window . cylinder_scene ) <EOL> class CylinderScene ( pg . Scene ) : <EOL> def setup ( self ) : <EOL> print '<STR_LIT>' <EOL> self . wasd = pg . WASD ( self ) <EOL> self . wasd . look_at ( ( - <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> self . context = pg . Context ( pg . DirectionalLightProgram ( ) ) <EOL> self . cylinder = pg . Cylinder ( ( <NUM_LIT:0> , - <NUM_LIT:0.5> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0.5> , <NUM_LIT:0> ) , <NUM_LIT:0.5> , <NUM_LIT> ) <EOL> def enter ( self ) : <EOL> print '<STR_LIT>' <EOL> def update ( self , t , dt ) : <EOL> matrix = self . wasd . get_matrix ( ) <EOL> matrix = matrix . perspective ( <NUM_LIT> , self . window . aspect , <NUM_LIT> , <NUM_LIT:100> ) <EOL> self . context . matrix = matrix <EOL> self . context . camera_position = self . wasd . position <EOL> def draw ( self ) : <EOL> self . window . clear ( ) <EOL> self . cylinder . draw ( self . context ) <EOL> def exit ( self ) : <EOL> print '<STR_LIT>' <EOL> def teardown ( self ) : <EOL> print '<STR_LIT>' <EOL> def on_mouse_button ( self , button , action , mods ) : <EOL> if action == pg . PRESS : <EOL> self . window . set_scene ( self . window . sphere_scene ) <EOL> class Window ( pg . Window ) : <EOL> def setup ( self ) : <EOL> self . sphere_scene = SphereScene ( self ) <EOL> self . cylinder_scene = CylinderScene ( self ) <EOL> self . set_scene ( self . sphere_scene ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> pg . run ( Window ) </s>
