<s> from __future__ import absolute_import , division , print_function , unicode_literals <EOL> """<STR_LIT>""" <EOL> import math , random <EOL> import demo <EOL> import pi3d <EOL> DISPLAY = pi3d . Display . create ( ) <EOL> DISPLAY . set_background ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> ) <EOL> mylight = pi3d . Light ( lightpos = ( - <NUM_LIT> , - <NUM_LIT:1.0> , <NUM_LIT:0.0> ) , lightcol = ( <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT> ) , lightamb = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> CAMERA = pi3d . Camera . instance ( ) <EOL> shader = pi3d . Shader ( "<STR_LIT>" ) <EOL> shinesh = pi3d . Shader ( "<STR_LIT>" ) <EOL> flatsh = pi3d . Shader ( "<STR_LIT>" ) <EOL> tree2img = pi3d . Texture ( "<STR_LIT>" ) <EOL> tree1img = pi3d . Texture ( "<STR_LIT>" ) <EOL> hb2img = pi3d . Texture ( "<STR_LIT>" ) <EOL> bumpimg = pi3d . Texture ( "<STR_LIT>" ) <EOL> reflimg = pi3d . Texture ( "<STR_LIT>" ) <EOL> rockimg = pi3d . Texture ( "<STR_LIT>" ) <EOL> FOG = ( ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT> ) <EOL> TFOG = ( ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1.0> ) , <NUM_LIT> ) <EOL> ectex = pi3d . loadECfiles ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> myecube = pi3d . EnvironmentCube ( size = <NUM_LIT> , maptype = "<STR_LIT>" , name = "<STR_LIT>" ) <EOL> myecube . set_draw_details ( flatsh , ectex ) <EOL> mapwidth = <NUM_LIT> <EOL> mapdepth = <NUM_LIT> <EOL> mapheight = <NUM_LIT> <EOL> mountimg1 = pi3d . Texture ( "<STR_LIT>" ) <EOL> mymap = pi3d . ElevationMap ( "<STR_LIT>" , name = "<STR_LIT>" , <EOL> width = mapwidth , depth = mapdepth , height = mapheight , <EOL> divx = <NUM_LIT:32> , divy = <NUM_LIT:32> ) <EOL> mymap . set_draw_details ( shader , [ mountimg1 , bumpimg , bumpimg ] , <NUM_LIT> , <NUM_LIT:0.0> ) <EOL> mymap . set_fog ( * FOG ) <EOL> treeplane = pi3d . Plane ( w = <NUM_LIT> , h = <NUM_LIT> ) <EOL> treemodel1 = pi3d . MergeShape ( name = "<STR_LIT>" ) <EOL> treemodel1 . merge ( [ [ treeplane , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] , <EOL> [ treeplane , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] ] ) <EOL> treemodel2 = pi3d . MergeShape ( name = "<STR_LIT>" ) <EOL> treemodel2 . merge ( [ [ treeplane , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] , <EOL> [ treeplane , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] , <EOL> [ treeplane , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] ] ) <EOL> mytrees1 = pi3d . MergeShape ( name = "<STR_LIT>" ) <EOL> mytrees1 . cluster ( treemodel1 . buf [ <NUM_LIT:0> ] , mymap , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:50> , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) <EOL> mytrees1 . set_draw_details ( flatsh , [ tree2img ] , <NUM_LIT:0.0> , <NUM_LIT:0.0> ) <EOL> mytrees1 . set_fog ( * TFOG ) <EOL> mytrees2 = pi3d . MergeShape ( name = "<STR_LIT>" ) <EOL> mytrees2 . cluster ( treemodel2 . buf [ <NUM_LIT:0> ] , mymap , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:5> , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) <EOL> mytrees2 . set_draw_details ( flatsh , [ tree1img ] , <NUM_LIT:0.0> , <NUM_LIT:0.0> ) <EOL> mytrees2 . set_fog ( * TFOG ) <EOL> mytrees3 = pi3d . MergeShape ( name = "<STR_LIT>" ) <EOL> mytrees3 . cluster ( treemodel2 , mymap , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:5> , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) <EOL> mytrees3 . set_draw_details ( flatsh , [ hb2img ] , <NUM_LIT:0.0> , <NUM_LIT:0.0> ) <EOL> mytrees3 . set_fog ( * TFOG ) <EOL> myplane = pi3d . Plane ( h = <NUM_LIT> , w = <NUM_LIT> ) <EOL> myplane . set_draw_details ( shinesh , [ rockimg , bumpimg , reflimg ] , <NUM_LIT> , <NUM_LIT> ) <EOL> xrot , yrot , zrot = <NUM_LIT> , <NUM_LIT:0.0> , <NUM_LIT:0.0> <EOL> dxrot , dyrot , dzrot = <NUM_LIT> , <NUM_LIT> , <NUM_LIT> <EOL> radius = <NUM_LIT> <EOL> angle = <NUM_LIT:0.0> <EOL> rotn = <NUM_LIT> <EOL> elev = <NUM_LIT> <EOL> scshots = <NUM_LIT:1> <EOL> rot = <NUM_LIT:0.0> <EOL> tilt = <NUM_LIT:0.0> <EOL> avhgt = <NUM_LIT> <EOL> xm = <NUM_LIT:0.0> <EOL> zm = <NUM_LIT:0.0> <EOL> ym = mymap . calcHeight ( xm , zm ) + avhgt <EOL> myshadows = pi3d . ShadowCaster ( position = [ xm , ym , zm ] , light = mylight ) <EOL> mykeys = pi3d . Keyboard ( ) <EOL> mymouse = pi3d . Mouse ( restrict = False ) <EOL> mymouse . start ( ) <EOL> omx , omy = mymouse . position ( ) <EOL> while DISPLAY . loop_running ( ) : <EOL> CAMERA . reset ( ) <EOL> CAMERA . rotate ( tilt , rot , <NUM_LIT:0> ) <EOL> CAMERA . position ( ( xm , ym , zm ) ) <EOL> xrot += dxrot <EOL> yrot += dyrot <EOL> zrot += dzrot <EOL> angle += rotn <EOL> myplane . position ( radius * math . cos ( angle ) - radius , elev , radius * math . sin ( angle ) ) <EOL> myplane . rotateToX ( xrot ) <EOL> myplane . rotateToY ( yrot ) <EOL> myplane . rotateToZ ( zrot ) <EOL> myshadows . start_cast ( [ xm , ym , zm ] ) <EOL> myshadows . cast_shadow ( mytrees1 ) <EOL> myshadows . cast_shadow ( mytrees2 ) <EOL> myshadows . cast_shadow ( mytrees3 ) <EOL> myshadows . cast_shadow ( myplane ) <EOL> myshadows . cast_shadow ( mymap ) <EOL> myshadows . end_cast ( ) <EOL> myplane . draw ( ) <EOL> mymap . draw ( shader , [ mountimg1 , bumpimg , myshadows ] , <NUM_LIT> , <NUM_LIT:0.0> , light_camera = myshadows . LIGHT_CAM ) <EOL> myecube . draw ( ) <EOL> mytrees2 . draw ( ) <EOL> mytrees3 . draw ( ) <EOL> mytrees1 . draw ( ) <EOL> mx , my = mymouse . position ( ) <EOL> rot -= ( mx - omx ) * <NUM_LIT> <EOL> tilt += ( my - omy ) * <NUM_LIT> <EOL> omx = mx <EOL> omy = my <EOL> k = mykeys . read ( ) <EOL> if k > - <NUM_LIT:1> : <EOL> if k == <NUM_LIT> : <EOL> xm -= math . sin ( math . radians ( rot ) ) <EOL> zm += math . cos ( math . radians ( rot ) ) <EOL> ym = mymap . calcHeight ( xm , zm ) + avhgt <EOL> elif k == <NUM_LIT> : <EOL> xm += math . sin ( math . radians ( rot ) ) <EOL> zm -= math . cos ( math . radians ( rot ) ) <EOL> ym = mymap . calcHeight ( xm , zm ) + avhgt <EOL> elif k == <NUM_LIT> : <EOL> tilt -= <NUM_LIT> <EOL> elif k == <NUM_LIT> : <EOL> tilt += <NUM_LIT> <EOL> elif k == <NUM_LIT> : <EOL> rot -= <NUM_LIT:2> <EOL> elif k == <NUM_LIT:100> : <EOL> rot += <NUM_LIT:2> <EOL> elif k == <NUM_LIT> : <EOL> pi3d . screenshot ( "<STR_LIT>" + str ( scshots ) + "<STR_LIT>" ) <EOL> scshots += <NUM_LIT:1> <EOL> elif k == <NUM_LIT:10> : <EOL> mc = <NUM_LIT:0> <EOL> elif k == <NUM_LIT> : <EOL> mykeys . close ( ) <EOL> mymouse . stop ( ) <EOL> DISPLAY . stop ( ) <EOL> break <EOL> else : <EOL> print ( k ) <EOL> CAMERA . was_moved = False <EOL> quit ( ) </s>
