<div dir="ltr">It's all <a href="https://github.com/xoreos/xoreos/pull/159/files">here</a> or you could use <a href="https://github.com/seedhartha/xoreos/tree/kotoranim3" target="_blank">this</a> branch.<div><br></div><div>b there is a float array of MDX bone data.</div><div><br></div><div>For every vertex there are 8 float values, four of which are bone weights, four are bone identifiers (or -1 if no bone is used). Weights are normalized.</div><div><br></div><div>P.S. Already fixed skeleton falling through the floor</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-27 18:01 GMT+07:00 Bardot Jérôme <span dir="ltr"><<a href="mailto:bardot.jerome@gmail.com" target="_blank">bardot.jerome@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_8041118729166450523moz-cite-prefix">Can you send more code ? (a paste)<br>
<br>
what is your b ? <br><div><div class="h5">
<br>
<br>
<br>
Le 27/08/2017 à 10:26, Vsevolod Kremianskii a écrit :<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr"><span style="font-size:12.8px">Alright, it works.
Sort off. Except for that ugly mesh deformation issue. I
wonder if somebody could set me in the right direction from
here.</span>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">Here's how it's done:</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">I load position and orientation
controllers for every animation node, which pretty much does
it for the skeleton (also heads, since they're attached to the
headhook).</div>
<div style="font-size:12.8px">I load bone mapping from skin mesh
header and per vertex bone data from MDX (as described <a href="https://github.com/xoreos/xoreos-docs/blob/master/specs/kotor_mdl.html" target="_blank">here</a>).</div>
<div style="font-size:12.8px">When animation gets updated I
iterate through model's skinned nodes and for every vertex do
the following:</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">I iterate over nodes (bones) that
affect the vertex and create each node's global transformation
matrix (relative to the root node). Then I multiply initial
vertex coordinates by the transformation matrix and multiply
that by the bone weight. Resulting vertex coordinates are
calculated as a sum of four transformed vertices. There are
some optimizations in place so it isn't quite as bad as it
sounds.</div>
<div style="font-size:12.8px"><br>
</div>
<div>
<div style="font-size:12.8px"> <span style="white-space:pre-wrap"> </span>for
(uint32 i = 0; i < vertexCount; ++i) {</div>
<div style="font-size:12.8px">
<div> <span style="white-space:pre-wrap"> </span>v[0] = 0;</div>
<div> <span style="white-space:pre-wrap"> </span>v[1] = 0;</div>
<div> <span style="white-space:pre-wrap"> </span>v[2] = 0;</div>
<div> <span style="white-space:pre-wrap"> </span>for
(uint8 j = 0; j < 4; ++j) {</div>
<div> <span style="white-space:pre-wrap"> </span>int
index = static_cast<int>(b[4 + j]);</div>
<div> <span style="white-space:pre-wrap"> </span>if
(index != -1) {</div>
<div> <span style="white-space:pre-wrap"> </span>float
rv[3];</div>
<div> <span style="white-space:pre-wrap"> </span>transform
= transArr + (index * 16);</div>
<div> <span style="white-space:pre-wrap"> </span>transform.multiply(iv,
rv);</div>
<div> <span style="white-space:pre-wrap"> </span>v[0] +=
rv[0] * b[j];</div>
<div> <span style="white-space:pre-wrap"> </span>v[1] +=
rv[1] * b[j];</div>
<div> <span style="white-space:pre-wrap"> </span>v[2] +=
rv[2] * b[j];</div>
<div> <span style="white-space:pre-wrap"> </span>}</div>
<div> <span style="white-space:pre-wrap"> </span>}</div>
<div> <span style="white-space:pre-wrap"> </span>v +=
stride;</div>
<div> <span style="white-space:pre-wrap"> </span>iv += 3;</div>
<div> <span style="white-space:pre-wrap"> </span>b += 8;</div>
<div> <span style="white-space:pre-wrap"> </span>}</div>
</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">Now, the problem is that weird
stretching issue. I have no idea what could cause that at
the moment.</div>
<div style="font-size:12.8px"><a href="http://goog_555208919" target="_blank"><br>
</a></div>
<div><span style="font-size:12.8px"><a href="https://yadi.sk/i/0hnd2a0M3MMYJR" target="_blank">https://yadi.sk/i/<wbr>0hnd2a0M3MMYJR</a></span><br>
</div>
</div>
<div><span style="font-size:12.8px"><a href="https://yadi.sk/i/jdiTSrXZ3MMYL3" target="_blank">https://yadi.sk/i/<wbr>jdiTSrXZ3MMYL3</a></span><br>
</div>
<div><span style="font-size:12.8px"><a href="https://yadi.sk/i/Vm3kRTVf3MMYKQ" target="_blank">https://yadi.sk/i/<wbr>Vm3kRTVf3MMYKQ</a></span><br>
</div>
<div><span style="font-size:12.8px"><br>
</span></div>
</div>
<br>
<fieldset class="m_8041118729166450523mimeAttachmentHeader"></fieldset>
<br>
</div></div><span class=""><pre>______________________________<wbr>_________________
xoreos-devel mailing list
<a class="m_8041118729166450523moz-txt-link-abbreviated" href="mailto:xoreos-devel@xoreos.org" target="_blank">xoreos-devel@xoreos.org</a>
<a class="m_8041118729166450523moz-txt-link-freetext" href="https://xoreos.org/mailman/listinfo/xoreos-devel" target="_blank">https://xoreos.org/mailman/<wbr>listinfo/xoreos-devel</a>
</pre>
</span></blockquote>
<p><br>
</p>
</div>
<br>______________________________<wbr>_________________<br>
xoreos-devel mailing list<br>
<a href="mailto:xoreos-devel@xoreos.org">xoreos-devel@xoreos.org</a><br>
<a href="https://xoreos.org/mailman/listinfo/xoreos-devel" rel="noreferrer" target="_blank">https://xoreos.org/mailman/<wbr>listinfo/xoreos-devel</a><br>
<br></blockquote></div><br></div>