diff options
Diffstat (limited to 'manuals/chickadee/Meshes.html')
-rw-r--r-- | manuals/chickadee/Meshes.html | 413 |
1 files changed, 0 insertions, 413 deletions
diff --git a/manuals/chickadee/Meshes.html b/manuals/chickadee/Meshes.html deleted file mode 100644 index 7e66c4d..0000000 --- a/manuals/chickadee/Meshes.html +++ /dev/null @@ -1,413 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<!-- 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 -or any later version published by the Free Software Foundation; -with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -A copy of the license is included in the section entitled "GNU -Free Documentation License". - -A copy of the license is also available from the Free Software -Foundation Web site at http://www.gnu.org/licenses/fdl.html. - - -* Chickadee: (chickadee). Game programming toolkit for Guile. - -The document was typeset with -http://www.texinfo.org/ (GNU 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" /> -<title>Meshes (The Chickadee Game Toolkit)</title> - -<meta name="description" content="Meshes (The Chickadee Game Toolkit)" /> -<meta name="keywords" content="Meshes (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="Buffers.html" rel="next" title="Buffers" /> -<link href="Skyboxes.html" rel="prev" title="Skyboxes" /> -<style type="text/css"> -<!-- -a.summary-letter {text-decoration: none} -blockquote.indentedblock {margin-right: 0em} -div.display {margin-left: 3.2em} -div.example {margin-left: 3.2em} -div.lisp {margin-left: 3.2em} -kbd {font-style: oblique} -pre.display {font-family: inherit} -pre.format {font-family: inherit} -pre.menu-comment {font-family: serif} -pre.menu-preformatted {font-family: serif} -span.nolinebreak {white-space: nowrap} -span.roman {font-family: initial; font-weight: normal} -span.sansserif {font-family: sans-serif; font-weight: normal} -ul.no-bullet {list-style: none} -@media (min-width: 1140px) { - body { - margin-left: 14rem; - margin-right: 4rem; - max-width: 52rem; - } -} - -@media (min-width: 800px) and (max-width: 1140px) { - body { - margin-left: 6rem; - margin-right: 4rem; - max-width: 52rem; - } -} - -@media (max-width: 800px) { - body { - margin: 1rem; - } -} - ---> -</style> -<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css" /> - - -</head> - -<body lang="en"> -<span id="Meshes"></span><div class="header"> -<p> -Next: <a href="Buffers.html" accesskey="n" rel="next">Buffers</a>, Previous: <a href="Skyboxes.html" accesskey="p" rel="prev">Skyboxes</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 /> -<span id="Meshes-1"></span><h4 class="subsection">5.3.11 Meshes</h4> - -<p>The <code>(chickadee graphics mesh)</code> modules provides procedures for -programmatically creating 3D objects (to load 3D models from a file on -disk, see <a href="#Meshes">Meshes</a>.) -</p> -<span id="Materials"></span><h4 class="subsubsection">5.3.11.1 Materials</h4> - -<p>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. -</p> -<p>All materials share some common data: -</p> -<dl> -<dt id="index-material_003f">Procedure: <strong>material?</strong> <em>obj</em></dt> -<dd><p>Return <code>#t</code> if <var>obj</var> is a material. -</p></dd></dl> - -<dl> -<dt id="index-material_002dname">Procedure: <strong>material-name</strong> <em>material</em></dt> -<dd><p>Return the name of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dshader">Procedure: <strong>material-shader</strong> <em>material</em></dt> -<dd><p>Return the shader of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dblend_002dmode">Procedure: <strong>material-blend-mode</strong> <em>material</em></dt> -<dd><p>Return the blend mode of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dpolygon_002dmode">Procedure: <strong>material-polygon-mode</strong> <em>material</em></dt> -<dd><p>Return the polygon mode of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dcull_002dface_002dmode">Procedure: <strong>material-cull-face-mode</strong> <em>material</em></dt> -<dd><p>Return the cull face mode of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002ddepth_002dtest">Procedure: <strong>material-depth-test</strong> <em>material</em></dt> -<dd><p>Return the depth test of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dstencil_002dtest">Procedure: <strong>material-stencil-test</strong> <em>material</em></dt> -<dd><p>Return the stencil test of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dmultisample_003f">Procedure: <strong>material-multisample?</strong> <em>material</em></dt> -<dd><p>Return <code>#t</code> if <var>material</var> uses multisampling. -</p></dd></dl> - -<p>Materials support 5 textures. What each texture is used for depends -on the lighting model. -</p> -<dl> -<dt id="index-material_002dtexture_002d0">Procedure: <strong>material-texture-0</strong> <em>material</em></dt> -<dd><p>Return the first texture of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dtexture_002d1">Procedure: <strong>material-texture-1</strong> <em>material</em></dt> -<dd><p>Return the second texture of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dtexture_002d2">Procedure: <strong>material-texture-2</strong> <em>material</em></dt> -<dd><p>Return the third texture of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dtexture_002d3">Procedure: <strong>material-texture-3</strong> <em>material</em></dt> -<dd><p>Return the fourth texture of <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-material_002dtexture_002d4">Procedure: <strong>material-texture-4</strong> <em>material</em></dt> -<dd><p>Return the fifth texture of <var>material</var>. -</p></dd></dl> - -<p>For all data that is specific to the lighting model, materials have a -“properties” field. -</p> -<dl> -<dt id="index-material_002dproperties">Procedure: <strong>material-properties</strong> <em>material</em></dt> -<dd><p>Return the lighting model specific properties of <var>material</var>. -</p></dd></dl> - -<span id="Blinn_002dPhong-Materials"></span><h4 class="subsubsection">5.3.11.2 Blinn-Phong Materials</h4> - -<p>The <code>(chickadee graphics phong)</code> module has the Blinn-Phong -lighting model: -</p> -<dl> -<dt id="index-make_002dphong_002dmaterial">Procedure: <strong>make-phong-material</strong> <em>[#: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]</em></dt> -<dd> -<p>Return a new Blinn-Phong material. -</p></dd></dl> - -<dl> -<dt id="index-make_002dphong_002dproperties">Procedure: <strong>make-phong-properties</strong> <em>[#:ambient] [#:diffuse] [#:specular] [#:shininess]</em></dt> -<dd> -<p>Return a new Blinn-Phong properties object. -</p></dd></dl> - -<dl> -<dt id="index-phong_002dproperties_003f">Procedure: <strong>phong-properties?</strong> <em>obj</em></dt> -<dd><p>Return <code>#t</code> if <var>obj</var> is a Blinn-Phong properties object. -</p></dd></dl> - -<dl> -<dt id="index-phong_002dproperties_002dambient">Procedure: <strong>phong-properties-ambient</strong> <em>properties</em></dt> -<dd><p>Return the ambient factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-phong_002dproperties_002ddiffuse">Procedure: <strong>phong-properties-diffuse</strong> <em>properties</em></dt> -<dd><p>Return the diffuse factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-phong_002dproperties_002dspecular">Procedure: <strong>phong-properties-specular</strong> <em>properties</em></dt> -<dd><p>Return the specular factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-phong_002dproperties_002dshininess">Procedure: <strong>phong-properties-shininess</strong> <em>properties</em></dt> -<dd><p>Return the shininess factor of <var>properties</var>. -</p></dd></dl> - -<span id="PBR-Materials"></span><h4 class="subsubsection">5.3.11.3 PBR Materials</h4> - -<p>The <code>(chickadee graphics pbr)</code> module has the PBR lighting model: -</p> -<dl> -<dt id="index-make_002dpbr_002dmaterial">Procedure: <strong>make-pbr-material</strong> <em>[#: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]</em></dt> -<dd> -<p>Return a new PBR material. -</p></dd></dl> - -<dl> -<dt id="index-make_002dpbr_002dproperties">Procedure: <strong>make-pbr-properties</strong> <em>[#: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]</em></dt> -<dd> -<p>Return a new PBR properties object. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_003f">Procedure: <strong>pbr-properties?</strong> <em>obj</em></dt> -<dd><p>Return <code>#t</code> if <var>obj</var> is a PBR properties object. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dbase_002dcolor_002dfactor">Procedure: <strong>pbr-properties-base-color-factor</strong> <em>properties</em></dt> -<dd><p>Return the base color factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dbase_002dcolor_002dtexcoord">Procedure: <strong>pbr-properties-base-color-texcoord</strong> <em>properties</em></dt> -<dd><p>Return the base color texture coordinate attribute index of -<var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dmetallic_002dfactor">Procedure: <strong>pbr-properties-metallic-factor</strong> <em>properties</em></dt> -<dd><p>Return the metallic factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002droughness">Procedure: <strong>pbr-properties-roughness</strong> <em>properties</em></dt> -<dd><p>Return the roughness factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dmetallic_002droughness_002dtexcoord">Procedure: <strong>pbr-properties-metallic-roughness-texcoord</strong> <em>properties</em></dt> -<dd><p>Return the metallic-roughness texture coordinate attribute index of -<var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dnormal_002dtexcoord">Procedure: <strong>pbr-properties-normal-texcoord</strong> <em>properties</em></dt> -<dd><p>Return the normal texture coordinate attribute index of -<var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002docclusion_002dtexcoord">Procedure: <strong>pbr-properties-occlusion-texcoord</strong> <em>properties</em></dt> -<dd><p>Return the ambient occlusion texture coordinate attribute index of -<var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002demissive_002dfactor">Procedure: <strong>pbr-properties-emissive-factor</strong> <em>properties</em></dt> -<dd><p>Return the emissive factor of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002demissive_002dtexcoord">Procedure: <strong>pbr-properties-emissive-texcoord</strong> <em>properties</em></dt> -<dd><p>Return the emissive texture coordinate attribute index of -<var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dalpha_002dmode">Procedure: <strong>pbr-properties-alpha-mode</strong> <em>properties</em></dt> -<dd><p>Return the alpha mode of <var>properties</var>. -</p></dd></dl> - -<dl> -<dt id="index-pbr_002dproperties_002dalpha_002dcutoff">Procedure: <strong>pbr-properties-alpha-cutoff</strong> <em>properties</em></dt> -<dd><p>Return the alpha cutoff threshold of <var>properties</var>. -</p></dd></dl> - -<span id="Primitives-and-Meshes"></span><h4 class="subsubsection">5.3.11.4 Primitives and Meshes</h4> - -<p>A mesh is a collection of “primitives,” so we should discuss those -next. A primitive contains vertex data and a material. -</p> -<dl> -<dt id="index-make_002dprimitive">Procedure: <strong>make-primitive</strong> <em>name vertex-array material</em></dt> -<dd><p>Return a new primitive named <var>name</var> that renders -<var>vertex-array</var> (see <a href="Buffers.html">Buffers</a>) using <var>material</var>. -</p></dd></dl> - -<dl> -<dt id="index-primitive_003f">Procedure: <strong>primitive?</strong> <em>obj</em></dt> -<dd><p>Return <code>#t</code> if <var>obj</var> is a primitive. -</p></dd></dl> - -<dl> -<dt id="index-primitive_002dname">Procedure: <strong>primitive-name</strong> <em>primitive</em></dt> -<dd><p>Return the name of <var>primitive</var>. -</p></dd></dl> - -<dl> -<dt id="index-primitive_002dvertex_002darray">Procedure: <strong>primitive-vertex-array</strong> <em>primitive</em></dt> -<dd><p>Return the vertex array of <var>primitive</var>. -</p></dd></dl> - -<dl> -<dt id="index-primitive_002dmaterial">Procedure: <strong>primitive-material</strong> <em>primitive</em></dt> -<dd><p>Return the material of <var>primitive</var>. -</p></dd></dl> - -<p>Okay, now we can talk about meshes, which are just a glorified list of -primitive objects. -</p> -<dl> -<dt id="index-make_002dmesh">Procedure: <strong>make-mesh</strong> <em>name primitives</em></dt> -<dd><p>Return a new mesh named <var>name</var> that is composed of the list -<var>primitives</var>. -</p></dd></dl> - -<dl> -<dt id="index-mesh_003f">Procedure: <strong>mesh?</strong> <em>obj</em></dt> -<dd><p>Return <code>#t</code> if <var>obj</var> is a mesh. -</p></dd></dl> - -<dl> -<dt id="index-mesh_002dname">Procedure: <strong>mesh-name</strong> <em>mesh</em></dt> -<dd><p>Return the name of <var>mesh</var>. -</p></dd></dl> - -<dl> -<dt id="index-mesh_002dprimitives">Procedure: <strong>mesh-primitives</strong> <em>mesh</em></dt> -<dd><p>Return the list of primitives for <var>mesh</var>. -</p></dd></dl> - -<p>The mesh module also conveniently provides procedures to build several -basic 3D shapes. -</p> -<dl> -<dt id="index-make_002dplane">Procedure: <strong>make-plane</strong> <em>length width material</em></dt> -<dd><p>Return a new mesh that forms a flat plane on the XZ axis that is -<var>width</var> units long along the X axis and <var>length</var> units long -along the Z axis. -</p></dd></dl> - -<dl> -<dt id="index-make_002dtesselated_002dplane">Procedure: <strong>make-tesselated-plane</strong> <em>length width resolution material</em></dt> -<dd><p>Return a new mesh that forms a tesselated plane on the XZ axis that is -<var>width</var> units long along the X axis and <var>length</var> units long -along the Z axis. -</p> -<p>A regular plane is a single rectangle, but a tesselated plane is -subdivided into many smaller rectangles by <var>resolution</var>. This -allows for transforming the vertices in a shader to achieve effects -such as waves in water or mountainous terrain. -</p></dd></dl> - -<dl> -<dt id="index-make_002dcube">Procedure: <strong>make-cube</strong> <em>size material</em></dt> -<dd><p>Return a new mesh that forms a cube that is <var>size</var> units big. -</p></dd></dl> - -<dl> -<dt id="index-make_002dsphere">Procedure: <strong>make-sphere</strong> <em>radius material [#:quality 2]</em></dt> -<dd><p>Return a new mesh that forms a sphere that has a radius of -<var>radius</var> 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 <var>quality</var>, -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 <var>quality</var>. -</p></dd></dl> - -<hr /> -<div class="header"> -<p> -Next: <a href="Buffers.html" accesskey="n" rel="next">Buffers</a>, Previous: <a href="Skyboxes.html" accesskey="p" rel="prev">Skyboxes</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> - - - -</body> -</html> |