#!/usr/bin/env sim Copyright (C) 2009 by Dipl.-Ing. Michael Niederle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For details of the GNU General Public License see http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. !draw_scene: stage: $$x 0 $$z 0 $$h 1 $$direction -90 $draw_ramp: [new_x new_z new_h new_direction] $lx x+Sin(direction) $lz z-Cos(direction) $rx x-Sin(direction) $rz z+Cos(direction) $new_lx new_x+Sin(new_direction) $new_lz new_z-Cos(new_direction) $new_rx new_x-Sin(new_direction) $new_rz new_z+Cos(new_direction) colour 1 1 0 draw_triangle lx h lz new_lx new_h new_lz rx h rz draw_triangle rx h rz new_lx new_h new_lz new_rx new_h new_rz colour 0.8 0 0 draw_triangle lx 0 lz lx h lz new_lx 0 new_lz draw_triangle lx h lz new_lx new_h new_lz new_lx 0 new_lz colour 0 0 0.8 draw_triangle rx 0 rz new_rx 0 new_rz rx h rz draw_triangle rx h rz new_rx 0 new_rz new_rx new_h new_rz !x new_x !z new_z !h new_h !direction new_direction $streight: [len new_h] draw_ramp x+len*Cos(direction) z+len*Sin(direction) new_h direction $right: [angle r new_h] $steps ceil(2*r*PI*angle/360) $center_x x-r*Sin(direction) $center_z z+r*Cos(direction) $d_angle angle/steps $dh (new_h-h)/steps steps->times: draw_ramp center_x+r*Sin(direction+d_angle) center_z-r*Cos(direction+d_angle) h+dh direction+d_angle $left: [angle r new_h] $steps ceil(2*r*PI*angle/360) $center_x x+r*Sin(direction) $center_z z-r*Cos(direction) $d_angle angle/steps $dh (new_h-h)/steps steps->times: draw_ramp center_x-r*Sin(direction-d_angle) center_z+r*Cos(direction-d_angle) h+dh direction-d_angle streight 5 1 streight 4 2 streight 3 4 streight 3 5 streight 2 5.5 streight 1 5.5 streight 3 5 streight 2 4 streight 1 3 streight 2 2 streight 4 1 right 90 10 2 streight 4 2 left 90 10 6 streight 4 5 streight 2 4 streight 1 3.8 streight 2 4 streight 4 5 streight 3 6 streight 2 7 streight 1 8 streight 2 11 streight 1 13 streight 1 14 streight 2 15 streight 4 16 right 180 10 16 streight 4 15 streight 2 14 streight 1 12 streight 1 9 streight 1 7 streight 1 6 streight 2 5 streight 4 4 streight 8 3 streight 10 2 streight 15 1 streight 3 1.5 streight 2 2 streight 1 2 streight 2 1.5 streight 3 1 streight 5 2 streight 8 4 streight 6 5 right 180 22 1 openGL "Rollercoaster": set_camera_position -14 30 50 pull_down 25 turn_right 30 roll_right 10