From 0e699be281c8dea53e589e08a5831837e0eae7ea Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 7 Oct 2021 20:17:50 -0400 Subject: Updates for Chickadee 0.8.0 and Guile-SDL2 0.7.0. --- manuals/chickadee/3D-Models.html | 157 ------- manuals/chickadee/9_002dPatches.html | 131 ------ manuals/chickadee/API-Reference.html | 14 +- manuals/chickadee/Agendas.html | 4 +- manuals/chickadee/Array-Lists.html | 179 +++++++ manuals/chickadee/Audio-Files.html | 4 +- manuals/chickadee/Audio.html | 16 +- manuals/chickadee/Basics.html | 6 +- manuals/chickadee/Bezier-Curves.html | 10 +- manuals/chickadee/Blending.html | 204 -------- manuals/chickadee/Buffers.html | 122 +++-- manuals/chickadee/Channels.html | 11 +- manuals/chickadee/Colors.html | 6 +- manuals/chickadee/Command-Line-Interface.html | 104 +++++ manuals/chickadee/Copying-This-Manual.html | 4 +- manuals/chickadee/Data-Structures.html | 109 +++++ manuals/chickadee/Easings.html | 4 +- manuals/chickadee/Fonts.html | 10 +- manuals/chickadee/Framebuffers.html | 18 +- .../chickadee/GNU-Free-Documentation-License.html | 2 +- manuals/chickadee/Getting-Started.html | 177 +++++++ manuals/chickadee/Graphics.html | 34 +- manuals/chickadee/Grid.html | 214 --------- manuals/chickadee/Grids.html | 214 +++++++++ manuals/chickadee/Heaps.html | 139 ++++++ manuals/chickadee/Index.html | 295 +++++++++--- manuals/chickadee/Input-Devices.html | 4 +- manuals/chickadee/Installation.html | 4 +- manuals/chickadee/Invoking-chickadee-bundle.html | 219 +++++++++ manuals/chickadee/Invoking-chickadee-play.html | 198 ++++++++ manuals/chickadee/Kernel.html | 6 +- manuals/chickadee/Lights.html | 212 +++++++++ manuals/chickadee/Live-Coding.html | 24 +- manuals/chickadee/Math.html | 10 +- manuals/chickadee/Matrices.html | 19 +- manuals/chickadee/Meshes.html | 413 +++++++++++++++++ manuals/chickadee/Models.html | 167 +++++++ manuals/chickadee/Particles.html | 8 +- manuals/chickadee/Path-Finding.html | 16 +- manuals/chickadee/Quadtrees.html | 222 +++++++++ manuals/chickadee/Quaternions.html | 4 +- manuals/chickadee/Queues.html | 133 ++++++ manuals/chickadee/Rectangles.html | 4 +- manuals/chickadee/Render-Settings.html | 512 +++++++++++++++++++++ manuals/chickadee/Rendering-Engine.html | 140 +++--- manuals/chickadee/Requirements.html | 16 +- manuals/chickadee/Scripting.html | 6 +- manuals/chickadee/Scripts.html | 4 +- manuals/chickadee/Shaders.html | 79 ++-- manuals/chickadee/Skyboxes.html | 119 +++++ manuals/chickadee/Sources.html | 4 +- manuals/chickadee/Sprites.html | 64 ++- manuals/chickadee/Textures.html | 83 +++- manuals/chickadee/The-Environment.html | 4 +- manuals/chickadee/The-Game-Loop.html | 23 +- manuals/chickadee/The-Listener.html | 4 +- manuals/chickadee/Tile-Maps.html | 14 +- manuals/chickadee/Tweening.html | 4 +- manuals/chickadee/Vector-Paths.html | 165 ++++++- manuals/chickadee/Vectors.html | 19 +- manuals/chickadee/Viewports.html | 18 +- manuals/chickadee/Window-Manipulation.html | 9 +- manuals/chickadee/index.html | 158 ++++--- 63 files changed, 4110 insertions(+), 1186 deletions(-) delete mode 100644 manuals/chickadee/3D-Models.html delete mode 100644 manuals/chickadee/9_002dPatches.html create mode 100644 manuals/chickadee/Array-Lists.html delete mode 100644 manuals/chickadee/Blending.html create mode 100644 manuals/chickadee/Command-Line-Interface.html create mode 100644 manuals/chickadee/Data-Structures.html create mode 100644 manuals/chickadee/Getting-Started.html delete mode 100644 manuals/chickadee/Grid.html create mode 100644 manuals/chickadee/Grids.html create mode 100644 manuals/chickadee/Heaps.html create mode 100644 manuals/chickadee/Invoking-chickadee-bundle.html create mode 100644 manuals/chickadee/Invoking-chickadee-play.html create mode 100644 manuals/chickadee/Lights.html create mode 100644 manuals/chickadee/Meshes.html create mode 100644 manuals/chickadee/Models.html create mode 100644 manuals/chickadee/Quadtrees.html create mode 100644 manuals/chickadee/Queues.html create mode 100644 manuals/chickadee/Render-Settings.html create mode 100644 manuals/chickadee/Skyboxes.html (limited to 'manuals/chickadee') diff --git a/manuals/chickadee/3D-Models.html b/manuals/chickadee/3D-Models.html deleted file mode 100644 index 6d0f7c7..0000000 --- a/manuals/chickadee/3D-Models.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - -3D Models (The Chickadee Game Toolkit) - - - - - - - - - - - - - - - - - - - -
-

-Next: , Previous: , Up: Graphics   [Contents][Index]

-
-
-

2.3.9 3D Models

- -

Disclaimer: Chickadee is alpha software, but 3D model support is -even more alpha than that. There are many missing features in both -the model loading and rendering components, so set your expectations -accordingly! -

-

Chickadee can load and render 3D models in the classic OBJ and more -modern glTF 2.0 formats. -

-

Here’s some basic boilerplate to render a 3D model: -

-
-
(use-modules (chickadee)
-             (chickadee math)
-             (chickadee math matrix)
-             (chickadee graphics model))
-
-(define model #f)
-(define projection-matrix
-  (perspective-projection (/ pi 3.0) (/ 4.0 3.0) 0.1 500.0))
-;; Adjust these 2 matrices so that you can actually see the model.
-(define view-matrix (make-identity-matrix4))
-(define model-matrix (make-identity-matrix4))
-
-(define (load)
-  (set! model (load-obj "model.obj"))
-
-(define (draw alpha)
-  (with-projection projection-matrix
-    (with-depth-test #t
-      (draw-model model model-matrix view-matrix))))
-
-(run-game #:load load #:draw draw)
-
- -
-
Procedure: load-obj file-name
-

Load the OBJ formatted model in file-name and return a 3D model -object. -

-

OBJ models are rendered using a Phong lighting model, which is a -work-in-progress. -

- -
-
Procedure: load-gltf file-name
-

Load the glTF 2.0 formatted model in file-name and return a 3D -model object. -

-

glTF models are rendered using a physically based lighting model, -which is currently a stub to be implemented later. -

- -
-
Procedure: model? obj
-

Return #t if obj is a 3D model. -

- -
-
Procedure: draw-model model model-matrix view-matrix
-

Render model with the transformation matrices model-matrix -and view-matrix applied. -

- - - - - - diff --git a/manuals/chickadee/9_002dPatches.html b/manuals/chickadee/9_002dPatches.html deleted file mode 100644 index 0f6dd96..0000000 --- a/manuals/chickadee/9_002dPatches.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - -9-Patches (The Chickadee Game Toolkit) - - - - - - - - - - - - - - - - - - - -
-

-Next: , Previous: , Up: Graphics   [Contents][Index]

-
-
-

2.3.4 9-Patches

- -

A 9-patch is a method of rendering a texture so that it can be -stretched to cover an area of any size without becoming distorted. -This is achieved by dividing up the sprite into nine regions: -

- - -

The most common application of this technique is for graphical user -interface widgets like buttons and dialog boxes which are often -dynamically resizable. By using a 9-patch, they can be rendered at -any size without scaling artifacts. -

-
-
Procedure: draw-9-patch texture rect [#:margin 0] [#:top-margin margin] [#:bottom-margin margin] [#:left-margin margin] [#:right-margin margin] [#:mode stretch] [#:origin] [#:scale] [#:rotation] [#:blend-mode] [#:tint white]
-
-

Draw a 9-patch over the area rect using texture whose -stretchable/tileable patches are defined by the given margin -measurements. The corners are never stretched/tiled, the left and -right edges will be stretched/tiled vertically, the top and bottom -edges may be stretched/tiled horizontally, and the center may be -stretched/tiled in both directions. -

-

mode may be either stretch (the default) or tile. -

-

margin specifies the margin size for all sides of the 9-patch. -To make margins of differing sizes, the top-margin, -bottom-margin, left-margin, and right-margin -arguments may be used. -

-

Refer to draw-sprite (see Sprites) for information about -the other arguments as they are the same. -

- - - - - - diff --git a/manuals/chickadee/API-Reference.html b/manuals/chickadee/API-Reference.html index 681a169..7ccd8b2 100644 --- a/manuals/chickadee/API-Reference.html +++ b/manuals/chickadee/API-Reference.html @@ -1,6 +1,6 @@ - + + + +Array Lists (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Up: Data Structures   [Contents][Index]

+
+
+

5.6.1 Array Lists

+ +

The (chickadee data array-list) module provides an array/vector +that dynamically expands to hold all of the data that is added to it. +It is named after the ArrayList class in Java. +

+

In addition to being used as a dynamic vector, it can also be used as +a stack via the array-list-push! and array-list-pop! +procedures. +

+
+
Procedure: make-array-list [initial-capacity]
+

Return a new empty array list with an initial capacity of +initial-capacity, or 32 by default. +

+ +
+
Procedure: array-list items ...
+

Return a new array list with items in it. +

+ +
+
Procedure: array-list? obj
+

Return #t if obj is an array list. +

+ +
+
Procedure: array-list-empty? array-list
+

Return #t if array-list is empty. +

+ +
+
Procedure: array-list-size array-list
+

Return the current size of array-list. +

+ +
+
Procedure: array-list-ref array-list i
+

Return the item in array-list at index i. +

+ +
+
Procedure: array-list-set! array-list i value
+

Set the value in array-list at index i to value. +

+ +
+
Procedure: array-list-push! array-list item
+

Append item to array-list. +

+ +
+
Procedure: array-list-pop! array-list
+

Remove and return the last object in array-list. +

+ +
+
Procedure: array-list-delete! array-list item [#:equal? equal?] [#:fast? #f]
+

Delete item from array-list. Use equal? as the +equivalence predicate, which defaults to Guile’s equal? +procedure. By default, deletion preserves the order of the array, but +takes linear time in the worst case. If fast? is #t then +item will deleted in constant time, but order is not preserved. +

+ +
+
Procedure: array-list-clear! array-list
+

Remove all items from array-list. +

+ +
+
Procedure: array-list-for-each proc array-list
+

Apply PROC with each item in array-list. +

+ +
+
Procedure: array-list-fold proc init array-list
+

Apply proc to all items in array-list to build a result and +return that result. init is the initial result. If there are +no objects in the vicinity of rect, just init is returned. +

+ +
+
+

+Next: , Up: Data Structures   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Audio-Files.html b/manuals/chickadee/Audio-Files.html index adaa772..f120772 100644 --- a/manuals/chickadee/Audio-Files.html +++ b/manuals/chickadee/Audio-Files.html @@ -1,6 +1,6 @@ - - - - -Blending (The Chickadee Game Toolkit) - - - - - - - - - - - - - - - - - - - -
-

-Next: , Previous: , Up: Graphics   [Contents][Index]

-
-
-

2.3.10 Blending

- -

Rendering a scene often involves drawing layers of objects that -overlap each other. Blending determines how two overlapping pixels -are combined in the final image that is rendered to the screen. -

-

Chickadee provides the following blend modes: -

-
-
Variable: blend:alpha
-

Blend pixels according to the values of their alpha channels. This is -the most commonly used blend mode. -

- -
-
Variable: blend:replace
-

Overwrite the output pixel color with the color being drawn. -

- -
-
Variable: blend:add
-

Add all pixel color values together. The more colors blended -together, the more white the final color becomes. -

- -
-
Variable: blend:subtract
-

Subtract all pixel color values. The more colors blended together, -the more black the final color becomes. -

- -
-
Variable: blend:multiply
-
- -
-
Variable: blend:darken
-
- -
-
Variable: blend:lighten
-
- -
-
Variable: blend:screen
-
- -

Custom blend modes can be created using the make-blend-mode procedure: -

-
-
Procedure: make-blend-mode equation source-function destination-function
-

Return a new custom blend mode that applies source-function to -the source color, destination-function to the destination color, -and finally applies equation to the transformed -source/destination color values. These arguments are not -procedures, but symbolic representations of the functions that OpenGL -supports. -

-

Valid values for equation are: -

-
    -
  • add -
  • subtract -
  • reverse-subtract -
  • min -
  • max -
  • alpha-min -
  • alpha-max -
- -

Valid values for source-function are: -

-
    -
  • zero -
  • one -
  • destination-color -
  • one-minus-destination-color -
  • source-alpha-saturate -
  • source-alpha -
  • one-minus-source-alpha -
  • destination-alpha -
  • one-minus-destination-alpha -
  • constant-color -
  • one-minus-constant-color -
  • constant-alpha -
  • one-minus-constant-alpha -
- -

Valid values for destination-function are: -

-
    -
  • zero -
  • one -
  • source-color -
  • one-minus-source-color -
  • source-alpha -
  • one-minus-source-alpha -
  • destination-alpha -
  • one-minus-destination-alpha -
  • constant-color -
  • one-minus-constant-color -
  • constant-alpha -
  • one-minus-constant-alpha -
- -
- -
-
-

-Next: , Previous: , Up: Graphics   [Contents][Index]

-
- - - - - diff --git a/manuals/chickadee/Buffers.html b/manuals/chickadee/Buffers.html index 06b156a..ffb4714 100644 --- a/manuals/chickadee/Buffers.html +++ b/manuals/chickadee/Buffers.html @@ -1,6 +1,6 @@ - + + + +Command Line Interface (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+
+

3 Command Line Interface

+ +

While Chickadee is a library at heart, it also comes with a command +line utility to make it easier to get started. +

+ + + + + + + + + + diff --git a/manuals/chickadee/Copying-This-Manual.html b/manuals/chickadee/Copying-This-Manual.html index 30e570e..4738441 100644 --- a/manuals/chickadee/Copying-This-Manual.html +++ b/manuals/chickadee/Copying-This-Manual.html @@ -1,6 +1,6 @@ - + + + +Data Structures (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Previous: , Up: API Reference   [Contents][Index]

+
+
+

5.6 Data Structures

+ + + + + + + + + + + + + + + diff --git a/manuals/chickadee/Easings.html b/manuals/chickadee/Easings.html index 0e79a7e..6169f14 100644 --- a/manuals/chickadee/Easings.html +++ b/manuals/chickadee/Easings.html @@ -1,6 +1,6 @@ - + + + +Getting Started (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+
+

2 Getting Started

+ +

One of the simplest programs we can make with Chickadee is rendering +the text “Hello, world” on screen. Here’s what that looks like: +

+
+
(define (draw alpha)
+  (draw-text "Hello, world!" (vec2 64.0 240.0)))
+
+ +

The draw procedure is called frequently to draw the game scene. +For the sake of simplicity, we will ignore the alpha variable +in this tutorial. +

+

To run this program, we’ll use the chickadee play command: +

+
+
chickadee play hello.scm
+
+ +

This is a good start, but it’s boring. Let’s make the text move! +

+
+
(define position (vec2 0.0 240.0))
+
+(define (draw alpha)
+  (draw-text "Hello, world!" position))
+
+(define (update dt)
+  (set-vec2-x! position (+ (vec2-x position) (* 100.0 dt))))
+
+ +

The vec2 type is used to store 2D coordinates +(see Vectors.) A variable named position contains the +position where the text should be rendered. A new hook called +update has been added to handle the animation. This hook is +called frequently to update the state of the game. The variable +dt (short for “delta-time”) contains the amount of time that +has passed since the last update, in seconds. Putting it all +together, this update procedure is incrementing the x coordinate of +the position by 100 pixels per second. +

+

This is neat, but after a few seconds the text moves off the screen +completely, never to be seen again. It would be better if the text +bounced back and forth against the sides of the window. +

+
+
(define position (vec2 0.0 240.0))
+
+(define (draw alpha)
+  (draw-text "Hello, world!" position))
+
+(define (update dt)
+  (update-agenda dt))
+
+(define (update-x x)
+  (set-vec2-x! position x))
+
+(let ((start 0.0)
+      (end 536.0)
+      (duration 4.0))
+  (script
+   (while #t
+    (tween duration start end update-x)
+    (tween duration end start update-x))))
+
+ +

This final example uses Chickadee’s scripting features +(see Scripting) to bounce the text between the edges of the window +indefinitely using the handy tween procedure. The only thing +the update procedure needs to do now is advance the clock of +the “agenda” (the thing that runs scripts.) The script takes care +of the rest. +

+

This quick tutorial has hopefully given you a taste of what you can do +with Chickadee. The rest of this manual gets into all of the details +that were glossed over, and much more. Try rendering a sprite, +playing a sound effect, or handling keyboard input. But most +importantly: Have fun! +

+
+
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Graphics.html b/manuals/chickadee/Graphics.html index 60ba1f8..31a2c83 100644 --- a/manuals/chickadee/Graphics.html +++ b/manuals/chickadee/Graphics.html @@ -1,6 +1,6 @@ - - - - -Grid (The Chickadee Game Toolkit) - - - - - - - - - - - - - - - - - - - -
-

-Previous: , Up: Math   [Contents][Index]

-
-
-

2.2.9 Grid

- -

The (chickadee math grid) module provides a simple spatial -partitioning system for axis-aligned bounding boxes -(see Rectangles) in 2D space. The grid divides the world into -tiles and keeps track of which rectangles occupy which tiles. When -there are lots of moving objects in the game world that need collision -detection, the grid greatly speeds up the process. Instead of -checking collisions of each object against every other object (an -O(n^2) operation), the grid quickly narrows down which objects could -possibly be colliding and only performs collision testing against a -small set of objects. -

-

In addition to checking for collisions, the grid also handles the -resolution of collisions. Exactly how each collision is resolved is -user-defined. A player bumping into a wall may slide against it. An -enemy colliding with a projectile shot by the player may get pushed -back in the opposite direction. Two players colliding may not need -resolution at all and will just pass through each other. The way this -works is that each time an object (A) is moved within the grid, the -grid looks for an object (B) that may possibly be colliding with A. A -user-defined procedure known as a “filter” is then called with both -A and B. If the filter returns #f, it means that even if A and -B are colliding, no collision resolution is needed. In this case the -grid won’t waste time checking if they really do collide because it -doesn’t matter. If A and B are collidable, then the filter returns a -procedure that implements the resolution technique. The grid will -then perform a collision test. If A and B are colliding, the resolver -procedure is called. It’s the resolvers job to adjust the objects -such that they are no longer colliding. The grid module comes with a -very simple resolution procedure, slide, that adjusts object A -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. -

-
-
Procedure: make-grid [cell-size 64]
-

Return a new grid partitioned into cell-size tiles. -

- -
-
Procedure: grid? obj
-

Return #t if obj is a grid. -

- -
-
Procedure: cell? obj
-

Return #t if obj is a grid cell. -

- -
-
Procedure: cell-count cell
-

Return the number of items in cell. -

- -
-
Procedure: grid-cell-size grid
-

Return the cell size of grid. -

- -
-
Procedure: grid-cell-count grid
-

Return the number of cells currently in grid. -

- -
-
Procedure: grid-item-count grid
-

Return the number of items in grid. -

- -
-
Procedure: grid-add grid item x y width height
-
-

Add item to grid represented by the axis-aligned bounding -box whose lower-left corner is at (x, y) and is -width x height in size. -

- -
-
Procedure: grid-remove grid item
-

Return item from grid. -

- -
-
Procedure: grid-clear grid
-

Remove all items from grid. -

- -
-
Procedure: grid-move grid item position filter
-

Attempt to move item in grid to position (a 2D -vector) and check for collisions. For each collision, filter -will be called with two arguments: item and the item it collided -with. If a collision occurs, position may be modified to -resolve the colliding objects. -

- -
-
Procedure: for-each-cell proc grid [rect]
-

Call proc with each cell in grid that intersects -rect, or every cell if rect is #f. -

- -
-
Procedure: for-each-item proc grid
-

Call proc for each item in grid. -

- -
-
Procedure: slide item item-rect other other-rect goal
-
-

Resolve the collision that occurs between item and other -when moving item-rect to goal by sliding item-rect -the minimum amount needed to make it no longer overlap -other-rect. -

- -
-
-

-Previous: , Up: Math   [Contents][Index]

-
- - - - - diff --git a/manuals/chickadee/Grids.html b/manuals/chickadee/Grids.html new file mode 100644 index 0000000..ef364be --- /dev/null +++ b/manuals/chickadee/Grids.html @@ -0,0 +1,214 @@ + + + + + + +Grids (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Data Structures   [Contents][Index]

+
+
+

5.6.5 Grids

+ +

The (chickadee data grid) module provides a simple spatial +partitioning system for axis-aligned bounding boxes +(see Rectangles) in 2D space. The grid divides the world into +tiles and keeps track of which rectangles occupy which tiles. When +there are lots of moving objects in the game world that need collision +detection, the grid greatly speeds up the process. Instead of +checking collisions of each object against every other object (an +O(n^2) operation), the grid quickly narrows down which objects could +possibly be colliding and only performs collision testing against a +small set of objects. +

+

In addition to checking for collisions, the grid also handles the +resolution of collisions. Exactly how each collision is resolved is +user-defined. A player bumping into a wall may slide against it. An +enemy colliding with a projectile shot by the player may get pushed +back in the opposite direction. Two players colliding may not need +resolution at all and will just pass through each other. The way this +works is that each time an object (A) is moved within the grid, the +grid looks for an object (B) that may possibly be colliding with A. A +user-defined procedure known as a “filter” is then called with both +A and B. If the filter returns #f, it means that even if A and +B are colliding, no collision resolution is needed. In this case the +grid won’t waste time checking if they really do collide because it +doesn’t matter. If A and B are collidable, then the filter returns a +procedure that implements the resolution technique. The grid will +then perform a collision test. If A and B are colliding, the resolver +procedure is called. It’s the resolvers job to adjust the objects +such that they are no longer colliding. The grid module comes with a +very simple resolution procedure, slide, that adjusts object A +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. +

+
+
Procedure: make-grid [cell-size 64]
+

Return a new grid partitioned into cell-size tiles. +

+ +
+
Procedure: grid? obj
+

Return #t if obj is a grid. +

+ +
+
Procedure: cell? obj
+

Return #t if obj is a grid cell. +

+ +
+
Procedure: cell-count cell
+

Return the number of items in cell. +

+ +
+
Procedure: grid-cell-size grid
+

Return the cell size of grid. +

+ +
+
Procedure: grid-cell-count grid
+

Return the number of cells currently in grid. +

+ +
+
Procedure: grid-item-count grid
+

Return the number of items in grid. +

+ +
+
Procedure: grid-add grid item x y width height
+
+

Add item to grid represented by the axis-aligned bounding +box whose lower-left corner is at (x, y) and is +width x height in size. +

+ +
+
Procedure: grid-remove grid item
+

Return item from grid. +

+ +
+
Procedure: grid-clear grid
+

Remove all items from grid. +

+ +
+
Procedure: grid-move grid item position filter
+

Attempt to move item in grid to position (a 2D +vector) and check for collisions. For each collision, filter +will be called with two arguments: item and the item it collided +with. If a collision occurs, position may be modified to +resolve the colliding objects. +

+ +
+
Procedure: for-each-cell proc grid [rect]
+

Call proc with each cell in grid that intersects +rect, or every cell if rect is #f. +

+ +
+
Procedure: for-each-item proc grid
+

Call proc for each item in grid. +

+ +
+
Procedure: slide item item-rect other other-rect goal
+
+

Resolve the collision that occurs between item and other +when moving item-rect to goal by sliding item-rect +the minimum amount needed to make it no longer overlap +other-rect. +

+ +
+
+

+Next: , Previous: , Up: Data Structures   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Heaps.html b/manuals/chickadee/Heaps.html new file mode 100644 index 0000000..8aea793 --- /dev/null +++ b/manuals/chickadee/Heaps.html @@ -0,0 +1,139 @@ + + + + + + +Heaps (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Data Structures   [Contents][Index]

+
+
+

5.6.3 Heaps

+ +

The (chickadee data heap) module provides a binary heap data +structure. The heap orders data from smallest to largest, according +to a custom comparison predicate, making it a good choice for priority +queues. +

+
+
Procedure: make-heap [#:< <]
+

Return a new heap that uses the predicate < to determine order. +

+ +
+
Procedure: heap? obj
+

Return #t if obj is a heap. +

+ +
+
Procedure: heap-empty? heap
+

Return #t if heap is empty. +

+ +
+
Procedure: heap-size heap
+

Return the current size of heap. +

+ +
+
Procedure: heap-min heap
+

Return the minimum item in heap. +

+ +
+
Procedure: heap-insert! heap item
+

Add item to heap. +

+ +
+
Procedure: heap-remove! heap
+

Remove the minimum item in heap. +

+ +
+
Procedure: heap-clear! heap
+

Remove all items from heap. +

+ + + + + + diff --git a/manuals/chickadee/Index.html b/manuals/chickadee/Index.html index e9ea924..99a7806 100644 --- a/manuals/chickadee/Index.html +++ b/manuals/chickadee/Index.html @@ -1,6 +1,6 @@ - + + + +Invoking chickadee bundle (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Previous: , Up: Command Line Interface   [Contents][Index]

+
+
+

3.2 Invoking chickadee bundle

+ +

Distributing games is difficult. While Chickadee games are free +software, it would be far too burdensome on the player to ask them to +compile a game from source in order to try it out. Many potential +players will simply not even try. Players expect to be able to +download a compressed archive, extract it, and play. If there are any +more steps than that then the chances of the game being played drop +dramatically. If you can’t beat ’em, join ’em. The +chickadee bundle tool creates redistributable binary bundles +by combining the game code and assets with shared libraries and +executables from the host operating system. +

+

Bundling is currently only supported on Linux. In the future, it may +be possible to bundle on MacOS. Patches very much welcome for that. +

+

It should be noted that bundling is a problematic way to distribute +software. All of the libraries that the bundled application includes +are separated from the distribution that was so carefully making sure +that they stay up-to-date with regard to security patches. The +bundled libraries are frozen in time, vulnerabilities and all. +Unfortunately, the release model used by the most popular +distributions, while wonderful for stable, mature software, does not +fit the needs of game distribution at all. So, we compromise, knowing +that most games are only played for only a short amount of time before +being disposed. Perhaps, in time, the Linux world will shift to using +more robust package management solutions such as +GNU Guix which support long-term +maintenance of stable software as well as the “fire and forget” +nature of game releases. And maybe a game made with Chickadee will +become so popular that major distributions decide to package it, but +let’s get back to reality. +

+

To get started with bundling, simply add a bundle.scm file to +the root of the project directory. It could look something like this: +

+
+
'((asset-directories . ("images" "models"))
+  (bundle-name . "the-legend-of-emacs-1.0")
+  (code . "the-legend-of-emacs.scm")
+  (launcher-name . "the-legend-of-emacs"))
+
+ +

To create the bundle, simply run chickadee bundle. Upon +success, the file the-legend-of-emacs-1.0.tar.gz would be +created in the current directory. +

+

To maximize the chances that the bundle will work on someone else’s +computer, it’s best to build on the oldest supported Linux +distribution available. As of this writing, Ubuntu 18.04 LTS is a +good choice. +

+

In addition to including system libraries and executables, +chickadee bundle also includes the compiled Guile bytecode +(the .go files) for all modules used by the game. The module +source files are not included, so it’s critical that all of the +modules used by the game have been compiled. +

+

Available options: +

+ + +

Default configuration options, such as the list of C shared libaries, +can be found in the %default-config variable. This way they +can be programatically modified, if necessary. +

+
+
Variable: %default-config
+

An association list of default configuration options. +

+ +
+
+

+Previous: , Up: Command Line Interface   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Invoking-chickadee-play.html b/manuals/chickadee/Invoking-chickadee-play.html new file mode 100644 index 0000000..0c9c065 --- /dev/null +++ b/manuals/chickadee/Invoking-chickadee-play.html @@ -0,0 +1,198 @@ + + + + + + +Invoking chickadee play (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Up: Command Line Interface   [Contents][Index]

+
+
+

3.1 Invoking chickadee play

+ +

The chickadee play command is used to open a window and run +the Chickadee game contained within a Scheme source file. +

+
+
chickadee play the-legend-of-emacs.scm
+
+ +

In this file, special procedures may be defined to handle various +events from the game loop: +

+ + +

See The Game Loop for complete information on all of these +hooks, such as the arguments that each procedure receives. +

+

In additional to evaluating the specified source file, the directory +containing that file is added to Guile’s load path so that games can +easily be divided into many different files. Furthermore, that +directory is entered prior to evaluating the file so that data files +(images, sounds, etc.) can be loaded relative to the main source file, +regardless of what the current directory was when chickadee +play was invoked. +

+

Many aspects of the initial game window and environment can be +controlled via the following options: +

+
+
--title=title
+
-t title
+
+

Set the window title to title. +

+
+
--width=width
+
-w width
+
+

Set the window width to width pixels. +

+
+
--height=height
+
-h height
+
+

Set the window height to height pixels. +

+
+
--fullscreen
+
-f
+
+

Open window in fullscreen mode. +

+
+
--resizable
+
-r
+
+

Make window resizable. +

+
+
--update-hz=n
+
-u n
+
+

Update the game n times per second. +

+
+
--repl
+
+

Launch a REPL in the terminal. This will allow the game environment +to debugged and modified without having to stop and restart the game +after each change. +

+
+
--repl-server[=port]
+
+

Launch a REPL server on port port, or 37146 by default. +

+

telnet localhost 37146 (or whatever port number was given) +will do the trick, but using the Geiser extension for Emacs is by far the best way to develop at the +REPL with Guile. Use M-x connect-to-guile to connect to the +REPL server. +

+
+
+ +
+
+

+Next: , Up: Command Line Interface   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Kernel.html b/manuals/chickadee/Kernel.html index 7c17f80..64647aa 100644 --- a/manuals/chickadee/Kernel.html +++ b/manuals/chickadee/Kernel.html @@ -1,6 +1,6 @@ - + + + +Lights (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+
+

5.3.9 Lights

+ +

The (chickadee graphics light) module provides a data type for +dynamic lights that can be used to light 3D objects (such as +Models or Meshes.) +

+

There are 3 types of dynamic lights: +

+ + +
+
Procedure: make-point-light [#:position (vec3 0 0 0)] [#:color black] [#:intensity 1]
+
+

Return a new point light located at position that emits +color light. +

+ +
+
Procedure: make-directional-light [#:direction (vec3 0 -1 0)] [#:color black] [#:intensity 1]
+
+

Return a new directional light that emits color light in +direction. +

+ +
+
Procedure: make-spot-light [#:position (vec3 0 0 0)] [#:direction (vec3 0 -1 0)] [#:color black] [#:cut-off π/4] [#:intensity 1]
+
+

Return a new spot light located at position that emits +color light in direction in a cone that cuts off at +cut-off radians. +

+ +
+
Procedure: point-light? obj
+

Return #t if obj is a point light. +

+ +
+
Procedure: directional-light? obj
+

Return #t if obj is a directional light. +

+ +
+
Procedure: spot-light? obj
+

Return #t if obj is a spot light. +

+ +
+
Procedure: light-type light
+

Return the type of light, one of: +

+
    +
  • point +
  • directional +
  • spot +
+ +
+ +
+
Procedure: light-color light
+

Return the color of light. +

+ +
+
Procedure: light-intensity light
+

Return the intensity of light. +

+ +
+
Procedure: light-position light
+

Return the position of light. The value is irrelevant for +directional lights. +

+ +
+
Procedure: light-direction light
+

Return the direction of light. The value is irrelevant for +point lights. +

+ +
+
Procedure: light-cut-off light
+

Return the cosine of the cut off angle of light. The value is +only relevant for spot lights. +

+ +
+
Procedure: set-light-color! light color
+

Set the color of light to color. +

+ +
+
Procedure: set-light-position! light position
+

Set the position of light to position. +

+ +
+
Procedure: set-light-direction! light direction
+

Set the direction of light to direction. +

+ +
+
Procedure: set-light-cut-off! light cut-off
+

Set the cut off angle of light to cut-off. +

+ +
+
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Live-Coding.html b/manuals/chickadee/Live-Coding.html index 74a927c..4e3c174 100644 --- a/manuals/chickadee/Live-Coding.html +++ b/manuals/chickadee/Live-Coding.html @@ -1,6 +1,6 @@ - + + + +Meshes (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+
+

5.3.11 Meshes

+ +

The (chickadee graphics mesh) modules provides procedures for +programmatically creating 3D objects (to load 3D models from a file on +disk, see Meshes.) +

+

5.3.11.1 Materials

+ +

Before we talk about meshes themselves, let’s discuss “materials.” +Materials control the appearance of 3D objects. Whether an object +appears like a rough rock, a smooth and shiny metal, etc. depends on +the material that is applied to it. Different types of materials use +different lighting models. Chickadee supports two lighting models: +The classic Blinn-Phong model and a more modern physically based +rendering (PBR) model. +

+

All materials share some common data: +

+
+
Procedure: material? obj
+

Return #t if obj is a material. +

+ +
+
Procedure: material-name material
+

Return the name of material. +

+ +
+
Procedure: material-shader material
+

Return the shader of material. +

+ +
+
Procedure: material-blend-mode material
+

Return the blend mode of material. +

+ +
+
Procedure: material-polygon-mode material
+

Return the polygon mode of material. +

+ +
+
Procedure: material-cull-face-mode material
+

Return the cull face mode of material. +

+ +
+
Procedure: material-depth-test material
+

Return the depth test of material. +

+ +
+
Procedure: material-stencil-test material
+

Return the stencil test of material. +

+ +
+
Procedure: material-multisample? material
+

Return #t if material uses multisampling. +

+ +

Materials support 5 textures. What each texture is used for depends +on the lighting model. +

+
+
Procedure: material-texture-0 material
+

Return the first texture of material. +

+ +
+
Procedure: material-texture-1 material
+

Return the second texture of material. +

+ +
+
Procedure: material-texture-2 material
+

Return the third texture of material. +

+ +
+
Procedure: material-texture-3 material
+

Return the fourth texture of material. +

+ +
+
Procedure: material-texture-4 material
+

Return the fifth texture of material. +

+ +

For all data that is specific to the lighting model, materials have a +“properties” field. +

+
+
Procedure: material-properties material
+

Return the lighting model specific properties of material. +

+ +

5.3.11.2 Blinn-Phong Materials

+ +

The (chickadee graphics phong) module has the Blinn-Phong +lighting model: +

+
+
Procedure: make-phong-material [#:name "anonymous"] [#:blend-mode] [#:polygon-mode] [#:cull-face-mode] [#:depth-test] [#:stencil-test] [#:multisample? #f] [#:ambient-factor (vec3 1 1 1)] [#:diffuse-factor (vec3 1 1 1)] [#:specular-factor (vec3 1 1 1)] [#:shininess 32] [#:ambient-texture] [#:diffuse-texture] [#:specular-texture] [#:normal-texture]
+
+

Return a new Blinn-Phong material. +

+ +
+
Procedure: make-phong-properties [#:ambient] [#:diffuse] [#:specular] [#:shininess]
+
+

Return a new Blinn-Phong properties object. +

+ +
+
Procedure: phong-properties? obj
+

Return #t if obj is a Blinn-Phong properties object. +

+ +
+
Procedure: phong-properties-ambient properties
+

Return the ambient factor of properties. +

+ +
+
Procedure: phong-properties-diffuse properties
+

Return the diffuse factor of properties. +

+ +
+
Procedure: phong-properties-specular properties
+

Return the specular factor of properties. +

+ +
+
Procedure: phong-properties-shininess properties
+

Return the shininess factor of properties. +

+ +

5.3.11.3 PBR Materials

+ +

The (chickadee graphics pbr) module has the PBR lighting model: +

+
+
Procedure: make-pbr-material [#:name "anonymous"] [#:blend-mode] [#:polygon-mode] [#:cull-face-mode] [#:depth-test] [#:stencil-test] [#:multisample? #f] [#:base-color-factor (vec3 1 1 1)] [#:base-color-texcoord 0] [#:metallic-factor 1.0] [#:roughness-factor 1.0] [#:metallic-roughness-texcoord 0] [#:normal-texcoord 0] [#:occlusion-texcoord 0] [#:emissive-factor (vec3 1 1 1)] [#:emissive-texcoord 0] [#:alpha-mode opaque] [#:alpha-cutoff 0.5] [#:base-color-texture] [#:metallic-roughness-texture] [#:normal-texture] [#:occlusion-texture] [#:emissive-texture]
+
+

Return a new PBR material. +

+ +
+
Procedure: make-pbr-properties [#:base-color-factor] [#:base-color-texcoord] [#:metallic-factor] [#:roughness-factor] [#:metallic-roughness-texcoord] [#:normal-texcoord] [#:occlusion-texcoord] [#:emissive-factor] [#:emissive-texcoord] [#:alpha-mode] [#:alpha-cutoff]
+
+

Return a new PBR properties object. +

+ +
+
Procedure: pbr-properties? obj
+

Return #t if obj is a PBR properties object. +

+ +
+
Procedure: pbr-properties-base-color-factor properties
+

Return the base color factor of properties. +

+ +
+
Procedure: pbr-properties-base-color-texcoord properties
+

Return the base color texture coordinate attribute index of +properties. +

+ +
+
Procedure: pbr-properties-metallic-factor properties
+

Return the metallic factor of properties. +

+ +
+
Procedure: pbr-properties-roughness properties
+

Return the roughness factor of properties. +

+ +
+
Procedure: pbr-properties-metallic-roughness-texcoord properties
+

Return the metallic-roughness texture coordinate attribute index of +properties. +

+ +
+
Procedure: pbr-properties-normal-texcoord properties
+

Return the normal texture coordinate attribute index of +properties. +

+ +
+
Procedure: pbr-properties-occlusion-texcoord properties
+

Return the ambient occlusion texture coordinate attribute index of +properties. +

+ +
+
Procedure: pbr-properties-emissive-factor properties
+

Return the emissive factor of properties. +

+ +
+
Procedure: pbr-properties-emissive-texcoord properties
+

Return the emissive texture coordinate attribute index of +properties. +

+ +
+
Procedure: pbr-properties-alpha-mode properties
+

Return the alpha mode of properties. +

+ +
+
Procedure: pbr-properties-alpha-cutoff properties
+

Return the alpha cutoff threshold of properties. +

+ +

5.3.11.4 Primitives and Meshes

+ +

A mesh is a collection of “primitives,” so we should discuss those +next. A primitive contains vertex data and a material. +

+
+
Procedure: make-primitive name vertex-array material
+

Return a new primitive named name that renders +vertex-array (see Buffers) using material. +

+ +
+
Procedure: primitive? obj
+

Return #t if obj is a primitive. +

+ +
+
Procedure: primitive-name primitive
+

Return the name of primitive. +

+ +
+
Procedure: primitive-vertex-array primitive
+

Return the vertex array of primitive. +

+ +
+
Procedure: primitive-material primitive
+

Return the material of primitive. +

+ +

Okay, now we can talk about meshes, which are just a glorified list of +primitive objects. +

+
+
Procedure: make-mesh name primitives
+

Return a new mesh named name that is composed of the list +primitives. +

+ +
+
Procedure: mesh? obj
+

Return #t if obj is a mesh. +

+ +
+
Procedure: mesh-name mesh
+

Return the name of mesh. +

+ +
+
Procedure: mesh-primitives mesh
+

Return the list of primitives for mesh. +

+ +

The mesh module also conveniently provides procedures to build several +basic 3D shapes. +

+
+
Procedure: make-plane length width material
+

Return a new mesh that forms a flat plane on the XZ axis that is +width units long along the X axis and length units long +along the Z axis. +

+ +
+
Procedure: make-tesselated-plane length width resolution material
+

Return a new mesh that forms a tesselated plane on the XZ axis that is +width units long along the X axis and length units long +along the Z axis. +

+

A regular plane is a single rectangle, but a tesselated plane is +subdivided into many smaller rectangles by resolution. This +allows for transforming the vertices in a shader to achieve effects +such as waves in water or mountainous terrain. +

+ +
+
Procedure: make-cube size material
+

Return a new mesh that forms a cube that is size units big. +

+ +
+
Procedure: make-sphere radius material [#:quality 2]
+

Return a new mesh that forms a sphere that has a radius of +radius units. Since 3D models are composed of triangles, the +quality of a sphere is entirely dependent upon how many triangles are +used to appromixate the shape. The higher the value of quality, +the better the appromixation, but the more time it will take to +generate and the more expensive it will be to draw. The number of +triangles in the resulting sphere increases exponentially with each +increment to quality. +

+ +
+
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Models.html b/manuals/chickadee/Models.html new file mode 100644 index 0000000..3a1a6d6 --- /dev/null +++ b/manuals/chickadee/Models.html @@ -0,0 +1,167 @@ + + + + + + +Models (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+
+

5.3.8 Models

+ +

Disclaimer: Chickadee is alpha software, but 3D model support is +even more alpha than that. There are many missing features in both +the model loading and rendering components, so set your expectations +accordingly! +

+

The (chickadee graphics model) module provides procedures to +load and render 3D models in the classic OBJ and more modern glTF 2.0 +formats. +

+

Here’s some basic boilerplate to render a 3D model: +

+
+
(use-modules (chickadee graphics light)
+             (chickadee graphics model)
+             (chickadee graphics skybox))
+
+(define model (load-gltf "Suzanne.gltf"))
+(define camera-position (vec3 0.0 0.0 3.0))
+(define world (make-identity-matrix4))
+(define view (look-at camera-position (vec3 0.0 0.0 0.0) (vec3 0.0 1.0 0.0)))
+(define projection (perspective-projection (/ pi 3.0) (/ 4.0 3.0) 0.1 5.0))
+
+(define (draw alpha)
+  (with-projection projection
+    (draw-model model world view camera-position
+
+ +
+
Procedure: load-obj file-name
+

Load the OBJ formatted model in file-name and return a 3D model +object. +

+

OBJ models are rendered using a Phong lighting model, which is a +work-in-progress. +

+ +
+
Procedure: load-gltf file-name
+

Load the glTF 2.0 formatted model in file-name and return a 3D +model object. +

+

glTF models are rendered using a physically based lighting model, +which is currently a stub to be implemented later. +

+ +
+
Procedure: model? obj
+

Return #t if obj is a 3D model. +

+ +
+
Procedure: draw-model model [#:model-matrix] [#:view-matrix] [#:camera-position (vec3 0 0 0)] [#:skybox] [#:lights '()]
+
+

Render model with the transformation matrices model-matrix +and view-matrix applied. camera-position is the world +position of the camera, for correct specular lighting calculations. +skybox is used to apply ambient lighting to the model. +lights contains all of the dynamic lights (see Lights) that +should have an effect on the model. +

+ +

Models are composed of simpler data types: meshes, primitives, and +materials. Let’s start with materials. A material controls the +appearance of a 3D object. Is the object a rough stone? Or maybe a +smooth metal? Materials control all of this and more. +

+

There are two types of materials in Chickadee: Phong and PBR. +

+
+
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Particles.html b/manuals/chickadee/Particles.html index d058996..38943fa 100644 --- a/manuals/chickadee/Particles.html +++ b/manuals/chickadee/Particles.html @@ -1,6 +1,6 @@ - + + + +Quadtrees (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Data Structures   [Contents][Index]

+
+
+

5.6.4 Quadtrees

+ +

The (chickadee data quadtree) module provides a 2D spatial +partitioning implementation known as a “quadtree”. A quadtree +recursively subdivides the world into rectangular quadrants. This +data structure is very useful for handling broad-phase collision +detection because it can quickly determine the objects that may +possibly be colliding with another, resulting in fewer narrow-phase +collision tests that are typically much more expensive. +

+
+
Procedure: make-quadtree bounds [#:max-size 5] [#:max-depth 4]
+

Return a new quadtree that covers the area bounds. Each node +will try to hold at maximum max-size objects and the tree depth +will be restricted to max-depth. +

+ +
+
Procedure: quadtree? obj
+

Return #t if obj is a quadtree. +

+ +
+
Procedure: quadtree-clear! quadtree
+

Clear all objects from quadtree. +

+ +
+
Procedure: quadtree-insert! quadtree rect object
+

Insert object with bounding box rect into quadtree. +

+ +
+
Procedure: quadtree-delete! quadtree rect object
+

Delete object, who occupies the space rect, from +quadtree. +

+ +
+
Procedure: quadtree-find rect pred
+

Return the first object in quadtree in the vicinity of +rect that satisfies pred. +

+ +
+
Procedure: quadtree-fold quadtree rect init proc
+

Apply proc to all objects in the vicinity of rect in +quadtree to build a result and return that result. init +is the initial result. If there are no objects in the vicinity of +rect, just init is returned. +

+ +
+
Procedure: quadtree-for-each quadtree rect proc
+

Call proc for all objects in the vicinity of rect in +quadtree. +

+ +
+
Procedure: quadtree-leaf? quadtree
+

Return #t if quadtree is a leaf node. +

+ +
+
Procedure: quadtree-bounds quadtree
+

Return the bounding rectangle of quadtree. +

+ +
+
Procedure: quadtree-max-depth quadtree
+

Return the maximum depth of quadtree. +

+ +
+
Procedure: quadtree-max-size quadtree
+

Return the desired per-node maximum object count of quadtree. +

+ +
+
Procedure: quadtree-depth quadtree
+

Return the depth of the node quadtree. +

+ +
+
Procedure: quadtree-size quadtree
+

Return the number of objects stored in the node quadtree. +

+ +

Non-leaf nodes always have four child nodes, which correspond to the +quadrants of a Cartesian coordinate system: +

+
*------*------*
+|      |      |
+|  Q2  |  Q1  |
+|      |      |
+*------*------*
+|      |      |
+|  Q3  |  Q4  |
+|      |      |
+*------*------*
+
+
+
Procedure: quadtree-q1 quadtree
+

Return the upper-right child node of quadtree, or #f if +quadtree is a leaf node. +

+ +
+
Procedure: quadtree-q2 quadtree
+

Return the upper-left child node of quadtree, or #f if +quadtree is a leaf node. +

+ +
+
Procedure: quadtree-q3 quadtree
+

Return the lower-left child node of quadtree, or #f if +quadtree is a leaf node. +

+ +
+
Procedure: quadtree-q4 quadtree
+

Return the lower-right child node of quadtree, or #f if +quadtree is a leaf node. +

+ +
+
+

+Next: , Previous: , Up: Data Structures   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Quaternions.html b/manuals/chickadee/Quaternions.html index aaf3187..3728f66 100644 --- a/manuals/chickadee/Quaternions.html +++ b/manuals/chickadee/Quaternions.html @@ -1,6 +1,6 @@ - + + + +Queues (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Data Structures   [Contents][Index]

+
+
+

5.6.2 Queues

+ +

The (chickadee data queue) module provides a mutable queue that +is more memory efficient than Guile’s built-in (ice-9 q) +module. +

+
+
Procedure: make-queue
+

Return a new, empty queue. +

+ +
+
Procedure: queue? obj
+

Return #t if obj is a queue. +

+ +
+
Procedure: queue-empty? queue
+

Return #t if queue is empty. +

+ +
+
Procedure: queue-length queue
+

Return the current length of queue. +

+ +
+
Procedure: enqueue! queue item
+

Add item to queue. +

+ +
+
Procedure: dequeue! queue
+

Remove and return the first item in queue. +

+ +
+
Procedure: queue-clear! queue
+

Remove all items from queue. +

+ + + + + + diff --git a/manuals/chickadee/Rectangles.html b/manuals/chickadee/Rectangles.html index 3dde39d..62d4f16 100644 --- a/manuals/chickadee/Rectangles.html +++ b/manuals/chickadee/Rectangles.html @@ -1,6 +1,6 @@ - + + + +Render Settings (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+
+

5.3.16 Render Settings

+ +

5.3.16.1 Blending

+ +

Rendering a scene often involves drawing layers of objects that +overlap each other. Blending determines how two overlapping pixels +are combined in the final image that is rendered to the screen. The +(chickadee graphics blend) module provides a data type for +blending modes. +

+

Chickadee provides the following blend modes: +

+
+
Variable: blend:alpha
+

Blend pixels according to the values of their alpha channels. This is +the most commonly used blend mode. +

+ +
+
Variable: blend:replace
+

Overwrite the output pixel color with the color being drawn. +

+ +
+
Variable: blend:add
+

Add all pixel color values together. The more colors blended +together, the more white the final color becomes. +

+ +
+
Variable: blend:subtract
+

Subtract all pixel color values. The more colors blended together, +the more black the final color becomes. +

+ +
+
Variable: blend:multiply
+
+ +
+
Variable: blend:darken
+
+ +
+
Variable: blend:lighten
+
+ +
+
Variable: blend:screen
+
+ +

Custom blend modes can be created using the make-blend-mode procedure: +

+
+
Procedure: make-blend-mode equation source-function destination-function
+

Return a new custom blend mode that applies source-function to +the source color, destination-function to the destination color, +and finally applies equation to the transformed +source/destination color values. These arguments are not +procedures, but symbolic representations of the functions that OpenGL +supports. +

+

Valid values for equation are: +

+
    +
  • add +
  • subtract +
  • reverse-subtract +
  • min +
  • max +
  • alpha-min +
  • alpha-max +
+ +

Valid values for source-function are: +

+
    +
  • zero +
  • one +
  • destination-color +
  • one-minus-destination-color +
  • source-alpha-saturate +
  • source-alpha +
  • one-minus-source-alpha +
  • destination-alpha +
  • one-minus-destination-alpha +
  • constant-color +
  • one-minus-constant-color +
  • constant-alpha +
  • one-minus-constant-alpha +
+ +

Valid values for destination-function are: +

+
    +
  • zero +
  • one +
  • source-color +
  • one-minus-source-color +
  • source-alpha +
  • one-minus-source-alpha +
  • destination-alpha +
  • one-minus-destination-alpha +
  • constant-color +
  • one-minus-constant-color +
  • constant-alpha +
  • one-minus-constant-alpha +
+ +
+ +

5.3.16.2 Polygon Modes and Culling

+ +

The (chickadee graphics polygon) module provides access to the +g:polygon-mode and g:cull-face-mode render states. +

+
+
Variable: fill-polygon-mode
+

Completely fill in the polygon. This is the default mode. +

+ +
+
Variable: line-polygon-mode
+

Render only the edges of the polygon. Produces a wireframe. +

+ +
+
Variable: point-polygon-mode
+

Render only the vertex positions as points. +

+ +
+
Procedure: make-polygon-mode front back
+

Return a new polygon mode that uses the method front for the +front face and back for the back face. The valid modes are +fill, line, and point. +

+ +
+
Procedure: polygon-mode? obj
+

Return #t if obj is a polygon mode. +

+ +
+
Procedure: current-polygon-mode
+

Return the current polygon mode. +

+ +
+
Variable: g:polygon-mode
+

Render state for polygon modes (see Rendering Engine.) +

+ +
+
Variable: no-cull-face-mode
+

Don’t cull any faces. +

+ +
+
Variable: back-cull-face-mode
+

Cull only back faces. +

+ +
+
Variable: front-cull-face-mode
+

Cull only front faces. +

+ +
+
Variable: front-and-back-cull-face-mode
+

Cull both front and back faces. +

+ +
+
Procedure: cull-face-mode? obj
+

Return #t if obj is a cull face mode. +

+ +
+
Procedure: cull-face-mode-front? cull-face-mode
+

Return #t if cull-face-mode culls front faces. +

+ +
+
Procedure: cull-face-mode-back? cull-face-mode
+

Return #t if cull-face-mode culls back faces. +

+ +
+
Procedure: current-cull-face-mode
+

Return the current cull face mode. +

+ +
+
Variable: g:cull-face-mode
+

Render state for cull face modes (see Rendering Engine.) +

+ +

5.3.16.3 Depth Testing

+ +

The (chickadee graphics depth) module provides access to the +g:depth-test render state. +

+
+
Procedure: make-depth-test [#:write? #t] [#:function 'less-than] [#:near 0.0] [#:far 1.0]
+
+

Return a new depth test object. If write is #t, the +depth buffer will be written to during a draw call. near and +far define the min/max Z values for which depth testing may +pass. +

+

function specifies how the depth value of pixel being drawn +compares to the depth value that is already in the depth buffer. When +this comparison is true, the depth test passes and the pixel is drawn. +When it fails, the pixel is discarded. +

+

The possible values of function are: +

+
    +
  • always +
  • never +
  • equal +
  • not-equal +
  • less-than +
  • less-than-or-equal +
  • greater-than +
  • greater-than-or-equal +
+ +
+ +
+
Procedure: depth-test? obj
+

Return #t when obj is a depth test object. +

+ +
+
Procedure: depth-test-write? depth-test
+

Return #t when depth-test will write to the depth buffer. +

+ +
+
Procedure: depth-test-function depth-test
+

Return the comparison function of depth-test. +

+ +
+
Procedure: depth-test-near depth-test
+

Return the near Z value of depth-test. +

+ +
+
Procedure: depth-test-far depth-test
+

Return the far Z value of depth-test. +

+ +
+
Procedure: current-depth-test
+

Return the current depth test. +

+ +
+
Variable: g:depth-test
+

Render state for depth tests (see Rendering Engine.) +

+ +

5.3.16.4 Stencil Testing

+ +

The (chickadee graphics stencil) module provides access to the +g:stencil-test render state. +

+
+
Variable: default-stencil-test
+

A stencil test that always passes. +

+ +
+
Procedure: make-stencil-test [#:mask #xFF] [#:function always] [#:function-mask #xFF] [#:reference 0] [#:on-fail keep] [#:on-depth-fail keep] [#:on-pass keep] [#:mask-front mask] [#:mask-back mask] [#:function-mask-front function-mask] [#:function-mask-back function-mask] [#:refrence-front reference] [#:reference-back reference] [#:on-fail-front on-fail] [#:on-fail-back on-fail] [#:on-depth-fail-front on-depth-fail] [#:on-depth-fail-back on-depth-fail] [#:on-pass-front on-pass] [#:on-pass-back on-pass]
+
+

Return a new stencil test object. Different configurations can be +used for the front and back faces by using the arguments that end in +“front” or “back”. +

+

Valid values for on-pass, on-fail, and on-depth-fail +are: +

+
    +
  • zero +
  • keep +
  • replace +
  • increment +
  • increment-wrap +
  • decrement +
  • decrement-wrap +
  • invert +
+ +

Valid values for function are: +

+
    +
  • always +
  • never +
  • equal +
  • not-equal +
  • less-than +
  • less-than-or-equal +
  • greater-than +
  • greater-than-or-equal +
+ +
+ +
+
Procedure: stencil-test? obj
+

Return #t when obj is a stencil test object. +

+ +
+
Procedure: stencil-test-mask-front stencil-test
+

Return the front mask of stencil-test. +

+ +
+
Procedure: stencil-test-mask-back stencil-test
+

Return the back mask of stencil-test. +

+ +
+
Procedure: stencil-test-function-front stencil-test
+

Return the front function of stencil-test. +

+ +
+
Procedure: stencil-test-function-back stencil-test
+

Return the back function of stencil-test. +

+ +
+
Procedure: stencil-test-function-mask-front stencil-test
+

Return the front function-mask of stencil-test. +

+ +
+
Procedure: stencil-test-function-mask-back stencil-test
+

Return the back function-mask of stencil-test. +

+ +
+
Procedure: stencil-test-reference-front stencil-test
+

Return the front reference value of stencil-test. +

+ +
+
Procedure: stencil-test-reference-back stencil-test
+

Return the back reference value of stencil-test. +

+ +
+
Procedure: stencil-test-on-fail-front stencil-test
+

Return the front failure action of stencil-test. +

+ +
+
Procedure: stencil-test-on-fail-back stencil-test
+

Return the back failure action of stencil-test. +

+ +
+
Procedure: stencil-test-on-depth-fail-front stencil-test
+

Return the front depth test failure action of stencil-test. +

+ +
+
Procedure: stencil-test-on-depth-fail-back stencil-test
+

Return the back depth test failure action of stencil-test. +

+ +
+
Procedure: stencil-test-on-pass-front stencil-test
+

Return the front pass action of stencil-test. +

+ +
+
Procedure: stencil-test-on-pass-back stencil-test
+

Return the back pass action of stencil-test. +

+ +
+
Procedure: current-stencil-test
+

Return the current stencil test. +

+ +
+
Variable: g:stencil-test
+

Render state for stencil testing (see Rendering Engine.) +

+ +

5.3.16.5 Multisample Antialiasing

+ +

Multisample antialiasing is a feature supported by many, but not all, +graphics cards. It is a nice easy way to improve the final frame that +the user sees, particularly in 3D scenes. The (chickadee +graphics multisample) module provides access to the +g:multisample? render state. +

+
+
Procedure: current-multisample
+

Return #t if multisampling is enabled. +

+ +
+
Variable: g:multisample?
+

Render state for multisampling (see Rendering Engine.) +

+ +
+
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Rendering-Engine.html b/manuals/chickadee/Rendering-Engine.html index bdc2444..1c90022 100644 --- a/manuals/chickadee/Rendering-Engine.html +++ b/manuals/chickadee/Rendering-Engine.html @@ -1,6 +1,6 @@ - + + + +Skyboxes (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+
+

5.3.10 Skyboxes

+ +

Skyboxes are used as backgrounds in 3D environments, as well as a +source of ambient lighting data when rendering 3D objects. The +(chickadee graphics skybox) module provides an API for making +skyboxes. +

+
+
Procedure: make-skybox cube-map
+

Return a new skybox that uses cube-map for a texture. +

+ +
+
Procedure: skybox? obj
+

Return #t if obj is a skybox. +

+ +
+
Procedure: skybox-cube-map sky-box
+

Return the cube map of skybox. +

+ +
+
Procedure: draw-skybox skybox view
+

Render skybox to the screen using the view matrix view. +

+ + + + + + diff --git a/manuals/chickadee/Sources.html b/manuals/chickadee/Sources.html index faf1c1b..c1ca1f3 100644 --- a/manuals/chickadee/Sources.html +++ b/manuals/chickadee/Sources.html @@ -1,6 +1,6 @@ -