summaryrefslogtreecommitdiff
path: root/manuals/chickadee/Shaders.html
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-05-24 08:09:03 -0400
committerDavid Thompson <dthompson2@worcester.edu>2023-05-24 08:09:03 -0400
commit03072ef67af0623758a660e2cd3fb5e153133efa (patch)
treeeea30b2b8fd47aa7d1bd6494ed64b4313f03eb4a /manuals/chickadee/Shaders.html
parentbcccc363a3b814930856be06c52914fb88c2ece6 (diff)
Update chickadee manual.
Diffstat (limited to 'manuals/chickadee/Shaders.html')
-rw-r--r--manuals/chickadee/Shaders.html70
1 files changed, 35 insertions, 35 deletions
diff --git a/manuals/chickadee/Shaders.html b/manuals/chickadee/Shaders.html
index 95c5186..505e031 100644
--- a/manuals/chickadee/Shaders.html
+++ b/manuals/chickadee/Shaders.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>Shaders (The Chickadee Game Toolkit)</title>
-<meta name="description" content="Shaders (The Chickadee Game Toolkit)">
-<meta name="keywords" content="Shaders (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="Framebuffers.html" rel="next" title="Framebuffers">
-<link href="Buffers.html" rel="prev" title="Buffers">
+<meta name="description" content="Shaders (The Chickadee Game Toolkit)" />
+<meta name="keywords" content="Shaders (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="Framebuffers.html" rel="next" title="Framebuffers" />
+<link href="Buffers.html" rel="prev" title="Buffers" />
<style type="text/css">
-<!--
+&lt;!--
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}
}
}
--->
+--&gt;
</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="Framebuffers.html" accesskey="n" rel="next">Framebuffers</a>, Previous: <a href="Buffers.html" accesskey="p" rel="prev">Buffers</a>, Up: <a href="Graphics.html" accesskey="u" rel="up">Graphics</a> &nbsp; [<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="Shaders-1"></span><h4 class="subsection">5.3.13 Shaders</h4>
<p>Shaders are programs that the GPU can evaluate that allow the
@@ -139,10 +139,10 @@ Chickadee uses, is to think about it as a function call: The shader is
a function, and it is applied to some &ldquo;attributes&rdquo; (positional
arguments), and some &ldquo;uniforms&rdquo; (keyword arguments).
</p>
-<div class="example">
-<pre class="example">(define my-shader (load-shader &quot;vert.glsl&quot; &quot;frag.glsl&quot;))
-(define vertices (make-vertex-array &hellip;))
-(shader-apply my-shader vertices #:color red)
+<div class="lisp">
+<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">my-shader</span> <span class="syntax-open">(</span><span class="syntax-symbol">load-shader</span> <span class="syntax-string">"vert.glsl"</span> <span class="syntax-string">"frag.glsl"</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">vertices</span> <span class="syntax-open">(</span><span class="syntax-symbol">make-vertex-array</span> <span class="syntax-symbol">...</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
+<span class="syntax-open">(</span><span class="syntax-symbol">shader-apply</span> <span class="syntax-symbol">my-shader</span> <span class="syntax-symbol">vertices</span> <span class="syntax-keyword">#:color</span> <span class="syntax-symbol">red</span><span class="syntax-close">)</span>
</pre></div>
<p>See <a href="Rendering-Engine.html">Rendering Engine</a> for more details about the <code>shader-apply</code>
@@ -277,17 +277,17 @@ shader struct.
<p>Some example code will explain this concept best. Here is the Scheme
equivalent of the <code>Light</code> struct:
</p>
-<div class="example">
-<pre class="example">(define-shader-type &lt;light&gt;
- make-light
- light?
- (bool enabled light-enabled?)
- (int type light-type)
- (float-vec3 position light-position)
- (float-vec3 direction light-direction)
- (float-vec4 color light-color)
- (float intensity light-intensity)
- (float cut-off light-cut-off))
+<div class="lisp">
+<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define-shader-type</span> <span class="syntax-symbol">&lt;light&gt;</span>
+ <span class="syntax-symbol">make-light</span>
+ <span class="syntax-symbol">light?</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">bool</span> <span class="syntax-symbol">enabled</span> <span class="syntax-symbol">light-enabled?</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">int</span> <span class="syntax-symbol">type</span> <span class="syntax-symbol">light-type</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">float-vec3</span> <span class="syntax-symbol">position</span> <span class="syntax-symbol">light-position</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">float-vec3</span> <span class="syntax-symbol">direction</span> <span class="syntax-symbol">light-direction</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">float-vec4</span> <span class="syntax-symbol">color</span> <span class="syntax-symbol">light-color</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">float</span> <span class="syntax-symbol">intensity</span> <span class="syntax-symbol">light-intensity</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">float</span> <span class="syntax-symbol">cut-off</span> <span class="syntax-symbol">light-cut-off</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
</pre></div>
<p>The macro <code>define-shader-type</code> closely resembles the familiar
@@ -393,7 +393,7 @@ optional.
<dd><p>Return <code>#t</code> if <var>obj</var> is a shader data type object.
</p></dd></dl>
-<hr>
+<hr />
<div class="header">
<p>
Next: <a href="Framebuffers.html" accesskey="n" rel="next">Framebuffers</a>, Previous: <a href="Buffers.html" accesskey="p" rel="prev">Buffers</a>, Up: <a href="Graphics.html" accesskey="u" rel="up">Graphics</a> &nbsp; [<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>