call set_interactivity(type)
character(*), intent(in) :: type
This sets the kind of control the user should have over the camera, here type is one of:
- "none" (user cannot move the camera)
- "walk" (wasd to move, arrow keys to turn)
- "fly" (same as walk but can use space/c to go up/down)
- "orbit" (camera orbits a point, arrow keys to turn, w/s to zoom)
objectIndex = add_stl(filename, pos, scale, rot, edgeCol, edgeChar, fillCol, fillChar)
integer :: add_stl
character(*), intent(in) :: filename
real, dimension(3), intent(in), optional :: pos, scale, rot
character(*), intent(in), optional :: edgeChar, fillChar, fillCol, edgeCol
This loads an stl file and creates an object using it, starting at position pos, rotation rot and scale scale and returning the ID of the newly generated object. The edgeChar and fillChar are the characters used to fill the respective sections, whilst edgeCol and fillCol are the colors ("white", "red", "green", "blue", "magenta", "yellow", "cyan") for those sections.
objectIndex = add_cube(pos, scale, rot, edgeCol, edgeChar, fillCol, fillChar)
integer :: add_cube
real, dimension(3), intent(in), optional :: pos, scale, rot
character(*), intent(in), optional :: edgeChar, fillChar, fillCol, edgeCol
This creates a cube object with size s, starting at position pos, rotation rot and scale scale and returning the ID of the newly generated object. The edgeChar and fillChar are the characters used to fill the respective sections, whilst edgeCol and fillCol are the colors ("white", "red", "green", "blue", "magenta", "yellow", "cyan") for those sections.
call start()
call stop()
Start or stop ncurses.
call str(vector)
call str(int)
call str(real)
Function to convert various data types to string, useful for UI.
call draw_line_2d(x1, y1, x2, y2, c)
integer, intent(in) :: x1, y1, x2, y2
character, intent(in), optional :: c
Draw a 2D line from (x1, y1) to (x2, y2), with character c. If c is omitted or "/" then the character is calculated based on the angle of the line.
call draw_line_3d(v1, v2, c, col, dz)
real, dimension(3), intent(in) :: v1, v2
character(*), intent(in) :: c
real, intent(in), optional :: dz
integer, intent(in) :: col
Draw a 2D line from v1 to v2 in 3D space, with character c. If c is omitted or "/" then the character is calculated based on the angle of the line. An optional small positive dz is used to prioritize the character in the z-buffer (e.g. when lines should be drawn over fill).
call draw_string_2d(x, y, char)
integer, intent(in) :: x, y
character(*), intent(in) :: char
Draw the string given by char at the location (x, y) on the screen.
call draw_string_3d(v1, char, alwaysShow)
real, dimension(3), intent(in) :: v1
logical, intent(in), optional :: alwaysShow
character(*), intent(in) :: char
Draw the string given by char at the location v1 in 3d space. The string will always face right, but can be hidden by other things unless alwaysShow is set to true.
call get_screen_size(x, y)
integer, intent(inout) :: x, y
Puts the size of the terminal into x and y.
call get_input(k)
character, intent(inout) :: k
Puts the latest key pressed k and processes certain key presses depending on the interactivity.
call draw_box_2d(x1, y1, x2, y2)
integer, intent(in) :: x1, y1, x2, y2
Draws a box to the screen from (x1, y1) to (x2, y2).
fill_box_2d(x1, y1, x2, y2, char)
integer, intent(in) :: x1, y1, x2, y2
character, intent(in) :: char
Fills a box to the screen from (x1, y1) to (x2, y2) with char.
render()
draw()
render() the 3D scene, saving it to a buffer. Can then draw() the buffer to the screen. The functions are separate so that UI elements can be added to the buffer after 3D rendering but before drawing.
set_orbit_distance(dist)
real, intent(in) :: dist
Only used in orbit mode. Set the distance from the pivot that the camera should orbit.
set_orbit_pivot(piv)
real, dimension(3), intent(in) :: piv
Only used in orbit mode. Set the location of the pivot that the camera should orbit.
set_orbit_object(objIndex)
integer, intent(in) :: objIndex
Only used in orbit mode. Set the object the camera should orbit around. Note that this needs to be called again if the target moves.
rotation = get_object_scale(index)
call set_object_scale(index, newScale)
call scale_object(index, deltaScale)
integer, intent(in) :: index
real, dimension(3) :: get_object_scale
real, dimension(3), intent(in) :: newScale
real, dimension(3), intent(in) :: deltaScale
Get, set or change the rotation of an object.
position = get_object_pos(index)
call set_object_pos(index, newPos)
call translate_object(index, deltaPos)
integer, intent(in) :: index
real, dimension(3) :: get_object_pos
real, dimension(3), intent(in) :: newPos
real, dimension(3), intent(in) :: deltaPos
Get, set or change the position of an object.
position = get_object_pos(index)
call set_object_pos(index, newPos)
call translate_object(index, deltaPos)
integer, intent(in) :: index
real, dimension(3) :: get_object_pos
real, dimension(3), intent(in) :: newPos
real, dimension(3), intent(in) :: deltaPos
Get, set or change the position of an object.
position = get_camera_pos()
call set_camera_pos(newPos)
rotation = get_camera_rot()
call set_camera_rot(newRot)
real, dimension(3) :: get_camera_pos
real, dimension(3), intent(in) :: newPos
real, dimension(3) :: get_camera_rot
real, dimension(3), intent(in) :: newRot
Get, set or change the position or rotation of the camera.
set_debug(val)
logical, intent(in) :: val
Enable or disable debug mode. If enabled this displays some debug info in a box in the top left.