ZealOS/docs/System/Gr/SpriteMesh.CC.html
TomAwezome 22e3d8f06e Clean up E1000 Driver.
Remove some palettes.
Add PaletteSetSlate.
Change all gr_palette_std to gr32_palette_std.
Change all CBGR48 to CBGR24.
2021-07-28 22:20:15 -04:00

1837 lines
199 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.11">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Mesh&quot;</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0> </span><span class=cFE>4000</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VF_SEL</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VF_COPIED</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VF_IGNORE</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CMeshEdVertex</span><span class=cF0>
<a name="l9"></a>{
<a name="l10"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *next, *last, *copy;
<a name="l11"></a>
<a name="l12"></a> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p; </span><span class=cF2>//World coordinates of the point.</span><span class=cF0>
<a name="l14"></a> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF1>end</span><span class=cF0>;
<a name="l15"></a>
<a name="l16"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p0,
<a name="l17"></a> pt; </span><span class=cF2>//Transformed coordinates.</span><span class=cF0> </span><span class=cF2>(Screen)</span><span class=cF0>
<a name="l18"></a> </span><span class=cF9>I32</span><span class=cF0> num, flags;
<a name="l19"></a>};
<a name="l20"></a>
<a name="l21"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>TF_SEL</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l22"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>TF_COPIED</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l23"></a>
<a name="l24"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CMeshEdTri</span><span class=cF0>
<a name="l25"></a>{
<a name="l26"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *next, *last;
<a name="l27"></a>
<a name="l28"></a> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF9>CMeshTri</span><span class=cF0> mt;
<a name="l30"></a> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF1>end</span><span class=cF0>;
<a name="l31"></a>
<a name="l32"></a> </span><span class=cF9>I32</span><span class=cF0> cpu_num, flags; </span><span class=cF2>//Draw different tris with different cores.</span><span class=cF0>
<a name="l33"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *t[</span><span class=cFE>3</span><span class=cF0>];
<a name="l34"></a>};
<a name="l35"></a>
<a name="l36"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CMeshFrame</span><span class=cF0>
<a name="l37"></a>{
<a name="l38"></a> </span><span class=cF9>I64</span><span class=cF0> mouse_z, thickness; </span><span class=cF2>//Mouse Z-coordinate</span><span class=cF0>
<a name="l39"></a> </span><span class=cF9>I64</span><span class=cF0> ed_mode, cx, cy;
<a name="l40"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> cur_color;
<a name="l41"></a> </span><span class=cF1>Bool</span><span class=cF0> grid_on, flip_y, sel_rect, vertex_on, closed, pad[</span><span class=cFE>3</span><span class=cF0>];
<a name="l42"></a> </span><span class=cF9>I64</span><span class=cF0> mp_not_done_flags; </span><span class=cF2>//Used for multiprocessing signaling.</span><span class=cF0>
<a name="l43"></a> </span><span class=cF1>F64</span><span class=cF0> view_scale;
<a name="l44"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc;
<a name="l45"></a> </span><span class=cF9>I32</span><span class=cF0> *depth_buf;
<a name="l46"></a> </span><span class=cF9>I64</span><span class=cF0> *w2s, *s2w; </span><span class=cF2>//Screen-to-world and world-to-screen transform matrices.</span><span class=cF0>
<a name="l47"></a> </span><span class=cF9>I64</span><span class=cF0> vertex_count, tri_count; </span><span class=cF2>//Set by MeshSize</span><span class=cF0>
<a name="l48"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> vertex_head, *cur_vertex, *chain_pred;
<a name="l49"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> tri_head, *cur_tri;
<a name="l50"></a> </span><span class=cF9>I64</span><span class=cF0> x1, y1, x2, y2, cur_snap;
<a name="l51"></a>};
<a name="l52"></a>
<a name="l53"></a></span><span class=cF9>CMeshEdVertex</span><span class=cF0> *</span><span class=cF5>MeshVertexNew</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0> z)
<a name="l54"></a>{
<a name="l55"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF7>)</span><span class=cF0>);
<a name="l56"></a>
<a name="l57"></a> tmpv-&gt;p.x = x;
<a name="l58"></a> tmpv-&gt;p.y = y;
<a name="l59"></a> tmpv-&gt;p.z = z;
<a name="l60"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpv, e-&gt;vertex_head.last);
<a name="l61"></a>
<a name="l62"></a> </span><span class=cF1>return</span><span class=cF0> tmpv;
<a name="l63"></a>}
<a name="l64"></a>
<a name="l65"></a></span><span class=cF9>CMeshEdTri</span><span class=cF0> *</span><span class=cF5>MeshTriNew</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CColorROPU32</span><span class=cF0> color, </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *v1, </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *v2, </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *v3)
<a name="l66"></a>{
<a name="l67"></a> </span><span class=cF1>static</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> cpu_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l68"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshEdTri</span><span class=cF7>)</span><span class=cF0>);
<a name="l69"></a>
<a name="l70"></a> tmpt-&gt;cpu_num = cpu_num++ % </span><span class=cFB>mp_count</span><span class=cF0>;
<a name="l71"></a> tmpt-&gt;mt.color = color;
<a name="l72"></a> tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>] = v1;
<a name="l73"></a> tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>] = v2;
<a name="l74"></a> tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>] = v3;
<a name="l75"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt, e-&gt;tri_head.last);
<a name="l76"></a>
<a name="l77"></a> </span><span class=cF1>return</span><span class=cF0> tmpt;
<a name="l78"></a>}
<a name="l79"></a>
<a name="l80"></a></span><span class=cF9>CMeshEdVertex</span><span class=cF0> *</span><span class=cF5>MeshVertexFindScrPt</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
<a name="l81"></a>{</span><span class=cF2>//Screen coordinates</span><span class=cF0>
<a name="l82"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *res = </span><span class=cF3>NULL</span><span class=cF0>, *tmpv = e-&gt;vertex_head.next;
<a name="l83"></a> </span><span class=cF9>I64</span><span class=cF0> dd, dz, best_dd = </span><span class=cF3>I64_MAX</span><span class=cF0>, best_dz = </span><span class=cF3>I64_MAX</span><span class=cF0>;
<a name="l84"></a>
<a name="l85"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l86"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpv-&gt;flags &amp; </span><span class=cF3>VF_IGNORE</span><span class=cF7>)</span><span class=cF0>)
<a name="l88"></a> {
<a name="l89"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(x - tmpv-&gt;pt.x) + </span><span class=cF5>SqrI64</span><span class=cF0>(y - tmpv-&gt;pt.y);
<a name="l90"></a> dz = </span><span class=cF5>AbsI64</span><span class=cF0>(e-&gt;mouse_z - tmpv-&gt;p.z);
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (dd &lt; best_dd || dd == best_dd &amp;&amp; dz &lt; best_dz)
<a name="l92"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l93"></a> res = tmpv;
<a name="l94"></a> best_dd = dd;
<a name="l95"></a> best_dz = dz;
<a name="l96"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l97"></a> }
<a name="l98"></a> tmpv = tmpv-&gt;next;
<a name="l99"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l100"></a>
<a name="l101"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l102"></a>}
<a name="l103"></a>
<a name="l104"></a></span><span class=cF9>CMeshEdVertex</span><span class=cF0> *</span><span class=cF5>MeshVertexFindNum</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *haystack_e, </span><span class=cF9>I64</span><span class=cF0> needle_num)
<a name="l105"></a>{
<a name="l106"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = haystack_e-&gt;vertex_head.next;
<a name="l107"></a>
<a name="l108"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;haystack_e-&gt;vertex_head)
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;num == needle_num)
<a name="l111"></a> </span><span class=cF1>return</span><span class=cF0> tmpv;
<a name="l112"></a> tmpv = tmpv-&gt;next;
<a name="l113"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l114"></a>
<a name="l115"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l116"></a>}
<a name="l117"></a>
<a name="l118"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshTriDel</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt)
<a name="l119"></a>{
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt)
<a name="l121"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt == e-&gt;cur_tri)
<a name="l123"></a> e-&gt;cur_tri = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l124"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpt);
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l127"></a>}
<a name="l128"></a>
<a name="l129"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv)
<a name="l130"></a>{
<a name="l131"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l132"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt, *tmpt1;
<a name="l133"></a>
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv)
<a name="l135"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l136"></a> tmpt = e-&gt;tri_head.next;
<a name="l137"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l138"></a> {
<a name="l139"></a> tmpt1 = tmpt-&gt;next;
<a name="l140"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>3</span><span class=cF0>; i++)
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;t[i] == tmpv)
<a name="l142"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l143"></a> </span><span class=cF1>if</span><span class=cF0> (i &lt; </span><span class=cFE>3</span><span class=cF0>)
<a name="l144"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(e, tmpt);
<a name="l145"></a> tmpt = tmpt1;
<a name="l146"></a> }
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv == e-&gt;cur_vertex)
<a name="l148"></a> e-&gt;cur_vertex = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv == e-&gt;chain_pred)
<a name="l150"></a> e-&gt;chain_pred = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l151"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpv);
<a name="l152"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpv);
<a name="l153"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l154"></a>}
<a name="l155"></a>
<a name="l156"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshFence</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l157"></a>{
<a name="l158"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv, *tmpv1, *tmpv_last = </span><span class=cF3>NULL</span><span class=cF0>, *tmpv1_last = </span><span class=cF3>NULL</span><span class=cF0>,
<a name="l159"></a> *</span><span class=cF1>start</span><span class=cF0> = e-&gt;chain_pred-&gt;next, *</span><span class=cF1>end</span><span class=cF0> = e-&gt;vertex_head.last;
<a name="l160"></a>
<a name="l161"></a> tmpv = </span><span class=cF1>start</span><span class=cF0>;
<a name="l162"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l163"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l164"></a> tmpv1 = </span><span class=cF5>MeshVertexNew</span><span class=cF0>(e, tmpv-&gt;p.x, tmpv-&gt;p.y, tmpv-&gt;p.z + e-&gt;thickness);
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv_last)
<a name="l166"></a> {
<a name="l167"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, e-&gt;cur_color, tmpv_last, tmpv, tmpv1);
<a name="l168"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, e-&gt;cur_color, tmpv1, tmpv1_last, tmpv_last);
<a name="l169"></a> }
<a name="l170"></a> tmpv_last = tmpv;
<a name="l171"></a> tmpv1_last = tmpv1;
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv == </span><span class=cF1>end</span><span class=cF0>)
<a name="l173"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l174"></a> tmpv = tmpv-&gt;next;
<a name="l175"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;closed &amp;&amp; tmpv_last)
<a name="l177"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l178"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, e-&gt;cur_color, tmpv_last, </span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>end</span><span class=cF0>-&gt;next);
<a name="l179"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, e-&gt;cur_color, </span><span class=cF1>end</span><span class=cF0>-&gt;next, tmpv1_last, tmpv_last);
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l181"></a>}
<a name="l182"></a>
<a name="l183"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshPolygon</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *</span><span class=cF1>end</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> rev)
<a name="l184"></a>{
<a name="l185"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv, *tmpv1;
<a name="l186"></a>
<a name="l187"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> != </span><span class=cF1>end</span><span class=cF0>)
<a name="l188"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l189"></a> tmpv = </span><span class=cF1>start</span><span class=cF0>;
<a name="l190"></a> tmpv1 = tmpv-&gt;next;
<a name="l191"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv1 != </span><span class=cF1>end</span><span class=cF0>)
<a name="l192"></a> {
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (rev)
<a name="l194"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, e-&gt;cur_color, tmpv1, tmpv, </span><span class=cF1>end</span><span class=cF0>);
<a name="l195"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l196"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, e-&gt;cur_color, tmpv, tmpv1, </span><span class=cF1>end</span><span class=cF0>);
<a name="l197"></a> tmpv = tmpv-&gt;next;
<a name="l198"></a> tmpv1 = tmpv1-&gt;next;
<a name="l199"></a> }
<a name="l200"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l201"></a>}
<a name="l202"></a>
<a name="l203"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshPrism</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l204"></a>{
<a name="l205"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *</span><span class=cF1>start</span><span class=cF0> = e-&gt;chain_pred-&gt;next, *</span><span class=cF1>end</span><span class=cF0> = e-&gt;vertex_head.last;
<a name="l206"></a>
<a name="l207"></a> </span><span class=cF5>MeshFence</span><span class=cF0>(e);
<a name="l208"></a> </span><span class=cF5>MeshPolygon</span><span class=cF0>(e, </span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>end</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l209"></a> </span><span class=cF5>MeshPolygon</span><span class=cF0>(e, </span><span class=cF1>end</span><span class=cF0>-&gt;next, e-&gt;vertex_head.last, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l210"></a>}
<a name="l211"></a>
<a name="l212"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF1>Bool</span><span class=cF0> val)
<a name="l213"></a>{
<a name="l214"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l215"></a>
<a name="l216"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l217"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l218"></a> </span><span class=cF1>if</span><span class=cF0> (val)
<a name="l219"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l220"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l221"></a> tmpv-&gt;flags &amp;= ~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l222"></a> tmpv = tmpv-&gt;next;
<a name="l223"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l224"></a>}
<a name="l225"></a>
<a name="l226"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF1>Bool</span><span class=cF0> val)
<a name="l227"></a>{
<a name="l228"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l229"></a>
<a name="l230"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l231"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (val)
<a name="l233"></a> tmpt-&gt;flags |= </span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l234"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l235"></a> tmpt-&gt;flags &amp;= ~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l236"></a> tmpt = tmpt-&gt;next;
<a name="l237"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l238"></a>}
<a name="l239"></a>
<a name="l240"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshVertexIgnoreSet</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF1>Bool</span><span class=cF0> val)
<a name="l241"></a>{
<a name="l242"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l243"></a>
<a name="l244"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l245"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l246"></a> tmpv-&gt;flags &amp;= ~</span><span class=cF3>VF_IGNORE</span><span class=cF0>;
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0> &amp;&amp; val)
<a name="l248"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_IGNORE</span><span class=cF0>;
<a name="l249"></a> tmpv = tmpv-&gt;next;
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l251"></a>}
<a name="l252"></a>
<a name="l253"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l254"></a>{
<a name="l255"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l256"></a>
<a name="l257"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l258"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l259"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpv-&gt;p0, &amp;tmpv-&gt;p, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l260"></a> tmpv = tmpv-&gt;next;
<a name="l261"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l262"></a>}
<a name="l263"></a>
<a name="l264"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> dx, </span><span class=cF9>I64</span><span class=cF0> dy, </span><span class=cF9>I64</span><span class=cF0> dz)
<a name="l265"></a>{
<a name="l266"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l267"></a>
<a name="l268"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l269"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l270"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l271"></a> {
<a name="l272"></a> tmpv-&gt;p.x = tmpv-&gt;p0.x + dx;
<a name="l273"></a> tmpv-&gt;p.y = tmpv-&gt;p0.y + dy;
<a name="l274"></a> tmpv-&gt;p.z = tmpv-&gt;p0.z + dz;
<a name="l275"></a> }
<a name="l276"></a> tmpv = tmpv-&gt;next;
<a name="l277"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l278"></a>}
<a name="l279"></a>
<a name="l280"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SEL_MESH_EQU</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>
<a name="l281"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SEL_MESH_OR</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l282"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SEL_MESH_AND</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l283"></a>
<a name="l284"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshVertexSelRect</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> sel_mode, </span><span class=cF9>I64</span><span class=cF0> x1, </span><span class=cF9>I64</span><span class=cF0> x2, </span><span class=cF9>I64</span><span class=cF0> y1, </span><span class=cF9>I64</span><span class=cF0> y2)
<a name="l285"></a>{
<a name="l286"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l287"></a>
<a name="l288"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &gt; x2)
<a name="l289"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;x1, &amp;x2);
<a name="l290"></a> </span><span class=cF1>if</span><span class=cF0> (y1 &gt; y2)
<a name="l291"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;y1, &amp;y2);
<a name="l292"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l293"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &lt;= tmpv-&gt;pt.x &lt;= x2 &amp;&amp; y1 &lt;= tmpv-&gt;pt.y &lt;= y2)
<a name="l295"></a> {
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (sel_mode == </span><span class=cF3>SEL_MESH_AND</span><span class=cF0>)
<a name="l297"></a> tmpv-&gt;flags &amp;= ~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l299"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l300"></a> }
<a name="l301"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sel_mode == </span><span class=cF3>SEL_MESH_EQU</span><span class=cF0>)
<a name="l302"></a> tmpv-&gt;flags &amp;= ~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l303"></a> tmpv = tmpv-&gt;next;
<a name="l304"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l305"></a>}
<a name="l306"></a>
<a name="l307"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshTriSelRect</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> sel_mode, </span><span class=cF9>I64</span><span class=cF0> x1, </span><span class=cF9>I64</span><span class=cF0> x2, </span><span class=cF9>I64</span><span class=cF0> y1, </span><span class=cF9>I64</span><span class=cF0> y2)
<a name="l308"></a>{
<a name="l309"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l310"></a>
<a name="l311"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &gt; x2)
<a name="l312"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;x1, &amp;x2);
<a name="l313"></a> </span><span class=cF1>if</span><span class=cF0> (y1 &gt; y2)
<a name="l314"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;y1, &amp;y2);
<a name="l315"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &lt;= tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt.x &lt;= x2 &amp;&amp;
<a name="l318"></a> y1 &lt;= tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt.y &lt;= y2 &amp;&amp;
<a name="l319"></a> x1 &lt;= tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt.x &lt;= x2 &amp;&amp;
<a name="l320"></a> y1 &lt;= tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt.y &lt;= y2 &amp;&amp;
<a name="l321"></a> x1 &lt;= tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt.x &lt;= x2 &amp;&amp;
<a name="l322"></a> y1 &lt;= tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt.y &lt;= y2)
<a name="l323"></a> {
<a name="l324"></a> </span><span class=cF1>if</span><span class=cF0> (sel_mode == </span><span class=cF3>SEL_MESH_AND</span><span class=cF0>)
<a name="l325"></a> tmpt-&gt;flags &amp;= ~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l326"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l327"></a> tmpt-&gt;flags |= </span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l328"></a> }
<a name="l329"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l330"></a> {
<a name="l331"></a> </span><span class=cF1>if</span><span class=cF0> (sel_mode == </span><span class=cF3>SEL_MESH_EQU</span><span class=cF0>)
<a name="l332"></a> tmpt-&gt;flags &amp;= ~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l333"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sel_mode == </span><span class=cF3>SEL_MESH_AND</span><span class=cF0>)
<a name="l334"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> ( x1 &lt;= tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt.x &lt;= x2 &amp;&amp;
<a name="l336"></a> y1 &lt;= tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt.y &lt;= y2 ||
<a name="l337"></a> x1 &lt;= tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt.x &lt;= x2 &amp;&amp;
<a name="l338"></a> y1 &lt;= tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt.y &lt;= y2 ||
<a name="l339"></a> x1 &lt;= tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt.x &lt;= x2 &amp;&amp;
<a name="l340"></a> y1 &lt;= tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt.y &lt;= y2)
<a name="l341"></a> tmpt-&gt;flags &amp;= ~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l342"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l343"></a> }
<a name="l344"></a> tmpt = tmpt-&gt;next;
<a name="l345"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l346"></a>}
<a name="l347"></a>
<a name="l348"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>MeshSelCount</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l349"></a>{
<a name="l350"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l351"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l352"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l353"></a>
<a name="l354"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l355"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l356"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l357"></a> res++;
<a name="l358"></a> tmpv = tmpv-&gt;next;
<a name="l359"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l360"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l361"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0>)
<a name="l363"></a> res++;
<a name="l364"></a> tmpt = tmpt-&gt;next;
<a name="l365"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l366"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l367"></a>}
<a name="l368"></a>
<a name="l369"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshSwapAxes</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> o1, </span><span class=cF9>I64</span><span class=cF0> o2)
<a name="l370"></a>{
<a name="l371"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l372"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l373"></a>
<a name="l374"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>)
<a name="l375"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l376"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l377"></a> unsel = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l378"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l379"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l380"></a> unsel = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l381"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l382"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l383"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l384"></a> </span><span class=cF5>SwapU32</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>&amp;tmpv-&gt;p</span><span class=cF7>)(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + o1, </span><span class=cF7>(</span><span class=cF0>&amp;tmpv-&gt;p</span><span class=cF7>)(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + o2);
<a name="l385"></a> tmpv = tmpv-&gt;next;
<a name="l386"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l387"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l388"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l389"></a>}
<a name="l390"></a>
<a name="l391"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshInvertAxis</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> o)
<a name="l392"></a>{
<a name="l393"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l394"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l395"></a>
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>)
<a name="l397"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l398"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l399"></a> unsel = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l400"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l401"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l402"></a> unsel = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l403"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l404"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l405"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l406"></a> *(</span><span class=cF7>(</span><span class=cF0>&amp;tmpv-&gt;p</span><span class=cF7>)(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + o)(</span><span class=cF9>I32</span><span class=cF0> *) = -*(</span><span class=cF7>(</span><span class=cF0>&amp;tmpv-&gt;p</span><span class=cF7>)(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + o)(</span><span class=cF9>I32</span><span class=cF0> *);
<a name="l407"></a> tmpv = tmpv-&gt;next;
<a name="l408"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l409"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l410"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l411"></a>}
<a name="l412"></a>
<a name="l413"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshTransformSel</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l414"></a>{
<a name="l415"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l416"></a> </span><span class=cF9>I64</span><span class=cF0> r[</span><span class=cFE>16</span><span class=cF0>], x, y, z;
<a name="l417"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l418"></a>
<a name="l419"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpTransform</span><span class=cF7>(</span><span class=cF0>r</span><span class=cF7>)</span><span class=cF0>)
<a name="l420"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l421"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>)
<a name="l422"></a> {
<a name="l423"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l424"></a> unsel = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l425"></a> }
<a name="l426"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l427"></a> unsel = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l428"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l429"></a> {
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l431"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l432"></a> x = tmpv-&gt;p.x;
<a name="l433"></a> y = tmpv-&gt;p.y;
<a name="l434"></a> z = tmpv-&gt;p.z;
<a name="l435"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l436"></a> tmpv-&gt;p.x = x;
<a name="l437"></a> tmpv-&gt;p.y = y;
<a name="l438"></a> tmpv-&gt;p.z = z;
<a name="l439"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l440"></a> tmpv = tmpv-&gt;next;
<a name="l441"></a> }
<a name="l442"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l443"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l444"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l445"></a>}
<a name="l446"></a>
<a name="l447"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshColorTris</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l448"></a>{
<a name="l449"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l450"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l451"></a>
<a name="l452"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>)
<a name="l453"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l454"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l455"></a> unsel = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l456"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l457"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l458"></a> unsel = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l459"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l460"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l461"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0>)
<a name="l462"></a> tmpt-&gt;mt.color = e-&gt;cur_color;
<a name="l463"></a> tmpt = tmpt-&gt;next;
<a name="l464"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l465"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l466"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l467"></a>}
<a name="l468"></a>
<a name="l469"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshRevTris</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l470"></a>{
<a name="l471"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l472"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l473"></a>
<a name="l474"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>)
<a name="l475"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l476"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l477"></a> unsel = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l478"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l479"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l480"></a> unsel = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l481"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l482"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l483"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0>)
<a name="l484"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>], &amp;tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]);
<a name="l485"></a> tmpt = tmpt-&gt;next;
<a name="l486"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l487"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l488"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l489"></a>}
<a name="l490"></a>
<a name="l491"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l492"></a>{
<a name="l493"></a> e-&gt;cx = </span><span class=cF5>RoundI64</span><span class=cF0>(task-&gt;pix_width / </span><span class=cFE>2</span><span class=cF0> - task-&gt;horz_scroll.pos, e-&gt;cur_snap);
<a name="l494"></a> e-&gt;cy = </span><span class=cF5>RoundI64</span><span class=cF0>(task-&gt;pix_height / </span><span class=cFE>2</span><span class=cF0> - task-&gt;vert_scroll.pos, e-&gt;cur_snap);
<a name="l495"></a>}
<a name="l496"></a>
<a name="l497"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l498"></a>{
<a name="l499"></a> </span><span class=cF9>I64</span><span class=cF0> x1, y1, z1, x2, y2, z2;
<a name="l500"></a>
<a name="l501"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;w2s)
<a name="l502"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l503"></a> x1 = e-&gt;cur_snap &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l504"></a> y1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l505"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l506"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s, &amp;x1, &amp;y1, &amp;z1);
<a name="l507"></a> x2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l508"></a> y2 = e-&gt;cur_snap &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l509"></a> z2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l510"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s, &amp;x2, &amp;y2, &amp;z2);
<a name="l511"></a> </span><span class=cFB>mouse_grid</span><span class=cF0>.x = </span><span class=cF5>Max</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF5>MaxI64</span><span class=cF7>(</span><span class=cF0>x1, x2</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>16</span><span class=cF0>);
<a name="l512"></a> </span><span class=cFB>mouse_grid</span><span class=cF0>.y = </span><span class=cF5>Max</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF5>MaxI64</span><span class=cF7>(</span><span class=cF0>y1, y2</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>16</span><span class=cF0>);
<a name="l513"></a> </span><span class=cFB>mouse_grid</span><span class=cF0>.z = </span><span class=cF5>Min</span><span class=cF0>(</span><span class=cFB>mouse_grid</span><span class=cF0>.x, </span><span class=cFB>mouse_grid</span><span class=cF0>.y);
<a name="l514"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l515"></a>}
<a name="l516"></a>
<a name="l517"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshScaleZoom</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF1>F64</span><span class=cF0> scale)
<a name="l518"></a>{
<a name="l519"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l520"></a> </span><span class=cF9>I64</span><span class=cF0> x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x - task-&gt;pix_left - task-&gt;scroll_x - task-&gt;pix_width / </span><span class=cFE>2</span><span class=cF0>,
<a name="l521"></a> y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y - task-&gt;pix_top - task-&gt;scroll_y - task-&gt;pix_height / </span><span class=cFE>2</span><span class=cF0>;
<a name="l522"></a>
<a name="l523"></a> task-&gt;horz_scroll.pos *= scale;
<a name="l524"></a> task-&gt;vert_scroll.pos *= scale;
<a name="l525"></a> task-&gt;horz_scroll.pos += scale * x - x;
<a name="l526"></a> task-&gt;vert_scroll.pos += scale * y - y;
<a name="l527"></a> e-&gt;view_scale *= scale;
<a name="l528"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(task, e);
<a name="l529"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(e);
<a name="l530"></a>}
<a name="l531"></a>
<a name="l532"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MPDrawIt</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l533"></a>{</span><span class=cF2>//Multiprocessing draw it, called by each core.</span><span class=cF0>
<a name="l534"></a>
<a name="l535"></a> </span><span class=cF2>//Makes a copy of e-&gt;dc so we can change dc-&gt;color member and stuff.</span><span class=cF0>
<a name="l536"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>(e-&gt;dc, e-&gt;dc-&gt;win_task);
<a name="l537"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l538"></a> </span><span class=cF9>I64</span><span class=cF0> i, *old_r = dc-&gt;r;
<a name="l539"></a>
<a name="l540"></a> </span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.CC.html#l182"><span class=cF4>DCAlias</span></a><span class=cF2>() allocs a new identity rotation matrix.</span><span class=cF0>
<a name="l541"></a> </span><span class=cF2>//We want e-&gt;dc's rotation matrix.</span><span class=cF0>
<a name="l542"></a> dc-&gt;r = e-&gt;dc-&gt;r;
<a name="l543"></a> dc-&gt;depth_buf = e-&gt;depth_buf;
<a name="l544"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;dc-&gt;ls, &amp;e-&gt;dc-&gt;ls, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l545"></a>
<a name="l546"></a> </span><span class=cF2>//... and translation (shift) vals.</span><span class=cF0>
<a name="l547"></a> dc-&gt;x = e-&gt;dc-&gt;x;
<a name="l548"></a> dc-&gt;y = e-&gt;dc-&gt;y;
<a name="l549"></a> dc-&gt;z = e-&gt;dc-&gt;z;
<a name="l550"></a> dc-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l551"></a>
<a name="l552"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;grid_on)
<a name="l553"></a></span><span class=cF2>//Draw grid with different cores.</span><span class=cF0>
<a name="l554"></a> </span><span class=cF1>for</span><span class=cF0> (i = -</span><span class=cFE>500</span><span class=cF0> + </span><span class=cFE>25</span><span class=cF0> * </span><span class=cF5>Gs</span><span class=cF0>-&gt;num; i &lt;= </span><span class=cFE>500</span><span class=cF0>; i += </span><span class=cFE>25</span><span class=cF0> * </span><span class=cFB>mp_count</span><span class=cF0>)
<a name="l555"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l556"></a> </span><span class=cF1>if</span><span class=cF0> (i)
<a name="l557"></a> {
<a name="l558"></a> dc-&gt;color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
<a name="l559"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, i, -</span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, i, </span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l560"></a> dc-&gt;color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l561"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, -</span><span class=cFE>500</span><span class=cF0>, i, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>500</span><span class=cF0>, i, </span><span class=cFE>0</span><span class=cF0>);
<a name="l562"></a> }
<a name="l563"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l564"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Gs</span><span class=cF0>-&gt;num)
<a name="l565"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l566"></a> dc-&gt;color = </span><span class=cF3>RED</span><span class=cF0>; </span><span class=cF2>//Y-Axis red</span><span class=cF0>
<a name="l567"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l568"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0>; </span><span class=cF2>//Y-Axis red</span><span class=cF0>
<a name="l569"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, -</span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l570"></a>
<a name="l571"></a> dc-&gt;color = </span><span class=cF3>YELLOW</span><span class=cF0>; </span><span class=cF2>//X-Axis yellow</span><span class=cF0>
<a name="l572"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l573"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>YELLOW</span><span class=cF0>; </span><span class=cF2>//X-Axis yellow</span><span class=cF0>
<a name="l574"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, -</span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l575"></a>
<a name="l576"></a> dc-&gt;color = </span><span class=cF3>GREEN</span><span class=cF0>; </span><span class=cF2>//Z-Axis green</span><span class=cF0>
<a name="l577"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>500</span><span class=cF0>);
<a name="l578"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>GREEN</span><span class=cF0>; </span><span class=cF2>//Z-Axis green</span><span class=cF0>
<a name="l579"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, -</span><span class=cFE>500</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l580"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l581"></a>
<a name="l582"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l583"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;cpu_num == </span><span class=cF5>Gs</span><span class=cF0>-&gt;num)
<a name="l585"></a> {
<a name="l586"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0>)
<a name="l587"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l588"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l589"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0>;
<a name="l590"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l591"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l592"></a> </span><span class=cF5>GrFillTri0</span><span class=cF0>(dc, &amp;tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt, &amp;tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt, &amp;tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt);
<a name="l593"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l594"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l595"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l596"></a> (*dc-&gt;lighting)(dc, &amp;tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt, &amp;tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt,
<a name="l597"></a> &amp;tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt, tmpt-&gt;mt.color);
<a name="l598"></a> </span><span class=cF5>GrFillTri0</span><span class=cF0>(dc, &amp;tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;pt, &amp;tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;pt, &amp;tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;pt);
<a name="l599"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l600"></a> }
<a name="l601"></a> tmpt = tmpt-&gt;next;
<a name="l602"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l603"></a> dc-&gt;r = old_r;
<a name="l604"></a>
<a name="l605"></a> </span><span class=cF2>//e-&gt;dc's depth buf was copied but we don't want it freed during </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.CC.html#l230"><span class=cF4>DCDel</span></a><span class=cF2>().</span><span class=cF0>
<a name="l606"></a> dc-&gt;depth_buf = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l607"></a>
<a name="l608"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l609"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;e-&gt;mp_not_done_flags, </span><span class=cF5>Gs</span><span class=cF0>-&gt;num);
<a name="l610"></a>}
<a name="l611"></a>
<a name="l612"></a></span><span class=cF9>I64</span><span class=cF0> *</span><span class=cF5>MeshW2S</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l613"></a>{</span><span class=cF2>//World to screen coordinate transform matrix.</span><span class=cF0>
<a name="l614"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c = </span><span class=cF5>CtrlFindUnique</span><span class=cF0>(task, </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>);
<a name="l615"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s = c-&gt;state;
<a name="l616"></a> </span><span class=cF9>I64</span><span class=cF0> *r = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>(task);
<a name="l617"></a>
<a name="l618"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(r, e-&gt;view_scale);
<a name="l619"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r, s-&gt;az);
<a name="l620"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r, s-&gt;ay);
<a name="l621"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;flip_y)
<a name="l622"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r, s-&gt;ax);
<a name="l623"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l624"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r, s-&gt;ax + </span><span class=cF3>pi</span><span class=cF0>);
<a name="l625"></a>
<a name="l626"></a> </span><span class=cF1>return</span><span class=cF0> r;
<a name="l627"></a>}
<a name="l628"></a>
<a name="l629"></a></span><span class=cF9>I64</span><span class=cF0> *</span><span class=cF5>MeshS2W</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l630"></a>{</span><span class=cF2>//Screen to world coordinate transform matrix.</span><span class=cF0>
<a name="l631"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c = </span><span class=cF5>CtrlFindUnique</span><span class=cF0>(task, </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>);
<a name="l632"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s = c-&gt;state;
<a name="l633"></a> </span><span class=cF9>I64</span><span class=cF0> *r = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>(task);
<a name="l634"></a>
<a name="l635"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;flip_y)
<a name="l636"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r, -s-&gt;ax);
<a name="l637"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l638"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r, -</span><span class=cF7>(</span><span class=cF0>s-&gt;ax + </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0>);
<a name="l639"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r, -s-&gt;ay);
<a name="l640"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r, -s-&gt;az);
<a name="l641"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(r, </span><span class=cFE>1</span><span class=cF0> / e-&gt;view_scale);
<a name="l642"></a>
<a name="l643"></a> </span><span class=cF1>return</span><span class=cF0> r;
<a name="l644"></a>}
<a name="l645"></a>
<a name="l646"></a></span><span class=cF9>I64</span><span class=cF0> *</span><span class=cF5>MeshSetW2S</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l647"></a>{
<a name="l648"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;w2s);
<a name="l649"></a> e-&gt;w2s = </span><span class=cF5>MeshW2S</span><span class=cF0>(e, task);
<a name="l650"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;s2w);
<a name="l651"></a> e-&gt;s2w = </span><span class=cF5>MeshS2W</span><span class=cF0>(e, task);
<a name="l652"></a></span><span class=cF2>//returned matrix is assigned to dc-&gt;r and will be freed by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.CC.html#l230"><span class=cF4>DCDel</span></a><span class=cF2>().</span><span class=cF0>
<a name="l653"></a>
<a name="l654"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Mat4x4New</span><span class=cF0>(e-&gt;w2s, task);
<a name="l655"></a>}
<a name="l656"></a>
<a name="l657"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshCursorW</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>I64</span><span class=cF0> *_x, </span><span class=cF9>I64</span><span class=cF0> *_y, </span><span class=cF9>I64</span><span class=cF0> *_z)
<a name="l658"></a>{
<a name="l659"></a> </span><span class=cF9>I64</span><span class=cF0> x_shadow, y_shadow, z_shadow,
<a name="l660"></a> xc = </span><span class=cFB>mouse</span><span class=cF0>.pos.x - task-&gt;pix_left - task-&gt;scroll_x - e-&gt;cx,
<a name="l661"></a> yc = </span><span class=cFB>mouse</span><span class=cF0>.pos.y - task-&gt;pix_top - task-&gt;scroll_y - e-&gt;cy,
<a name="l662"></a> zc = </span><span class=cFE>0</span><span class=cF0>, x = </span><span class=cFE>0</span><span class=cF0>, y = </span><span class=cFE>0</span><span class=cF0>, z = e-&gt;mouse_z, i, x2, y2, z2;
<a name="l663"></a>
<a name="l664"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s, &amp;x, &amp;y, &amp;z); </span><span class=cF2>//screen of Z vect</span><span class=cF0>
<a name="l665"></a>
<a name="l666"></a> </span><span class=cF2>//Converges onto a solution for zc, an unknown.</span><span class=cF0>
<a name="l667"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>128</span><span class=cF0>; i++)
<a name="l668"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l669"></a> x_shadow = xc - x; </span><span class=cF2>//Shadow of mouse cursor on xy plane</span><span class=cF0>
<a name="l670"></a> y_shadow = yc - y;
<a name="l671"></a> z_shadow = zc - z;
<a name="l672"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;s2w, &amp;x_shadow, &amp;y_shadow, &amp;z_shadow);
<a name="l673"></a> x2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l674"></a> y2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l675"></a> z2 = -z_shadow;
<a name="l676"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s, &amp;x2, &amp;y2, &amp;z2);
<a name="l677"></a> zc += </span><span class=cF5>Round</span><span class=cF0>(</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>x2 * x2 + y2 * y2 + z2 * z2</span><span class=cF7>)</span><span class=cF0>) * </span><span class=cF5>SignI64</span><span class=cF0>(z2);
<a name="l678"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l679"></a>
<a name="l680"></a> x = xc - x;
<a name="l681"></a> y = yc - y;
<a name="l682"></a> z = zc - z;
<a name="l683"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;s2w, &amp;x, &amp;y, &amp;z);
<a name="l684"></a> x = </span><span class=cF5>RoundI64</span><span class=cF0>(x, e-&gt;cur_snap);
<a name="l685"></a> y = </span><span class=cF5>RoundI64</span><span class=cF0>(y, e-&gt;cur_snap);
<a name="l686"></a> z = </span><span class=cF5>RoundI64</span><span class=cF0>(e-&gt;mouse_z, e-&gt;cur_snap);
<a name="l687"></a> *_x = x;
<a name="l688"></a> *_y = y;
<a name="l689"></a> *_z = z;
<a name="l690"></a>}
<a name="l691"></a>
<a name="l692"></a></span><span class=cF9>CMeshEdVertex</span><span class=cF0> </span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>;
<a name="l693"></a></span><span class=cF9>CMeshEdTri</span><span class=cF0> </span><span class=cFB>sys_clip_tri_head</span><span class=cF0>;
<a name="l694"></a>
<a name="l695"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipInit</span><span class=cF0>()
<a name="l696"></a>{
<a name="l697"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;</span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>);
<a name="l698"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;</span><span class=cFB>sys_clip_tri_head</span><span class=cF0>);
<a name="l699"></a>}
<a name="l700"></a>
<a name="l701"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipReset</span><span class=cF0>()
<a name="l702"></a>{
<a name="l703"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;</span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l704"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;</span><span class=cFB>sys_clip_tri_head</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l705"></a> </span><span class=cF5>MeshClipInit</span><span class=cF0>;
<a name="l706"></a>}
<a name="l707"></a>
<a name="l708"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipCopy</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l709"></a>{
<a name="l710"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next, *tmpv2;
<a name="l711"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next, *tmpt2;
<a name="l712"></a>
<a name="l713"></a> </span><span class=cF5>MeshClipReset</span><span class=cF0>;
<a name="l714"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l715"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l716"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l717"></a> {
<a name="l718"></a> tmpv-&gt;copy = tmpv2 = </span><span class=cF5>SysCAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF7>)</span><span class=cF0>);
<a name="l719"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpv2-&gt;p, &amp;tmpv-&gt;p, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l720"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpv2, </span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>.last);
<a name="l721"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_COPIED</span><span class=cF0>;
<a name="l722"></a> tmpv-&gt;flags &amp;= ~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l723"></a> }
<a name="l724"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l725"></a> {
<a name="l726"></a> tmpv-&gt;copy = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l727"></a> tmpv-&gt;flags &amp;= ~(</span><span class=cF3>VF_COPIED</span><span class=cF0> | </span><span class=cF3>VF_SEL</span><span class=cF0>);
<a name="l728"></a> }
<a name="l729"></a> tmpv = tmpv-&gt;next;
<a name="l730"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l731"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l732"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l733"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0> &amp;&amp; tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;copy &amp;&amp; tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;copy &amp;&amp; tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;copy)
<a name="l734"></a> {
<a name="l735"></a> tmpt2 = </span><span class=cF5>SysCAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshEdTri</span><span class=cF7>)</span><span class=cF0>);
<a name="l736"></a> tmpt2-&gt;t[</span><span class=cFE>0</span><span class=cF0>] = tmpt-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;copy;
<a name="l737"></a> tmpt2-&gt;t[</span><span class=cFE>1</span><span class=cF0>] = tmpt-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;copy;
<a name="l738"></a> tmpt2-&gt;t[</span><span class=cFE>2</span><span class=cF0>] = tmpt-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;copy;
<a name="l739"></a> tmpt2-&gt;mt.color = tmpt-&gt;mt.color;
<a name="l740"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt2, </span><span class=cFB>sys_clip_tri_head</span><span class=cF0>.last);
<a name="l741"></a> tmpt-&gt;flags |= </span><span class=cF3>TF_COPIED</span><span class=cF0>;
<a name="l742"></a> tmpt-&gt;flags &amp;= ~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l743"></a> }
<a name="l744"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l745"></a> tmpt-&gt;flags &amp;= ~(</span><span class=cF3>TF_COPIED</span><span class=cF0>|</span><span class=cF3>TF_SEL</span><span class=cF0>);
<a name="l746"></a> tmpt = tmpt-&gt;next;
<a name="l747"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l748"></a>}
<a name="l749"></a>
<a name="l750"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipCut</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l751"></a>{
<a name="l752"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next, *tmpv1;
<a name="l753"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next, *tmpt1;
<a name="l754"></a>
<a name="l755"></a> </span><span class=cF5>MeshClipCopy</span><span class=cF0>(e);
<a name="l756"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l757"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l758"></a> tmpt1 = tmpt-&gt;next;
<a name="l759"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_COPIED</span><span class=cF0>)
<a name="l760"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(e, tmpt);
<a name="l761"></a> tmpt = tmpt1;
<a name="l762"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l763"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l764"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l765"></a> tmpv1 = tmpv-&gt;next;
<a name="l766"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_COPIED</span><span class=cF0>)
<a name="l767"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(e, tmpv);
<a name="l768"></a> tmpv = tmpv1;
<a name="l769"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l770"></a>}
<a name="l771"></a>
<a name="l772"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipDel</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l773"></a>{</span><span class=cF2>//Technically not clip</span><span class=cF0>
<a name="l774"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next, *tmpv1;
<a name="l775"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next, *tmpt1;
<a name="l776"></a>
<a name="l777"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l778"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l779"></a> tmpt1 = tmpt-&gt;next;
<a name="l780"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0>)
<a name="l781"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(e, tmpt);
<a name="l782"></a> tmpt = tmpt1;
<a name="l783"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l784"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l785"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l786"></a> tmpv1 = tmpv-&gt;next;
<a name="l787"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l788"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(e, tmpv);
<a name="l789"></a> tmpv = tmpv1;
<a name="l790"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l791"></a>}
<a name="l792"></a>
<a name="l793"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipPaste</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l794"></a>{
<a name="l795"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv2 = </span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>.next, *tmpv;
<a name="l796"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt2 = </span><span class=cFB>sys_clip_tri_head</span><span class=cF0>.next, *tmpt;
<a name="l797"></a>
<a name="l798"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l799"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l800"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv2 != &amp;</span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>)
<a name="l801"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l802"></a> tmpv2-&gt;copy = tmpv = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF7>)</span><span class=cF0>);
<a name="l803"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpv-&gt;p, &amp;tmpv2-&gt;p, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l804"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpv, e-&gt;vertex_head.last);
<a name="l805"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l806"></a> tmpv2 = tmpv2-&gt;next;
<a name="l807"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l808"></a>
<a name="l809"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt2 != &amp;</span><span class=cFB>sys_clip_tri_head</span><span class=cF0>)
<a name="l810"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l811"></a> tmpt = </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, tmpt2-&gt;mt.color, tmpt2-&gt;t[</span><span class=cFE>0</span><span class=cF0>]-&gt;copy, tmpt2-&gt;t[</span><span class=cFE>1</span><span class=cF0>]-&gt;copy, tmpt2-&gt;t[</span><span class=cFE>2</span><span class=cF0>]-&gt;copy);
<a name="l812"></a> tmpt-&gt;flags |= </span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l813"></a> tmpt2 = tmpt2-&gt;next;
<a name="l814"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l815"></a>}
<a name="l816"></a>
<a name="l817"></a></span><span class=cF5>MeshClipInit</span><span class=cF0>;
<a name="l818"></a>
<a name="l819"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawIt</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l820"></a>{
<a name="l821"></a> </span><span class=cF9>CMeshFrame</span><span class=cF0> *e = </span><span class=cF5>FramePtr</span><span class=cF0>(</span><span class=cF6>&quot;CMeshFrame&quot;</span><span class=cF0>, task);
<a name="l822"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c = </span><span class=cF5>CtrlFindUnique</span><span class=cF0>(task, </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>);
<a name="l823"></a> </span><span class=cF1>F64</span><span class=cF0> d;
<a name="l824"></a> </span><span class=cF9>I64</span><span class=cF0> i, x, y, z;
<a name="l825"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv;
<a name="l826"></a>
<a name="l827"></a> task-&gt;horz_scroll.min = -(</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0> - task-&gt;pix_width) / </span><span class=cFE>2</span><span class=cF0>;
<a name="l828"></a> task-&gt;horz_scroll.max = (</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0> - task-&gt;pix_width) / </span><span class=cFE>2</span><span class=cF0>;
<a name="l829"></a> task-&gt;vert_scroll.min = -(</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0> - task-&gt;pix_height) / </span><span class=cFE>2</span><span class=cF0>;
<a name="l830"></a> task-&gt;vert_scroll.max = (</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0> - task-&gt;pix_height) / </span><span class=cFE>2</span><span class=cF0>;
<a name="l831"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
<a name="l832"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(task, e);
<a name="l833"></a>
<a name="l834"></a> dc-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l835"></a>
<a name="l836"></a> </span><span class=cF5>Free</span><span class=cF0>(dc-&gt;r); </span><span class=cF2>//Set rotmat doesn't free old dc-&gt;r matrix.</span><span class=cF0>
<a name="l837"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc, </span><span class=cF5>MeshSetW2S</span><span class=cF7>(</span><span class=cF0>e, task</span><span class=cF7>)</span><span class=cF0>);
<a name="l838"></a>
<a name="l839"></a> dc-&gt;x = e-&gt;cx;
<a name="l840"></a> dc-&gt;y = e-&gt;cy;
<a name="l841"></a></span><span class=cF2>//z-vals less than zero are in front of screen and not drawn.</span><span class=cF0>
<a name="l842"></a> </span><span class=cF2>//we want to shift all Z-vals into a drawable range.</span><span class=cF0>
<a name="l843"></a> </span><span class=cF2>//GR_Z_ALL is set to half of the Z-range which is an I32.</span><span class=cF0>
<a name="l844"></a> dc-&gt;z = </span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
<a name="l845"></a>
<a name="l846"></a> </span><span class=cF2>//Light source set to mouse.</span><span class=cF0>
<a name="l847"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(e, task, &amp;x, &amp;y, &amp;z);
<a name="l848"></a> dc-&gt;ls.x = x;
<a name="l849"></a> dc-&gt;ls.y = y;
<a name="l850"></a> dc-&gt;ls.z = z;
<a name="l851"></a> d = </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> / </span><span class=cF5>D3I32Norm</span><span class=cF0>(&amp;dc-&gt;ls); </span><span class=cF2>//Light source normalized to 65536.</span><span class=cF0>
<a name="l852"></a> dc-&gt;ls.x *= d;
<a name="l853"></a> dc-&gt;ls.y *= d;
<a name="l854"></a> dc-&gt;ls.z *= d;
<a name="l855"></a>
<a name="l856"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l857"></a>
<a name="l858"></a> tmpv = e-&gt;vertex_head.next;
<a name="l859"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l860"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l861"></a> x = tmpv-&gt;p.x;
<a name="l862"></a> y = tmpv-&gt;p.y;
<a name="l863"></a> z = tmpv-&gt;p.z;
<a name="l864"></a> (*dc-&gt;transform)(dc, &amp;x, &amp;y, &amp;z);
<a name="l865"></a> tmpv-&gt;pt.x = x;
<a name="l866"></a> tmpv-&gt;pt.y = y;
<a name="l867"></a> tmpv-&gt;pt.z = z;
<a name="l868"></a> tmpv = tmpv-&gt;next;
<a name="l869"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l870"></a>
<a name="l871"></a> e-&gt;mp_not_done_flags = </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cFB>mp_count</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>; </span><span class=cF2>//Issue jobs to all cores.</span><span class=cF0>
<a name="l872"></a> e-&gt;dc = dc;
<a name="l873"></a> e-&gt;depth_buf = dc-&gt;depth_buf;
<a name="l874"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFB>mp_count</span><span class=cF0>; i++)
<a name="l875"></a> </span><span class=cF5>JobQueue</span><span class=cF0>(&amp;</span><span class=cF5>MPDrawIt</span><span class=cF0>, e, i);
<a name="l876"></a>
<a name="l877"></a> tmpv = e-&gt;vertex_head.next;
<a name="l878"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l879"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l880"></a> x = tmpv-&gt;pt.x;
<a name="l881"></a> y = tmpv-&gt;pt.y;
<a name="l882"></a> z = tmpv-&gt;pt.z;
<a name="l883"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;vertex_on)
<a name="l884"></a> {
<a name="l885"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>10</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF2>//This blinks at 10 Hz.</span><span class=cF0>
<a name="l886"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l887"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l888"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l889"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, x - </span><span class=cFE>3</span><span class=cF0>, y - </span><span class=cFE>3</span><span class=cF0>, x + </span><span class=cFE>3</span><span class=cF0>, y + </span><span class=cFE>3</span><span class=cF0>);
<a name="l890"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, x - </span><span class=cFE>3</span><span class=cF0>, y + </span><span class=cFE>3</span><span class=cF0>, x + </span><span class=cFE>3</span><span class=cF0>, y - </span><span class=cFE>3</span><span class=cF0>);
<a name="l891"></a> }
<a name="l892"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags &amp; </span><span class=cF3>VF_SEL</span><span class=cF0>)
<a name="l893"></a> {
<a name="l894"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;ed_mode == </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l895"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l896"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>10</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF2>//This blinks at 10 Hz.</span><span class=cF0>
<a name="l897"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + e-&gt;cur_color.c0.color &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + e-&gt;cur_color.c0.color ^ </span><span class=cFE>8</span><span class=cF0>;
<a name="l898"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l899"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + (e-&gt;cur_color.c0.color ^ </span><span class=cFE>8</span><span class=cF0>) &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + e-&gt;cur_color.c0.color;
<a name="l900"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l901"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l902"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l903"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l904"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l905"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l906"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0>;
<a name="l907"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l908"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, x, y, </span><span class=cFE>3</span><span class=cF0>);
<a name="l909"></a> }
<a name="l910"></a> tmpv = tmpv-&gt;next;
<a name="l911"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l912"></a>
<a name="l913"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>CtrlInside</span><span class=cF7>(</span><span class=cF0>c, </span><span class=cFB>mouse</span><span class=cF0>.presnap.x, </span><span class=cFB>mouse</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0> || </span><span class=cFB>winmgr</span><span class=cF0>.show_menu)
<a name="l914"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l915"></a> </span><span class=cF5>GridInit</span><span class=cF0>;
<a name="l916"></a> task-&gt;win_inhibit = </span><span class=cF3>WIF_SELF_DOC</span><span class=cF0>;
<a name="l917"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l918"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l919"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l920"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(e);
<a name="l921"></a> task-&gt;win_inhibit = </span><span class=cF3>WIG_TASK_DEFAULT</span><span class=cF0> |
<a name="l922"></a> </span><span class=cF3>WIF_SELF_DOC</span><span class=cF0> - </span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0> - </span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0> - </span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0> - </span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0> - </span><span class=cF3>WIF_SELF_GRAB_SCROLL</span><span class=cF0>;
<a name="l923"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l924"></a>
<a name="l925"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(e, task, &amp;x, &amp;y, &amp;z);
<a name="l926"></a> </span><span class=cF1>if</span><span class=cF0> (z &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l927"></a> dc-&gt;color = </span><span class=cF3>ROP_XOR</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0> ^ </span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l928"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l929"></a> dc-&gt;color = </span><span class=cF3>ROP_XOR</span><span class=cF0> + </span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l930"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>&quot;%6.3f%% (%d,%d,%d)&quot;</span><span class=cF0>, e-&gt;view_scale * </span><span class=cFE>100</span><span class=cF0>, x, y, z);
<a name="l931"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l932"></a> dc-&gt;color &amp;= </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l933"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>10</span><span class=cF7>)</span><span class=cF0>)
<a name="l934"></a> dc-&gt;color ^= </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l935"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x, y, z, x, y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l936"></a>
<a name="l937"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;sel_rect)
<a name="l938"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l939"></a> dc-&gt;flags &amp;= ~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l940"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l941"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l942"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l943"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l944"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0>;
<a name="l945"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, e-&gt;x1, e-&gt;y1, e-&gt;x2, e-&gt;y2);
<a name="l946"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l947"></a></span><span class=cF2>//Wait for all cores to complete.</span><span class=cF0>
<a name="l948"></a> </span><span class=cF1>while</span><span class=cF0> (e-&gt;mp_not_done_flags)
<a name="l949"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l950"></a>}
<a name="l951"></a>
<a name="l952"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshInit</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF1>Bool</span><span class=cF0> flip_y)
<a name="l953"></a>{
<a name="l954"></a> </span><span class=cF5>MemSet</span><span class=cF0>(e, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshFrame</span><span class=cF7>)</span><span class=cF0>);
<a name="l955"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;e-&gt;vertex_head);
<a name="l956"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;e-&gt;tri_head);
<a name="l957"></a> e-&gt;ed_mode = </span><span class=cF6>'v'</span><span class=cF0>;
<a name="l958"></a> e-&gt;grid_on = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l959"></a> e-&gt;vertex_on = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l960"></a> e-&gt;mouse_z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l961"></a> e-&gt;thickness = </span><span class=cFE>25</span><span class=cF0>;
<a name="l962"></a> e-&gt;closed = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l963"></a> e-&gt;view_scale = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l964"></a> e-&gt;w2s = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l965"></a> e-&gt;s2w = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l966"></a> e-&gt;cur_color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l967"></a> e-&gt;cur_snap = </span><span class=cFE>5</span><span class=cF0>;
<a name="l968"></a> e-&gt;flip_y = flip_y;
<a name="l969"></a> e-&gt;sel_rect = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l970"></a> e-&gt;cur_tri = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l971"></a> e-&gt;cur_vertex = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l972"></a> e-&gt;chain_pred = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l973"></a>}
<a name="l974"></a>
<a name="l975"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshLoad</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF1>U8</span><span class=cF0> *src)
<a name="l976"></a>{
<a name="l977"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, x, y, z;
<a name="l978"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> color;
<a name="l979"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv, *va[</span><span class=cFE>3</span><span class=cF0>];
<a name="l980"></a>
<a name="l981"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;e-&gt;vertex_head);
<a name="l982"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;e-&gt;tri_head);
<a name="l983"></a>
<a name="l984"></a> e-&gt;vertex_count = *src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l985"></a> e-&gt;tri_count = *src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l986"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; e-&gt;vertex_count; i++)
<a name="l987"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l988"></a> x = *src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l989"></a> y = *src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l990"></a> z = *src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l991"></a> tmpv = </span><span class=cF5>MeshVertexNew</span><span class=cF0>(e, x, y, z);
<a name="l992"></a> tmpv-&gt;num = i;
<a name="l993"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l994"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; e-&gt;tri_count; i++)
<a name="l995"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l996"></a> color = *src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l997"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; </span><span class=cFE>3</span><span class=cF0>; j++)
<a name="l998"></a> va[j] = </span><span class=cF5>MeshVertexFindNum</span><span class=cF0>(e, *src</span><span class=cF7>(</span><span class=cF9>I32</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
<a name="l999"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e, color, va[</span><span class=cFE>0</span><span class=cF0>], va[</span><span class=cFE>1</span><span class=cF0>], va[</span><span class=cFE>2</span><span class=cF0>]);
<a name="l1000"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1001"></a>}
<a name="l1002"></a>
<a name="l1003"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>MeshSize</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l1004"></a>{
<a name="l1005"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l1006"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l1007"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l1008"></a>
<a name="l1009"></a> e-&gt;vertex_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1010"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l1011"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1012"></a> tmpv-&gt;num = e-&gt;vertex_count++;
<a name="l1013"></a> tmpv = tmpv-&gt;next;
<a name="l1014"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1015"></a>
<a name="l1016"></a> e-&gt;tri_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1017"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l1018"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1019"></a> e-&gt;tri_count++;
<a name="l1020"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>3</span><span class=cF0>; i++)
<a name="l1021"></a> tmpt-&gt;mt.nums[i] = tmpt-&gt;t[i]-&gt;num;
<a name="l1022"></a> tmpt = tmpt-&gt;next;
<a name="l1023"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1024"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>I32</span><span class=cF0>) * </span><span class=cFE>2</span><span class=cF0> + (</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF0>.</span><span class=cF1>end</span><span class=cF7>)</span><span class=cF0> - </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>) * e-&gt;vertex_count +
<a name="l1025"></a> (</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdTri</span><span class=cF0>.</span><span class=cF1>end</span><span class=cF7>)</span><span class=cF0> - </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdTri</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>) * e-&gt;tri_count;
<a name="l1026"></a>}
<a name="l1027"></a>
<a name="l1028"></a></span><span class=cF9>I32</span><span class=cF0> *</span><span class=cF5>MeshSave</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e, </span><span class=cF9>I64</span><span class=cF0> *_size=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l1029"></a>{
<a name="l1030"></a> </span><span class=cF9>I64</span><span class=cF0> size = </span><span class=cF5>MeshSize</span><span class=cF0>(e);
<a name="l1031"></a> </span><span class=cF1>U8</span><span class=cF0> *res = </span><span class=cF5>MAlloc</span><span class=cF0>(size), *dst = res;
<a name="l1032"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv = e-&gt;vertex_head.next;
<a name="l1033"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt = e-&gt;tri_head.next;
<a name="l1034"></a>
<a name="l1035"></a> *dst(</span><span class=cF9>I32</span><span class=cF0> *)++ = e-&gt;vertex_count;
<a name="l1036"></a> *dst(</span><span class=cF9>I32</span><span class=cF0> *)++ = e-&gt;tri_count;
<a name="l1037"></a>
<a name="l1038"></a> e-&gt;vertex_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1039"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv != &amp;e-&gt;vertex_head)
<a name="l1040"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1041"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(dst, &amp;tmpv-&gt;</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF0>.</span><span class=cF1>end</span><span class=cF7>)</span><span class=cF0>
<a name="l1042"></a> -</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdVertex</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>);
<a name="l1043"></a> dst += </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CMeshEdVertex</span><span class=cF0>.</span><span class=cF1>end</span><span class=cF0>) - </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CMeshEdVertex</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF0>);
<a name="l1044"></a> tmpv = tmpv-&gt;next;
<a name="l1045"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1046"></a>
<a name="l1047"></a> e-&gt;tri_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1048"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;e-&gt;tri_head)
<a name="l1049"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1050"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(dst, &amp;tmpt-&gt;</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdTri</span><span class=cF0>.</span><span class=cF1>end</span><span class=cF7>)</span><span class=cF0> - </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CMeshEdTri</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>);
<a name="l1051"></a> dst += </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CMeshEdTri</span><span class=cF0>.</span><span class=cF1>end</span><span class=cF0>) - </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CMeshEdTri</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF0>);
<a name="l1052"></a> tmpt = tmpt-&gt;next;
<a name="l1053"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1054"></a> </span><span class=cF1>if</span><span class=cF0> (_size)
<a name="l1055"></a> *_size = size;
<a name="l1056"></a>
<a name="l1057"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1058"></a>}
<a name="l1059"></a>
<a name="l1060"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshCleanUp</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l1061"></a>{
<a name="l1062"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;e-&gt;vertex_head, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1063"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;e-&gt;tri_head, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1064"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;w2s);
<a name="l1065"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;s2w);
<a name="l1066"></a>}
<a name="l1067"></a>
<a name="l1068"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshUpdateMenu</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l1069"></a>{
<a name="l1070"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
<a name="l1071"></a>
<a name="l1072"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;View/Grid&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1073"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;grid_on);
<a name="l1074"></a>
<a name="l1075"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;View/Vertex&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1076"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;vertex_on);
<a name="l1077"></a>
<a name="l1078"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/PlaceVertex&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1079"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'v'</span><span class=cF0>);
<a name="l1080"></a>
<a name="l1081"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/MoveVertex&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1082"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'m'</span><span class=cF0>);
<a name="l1083"></a>
<a name="l1084"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/MoveVertexZ&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1085"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'M'</span><span class=cF0>);
<a name="l1086"></a>
<a name="l1087"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/Triangle&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1088"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'t'</span><span class=cF0>);
<a name="l1089"></a>
<a name="l1090"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/Polygon&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1091"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'n'</span><span class=cF0>);
<a name="l1092"></a>
<a name="l1093"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/Fence&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1094"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'f'</span><span class=cF0>);
<a name="l1095"></a>
<a name="l1096"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;Mode/Prism&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1097"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;ed_mode == </span><span class=cF6>'p'</span><span class=cF0>);
<a name="l1098"></a>
<a name="l1099"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu, </span><span class=cF6>&quot;View/FlipY&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l1100"></a> tmpse-&gt;checked = </span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;flip_y);
<a name="l1101"></a>}
<a name="l1102"></a>
<a name="l1103"></a></span><span class=cF9>I32</span><span class=cF0> *</span><span class=cF5>SpriteMeshEd</span><span class=cF0>(</span><span class=cF9>I32</span><span class=cF0> *head=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> *_size=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> flip_y=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l1104"></a>{</span><span class=cF2>/*Format for mesh:</span><span class=cF0>
<a name="l1105"></a></span><span class=cF2>{</span><span class=cF0>
<a name="l1106"></a></span><span class=cF2>I32 vertex_count;</span><span class=cF0>
<a name="l1107"></a></span><span class=cF2>I32 tri_count;</span><span class=cF0>
<a name="l1108"></a></span><span class=cF2>CD3I32 vertices[];</span><span class=cF0>
<a name="l1109"></a></span><span class=cF2>CMeshTri tris[];</span><span class=cF0>
<a name="l1110"></a></span><span class=cF2>}</span><span class=cF0>
<a name="l1111"></a>
<a name="l1112"></a></span><span class=cF2>If head points to a mesh, it will load it.</span><span class=cF0>
<a name="l1113"></a>
<a name="l1114"></a></span><span class=cF2>Returns a newly malloced mesh or NULL.</span><span class=cF0>
<a name="l1115"></a>
<a name="l1116"></a></span><span class=cF2>See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Graphics/SpritePlot3D.CC.html#l1"><span class=cF4>::/Demo/Graphics/SpritePlot3D.CC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l1117"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l1118"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c = </span><span class=cF5>CtrlFindUnique</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>, </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>);
<a name="l1119"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s, *old_s;
<a name="l1120"></a> </span><span class=cF9>I64</span><span class=cF0> i, message_code, sel_mode, arg1, arg2, make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>, x, y, z;
<a name="l1121"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p0a, p0b;
<a name="l1122"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *va[</span><span class=cFE>3</span><span class=cF0>], *tmpv;
<a name="l1123"></a> </span><span class=cF1>Bool</span><span class=cF0> adjusting_z = </span><span class=cF3>FALSE</span><span class=cF0>, moving, save_and_exit, adjusting_camera_xy = </span><span class=cF3>FALSE</span><span class=cF0>, adjusting_camera_z = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1124"></a>
<a name="l1125"></a> </span><span class=cF9>CMeshFrame</span><span class=cF0> e;
<a name="l1126"></a>
<a name="l1127"></a> </span><span class=cF1>if</span><span class=cF0> (c)
<a name="l1128"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1129"></a> old_s = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CViewAngles</span><span class=cF7>)</span><span class=cF0>);
<a name="l1130"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(old_s, c-&gt;state, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CViewAngles</span><span class=cF7>)</span><span class=cF0>);
<a name="l1131"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1132"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1133"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1134"></a> c = </span><span class=cF5>ViewAnglesNew</span><span class=cF0>;
<a name="l1135"></a> old_s = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1136"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1137"></a>
<a name="l1138"></a> s = c-&gt;state;
<a name="l1139"></a> s-&gt;sx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1140"></a> s-&gt;sy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1141"></a> s-&gt;sz = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1142"></a> s-&gt;cx = </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l1143"></a> s-&gt;cy = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l1144"></a> s-&gt;cz = </span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l1145"></a>
<a name="l1146"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l1147"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l1148"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l1149"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l1150"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1151"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l1152"></a> </span><span class=cF6>&quot; Delete(,,SC_DELETE);&quot;</span><span class=cF0>
<a name="l1153"></a> </span><span class=cF6>&quot; DelLast(,CH_BACKSPACE);&quot;</span><span class=cF0>
<a name="l1154"></a> </span><span class=cF6>&quot; Cut(,CH_CTRLX);&quot;</span><span class=cF0>
<a name="l1155"></a> </span><span class=cF6>&quot; Copy(,CH_CTRLC);&quot;</span><span class=cF0>
<a name="l1156"></a> </span><span class=cF6>&quot; Paste(,CH_CTRLV);&quot;</span><span class=cF0>
<a name="l1157"></a> </span><span class=cF6>&quot; SelectAll(,'A');&quot;</span><span class=cF0>
<a name="l1158"></a> </span><span class=cF6>&quot; UnSelectAll(,'U');&quot;</span><span class=cF0>
<a name="l1159"></a> </span><span class=cF6>&quot; SelectRect(,'a');&quot;</span><span class=cF0>
<a name="l1160"></a> </span><span class=cF6>&quot; UnSelectRect(,'u');&quot;</span><span class=cF0>
<a name="l1161"></a> </span><span class=cF6>&quot; OrSelectRect(,'o');&quot;</span><span class=cF0>
<a name="l1162"></a> </span><span class=cF6>&quot; JumpToZ(,'j');&quot;</span><span class=cF0>
<a name="l1163"></a> </span><span class=cF6>&quot; ResetColor(,'C');&quot;</span><span class=cF0>
<a name="l1164"></a> </span><span class=cF6>&quot; ReverseTri(,'r');&quot;</span><span class=cF0>
<a name="l1165"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1166"></a> </span><span class=cF6>&quot;Mode {&quot;</span><span class=cF0>
<a name="l1167"></a> </span><span class=cF6>&quot; PlaceVertex(,'v');&quot;</span><span class=cF0>
<a name="l1168"></a> </span><span class=cF6>&quot; MoveVertex(,'m');&quot;</span><span class=cF0>
<a name="l1169"></a> </span><span class=cF6>&quot; MoveVertexZ(,'M');&quot;</span><span class=cF0>
<a name="l1170"></a> </span><span class=cF6>&quot; Triangle(,'t');&quot;</span><span class=cF0>
<a name="l1171"></a> </span><span class=cF6>&quot; Polygon(,'n');&quot;</span><span class=cF0>
<a name="l1172"></a> </span><span class=cF6>&quot; Fence(,'f');&quot;</span><span class=cF0>
<a name="l1173"></a> </span><span class=cF6>&quot; Prism(,'p');&quot;</span><span class=cF0>
<a name="l1174"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1175"></a> </span><span class=cF6>&quot;Settings {&quot;</span><span class=cF0>
<a name="l1176"></a> </span><span class=cF6>&quot; Color(,'c');&quot;</span><span class=cF0>
<a name="l1177"></a> </span><span class=cF6>&quot; Snap(,'s');&quot;</span><span class=cF0>
<a name="l1178"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1179"></a> </span><span class=cF6>&quot;View {&quot;</span><span class=cF0>
<a name="l1180"></a> </span><span class=cF6>&quot; ZoomIn(,'z');&quot;</span><span class=cF0>
<a name="l1181"></a> </span><span class=cF6>&quot; ZoomOut(,'Z');&quot;</span><span class=cF0>
<a name="l1182"></a> </span><span class=cF6>&quot; NullAngles(,'N');&quot;</span><span class=cF0>
<a name="l1183"></a> </span><span class=cF6>&quot; FlipY(,'y');&quot;</span><span class=cF0>
<a name="l1184"></a> </span><span class=cF6>&quot; Grid(,'g');&quot;</span><span class=cF0>
<a name="l1185"></a> </span><span class=cF6>&quot; Vertex(,'V');&quot;</span><span class=cF0>
<a name="l1186"></a> </span><span class=cF6>&quot; ToggleBorder(,CH_CTRLB);&quot;</span><span class=cF0>
<a name="l1187"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1188"></a> </span><span class=cF6>&quot;Transforms {&quot;</span><span class=cF0>
<a name="l1189"></a> </span><span class=cF6>&quot; Transform(,'T');&quot;</span><span class=cF0>
<a name="l1190"></a> </span><span class=cF6>&quot; SwapXY(,'1');&quot;</span><span class=cF0>
<a name="l1191"></a> </span><span class=cF6>&quot; SwapXZ(,'2');&quot;</span><span class=cF0>
<a name="l1192"></a> </span><span class=cF6>&quot; SwapYZ(,'3');&quot;</span><span class=cF0>
<a name="l1193"></a> </span><span class=cF6>&quot; InvertX(,'4');&quot;</span><span class=cF0>
<a name="l1194"></a> </span><span class=cF6>&quot; InvertY(,'5');&quot;</span><span class=cF0>
<a name="l1195"></a> </span><span class=cF6>&quot; InvertZ(,'6');&quot;</span><span class=cF0>
<a name="l1196"></a> </span><span class=cF6>&quot; ReverseTri(,'R');&quot;</span><span class=cF0>
<a name="l1197"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l1198"></a>
<a name="l1199"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l1200"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l1201"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_MESH_ED</span><span class=cF0>,
<a name="l1202"></a> </span><span class=cF6>&quot;$GREEN$Right Mouse$FG$: Hold and move to shift cursor z\n&quot;</span><span class=cF0>
<a name="l1203"></a> </span><span class=cF6>&quot;$GREEN$Shift + Right Mouse$FG$: Hold and move to rotate camera XY\n&quot;</span><span class=cF0>
<a name="l1204"></a> </span><span class=cF6>&quot;$GREEN$Alt + Right Mouse$FG$: Hold and move to rotate camera Z\n&quot;</span><span class=cF0>
<a name="l1205"></a> </span><span class=cF6>&quot;$GREEN$'j'$FG$: Jump cursor Z to nearest vertex's Z\n&quot;</span><span class=cF0>
<a name="l1206"></a> </span><span class=cF6>&quot;$GREEN$'v'$FG$: Place Vertex Mode\n&quot;</span><span class=cF0>
<a name="l1207"></a> </span><span class=cF6>&quot;$GREEN$'m'$FG$: Move Vertex Mode\n&quot;</span><span class=cF0>
<a name="l1208"></a> </span><span class=cF6>&quot;$GREEN$'M'$FG$: Move Vertex Z\n&quot;</span><span class=cF0>
<a name="l1209"></a> </span><span class=cF6>&quot;$GREEN$'t'$FG$: Form Triangle Mode\n&quot;</span><span class=cF0>
<a name="l1210"></a> </span><span class=cF6>&quot;$GREEN$'n'$FG$: Polygon Mode\n&quot;</span><span class=cF0>
<a name="l1211"></a> </span><span class=cF6>&quot;$GREEN$'f'$FG$: Fence Mode\n&quot;</span><span class=cF0>
<a name="l1212"></a> </span><span class=cF6>&quot;$GREEN$'p'$FG$: Prism Mode\n&quot;</span><span class=cF0>
<a name="l1213"></a> </span><span class=cF6>&quot;$GREEN$'c'$FG$: Set color\n&quot;</span><span class=cF0>
<a name="l1214"></a> </span><span class=cF6>&quot;$GREEN$'s'$FG$: Set snap\n&quot;</span><span class=cF0>
<a name="l1215"></a> </span><span class=cF6>&quot;\nSee menu at top of screen for more.\n&quot;</span><span class=cF0>);
<a name="l1216"></a>
<a name="l1217"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit = </span><span class=cF3>WIG_TASK_DEFAULT</span><span class=cF0> |
<a name="l1218"></a> </span><span class=cF3>WIF_SELF_DOC</span><span class=cF0> - </span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0> - </span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0> - </span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0> - </span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0> - </span><span class=cF3>WIF_SELF_GRAB_SCROLL</span><span class=cF0>;
<a name="l1219"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;horz_scroll.pos = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1220"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;vert_scroll.pos = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1221"></a> </span><span class=cF5>MeshInit</span><span class=cF0>(&amp;e, flip_y);
<a name="l1222"></a> </span><span class=cF1>if</span><span class=cF0> (head)
<a name="l1223"></a> </span><span class=cF5>MeshLoad</span><span class=cF0>(&amp;e, head);
<a name="l1224"></a> </span><span class=cF5>FramePtrAdd</span><span class=cF0>(</span><span class=cF6>&quot;CMeshFrame&quot;</span><span class=cF0>, &amp;e);
<a name="l1225"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;draw_it = &amp;</span><span class=cF5>DrawIt</span><span class=cF0>;
<a name="l1226"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(&amp;e);
<a name="l1227"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>, &amp;e);
<a name="l1228"></a>
<a name="l1229"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l1230"></a> </span><span class=cF7>{</span><span class=cF2>//In case of &lt;CTRL-ALT-c&gt;</span><span class=cF0>
<a name="l1231"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l1232"></a> {
<a name="l1233"></a> </span><span class=cF5>MeshUpdateMenu</span><span class=cF0>(&amp;e);
<a name="l1234"></a> message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>|
<a name="l1235"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>);
<a name="l1236"></a>me_restart:
<a name="l1237"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code)
<a name="l1238"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1239"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l1240"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l1241"></a> {
<a name="l1242"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
<a name="l1243"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[</span><span class=cFE>0</span><span class=cF0>])
<a name="l1244"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1245"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
<a name="l1246"></a> </span><span class=cF1>if</span><span class=cF0> (arg2 &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1247"></a> </span><span class=cF1>goto</span><span class=cF0> me_clip_cut;
<a name="l1248"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1249"></a> {
<a name="l1250"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0>)
<a name="l1251"></a> </span><span class=cF5>MeshClipDel</span><span class=cF0>(&amp;e);
<a name="l1252"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode != </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1253"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(&amp;e, </span><span class=cF5>MeshVertexFindScrPt</span><span class=cF7>(</span><span class=cF0>&amp;e,
<a name="l1254"></a> </span><span class=cFB>mouse</span><span class=cF0>.presnap.x - </span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_left - </span><span class=cF5>Fs</span><span class=cF0>-&gt;scroll_x,
<a name="l1255"></a> </span><span class=cFB>mouse</span><span class=cF0>.presnap.y - </span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_top - </span><span class=cF5>Fs</span><span class=cF0>-&gt;scroll_y</span><span class=cF7>)</span><span class=cF0>);
<a name="l1256"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1257"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1258"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1259"></a> }
<a name="l1260"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1261"></a>
<a name="l1262"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>:
<a name="l1263"></a> </span><span class=cF1>if</span><span class=cF0> (arg2 &amp; </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l1264"></a> </span><span class=cF1>goto</span><span class=cF0> me_clip_copy;
<a name="l1265"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2 &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1266"></a> </span><span class=cF1>goto</span><span class=cF0> me_clip_paste;
<a name="l1267"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1268"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1269"></a>
<a name="l1270"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>:
<a name="l1271"></a> </span><span class=cF1>switch</span><span class=cF0> (e.ed_mode)
<a name="l1272"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1273"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l1274"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>:
<a name="l1275"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1276"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l1277"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(&amp;e, e.cur_vertex);
<a name="l1278"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1279"></a>
<a name="l1280"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l1281"></a> </span><span class=cF1>if</span><span class=cF0> (make_tri_vertex_num)
<a name="l1282"></a> {
<a name="l1283"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1284"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1285"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1286"></a> }
<a name="l1287"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1288"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(&amp;e, e.cur_tri);
<a name="l1289"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1290"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1291"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1292"></a>
<a name="l1293"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>:
<a name="l1294"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1295"></a> e.thickness = </span><span class=cF5>PopUpI64Get</span><span class=cF0>(</span><span class=cF6>&quot;Thickness (%d):&quot;</span><span class=cF0>, e.thickness);
<a name="l1296"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l1297"></a> </span><span class=cF1>if</span><span class=cF0> (arg1 == </span><span class=cF6>'n'</span><span class=cF0> || arg1 == </span><span class=cF6>'p'</span><span class=cF0>)
<a name="l1298"></a> e.closed = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1299"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1300"></a> e.closed = </span><span class=cF5>PopUpNoYes</span><span class=cF0>(</span><span class=cF6>&quot;Closed?\n&quot;</span><span class=cF0>);
<a name="l1301"></a>me_chain:
<a name="l1302"></a> e.chain_pred = e.vertex_head.last;
<a name="l1303"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l1304"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1305"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1306"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l1307"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l1308"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'M'</span><span class=cF0>:
<a name="l1309"></a> adjusting_z = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1310"></a> moving = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1311"></a> e.ed_mode = arg1;
<a name="l1312"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1313"></a> </span><span class=cF5>Sound</span><span class=cF0>;
<a name="l1314"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1315"></a>
<a name="l1316"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'T'</span><span class=cF0>:
<a name="l1317"></a> </span><span class=cF5>MeshTransformSel</span><span class=cF0>(&amp;e);
<a name="l1318"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1319"></a>
<a name="l1320"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'A'</span><span class=cF0>:
<a name="l1321"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1322"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode != </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1323"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1324"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1325"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1326"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1327"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1328"></a>
<a name="l1329"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'U'</span><span class=cF0>:
<a name="l1330"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1331"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1332"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1333"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1334"></a>
<a name="l1335"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'a'</span><span class=cF0>:
<a name="l1336"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'u'</span><span class=cF0>:
<a name="l1337"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'o'</span><span class=cF0>:
<a name="l1338"></a> </span><span class=cF1>if</span><span class=cF0> (arg1 == </span><span class=cF6>'a'</span><span class=cF0>)
<a name="l1339"></a> sel_mode = </span><span class=cF3>SEL_MESH_EQU</span><span class=cF0>;
<a name="l1340"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1 == </span><span class=cF6>'u'</span><span class=cF0>)
<a name="l1341"></a> sel_mode = </span><span class=cF3>SEL_MESH_AND</span><span class=cF0>;
<a name="l1342"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1343"></a> sel_mode = </span><span class=cF3>SEL_MESH_OR</span><span class=cF0>;
<a name="l1344"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> |
<a name="l1345"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> |
<a name="l1346"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> |
<a name="l1347"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0> |
<a name="l1348"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>)
<a name="l1349"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1350"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1351"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1352"></a> </span><span class=cF1>goto</span><span class=cF0> me_restart;
<a name="l1353"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1354"></a> e.x1 = arg1;
<a name="l1355"></a> e.y1 = arg2;
<a name="l1356"></a> e.x2 = arg1;
<a name="l1357"></a> e.y2 = arg2;
<a name="l1358"></a> e.sel_rect = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1359"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l1360"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1361"></a> message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> |
<a name="l1362"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> |
<a name="l1363"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> |
<a name="l1364"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> |
<a name="l1365"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0> |
<a name="l1366"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>);
<a name="l1367"></a> </span><span class=cF1>if</span><span class=cF0> (message_code == </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>)
<a name="l1368"></a> {
<a name="l1369"></a> e.x2 = arg1;
<a name="l1370"></a> e.y2 = arg2;
<a name="l1371"></a> }
<a name="l1372"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (message_code == </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>)
<a name="l1373"></a> {
<a name="l1374"></a> e.x2 = arg1;
<a name="l1375"></a> e.y2 = arg2;
<a name="l1376"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1377"></a> }
<a name="l1378"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1379"></a> {
<a name="l1380"></a> e.sel_rect = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1381"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1382"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1383"></a> </span><span class=cF1>goto</span><span class=cF0> me_restart;
<a name="l1384"></a> }
<a name="l1385"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1386"></a> e.sel_rect = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1387"></a> </span><span class=cF5>MeshTriSelRect</span><span class=cF0>(&amp;e, sel_mode, e.x1, e.x2, e.y1, e.y2);
<a name="l1388"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode != </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1389"></a> </span><span class=cF5>MeshVertexSelRect</span><span class=cF0>(&amp;e, sel_mode, e.x1, e.x2, e.y1, e.y2);
<a name="l1390"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1391"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1392"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1393"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1394"></a>
<a name="l1395"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLB</span><span class=cF0>:
<a name="l1396"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>);
<a name="l1397"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1398"></a>
<a name="l1399"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLC</span><span class=cF0>:
<a name="l1400"></a>me_clip_copy:
<a name="l1401"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode == </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1402"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1403"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1404"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1405"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1406"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1407"></a> </span><span class=cF5>MeshClipCopy</span><span class=cF0>(&amp;e);
<a name="l1408"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1409"></a>
<a name="l1410"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLV</span><span class=cF0>:
<a name="l1411"></a>me_clip_paste:
<a name="l1412"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode == </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1413"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1414"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1415"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1416"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1417"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1418"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1419"></a> </span><span class=cF5>MeshClipPaste</span><span class=cF0>(&amp;e);
<a name="l1420"></a> e.ed_mode = </span><span class=cF6>'m'</span><span class=cF0>;
<a name="l1421"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1422"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1423"></a>
<a name="l1424"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLX</span><span class=cF0>:
<a name="l1425"></a>me_clip_cut:
<a name="l1426"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode == </span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1427"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1428"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1429"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1430"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1431"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1432"></a> </span><span class=cF5>MeshClipCut</span><span class=cF0>(&amp;e);
<a name="l1433"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1434"></a>
<a name="l1435"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l1436"></a> save_and_exit = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1437"></a> </span><span class=cF1>goto</span><span class=cF0> me_done;
<a name="l1438"></a>
<a name="l1439"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l1440"></a> save_and_exit = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1441"></a> </span><span class=cF1>goto</span><span class=cF0> me_done;
<a name="l1442"></a>
<a name="l1443"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
<a name="l1444"></a> </span><span class=cF5>MeshScaleZoom</span><span class=cF0>(&amp;e, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>);
<a name="l1445"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1446"></a>
<a name="l1447"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'Z'</span><span class=cF0>:
<a name="l1448"></a> </span><span class=cF5>MeshScaleZoom</span><span class=cF0>(&amp;e, </span><span class=cFE>1</span><span class=cF0> / </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>);
<a name="l1449"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1450"></a>
<a name="l1451"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
<a name="l1452"></a> e.cur_color = </span><span class=cF5>PopUpColorLighting</span><span class=cF0>;
<a name="l1453"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1454"></a>
<a name="l1455"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>:
<a name="l1456"></a> i = </span><span class=cF5>PopUpRangeI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>25</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>&quot;New Snap\n&quot;</span><span class=cF0>);
<a name="l1457"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>1</span><span class=cF0>)
<a name="l1458"></a> e.cur_snap = i;
<a name="l1459"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(&amp;e);
<a name="l1460"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>, &amp;e);
<a name="l1461"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1462"></a>
<a name="l1463"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'g'</span><span class=cF0>:
<a name="l1464"></a> e.grid_on = !e.grid_on;
<a name="l1465"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1466"></a>
<a name="l1467"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'V'</span><span class=cF0>:
<a name="l1468"></a> e.vertex_on = !e.vertex_on;
<a name="l1469"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1470"></a>
<a name="l1471"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'N'</span><span class=cF0>:
<a name="l1472"></a> s-&gt;sx = s-&gt;sy = s-&gt;sz = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1473"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1474"></a>
<a name="l1475"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'y'</span><span class=cF0>:
<a name="l1476"></a> e.flip_y = !e.flip_y;
<a name="l1477"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1478"></a>
<a name="l1479"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'j'</span><span class=cF0>:
<a name="l1480"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1481"></a> </span><span class=cF5>MeshVertexIgnoreSet</span><span class=cF0>(&amp;e, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1482"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv = </span><span class=cF5>MeshVertexFindScrPt</span><span class=cF7>(</span><span class=cF0>&amp;e,
<a name="l1483"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.x - </span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_left - </span><span class=cF5>Fs</span><span class=cF0>-&gt;scroll_x,
<a name="l1484"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.y - </span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_top - </span><span class=cF5>Fs</span><span class=cF0>-&gt;scroll_y</span><span class=cF7>)</span><span class=cF0>)
<a name="l1485"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1486"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>25</span><span class=cF0>, </span><span class=cFE>86</span><span class=cF0>, </span><span class=cFE>110</span><span class=cF0>);
<a name="l1487"></a> e.mouse_z = </span><span class=cF5>RoundI64</span><span class=cF0>(tmpv-&gt;p.z, e.cur_snap);
<a name="l1488"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1489"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1490"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1491"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1492"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1493"></a> e.mouse_z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1494"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1495"></a> </span><span class=cF5>MeshVertexIgnoreSet</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1496"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1497"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1498"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1499"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1500"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, z - p0a.z);
<a name="l1501"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1502"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, x - p0a.x, y - p0a.y, z - p0a.z);
<a name="l1503"></a> p0a.x = x;
<a name="l1504"></a> p0a.y = y;
<a name="l1505"></a> p0a.z = z;
<a name="l1506"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1507"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1508"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1509"></a>
<a name="l1510"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'1'</span><span class=cF0>:
<a name="l1511"></a> </span><span class=cF5>MeshSwapAxes</span><span class=cF0>(&amp;e, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.x</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.y</span><span class=cF7>)</span><span class=cF0>);
<a name="l1512"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1513"></a>
<a name="l1514"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'2'</span><span class=cF0>:
<a name="l1515"></a> </span><span class=cF5>MeshSwapAxes</span><span class=cF0>(&amp;e, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.x</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.z</span><span class=cF7>)</span><span class=cF0>);
<a name="l1516"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1517"></a>
<a name="l1518"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'3'</span><span class=cF0>:
<a name="l1519"></a> </span><span class=cF5>MeshSwapAxes</span><span class=cF0>(&amp;e, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.y</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.z</span><span class=cF7>)</span><span class=cF0>);
<a name="l1520"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1521"></a>
<a name="l1522"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'4'</span><span class=cF0>:
<a name="l1523"></a> </span><span class=cF5>MeshInvertAxis</span><span class=cF0>(&amp;e, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.x</span><span class=cF7>)</span><span class=cF0>);
<a name="l1524"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1525"></a>
<a name="l1526"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'5'</span><span class=cF0>:
<a name="l1527"></a> </span><span class=cF5>MeshInvertAxis</span><span class=cF0>(&amp;e, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.y</span><span class=cF7>)</span><span class=cF0>);
<a name="l1528"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1529"></a>
<a name="l1530"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'6'</span><span class=cF0>:
<a name="l1531"></a> </span><span class=cF5>MeshInvertAxis</span><span class=cF0>(&amp;e, </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF0>.z</span><span class=cF7>)</span><span class=cF0>);
<a name="l1532"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1533"></a>
<a name="l1534"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'r'</span><span class=cF0>:
<a name="l1535"></a> </span><span class=cF1>if</span><span class=cF0> (e.cur_tri)
<a name="l1536"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;e.cur_tri-&gt;t[</span><span class=cFE>1</span><span class=cF0>], &amp;e.cur_tri-&gt;t[</span><span class=cFE>2</span><span class=cF0>]);
<a name="l1537"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1538"></a>
<a name="l1539"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'C'</span><span class=cF0>:
<a name="l1540"></a> </span><span class=cF5>MeshColorTris</span><span class=cF0>(&amp;e);
<a name="l1541"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1542"></a>
<a name="l1543"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'R'</span><span class=cF0>:
<a name="l1544"></a> </span><span class=cF5>MeshRevTris</span><span class=cF0>(&amp;e);
<a name="l1545"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1546"></a> }
<a name="l1547"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1548"></a>
<a name="l1549"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
<a name="l1550"></a> </span><span class=cF1>switch</span><span class=cF0> (e.ed_mode)
<a name="l1551"></a> {
<a name="l1552"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l1553"></a> </span><span class=cF1>if</span><span class=cF0> (!moving)
<a name="l1554"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1555"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>tmpv = </span><span class=cF5>MeshVertexFindScrPt</span><span class=cF0>(&amp;e, arg1, arg2)</span><span class=cF7>)</span><span class=cF0>)
<a name="l1556"></a> {
<a name="l1557"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1558"></a> e.mouse_z = </span><span class=cF5>RoundI64</span><span class=cF0>(tmpv-&gt;p.z, e.cur_snap);
<a name="l1559"></a> }
<a name="l1560"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0>)
<a name="l1561"></a> {
<a name="l1562"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1563"></a> p0a.x = x;
<a name="l1564"></a> p0a.y = y;
<a name="l1565"></a> p0a.z = z;
<a name="l1566"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1567"></a> moving = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1568"></a> }
<a name="l1569"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1570"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1571"></a>
<a name="l1572"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'M'</span><span class=cF0>:
<a name="l1573"></a> </span><span class=cF1>if</span><span class=cF0> (!adjusting_z &amp;&amp; !moving)
<a name="l1574"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1575"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>tmpv = </span><span class=cF5>MeshVertexFindScrPt</span><span class=cF0>(&amp;e, arg1, arg2)</span><span class=cF7>)</span><span class=cF0>)
<a name="l1576"></a> {
<a name="l1577"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1578"></a> e.mouse_z = </span><span class=cF5>RoundI64</span><span class=cF0>(tmpv-&gt;p.z, e.cur_snap);
<a name="l1579"></a> }
<a name="l1580"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MeshSelCount</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0>)
<a name="l1581"></a> {
<a name="l1582"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1583"></a> p0a.x = x;
<a name="l1584"></a> p0a.y = y;
<a name="l1585"></a> p0a.z = z;
<a name="l1586"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1587"></a> moving = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1588"></a>
<a name="l1589"></a> p0b.x = </span><span class=cFB>mouse</span><span class=cF0>.presnap.x;
<a name="l1590"></a> p0b.y = </span><span class=cFB>mouse</span><span class=cF0>.presnap.y;
<a name="l1591"></a> p0b.z = e.mouse_z;
<a name="l1592"></a> adjusting_z = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1593"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cF5>ClampI64</span><span class=cF7>(</span><span class=cF5>Freq2Ona</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0> * e.mouse_z + </span><span class=cFE>1500</span><span class=cF0>), </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l1594"></a> }
<a name="l1595"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1596"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1597"></a> }
<a name="l1598"></a>
<a name="l1599"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1600"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
<a name="l1601"></a> </span><span class=cF1>switch</span><span class=cF0> (e.ed_mode)
<a name="l1602"></a> {
<a name="l1603"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l1604"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>:
<a name="l1605"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1606"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l1607"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>25</span><span class=cF0>, </span><span class=cFE>86</span><span class=cF0>, </span><span class=cFE>110</span><span class=cF0>);
<a name="l1608"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1609"></a> e.cur_vertex = </span><span class=cF5>MeshVertexNew</span><span class=cF0>(&amp;e, x, y, z);
<a name="l1610"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1611"></a>
<a name="l1612"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l1613"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'M'</span><span class=cF0>:
<a name="l1614"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1615"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1616"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1617"></a> {
<a name="l1618"></a> e.mouse_z = </span><span class=cF5>RoundI64</span><span class=cF0>(</span><span class=cF5>Sign</span><span class=cF7>(</span><span class=cF0>p0b.y - </span><span class=cFB>mouse</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0> *
<a name="l1619"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(p0b.x - </span><span class=cFB>mouse</span><span class=cF0>.presnap.x) +
<a name="l1620"></a> </span><span class=cF5>Sqr</span><span class=cF0>(p0b.y - </span><span class=cFB>mouse</span><span class=cF0>.presnap.y)</span><span class=cF7>)</span><span class=cF0> + p0b.z, e.cur_snap);
<a name="l1621"></a> </span><span class=cF5>Sound</span><span class=cF0>;
<a name="l1622"></a> adjusting_z = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1623"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1624"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, z - p0a.z);
<a name="l1625"></a> }
<a name="l1626"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1627"></a> {
<a name="l1628"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1629"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, x - p0a.x, y - p0a.y, z - p0a.z);
<a name="l1630"></a> }
<a name="l1631"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1632"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1633"></a> moving = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1634"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1635"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1636"></a>
<a name="l1637"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l1638"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv = </span><span class=cF5>MeshVertexFindScrPt</span><span class=cF7>(</span><span class=cF0>&amp;e, arg1, arg2</span><span class=cF7>)</span><span class=cF0>)
<a name="l1639"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1640"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; make_tri_vertex_num; i++)
<a name="l1641"></a> </span><span class=cF1>if</span><span class=cF0> (va[i] == tmpv)
<a name="l1642"></a> {
<a name="l1643"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1644"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1645"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1646"></a> }
<a name="l1647"></a> </span><span class=cF1>if</span><span class=cF0> (i == make_tri_vertex_num)
<a name="l1648"></a> {
<a name="l1649"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>25</span><span class=cF0>, </span><span class=cFE>86</span><span class=cF0>, </span><span class=cFE>110</span><span class=cF0>);
<a name="l1650"></a> va[make_tri_vertex_num++] = tmpv;
<a name="l1651"></a> tmpv-&gt;flags |= </span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1652"></a> </span><span class=cF1>if</span><span class=cF0> (make_tri_vertex_num == </span><span class=cFE>3</span><span class=cF0>)
<a name="l1653"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1654"></a> e.cur_tri = </span><span class=cF5>MeshTriNew</span><span class=cF0>(&amp;e, e.cur_color, va[</span><span class=cFE>0</span><span class=cF0>], va[</span><span class=cFE>1</span><span class=cF0>], va[</span><span class=cFE>2</span><span class=cF0>]);
<a name="l1655"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; make_tri_vertex_num; i++)
<a name="l1656"></a> va[i]-&gt;flags &amp;= ~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1657"></a> make_tri_vertex_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1658"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1659"></a> }
<a name="l1660"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1661"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1662"></a> }
<a name="l1663"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1664"></a>
<a name="l1665"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
<a name="l1666"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, </span><span class=cF3>SC_SHIFT</span><span class=cF7>)</span><span class=cF0>) adjusting_camera_xy = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1667"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, </span><span class=cF3>SC_ALT</span><span class=cF7>)</span><span class=cF0>) adjusting_camera_z = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1668"></a>
<a name="l1669"></a> </span><span class=cF1>if</span><span class=cF0> (!adjusting_z &amp;&amp; e.ed_mode != </span><span class=cF6>'M'</span><span class=cF0> &amp;&amp;
<a name="l1670"></a> </span><span class=cF7>(</span><span class=cF0>e.chain_pred == e.vertex_head.last || e.ed_mode != </span><span class=cF6>'n'</span><span class=cF0> &amp;&amp; e.ed_mode != </span><span class=cF6>'f'</span><span class=cF0> &amp;&amp; e.ed_mode != </span><span class=cF6>'p'</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l1671"></a> !adjusting_camera_xy &amp;&amp; !adjusting_camera_z)
<a name="l1672"></a> {
<a name="l1673"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1674"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1675"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1676"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, x - p0a.x, y - p0a.y, z - p0a.z);
<a name="l1677"></a> p0a.x = x;
<a name="l1678"></a> p0a.y = y;
<a name="l1679"></a> p0a.z = z;
<a name="l1680"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1681"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1682"></a> p0b.x = </span><span class=cFB>mouse</span><span class=cF0>.presnap.x;
<a name="l1683"></a> p0b.y = </span><span class=cFB>mouse</span><span class=cF0>.presnap.y;
<a name="l1684"></a> p0b.z = e.mouse_z;
<a name="l1685"></a> adjusting_z = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1686"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cF5>ClampI64</span><span class=cF7>(</span><span class=cF5>Freq2Ona</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0> * e.mouse_z + </span><span class=cFE>1500</span><span class=cF0>), </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l1687"></a> }
<a name="l1688"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1689"></a>
<a name="l1690"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>:
<a name="l1691"></a> adjusting_camera_xy = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1692"></a> adjusting_camera_z = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1693"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1694"></a> {
<a name="l1695"></a> e.mouse_z = </span><span class=cF5>RoundI64</span><span class=cF0>(</span><span class=cF5>Sign</span><span class=cF7>(</span><span class=cF0>p0b.y - </span><span class=cFB>mouse</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0> *
<a name="l1696"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(p0b.x - </span><span class=cFB>mouse</span><span class=cF0>.presnap.x) +
<a name="l1697"></a> </span><span class=cF5>Sqr</span><span class=cF0>(p0b.y - </span><span class=cFB>mouse</span><span class=cF0>.presnap.y)</span><span class=cF7>)</span><span class=cF0> + p0b.z, e.cur_snap);
<a name="l1698"></a> </span><span class=cF5>Sound</span><span class=cF0>;
<a name="l1699"></a> adjusting_z = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1700"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1701"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1702"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1703"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, z - p0a.z);
<a name="l1704"></a> p0a.x = x;
<a name="l1705"></a> p0a.y = y;
<a name="l1706"></a> p0a.z = z;
<a name="l1707"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1708"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1709"></a> }
<a name="l1710"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode == </span><span class=cF6>'n'</span><span class=cF0>)
<a name="l1711"></a> {
<a name="l1712"></a> </span><span class=cF1>if</span><span class=cF0> (e.chain_pred &amp;&amp; e.chain_pred != e.vertex_head.last)
<a name="l1713"></a> </span><span class=cF5>MeshPolygon</span><span class=cF0>(&amp;e, e.chain_pred-&gt;next, e.vertex_head.last, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1714"></a> arg1 = e.ed_mode;
<a name="l1715"></a> </span><span class=cF1>goto</span><span class=cF0> me_chain;
<a name="l1716"></a> }
<a name="l1717"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode == </span><span class=cF6>'f'</span><span class=cF0>)
<a name="l1718"></a> {
<a name="l1719"></a> </span><span class=cF1>if</span><span class=cF0> (e.chain_pred &amp;&amp; e.chain_pred != e.vertex_head.last)
<a name="l1720"></a> </span><span class=cF5>MeshFence</span><span class=cF0>(&amp;e);
<a name="l1721"></a> arg1 = e.ed_mode;
<a name="l1722"></a> </span><span class=cF1>goto</span><span class=cF0> me_chain;
<a name="l1723"></a> }
<a name="l1724"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode == </span><span class=cF6>'p'</span><span class=cF0>)
<a name="l1725"></a> {
<a name="l1726"></a> </span><span class=cF1>if</span><span class=cF0> (e.chain_pred &amp;&amp; e.chain_pred != e.vertex_head.last)
<a name="l1727"></a> </span><span class=cF5>MeshPrism</span><span class=cF0>(&amp;e);
<a name="l1728"></a> arg1 = e.ed_mode;
<a name="l1729"></a> </span><span class=cF1>goto</span><span class=cF0> me_chain;
<a name="l1730"></a> }
<a name="l1731"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1732"></a>
<a name="l1733"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
<a name="l1734"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_camera_xy)
<a name="l1735"></a> {
<a name="l1736"></a> </span><span class=cF2>// In the editor, X and Y of mouse rotate around Y and X 3D axes.</span><span class=cF0>
<a name="l1737"></a>
<a name="l1738"></a> s-&gt;sx += </span><span class=cFB>mouse</span><span class=cF0>.presnap.y - </span><span class=cFB>mouse_last</span><span class=cF0>.presnap.y;
<a name="l1739"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;sx &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1740"></a> s-&gt;sx = </span><span class=cFE>360</span><span class=cF0>; </span><span class=cF2>// VIEWANGLES_RANGE</span><span class=cF0>
<a name="l1741"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (s-&gt;sx &gt; </span><span class=cFE>360</span><span class=cF0>)
<a name="l1742"></a> s-&gt;sx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1743"></a> s-&gt;sy -= </span><span class=cFB>mouse</span><span class=cF0>.presnap.x - </span><span class=cFB>mouse_last</span><span class=cF0>.presnap.x;
<a name="l1744"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;sy &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1745"></a> s-&gt;sy = </span><span class=cFE>360</span><span class=cF0>; </span><span class=cF2>// VIEWANGLES_RANGE</span><span class=cF0>
<a name="l1746"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (s-&gt;sy &gt; </span><span class=cFE>360</span><span class=cF0>)
<a name="l1747"></a> s-&gt;sy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1748"></a> }
<a name="l1749"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_camera_z)
<a name="l1750"></a> {
<a name="l1751"></a> </span><span class=cF2>// In the editor, X and Y of mouse rotates around Z 3D axis.</span><span class=cF0>
<a name="l1752"></a>
<a name="l1753"></a> s-&gt;sz += </span><span class=cFB>mouse</span><span class=cF0>.presnap.x - </span><span class=cFB>mouse_last</span><span class=cF0>.presnap.x;
<a name="l1754"></a> s-&gt;sz += </span><span class=cFB>mouse</span><span class=cF0>.presnap.y - </span><span class=cFB>mouse_last</span><span class=cF0>.presnap.y;
<a name="l1755"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;sz &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1756"></a> s-&gt;sz = </span><span class=cFE>360</span><span class=cF0>; </span><span class=cF2>// VIEWANGLES_RANGE</span><span class=cF0>
<a name="l1757"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (s-&gt;sz &gt; </span><span class=cFE>360</span><span class=cF0>)
<a name="l1758"></a> s-&gt;sz = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1759"></a> }
<a name="l1760"></a>
<a name="l1761"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_camera_xy || adjusting_camera_z)
<a name="l1762"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1763"></a>
<a name="l1764"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1765"></a> {
<a name="l1766"></a> e.mouse_z = </span><span class=cF5>RoundI64</span><span class=cF0>(</span><span class=cF5>Sign</span><span class=cF7>(</span><span class=cF0>p0b.y - </span><span class=cFB>mouse</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0> *
<a name="l1767"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(p0b.x - </span><span class=cFB>mouse</span><span class=cF0>.presnap.x) +
<a name="l1768"></a> </span><span class=cF5>Sqr</span><span class=cF0>(p0b.y - </span><span class=cFB>mouse</span><span class=cF0>.presnap.y)</span><span class=cF7>)</span><span class=cF0> + p0b.z, e.cur_snap);
<a name="l1769"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cF5>ClampI64</span><span class=cF7>(</span><span class=cF5>Freq2Ona</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0> * e.mouse_z + </span><span class=cFE>1500</span><span class=cF0>), </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l1770"></a> }
<a name="l1771"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1772"></a> {
<a name="l1773"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(&amp;e, </span><span class=cF5>Fs</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l1774"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1775"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, z - p0a.z);
<a name="l1776"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1777"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e, x - p0a.x, y - p0a.y, z - p0a.z);
<a name="l1778"></a> p0a.x = x;
<a name="l1779"></a> p0a.y = y;
<a name="l1780"></a> p0a.z = z;
<a name="l1781"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1782"></a> }
<a name="l1783"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1784"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1785"></a> }
<a name="l1786"></a>me_done:
<a name="l1787"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1788"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l1789"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1790"></a>
<a name="l1791"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l1792"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l1793"></a> </span><span class=cF1>if</span><span class=cF0> (save_and_exit)
<a name="l1794"></a> head = </span><span class=cF5>MeshSave</span><span class=cF0>(&amp;e, _size);
<a name="l1795"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1796"></a> head = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1797"></a> </span><span class=cF5>MeshCleanUp</span><span class=cF0>(&amp;e);
<a name="l1798"></a> </span><span class=cF5>FramePtrDel</span><span class=cF0>(</span><span class=cF6>&quot;CMeshFrame&quot;</span><span class=cF0>);
<a name="l1799"></a> </span><span class=cF1>if</span><span class=cF0> (old_s)
<a name="l1800"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1801"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(c-&gt;state, old_s, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CViewAngles</span><span class=cF7>)</span><span class=cF0>);
<a name="l1802"></a> </span><span class=cF5>Free</span><span class=cF0>(old_s);
<a name="l1803"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1804"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1805"></a> </span><span class=cF5>ViewAnglesDel</span><span class=cF0>;
<a name="l1806"></a>
<a name="l1807"></a> </span><span class=cF1>return</span><span class=cF0> head;
<a name="l1808"></a>}
</span></pre></body>
</html>