mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-10-20 10:37:37 -04:00
Work on lua level generation
This commit is contained in:
parent
f3e63ecbc7
commit
98c4ae3667
|
@ -32,7 +32,7 @@
|
|||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="modules/sk_input.html">sk_input</a></li>
|
||||
<li><a href="modules/LuaMesh.html">LuaMesh</a></li>
|
||||
<li><a href="modules/sk_mesh.html">sk_mesh</a></li>
|
||||
<li><a href="modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><a href="modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><a href="modules/sk_math.html">sk_math</a></li>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/LuaMesh.html">LuaMesh</a></td>
|
||||
<td class="name" nowrap><a href="modules/sk_mesh.html">sk_mesh</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>skeletool64</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/sk_input.html">sk_input</a></li>
|
||||
<li><strong>LuaMesh</strong></li>
|
||||
<li><a href="../modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><a href="../modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><a href="../modules/sk_math.html">sk_math</a></li>
|
||||
<li><a href="../modules/sk_scene.html">sk_scene</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>LuaMesh</code></h1>
|
||||
<p></p>
|
||||
<p></p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#generate_mesh">generate_mesh (renderChunks, file[, changes])</a></td>
|
||||
<td class="summary">Generates a mesh</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "generate_mesh"></a>
|
||||
<strong>generate_mesh (renderChunks, file[, changes])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Generates a mesh
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">renderChunks</span>
|
||||
<span class="types"><span class="type">{RenderChunk,...}</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">file</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
suffix where the mesh definition is written to
|
||||
</li>
|
||||
<li><span class="parameter">changes</span>
|
||||
<span class="types"><span class="type">DisplayListOverrides</span></span>
|
||||
to the display list
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
|
@ -40,7 +40,7 @@
|
|||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/sk_input.html">sk_input</a></li>
|
||||
<li><a href="../modules/LuaMesh.html">LuaMesh</a></li>
|
||||
<li><a href="../modules/sk_mesh.html">sk_mesh</a></li>
|
||||
<li><a href="../modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><strong>sk_definition_writer</strong></li>
|
||||
<li><a href="../modules/sk_math.html">sk_math</a></li>
|
||||
|
@ -58,6 +58,10 @@
|
|||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_header">add_header (include)</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#reference_to">reference_to (value[, index])</a></td>
|
||||
<td class="summary">creates a pointer to another piece of data
|
||||
|
@ -131,6 +135,27 @@
|
|||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "add_header"></a>
|
||||
<strong>add_header (include)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">include</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "reference_to"></a>
|
||||
<strong>reference_to (value[, index])</strong>
|
||||
|
@ -481,7 +506,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -30,12 +30,16 @@
|
|||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><strong>sk_input</strong></li>
|
||||
<li><a href="../modules/LuaMesh.html">LuaMesh</a></li>
|
||||
<li><a href="../modules/sk_mesh.html">sk_mesh</a></li>
|
||||
<li><a href="../modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><a href="../modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><a href="../modules/sk_math.html">sk_math</a></li>
|
||||
|
@ -51,18 +55,87 @@
|
|||
<p></p>
|
||||
|
||||
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#settings">settings</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#input_filename">input_filename</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "settings"></a>
|
||||
<strong>settings</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">model_transform</span>
|
||||
<span class="types"><span class="type">sk_transform.Transform</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">fixed_point_transform</span>
|
||||
<span class="types"><span class="type">sk_transform.Transform</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">model_scale</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">fixed_point_scale</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "input_filename"></a>
|
||||
<strong>input_filename</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">bar</span>
|
||||
<span class="types"><span class="type">foo</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -33,14 +33,16 @@
|
|||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Class_Vector3">Class Vector3 </a></li>
|
||||
<li><a href="#Class_Box3">Class Box3 </a></li>
|
||||
<li><a href="#Class_Quaternion">Class Quaternion </a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/sk_input.html">sk_input</a></li>
|
||||
<li><a href="../modules/LuaMesh.html">LuaMesh</a></li>
|
||||
<li><a href="../modules/sk_mesh.html">sk_mesh</a></li>
|
||||
<li><a href="../modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><a href="../modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><strong>sk_math</strong></li>
|
||||
|
@ -63,6 +65,10 @@
|
|||
<td class="summary">creates a new 3d vector</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#isVector3">isVector3 (obj)</a></td>
|
||||
<td class="summary">determines if the input is a Vector3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#box3">box3 (min, max)</a></td>
|
||||
<td class="summary">creates a box3</td>
|
||||
</tr>
|
||||
|
@ -70,19 +76,75 @@
|
|||
<td class="name" nowrap><a href="#quaternion">quaternion (x, y, z, w)</a></td>
|
||||
<td class="summary">creates a new quaternion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#isQuaternion">isQuaternion (obj)</a></td>
|
||||
<td class="summary">determines if the input is a Quaternion</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<h2><a href="#Class_Vector3">Class Vector3 </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3">Vector3</a></td>
|
||||
<td class="name" nowrap><a href="#Vector3:__add">Vector3:__add (b)</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Box3">Box3</a></td>
|
||||
<td class="name" nowrap><a href="#Vector3:__sub">Vector3:__sub (b)</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Quaternion">Quaternion</a></td>
|
||||
<td class="name" nowrap><a href="#Vector3:__mul">Vector3:__mul (b)</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:__div">Vector3:__div (b)</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:magnitude">Vector3:magnitude ()</a></td>
|
||||
<td class="summary">Get the magnitude of the vector</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:min">Vector3:min (other)</a></td>
|
||||
<td class="summary">Get the magnitude of the vector</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:max">Vector3:max (other)</a></td>
|
||||
<td class="summary">Get the magnitude of the vector</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:dot">Vector3:dot (b)</a></td>
|
||||
<td class="summary">Get the dot product between two vectors</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:cross">Vector3:cross (b)</a></td>
|
||||
<td class="summary">Get the cross product between two vectors</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Vector3:lerp">Vector3:lerp (b)</a></td>
|
||||
<td class="summary">Linearly interpolates between two points</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Class_Box3">Class Box3 </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Box3:nearest_point_in_box">Box3:nearest_point_in_box (point)</a></td>
|
||||
<td class="summary">Returns the point inside or on the box that is nearest to the given point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Box3:distance_to_point">Box3:distance_to_point (point)</a></td>
|
||||
<td class="summary">Gets the distance from the box to the point
|
||||
If the box contains the point then the negative distance to
|
||||
the nearest edge is returned</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Box3:lerp">Box3:lerp ()</a></td>
|
||||
<td class="summary">Linearly interpolates between the min and max of the box</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Class_Quaternion">Class Quaternion </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Quaternion:conjugate">Quaternion:conjugate ()</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -128,6 +190,33 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "isVector3"></a>
|
||||
<strong>isVector3 (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
determines if the input is a Vector3
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><span class="type">any</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "box3"></a>
|
||||
|
@ -198,93 +287,400 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "isQuaternion"></a>
|
||||
<strong>isQuaternion (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
determines if the input is a Quaternion
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><span class="type">any</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
<h2 class="section-header "><a name="Class_Vector3"></a>Class Vector3 </h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Vector3"></a>
|
||||
<strong>Vector3</strong>
|
||||
<a name = "Vector3:__add"></a>
|
||||
<strong>Vector3:__add (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">z</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><span class="type">number</span> or <a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Box3"></a>
|
||||
<strong>Box3</strong>
|
||||
<a name = "Vector3:__sub"></a>
|
||||
<strong>Vector3:__sub (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">min</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">max</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><span class="type">number</span> or <a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Quaternion"></a>
|
||||
<strong>Quaternion</strong>
|
||||
<a name = "Vector3:__mul"></a>
|
||||
<strong>Vector3:__mul (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">x</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">y</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">z</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">w</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><span class="type">number</span> or <a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:__div"></a>
|
||||
<strong>Vector3:__div (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><span class="type">number</span> or <a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:magnitude"></a>
|
||||
<strong>Vector3:magnitude ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the magnitude of the vector
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:min"></a>
|
||||
<strong>Vector3:min (other)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the magnitude of the vector
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">other</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
vector
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:max"></a>
|
||||
<strong>Vector3:max (other)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the magnitude of the vector
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">other</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
vector
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:dot"></a>
|
||||
<strong>Vector3:dot (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the dot product between two vectors
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:cross"></a>
|
||||
<strong>Vector3:cross (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the cross product between two vectors
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Vector3:lerp"></a>
|
||||
<strong>Vector3:lerp (b)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Linearly interpolates between two points
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Class_Box3"></a>Class Box3 </h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Box3:nearest_point_in_box"></a>
|
||||
<strong>Box3:nearest_point_in_box (point)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the point inside or on the box that is nearest to the given point
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">point</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Box3:distance_to_point"></a>
|
||||
<strong>Box3:distance_to_point (point)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Gets the distance from the box to the point
|
||||
If the box contains the point then the negative distance to
|
||||
the nearest edge is returned
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">point</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Box3:lerp"></a>
|
||||
<strong>Box3:lerp ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Linearly interpolates between the min and max of the box
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Vector3">Vector3</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Class_Quaternion"></a>Class Quaternion </h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Quaternion:conjugate"></a>
|
||||
<strong>Quaternion:conjugate ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_math.html#Quaternion">Quaternion</a></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
@ -297,7 +693,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
268
skelatool64/doc/modules/sk_mesh.html
Normal file
268
skelatool64/doc/modules/sk_mesh.html
Normal file
|
@ -0,0 +1,268 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>skeletool64</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/sk_input.html">sk_input</a></li>
|
||||
<li><strong>sk_mesh</strong></li>
|
||||
<li><a href="../modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><a href="../modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><a href="../modules/sk_math.html">sk_math</a></li>
|
||||
<li><a href="../modules/sk_scene.html">sk_scene</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>sk_mesh</code></h1>
|
||||
<p></p>
|
||||
<p></p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#generate_render_chunks">generate_render_chunks (node)</a></td>
|
||||
<td class="summary">generate runder chunks for a node</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#generate_mesh">generate_mesh (renderChunks, file[, changes])</a></td>
|
||||
<td class="summary">Generates a mesh</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Material">Material</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Mesh">Mesh</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#RenderChunk">RenderChunk</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "generate_render_chunks"></a>
|
||||
<strong>generate_render_chunks (node)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
generate runder chunks for a node
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><span class="type">sk_scene.Node</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/sk_mesh.html#RenderChunk">{RenderChunk,...}</a></span>
|
||||
result
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "generate_mesh"></a>
|
||||
<strong>generate_mesh (renderChunks, file[, changes])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Generates a mesh
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">renderChunks</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_mesh.html#RenderChunk">{RenderChunk,...}</a></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">file</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
suffix where the mesh definition is written to
|
||||
</li>
|
||||
<li><span class="parameter">changes</span>
|
||||
<span class="types"><span class="type">DisplayListOverrides</span></span>
|
||||
to the display list
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Material"></a>
|
||||
<strong>Material</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">macro_name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Mesh"></a>
|
||||
<strong>Mesh</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">transform</span>
|
||||
<span class="types"><span class="type">sk_transform.Transform</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">vertices</span>
|
||||
<span class="types"><span class="type">{sk_math.Vector3,...}</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">normals</span>
|
||||
<span class="types"><span class="type">{sk_math.Vector3,...}</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">faces</span>
|
||||
<span class="types"><span class="type">{{number,number,number},...}</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">material</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_mesh.html#Material">Material</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "RenderChunk"></a>
|
||||
<strong>RenderChunk</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">bone_pair</span>
|
||||
<span class="types"><span class="type">{Bone,Bone}</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">mesh</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_mesh.html#Mesh">Mesh</a></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">meshRoot</span>
|
||||
<span class="types"><span class="type">sk_scene.Node</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">attached_dl_index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">material</span>
|
||||
<span class="types"><a class="type" href="../modules/sk_mesh.html#Material">Material</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
|
@ -40,7 +40,7 @@
|
|||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/sk_input.html">sk_input</a></li>
|
||||
<li><a href="../modules/LuaMesh.html">LuaMesh</a></li>
|
||||
<li><a href="../modules/sk_mesh.html">sk_mesh</a></li>
|
||||
<li><a href="../modules/sk_transform.html">sk_transform</a></li>
|
||||
<li><a href="../modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><a href="../modules/sk_math.html">sk_math</a></li>
|
||||
|
@ -244,7 +244,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/sk_input.html">sk_input</a></li>
|
||||
<li><a href="../modules/LuaMesh.html">LuaMesh</a></li>
|
||||
<li><a href="../modules/sk_mesh.html">sk_mesh</a></li>
|
||||
<li><strong>sk_transform</strong></li>
|
||||
<li><a href="../modules/sk_definition_writer.html">sk_definition_writer</a></li>
|
||||
<li><a href="../modules/sk_math.html">sk_math</a></li>
|
||||
|
@ -106,7 +106,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-12-18 16:40:03 </i>
|
||||
<i style="float:right;">Last updated 2022-12-18 19:38:08 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
local exports = {}
|
||||
|
||||
-- From LuaDefinitionWriter.cpp
|
||||
|
||||
---@function add_header
|
||||
---@tparam string include
|
||||
|
||||
local pending_definitions = {}
|
||||
|
||||
--- @table RefType
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
--- @module sk_math
|
||||
|
||||
local exports = {}
|
||||
|
||||
--- @table Vector3
|
||||
--- @tfield number x
|
||||
--- @tfield number y
|
||||
--- @tfield number z
|
||||
local Vector3 = {}
|
||||
|
||||
exports.Vector3 = exports
|
||||
local Box3 = {}
|
||||
local Quaternion = {}
|
||||
|
||||
--- creates a new 3d vector
|
||||
--- @function vector3
|
||||
|
@ -20,41 +14,14 @@ local function vector3(x, y, z)
|
|||
return setmetatable({ x = x, y = y, z = z }, Vector3)
|
||||
end
|
||||
|
||||
exports.vector3 = vector3
|
||||
|
||||
function Vector3.__add(a, b)
|
||||
if (type(a) == 'number') then
|
||||
return vector3(a + b.x, a + b.y, a + b.z)
|
||||
end
|
||||
|
||||
if (type(b) == 'number') then
|
||||
return vector3(a.x + b, a.y + b, a.z + b)
|
||||
end
|
||||
|
||||
if (type(b) ~= 'table' or type(b.x) ~= 'number' or type(b.y) ~= 'number' or type(b.z) ~= 'number') then
|
||||
error('Vector3.__add expected another vector as second operand')
|
||||
end
|
||||
|
||||
return vector3(a.x + b.x, a.y + b.y, a.z + b.z)
|
||||
end
|
||||
|
||||
function Vector3.__tostring(v)
|
||||
return 'vector3(' .. v.x .. ', ' .. v.y .. ', ' .. v.z .. ')'
|
||||
end
|
||||
|
||||
--- determines if the input is a Vector3
|
||||
--- @function isVector3
|
||||
--- @tparam any obj
|
||||
--- @treturn boolean
|
||||
local function isVector3(obj)
|
||||
return type(obj) == 'table' and type(obj.x) == 'number' and type(obj.y) == 'number' and type(obj.z) == 'number' and obj.w == nil
|
||||
end
|
||||
|
||||
exports.isVector3 = isVector3
|
||||
|
||||
--- @table Box3
|
||||
--- @tfield Vector3 min
|
||||
--- @tfield Vector3 max
|
||||
local Box3 = {}
|
||||
|
||||
exports.Box3 = Box3
|
||||
|
||||
--- creates a box3
|
||||
--- @function box3
|
||||
--- @tparam Vector3 min
|
||||
|
@ -64,17 +31,6 @@ local function box3(min, max)
|
|||
return setmetatable({ min = min, max = max }, Box3)
|
||||
end
|
||||
|
||||
exports.box3 = box3
|
||||
|
||||
--- @table Quaternion
|
||||
--- @tfield number x
|
||||
--- @tfield number y
|
||||
--- @tfield number z
|
||||
--- @tfield number w
|
||||
local Quaternion = {}
|
||||
|
||||
exports.Quaternion = Quaternion
|
||||
|
||||
--- creates a new quaternion
|
||||
--- @function quaternion
|
||||
--- @tparam number x the x value for the quaternion
|
||||
|
@ -86,13 +42,227 @@ local function quaternion(x, y, z, w)
|
|||
return setmetatable({ x = x, y = y, z = z, w = w }, Quaternion)
|
||||
end
|
||||
|
||||
exports.quaternion = quaternion
|
||||
|
||||
local function quaternionConjugate(input)
|
||||
return quaternion(-input.x, -input.y, -input.z, input.w)
|
||||
--- determines if the input is a Quaternion
|
||||
--- @function isQuaternion
|
||||
--- @tparam any obj
|
||||
--- @treturn boolean
|
||||
local function isQuaternion(obj)
|
||||
return type(obj) == 'table' and type(obj.x) == 'number' and type(obj.y) == 'number' and type(obj.z) == 'number' and type(obj.w) == 'number'
|
||||
end
|
||||
|
||||
exports.quaternionConjugate = quaternionConjugate
|
||||
--- @type Vector3
|
||||
--- @tfield number x
|
||||
--- @tfield number y
|
||||
--- @tfield number z
|
||||
Vector3.__index = Vector3;
|
||||
|
||||
--- @function __eq
|
||||
--- @tparam number|Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.__eq(a, b)
|
||||
if (type(a) == 'number') then
|
||||
return a == b.x and a == b.y and a == b.z
|
||||
end
|
||||
|
||||
if (type(b) == 'number') then
|
||||
return a.x == b and a.y == b and a.z + b
|
||||
end
|
||||
|
||||
if (not isVector3(b)) then
|
||||
error('Vector3.__add expected another vector as second operand')
|
||||
end
|
||||
|
||||
return a.x == b.x and a.y == b.y and a.z == b.z
|
||||
end
|
||||
|
||||
--- @function __add
|
||||
--- @tparam number|Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.__add(a, b)
|
||||
if (type(a) == 'number') then
|
||||
return vector3(a + b.x, a + b.y, a + b.z)
|
||||
end
|
||||
|
||||
if (type(b) == 'number') then
|
||||
return vector3(a.x + b, a.y + b, a.z + b)
|
||||
end
|
||||
|
||||
if (not isVector3(b)) then
|
||||
error('Vector3.__add expected another vector as second operand')
|
||||
end
|
||||
|
||||
return vector3(a.x + b.x, a.y + b.y, a.z + b.z)
|
||||
end
|
||||
|
||||
--- @function __sub
|
||||
--- @tparam number|Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.__sub(a, b)
|
||||
if (type(a) == 'number') then
|
||||
return vector3(a - b.x, a - b.y, a - b.z)
|
||||
end
|
||||
|
||||
if (type(b) == 'number') then
|
||||
return vector3(a.x - b, a.y - b, a.z - b)
|
||||
end
|
||||
|
||||
if (not isVector3(b)) then
|
||||
error('Vector3.__add expected another vector as second operand')
|
||||
end
|
||||
|
||||
return vector3(a.x - b.x, a.y - b.y, a.z - b.z)
|
||||
end
|
||||
|
||||
--- @function __mul
|
||||
--- @tparam number|Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.__mul(a, b)
|
||||
if (type(a) == 'number') then
|
||||
return vector3(a * b.x, a * b.y, a * b.z)
|
||||
end
|
||||
|
||||
if (type(b) == 'number') then
|
||||
return vector3(a.x * b, a.y * b, a.z * b)
|
||||
end
|
||||
|
||||
if (not isVector3(b)) then
|
||||
error('Vector3.__add expected another vector as second operand')
|
||||
end
|
||||
|
||||
return vector3(a.x * b.x, a.y * b.y, a.z * b.z)
|
||||
end
|
||||
|
||||
--- @function __div
|
||||
--- @tparam number|Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.__div(a, b)
|
||||
if (type(a) == 'number') then
|
||||
return vector3(a / b.x, a / b.y, a / b.z)
|
||||
end
|
||||
|
||||
if (type(b) == 'number') then
|
||||
local mul_value = 1 / b
|
||||
|
||||
return vector3(a.x * mul_value, a.y * mul_value, a.z * mul_value)
|
||||
end
|
||||
|
||||
if (not isVector3(b)) then
|
||||
error('Vector3.__add expected another vector as second operand')
|
||||
end
|
||||
|
||||
return vector3(a.x / b.x, a.y / b.y, a.z / b.z)
|
||||
end
|
||||
|
||||
function Vector3.__tostring(v)
|
||||
return 'vector3(' .. v.x .. ', ' .. v.y .. ', ' .. v.z .. ')'
|
||||
end
|
||||
|
||||
--- Get the magnitude of the vector
|
||||
--- @function magnitude
|
||||
--- @treturn number
|
||||
function Vector3.magnitude(v)
|
||||
return math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)
|
||||
end
|
||||
|
||||
--- Get the magnitude of the vector
|
||||
--- @function min
|
||||
--- @tparam Vector3 other vector
|
||||
--- @treturn Vector3
|
||||
function Vector3.min(a, b)
|
||||
return vector3(math.min(a.x, b.x), math.min(a.y, b.y), math.min(a.z, b.z))
|
||||
end
|
||||
|
||||
--- Get the magnitude of the vector
|
||||
--- @function max
|
||||
--- @tparam Vector3 other vector
|
||||
--- @treturn Vector3
|
||||
function Vector3.max(a, b)
|
||||
return vector3(math.max(a.x, b.x), math.max(a.y, b.y), math.max(a.z, b.z))
|
||||
end
|
||||
|
||||
--- Get the dot product between two vectors
|
||||
--- @function dot
|
||||
--- @tparam Vector3 b
|
||||
--- @treturn number
|
||||
function Vector3.dot(a, b)
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z
|
||||
end
|
||||
|
||||
--- Get the cross product between two vectors
|
||||
--- @function cross
|
||||
--- @tparam Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.cross(a, b)
|
||||
return vector3(
|
||||
a.y * b.z - a.z * b.y,
|
||||
a.z * b.x - a.x * b.z,
|
||||
a.x * b.y - a.y * b.x
|
||||
)
|
||||
end
|
||||
|
||||
--- Linearly interpolates between two points
|
||||
--- @function lerp
|
||||
--- @tparam Vector3 b
|
||||
--- @treturn Vector3
|
||||
function Vector3.lerp(a, b, lerp)
|
||||
return a * (1 - lerp) + b * lerp
|
||||
end
|
||||
|
||||
--- @type Box3
|
||||
--- @tfield Vector3 min
|
||||
--- @tfield Vector3 max
|
||||
Box3.__index = Box3;
|
||||
|
||||
--- Returns the point inside or on the box that is nearest to the given point
|
||||
--- @function nearest_point_in_box
|
||||
--- @tparam Vector3 point
|
||||
--- @treturn Vector3
|
||||
function Box3.nearest_point_in_box(box, point)
|
||||
return Vector3.min(box.max, point):max(box.min)
|
||||
end
|
||||
|
||||
--- Gets the distance from the box to the point
|
||||
--- If the box contains the point then the negative distance to
|
||||
--- the nearest edge is returned
|
||||
--- @function distance_to_point
|
||||
--- @tparam Vector3 point
|
||||
--- @treturn number
|
||||
function Box3.distance_to_point(box, point)
|
||||
local nearest_point = Box3.nearest_point_in_box(box, point)
|
||||
|
||||
if (nearest_point == point) then
|
||||
local max_offset = Vector3.__sub(point, box.max)
|
||||
local min_offset = Vector3.__sub(box.min, point)
|
||||
|
||||
return math.max(
|
||||
max_offset.x, max_offset.y, max_offset.z,
|
||||
min_offset.x, min_offset.y, min_offset.z
|
||||
)
|
||||
end
|
||||
|
||||
return (nearest_point - point):magnitude()
|
||||
end
|
||||
|
||||
|
||||
--- Linearly interpolates between the min and max of the box
|
||||
--- @function lerp
|
||||
--- @treturn Vector3
|
||||
function Box3.lerp(box, lerp)
|
||||
return Vector3.lerp(box.min, box.max, lerp)
|
||||
end
|
||||
|
||||
--- @type Quaternion
|
||||
--- @tfield number x
|
||||
--- @tfield number y
|
||||
--- @tfield number z
|
||||
--- @tfield number w
|
||||
Quaternion.__index = Quaternion;
|
||||
|
||||
--- @function conjugate
|
||||
--- @treturn Quaternion
|
||||
function Quaternion.conjugate(input)
|
||||
return quaternion(-input.x, -input.y, -input.z, input.w)
|
||||
end
|
||||
|
||||
function Quaternion.__tostring(v)
|
||||
return 'quaternion(' .. v.x .. ', ' .. v.y .. ', ' .. v.z .. ', ' .. v.w .. ')'
|
||||
|
@ -114,10 +284,13 @@ function Quaternion.__mul(a, b)
|
|||
end
|
||||
end
|
||||
|
||||
local function isQuaternion(obj)
|
||||
return type(obj) == 'table' and type(obj.x) == 'number' and type(obj.y) == 'number' and type(obj.z) == 'number' and type(obj.w) == 'number'
|
||||
end
|
||||
|
||||
exports.isQuaternion = isQuaternion
|
||||
|
||||
return exports
|
||||
return {
|
||||
vector3 = vector3,
|
||||
Vector3 = Vector3,
|
||||
isVector3 = isVector3,
|
||||
box3 = box3,
|
||||
Box3 = Box3,
|
||||
Quaternion = Quaternion,
|
||||
quaternion = quaternion,
|
||||
isQuaternion = isQuaternion,
|
||||
}
|
|
@ -34,6 +34,44 @@ end
|
|||
---@function nodes_for_type
|
||||
---@tparam string prefix the string prefix to search
|
||||
---@treturn NodeWithArguments
|
||||
exports.nodes_for_type = function(prefix)
|
||||
|
||||
end
|
||||
|
||||
---Finds a named value in a list of arguments
|
||||
---@function find_named_argument
|
||||
---@tfield {string,...} arg_list
|
||||
---@tfield string name
|
||||
---@treturn string|nil
|
||||
local function find_named_argument(arg_list, name)
|
||||
for i = 1,#arg_list do
|
||||
if (arg_list[i] == name) then
|
||||
return arg_list[i + 1]
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
exports.find_named_argument = find_named_argument
|
||||
|
||||
|
||||
---Finds a named value in a list of arguments
|
||||
---@function find_flag_argument
|
||||
---@tfield {string,...} arg_list
|
||||
---@tfield string name
|
||||
---@treturn boolean
|
||||
local function find_flag_argument(arg_list, name)
|
||||
for i = 1,#arg_list do
|
||||
if (arg_list[i] == name) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
exports.find_flag_argument = find_flag_argument
|
||||
|
||||
local function build_node_with_name_cache(node)
|
||||
node_name_cache[node.name] = node
|
||||
|
|
|
@ -13,7 +13,7 @@ bool bottomRightMost(const aiVector3D& a, const aiVector3D& b) {
|
|||
return a.y < b.y;
|
||||
}
|
||||
|
||||
return a.z - b.z;
|
||||
return a.z < b.z;
|
||||
}
|
||||
|
||||
const aiVector3D* findMostOppositeEdge(const aiVector3D& fromEdge, const std::vector<aiVector3D>& edges) {
|
||||
|
|
|
@ -58,6 +58,19 @@ void fromLua(lua_State* L, DisplayListSettings& result, const DisplayListSetting
|
|||
|
||||
}
|
||||
|
||||
/***
|
||||
@table settings
|
||||
@tfield sk_transform.Transform model_transform
|
||||
@tfield sk_transform.Transform fixed_point_transform
|
||||
@tfield number model_scale
|
||||
@tfield number fixed_point_scale
|
||||
*/
|
||||
|
||||
/***
|
||||
@table input_filename
|
||||
@tfield foo bar
|
||||
*/
|
||||
|
||||
int luaInputModuleLoader(lua_State* L) {
|
||||
lua_newtable(L);
|
||||
|
||||
|
@ -77,10 +90,10 @@ int luaInputModuleLoader(lua_State* L) {
|
|||
toLua(L, defaults->mFixedPointScale);
|
||||
lua_setfield(L, -2, "fixed_point_scale");
|
||||
|
||||
lua_setfield(L, -3, "settings");
|
||||
lua_setfield(L, -2, "settings");
|
||||
|
||||
lua_pushstring(L, levelFilename);
|
||||
lua_setfield(L, -3, "input_filename");
|
||||
lua_setfield(L, -2, "input_filename");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// @module LuaMesh
|
||||
/// @module sk_mesh
|
||||
|
||||
#include "LuaMesh.h"
|
||||
|
||||
|
@ -75,6 +75,11 @@ bool luaIsLazyVector3DArray(lua_State* L, int index) {
|
|||
return luaL_testudata(L, index, "aiVector3DArray");
|
||||
}
|
||||
|
||||
/***
|
||||
@table Material
|
||||
@tfield string name
|
||||
@tfield string macro_name
|
||||
*/
|
||||
void toLua(lua_State* L, Material* material) {
|
||||
if (!material) {
|
||||
lua_pushnil(L);
|
||||
|
@ -132,6 +137,17 @@ int luaTransformMesh(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/***
|
||||
@table Mesh
|
||||
@tfield string name
|
||||
@tfield bb sk_math.Box3
|
||||
@tfield sk_transform.Transform transform
|
||||
@tfield {sk_math.Vector3,...} vertices
|
||||
@tfield {sk_math.Vector3,...} normals
|
||||
@tfield {{number,number,number},...} faces
|
||||
@tfield Material material
|
||||
*/
|
||||
|
||||
void meshToLua(lua_State* L, std::shared_ptr<ExtendedMesh> mesh) {
|
||||
lua_createtable(L, 0, 1);
|
||||
|
||||
|
@ -176,6 +192,15 @@ void fromLua(lua_State*L, Bone *& bone) {
|
|||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
/***
|
||||
@table RenderChunk
|
||||
@tfield {Bone,Bone} bone_pair
|
||||
@tfield Mesh mesh
|
||||
@tfield sk_scene.Node meshRoot
|
||||
@tfield number attached_dl_index
|
||||
@tfield Material material
|
||||
*/
|
||||
|
||||
void toLua(lua_State* L, const RenderChunk& renderChunk) {
|
||||
lua_createtable(L, 0, 5);
|
||||
|
||||
|
@ -216,6 +241,13 @@ void fromLua(lua_State* L, RenderChunk& result) {
|
|||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
/***
|
||||
generate runder chunks for a node
|
||||
@function generate_render_chunks
|
||||
@tparam sk_scene.Node node
|
||||
@treturn {RenderChunk,...} result
|
||||
*/
|
||||
|
||||
int luaBuildRenderChunks(lua_State* L) {
|
||||
const aiScene* scene = (const aiScene*)lua_touserdata(L, lua_upvalueindex(1));
|
||||
CFileDefinition* fileDefinition = (CFileDefinition*)lua_touserdata(L, lua_upvalueindex(2));
|
||||
|
|
|
@ -113,8 +113,12 @@ int luaTransformMul(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
luaL_checkudata(L, 2, "aiMatrix4x4");
|
||||
return 0;
|
||||
aiVector3D asPoint;
|
||||
fromLua(L, asPoint);
|
||||
|
||||
toLua(L, (*a) * asPoint);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void generateLuaTransform(lua_State* L) {
|
||||
|
|
|
@ -23,14 +23,14 @@ void luaChainModuleLoader(lua_State* L, const char* moduleName, lua_CFunction fu
|
|||
lua_getglobal(L, "package");
|
||||
lua_getfield(L, -1, "preload");
|
||||
|
||||
lua_getfield(L, -1, "sk_scene");
|
||||
lua_getfield(L, -1, moduleName);
|
||||
|
||||
if (additionalClosure) {
|
||||
lua_rotate(L, startingTop - additionalClosure + 1, -additionalClosure);
|
||||
}
|
||||
|
||||
lua_pushcclosure(L, function, 1 + additionalClosure);
|
||||
lua_setfield(L, -2, "sk_scene");
|
||||
lua_setfield(L, -2, moduleName);
|
||||
|
||||
// pop package and preload
|
||||
lua_pop(L, 2);
|
||||
|
|
Loading…
Reference in a new issue