diff options
Diffstat (limited to 'doc/api.texi')
-rw-r--r-- | doc/api.texi | 603 |
1 files changed, 300 insertions, 303 deletions
diff --git a/doc/api.texi b/doc/api.texi index ab2955d..9a7591d 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -384,7 +384,7 @@ approximation that is ``good enough.'' Half of @var{pi}. @end defvar -@deffn {Procedure} cotan @var{z} +@deffn {Procedure} cotan z Return the cotangent of @var{z}. @end deffn @@ -425,176 +425,176 @@ functions, they do not compose well and create more verbose code. @subsubsection 2D Vectors -@deffn {Procedure} vec2 @var{x} @var{y} +@deffn {Procedure} vec2 x y Return a new 2D vector with coordinates (@var{x}, @var{y}). @end deffn -@deffn {Procedure} vec2/polar @var{r} @var{theta} +@deffn {Procedure} vec2/polar r theta Return a new 2D vector containing the Cartesian representation of the polar coordinate (@var{r}, @var{theta}). The angle @var{theta} is measured in radians. @end deffn -@deffn {Procedure} vec2? @var{obj} +@deffn {Procedure} vec2? obj Return @code{#t} if @var{obj} is a 2D vector. @end deffn -@deffn {Procedure} vec2-x @var{v} +@deffn {Procedure} vec2-x v Return the X coordinate of the 2D vector @var{v}. @end deffn -@deffn {Procedure} vec2-y @var{v} +@deffn {Procedure} vec2-y v Return the Y coordinate of the 2D vector @var{v}. @end deffn -@deffn {Procedure} vec2-copy @var{v} +@deffn {Procedure} vec2-copy v Return a fresh copy of the 2D vector @var{v}. @end deffn -@deffn {Procedure} vec2-magnitude @var{v} +@deffn {Procedure} vec2-magnitude v Return the magnitude of the 2D vector @var{v}. @end deffn -@deffn {Procedure} vec2-dot-product @var{v1} @var{v2} +@deffn {Procedure} vec2-dot-product v1 v2 Return the dot product of the 2D vectors @var{v1} and @var{v2}. @end deffn -@deffn {Procedure} vec2-normalize @var{v} +@deffn {Procedure} vec2-normalize v Return the normalized form of the 2D vector @var{v}. @end deffn -@deffn {Procedure} vec2+ @var{v} @var{x} +@deffn {Procedure} vec2+ v x Add @var{x}, either a 2D vector or a scalar (i.e. a real number), to the 2D vector @var{v} and return a new vector containing the sum. @end deffn -@deffn {Procedure} vec2- @var{v} @var{x} +@deffn {Procedure} vec2- v x Subtract @var{x}, either a 2D vector or a scalar, from the 2D vector @var{v} and return a new vector containing the difference. @end deffn -@deffn {Procedure} vec2* @var{v} @var{x} +@deffn {Procedure} vec2* v x Multiply the 2D vector @var{v} by @var{x}, a 2D vector or a scalar, and return a new vector containing the product. @end deffn -@deffn {Procedure} set-vec2-x! @var{v} @var{x} +@deffn {Procedure} set-vec2-x! v x Set the X coordinate of the 2D vector @var{v} to @var{x}. @end deffn -@deffn {Procedure} set-vec2-y! @var{v} @var{y} +@deffn {Procedure} set-vec2-y! v y Set the Y coordinate of the 2D vector @var{v} to @var{y}. @end deffn -@deffn {Procedure} set-vec2! @var{v} @var{x} @var{y} +@deffn {Procedure} set-vec2! v x y Set the X and Y coordinates of the 2D vector @var{v} to @var{x} and @var{y}, respectively. @end deffn -@deffn {Procedure} vec2-copy! @var{source} @var{target} +@deffn {Procedure} vec2-copy! source target Copy the 2D vector @var{source} into the 2D vector @var{target}. @end deffn -@deffn {Procedure} vec2-add! @var{v} @var{x} +@deffn {Procedure} vec2-add! v x Perform an in-place modification of the 2D vector @var{v} by adding @var{x}, a 2D vector or a scalar. @end deffn -@deffn {Procedure} vec2-sub! @var{v} @var{x} +@deffn {Procedure} vec2-sub! v x Perform an in-place modification of the 2D vector @var{v} by subtracting @var{x}, a 2D vector or a scalar. @end deffn -@deffn {Procedure} vec2-mult! @var{v} @var{x} +@deffn {Procedure} vec2-mult! v x Perform an in-place modification of the 2D vector @var{v} by multiplying it by @var{x}, a 2D vector or a scalar. @end deffn @subsubsection 3D Vectors -@deffn {Procedure} vec3 @var{x} @var{y} +@deffn {Procedure} vec3 x y Return a new 2D vector with coordinates (@var{x}, @var{y}). @end deffn -@deffn {Procedure} vec3? @var{obj} +@deffn {Procedure} vec3? obj Return @code{#t} if @var{obj} is a 3D vector. @end deffn -@deffn {Procedure} vec3-x @var{v} +@deffn {Procedure} vec3-x v Return the X coordinate of the 3D vector @var{v}. @end deffn -@deffn {Procedure} vec3-y @var{v} +@deffn {Procedure} vec3-y v Return the Y coordinate of the 3D vector @var{v}. @end deffn -@deffn {Procedure} vec3-z @var{v} +@deffn {Procedure} vec3-z v Return the Z coordinate of the 3D vector @var{v}. @end deffn -@deffn {Procedure} vec3-copy @var{v} +@deffn {Procedure} vec3-copy v Return a fresh copy of the 3D vector @var{v}. @end deffn -@deffn {Procedure} vec3-magnitude @var{v} +@deffn {Procedure} vec3-magnitude v Return the magnitude of the 3D vector @var{v}. @end deffn -@deffn {Procedure} vec3-dot-product @var{v1} @var{v2} +@deffn {Procedure} vec3-dot-product v1 v2 Return the dot product of the 3D vectors @var{v1} and @var{v2}. @end deffn -@deffn {Procedure} vec3-normalize @var{v} +@deffn {Procedure} vec3-normalize v Return the normalized form of the 3D vector @var{v}. @end deffn -@deffn {Procedure} vec3+ @var{v} @var{x} +@deffn {Procedure} vec3+ v x Add @var{x}, either a 3D vector or a scalar (i.e. a real number), to the 3D vector @var{v} and return a new vector containing the sum. @end deffn -@deffn {Procedure} vec3- @var{v} @var{x} +@deffn {Procedure} vec3- v x Subtract @var{x}, either a 3D vector or a scalar, from the 3D vector @var{v} and return a new vector containing the difference. @end deffn -@deffn {Procedure} vec3* @var{v} @var{x} +@deffn {Procedure} vec3* v x Multiply the 3D vector @var{v} by @var{x}, a 3D vector or a scalar, and return a new vector containing the product. @end deffn -@deffn {Procedure} set-vec3-x! @var{v} @var{x} +@deffn {Procedure} set-vec3-x! v x Set the X coordinate of the 3D vector @var{v} to @var{x}. @end deffn -@deffn {Procedure} set-vec3-y! @var{v} @var{y} +@deffn {Procedure} set-vec3-y! v y Set the Y coordinate of the 3D vector @var{v} to @var{y}. @end deffn -@deffn {Procedure} set-vec3-z! @var{v} @var{z} +@deffn {Procedure} set-vec3-z! v z Set the Z coordinate of the 3D vector @var{v} to @var{z}. @end deffn -@deffn {Procedure} set-vec3! @var{v} @var{x} @var{y} @var{z} +@deffn {Procedure} set-vec3! v x y z Set the X, Y, and Z coordinates of the 3D vector @var{v} to @var{x}, @var{y}, and @var{z}, respectively. @end deffn -@deffn {Procedure} vec3-copy! @var{source} @var{target} +@deffn {Procedure} vec3-copy! source target Copy the 3D vector @var{source} into the 3D vector @var{target}. @end deffn -@deffn {Procedure} vec3-add! @var{v} @var{x} +@deffn {Procedure} vec3-add! v x Perform an in-place modification of the 3D vector @var{v} by adding @var{x}, a 3D vector or a scalar. @end deffn -@deffn {Procedure} vec3-sub! @var{v} @var{x} +@deffn {Procedure} vec3-sub! v x Perform an in-place modification of the 3D vector @var{v} by subtracting @var{x}, a 3D vector or a scalar. @end deffn -@deffn {Procedure} vec3-mult! @var{v} @var{x} +@deffn {Procedure} vec3-mult! v x Perform an in-place modification of the 3D vector @var{v} by multiplying it by @var{x}, a 3D vector or a scalar. @end deffn @@ -613,182 +613,182 @@ Like some of the other math modules, there exists a collection of functions that do in-place modification of rectangles for use in performance critical code paths. -@deffn {Procedure} rect @var{x} @var{y} @var{width} @var{height} +@deffn {Procedure} rect x y width height @deffnx {Procedure} make-rect @var{x} @var{y} @var{width} @var{height} Create a new rectangle that is @var{width} by @var{height} in size and whose bottom-left corner is located at (@var{x}, @var{y}). @end deffn -@deffn {Procedure} rect? @var{obj} +@deffn {Procedure} rect? obj Return @code{#t} if @var{obj} is a rectangle. @end deffn -@deffn {Procedure} rect-within? @var{rect1} @var{rect2} +@deffn {Procedure} rect-within? rect1 rect2 Return @code{#t} if @var{rect2} is completely within @var{rect1}. @end deffn -@deffn {Procedure} rect-intersects? @var{rect1} @var{rect2} +@deffn {Procedure} rect-intersects? rect1 rect2 Return @code{#t} if @var{rect2} overlaps @var{rect1}. @end deffn -@deffn {Procedure} rect-contains? @var{rect} @var{x} @var{y} +@deffn {Procedure} rect-contains? rect x y Return @code{#t} if the coordinates (@var{x}, @var{y}) are within @var{rect}. @end deffn -@deffn {Procedure} rect-contains-vec2? @var{rect} @var{v} +@deffn {Procedure} rect-contains-vec2? rect v Return @code{#t} if the 2D vector @var{v} is within the bounds of @var{rect}. @end deffn -@deffn {Procedure} rect-x @var{rect} +@deffn {Procedure} rect-x rect Return the X coordinate of the lower-left corner of @var{rect}. @end deffn -@deffn {Procedure} rect-y @var{rect} +@deffn {Procedure} rect-y rect Return the Y coordinate of the lower-left corner of @var{rect}. @end deffn -@deffn {Procedure} rect-left @var{rect} +@deffn {Procedure} rect-left rect Return the left-most X coordinate of @var{rect}. @end deffn -@deffn {Procedure} rect-right @var{rect} +@deffn {Procedure} rect-right rect Return the right-most X coordinate of @var{rect}. @end deffn -@deffn {Procedure} rect-bottom @var{rect} +@deffn {Procedure} rect-bottom rect Return the bottom-most Y coordinate of @var{rect}. @end deffn -@deffn {Procedure} rect-top @var{rect} +@deffn {Procedure} rect-top rect Return the top-most Y coordinate of @var{rect}. @end deffn -@deffn {Procedure} rect-center-x @var{rect} +@deffn {Procedure} rect-center-x rect Return the X coordinate of the center of @var{rect}. @end deffn -@deffn {Procedure} rect-center-y @var{rect} +@deffn {Procedure} rect-center-y rect Return the Y coordinate of the center of @var{rect}. @end deffn -@deffn {Procedure} rect-width @var{rect} +@deffn {Procedure} rect-width rect Return the width of @var{rect}. @end deffn -@deffn {Procedure} rect-height @var{rect} +@deffn {Procedure} rect-height rect Return the height of @var{rect}. @end deffn -@deffn {Procedure} rect-area @var{rect} +@deffn {Procedure} rect-area rect Return the surface area covered by @var{rect}. @end deffn -@deffn {Procedure} rect-clamp-x @var{rect} @var{x} +@deffn {Procedure} rect-clamp-x rect x Restrict @var{x} to the portion of the X axis covered by @var{rect}. @end deffn -@deffn {Procedure} rect-clamp-y @var{rect} @var{y} +@deffn {Procedure} rect-clamp-y rect y Restrict @var{y} to the portion of the Y axis covered by @var{rect}. @end deffn -@deffn {Procedure} rect-clamp @var{rect1} @var{rect2} +@deffn {Procedure} rect-clamp rect1 rect2 Return a new rect that adjusts the location of @var{rect1} so that it is completely within @var{rect2}. An exception is thrown in the case that @var{rect1} cannot fit completely within @var{rect2}. @end deffn -@deffn {Procedure} rect-move @var{rect} @var{x} @var{y} +@deffn {Procedure} rect-move rect x y Return a new rectangle based on @var{rect} but moved to the coordinates (@var{x}, @var{y}). @end deffn -@deffn {Procedure} rect-move-vec2 @var{rect} @var{v} +@deffn {Procedure} rect-move-vec2 rect v Return a new rectangle based on @var{rect} but moved to the coordinates in the 2D vector @var{v}. @end deffn -@deffn {Procedure} rect-move-by @var{rect} @var{x} @var{y} +@deffn {Procedure} rect-move-by rect x y Return a new rectangle based on @var{rect} but moved by (@var{x}, @var{y}) units relative to its current location. @end deffn -@deffn {Procedure} rect-move-by-vec2 @var{rect} @var{v} +@deffn {Procedure} rect-move-by-vec2 rect v Return a new rectangle based on @var{rect} but moved by the 2D vector @var{v} relative to its current location. @end deffn -@deffn {Procedure} rect-inflate @var{rect} @var{width} @var{height} +@deffn {Procedure} rect-inflate rect width height Return a new rectangle based on @var{rect}, but expanded by @var{width} units on the X axis and @var{height} units on the Y axis, while keeping the rectangle centered on the same point. @end deffn -@deffn {Procedure} rect-union @var{rect1} @var{rect2} +@deffn {Procedure} rect-union rect1 rect2 Return a new rectangle that completely covers the area of @var{rect1} and @var{rect2}. @end deffn -@deffn {Procedure} rect-clip @var{rect1} @var{rect2} +@deffn {Procedure} rect-clip rect1 rect2 Return a new rectangle that is the overlapping region of @var{rect1} and @var{rect2}. If the two rectangles do not overlap, a rectangle of 0 width and 0 height is returned. @end deffn -@deffn {Procedure} set-rect-x! @var{rect} @var{x} +@deffn {Procedure} set-rect-x! rect x Set the left X coordinate of @var{rect} to @var{x}. @end deffn -@deffn {Procedure} set-rect-y! @var{rect} @var{y} +@deffn {Procedure} set-rect-y! rect y Set the bottom Y coordinate of @var{rect} to @var{y}. @end deffn -@deffn {Procedure} set-rect-width! @var{rect} @var{width} +@deffn {Procedure} set-rect-width! rect width Set the width of @var{rect} to @var{width}. @end deffn -@deffn {Procedure} set-rect-height! @var{rect} @var{height} +@deffn {Procedure} set-rect-height! rect height Set the height of @var{rect} to @var{height}. @end deffn -@deffn {Procedure} rect-move! @var{rect} @var{x} @var{y} +@deffn {Procedure} rect-move! rect x y Move @var{rect} to (@var{x}, @var{y}) in-place. @end deffn -@deffn {Procedure} rect-move-vec2! @var{rect} @var{v} +@deffn {Procedure} rect-move-vec2! rect v Move @var{rect} to the 2D vector @var{v} in-place. @end deffn -@deffn {Procedure} rect-move-by! @var{rect} @var{x} @var{y} +@deffn {Procedure} rect-move-by! rect x y Move @var{rect} by (@var{x}, @var{y}) in-place. @end deffn -@deffn {Procedure} rect-move-by-vec2! @var{rect} @var{v} +@deffn {Procedure} rect-move-by-vec2! rect v Move @var{rect} by the 2D vector @var{v} in-place. @end deffn -@deffn {Procedure} rect-inflate! @var{rect} @var{width} @var{height} +@deffn {Procedure} rect-inflate! rect width height Expand @var{rect} by @var{width} and @var{height} in-place. @end deffn -@deffn {Procedure} rect-union! @var{rect1} @var{rect2} +@deffn {Procedure} rect-union! rect1 rect2 Modify @var{rect1} in-place to completely cover the area of both @var{rect1} and @var{rect2}. @end deffn -@deffn {Procedure} rect-clip! @var{rect1} @var{rect2} +@deffn {Procedure} rect-clip! rect1 rect2 Modify @var{rect1} in-place to be the overlapping region of @var{rect1} and @var{rect2}. @end deffn -@deffn {Procedure} rect-clamp! @var{rect1} @var{rect2} +@deffn {Procedure} rect-clamp! rect1 rect2 Adjust the location of @var{rect1} in-place so that its bounds are completely within @var{rect2}. An exception is thrown in the case that @var{rect1} cannot fit completely within @var{rect2}. @end deffn -@deffn {Procedure} vec2-clamp-to-rect! @var{v} @var{rect} +@deffn {Procedure} vec2-clamp-to-rect! v rect Restrict the coordinates of the 2D vector @var{v} so that they are within the bounds of @var{rect}. @var{v} is modified in-place. @end deffn @@ -829,51 +829,51 @@ by the smallest amount so that it no longer overlaps with B. By using this filtering technique, a game can resolve collisions between different objects in different ways. -@deffn {Procedure} make-grid [@var{cell-size} 64] +@deffn {Procedure} make-grid [cell-size 64] Return a new grid partitioned into @var{cell-size} tiles. @end deffn -@deffn {Procedure} grid? @var{obj} +@deffn {Procedure} grid? obj Return @code{#t} if @var{obj} is a grid. @end deffn -@deffn {Procedure} cell? @var{obj} +@deffn {Procedure} cell? obj Return @code{#t} if @var{obj} is a grid cell. @end deffn -@deffn {Procedure} cell-count @var{cell} +@deffn {Procedure} cell-count cell Return the number of items in @var{cell}. @end deffn -@deffn {Procedure} grid-cell-size @var{grid} +@deffn {Procedure} grid-cell-size grid Return the cell size of @var{grid}. @end deffn -@deffn {Procedure} grid-cell-count @var{grid} +@deffn {Procedure} grid-cell-count grid Return the number of cells currently in @var{grid}. @end deffn -@deffn {Procedure} grid-item-count @var{grid} +@deffn {Procedure} grid-item-count grid Return the number of items in @var{grid}. @end deffn -@deffn {Procedure} grid-add @var{grid} @var{item} @var{x} @var{y} @ - @var{width} @var{height} +@deffn {Procedure} grid-add grid item x y @ + width height Add @var{item} to @var{grid} represented by the axis-aligned bounding box whose lower-left corner is at (@var{x}, @var{y}) and is @var{width} x @var{height} in size. @end deffn -@deffn {Procedure} grid-remove @var{grid} @var{item} +@deffn {Procedure} grid-remove grid item Return @var{item} from @var{grid}. @end deffn -@deffn {Procedure} grid-clear @var{grid} +@deffn {Procedure} grid-clear grid Remove all items from @var{grid}. @end deffn -@deffn {Procedure} grid-move @var{grid} @var{item} @var{position} @var{filter} +@deffn {Procedure} grid-move grid item position filter Attempt to move @var{item} in @var{grid} to @var{position} (a 2D vector) and check for collisions. For each collision, @var{filter} will be called with two arguments: @var{item} and the item it collided @@ -881,17 +881,16 @@ with. If a collision occurs, @var{position} may be modified to resolve the colliding objects. @end deffn -@deffn {Procedure} for-each-cell @var{proc} @var{grid} [@var{rect}] +@deffn {Procedure} for-each-cell proc grid [rect] Call @var{proc} with each cell in @var{grid} that intersects @var{rect}, or every cell if @var{rect} is @code{#f}. @end deffn -@deffn {Procedure} for-each-item @var{proc} @var{grid} +@deffn {Procedure} for-each-item proc grid Call @var{proc} for each item in @var{grid}. @end deffn -@deffn {Procedure} slide @var{item} @var{item-rect} @ - @var{other} @var{other-rect} @var{goal} +@deffn {Procedure} slide item item-rect other other-rect goal Resolve the collision that occurs between @var{item} and @var{other} when moving @var{item-rect} to @var{goal} by sliding @var{item-rect} @@ -916,10 +915,10 @@ objects. @subsubsection Matrix Operations -@deffn {Procedure} make-matrix4 @var{aa} @var{ab} @var{ac} @var{ad} @ - @var{ba} @var{bb} @var{bc} @var{bd} @ - @var{ca} @var{cb} @var{cc} @var{cd} @ - @var{da} @var{db} @var{dc} @var{dd} +@deffn {Procedure} make-matrix4 aa ab ac ad @ + ba bb bc bd @ + ca cb cc cd @ + da db dc dd Return a new 4x4 matrix initialized with the given 16 values in column-major format. @@ -943,20 +942,18 @@ equivalent to the following code: @end deffn -@deffn {Procedure} matrix4? @var{obj} +@deffn {Procedure} matrix4? obj Return @code{#t} if @var{obj} is a 4x4 matrix. @end deffn -@deffn {Procedure} matrix4* . @var{matrices} +@deffn {Procedure} matrix4* . matrices Return a new 4x4 matrix containing the product of multiplying all of the given @var{matrices}. Note: Remember that matrix multiplication is @strong{not} commutative! @end deffn -@deffn {Procedure} orthographic-projection @var{left} @var{right} @ - @var{top} @var{bottom} @ - @var{near} @var{far} +@deffn {Procedure} orthographic-projection left right top bottom near far Return a new 4x4 matrix that represents an orthographic (2D) projection for the horizontal clipping plane @var{top} and @@ -964,9 +961,7 @@ projection for the horizontal clipping plane @var{top} and and the depth clipping plane @var{near} and @var{far}. @end deffn -@deffn {Procedure} perspective-projection @var{fov} @ - @var{aspect-ratio} @ - @var{near} @var{far} +@deffn {Procedure} perspective-projection fov aspect-ratio near far Return a new 4x4 matrix that represents a perspective (3D) projection with a field of vision of @var{fov} radians, an aspect ratio of @@ -974,58 +969,58 @@ with a field of vision of @var{fov} radians, an aspect ratio of and @var{far}. @end deffn -@deffn {Procedure} matrix4-translate @var{x} +@deffn {Procedure} matrix4-translate x Return a new 4x4 matrix that represents a translation by @var{x}, a 2D vector, a 3D vector, or a rectangle (in which case the bottom-left corner of the rectangle is used). @end deffn -@deffn {Procedure} matrix4-scale @var{s} +@deffn {Procedure} matrix4-scale s Return a new 4x4 matrix that represents a scaling along the X, Y, and Z axes by the scaling factor @var{s}, a real number. @end deffn -@deffn {Procedure} matrix4-rotate @var{q} +@deffn {Procedure} matrix4-rotate q Return a new 4x4 matrix that represents a rotation about an arbitrary axis defined by the quaternion @var{q}. @end deffn -@deffn {Procedure} matrix4-rotate-z @var{theta} +@deffn {Procedure} matrix4-rotate-z theta Return a new 4x4 matrix that represents a rotation about the Z axis by @var{theta} radians. @end deffn -@deffn {Procedure} matrix4-identity! @var{matrix} +@deffn {Procedure} matrix4-identity! matrix Modify @var{matrix} in-place to contain the identity matrix. @end deffn -@deffn {Procedure} matrix4-mult! @var{dest} @var{a} @var{b} +@deffn {Procedure} matrix4-mult! dest a b Multiply the 4x4 matrix @var{a} by the 4x4 matrix @var{b} and store the result in the 4x4 matrix @var{dest}. @end deffn -@deffn {Procedure} matrix4-translate! @var{matrix} @var{x} +@deffn {Procedure} matrix4-translate! matrix x Modify @var{matrix} in-place to contain a translation by @var{x}, a 2D vector, a 3D vector, or a rectangle (in which case the bottom-left corner of the rectangle is used). @end deffn -@deffn {Procedure} matrix4-scale! @var{matrix} @var{s} +@deffn {Procedure} matrix4-scale! matrix s Modify @var{matrix} in-place to contain a scaling along the X, Y, and Z axes by the scaling factor @var{s}, a real number. @end deffn -@deffn {Procedure} matrix4-rotate! @var{matrix} @var{q} +@deffn {Procedure} matrix4-rotate! matrix q Modify @var{matrix} in-place to contain a rotation about an arbitrary axis defined by the quaternion @var{q}. @end deffn -@deffn {Procedure} matrix4-rotate-z! @var{matrix} @var{theta} +@deffn {Procedure} matrix4-rotate-z! matrix theta Modify @var{matrix} in-place to contain a rotation about the Z axis by @var{theta} radians. @end deffn -@deffn {Procedure} matrix4-2d-transform! @var{matrix} [#:origin] @ +@deffn {Procedure} matrix4-2d-transform! matrix [#:origin] @ [#:position] [#:rotation] @ [#:scale] [#:skew] @@ -1037,7 +1032,7 @@ to @var{origin}, a 2D vector. If an argument is not provided, that particular transformation will not be included in the result. @end deffn -@deffn {Procedure} transform! @var{matrix} @var{v} +@deffn {Procedure} transform! matrix v Modify the 2D vector @var{v} in-place by multiplying it by the 4x4 matrix @var{matrix}. @end deffn @@ -1052,28 +1047,28 @@ meaningful result. When interpolating two quaternions, there is a smooth transition from one rotation to another, whereas interpolating two matrices would yield garbage. -@deffn {Procedure} quaternion @var{x} @var{y} @var{z} @var{w} +@deffn {Procedure} quaternion x y z w Return a new quaternion with values @var{x}, @var{y}, @var{z}, and @var{w}. @end deffn -@deffn {Procedure} quaternion? @var{obj} +@deffn {Procedure} quaternion? obj Return @code{#t} if @var{obj} is a quaternion. @end deffn -@deffn {Procedure} quaternion-w @var{q} +@deffn {Procedure} quaternion-w q Return the W component of the quaternion @var{q}. @end deffn -@deffn {Procedure} quaternion-x @var{q} +@deffn {Procedure} quaternion-x q Return the X component of the quaternion @var{q}. @end deffn -@deffn {Procedure} quaternion-y @var{q} +@deffn {Procedure} quaternion-y q Return the Y component of the quaternion @var{q}. @end deffn -@deffn {Procedure} quaternion-z @var{q} +@deffn {Procedure} quaternion-z q Return the Z component of the quaternion @var{q}. @end deffn @@ -1093,55 +1088,55 @@ figure out which function makes an animation look the best. Pro tip: @code{smoothstep} provides nice results most of the time and creates smoother animation than using @code{linear}. -@deffn {Procedure} linear @var{t} +@deffn {Procedure} linear t @end deffn -@deffn {Procedure} smoothstep @var{t} +@deffn {Procedure} smoothstep t @end deffn -@deffn {Procedure} ease-in-quad @var{t} +@deffn {Procedure} ease-in-quad t @end deffn -@deffn {Procedure} ease-out-quad @var{t} +@deffn {Procedure} ease-out-quad t @end deffn -@deffn {Procedure} ease-in-out-quad @var{t} +@deffn {Procedure} ease-in-out-quad t @end deffn -@deffn {Procedure} ease-in-cubic @var{t} +@deffn {Procedure} ease-in-cubic t @end deffn -@deffn {Procedure} ease-out-cubic @var{t} +@deffn {Procedure} ease-out-cubic t @end deffn -@deffn {Procedure} ease-in-out-cubic @var{t} +@deffn {Procedure} ease-in-out-cubic t @end deffn -@deffn {Procedure} ease-in-quart @var{t} +@deffn {Procedure} ease-in-quart t @end deffn -@deffn {Procedure} ease-out-quart @var{t} +@deffn {Procedure} ease-out-quart t @end deffn -@deffn {Procedure} ease-in-out-quart @var{t} +@deffn {Procedure} ease-in-out-quart t @end deffn -@deffn {Procedure} ease-in-quint @var{t} +@deffn {Procedure} ease-in-quint t @end deffn -@deffn {Procedure} ease-out-quint @var{t} +@deffn {Procedure} ease-out-quint t @end deffn -@deffn {Procedure} ease-in-out-quint @var{t} +@deffn {Procedure} ease-in-out-quint t @end deffn -@deffn {Procedure} ease-in-sine @var{t} +@deffn {Procedure} ease-in-sine t @end deffn -@deffn {Procedure} ease-out-sine @var{t} +@deffn {Procedure} ease-out-sine t @end deffn -@deffn {Procedure} ease-in-out-sine @var{t} +@deffn {Procedure} ease-in-out-sine t @end deffn @node Bezier Curves @@ -1160,46 +1155,46 @@ Currently, the rendering of Bezier curves is rather crude and provided mostly for visualizing and debugging curves that would be unseen in the final game. See @xref{Lines and Shapes} for more information. -@deffn {Procedure} make-bezier-curve @var{p0} @var{p1} @var{p2} @var{p3} +@deffn {Procedure} make-bezier-curve p0 p1 p2 p3 Return a new Bezier curve object whose starting point is @var{p0}, ending point is @var{p3}, and control points are @var{p1} and @var{p2}. All points are 2D vectors. @end deffn -@deffn {Procedure} bezier-curve? @var{obj} +@deffn {Procedure} bezier-curve? obj Return @code{#t} if @var{obj} is a Bezier curve. @end deffn -@deffn {Procedure} bezier-curve-p0 @var{bezier} +@deffn {Procedure} bezier-curve-p0 bezier Return the starting point of @var{bezier}. @end deffn -@deffn {Procedure} bezier-curve-p1 @var{bezier} +@deffn {Procedure} bezier-curve-p1 bezier Return the first control point of @var{bezier}. @end deffn -@deffn {Procedure} bezier-curve-p2 @var{bezier} +@deffn {Procedure} bezier-curve-p2 bezier Return the second control point of @var{bezier}. @end deffn -@deffn {Procedure} bezier-curve-p3 @var{bezier} +@deffn {Procedure} bezier-curve-p3 bezier Return the end point of @var{bezier}. @end deffn -@deffn {Procedure} bezier-path . @var{control-points} +@deffn {Procedure} bezier-path . control-points Return a list of connected bezier curves defined by @var{control-points}. The first curve is defined by the first 4 arguments and every additional curve thereafter requires 3 additional arguments. @end deffn -@deffn {Procedure} bezier-curve-point-at @var{bezier} @var{t} +@deffn {Procedure} bezier-curve-point-at bezier t Return the coordinates for @var{bezier} at @var{t} (a value in the range [0, 1] representing how far from the start of the curve to check) as a 2D vector. @end deffn -@deffn {Procedure} bezier-curve-point-at! @var{dest} @var{bezier} @var{t} +@deffn {Procedure} bezier-curve-point-at! dest bezier t Modify the 2D vector @var{dest} in-place to contain the coordinates for @var{bezier} at @var{t}. @end deffn @@ -1261,12 +1256,11 @@ for optimal path finding! Return a new path finder object. @end deffn -@deffn {Procedure} path-finder? @var{obj} +@deffn {Procedure} path-finder? obj Return @code{#t} if @var{obj} is a path finder. @end deffn -@deffn {Procedure} a* @var{path-finder} @var{start} @var{goal} @ - @var{neighbors} @var{cost} @var{distance} +@deffn {Procedure} a* path-finder start goal neighbors cost distance Return a list of nodes forming a path from @var{start} to @var{goal} using @var{path-finder} to hold state. @var{neighbors} is a procedure @@ -1307,7 +1301,7 @@ blocks to implement additional rendering techniques. @node Textures @subsection Textures -@deffn {Procedure} load-image @var{file} [#:min-filter nearest] @ +@deffn {Procedure} load-image file [#:min-filter nearest] @ [#:mag-filter nearest] [#:wrap-s repeat] [#:wrap-t repeat] Load the image data from @var{file} and return a new texture object. @@ -1323,30 +1317,30 @@ coordinates that are greater than @code{1.0}. Possible values are @end deffn -@deffn {Procedure} texture? @var{obj} +@deffn {Procedure} texture? obj Return @code{#t} if @var{obj} is a texture. @end deffn -@deffn {Procedure} texture-region? @var{obj} +@deffn {Procedure} texture-region? obj Return @code{#t} if @var{obj} is a texture region. @end deffn -@deffn {Procedure} texture-parent @var{texture} +@deffn {Procedure} texture-parent texture If @var{texture} is a texture region, return the full texture that it is based upon. Otherwise, return @code{#f}. @end deffn -@deffn {Procedure} texture-min-filter @var{texture} +@deffn {Procedure} texture-min-filter texture Return the minification filter for @var{texture}, either @code{nearest} or @code{linear}. @end deffn -@deffn {Procedure} texture-mag-filter @var{texture} +@deffn {Procedure} texture-mag-filter texture Return the magnification filter for @var{texture}, either @code{nearest} or @code{linear}. @end deffn -@deffn {Procedure} texture-wrap-s @var{texture} +@deffn {Procedure} texture-wrap-s texture Return the method used for wrapping texture coordinates along the X axis for @var{texture}. @@ -1360,16 +1354,16 @@ Possible wrapping methods: @end deffn -@deffn {Procedure} texture-wrap-t @var{texture} +@deffn {Procedure} texture-wrap-t texture Return the method used for wrapping texture coordinates along the Y axis for @var{texture}. @end deffn -@deffn {Procedure} texture-width @var{texture} +@deffn {Procedure} texture-width texture Return the width of @var{texture} in pixels. @end deffn -@deffn {Procedure} texture-height @var{texture} +@deffn {Procedure} texture-height texture Return the height of @var{texture} in pixels. @end deffn @@ -1379,7 +1373,7 @@ efficient to render many regions of a large texture than it is to render a bunch of small textures. Chickadee provides a tile atlas data type for collecting texture regions into a single vector. -@deffn {Procedure} split-texture @var{texture} @var{tile-width} @var{tile-height} @ +@deffn {Procedure} split-texture texture tile-width tile-height @ [#:margin 0] [#:spacing 0] Return a new texture atlas that splits @var{texture} into a grid of @@ -1392,15 +1386,15 @@ This type of texture atlas layout is very common for 2D tile maps. @xref{Tile Maps} for more information. @end deffn -@deffn {Procedure} texture-atlas? @var{obj} +@deffn {Procedure} texture-atlas? obj Return @code{#t} if @var{obj} is a texture atlas. @end deffn -@deffn {Procedure} texture-atlas-texture @var{atlas} +@deffn {Procedure} texture-atlas-texture atlas Return the texture that all texture regions in @var{atlas} have been created from. @end deffn -@deffn {Procedure} texture-atlas-ref @var{atlas} @var{index} +@deffn {Procedure} texture-atlas-ref atlas index Return the texture region in @var{atlas} at @var{index}. @end deffn @@ -1414,7 +1408,7 @@ players, NPCs, items, particles, text, etc. In Chickadee, bitmaps are stored in textures (@pxref{Textures}) and can be used to draw sprites via the @code{draw-sprite} procedure. -@deffn {Procedure} draw-sprite @var{texture} @var{position} @ +@deffn {Procedure} draw-sprite texture position @ [#:tint white] [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] @ [#:rect] @@ -1452,25 +1446,25 @@ reducing the number of different textures is to stuff many bitmaps into a single image file and create a ``texture atlas'' (@pxref{Textures}) to access the sub-images within. -@deffn {Procedure} make-sprite-batch @var{texture} [#:capacity 256] +@deffn {Procedure} make-sprite-batch texture [#:capacity 256] Create a new sprite batch for @var{texture} with initial space for @var{capacity} sprites. Sprite batches automatically resize when they are full to accomodate as many sprites as necessary. @end deffn -@deffn {Procedure} sprite-batch? @var{obj} +@deffn {Procedure} sprite-batch? obj Return @code{#t} if @var{obj} is a sprite batch. @end deffn -@deffn {Procedure} sprite-batch-texture @var{batch} +@deffn {Procedure} sprite-batch-texture batch Return the texture for @var{batch}. @end deffn -@deffn {Procedure} set-sprite-batch-texture! @var{batch} @var{texture} +@deffn {Procedure} set-sprite-batch-texture! batch texture Set texture for @var{batch} to @var{texture}. @end deffn -@deffn {Procedure} sprite-batch-add! @var{batch} @var{position} @ +@deffn {Procedure} sprite-batch-add! batch position @ [#:origin] [#:scale] [:rotation] @ [#:tint @code{white}] [#:texture-region] @@ -1482,11 +1476,11 @@ parent is the batch texture may be specified as @var{texture-region}. See @code{draw-sprite} for information about the other arguments. @end deffn -@deffn {Procedure} sprite-batch-clear! @var{batch} +@deffn {Procedure} sprite-batch-clear! batch Reset size of @var{batch} to 0. @end deffn -@deffn {Procedure} draw-sprite-batch @var{batch} [#:blend-mode @code{alpha}] +@deffn {Procedure} draw-sprite-batch batch [#:blend-mode @code{alpha}] Render @var{batch} using @var{blend-mode}. Alpha blending is used by default. @end deffn @@ -1518,7 +1512,7 @@ interface widgets like buttons and dialog boxes. By using a nine patch, they can be rendered at any size without unappealing scaling artifacts. -@deffn {Procedure} draw-nine-patch @var{texture} @var{rect} @ +@deffn {Procedure} draw-nine-patch texture rect @ [#:margin 0] [#:top-margin margin] [#:bottom-margin margin] @ [#:left-margin margin] [#:right-margin margin] @ [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] @ @@ -1544,12 +1538,12 @@ maps is called @url{http://mapeditor.org,Tiled}. Chickadee has native support for loading and rendering Tiled maps in the @code{(chickadee render tiled)} module. -@deffn {Procedure} load-tile-map @var{file-name} +@deffn {Procedure} load-tile-map file-name Load the Tiled formatted map in @var{file-name} and return a new tile map object. @end deffn -@deffn {Procedure} draw-tile-map @var{tile-map} [#:layers] [#:region] @ +@deffn {Procedure} draw-tile-map tile-map [#:layers] [#:region] @ [#:origin] [#:position] [#:scale] [#:rotation] Draw the layers of @var{tile-map}. By default, all layers are drawn. @@ -1567,7 +1561,7 @@ Sprites are fun, but sometimes simple, untextured lines and polygons are desired. That's where the @code{(chickadee render shapes)} module comes in! -@deffn {Procedure} draw-line @var{start} @var{end} @ +@deffn {Procedure} draw-line start end @ [#:thickness 0.5] [#:feather 1.0] [#:cap round] [#:color] @ [#:shader] @@ -1581,7 +1575,7 @@ the @var{shader} argument to override the built-in line segment shader. @end deffn -@deffn {Procedure} draw-bezier-curve @var{bezier} [#:segments 32] @ +@deffn {Procedure} draw-bezier-curve bezier [#:segments 32] @ [#:control-points?] [#:tangents?] @ [#:control-point-size 8] @ [#:control-point-color yellow] @ @@ -1604,7 +1598,7 @@ A custom @var{matrix} may be passed for applications that require more control over the final output. @end deffn -@deffn {Procedure} draw-bezier-path @var{path} [#:segments 32] @ +@deffn {Procedure} draw-bezier-path path [#:segments 32] @ [#:control-points?] [#:tangents?] @ [#:control-point-size 8] @ [#:control-point-color yellow] @ @@ -1635,36 +1629,36 @@ where a font is not specified, as is the case in the above example. The following procedures can be found in the @code{(chickadee render font)} module: -@deffn {Procedure} load-font @var{file} +@deffn {Procedure} load-font file Load the Angel Code font (in either XML or FNT format) in @var{file} and return a new font object. @end deffn -@deffn {Procedure} font? @var{obj} +@deffn {Procedure} font? obj Return @code{#t} if @var{obj} is a font object. @end deffn -@deffn {Procedure} font-face @var{font} +@deffn {Procedure} font-face font Return the name of @var{font}. @end deffn -@deffn {Procedure} font-line-height @var{font} +@deffn {Procedure} font-line-height font Return the line height of @var{font}. @end deffn -@deffn {Procedure} font-line-height @var{font} +@deffn {Procedure} font-line-height font Return the line height of @var{font}. @end deffn -@deffn {Procedure} font-bold? @var{font} +@deffn {Procedure} font-bold? font Return @code{#t} if @var{font} is a bold font. @end deffn -@deffn {Procedure} font-italic? @var{font} +@deffn {Procedure} font-italic? font Return @code{#t} if @var{font} is an italicized font. @end deffn -@deffn {Procedure} draw-text @var{text} @var{position} +@deffn {Procedure} draw-text text position [#:font] [#:origin] [#:scale] [#:rotation] [#:blend-mode] [#:start 0] [#:end @code{(string-length text)}] @@ -1719,7 +1713,7 @@ at the coordinates @code{(320, 240)}: To see all of the tweakable knobs and switches, read on! -@deffn {Procedure} make-particles @var{capacity} [#:blend-mode @code{alpha}] @ +@deffn {Procedure} make-particles capacity [#:blend-mode @code{alpha}] @ [#:color white] [#:end-color transparent] [#:texture] @ [#:animation-rows 1] [#:animation-columns 1] [#:width] [#:height] @ [#:speed-range (vec2 0.1 1.0)] [#:acceleration-range (vec2 0.0 0.1)] @ @@ -1777,24 +1771,23 @@ last or @code{oldest} for the reverse. By default, no sorting is applied at all. @end deffn -@deffn {Procedure} particles? @var{obj} +@deffn {Procedure} particles? obj Return @code{#t} if @var{obj} is a particle system. @end deffn -@deffn {Procedure} update-particles @var{particles} +@deffn {Procedure} update-particles particles Advance the simulation of @var{particles}. @end deffn -@deffn {Procedure} draw-particles @var{particles} +@deffn {Procedure} draw-particles particles Render @var{particles}. @end deffn -@deffn {Procedure} draw-particles* @var{particles} @var{matrix} +@deffn {Procedure} draw-particles* particles matrix Render @var{particles} with @var{matrix} applied. @end deffn -@deffn {Procedure} make-particle-emitter @var{spawn-area} @ - @var{rate} [@var{duration}] +@deffn {Procedure} make-particle-emitter spawn-area rate [duration] Return a new particle emitter that spawns @var{rate} particles per frame within @var{spawn-area} (a rectangle or 2D vector) for @@ -1802,32 +1795,32 @@ frame within @var{spawn-area} (a rectangle or 2D vector) for emitter will spawn particles indefinitely. @end deffn -@deffn {Procedure} particle-emitter? @var{obj} +@deffn {Procedure} particle-emitter? obj Return @code{#t} if @var{obj} is a particle emitter. @end deffn -@deffn {Procedure} particle-emitter-spawn-area @var{emitter} +@deffn {Procedure} particle-emitter-spawn-area emitter Return the spawn area for @var{emitter}. @end deffn -@deffn {Procedure} particle-emitter-rate @var{emitter} +@deffn {Procedure} particle-emitter-rate emitter Return the number of particles that @var{emitter} will spawn per frame. @end deffn -@deffn {Procedure} particle-emitter-life @var{emitter} +@deffn {Procedure} particle-emitter-life emitter Return the number of frames remaining in @var{emitter}'s lifespan. @end deffn -@deffn {Procedure} particle-emitter-done? @var{emitter} +@deffn {Procedure} particle-emitter-done? emitter Return @code{#t} if @var{emitter} has finished spawning particlces. @end deffn -@deffn {Procedure} add-particle-emitter @var{particles} @var{emitter} +@deffn {Procedure} add-particle-emitter particles emitter Add @var{emitter} to @var{particles}. @end deffn -@deffn {Procedure} remove-particle-emitter @var{particles} @var{emitter} +@deffn {Procedure} remove-particle-emitter particles emitter Remove @var{emitter} to @var{particles} @end deffn @@ -1880,7 +1873,11 @@ a post-processing shader and rendered to the game window. The post-processing shader could do any number of things: scaling, antialiasing, motion blur, etc. -@deffn {Procedure} make-framebuffer @var{width} @var{height} [#:min-filter 'linear] [#:mag-filter 'linear] [#:wrap-s 'repeat] [#:wrap-t 'repeat] +@deffn {Procedure} make-framebuffer width height @ + [#:min-filter @code{linear}] @ + [#:mag-filter @code{linear}] @ + [#:wrap-s @code{repeat}] @ + [#:wrap-t @code{repeat}] Create a new framebuffer that is @var{width} pixels wide and @var{height} pixels high. @@ -1891,15 +1888,15 @@ is used in both cases. To perform no smoothing at all, use the best choice for pixel art games. @end deffn -@deffn {Procedure} framebuffer? @var{obj} +@deffn {Procedure} framebuffer? obj Return @code{#t} if @var{obj} is a framebuffer. @end deffn -@deffn {Procedure} framebuffer-texture @var{fb} +@deffn {Procedure} framebuffer-texture fb Return the texture backing the framebuffer @var{fb}. @end deffn -@deffn {Procedure} framebuffer-viewport @var{fb} +@deffn {Procedure} framebuffer-viewport fb Return the default viewport (@pxref{Viewports}) used by the framebuffer @var{fb}. @end deffn @@ -1923,8 +1920,8 @@ see @code{with-viewport} in @ref{Rendering Engine}. The @code{(chickadee render viewport)} module provides the following API: -@deffn {Procedure} make-viewport @var{x} @var{y} @var{width} @var{height} @ - [#:clear-color] [#:clear-flags] +@deffn {Procedure} make-viewport x y width height @ + [#:clear-color] [#:clear-flags] Create a viewport that covers an area of the window starting from coordinates (@var{x}, @var{y}) and spanning @var{width} @code{x} @@ -1936,31 +1933,31 @@ Possible values for @var{clear-flags} are @var{color-buffer}, @var{depth-buffer}, @var{accum-buffer}, and @var{stencil-buffer}. @end deffn -@deffn {Procedure} viewport? @var{obj} +@deffn {Procedure} viewport? obj Return @code{#t} if @var{obj} is a viewport. @end deffn -@deffn {Procedure} viewport-x @var{viewport} +@deffn {Procedure} viewport-x viewport Return the left edge of @var{viewport}. @end deffn -@deffn {Procedure} viewport-y @var{viewport} +@deffn {Procedure} viewport-y viewport Return the bottom edge of @var{viewport}. @end deffn -@deffn {Procedure} viewport-width @var{viewport} +@deffn {Procedure} viewport-width viewport Return the width of @var{viewport}. @end deffn -@deffn {Procedure} viewport-height @var{viewport} +@deffn {Procedure} viewport-height viewport Return the height of @var{viewport}. @end deffn -@deffn {Procedure} viewport-clear-color @var{viewport} +@deffn {Procedure} viewport-clear-color viewport Return the clear color for @var{viewport}. @end deffn -@deffn {Procedure} viewport-clear-flags @var{viewport} +@deffn {Procedure} viewport-clear-flags viewport Return the list of clear flags for @var{viewport}. @end deffn @@ -1984,10 +1981,10 @@ would be tedious to have to have to specify them each time The following procedures and syntax can be found in the @code{(chickadee render)} module. -@deffn {Syntax} gpu-apply @var{shader} @var{vertex-array} @ - [#:uniform-key @var{uniform-value} ...] -@deffnx {Syntax} gpu-apply* @var{shader} @var{vertex-array} @ - @var{count} [#:uniform-key @var{uniform-value} ...] +@deffn {Syntax} gpu-apply shader vertex-array @ + [#:uniform-key uniform-value @dots{}] +@deffnx {Syntax} gpu-apply* shader vertex-array count @ + [#:uniform-key uniform-value @dots{}] Render @var{vertex-array} using @var{shader} with the uniform values specified in the following keyword arguments. @@ -1996,10 +1993,10 @@ While @code{gpu-apply} will draw every vertex in @var{vertex-array}, @code{gpu-apply*} will only draw @var{count} vertices. @end deffn -@deffn {Syntax} gpu-apply/instanced @var{shader} @var{vertex-array} @ - @var{n} [#:uniform-key @var{uniform-value} ...] -@deffnx {Syntax} gpu-apply/instanced @var{shader} @var{vertex-array} @ - @var{count} @var{n} [#:uniform-key @var{uniform-value} ...] +@deffn {Syntax} gpu-apply/instanced shader vertex-array @ + n [#:uniform-key uniform-value @dots{}] +@deffnx {Syntax} gpu-apply/instanced shader vertex-array @ + count n [#:uniform-key uniform-value @dots{}] Render @var{vertex-array} @var{n} times using @var{shader} with the uniform values specified in the following keyword arguments. @@ -2037,31 +2034,31 @@ Return the currently bound texture (@pxref{Textures}). Return the currently bound projection matrix (@pxref{Matrices}). @end deffn -@deffn {Syntax} with-viewport @var{viewport} @var{body} ... +@deffn {Syntax} with-viewport viewport body @dots{} Evaluate @var{body} with the current viewport bound to @var{viewport} (@pxref{Viewports}). @end deffn -@deffn {Syntax} with-framebuffer @var{framebuffer} @var{body} ... +@deffn {Syntax} with-framebuffer framebuffer body @dots{} Evaluate @var{body} with the current framebuffer bound to @var{framebuffer} (@pxref{Framebuffers}). @end deffn -@deffn {Syntax} with-blend-mode @var{blend-mode} @var{body} ... +@deffn {Syntax} with-blend-mode blend-mode body @dots{} Evaluate @var{body} with the current blend mode bound to @var{blend-mode} (@pxref{Blending}). @end deffn -@deffn {Syntax} with-depth-test @var{depth-test?} @var{body} ... +@deffn {Syntax} with-depth-test depth-test? body @dots{} Evaluate @var{body} with the depth-test disabled if @var{depth-test?} is @code{#f}, or enabled otherwise (@pxref{Blending}). @end deffn -@deffn {Syntax} with-texture @var{texture} @var{body} ... +@deffn {Syntax} with-texture texture body @dots{} Evaluate @var{body} with the current texture bound to @var{texture} (@pxref{Textures}). @end deffn -@deffn {Syntax} with-projection @var{projection} @var{body} ... +@deffn {Syntax} with-projection projection body @dots{} Evaluate @var{body} with the current projection matrix bound to @var{projection} (@pxref{Matrices}). @end deffn @@ -2172,7 +2169,7 @@ shapes, or particles to see GPU buffers in action. Without further ado, the API reference: -@deffn {Procedure} make-buffer @var{data} [#:name "anonymous"] @ +@deffn {Procedure} make-buffer data [#:name "anonymous"] @ [#:length] [#:offset 0] [#:stride 0] [#:target @code{vertex}] @ [#:usage @code{static}] @@ -2213,11 +2210,11 @@ The buffer data will be modified frequently. is never sent to the GPU. @end deffn -@deffn {Procedure} buffer? @var{obj} +@deffn {Procedure} buffer? obj Return @code{#t} if @var{obj} is a GPU buffer. @end deffn -@deffn {Procedure} index-buffer? @var{buffer} +@deffn {Procedure} index-buffer? buffer Return @code{#t} if @var{buffer} is an index buffer. @end deffn @@ -2225,38 +2222,38 @@ Return @code{#t} if @var{buffer} is an index buffer. Represents the absence of a buffer. @end defvar -@deffn {Procedure} buffer-name @var{buffer} +@deffn {Procedure} buffer-name buffer Return the name of @var{buffer}. @end deffn -@deffn {Procedure} buffer-length @var{buffer} +@deffn {Procedure} buffer-length buffer Return the length of @var{buffer}. @end deffn -@deffn {Procedure} buffer-stride @var{buffer} +@deffn {Procedure} buffer-stride buffer Return the amount of space, in bytes, between each element in @var{buffer}. @end deffn -@deffn {Procedure} buffer-target @var{buffer} +@deffn {Procedure} buffer-target buffer Return the the intended usage of @var{buffer}, either @code{vertex} or @code{index}. @end deffn -@deffn {Procedure} buffer-usage @var{buffer} +@deffn {Procedure} buffer-usage buffer Return the intended usage of @var{buffer}, either @code{static} for buffer data that will not change once sent to the GPU, or @code{stream} for buffer data that will be frequently updated from the client-side. @end deffn -@deffn {Procedure} buffer-data @var{buffer} +@deffn {Procedure} buffer-data buffer Return a bytevector containing all the data within @var{buffer}. If @var{buffer} has not been mapped (see @code{with-mapped-buffer}) then this procedure will return @code{#f}. @end deffn -@deffn {Syntax} with-mapped-buffer @var{buffer} @var{body} @dots{} +@deffn {Syntax} with-mapped-buffer buffer body @dots{} Evaluate @var{body} in the context of @var{buffer} having its data synced from GPU memory to RAM. In this context, @code{buffer-data} will return a bytevector of all the data stored in @var{buffer}. When @@ -2268,8 +2265,8 @@ contents dynamically, such as a sprite batch. @end deffn @deffn {Procedure} make-buffer-view #:buffer #:type @ - #:component-type #:length [#:offset 0] [#:divisor] @ - [#:name "anonymous"] + #:component-type #:length [#:offset @code{0}] [#:divisor @code{1}] @ + [#:name @code{"anonymous"}] Return a new buffer view for @var{buffer} starting at byte index @var{offset} of @var{length} elements, where each element is of @@ -2324,35 +2321,35 @@ used for 1 instance. A divisor of 2 means that each element is used for 2 instances, and so on. @end deffn -@deffn {Procedure} buffer-view? @var{obj} +@deffn {Procedure} buffer-view? obj Return @code{#t} if @var{obj} is a buffer view. @end deffn -@deffn {Procedure} buffer-view->buffer @var{buffer-view} +@deffn {Procedure} buffer-view->buffer buffer-view Return the buffer that @var{buffer-view} is using. @end deffn -@deffn {Procedure} buffer-view-name @var{buffer-view} +@deffn {Procedure} buffer-view-name buffer-view Return the name of @var{buffer-view}. @end deffn -@deffn {Procedure} buffer-view-offset @var{buffer-view} +@deffn {Procedure} buffer-view-offset buffer-view Return the byte offset of @var{buffer-view}. @end deffn -@deffn {Procedure} buffer-view-type @var{buffer-view} +@deffn {Procedure} buffer-view-type buffer-view Return the data type of @var{buffer-view}. @end deffn -@deffn {Procedure} buffer-view-component-type @var{buffer-view} +@deffn {Procedure} buffer-view-component-type buffer-view Return the component data type of @var{buffer-view} @end deffn -@deffn {Procedure} buffer-view-divisor @var{buffer-view} +@deffn {Procedure} buffer-view-divisor buffer-view Return the instance divisor for @var{buffer-view}. @end deffn -@deffn {Syntax} with-mapped-buffer-view @var{buffer-view} @var{body} @dots{} +@deffn {Syntax} with-mapped-buffer-view buffer-view body @dots{} Evaluate @var{body} in the context of @var{buffer-view} having its data synced from GPU memory to RAM. See @code{with-mapped-buffer} for @@ -2371,7 +2368,7 @@ buffers containing vertex data: @example `((1 . ,buffer-view-a) (2 . ,buffer-view-b) - ...) + @dots{}) @end example By default, the vertex array is interpreted as containing a series of @@ -2395,20 +2392,20 @@ supported: Represents the absence of a vertex array. @end defvar -@deffn {Procedure} vertex-array? @var{obj} +@deffn {Procedure} vertex-array? obj Return @code{#t} if @var{obj} is a vertex array. @end deffn -@deffn {Procedure} vertex-array-indices @var{vertex-array} +@deffn {Procedure} vertex-array-indices vertex-array Return the buffer view containing index data for @var{vertex-array}. @end deffn -@deffn {Procedure} vertex-array-attributes @var{vertex-array} +@deffn {Procedure} vertex-array-attributes vertex-array Return the attribute index -> buffer view mapping of vertex attribute data for @var{vertex-array}. @end deffn -@deffn {Procedure} vertex-array-mode @var{vertex-array} +@deffn {Procedure} vertex-array-mode vertex-array Return the primitive rendering mode for @var{vertex-array}. @end deffn @@ -2473,7 +2470,7 @@ arguments), and some ``uniforms'' (keyword arguments). @example (define my-shader (load-shader "vert.glsl" "frag.glsl")) -(define vertices (make-vertex-array ...)) +(define vertices (make-vertex-array @dots{})) (gpu-apply my-shader vertices #:color red) @end example @@ -2485,25 +2482,23 @@ about them than we could ever fit into this manual, so we highly recommend searching the web for more information and examples. What we can say, though, is how to use our API: -@deffn {Procedure} strings->shader @var{vertex-source} @var{fragment-source} +@deffn {Procedure} strings->shader vertex-source fragment-source Compile @var{vertex-source}, the GLSL code for the vertex shader, and @var{fragment-source}, the GLSL code for the fragment shader, into a GPU shader program. @end deffn -@deffn {Procedure} load-shader @var{vertex-source-file} @ - @var{fragment-source-file} - +@deffn {Procedure} load-shader vertex-source-file fragment-source-file Compile the GLSL source code within @var{vertex-source-file} and @var{fragment-source-file} into a GPU shader program. @end deffn -@deffn {Procedure} make-shader @var{vertex-port} @var{fragment-port} +@deffn {Procedure} make-shader vertex-port fragment-port Read GLSL source from @var{vertex-port} and @var{fragment-port} and compile them into a GPU shader program. @end deffn -@deffn {Procedure} shader? @var{obj} +@deffn {Procedure} shader? obj Return @code{#t} if @var{obj} is a shader. @end deffn @@ -2511,51 +2506,51 @@ Return @code{#t} if @var{obj} is a shader. Represents the absence shader program. @end defvar -@deffn {Procedure} shader-uniform @var{shader} @var{name} +@deffn {Procedure} shader-uniform shader name Return the metadata for the uniform @var{name} in @var{shader}. @end deffn -@deffn {Procedure} shader-uniforms @var{shader} +@deffn {Procedure} shader-uniforms shader Return a hash table of uniforms for @var{shader}. @end deffn -@deffn {Procedure} shader-attributes @var{shader} +@deffn {Procedure} shader-attributes shader Return a hash table of attributes for @var{shader}. @end deffn -@deffn {Procedure} uniform? @var{obj} +@deffn {Procedure} uniform? obj Return @code{#t} if @var{obj} is a uniform. @end deffn -@deffn {Procedure} uniform-name @var{uniform} +@deffn {Procedure} uniform-name uniform Return the variable name of @var{uniform}. @end deffn -@deffn {Procedure} uniform-type @var{uniform} +@deffn {Procedure} uniform-type uniform Return the data type of @var{uniform}. @end deffn -@deffn {Procedure} uniform-value @var{uniform} +@deffn {Procedure} uniform-value uniform Return the current value of @var{uniform}. @end deffn -@deffn {Procedure} uniform-default-value @var{uniform} +@deffn {Procedure} uniform-default-value uniform Return the default value of @var{uniform}. @end deffn -@deffn {Procedure} attribute? @var{obj} +@deffn {Procedure} attribute? obj Return @code{#t} if @var{obj} is an attribute. @end deffn -@deffn {Procedure} attribute-name @var{attribute} +@deffn {Procedure} attribute-name attribute Return the variable name of @var{attribute}. @end deffn -@deffn {Procedure} attribute-location @var{attribute} +@deffn {Procedure} attribute-location attribute Return the binding location of @var{attribute}. @end deffn -@deffn {Procedure} attribute-type @var{attribute} +@deffn {Procedure} attribute-type attribute Return the data type of @var{attribute}. @end deffn @@ -2635,17 +2630,17 @@ scoped and can be changed using the @code{with-agenda} special form: Return a new task scheduler. @end deffn -@deffn {Procedure} agenda? @var{obj} +@deffn {Procedure} agenda? obj Return @code{#t} if @var{obj} is an agenda. @end deffn @deffn {Procedure} current-agenda -@deffnx {Procedure} current-agenda @var{agenda} +@deffnx {Procedure} current-agenda agenda When called with no arguments, return the current agenda. When called with one argument, set the current agenda to @var{agenda}. @end deffn -@deffn {Syntax} with-agenda @var{agenda} @var{body} @dots{} +@deffn {Syntax} with-agenda agenda body @dots{} Evaluate @var{body} with the current agenda set to @var{agenda}. @end deffn @@ -2653,36 +2648,36 @@ Evaluate @var{body} with the current agenda set to @var{agenda}. Return the current agenda time. @end deffn -@deffn {Procedure} update-agenda @var{dt} +@deffn {Procedure} update-agenda dt Advance the current agenda by @var{dt}. @end deffn -@deffn {Procedure} schedule-at @var{time} @var{thunk} +@deffn {Procedure} schedule-at time thunk Schedule @var{thunk}, a procedure of zero arguments, to be run at @var{time}. @end deffn -@deffn {Procedure} schedule-after @var{delay} @var{thunk} +@deffn {Procedure} schedule-after delay thunk Schedule @var{thunk}, a procedure of zero arguments, to be run after @var{delay}. @end deffn -@deffn {Procedure} schedule-every @var{interval} @var{thunk} [@var{n}] +@deffn {Procedure} schedule-every interval thunk [n] Schedule @var{thunk}, a procedure of zero arguments, to be run every @var{interval} amount of time. Repeat this @var{n} times, or indefinitely if not specified. @end deffn -@deffn {Syntax} at @var{time} @var{body} @dots{} +@deffn {Syntax} at time body @dots{} Schedule @var{body} to be evaluated at @var{time}. @end deffn -@deffn {Syntax} after @var{delay} @var{body} @dots{} +@deffn {Syntax} after delay body @dots{} Schedule @var{body} to be evaluated after @var{delay}. @end deffn -@deffn {Syntax} every @var{interval} @var{body} @dots{} -@deffnx {Syntax} every (@var{interval} @var{n}) @var{body} @dots{} +@deffn {Syntax} every interval body @dots{} +@deffnx {Syntax} every (interval n) body @dots{} Schedule @var{body} to be evaluated every @var{interval} amount of time. Repeat this @var{n} times, or indefinitely if not specified. @end deffn @@ -2734,45 +2729,45 @@ script is returned that can be used to cancel it when desired. (cancel-script script) @end example -@deffn {Procedure} spawn-script @var{thunk} +@deffn {Procedure} spawn-script thunk Apply @var{thunk} as a script and return a handle to it. @end deffn -@deffn {Syntax} script @var{body} @dots{} +@deffn {Syntax} script body @dots{} Evaluate @var{body} as a script and return a handle to it. @end deffn -@deffn {Procedure} script? @var{obj} +@deffn {Procedure} script? obj Return @code{#t} if @var{obj} is a script handle. @end deffn -@deffn {Procedure} script-cancelled? @var{obj} +@deffn {Procedure} script-cancelled? obj Return @code{#t} if @var{obj} has been cancelled. @end deffn -@deffn {Procedure} script-running? @var{obj} +@deffn {Procedure} script-running? obj Return @code{#t} if @var{obj} has not yet terminated or been cancelled. @end deffn -@deffn {Procedure} script-complete? @var{obj} +@deffn {Procedure} script-complete? obj Return @code{#t} if @var{obj} has terminated. @end deffn -@deffn {Procedure} cancel-script @var{co} +@deffn {Procedure} cancel-script co Prevent further execution of the script @var{co}. @end deffn -@deffn {Procedure} yield @var{handler} +@deffn {Procedure} yield handler Suspend the current script and pass its continuation to the procedure @var{handler}. @end deffn -@deffn {Procedure} sleep @var{duration} +@deffn {Procedure} sleep duration Wait @var{duration} before resuming the current script. @end deffn -@deffn {Syntax} forever @var{body} @dots{} +@deffn {Syntax} forever body @dots{} Evaluate @var{body} in an endless loop. @end deffn @@ -2791,7 +2786,9 @@ procedure can be used within any script like so: (tween 60 0 100 (lambda (y) (set! x y)))) @end example -@deffn {Procedure} tween @var{duration} @var{start} @var{end} @var{proc} [#:step 1 #:ease @code{smoothstep} #:interpolate @code{lerp}] +@deffn {Procedure} tween duration start end proc @ + [#:step @code{1}] [#:ease @code{smoothstep}] @ + #:interpolate @code{lerp}] Transition a value from @var{start} to @var{end} over @var{duration}, sending each succesive value to @var{proc}. @var{step} controls the amount of time between each update of the animation. @@ -2835,16 +2832,16 @@ Here's a simplistic example: Return a new channel @end deffn -@deffn {Procedure} channel? @var{obj} +@deffn {Procedure} channel? obj Return @code{#t} if @var{obj} is a channel. @end deffn -@deffn {Procedure} channel-get @var{channel} +@deffn {Procedure} channel-get channel Retrieve a value from @var{channel}. The current script suspends until a value is available. @end deffn -@deffn {Procedure} channel-put @var{channel} @var{data} +@deffn {Procedure} channel-put channel data Send @var{data} to @var{channel}. The current script suspends until another script is available to retrieve the value. @end deffn @@ -2852,12 +2849,12 @@ another script is available to retrieve the value. A low-level API also exists for using channels outside of a script via callback procedures: -@deffn {Procedure} channel-get! @var{channel} @var{proc} +@deffn {Procedure} channel-get! channel proc Asynchronously retrieve a value from @var{channel} and call @var{proc} with that value. @end deffn -@deffn {Procedure} channel-put! @var{channel} @var{data} [@var{thunk}] +@deffn {Procedure} channel-put! channel data [thunk] Asynchronously send @var{data} to @var{channel} and call @var{thunk} after it has been received. @end deffn |