diff options
Diffstat (limited to 'manuals/chickadee/Models.html')
-rw-r--r-- | manuals/chickadee/Models.html | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/manuals/chickadee/Models.html b/manuals/chickadee/Models.html index 3a1a6d6..4d319a1 100644 --- a/manuals/chickadee/Models.html +++ b/manuals/chickadee/Models.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> -<!-- Copyright (C) 2017-2021 David Thompson davet@gnu.org +<!-- Copyright (C) 2017-2023 David Thompson dthompson2@worcester.edu Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 @@ -17,25 +17,25 @@ Foundation Web site at http://www.gnu.org/licenses/fdl.html. The document was typeset with http://www.texinfo.org/ (GNU Texinfo). - --> -<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> + --> +<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> <head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Models (The Chickadee Game Toolkit)</title> -<meta name="description" content="Models (The Chickadee Game Toolkit)"> -<meta name="keywords" content="Models (The Chickadee Game Toolkit)"> -<meta name="resource-type" content="document"> -<meta name="distribution" content="global"> -<meta name="Generator" content="makeinfo"> -<link href="index.html" rel="start" title="Top"> -<link href="Index.html" rel="index" title="Index"> -<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> -<link href="Graphics.html" rel="up" title="Graphics"> -<link href="Lights.html" rel="next" title="Lights"> -<link href="Tile-Maps.html" rel="prev" title="Tile Maps"> +<meta name="description" content="Models (The Chickadee Game Toolkit)" /> +<meta name="keywords" content="Models (The Chickadee Game Toolkit)" /> +<meta name="resource-type" content="document" /> +<meta name="distribution" content="global" /> +<meta name="Generator" content="makeinfo" /> +<link href="index.html" rel="start" title="Top" /> +<link href="Index.html" rel="index" title="Index" /> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents" /> +<link href="Graphics.html" rel="up" title="Graphics" /> +<link href="Lights.html" rel="next" title="Lights" /> +<link href="Tile-Maps.html" rel="prev" title="Tile Maps" /> <style type="text/css"> -<!-- +<!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} div.display {margin-left: 3.2em} @@ -72,9 +72,9 @@ ul.no-bullet {list-style: none} } } ---> +--> </style> -<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css"> +<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css" /> </head> @@ -84,7 +84,7 @@ ul.no-bullet {list-style: none} <p> Next: <a href="Lights.html" accesskey="n" rel="next">Lights</a>, Previous: <a href="Tile-Maps.html" accesskey="p" rel="prev">Tile Maps</a>, Up: <a href="Graphics.html" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p> </div> -<hr> +<hr /> <span id="Models-1"></span><h4 class="subsection">5.3.8 Models</h4> <p><em>Disclaimer: Chickadee is alpha software, but 3D model support is @@ -98,20 +98,20 @@ formats. </p> <p>Here’s some basic boilerplate to render a 3D model: </p> -<div class="example"> -<pre class="example">(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 +<div class="lisp"> +<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-symbol">use-modules</span> <span class="syntax-open">(</span><span class="syntax-symbol">chickadee</span> <span class="syntax-symbol">graphics</span> <span class="syntax-symbol">light</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">chickadee</span> <span class="syntax-symbol">graphics</span> <span class="syntax-symbol">model</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">chickadee</span> <span class="syntax-symbol">graphics</span> <span class="syntax-symbol">skybox</span><span class="syntax-close">)</span><span class="syntax-close">)</span> + +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">model</span> <span class="syntax-open">(</span><span class="syntax-symbol">load-gltf</span> <span class="syntax-string">"Suzanne.gltf"</span><span class="syntax-close">)</span><span class="syntax-close">)</span> +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">camera-position</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec3</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">3.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span> +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">world</span> <span class="syntax-open">(</span><span class="syntax-symbol">make-identity-matrix4</span><span class="syntax-close">)</span><span class="syntax-close">)</span> +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">view</span> <span class="syntax-open">(</span><span class="syntax-symbol">look-at</span> <span class="syntax-symbol">camera-position</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec3</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">0.0</span><span class="syntax-close">)</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec3</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">1.0</span> <span class="syntax-symbol">0.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span> +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">projection</span> <span class="syntax-open">(</span><span class="syntax-symbol">perspective-projection</span> <span class="syntax-open">(</span><span class="syntax-symbol">/</span> <span class="syntax-symbol">pi</span> <span class="syntax-symbol">3.0</span><span class="syntax-close">)</span> <span class="syntax-open">(</span><span class="syntax-symbol">/</span> <span class="syntax-symbol">4.0</span> <span class="syntax-symbol">3.0</span><span class="syntax-close">)</span> <span class="syntax-symbol">0.1</span> <span class="syntax-symbol">5.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span> + +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">draw</span> <span class="syntax-symbol">alpha</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">with-projection</span> <span class="syntax-symbol">projection</span> + <span class="syntax-open">(</span><span class="syntax-symbol">draw-model</span> <span class="syntax-symbol">model</span> <span class="syntax-symbol">world</span> <span class="syntax-symbol">view</span> <span class="syntax-symbol">camera-position</span> </pre></div> <dl> @@ -155,7 +155,7 @@ smooth metal? Materials control all of this and more. </p> <p>There are two types of materials in Chickadee: Phong and PBR. </p> -<hr> +<hr /> <div class="header"> <p> Next: <a href="Lights.html" accesskey="n" rel="next">Lights</a>, Previous: <a href="Tile-Maps.html" accesskey="p" rel="prev">Tile Maps</a>, Up: <a href="Graphics.html" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p> |