269 lines
7.5 KiB
HTML
269 lines
7.5 KiB
HTML
<!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>MTUL b3d reader/writer documentation</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>MTUL b3d</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/b3d_reader.html">b3d_reader</a></li>
|
|
<li><strong>b3d_nodes</strong></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Module <code>b3d_nodes</code></h1>
|
|
<p>allows you to get information about nodes (bones or meshes) within a b3d table (generated with <code>b3d_reader</code>)
|
|
located in <code>mtul.b3d_nodes</code>.</p>
|
|
<p> WARNING! mtul-cpml must be present for this module to run!</p>
|
|
|
|
|
|
<h2><a href="#Functions">Functions</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_node_by_name">get_node_by_name (self, node_name, is_bone)</a></td>
|
|
<td class="summary">get a node by it's name</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_animated_local_trs">get_animated_local_trs (node, target_frame)</a></td>
|
|
<td class="summary">get the local "TRS" (translation, rotation, scale) of a bone in animation.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_node_global_transform">get_node_global_transform (node, frame, outputs)</a></td>
|
|
<td class="summary">get a node's global mat4 transform and rotation.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_node_global_position">get_node_global_position (self, node, is_bone, frame)</a></td>
|
|
<td class="summary">find the position of a node in global model space.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_node_rotation">get_node_rotation (self, node, is_bone, frame)</a></td>
|
|
<td class="summary">find the global rotation of a node in model space.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "get_node_by_name"></a>
|
|
<strong>get_node_by_name (self, node_name, is_bone)</strong>
|
|
</dt>
|
|
<dd>
|
|
get a node by it's name
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
the b3d table (from b3d_reader)
|
|
</li>
|
|
<li><span class="parameter">node_name</span>
|
|
the name of the node to fine
|
|
</li>
|
|
<li><span class="parameter">is_bone</span>
|
|
(optional) bool to indicate wether the node is a bone or not (incase there's a mesh named the same thing). False will only return meshes and pivots, true will only return bones. Nil will return any.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
node (from b3d table, documentation needed)
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_animated_local_trs"></a>
|
|
<strong>get_animated_local_trs (node, target_frame)</strong>
|
|
</dt>
|
|
<dd>
|
|
get the local "TRS" (translation, rotation, scale) of a bone in animation. This is used for global transformation calculations.
|
|
quaternion is returned as a string indexed table because it needs to be a cpml object to be interpolated, also has to be usable anyway.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">node</span>
|
|
table, the node from within a b3d table to read (as outputed by b3d_reader).
|
|
</li>
|
|
<li><span class="parameter">target_frame</span>
|
|
float, the frame to find the TRS in, can be inbetween frames/keyframes (of course).
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
<li>
|
|
<code>position</code> ordered table: {x, y, z}</li>
|
|
<li>
|
|
<code>rotation</code> quat from <code>mtul_cpml</code>: (example) {w=0,x=0,y=0,z=1}</li>
|
|
<li>
|
|
<code>scale</code> ordered table: {x, y, z}
|
|
outputs need cleaning up.</li>
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_node_global_transform"></a>
|
|
<strong>get_node_global_transform (node, frame, outputs)</strong>
|
|
</dt>
|
|
<dd>
|
|
get a node's global mat4 transform and rotation.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">node</span>
|
|
table, the node from within a b3d table to read (as outputed by <code>b3d_reader</code>).
|
|
</li>
|
|
<li><span class="parameter">frame</span>
|
|
float, the frame to find the transform and rotation in.
|
|
</li>
|
|
<li><span class="parameter">outputs</span>
|
|
(optional) string, either "rotation" or "transform". Set to nil to return both.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
<li>
|
|
<code>global_transform</code>, a matrix 4x4, note that CPML's tranforms are column major (i.e. 1st column is 1, 2, 3, 4). (see <code>mtul_cpml</code> docs)</li>
|
|
<li>
|
|
<code>rotation quat</code>, the quaternion rotation in global space. (cannot be assumed to be normalized, this uses raw interpolated data from the b3d reader)</li>
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_node_global_position"></a>
|
|
<strong>get_node_global_position (self, node, is_bone, frame)</strong>
|
|
</dt>
|
|
<dd>
|
|
find the position of a node in global model space.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
b3d table, (optional if node is a node table and not name)
|
|
</li>
|
|
<li><span class="parameter">node</span>
|
|
string or table, either the node from b3d table or a the name of the node to find.
|
|
</li>
|
|
<li><span class="parameter">is_bone</span>
|
|
(optional) if node is string, this is used to find it (see <code>get_node_by_name</code>)
|
|
</li>
|
|
<li><span class="parameter">frame</span>
|
|
the frame to find the global position of the node at.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
<li>
|
|
<code>x</code></li>
|
|
<li>
|
|
<code>y</code></li>
|
|
<li>
|
|
<code>z</code></li>
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_node_rotation"></a>
|
|
<strong>get_node_rotation (self, node, is_bone, frame)</strong>
|
|
</dt>
|
|
<dd>
|
|
find the global rotation of a node in model space.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
b3d table, (optional if node is a node table and not name)
|
|
</li>
|
|
<li><span class="parameter">node</span>
|
|
string or table, either the node from b3d table or a the name of the node to find.
|
|
</li>
|
|
<li><span class="parameter">is_bone</span>
|
|
(optional) if node is string, this is used to find it (see <code>get_node_by_name</code>)
|
|
</li>
|
|
<li><span class="parameter">frame</span>
|
|
the frame to find the global rotation of the node at.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<code>rotation</code> quaternion rotation of the node (may not be normalized)
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
</div> <!-- id="content" -->
|
|
</div> <!-- id="main" -->
|
|
<div id="about">
|
|
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
|
<i style="float:right;">Last updated 2024-01-06 20:41:04 </i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|