Daniele Bartolini 10 vuotta sitten
vanhempi
sitoutus
391c5fd384
1 muutettua tiedostoa jossa 169 lisäystä ja 189 poistoa
  1. 169 189
      docs/lua_api.txt

+ 169 - 189
docs/lua_api.txt

@@ -329,6 +329,19 @@ Math
 		Returns the distance along ray (from, dir) to intersection point with the oriented
 		bounding box (tm, half_extents) or -1.0 if no intersection.
 
+UnitManager
+===========
+
+	**create** ([world]) : Unit
+		Creates a new empty unit. If *world* is specified, the unit will be owned by
+		that world.
+
+	**destroy** (unit)
+		Destroys the given *unit*.
+
+	**alive** (unit) : bool
+		Returns whether the unit is alive.
+
 World
 =====
 
@@ -376,12 +389,6 @@ World
 	**set_sound_volume** (world, volume)
 		Sets the *volume* of the sound *id*.
 
-	**create_window_gui** (world) : Gui
-		Creates a new window-space Gui of size *width* and *height*.
-
-	**destroy_gui** (world, id)
-		Destroys the gui with the given *id*.
-
 	**create_debug_line** (world, depth_test) : DebugLine
 		Creates a new DebugLine. *depth_test* controls whether to
 		enable depth test when rendering the lines.
@@ -389,8 +396,14 @@ World
 	**destroy_debug_line** (world, line)
 		Destroys the debug *line*.
 
-	**load_level** (world, name) : Level
-		Loads the level *name* into the world.
+	**load_level** (world, name, [pos, rot]) : Level
+		Loads the level *name* into the world at the given *position* and *rotation*.
+
+	**scene_graph** (world) : SceneGraph
+		Returns the scene graph.
+
+	**render_world** (world) : RenderWorld
+		Returns the render sub-world.
 
 	**physics_world** (world) : PhysicsWorld
 		Returns the physics sub-world.
@@ -398,145 +411,56 @@ World
 	**sound_world** (world) : SoundWorld
 		Returns the sound sub-world.
 
-Unit
-----
-
-	**local_position** (unit) : Vector3
-		Returns the local position of the unit.
-
-	**local_rotation** (unit) : Quaternion
-		Returns the local rotation of the unit.
-
-	**local_scale** (unit) : Vector3
-		Returns the local scale of the unit.
-
-	**local_pose** (unit) : Matrix4x4
-		Returns the local pose of the unit.
-
-	**world_position** (unit) : Vector3
-		Returns the world position of the unit.
-
-	**world_rotation** (unit) : Quaternion
-		Returns the world rotation of the unit.
-
-	**world_pose** (unit) : Matrix4x4
-		Returns the world pose of the unit.
-
-	**set_local_position** (unit, position)
-		Sets the local position of the unit.
-
-	**set_local_rotation** (unit, rotation)
-		Sets the local rotation of the unit.
-
-	**set_local_scale** (unit, scale)
-		Sets the local scale of the unit.
-
-	**set_local_pose** (unit, n, pose)
-		Sets the local pose of the unit.
-
-	**camera** (unit, name)
-		Returns the camera *name*.
-
-	**material** (unit, name)
-		Returns the material *name*.
-
-	**mesh** (unit, name)
-		Returns the mesh *name*.
-
-	**sprite** (unit, name)
-		Returns the sprite *name*.
-
-	**actor** (unit, name)
-		Returns the actor *name*.
-
-	**controller** (unit, name)
-		Returns the controller *name*.
-
-	**is_a** (unit, type)
-		Returns whether the unit is of the given *type*.
-
-	**play_sprite_animation** (unit, name, loop)
-		Plays the sprite animation *name*.
-
-	**stop_sprite_animation** (unit)
-		Stops the current playing animation.
-
-Camera
-------
-
-	**set_projection_type** (camera, type)
-		Sets the projection type of the camera.
-
-	**projection_type** (camera) : int
-		Returns the projection type of the camera.
-
-	**fov** (camera) : float
-		Returns the field-of-view of the camera in degrees.
-
-	**set_fov** (camera, degrees)
-		Sets the field-of-view of the camera in degrees.
+SceneGraph
+----------
 
-	**aspect** (camera) : float
-		Returns the aspect ratio of the camera. (Perspective projection only.)
+	**create** (sg, unit) : int
+		Creates the transform for the *unit*.
 
-	**set_aspect** (camera)
-		Sets the aspect ratio of the camera. (Perspective projection only.)
+	**destroy** (sg, id)
+		Destroys the transform *id*.
 
-	**near_clip_distance** (camera) : float
-		Returns the near clip distance of the camera.
+	**transform_instances** (sg, unit) : Id
+		Returns the transform of the *unit*.
 
-	**set_near_clip_distance** (camera, near)
-		Sets the near clip distance of the camera.
+	**local_position** (sg, id) : Vector3
+		Returns the local position of the transform *id*.
 
-	**far_clip_distance** (camera) : float
-		Returns the far clip distance of the camera.
+	**local_rotation** (sg, id) : Quaternion
+		Returns the local rotation of the transform *id*.
 
-	**set_far_clip_distance** (camera, far)
-		Sets the far clip distance of the camera.
+	**local_scale** (sg, id) : Vector3
+		Returns the local scale of the transform *id*.
 
-	**set_orthographic_metrics** (camera, left, right, bottom, top)
-		Sets the coordinates for orthographic clipping planes. (Orthographic projection only.)
+	**local_pose** (sg, id) : Matrix4x4
+		Returns the local pose of the transform *id*.
 
-	**set_viewport_metrics** (camera, x, y, width, height)
-		Sets the coordinates for the camera viewport in pixels.
+	**world_position** (sg, id) : Vector3
+		Returns the world position of the transform *id*.
 
-	**screen_to_world** (camera, pos) : Vector3
-		Returns *pos* from screen-space to world-space coordinates.
+	**world_rotation** (sg, id) : Quaternion
+		Returns the world rotation of the transform *id*.
 
-	**world_to_screen** (camera, pos) : Vector3
-		Returns *pos* from world-space to screen-space coordinates.
+	**world_pose** (sg, id) : Matrix4x4
+		Returns the world pose of the transform *id*.
 
-Sprite
-------
+	**set_local_position** (sg, id, position)
+		Sets the local *position* of the transform *id*.
 
-	**set_frame** (sprite, num)
-		Sets the frame of the sprite.
+	**set_local_rotation** (sg, id, rotation)
+		Sets the local *rotation* of the transform *id*.
 
-	**set_depth** (sprite, depth)
-		Sets the depth of the sprite.
-		Sprites with higher depth values are drawn in front of sprites
-		whith lower depth values.
+	**set_local_scale** (sg, id, scale)
+		Sets the local *scale* of the transform *id*.
 
-Mesh
-----
+	**set_local_pose** (sg, id, pose)
+		Sets the local *pose* of the transform *id*.
 
-	**local_position** (mesh) : Vector3
-		Returns the local position of the mesh.
+	**link** (sg, child, parent)
+		Links *child* transform to *parent* transform.
 
-	**local_rotation** (mesh) : Quaternion
-		Returns the local rotation of the mesh.
-
-	**local_pose** (mesh) : Matrix4x4
-		Returns the local pose of the mesh.
-
-	**set_local_position** (mesh, unit, position)
-		Sets the local position of the mesh.
-
-	**set_local_rotation** (mesh, unit, rotation)
-		Sets the local rotation of the mesh.
-
-	**set_local_pose** (mesh, unit, pose)
-		Sets the local pose of the mesh.
+	**unlink** (sg, id)
+		Unlinks *id* transform from its parent, if any.
 
 Material
 --------
@@ -574,153 +498,209 @@ Gui
 	draw_text
 		TODO
 
-PhysicsWorld
-=============
+RenderWorld
+===========
 
-	**gravity** (physics_world) : Vector3
-		Returns the gravity.
+	**enable_debug_drawing** (rw, enable)
+		Sets whether to *enable* debug drawing.
 
-	**set_gravity** (physics_world, gravity)
-		Sets the gravity.
+Mesh
+----
 
-	**make_raycast**
-		TODO
+	**create_mesh** (rw, unit, mesh_resource, mesh_name, material_resource, visible) : Id
+		Creates a new mesh instance for *unit* and returns its id.
 
-	**overlap_test**
-		TODO
+	**destroy_mesh** (rw, id)
+		Destroys the mesh *id*.
 
-Controller
-----------
+	**mesh_instances** (rw, unit) : table
+		Returns all the mesh instances of the *unit*.
+
+Sprite
+------
+
+	**create_sprite** (rw, unit, sprite_resource, material_resource, visible) : Id
+		Creates a new sprite instance for *unit* and returns its id.
+
+	**destroy_sprite** (rw, id)
+		Destroys the sprite *id*.
 
-	**move** (controller, position)
-		Moves the controller to *position*.
+	**sprite_instances** (rw, unit) : table
+		Returns all the sprites of the *unit*.
+
+Light
+-----
 
-	**position** (controller) : Vector3
-		Returns the position of the controller.
+	**create_light** (rw, unit) : Id
+		Creates a new light for *unit* and returns its id.
 
-	**collides_up** (controller) : bool
-		Returns whether the contoller collides upwards.
+	**destroy_light** (rw, id)
+		Destroys the light *id*.
 
-	**collides_down** (controller) : bool
-		Returns whether the controller collides downwards.
+	**light_instances** (rw, unit) : Id
+		Returns the light of the *unit*.
 
-	**collides_sides** (controller) : bool
-		Returns whether the controller collides sidewards.
+	**light_type** (rw, id) : string
+		Returns the type of the light *id*.
+		It can be either ``directional``, ``omni`` or ``spot``.
+
+	**light_color** (rw, id) : Color4
+		Returns the color of the light *id*.
+
+	**light_range** (rw, id) : float
+		Returns the range of the light *id*.
+
+	**light_intensity** (rw, id) : float
+		Returns the intensity of the light *id*.
+
+	**light_spot_angle** (rw, id) : float
+		Returns the spot angle of the light *id*.
+
+	**set_light_type** (rw, id, type)
+		Sets the *type* of the light *id*.
+
+	**set_light_color** (rw, id, color)
+		Sets the *color* of the light *id*.
+
+	**set_light_range** (rw, id, range)
+		Sets the *range* of the light *id*.
+
+	**set_light_intensity** (rw, id, intensity)
+		Sets the *intensity* of the light *id*.
+
+	**set_light_spot_angle** (rw, id, angle)
+		Sets the spot *angle* of the light *id*.
+
+PhysicsWorld
+=============
+
+	**gravity** (pw) : Vector3
+		Returns the gravity.
+
+	**set_gravity** (pw, gravity)
+		Sets the gravity.
+
+	**raycast** (pw, from, dir, length, mode) : table
+		Returns the actors which intersects the raycast.
+		Mode can be either ``closest`` or ``all``.
+
+	**enable_debug_drawing** (pw, enable)
+		Sets whether to *enable* debug drawing.
 
 Actor
 -----
 
-	**world_position** (actor) : Vector3
+	**actor_instances** (pw, unit) : Id
+		Returns the actor of the *unit*.
+
+	**actor_world_position** (pw, actor) : Vector3
 		Returns the world position of the actor.
 
-	**world_rotation** (actor) : Quaternion
+	**actor_world_rotation** (pw, actor) : Quaternion
 		Returns the world rotation of the actor.
 
-	**world_pose** (actor) : Matrix4x4
+	**actor_world_pose** (pw, actor) : Matrix4x4
 		Returns the world pose of the actor.
 
-	**teleport_world_position** (actor, position)
+	**teleport_actor_world_position** (pw, actor, position)
 		Teleports the actor to the given world position.
 
-	**teleport_world_rotation** (actor, rotation)
+	**teleport_actor_world_rotation** (pw, actor, rotation)
 		Teleports the actor to the given world rotation.
 
-	**teleport_world_pose** (actor, pose)
+	**teleport_actor_world_pose** (pw, actor, pose)
 		Teleports the actor to the given world pose.
 
-	**center_of_mass** (actor) : Vector3
+	**actor_center_of_mass** (pw, actor) : Vector3
 		Returns the center of mass of the actor.
 
-	**enable_gravity** (actor)
+	**enable_actor_gravity** (pw, actor)
 		Enables gravity for the actor.
 
-	**disable_gravity** (actor)
+	**disable_actor_gravity** (pw, actor)
 		Disables gravity for the actor.
 
-	**enable_collision** (actor)
+	**enable_actor_collision** (pw, actor)
 		Enables collision detection for the actor.
 
-	**disable_collision** (actor)
+	**disable_actor_collision** (pw, actor)
 		Disables collision detection for the actor.
 
-	**set_collision_filter** (actor, name)
+	**set_actor_collision_filter** (pw, actor, name)
 		Sets the collision filter of the actor.
 
-	**set_kinematic** (actor, kinematic)
+	**set_actor_kinematic** (pw, actor, kinematic)
 		Sets whether the actor is kinematic or not.
 		Note that this call has no effect on static actors.
 
-	**move** (actor, position)
+	**move_actor** (pw, actor, position)
 		Moves the actor to *pos*
 		Note that this call only affects nonkinematic actors.
 
-	**is_static** (actor) : bool
+	**is_static** (pw, actor) : bool
 		Returns whether the actor is static.
 
-	**is_dynamic** (actor) bool
+	**is_dynamic** (pw, actor) bool
 		Returns whether the actor is dynamic.
 
-	**is_kinematic** (actor) : bool
+	**is_kinematic** (pw, actor) : bool
 		Returns whether the actor is kinematic (keyframed).
 
-	**is_nonkinematic** (actor) : bool
+	**is_nonkinematic** (pw, actor) : bool
 		Returns whether the actor is nonkinematic (i.e. dynamic and not kinematic).
 
-	**linear_damping** (actor) : float
+	**actor_linear_damping** (pw, actor) : float
 		Returns the linear damping of the actor.
 
-	**set_linear_damping** (actor, damping)
+	**set_actor_linear_damping** (pw, actor, damping)
 		Sets the linear damping of the actor.
 
-	**angular_damping** (actor) : float
+	**actor_angular_damping** (pw, actor) : float
 		Returns the angular damping of the actor.
 
-	**set_angular_damping** (actor, rate)
+	**set_actor_angular_damping** (pw, actor, rate)
 		Sets the angular damping of the actor.
 
-	**linear_velocity** (actor) : Vector3
+	**actor_linear_velocity** (pw, actor) : Vector3
 		Returns the linear velocity of the actor.
 
-	**set_linear_velocity** (actor, velocity)
+	**set_actor_linear_velocity** (pw, actor, velocity)
 		Sets the linear velocity of the actor.
 		Note that this call only affects nonkinematic actors.
 
-	**angular_velocity** (actor) : Vector3
+	**actor_angular_velocity** (pw, actor) : Vector3
 		Returns the angular velocity of the actor.
 
-	**set_angular_velocity** (actor, velocity)
+	**set_actor_angular_velocity** (pw, actor, velocity)
 		Sets the angular velocity of the actor.
 		Note that this call only affects nonkinematic actors.
 
-	**add_impulse** (actor, impulse)
+	**add_actor_impulse** (pw, actor, impulse)
 		Adds a linear impulse (acting along the center of mass) to the actor.
 		Note that this call only affects nonkinematic actors.
 
-	**add_impulse_at** (actor, impulse, position)
+	**add_actor_impulse_at** (pw, actor, impulse, position)
 		Adds a linear impulse (acting along the world position *pos*) to the actor.
 		Note that this call only affects nonkinematic actors.
 
-	**add_torque_impulse** (actor, impulse)
+	**add_actor_torque_impulse** (pw, actor, impulse)
 		Adds a torque impulse to the actor.
 
-	**push** (actor, velocity, mass)
+	**push_actor** (pw, actor, velocity, mass)
 		Pushes the actor as if it was hit by a point object with the given *mass*
 		travelling at the given *velocity*.
 		Note that this call only affects nonkinematic actors.
 
-	**push_at** (actor, velocity, mass, position)
+	**push_actor_at** (pw, actor, velocity, mass, position)
 		Like push() but applies the force at the world position *pos*.
 		Note that this call only affects nonkinematic actors.
 
-	**is_sleeping** (actor) : bool
+	**is_sleeping** (pw, actor) : bool
 		Returns whether the actor is sleeping.
 
-	**wake_up** (actor)
+	**wake_up** (pw, actor)
 		Wakes the actor up.
 
-	**unit** (actor) : Unit
-		Returns the unit that owns the actor or nil;
-
 SoundWorld
 ===========