chickadee.git
8 months agoexamples: game-controller: Add left/right trigger rendering.
David Thompson [Mon, 7 Jan 2019 04:19:46 +0000 (23:19 -0500)] 
examples: game-controller: Add left/right trigger rendering.

8 months agorender: sprite: Revamp rendering process.
David Thompson [Mon, 7 Jan 2019 03:50:45 +0000 (22:50 -0500)] 
render: sprite: Revamp rendering process.

Add support for tinting and simplify batch rendering.

8 months agorender: color: Use f32vector under the hood.
David Thompson [Mon, 7 Jan 2019 03:48:14 +0000 (22:48 -0500)] 
render: color: Use f32vector under the hood.

* chickadee/render/color.scm (<color>): Use a single field for storing
bytevector.
(make-color): Wrap f32vector.
(color-r, color-g, color-b, color-a): Fetch channel values from
f32vector.
(color): New procedure.

8 months agomath: matrix: Add transform-x and transform-y procedures.
David Thompson [Mon, 7 Jan 2019 03:47:46 +0000 (22:47 -0500)] 
math: matrix: Add transform-x and transform-y procedures.

* chickadee/math/matrix.scm (transform-x, transform-y): New procedures.

8 months agoexamples: Add game controller test.
David Thompson [Sun, 6 Jan 2019 05:08:13 +0000 (00:08 -0500)] 
examples: Add game controller test.

* examples/game-controller.scm: New file.
* examples/images/controller-buttons.png: New file.
* Makefile.am (EXTRA_DIST): Add them.

8 months agoRemove redundant open-all-controllers procedure.
David Thompson [Sun, 6 Jan 2019 05:06:34 +0000 (00:06 -0500)] 
Remove redundant open-all-controllers procedure.

I thought this was necessary to process controllers that were already
connected to the computer before a Chickadee-using program was
launched, but that doesn't seem to be the case.

* chickadee.scm (open-all-controllers): Delete.
(run-game): Remove call to open-all-controllers.

8 months agoAdd controller-name procedure.
David Thompson [Sun, 6 Jan 2019 05:05:47 +0000 (00:05 -0500)] 
Add controller-name procedure.

* chickadee.scm (controller-name): New procedure.

8 months agoFix normalization of game controller axis values.
David Thompson [Sun, 6 Jan 2019 05:04:54 +0000 (00:04 -0500)] 
Fix normalization of game controller axis values.

* chickadee.scm (controller-axis): Fix math so that axis values are
actually in the range [0, 1].

8 months agorender: texture: Fix error when splitting certain textures.
David Thompson [Sun, 6 Jan 2019 05:00:53 +0000 (00:00 -0500)] 
render: texture: Fix error when splitting certain textures.

The split-texture procedure would throw an exception in the event that
the image width/height could not be divided by tile width/height with
0 remainder.

* chickadee/render/texture.scm (split-texture): Floor the results of
dividing image dimensions by tile dimensions and ensure they are exact
integers.

8 months agoguix: Update to latest guile-sdl2 commit.
David Thompson [Sun, 6 Jan 2019 05:00:40 +0000 (00:00 -0500)] 
guix: Update to latest guile-sdl2 commit.

9 months agoMakefile: Install compiled files in the proper location.
David Thompson [Mon, 17 Dec 2018 01:41:28 +0000 (20:41 -0500)] 
Makefile: Install compiled files in the proper location.

* Makefile.am (godir): Use "site-ccache", not "ccache".

9 months agorender: font: Export a default-font procedure.
David Thompson [Sat, 15 Dec 2018 01:19:55 +0000 (20:19 -0500)] 
render: font: Export a default-font procedure.

* chickadee/render/font.scm (default-font): Change from variable to
procedure.

9 months agoCredit J-Robot for the pixel explosion image.
David Thompson [Fri, 14 Dec 2018 13:42:37 +0000 (08:42 -0500)] 
Credit J-Robot for the pixel explosion image.

9 months agoRename data/CREDITS to data/AUTHORS.
David Thompson [Fri, 14 Dec 2018 13:39:29 +0000 (08:39 -0500)] 
Rename data/CREDITS to data/AUTHORS.

9 months agoAdd particles example.
David Thompson [Fri, 14 Dec 2018 13:37:05 +0000 (08:37 -0500)] 
Add particles example.

* examples/images/explosion.png: New file.
* examples/particles.scm: New file.
* Makefile.am (EXTRA_DIST): Add them.

9 months agoFix game controller stuff.
David Thompson [Fri, 14 Dec 2018 13:34:14 +0000 (08:34 -0500)] 
Fix game controller stuff.

Forgot to prefix imported procedures since I define procedures with
the same names.

9 months agodoc: Improve Fonts section.
David Thompson [Fri, 14 Dec 2018 12:59:08 +0000 (07:59 -0500)] 
doc: Improve Fonts section.

9 months agoAdd controller query procedures.
David Thompson [Fri, 14 Dec 2018 12:48:00 +0000 (07:48 -0500)] 
Add controller query procedures.

Not ready to document them at this time since I have not done full
tests with a USB controller yet.

* chickadee.scm (controller-button-pressed?, controller-axis): New procedures.

9 months agoAdd mouse query procedures.
David Thompson [Fri, 14 Dec 2018 02:37:13 +0000 (21:37 -0500)] 
Add mouse query procedures.

* chickadee.scm (mouse-x, mouse-y, mouse-button-pressed?,
mouse-button-released?): New procedures.

9 months agoRe-add key-pressed? and key-released? procedures.
David Thompson [Fri, 14 Dec 2018 02:32:32 +0000 (21:32 -0500)] 
Re-add key-pressed? and key-released? procedures.

* chickadee.scm (key-pressed?, key-released?): New procedures.
* examples/grid.scm: Remove (sdl2 input keyboard) import.

9 months agoRe-hide SDL2 details.
David Thompson [Fri, 14 Dec 2018 02:20:42 +0000 (21:20 -0500)] 
Re-hide SDL2 details.

I know I'm backpedaling here, but I think it was a mistake to expose
SDL2 as much as I have here.  I think it's better for people just
getting started to not have to wonder what SDL means.  Making things
as usable as possible for beginners is an important goal, and
abstracting SDL2 + OpenGL things from the core game loop
implementation shouldn't require sacrificing that goal.

* chickadee.scm: Switch code with...
* chickadee/game-loop.scm: ...this! Which is copied straight from...
* chickadee/sdl.scm: ...this! Which is now deleted.
* Makefile.am (SOURCES): Add game-loop.scm, remove sdl.scm.
* examples/grid.scm: Update due to API breakage.
* examples/lines.scm: Ditto.
* examples/nine-patch.scm: Ditto.
* examples/sprite.scm: Ditto.
* examples/text.scm: Ditto.
* examples/tiled.scm: Ditto.
* doc/api.texi (Kernel): Update.

9 months agoexamples: Simplify text example.
David Thompson [Fri, 14 Dec 2018 01:50:39 +0000 (20:50 -0500)] 
examples: Simplify text example.

9 months agoFix automake warning.
David Thompson [Fri, 14 Dec 2018 01:50:07 +0000 (20:50 -0500)] 
Fix automake warning.

9 months agorender: font: Include a default font for convenience.
David Thompson [Thu, 13 Dec 2018 22:52:15 +0000 (17:52 -0500)] 
render: font: Include a default font for convenience.

* data/fonts/good-neighbors.fnt: New file.
* data/fonts/good-neighbors.png: New file.
* data/CREDITS: New file.
* examples/fonts/AUTHORS: Delete.
* examples/fonts/good_neighbors_starling.png: Delete.
* examples/fonts/good_neighbors_starling.xml: Delete.
* Makefile.am (dist_pkgdata_DATA, fontsdir, dist_fonts_DATA): New
variables.
(EXTRA_DIST): Remove examples/fonts files.
* chickadee/render/font.scm (draw-text): Make font an optional keyword argument.
* doc/api.texi (Fonts): Document it.
* examples/grid.scm: Update to use new draw-text API.
* examples/nine-patch.scm: Ditto.
* examples/text.scm: Ditto.

squash! render: font: Include a default font for convenience.

9 months agorender: sprite: Use a single buffer for unbatched sprite mesh.
David Thompson [Thu, 13 Dec 2018 22:32:07 +0000 (17:32 -0500)] 
render: sprite: Use a single buffer for unbatched sprite mesh.

* chickadee/render/sprite.scm (draw-sprite-unbatched): Combine
vertices and texcoords into a single packed buffer.

9 months agorender: sprite: batch: Combine vertices and texcoords into one buffer.
David Thompson [Thu, 13 Dec 2018 22:18:16 +0000 (17:18 -0500)] 
render: sprite: batch: Combine vertices and texcoords into one buffer.

Not sure how much of a gain this is, but it's one less buffer to map
each frame.

* chickadee/render/sprite.scm (init-sprite-batch): Create combined
vertex/texcoord buffer.
(double-sprite-batch-size!): Map and copy only a single buffer.
(sprite-batch-begin!): Map just one buffer.
(sprite-batch-add!): Use new packed buffer layout.

9 months agodoc: Mention 'rect' in manual.
David Thompson [Thu, 13 Dec 2018 13:29:32 +0000 (08:29 -0500)] 
doc: Mention 'rect' in manual.

* doc/api.texi (Rectangles): Document 'rect' procedure.

9 months agomath: rect: Add make-rect alias.
David Thompson [Thu, 13 Dec 2018 13:26:50 +0000 (08:26 -0500)] 
math: rect: Add make-rect alias.

* chickadee/math/rect.scm (rect): New procedure.

9 months agorender: font: Use set-vec2! where convenient.
David Thompson [Thu, 13 Dec 2018 13:18:06 +0000 (08:18 -0500)] 
render: font: Use set-vec2! where convenient.

* chickadee/render/font.scm (draw-text*): Use new set-vec2! procedure.

9 months agorender: sprite: Use set-vec2! where convenient.
David Thompson [Thu, 13 Dec 2018 13:17:29 +0000 (08:17 -0500)] 
render: sprite: Use set-vec2! where convenient.

* chickadee/render/sprite (sprite-batch-add!): Use new set-vec2!
procedure.

9 months agomath: vector: Add set-vec2! and set-vec3! procedures.
David Thompson [Thu, 13 Dec 2018 13:14:41 +0000 (08:14 -0500)] 
math: vector: Add set-vec2! and set-vec3! procedures.

* chickadee/math/vector.scm (set-vec2!, set-vec3!): New procedures.
* doc/api.texi (Vectors): Document them.

9 months agodoc: Fix typos.
David Thompson [Wed, 12 Dec 2018 14:00:37 +0000 (09:00 -0500)] 
doc: Fix typos.

9 months agodoc: Rename "GPU Buffers" section to "Buffers".
David Thompson [Wed, 12 Dec 2018 00:31:30 +0000 (19:31 -0500)] 
doc: Rename "GPU Buffers" section to "Buffers".

9 months agodoc: Rename "Blending and Depth Testing" section to just "Blending".
David Thompson [Wed, 12 Dec 2018 00:29:49 +0000 (19:29 -0500)] 
doc: Rename "Blending and Depth Testing" section to just "Blending".

9 months agodoc: Greatly expand public API documentation.
David Thompson [Tue, 11 Dec 2018 22:49:01 +0000 (17:49 -0500)] 
doc: Greatly expand public API documentation.

9 months agorender: shader: Change shader variable naming convention to camel case.
David Thompson [Tue, 11 Dec 2018 22:47:36 +0000 (17:47 -0500)] 
render: shader: Change shader variable naming convention to camel case.

9 months agorender: shader: Improve docstrings.
David Thompson [Tue, 11 Dec 2018 22:47:21 +0000 (17:47 -0500)] 
render: shader: Improve docstrings.

9 months agorender: buffer: Improve docstrings.
David Thompson [Tue, 11 Dec 2018 22:47:12 +0000 (17:47 -0500)] 
render: buffer: Improve docstrings.

9 months agoBump to version 0.4.0.
David Thompson [Mon, 10 Dec 2018 22:11:50 +0000 (17:11 -0500)] 
Bump to version 0.4.0.

9 months agorender: framebuffer: Add default projection matrix for convenience.
David Thompson [Mon, 10 Dec 2018 12:52:41 +0000 (07:52 -0500)] 
render: framebuffer: Add default projection matrix for convenience.

* chickadee/render/framebuffer.scm (<framebuffer>)[projection]: New
field.
(make-framebuffer): Use an orthographic projection the same size as
the framebuffer as the default projection matrix.
* chickadee/render.scm (with-framebuffer): Apply default projection
matrix.

9 months agogame-loop: Sleep thread a bit to avoid 100% CPU usage.
David Thompson [Sun, 9 Dec 2018 19:45:58 +0000 (14:45 -0500)] 
game-loop: Sleep thread a bit to avoid 100% CPU usage.

9 months agomath: grid: Simplify a formula.
David Thompson [Sun, 9 Dec 2018 19:44:59 +0000 (14:44 -0500)] 
math: grid: Simplify a formula.

* chickadee/math/grid.scm (slide): Simplify formula for setting new
goal coordinates.

9 months agoAdd particle rendering module. wip-particles
David Thompson [Wed, 5 Dec 2018 02:50:55 +0000 (21:50 -0500)] 
Add particle rendering module.

* chickadee/render/particles.scm: New file.
* Makefile.am (SOURCES): Add it.
* doc/api.texi (Particles): New subsection.

9 months agorender: buffer: Add support for int and double component types.
David Thompson [Wed, 5 Dec 2018 02:49:38 +0000 (21:49 -0500)] 
render: buffer: Add support for int and double component types.

* chickadee/render/buffer.scm (component-type-size,
typed-buffer-type-gl): Add int and double cases.

9 months agodoc: Fix typo.
David Thompson [Wed, 5 Dec 2018 16:19:29 +0000 (11:19 -0500)] 
doc: Fix typo.

* doc/api.texi (Sprites): s/diving/dividing/

9 months agorender: blend: Fix additive blending mode.
David Thompson [Tue, 4 Dec 2018 01:17:11 +0000 (20:17 -0500)] 
render: blend: Fix additive blending mode.

* chickadee/render/blend.scm (apply-blend-mode): Use the correct
destination blending factor (one, not zero!) for additive blending.

9 months agomath: grid: A couple more optimizations.
David Thompson [Sun, 2 Dec 2018 23:34:10 +0000 (18:34 -0500)] 
math: grid: A couple more optimizations.

* chickadee/math/grid.scm (make-grid): Set a high minimum bucket size
to avoid rehashing.
(grid-move): Use memoized inexact->exact procedure. Fix return value
of check procedure being ignored.

9 months agomath: grid: Refactor to improve performance a little bit.
David Thompson [Sun, 2 Dec 2018 22:15:18 +0000 (17:15 -0500)] 
math: grid: Refactor to improve performance a little bit.

There's still a lot of work needed to make the collision grid scale to
any reasonable number of moving objects, but this is a first step.

* chickadee/math/grid.scm: Big ol' refactor that I can't be bothered
  to list all the changes for.

9 months agoscripting: channel: Update copyright year.
David Thompson [Thu, 29 Nov 2018 21:38:01 +0000 (16:38 -0500)] 
scripting: channel: Update copyright year.

9 months agoscripting: channel: Add channel-get! and channel-put! procedures.
David Thompson [Thu, 29 Nov 2018 21:26:48 +0000 (16:26 -0500)] 
scripting: channel: Add channel-get! and channel-put! procedures.

* chickadee/scripting/channel.scm (channel-get!, channel-put!): New
  procedures.
* doc/api.texi [Channels]: Add docs.

9 months agoqueue: Add queue-length procedure.
David Thompson [Thu, 29 Nov 2018 19:27:00 +0000 (14:27 -0500)] 
queue: Add queue-length procedure.

* chickadee/queue.scm (queue-length): New procedure.

9 months agoscripting: channel: Remove unncessary module imports.
David Thompson [Thu, 29 Nov 2018 19:24:23 +0000 (14:24 -0500)] 
scripting: channel: Remove unncessary module imports.

* chickadee/scripting/channel.scm: Remove (ice-9 format) and
(srfi srfi-11) imports.

10 months agoguix: Update development environment to use Guile 2.9.1.
David Thompson [Thu, 25 Oct 2018 21:12:53 +0000 (17:12 -0400)] 
guix: Update development environment to use Guile 2.9.1.

10 months agorender: Add gpu-apply/instanced syntax.
David Thompson [Thu, 25 Oct 2018 12:46:53 +0000 (08:46 -0400)] 
render: Add gpu-apply/instanced syntax.

* chickadee/render.scm (gpu-apply/instanced*, gpu-apply/instanced): New syntax.

10 months agorender: buffer: Add render-vertices/instanced procedure.
David Thompson [Thu, 25 Oct 2018 12:46:25 +0000 (08:46 -0400)] 
render: buffer: Add render-vertices/instanced procedure.

* chickadee/render/buffer.scm (render-vertices/instanced): New procedure.

10 months agorender: buffer: Add divisor field to typed buffers.
David Thompson [Thu, 25 Oct 2018 12:44:48 +0000 (08:44 -0400)] 
render: buffer: Add divisor field to typed buffers.

* chickadee/render/buffer.scm (<typed-buffer>)[divisor]: New field.
(typed-buffer-divisor): New procedure.
(make-typed-buffer, make-streaming-typed-buffer): Add #:divisor argument.
(apply-typed-buffer): Setup vertex attribute divisor if there is one.

10 months agorender: gl: Add glDrawElementsInstanced binding.
David Thompson [Thu, 25 Oct 2018 12:42:30 +0000 (08:42 -0400)] 
render: gl: Add glDrawElementsInstanced binding.

* chickadee/render/gl.scm (gl-draw-elements-instanced): New procedure.

11 months agoconfigure: Accept Guile 3.0. v0.3.0
David Thompson [Wed, 3 Oct 2018 12:13:18 +0000 (08:13 -0400)] 
configure: Accept Guile 3.0.

11 months agodoc: Document the path finding API.
David Thompson [Wed, 3 Oct 2018 11:45:39 +0000 (07:45 -0400)] 
doc: Document the path finding API.

11 months agoMove pathfinding module to math directory.
David Thompson [Tue, 2 Oct 2018 21:12:44 +0000 (17:12 -0400)] 
Move pathfinding module to math directory.

11 months agodoc: Document collision grid API.
David Thompson [Tue, 2 Oct 2018 12:46:11 +0000 (08:46 -0400)] 
doc: Document collision grid API.

11 months agomath: grid: Fix docstring in grid-move.
David Thompson [Tue, 2 Oct 2018 12:46:01 +0000 (08:46 -0400)] 
math: grid: Fix docstring in grid-move.

11 months agodoc: Document bezier curve API.
David Thompson [Tue, 2 Oct 2018 12:10:53 +0000 (08:10 -0400)] 
doc: Document bezier curve API.

11 months agodoc: Document the rectangle API.
David Thompson [Fri, 28 Sep 2018 12:19:11 +0000 (08:19 -0400)] 
doc: Document the rectangle API.

11 months agodoc: Document vector and matrix math APIs.
David Thompson [Thu, 27 Sep 2018 12:41:05 +0000 (08:41 -0400)] 
doc: Document vector and matrix math APIs.

11 months agomath: matrix: Fix a few docstrings.
David Thompson [Thu, 27 Sep 2018 12:40:24 +0000 (08:40 -0400)] 
math: matrix: Fix a few docstrings.

* chickadee/math/matrix.scm: Fix mistakes in docstrings.

12 months agorender: texture: Fix bug in framebuffer texture coordinates.
David Thompson [Tue, 11 Sep 2018 01:40:56 +0000 (21:40 -0400)] 
render: texture: Fix bug in framebuffer texture coordinates.

* chickadee/render/texture.scm (make-texture): Don't flip texture
horizontally, only vertically.

12 months agorender: framebuffer: Flip UV coordinates.
David Thompson [Tue, 11 Sep 2018 01:27:51 +0000 (21:27 -0400)] 
render: framebuffer: Flip UV coordinates.

* chickadee/render/framebuffer.scm (make-framebuffer): Flip the
texture now that the texture origin is top-left.

12 months agorender: texture: Add flip? argument to make-texture.
David Thompson [Tue, 11 Sep 2018 01:27:25 +0000 (21:27 -0400)] 
render: texture: Add flip? argument to make-texture.

* chickadee/render/texture.scm (make-texture): Add #:flip? keyword argument.

12 months agorender: Change texture origin to top-left.
David Thompson [Mon, 10 Sep 2018 21:42:10 +0000 (17:42 -0400)] 
render: Change texture origin to top-left.

This is a pretty big change, but hopefully for the best as this aligns
with graphics programs and the glTF standard that uses a top-left
origin.  We can keep using a lower-left origin for vertices, though.

* chickadee/render/texture.scm (surface->texture): Stop flipping pixel
rows.
* chickadee/render/sprites.scm (draw-sprite-unbatched,
sprite-batch-add!, draw-nine-patch*): Adjust texture y-coordinates.
* chickadee/render/font.scm (parse-fnt): Stop inverting y coordinates.
* chickadee/render/tiled.scm (load-tile-map): Stop inverting tile ids.

12 months agomath: vector: Fix vec2-normalize and vec3-normalize.
David Thompson [Mon, 10 Sep 2018 21:12:09 +0000 (17:12 -0400)] 
math: vector: Fix vec2-normalize and vec3-normalize.

* chickadee/math/vector.scm: Move vec2-normalize and vec3-normalize
  below the definitions of vec2-normalize! and vec3-normalize! so that
  inlining doesn't screw things up.

12 months agomath: vector: Add vec2*, vec2+, and vec2- procedures.
David Thompson [Mon, 10 Sep 2018 21:09:50 +0000 (17:09 -0400)] 
math: vector: Add vec2*, vec2+, and vec2- procedures.

* chickadee/math/vector.scm (vec2*, vec2+, vec2-): New procedures.

12 months agorender: asset: Don't use mipmaps for now.
David Thompson [Fri, 7 Sep 2018 21:34:28 +0000 (17:34 -0400)] 
render: asset: Don't use mipmaps for now.

Chickadee doesn't support them yet.

12 months agorender: asset: Use default sampler index of 0 when loading textures.
David Thompson [Fri, 7 Sep 2018 21:34:07 +0000 (17:34 -0400)] 
render: asset: Use default sampler index of 0 when loading textures.

12 months agorender: asset: Removing debug print calls.
David Thompson [Fri, 7 Sep 2018 21:33:52 +0000 (17:33 -0400)] 
render: asset: Removing debug print calls.

12 months agorender: scene: Make material factors default to 1.0.
David Thompson [Fri, 7 Sep 2018 21:33:21 +0000 (17:33 -0400)] 
render: scene: Make material factors default to 1.0.

12 months agorender: asset: Add material texture parsing and loading.
David Thompson [Fri, 7 Sep 2018 13:06:35 +0000 (09:06 -0400)] 
render: asset: Add material texture parsing and loading.

* chickadee/render/asset.scm (read-gltf): Parse and load all textures
referenced by materials.

12 months agorender: scene: Apply base color texture and factor.
David Thompson [Fri, 7 Sep 2018 13:03:43 +0000 (09:03 -0400)] 
render: scene: Apply base color texture and factor.

* chickadee/render/scene.scm (draw-primitive): Set base color texture
and send base color factor as uniform to shader.
* data/shaders/pbr/pbr-vert.glsl (texcoord_0): New input attribute.
(frag_tex): New output attribute.
* data/shaders/pbr/pbr-frag.glsl (frag_tex): New input attribute.
(base_color_factor, base_color_texture): New uniforms.

12 months agorender: scene: Merge metallic roughness into material record type.
David Thompson [Fri, 7 Sep 2018 12:52:25 +0000 (08:52 -0400)] 
render: scene: Merge metallic roughness into material record type.

* chickadee/render/scene.scm (<metallic-roughness>): Delete. Merge all
  fields into <material>.

12 months agorender: shader: Add support for vec3 uniform values.
David Thompson [Fri, 7 Sep 2018 12:52:03 +0000 (08:52 -0400)] 
render: shader: Add support for vec3 uniform values.

12 months agorender: gl: Re-export gl-uniform3fv.
David Thompson [Fri, 7 Sep 2018 12:51:22 +0000 (08:51 -0400)] 
render: gl: Re-export gl-uniform3fv.

* chickadee/render/gl.scm: Export gl-uniform3fv.

12 months agorender: scene: Stop allocating matrices when rendering.
David Thompson [Thu, 6 Sep 2018 16:19:22 +0000 (12:19 -0400)] 
render: scene: Stop allocating matrices when rendering.

* chickadee/render/scene.scm (<primitive>): Add matrix field.
(make-primitive): Call %make-primitive with additional matrix arg.
(<scene-node>): Add world-matrix field.
(make-scene-node): Call %make-scene-node with additional matrix arg.
(modelview): Delete.
(draw-primitive): Perform matrix multiplication without allocating.
(draw-scene-node): Likewise.
(draw-scene): Pass pre-built matrix rather than allocating.

12 months agodata: shaders: Update WIP PBR shaders.
David Thompson [Thu, 6 Sep 2018 13:39:37 +0000 (09:39 -0400)] 
data: shaders: Update WIP PBR shaders.

They don't *anything* related to PBR, but they allow me to test glTF
asset loading as I work towards full PBR support.

12 months agorender: buffer: Fix pointer argument to glVertexAttribPointer.
David Thompson [Thu, 6 Sep 2018 13:34:46 +0000 (09:34 -0400)] 
render: buffer: Fix pointer argument to glVertexAttribPointer.

This one was a doozy.  Took me days to figure out why something wasn't
rendering properly and this was the culprit!  The last argument, the
"pointer" argument, to glVertexAttribPointer is supposed to point to
the byte offset to start reading data from the VBO.  I thought this
meant that I could pass a pointer to an integer that contained the
offset.  WRONG!  The pointer value itself must encode that offset.
You can see in the diff that I knew this code didn't work when the
offset was 0, but somehow a null pointer worked and I just made that
case work while leaving every other offset broken.  The more I know!

* chickadee/render/buffer.scm (apply-typed-buffer): Pass a pointer
  whose address is the byte offset of the buffer, rather than a
  pointer whose dereferenced value is an integer representing the byte
  offset.

12 months agorender: buffer: Use correct data type for index buffer when rendering.
David Thompson [Thu, 6 Sep 2018 13:33:19 +0000 (09:33 -0400)] 
render: buffer: Use correct data type for index buffer when rendering.

* chickadee/render/buffer.scm (render-vertices): Use the index buffer
  type rather than assuming it is always unsigned-int.

12 months agorender: buffer: Stop using glBufferSubData when creating VBOs.
David Thompson [Thu, 6 Sep 2018 13:28:59 +0000 (09:28 -0400)] 
render: buffer: Stop using glBufferSubData when creating VBOs.

* chickadee/render/buffer.scm (make-buffer): Remove unnecessary call
  to glBufferSubData and just use glBufferData to do it all.

12 months agorender: buffer: Fixed default typed buffer length calculation.
David Thompson [Thu, 6 Sep 2018 13:27:46 +0000 (09:27 -0400)] 
render: buffer: Fixed default typed buffer length calculation.

* chickadee/render/buffer.scm (num-elements): New procedure.
  (make-typed-buffer): Default 'length' to the correct value in
  elements, not bytes, when a custom length is not specified.

12 months agorender: buffer: Orphan before mapping only when used for streaming.
David Thompson [Thu, 6 Sep 2018 13:25:34 +0000 (09:25 -0400)] 
render: buffer: Orphan before mapping only when used for streaming.

* chickdaee/render/buffer.scm (map-buffer!): Orphan buffer data only
  when the buffer usage is 'stream'.

12 months agorender: scene: Add better printers for primitives, meshes, and scenes.
David Thompson [Thu, 6 Sep 2018 13:24:23 +0000 (09:24 -0400)] 
render: scene: Add better printers for primitives, meshes, and scenes.

* chickadee/render/scene.scm (display-primitive, display-mesh,
  display-scene-node): New procedures.

12 months agorender: gl: Export gl-point-size.
David Thompson [Thu, 6 Sep 2018 13:22:35 +0000 (09:22 -0400)] 
render: gl: Export gl-point-size.

* chickadee/render/gl.scm (gl-point-size): New procedure alias.

12 months agomath: Add grid module.
David Thompson [Mon, 3 Sep 2018 02:12:27 +0000 (22:12 -0400)] 
math: Add grid module.

* chickadee/math/grid.scm: New file.
* examples/grid.scm: New file.
* Makefile.am (SOURCES): Add grid module.
(EXTRA_DIST): Add grid example.

12 months agoRemove default error handler.
David Thompson [Mon, 3 Sep 2018 02:08:34 +0000 (22:08 -0400)] 
Remove default error handler.

* chickadee.scm (default-error-handler): Delete.
(call-with-error-handling): Don't catch errors if no handler is
specified.
(run-game): Default 'error' arg to #f.
* chickadee/sdl.scm: (run-game/sdl): Likewise.

12 months agorender: shapes: Add simple (but slow) bezier curve rendering.
David Thompson [Wed, 29 Aug 2018 21:53:35 +0000 (17:53 -0400)] 
render: shapes: Add simple (but slow) bezier curve rendering.

* chickadee/render/shapes.scm (draw-bezier-curve, draw-bezier-path):
  New procedures.

12 months agoAdd bezier curve module.
David Thompson [Wed, 29 Aug 2018 21:52:59 +0000 (17:52 -0400)] 
Add bezier curve module.

* chickadee/math/bezier.scm: New file.
* Makefile.am (SOURCES): Add it.

12 months agorender: shapes: Allow matrix to be passed to draw-line.
David Thompson [Wed, 29 Aug 2018 21:38:59 +0000 (17:38 -0400)] 
render: shapes: Allow matrix to be passed to draw-line.

* chickadee/render/shapes.scm (draw-line): Add matrix argument.

12 months agoscripting: Add repeat macro.
David Thompson [Wed, 29 Aug 2018 11:58:35 +0000 (07:58 -0400)] 
scripting: Add repeat macro.

* chickadee/scripting.scm (repeat): New syntax.

12 months agoFix error handling logic.
David Thompson [Sun, 26 Aug 2018 02:07:07 +0000 (22:07 -0400)] 
Fix error handling logic.

* chickadee.scm (call-with-error-handling): Call the correct error
handler. Return #t if an error occurred, #f otherwise.
(run-game): Reset current-time and buffer after recovering from an
error.

12 months agoRemove custom backtrace display.
David Thompson [Sun, 26 Aug 2018 01:31:14 +0000 (21:31 -0400)] 
Remove custom backtrace display.

Always printing a backtrace caused double backtraces to be printed
when using the default error handler that just re-throws the error.

13 months agogit: Ignore html manual build artifacts.
David Thompson [Thu, 23 Aug 2018 11:48:24 +0000 (07:48 -0400)] 
git: Ignore html manual build artifacts.

13 months agoUpdate manual to reflect major API changes.
David Thompson [Tue, 21 Aug 2018 14:46:44 +0000 (10:46 -0400)] 
Update manual to reflect major API changes.