templeos-info/public/Wb/Adam/Gr/SpriteMesh.HC.HTML

1540 lines
161 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<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> 4000
<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> 1
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VF_COPIED</span><span class=cF0> 2
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VF_IGNORE</span><span class=cF0> 4
<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> </span><span class=cF9>CD3I32</span><span class=cF0> p0,
<a name="l16"></a> pt; </span><span class=cF2>//Transformed coordinates.</span><span class=cF0> </span><span class=cF2>(Scrn)</span><span class=cF0>
<a name="l17"></a> </span><span class=cF9>I32</span><span class=cF0> num,flags;
<a name="l18"></a>};
<a name="l19"></a>
<a name="l20"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>TF_SEL</span><span class=cF0> 1
<a name="l21"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>TF_COPIED</span><span class=cF0> 2
<a name="l22"></a>
<a name="l23"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CMeshEdTri</span><span class=cF0>
<a name="l24"></a>{
<a name="l25"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *next,*last;
<a name="l26"></a>
<a name="l27"></a> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF9>CMeshTri</span><span class=cF0> mt;
<a name="l29"></a> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF1>end</span><span class=cF0>;
<a name="l30"></a>
<a name="l31"></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="l32"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *t[3];
<a name="l33"></a>};
<a name="l34"></a>
<a name="l35"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CMeshFrame</span><span class=cF0>
<a name="l36"></a>{
<a name="l37"></a> </span><span class=cF9>I64</span><span class=cF0> ms_z,thickness; </span><span class=cF2>//Mouse Z-coordinate</span><span class=cF0>
<a name="l38"></a> </span><span class=cF9>I64</span><span class=cF0> ed_mode,cx,cy;
<a name="l39"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> cur_color;
<a name="l40"></a> </span><span class=cF1>Bool</span><span class=cF0> grid_on,flip_y,sel_rect,vertex_on,closed,pad[3];
<a name="l41"></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="l42"></a> </span><span class=cF1>F64</span><span class=cF0> view_scale;
<a name="l43"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc;
<a name="l44"></a> </span><span class=cF9>I32</span><span class=cF0> *depth_buf;
<a name="l45"></a> </span><span class=cF9>I64</span><span class=cF0> *w2s,*s2w; </span><span class=cF2>//Scrn-to-world and world-to-scrn transform matrices.</span><span class=cF0>
<a name="l46"></a> </span><span class=cF9>I64</span><span class=cF0> vertex_cnt,tri_cnt; </span><span class=cF2>//Set by MeshSize</span><span class=cF0>
<a name="l47"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> vertex_head,*cur_vertex,*chain_pred;
<a name="l48"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> tri_head,*cur_tri;
<a name="l49"></a> </span><span class=cF9>I64</span><span class=cF0> x1,y1,x2,y2,cur_snap;
<a name="l50"></a>};
<a name="l51"></a>
<a name="l52"></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="l53"></a>{
<a name="l54"></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="l55"></a> tmpv-&gt;p.x=x;
<a name="l56"></a> tmpv-&gt;p.y=y;
<a name="l57"></a> tmpv-&gt;p.z=z;
<a name="l58"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpv,e-&gt;vertex_head.last);
<a name="l59"></a> </span><span class=cF1>return</span><span class=cF0> tmpv;
<a name="l60"></a>}
<a name="l61"></a>
<a name="l62"></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,
<a name="l63"></a> </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="l64"></a>{
<a name="l65"></a> </span><span class=cF1>static</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> cpu_num=0;
<a name="l66"></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="l67"></a> tmpt-&gt;cpu_num=cpu_num++%</span><span class=cFB>mp_cnt</span><span class=cF0>;
<a name="l68"></a> tmpt-&gt;mt.color=color;
<a name="l69"></a> tmpt-&gt;t[0]=v1;
<a name="l70"></a> tmpt-&gt;t[1]=v2;
<a name="l71"></a> tmpt-&gt;t[2]=v3;
<a name="l72"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpt,e-&gt;tri_head.last);
<a name="l73"></a> </span><span class=cF1>return</span><span class=cF0> tmpt;
<a name="l74"></a>}
<a name="l75"></a>
<a name="l76"></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="l77"></a>{</span><span class=cF2>//Scrn coordinates</span><span class=cF0>
<a name="l78"></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="l79"></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="l80"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l81"></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="l82"></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="l83"></a> dz=</span><span class=cF5>AbsI64</span><span class=cF0>(e-&gt;ms_z-tmpv-&gt;p.z);
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;best_dd || dd==best_dd &amp;&amp; dz&lt;best_dz) </span><span class=cF7>{</span><span class=cF0>
<a name="l85"></a> res=tmpv;
<a name="l86"></a> best_dd=dd;
<a name="l87"></a> best_dz=dz;
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l89"></a> }
<a name="l90"></a> tmpv=tmpv-&gt;next;
<a name="l91"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l92"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l93"></a>}
<a name="l94"></a>
<a name="l95"></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="l96"></a>{
<a name="l97"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=haystack_e-&gt;vertex_head.next;
<a name="l98"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;haystack_e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;num==needle_num)
<a name="l100"></a> </span><span class=cF1>return</span><span class=cF0> tmpv;
<a name="l101"></a> tmpv=tmpv-&gt;next;
<a name="l102"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l103"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l104"></a>}
<a name="l105"></a>
<a name="l106"></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="l107"></a>{
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt) </span><span class=cF7>{</span><span class=cF0>
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt==e-&gt;cur_tri)
<a name="l110"></a> e-&gt;cur_tri=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l111"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpt);
<a name="l112"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l113"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l114"></a>}
<a name="l115"></a>
<a name="l116"></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="l117"></a>{
<a name="l118"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l119"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt,*tmpt1;
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv) </span><span class=cF7>{</span><span class=cF0>
<a name="l121"></a> tmpt=e-&gt;tri_head.next;
<a name="l122"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) {
<a name="l123"></a> tmpt1=tmpt-&gt;next;
<a name="l124"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;3;i++)
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;t[i]==tmpv)
<a name="l126"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (i&lt;3)
<a name="l128"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(e,tmpt);
<a name="l129"></a> tmpt=tmpt1;
<a name="l130"></a> }
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv==e-&gt;cur_vertex)
<a name="l132"></a> e-&gt;cur_vertex=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv==e-&gt;chain_pred)
<a name="l134"></a> e-&gt;chain_pred=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l135"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpv);
<a name="l136"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpv);
<a name="l137"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l138"></a>}
<a name="l139"></a>
<a name="l140"></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="l141"></a>{
<a name="l142"></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="l143"></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="l144"></a> tmpv=</span><span class=cF1>start</span><span class=cF0>;
<a name="l145"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l146"></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="l147"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv_last) {
<a name="l148"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e,e-&gt;cur_color,tmpv_last,tmpv,tmpv1);
<a name="l149"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e,e-&gt;cur_color,tmpv1,tmpv1_last,tmpv_last);
<a name="l150"></a> }
<a name="l151"></a> tmpv_last=tmpv;
<a name="l152"></a> tmpv1_last=tmpv1;
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv==</span><span class=cF1>end</span><span class=cF0>)
<a name="l154"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l155"></a> tmpv=tmpv-&gt;next;
<a name="l156"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;closed &amp;&amp; tmpv_last) </span><span class=cF7>{</span><span class=cF0>
<a name="l158"></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="l159"></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="l160"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l161"></a>}
<a name="l162"></a>
<a name="l163"></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="l164"></a>{
<a name="l165"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv,*tmpv1;
<a name="l166"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l167"></a> tmpv=</span><span class=cF1>start</span><span class=cF0>;
<a name="l168"></a> tmpv1=tmpv-&gt;next;
<a name="l169"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv1!=</span><span class=cF1>end</span><span class=cF0>) {
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (rev)
<a name="l171"></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="l172"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l173"></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="l174"></a> tmpv=tmpv-&gt;next;
<a name="l175"></a> tmpv1=tmpv1-&gt;next;
<a name="l176"></a> }
<a name="l177"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l178"></a>}
<a name="l179"></a>
<a name="l180"></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="l181"></a>{
<a name="l182"></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="l183"></a> </span><span class=cF5>MeshFence</span><span class=cF0>(e);
<a name="l184"></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="l185"></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="l186"></a>}
<a name="l187"></a>
<a name="l188"></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="l189"></a>{
<a name="l190"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l191"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (val)
<a name="l193"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l194"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l195"></a> tmpv-&gt;flags&amp;=~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l196"></a> tmpv=tmpv-&gt;next;
<a name="l197"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l198"></a>}
<a name="l199"></a>
<a name="l200"></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="l201"></a>{
<a name="l202"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l203"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (val)
<a name="l205"></a> tmpt-&gt;flags|=</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l206"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l207"></a> tmpt-&gt;flags&amp;=~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l208"></a> tmpt=tmpt-&gt;next;
<a name="l209"></a> </span><span class=cF7>}</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>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="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> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l216"></a> tmpv-&gt;flags&amp;=~</span><span class=cF3>VF_IGNORE</span><span class=cF0>;
<a name="l217"></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="l218"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_IGNORE</span><span class=cF0>;
<a name="l219"></a> tmpv=tmpv-&gt;next;
<a name="l220"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l221"></a>}
<a name="l222"></a>
<a name="l223"></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="l224"></a>{
<a name="l225"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l226"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l227"></a> </span><span class=cF5>MemCpy</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="l228"></a> tmpv=tmpv-&gt;next;
<a name="l229"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l230"></a>}
<a name="l231"></a>
<a name="l232"></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="l233"></a>{
<a name="l234"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l235"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l236"></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="l237"></a> tmpv-&gt;p.x=tmpv-&gt;p0.x+dx;
<a name="l238"></a> tmpv-&gt;p.y=tmpv-&gt;p0.y+dy;
<a name="l239"></a> tmpv-&gt;p.z=tmpv-&gt;p0.z+dz;
<a name="l240"></a> }
<a name="l241"></a> tmpv=tmpv-&gt;next;
<a name="l242"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l243"></a>}
<a name="l244"></a>
<a name="l245"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SEL_MESH_EQU</span><span class=cF0> 0
<a name="l246"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SEL_MESH_OR</span><span class=cF0> 1
<a name="l247"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SEL_MESH_AND</span><span class=cF0> 2
<a name="l248"></a>
<a name="l249"></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="l250"></a>{
<a name="l251"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (x1&gt;x2) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;x1,&amp;x2);
<a name="l253"></a> </span><span class=cF1>if</span><span class=cF0> (y1&gt;y2) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;y1,&amp;y2);
<a name="l254"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;=tmpv-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l256"></a> y1&lt;=tmpv-&gt;pt.y&lt;=y2) {
<a name="l257"></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="l258"></a> tmpv-&gt;flags&amp;=~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l259"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l260"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l261"></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="l262"></a> tmpv-&gt;flags&amp;=~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l263"></a> tmpv=tmpv-&gt;next;
<a name="l264"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l265"></a>}
<a name="l266"></a>
<a name="l267"></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="l268"></a>{
<a name="l269"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l270"></a> </span><span class=cF1>if</span><span class=cF0> (x1&gt;x2) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;x1,&amp;x2);
<a name="l271"></a> </span><span class=cF1>if</span><span class=cF0> (y1&gt;y2) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;y1,&amp;y2);
<a name="l272"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l273"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;=tmpt-&gt;t[0]-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l274"></a> y1&lt;=tmpt-&gt;t[0]-&gt;pt.y&lt;=y2 &amp;&amp;
<a name="l275"></a> x1&lt;=tmpt-&gt;t[1]-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l276"></a> y1&lt;=tmpt-&gt;t[1]-&gt;pt.y&lt;=y2 &amp;&amp;
<a name="l277"></a> x1&lt;=tmpt-&gt;t[2]-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l278"></a> y1&lt;=tmpt-&gt;t[2]-&gt;pt.y&lt;=y2) {
<a name="l279"></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="l280"></a> tmpt-&gt;flags&amp;=~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l281"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l282"></a> tmpt-&gt;flags|=</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l283"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l284"></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="l285"></a> tmpt-&gt;flags&amp;=~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l286"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;=tmpt-&gt;t[0]-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l288"></a> y1&lt;=tmpt-&gt;t[0]-&gt;pt.y&lt;=y2 ||
<a name="l289"></a> x1&lt;=tmpt-&gt;t[1]-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l290"></a> y1&lt;=tmpt-&gt;t[1]-&gt;pt.y&lt;=y2 ||
<a name="l291"></a> x1&lt;=tmpt-&gt;t[2]-&gt;pt.x&lt;=x2 &amp;&amp;
<a name="l292"></a> y1&lt;=tmpt-&gt;t[2]-&gt;pt.y&lt;=y2)
<a name="l293"></a> tmpt-&gt;flags&amp;=~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l294"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l295"></a> }
<a name="l296"></a> tmpt=tmpt-&gt;next;
<a name="l297"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l298"></a>}
<a name="l299"></a>
<a name="l300"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>MeshSelCnt</span><span class=cF0>(</span><span class=cF9>CMeshFrame</span><span class=cF0> *e)
<a name="l301"></a>{
<a name="l302"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
<a name="l303"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l304"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l305"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l306"></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="l307"></a> res++;
<a name="l308"></a> tmpv=tmpv-&gt;next;
<a name="l309"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l310"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l311"></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="l312"></a> res++;
<a name="l313"></a> tmpt=tmpt-&gt;next;
<a name="l314"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l315"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l316"></a>}
<a name="l317"></a>
<a name="l318"></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="l319"></a>{
<a name="l320"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l321"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l323"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l324"></a> unsel=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l325"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l326"></a> unsel=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l327"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l328"></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="l329"></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="l330"></a> tmpv=tmpv-&gt;next;
<a name="l331"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l332"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l333"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l334"></a>}
<a name="l335"></a>
<a name="l336"></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="l337"></a>{
<a name="l338"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l339"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l340"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l341"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l342"></a> unsel=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l343"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l344"></a> unsel=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l345"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l346"></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="l347"></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="l348"></a> tmpv=tmpv-&gt;next;
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l350"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l351"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l352"></a>}
<a name="l353"></a>
<a name="l354"></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="l355"></a>{
<a name="l356"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l357"></a> </span><span class=cF9>I64</span><span class=cF0> r[16],x,y,z;
<a name="l358"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l359"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>) {
<a name="l361"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l362"></a> unsel=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l363"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l364"></a> unsel=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l365"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) {
<a name="l366"></a> </span><span class=cF1>if</span><span class=cF0> (tmpv-&gt;flags&amp;</span><span class=cF3>VF_SEL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l367"></a> x=tmpv-&gt;p.x; y=tmpv-&gt;p.y; z=tmpv-&gt;p.z;
<a name="l368"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l369"></a> tmpv-&gt;p.x=x; tmpv-&gt;p.y=y; tmpv-&gt;p.z=z;
<a name="l370"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l371"></a> tmpv=tmpv-&gt;next;
<a name="l372"></a> }
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l374"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l375"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l376"></a>}
<a name="l377"></a>
<a name="l378"></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="l379"></a>{
<a name="l380"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l381"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l382"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l383"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l384"></a> unsel=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l385"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l386"></a> unsel=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l387"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l388"></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="l389"></a> tmpt-&gt;mt.color=e-&gt;cur_color;
<a name="l390"></a> tmpt=tmpt-&gt;next;
<a name="l391"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l393"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l394"></a>}
<a name="l395"></a>
<a name="l396"></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="l397"></a>{
<a name="l398"></a> </span><span class=cF1>Bool</span><span class=cF0> unsel;
<a name="l399"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l400"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>e</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l401"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l402"></a> unsel=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l403"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l404"></a> unsel=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l405"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l406"></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="l407"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;tmpt-&gt;t[1],&amp;tmpt-&gt;t[2]);
<a name="l408"></a> tmpt=tmpt-&gt;next;
<a name="l409"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l410"></a> </span><span class=cF1>if</span><span class=cF0> (unsel)
<a name="l411"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l412"></a>}
<a name="l413"></a>
<a name="l414"></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="l415"></a>{
<a name="l416"></a> e-&gt;cx=</span><span class=cF5>RoundI64</span><span class=cF0>(task-&gt;pix_width/2 -task-&gt;horz_scroll.pos,e-&gt;cur_snap);
<a name="l417"></a> e-&gt;cy=</span><span class=cF5>RoundI64</span><span class=cF0>(task-&gt;pix_height/2-task-&gt;vert_scroll.pos,e-&gt;cur_snap);
<a name="l418"></a>}
<a name="l419"></a>
<a name="l420"></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="l421"></a>{
<a name="l422"></a> </span><span class=cF9>I64</span><span class=cF0> x1,y1,z1,x2,y2,z2;
<a name="l423"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;w2s) </span><span class=cF7>{</span><span class=cF0>
<a name="l424"></a> x1=e-&gt;cur_snap&lt;&lt;16; y1=0; z1=0;
<a name="l425"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s,&amp;x1,&amp;y1,&amp;z1);
<a name="l426"></a> x2=0; y2=e-&gt;cur_snap&lt;&lt;16; z2=0;
<a name="l427"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s,&amp;x2,&amp;y2,&amp;z2);
<a name="l428"></a> </span><span class=cFB>ms_grid</span><span class=cF0>.x=</span><span class=cF5>Max</span><span class=cF0>(1,</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;16);
<a name="l429"></a> </span><span class=cFB>ms_grid</span><span class=cF0>.y=</span><span class=cF5>Max</span><span class=cF0>(1,</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;16);
<a name="l430"></a> </span><span class=cFB>ms_grid</span><span class=cF0>.z=</span><span class=cF5>Min</span><span class=cF0>(</span><span class=cFB>ms_grid</span><span class=cF0>.x,</span><span class=cFB>ms_grid</span><span class=cF0>.y);
<a name="l431"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l432"></a>}
<a name="l433"></a>
<a name="l434"></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="l435"></a>{
<a name="l436"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l437"></a> </span><span class=cF9>I64</span><span class=cF0> x=</span><span class=cFB>ms</span><span class=cF0>.pos.x-task-&gt;pix_left-task-&gt;scroll_x-task-&gt;pix_width/2,
<a name="l438"></a> y=</span><span class=cFB>ms</span><span class=cF0>.pos.y-task-&gt;pix_top-task-&gt;scroll_y-task-&gt;pix_height/2;
<a name="l439"></a> task-&gt;horz_scroll.pos*=scale;
<a name="l440"></a> task-&gt;vert_scroll.pos*=scale;
<a name="l441"></a> task-&gt;horz_scroll.pos+=scale*x-x;
<a name="l442"></a> task-&gt;vert_scroll.pos+=scale*y-y;
<a name="l443"></a> e-&gt;view_scale*=scale;
<a name="l444"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(task,e);
<a name="l445"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(e);
<a name="l446"></a>}
<a name="l447"></a>
<a name="l448"></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="l449"></a>{</span><span class=cF2>//Multiprocessing draw it, called by each core.</span><span class=cF0>
<a name="l450"></a>
<a name="l451"></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="l452"></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="l453"></a>
<a name="l454"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l455"></a> </span><span class=cF9>I64</span><span class=cF0> i,*old_r=dc-&gt;r;
<a name="l456"></a>
<a name="l457"></a> </span><span class=cF2>//</span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l168"><span class=cF4>DCAlias</span></a><span class=cF2>() allocs a new identity rotation matrix.</span><span class=cF0>
<a name="l458"></a> </span><span class=cF2>//We want e-&gt;dc's rotation matrix.</span><span class=cF0>
<a name="l459"></a> dc-&gt;r=e-&gt;dc-&gt;r;
<a name="l460"></a> dc-&gt;depth_buf=e-&gt;depth_buf;
<a name="l461"></a> </span><span class=cF5>MemCpy</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="l462"></a>
<a name="l463"></a> </span><span class=cF2>//... and translation (shift) vals.</span><span class=cF0>
<a name="l464"></a> dc-&gt;x=e-&gt;dc-&gt;x;
<a name="l465"></a> dc-&gt;y=e-&gt;dc-&gt;y;
<a name="l466"></a> dc-&gt;z=e-&gt;dc-&gt;z;
<a name="l467"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l468"></a>
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;grid_on)
<a name="l470"></a></span><span class=cF2>//Draw grid with different cores.</span><span class=cF0>
<a name="l471"></a> </span><span class=cF1>for</span><span class=cF0> (i=-500+25*</span><span class=cF5>Gs</span><span class=cF0>-&gt;num;i&lt;=500;i+=25*</span><span class=cFB>mp_cnt</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l472"></a> </span><span class=cF1>if</span><span class=cF0> (i) {
<a name="l473"></a> dc-&gt;color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
<a name="l474"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,i,-500,0,i,500,0);
<a name="l475"></a> dc-&gt;color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l476"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,-500,i,0,500,i,0);
<a name="l477"></a> }
<a name="l478"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Gs</span><span class=cF0>-&gt;num) </span><span class=cF7>{</span><span class=cF0>
<a name="l480"></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="l481"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,0,0,0,0,500,0);
<a name="l482"></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="l483"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,0,-500,0,0,0,0);
<a name="l484"></a>
<a name="l485"></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="l486"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,0,0,0,500,0,0);
<a name="l487"></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="l488"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,-500,0,0,0,0,0);
<a name="l489"></a>
<a name="l490"></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="l491"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,0,0,0,0,0,500);
<a name="l492"></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="l493"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,0,0,-500,0,0,0);
<a name="l494"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l495"></a>
<a name="l496"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l497"></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="l498"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;flags &amp; </span><span class=cF3>TF_SEL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l499"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l500"></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;16+</span><span class=cF3>RED</span><span class=cF0>;
<a name="l501"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l502"></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;16+</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l503"></a> </span><span class=cF5>GrFillTri0</span><span class=cF0>(dc,&amp;tmpt-&gt;t[0]-&gt;pt,&amp;tmpt-&gt;t[1]-&gt;pt,&amp;tmpt-&gt;t[2]-&gt;pt);
<a name="l504"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l505"></a> (*dc-&gt;lighting)(dc,&amp;tmpt-&gt;t[0]-&gt;pt,&amp;tmpt-&gt;t[1]-&gt;pt,
<a name="l506"></a> &amp;tmpt-&gt;t[2]-&gt;pt,tmpt-&gt;mt.color);
<a name="l507"></a> </span><span class=cF5>GrFillTri0</span><span class=cF0>(dc,&amp;tmpt-&gt;t[0]-&gt;pt,&amp;tmpt-&gt;t[1]-&gt;pt,&amp;tmpt-&gt;t[2]-&gt;pt);
<a name="l508"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l509"></a> }
<a name="l510"></a> tmpt=tmpt-&gt;next;
<a name="l511"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l512"></a> dc-&gt;r=old_r;
<a name="l513"></a>
<a name="l514"></a> </span><span class=cF2>//e-&gt;dc's depth buf was copied but we don't want it freed during </span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l208"><span class=cF4>DCDel</span></a><span class=cF2>().</span><span class=cF0>
<a name="l515"></a> dc-&gt;depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l516"></a>
<a name="l517"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l518"></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="l519"></a>}
<a name="l520"></a>
<a name="l521"></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="l522"></a>{</span><span class=cF2>//World to scrn coordinate transform matrix.</span><span class=cF0>
<a name="l523"></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="l524"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s=c-&gt;state;
<a name="l525"></a> </span><span class=cF9>I64</span><span class=cF0> *r=</span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>(task);
<a name="l526"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(r,e-&gt;view_scale);
<a name="l527"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r,s-&gt;az);
<a name="l528"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r,s-&gt;ay);
<a name="l529"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;flip_y)
<a name="l530"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r,s-&gt;ax);
<a name="l531"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l532"></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="l533"></a> </span><span class=cF1>return</span><span class=cF0> r;
<a name="l534"></a>}
<a name="l535"></a>
<a name="l536"></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="l537"></a>{</span><span class=cF2>//Scrn to world coordinate transform matrix.</span><span class=cF0>
<a name="l538"></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="l539"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s=c-&gt;state;
<a name="l540"></a> </span><span class=cF9>I64</span><span class=cF0> *r=</span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>(task);
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;flip_y)
<a name="l542"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r,-s-&gt;ax);
<a name="l543"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l544"></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="l545"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r,-s-&gt;ay);
<a name="l546"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r,-s-&gt;az);
<a name="l547"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(r,1/e-&gt;view_scale);
<a name="l548"></a> </span><span class=cF1>return</span><span class=cF0> r;
<a name="l549"></a>}
<a name="l550"></a>
<a name="l551"></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="l552"></a>{
<a name="l553"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;w2s);
<a name="l554"></a> e-&gt;w2s=</span><span class=cF5>MeshW2S</span><span class=cF0>(e,task);
<a name="l555"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;s2w);
<a name="l556"></a> e-&gt;s2w=</span><span class=cF5>MeshS2W</span><span class=cF0>(e,task);
<a name="l557"></a></span><span class=cF2>//returned matrix is assigned to dc-&gt;r and will be freed by </span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l208"><span class=cF4>DCDel</span></a><span class=cF2>().</span><span class=cF0>
<a name="l558"></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="l559"></a>}
<a name="l560"></a>
<a name="l561"></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="l562"></a>{
<a name="l563"></a> </span><span class=cF9>I64</span><span class=cF0> x_shadow,y_shadow,z_shadow,
<a name="l564"></a> xc=</span><span class=cFB>ms</span><span class=cF0>.pos.x-task-&gt;pix_left-task-&gt;scroll_x-e-&gt;cx,
<a name="l565"></a> yc=</span><span class=cFB>ms</span><span class=cF0>.pos.y-task-&gt;pix_top-task-&gt;scroll_y-e-&gt;cy,zc=0,
<a name="l566"></a> x=0,y=0,z=e-&gt;ms_z,
<a name="l567"></a> i,x2,y2,z2;
<a name="l568"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s,&amp;x,&amp;y,&amp;z); </span><span class=cF2>//scrn of Z vect</span><span class=cF0>
<a name="l569"></a>
<a name="l570"></a> </span><span class=cF2>//Converges onto a solution for zc, an unknown.</span><span class=cF0>
<a name="l571"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;128;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l572"></a> x_shadow=xc-x; </span><span class=cF2>//Shadow of mouse cursor on xy plane</span><span class=cF0>
<a name="l573"></a> y_shadow=yc-y;
<a name="l574"></a> z_shadow=zc-z;
<a name="l575"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;s2w,&amp;x_shadow,&amp;y_shadow,&amp;z_shadow);
<a name="l576"></a> x2=0; y2=0; z2=-z_shadow;
<a name="l577"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;w2s,&amp;x2,&amp;y2,&amp;z2);
<a name="l578"></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="l579"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l580"></a>
<a name="l581"></a> x=xc-x;
<a name="l582"></a> y=yc-y;
<a name="l583"></a> z=zc-z;
<a name="l584"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(e-&gt;s2w,&amp;x,&amp;y,&amp;z);
<a name="l585"></a> x=</span><span class=cF5>RoundI64</span><span class=cF0>(x,e-&gt;cur_snap);
<a name="l586"></a> y=</span><span class=cF5>RoundI64</span><span class=cF0>(y,e-&gt;cur_snap);
<a name="l587"></a> z=</span><span class=cF5>RoundI64</span><span class=cF0>(e-&gt;ms_z,e-&gt;cur_snap);
<a name="l588"></a> *_x=x; *_y=y; *_z=z;
<a name="l589"></a>}
<a name="l590"></a>
<a name="l591"></a></span><span class=cF9>CMeshEdVertex</span><span class=cF0> </span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>;
<a name="l592"></a></span><span class=cF9>CMeshEdTri</span><span class=cF0> </span><span class=cFB>sys_clip_tri_head</span><span class=cF0>;
<a name="l593"></a>
<a name="l594"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipInit</span><span class=cF0>()
<a name="l595"></a>{
<a name="l596"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;</span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>);
<a name="l597"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;</span><span class=cFB>sys_clip_tri_head</span><span class=cF0>);
<a name="l598"></a>}
<a name="l599"></a>
<a name="l600"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MeshClipRst</span><span class=cF0>()
<a name="l601"></a>{
<a name="l602"></a> </span><span class=cF5>QueDel</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="l603"></a> </span><span class=cF5>QueDel</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="l604"></a> </span><span class=cF5>MeshClipInit</span><span class=cF0>;
<a name="l605"></a>}
<a name="l606"></a>
<a name="l607"></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="l608"></a>{
<a name="l609"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next,*tmpv2;
<a name="l610"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next,*tmpt2;
<a name="l611"></a>
<a name="l612"></a> </span><span class=cF5>MeshClipRst</span><span class=cF0>;
<a name="l613"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l614"></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="l615"></a> tmpv-&gt;copy=tmpv2=</span><span class=cF5>ACAlloc</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="l616"></a> </span><span class=cF5>MemCpy</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="l617"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpv2,</span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>.last);
<a name="l618"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_COPIED</span><span class=cF0>;
<a name="l619"></a> tmpv-&gt;flags&amp;=~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l620"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l621"></a> tmpv-&gt;copy=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l622"></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="l623"></a> }
<a name="l624"></a> tmpv=tmpv-&gt;next;
<a name="l625"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l626"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l627"></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;
<a name="l628"></a> tmpt-&gt;t[0]-&gt;copy &amp;&amp; tmpt-&gt;t[1]-&gt;copy &amp;&amp; tmpt-&gt;t[2]-&gt;copy) {
<a name="l629"></a> tmpt2=</span><span class=cF5>ACAlloc</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="l630"></a> tmpt2-&gt;t[0]=tmpt-&gt;t[0]-&gt;copy;
<a name="l631"></a> tmpt2-&gt;t[1]=tmpt-&gt;t[1]-&gt;copy;
<a name="l632"></a> tmpt2-&gt;t[2]=tmpt-&gt;t[2]-&gt;copy;
<a name="l633"></a> tmpt2-&gt;mt.color=tmpt-&gt;mt.color;
<a name="l634"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpt2,</span><span class=cFB>sys_clip_tri_head</span><span class=cF0>.last);
<a name="l635"></a> tmpt-&gt;flags|=</span><span class=cF3>TF_COPIED</span><span class=cF0>;
<a name="l636"></a> tmpt-&gt;flags&amp;=~</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l637"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l638"></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="l639"></a> tmpt=tmpt-&gt;next;
<a name="l640"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l641"></a>}
<a name="l642"></a>
<a name="l643"></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="l644"></a>{
<a name="l645"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next,*tmpv1;
<a name="l646"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next,*tmpt1;
<a name="l647"></a> </span><span class=cF5>MeshClipCopy</span><span class=cF0>(e);
<a name="l648"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l649"></a> tmpt1=tmpt-&gt;next;
<a name="l650"></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="l651"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(e,tmpt);
<a name="l652"></a> tmpt=tmpt1;
<a name="l653"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l654"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l655"></a> tmpv1=tmpv-&gt;next;
<a name="l656"></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="l657"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(e,tmpv);
<a name="l658"></a> tmpv=tmpv1;
<a name="l659"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l660"></a>}
<a name="l661"></a>
<a name="l662"></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="l663"></a>{</span><span class=cF2>//Technically not clip</span><span class=cF0>
<a name="l664"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next,*tmpv1;
<a name="l665"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next,*tmpt1;
<a name="l666"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l667"></a> tmpt1=tmpt-&gt;next;
<a name="l668"></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="l669"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(e,tmpt);
<a name="l670"></a> tmpt=tmpt1;
<a name="l671"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l672"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l673"></a> tmpv1=tmpv-&gt;next;
<a name="l674"></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="l675"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(e,tmpv);
<a name="l676"></a> tmpv=tmpv1;
<a name="l677"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l678"></a>}
<a name="l679"></a>
<a name="l680"></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="l681"></a>{
<a name="l682"></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="l683"></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="l684"></a>
<a name="l685"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l686"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l687"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv2!=&amp;</span><span class=cFB>sys_clip_vertex_head</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l688"></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="l689"></a> </span><span class=cF5>MemCpy</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="l690"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpv,e-&gt;vertex_head.last);
<a name="l691"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l692"></a> tmpv2=tmpv2-&gt;next;
<a name="l693"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l694"></a>
<a name="l695"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt2!=&amp;</span><span class=cFB>sys_clip_tri_head</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l696"></a> tmpt=</span><span class=cF5>MeshTriNew</span><span class=cF0>(e,tmpt2-&gt;mt.color,tmpt2-&gt;t[0]-&gt;copy,
<a name="l697"></a> tmpt2-&gt;t[1]-&gt;copy,tmpt2-&gt;t[2]-&gt;copy);
<a name="l698"></a> tmpt-&gt;flags|=</span><span class=cF3>TF_SEL</span><span class=cF0>;
<a name="l699"></a> tmpt2=tmpt2-&gt;next;
<a name="l700"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l701"></a>}
<a name="l702"></a>
<a name="l703"></a></span><span class=cF5>MeshClipInit</span><span class=cF0>;
<a name="l704"></a>
<a name="l705"></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="l706"></a>{
<a name="l707"></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="l708"></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="l709"></a> </span><span class=cF1>F64</span><span class=cF0> d;
<a name="l710"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z;
<a name="l711"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv;
<a name="l712"></a>
<a name="l713"></a> task-&gt;horz_scroll.min=-(</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0>-task-&gt;pix_width)/2;
<a name="l714"></a> task-&gt;horz_scroll.max= (</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0>-task-&gt;pix_width)/2;
<a name="l715"></a> task-&gt;vert_scroll.min=-(</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0>-task-&gt;pix_height)/2;
<a name="l716"></a> task-&gt;vert_scroll.max= (</span><span class=cF3>MESH_WORKSPACE_SIZE</span><span class=cF0>-task-&gt;pix_height)/2;
<a name="l717"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
<a name="l718"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(task,e);
<a name="l719"></a>
<a name="l720"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l721"></a>
<a name="l722"></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="l723"></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="l724"></a>
<a name="l725"></a> dc-&gt;x=e-&gt;cx;
<a name="l726"></a> dc-&gt;y=e-&gt;cy;
<a name="l727"></a></span><span class=cF2>//z-vals less than zero are in front of scrn and not drawn.</span><span class=cF0>
<a name="l728"></a> </span><span class=cF2>//we want to shift all Z-vals into a drawable range.</span><span class=cF0>
<a name="l729"></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="l730"></a> dc-&gt;z=</span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
<a name="l731"></a>
<a name="l732"></a> </span><span class=cF2>//Light source set to mouse.</span><span class=cF0>
<a name="l733"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(e,task,&amp;x,&amp;y,&amp;z);
<a name="l734"></a> dc-&gt;ls.x=x;
<a name="l735"></a> dc-&gt;ls.y=y;
<a name="l736"></a> dc-&gt;ls.z=z;
<a name="l737"></a> d=1&lt;&lt;16/</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="l738"></a> dc-&gt;ls.x*=d;
<a name="l739"></a> dc-&gt;ls.y*=d;
<a name="l740"></a> dc-&gt;ls.z*=d;
<a name="l741"></a>
<a name="l742"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l743"></a>
<a name="l744"></a> tmpv=e-&gt;vertex_head.next;
<a name="l745"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l746"></a> x=tmpv-&gt;p.x; y=tmpv-&gt;p.y; z=tmpv-&gt;p.z;
<a name="l747"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l748"></a> tmpv-&gt;pt.x=x; tmpv-&gt;pt.y=y; tmpv-&gt;pt.z=z;
<a name="l749"></a> tmpv=tmpv-&gt;next;
<a name="l750"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l751"></a>
<a name="l752"></a> e-&gt;mp_not_done_flags=1&lt;&lt;</span><span class=cFB>mp_cnt</span><span class=cF0>-1; </span><span class=cF2>//Issue jobs to all cores.</span><span class=cF0>
<a name="l753"></a> e-&gt;dc=dc;
<a name="l754"></a> e-&gt;depth_buf=dc-&gt;depth_buf;
<a name="l755"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cFB>mp_cnt</span><span class=cF0>;i++)
<a name="l756"></a> </span><span class=cF5>JobQue</span><span class=cF0>(&amp;</span><span class=cF5>MPDrawIt</span><span class=cF0>,e,i);
<a name="l757"></a>
<a name="l758"></a> tmpv=e-&gt;vertex_head.next;
<a name="l759"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l760"></a> x=tmpv-&gt;pt.x; y=tmpv-&gt;pt.y; z=tmpv-&gt;pt.z;
<a name="l761"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;vertex_on) {
<a name="l762"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cF0>10</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF2>//This blinks at 10 Hz.</span><span class=cF0>
<a name="l763"></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;16+</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l764"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l765"></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;16+</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l766"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,x-3,y-3,x+3,y+3);
<a name="l767"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,x-3,y+3,x+3,y-3);
<a name="l768"></a> }
<a name="l769"></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="l770"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;ed_mode==</span><span class=cF6>'t'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l771"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cF0>10</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF2>//This blinks at 10 Hz.</span><span class=cF0>
<a name="l772"></a> dc-&gt;color=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>+e-&gt;cur_color.c0.color&lt;&lt;16+
<a name="l773"></a> e-&gt;cur_color.c0.color^8;
<a name="l774"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l775"></a> dc-&gt;color=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>+(e-&gt;cur_color.c0.color^8)&lt;&lt;16+
<a name="l776"></a> e-&gt;cur_color.c0.color;
<a name="l777"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l778"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l779"></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;16+</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l780"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l781"></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;16+</span><span class=cF3>RED</span><span class=cF0>;
<a name="l782"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l783"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,x,y,3);
<a name="l784"></a> }
<a name="l785"></a> tmpv=tmpv-&gt;next;
<a name="l786"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l787"></a>
<a name="l788"></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>ms</span><span class=cF0>.presnap.x,</span><span class=cFB>ms</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) </span><span class=cF7>{</span><span class=cF0>
<a name="l789"></a> </span><span class=cF5>GridInit</span><span class=cF0>;
<a name="l790"></a> task-&gt;win_inhibit=</span><span class=cF3>WIF_SELF_DOC</span><span class=cF0>;
<a name="l791"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l792"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(e);
<a name="l793"></a> task-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>|</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>
<a name="l794"></a> -</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="l795"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l796"></a>
<a name="l797"></a> </span><span class=cF5>MeshCursorW</span><span class=cF0>(e,task,&amp;x,&amp;y,&amp;z);
<a name="l798"></a> </span><span class=cF1>if</span><span class=cF0> (z&lt;0)
<a name="l799"></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="l800"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l801"></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="l802"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>&quot;%6.3f%% (%d,%d,%d)&quot;</span><span class=cF0>,e-&gt;view_scale*100,x,y,z);
<a name="l803"></a> dc-&gt;thick=1;
<a name="l804"></a> dc-&gt;color&amp;=0xF;
<a name="l805"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cF0>10</span><span class=cF7>)</span><span class=cF0>)
<a name="l806"></a> dc-&gt;color^=0xF;
<a name="l807"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,x,y,z,x,y,0);
<a name="l808"></a>
<a name="l809"></a> </span><span class=cF1>if</span><span class=cF0> (e-&gt;sel_rect) </span><span class=cF7>{</span><span class=cF0>
<a name="l810"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l811"></a> dc-&gt;thick=1;
<a name="l812"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l813"></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;16+</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l814"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l815"></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;16+</span><span class=cF3>RED</span><span class=cF0>;
<a name="l816"></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="l817"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l818"></a></span><span class=cF2>//Wait for all cores to complete.</span><span class=cF0>
<a name="l819"></a> </span><span class=cF1>while</span><span class=cF0> (e-&gt;mp_not_done_flags)
<a name="l820"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l821"></a>}
<a name="l822"></a>
<a name="l823"></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="l824"></a>{
<a name="l825"></a> </span><span class=cF5>MemSet</span><span class=cF0>(e,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshFrame</span><span class=cF7>)</span><span class=cF0>);
<a name="l826"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;e-&gt;vertex_head);
<a name="l827"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;e-&gt;tri_head);
<a name="l828"></a> e-&gt;ed_mode=</span><span class=cF6>'v'</span><span class=cF0>;
<a name="l829"></a> e-&gt;grid_on=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l830"></a> e-&gt;vertex_on=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l831"></a> e-&gt;ms_z=0;
<a name="l832"></a> e-&gt;thickness=25;
<a name="l833"></a> e-&gt;closed=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l834"></a> e-&gt;view_scale=1.0;
<a name="l835"></a> e-&gt;w2s=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l836"></a> e-&gt;s2w=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l837"></a> e-&gt;cur_color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l838"></a> e-&gt;cur_snap=5;
<a name="l839"></a> e-&gt;flip_y=flip_y;
<a name="l840"></a> e-&gt;sel_rect=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l841"></a> e-&gt;cur_tri=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l842"></a> e-&gt;cur_vertex=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l843"></a> e-&gt;chain_pred=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l844"></a>}
<a name="l845"></a>
<a name="l846"></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="l847"></a>{
<a name="l848"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,x,y,z;
<a name="l849"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> color;
<a name="l850"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv,*va[3];
<a name="l851"></a>
<a name="l852"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;e-&gt;vertex_head);
<a name="l853"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;e-&gt;tri_head);
<a name="l854"></a>
<a name="l855"></a> e-&gt;vertex_cnt =*src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l856"></a> e-&gt;tri_cnt=*src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l857"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;e-&gt;vertex_cnt;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l858"></a> x=*src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l859"></a> y=*src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l860"></a> z=*src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l861"></a> tmpv=</span><span class=cF5>MeshVertexNew</span><span class=cF0>(e,x,y,z);
<a name="l862"></a> tmpv-&gt;num=i;
<a name="l863"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l864"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;e-&gt;tri_cnt;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l865"></a> color=*src(</span><span class=cF9>I32</span><span class=cF0> *)++;
<a name="l866"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;3;j++)
<a name="l867"></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="l868"></a> </span><span class=cF5>MeshTriNew</span><span class=cF0>(e,color,va[0],va[1],va[2]);
<a name="l869"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l870"></a>}
<a name="l871"></a>
<a name="l872"></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="l873"></a>{
<a name="l874"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l875"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l876"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l877"></a>
<a name="l878"></a> e-&gt;vertex_cnt=0;
<a name="l879"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l880"></a> tmpv-&gt;num=e-&gt;vertex_cnt++;
<a name="l881"></a> tmpv=tmpv-&gt;next;
<a name="l882"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l883"></a>
<a name="l884"></a> e-&gt;tri_cnt=0;
<a name="l885"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l886"></a> e-&gt;tri_cnt++;
<a name="l887"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;3;i++)
<a name="l888"></a> tmpt-&gt;mt.nums[i]=tmpt-&gt;t[i]-&gt;num;
<a name="l889"></a> tmpt=tmpt-&gt;next;
<a name="l890"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l891"></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>)*2+
<a name="l892"></a> (</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_cnt+
<a name="l893"></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_cnt;
<a name="l894"></a>}
<a name="l895"></a>
<a name="l896"></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="l897"></a>{
<a name="l898"></a> </span><span class=cF9>I64</span><span class=cF0> size=</span><span class=cF5>MeshSize</span><span class=cF0>(e);
<a name="l899"></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="l900"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *tmpv=e-&gt;vertex_head.next;
<a name="l901"></a> </span><span class=cF9>CMeshEdTri</span><span class=cF0> *tmpt=e-&gt;tri_head.next;
<a name="l902"></a>
<a name="l903"></a> *dst(</span><span class=cF9>I32</span><span class=cF0> *)++=e-&gt;vertex_cnt;
<a name="l904"></a> *dst(</span><span class=cF9>I32</span><span class=cF0> *)++=e-&gt;tri_cnt;
<a name="l905"></a>
<a name="l906"></a> e-&gt;vertex_cnt=0;
<a name="l907"></a> </span><span class=cF1>while</span><span class=cF0> (tmpv!=&amp;e-&gt;vertex_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l908"></a> </span><span class=cF5>MemCpy</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="l909"></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="l910"></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="l911"></a> tmpv=tmpv-&gt;next;
<a name="l912"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l913"></a>
<a name="l914"></a> e-&gt;tri_cnt=0;
<a name="l915"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;e-&gt;tri_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l916"></a> </span><span class=cF5>MemCpy</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="l917"></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="l918"></a> tmpt=tmpt-&gt;next;
<a name="l919"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l920"></a> </span><span class=cF1>if</span><span class=cF0> (_size) *_size=size;
<a name="l921"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l922"></a>}
<a name="l923"></a>
<a name="l924"></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="l925"></a>{
<a name="l926"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;e-&gt;vertex_head,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l927"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;e-&gt;tri_head,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l928"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;w2s);
<a name="l929"></a> </span><span class=cF5>Free</span><span class=cF0>(e-&gt;s2w);
<a name="l930"></a>}
<a name="l931"></a>
<a name="l932"></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="l933"></a>{
<a name="l934"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
<a name="l935"></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="l936"></a> tmpse-&gt;checked=</span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;grid_on);
<a name="l937"></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="l938"></a> tmpse-&gt;checked=</span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;vertex_on);
<a name="l939"></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="l940"></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="l941"></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="l942"></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="l943"></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="l944"></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="l945"></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="l946"></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="l947"></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="l948"></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="l949"></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="l950"></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="l951"></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="l952"></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="l953"></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="l954"></a> tmpse-&gt;checked=</span><span class=cF5>ToBool</span><span class=cF0>(e-&gt;flip_y);
<a name="l955"></a>}
<a name="l956"></a>
<a name="l957"></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="l958"></a>{</span><span class=cF2>/*Fmt for mesh:</span><span class=cF0>
<a name="l959"></a></span><span class=cF2>{</span><span class=cF0>
<a name="l960"></a></span><span class=cF2>I32 vertex_cnt;</span><span class=cF0>
<a name="l961"></a></span><span class=cF2>I32 tri_cnt;</span><span class=cF0>
<a name="l962"></a></span><span class=cF2>CD3I32 vertices[];</span><span class=cF0>
<a name="l963"></a></span><span class=cF2>CMeshTri tris[];</span><span class=cF0>
<a name="l964"></a></span><span class=cF2>}</span><span class=cF0>
<a name="l965"></a>
<a name="l966"></a></span><span class=cF2>If head points to a mesh, it will load it.</span><span class=cF0>
<a name="l967"></a>
<a name="l968"></a></span><span class=cF2>Returns a newly malloced mesh or NULL.</span><span class=cF0>
<a name="l969"></a>
<a name="l970"></a></span><span class=cF2>See </span><a href="/Wb/Demo/Graphics/SpritePlot3D.HC.HTML#l1"><span class=cF4>::/Demo/Graphics/SpritePlot3D.HC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l971"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l972"></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="l973"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s,*old_s;
<a name="l974"></a> </span><span class=cF9>I64</span><span class=cF0> i,msg_code,sel_mode,arg1,arg2,make_tri_vertex_num=0,x,y,z;
<a name="l975"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p0a,p0b;
<a name="l976"></a> </span><span class=cF9>CMeshEdVertex</span><span class=cF0> *va[3],*tmpv;
<a name="l977"></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;
<a name="l978"></a> </span><span class=cF9>CMeshFrame</span><span class=cF0> e;
<a name="l979"></a>
<a name="l980"></a> </span><span class=cF1>if</span><span class=cF0> (c) </span><span class=cF7>{</span><span class=cF0>
<a name="l981"></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="l982"></a> </span><span class=cF5>MemCpy</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="l983"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l984"></a> c=</span><span class=cF5>ViewAnglesNew</span><span class=cF0>;
<a name="l985"></a> old_s=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l986"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l987"></a>
<a name="l988"></a> s=c-&gt;state;
<a name="l989"></a> s-&gt;sx=0;
<a name="l990"></a> s-&gt;sy=0;
<a name="l991"></a> s-&gt;sz=0;
<a name="l992"></a> s-&gt;cx=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l993"></a> s-&gt;cy=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l994"></a> s-&gt;cz=</span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l995"></a>
<a name="l996"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l997"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l998"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l999"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l1000"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1001"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l1002"></a> </span><span class=cF6>&quot; Delete(,,SC_DELETE);&quot;</span><span class=cF0>
<a name="l1003"></a> </span><span class=cF6>&quot; DelLast(,CH_BACKSPACE);&quot;</span><span class=cF0>
<a name="l1004"></a> </span><span class=cF6>&quot; Cut(,CH_CTRLX);&quot;</span><span class=cF0>
<a name="l1005"></a> </span><span class=cF6>&quot; Copy(,CH_CTRLC);&quot;</span><span class=cF0>
<a name="l1006"></a> </span><span class=cF6>&quot; Paste(,CH_CTRLV);&quot;</span><span class=cF0>
<a name="l1007"></a> </span><span class=cF6>&quot; SelectAll(,'A');&quot;</span><span class=cF0>
<a name="l1008"></a> </span><span class=cF6>&quot; UnSelectAll(,'U');&quot;</span><span class=cF0>
<a name="l1009"></a> </span><span class=cF6>&quot; SelectRect(,'a');&quot;</span><span class=cF0>
<a name="l1010"></a> </span><span class=cF6>&quot; UnSelectRect(,'u');&quot;</span><span class=cF0>
<a name="l1011"></a> </span><span class=cF6>&quot; OrSelectRect(,'o');&quot;</span><span class=cF0>
<a name="l1012"></a> </span><span class=cF6>&quot; JumpToZ(,'j');&quot;</span><span class=cF0>
<a name="l1013"></a> </span><span class=cF6>&quot; ResetColor(,'C');&quot;</span><span class=cF0>
<a name="l1014"></a> </span><span class=cF6>&quot; ReverseTri(,'r');&quot;</span><span class=cF0>
<a name="l1015"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1016"></a> </span><span class=cF6>&quot;Mode {&quot;</span><span class=cF0>
<a name="l1017"></a> </span><span class=cF6>&quot; PlaceVertex(,'v');&quot;</span><span class=cF0>
<a name="l1018"></a> </span><span class=cF6>&quot; MoveVertex(,'m');&quot;</span><span class=cF0>
<a name="l1019"></a> </span><span class=cF6>&quot; MoveVertexZ(,'M');&quot;</span><span class=cF0>
<a name="l1020"></a> </span><span class=cF6>&quot; Triangle(,'t');&quot;</span><span class=cF0>
<a name="l1021"></a> </span><span class=cF6>&quot; Polygon(,'n');&quot;</span><span class=cF0>
<a name="l1022"></a> </span><span class=cF6>&quot; Fence(,'f');&quot;</span><span class=cF0>
<a name="l1023"></a> </span><span class=cF6>&quot; Prism(,'p');&quot;</span><span class=cF0>
<a name="l1024"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1025"></a> </span><span class=cF6>&quot;Settings {&quot;</span><span class=cF0>
<a name="l1026"></a> </span><span class=cF6>&quot; Color(,'c');&quot;</span><span class=cF0>
<a name="l1027"></a> </span><span class=cF6>&quot; Snap(,'s');&quot;</span><span class=cF0>
<a name="l1028"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1029"></a> </span><span class=cF6>&quot;View {&quot;</span><span class=cF0>
<a name="l1030"></a> </span><span class=cF6>&quot; ZoomIn(,'z');&quot;</span><span class=cF0>
<a name="l1031"></a> </span><span class=cF6>&quot; ZoomOut(,'Z');&quot;</span><span class=cF0>
<a name="l1032"></a> </span><span class=cF6>&quot; NullAngles(,'N');&quot;</span><span class=cF0>
<a name="l1033"></a> </span><span class=cF6>&quot; FlipY(,'y');&quot;</span><span class=cF0>
<a name="l1034"></a> </span><span class=cF6>&quot; Grid(,'g');&quot;</span><span class=cF0>
<a name="l1035"></a> </span><span class=cF6>&quot; Vertex(,'V');&quot;</span><span class=cF0>
<a name="l1036"></a> </span><span class=cF6>&quot; ToggleBorder(,CH_CTRLB);&quot;</span><span class=cF0>
<a name="l1037"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1038"></a> </span><span class=cF6>&quot;Transforms {&quot;</span><span class=cF0>
<a name="l1039"></a> </span><span class=cF6>&quot; Transform(,'T');&quot;</span><span class=cF0>
<a name="l1040"></a> </span><span class=cF6>&quot; SwapXY(,'1');&quot;</span><span class=cF0>
<a name="l1041"></a> </span><span class=cF6>&quot; SwapXZ(,'2');&quot;</span><span class=cF0>
<a name="l1042"></a> </span><span class=cF6>&quot; SwapYZ(,'3');&quot;</span><span class=cF0>
<a name="l1043"></a> </span><span class=cF6>&quot; InvertX(,'4');&quot;</span><span class=cF0>
<a name="l1044"></a> </span><span class=cF6>&quot; InvertY(,'5');&quot;</span><span class=cF0>
<a name="l1045"></a> </span><span class=cF6>&quot; InvertZ(,'6');&quot;</span><span class=cF0>
<a name="l1046"></a> </span><span class=cF6>&quot; ReverseTri(,'R');&quot;</span><span class=cF0>
<a name="l1047"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l1048"></a>
<a name="l1049"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l1050"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l1051"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_MESH_ED</span><span class=cF0>,
<a name="l1052"></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="l1053"></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="l1054"></a> </span><span class=cF6>&quot;$GREEN$'v'$FG$: Place Vertex Mode\n&quot;</span><span class=cF0>
<a name="l1055"></a> </span><span class=cF6>&quot;$GREEN$'m'$FG$: Move Vertex Mode\n&quot;</span><span class=cF0>
<a name="l1056"></a> </span><span class=cF6>&quot;$GREEN$'M'$FG$: Move Vertex Z\n&quot;</span><span class=cF0>
<a name="l1057"></a> </span><span class=cF6>&quot;$GREEN$'t'$FG$: Form Triangle Mode\n&quot;</span><span class=cF0>
<a name="l1058"></a> </span><span class=cF6>&quot;$GREEN$'n'$FG$: Polygon Mode\n&quot;</span><span class=cF0>
<a name="l1059"></a> </span><span class=cF6>&quot;$GREEN$'f'$FG$: Fence Mode\n&quot;</span><span class=cF0>
<a name="l1060"></a> </span><span class=cF6>&quot;$GREEN$'p'$FG$: Prism Mode\n&quot;</span><span class=cF0>
<a name="l1061"></a> </span><span class=cF6>&quot;$GREEN$'c'$FG$: Set color\n&quot;</span><span class=cF0>
<a name="l1062"></a> </span><span class=cF6>&quot;$GREEN$'s'$FG$: Set snap\n&quot;</span><span class=cF0>
<a name="l1063"></a> </span><span class=cF6>&quot;\nSee menu at top of scrn for more.\n&quot;</span><span class=cF0>);
<a name="l1064"></a>
<a name="l1065"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>|</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>
<a name="l1066"></a> -</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="l1067"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;horz_scroll.pos=0;
<a name="l1068"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;vert_scroll.pos=0;
<a name="l1069"></a> </span><span class=cF5>MeshInit</span><span class=cF0>(&amp;e,flip_y);
<a name="l1070"></a> </span><span class=cF1>if</span><span class=cF0> (head)
<a name="l1071"></a> </span><span class=cF5>MeshLoad</span><span class=cF0>(&amp;e,head);
<a name="l1072"></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="l1073"></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="l1074"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(&amp;e);
<a name="l1075"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>,&amp;e);
<a name="l1076"></a>
<a name="l1077"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF2>//In case of &lt;CTRL-ALT-c&gt;</span><span class=cF0>
<a name="l1078"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l1079"></a> </span><span class=cF5>MeshUpdateMenu</span><span class=cF0>(&amp;e);
<a name="l1080"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,
<a name="l1081"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|
<a name="l1082"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>);
<a name="l1083"></a>me_restart:
<a name="l1084"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code) </span><span class=cF7>{</span><span class=cF0>
<a name="l1085"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l1086"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) {
<a name="l1087"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l1088"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[0]) </span><span class=cF7>{</span><span class=cF0>
<a name="l1089"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
<a name="l1090"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1091"></a> </span><span class=cF1>goto</span><span class=cF0> me_clip_cut;
<a name="l1092"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l1093"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0>)
<a name="l1094"></a> </span><span class=cF5>MeshClipDel</span><span class=cF0>(&amp;e);
<a name="l1095"></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="l1096"></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="l1097"></a> </span><span class=cFB>ms</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="l1098"></a> </span><span class=cFB>ms</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="l1099"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1100"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1101"></a> make_tri_vertex_num=0;
<a name="l1102"></a> }
<a name="l1103"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1104"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>:
<a name="l1105"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l1106"></a> </span><span class=cF1>goto</span><span class=cF0> me_clip_copy;
<a name="l1107"></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="l1108"></a> </span><span class=cF1>goto</span><span class=cF0> me_clip_paste;
<a name="l1109"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1110"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1111"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>:
<a name="l1112"></a> </span><span class=cF1>switch</span><span class=cF0> (e.ed_mode) </span><span class=cF7>{</span><span class=cF0>
<a name="l1113"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l1114"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>:
<a name="l1115"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1116"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l1117"></a> </span><span class=cF5>MeshVertexDel</span><span class=cF0>(&amp;e,e.cur_vertex);
<a name="l1118"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1119"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l1120"></a> </span><span class=cF1>if</span><span class=cF0> (make_tri_vertex_num) {
<a name="l1121"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1122"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1123"></a> make_tri_vertex_num=0;
<a name="l1124"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l1125"></a> </span><span class=cF5>MeshTriDel</span><span class=cF0>(&amp;e,e.cur_tri);
<a name="l1126"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1127"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1128"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1129"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>:
<a name="l1130"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1131"></a> e.thickness=</span><span class=cF5>PopUpGetI64</span><span class=cF0>(</span><span class=cF6>&quot;Thickness (%d):&quot;</span><span class=cF0>,e.thickness);
<a name="l1132"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l1133"></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="l1134"></a> e.closed=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1135"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1136"></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="l1137"></a>me_chain:
<a name="l1138"></a> e.chain_pred=e.vertex_head.last;
<a name="l1139"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l1140"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1141"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1142"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l1143"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l1144"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'M'</span><span class=cF0>:
<a name="l1145"></a> adjusting_z=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1146"></a> moving=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1147"></a> e.ed_mode=arg1;
<a name="l1148"></a> make_tri_vertex_num=0;
<a name="l1149"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l1150"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1151"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'T'</span><span class=cF0>:
<a name="l1152"></a> </span><span class=cF5>MeshTransformSel</span><span class=cF0>(&amp;e);
<a name="l1153"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1154"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'A'</span><span class=cF0>:
<a name="l1155"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1156"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode!=</span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1157"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1158"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1159"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1160"></a> make_tri_vertex_num=0;
<a name="l1161"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1162"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'U'</span><span class=cF0>:
<a name="l1163"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1164"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1165"></a> make_tri_vertex_num=0;
<a name="l1166"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1167"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'a'</span><span class=cF0>:
<a name="l1168"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'u'</span><span class=cF0>:
<a name="l1169"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'o'</span><span class=cF0>:
<a name="l1170"></a> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF6>'a'</span><span class=cF0>)
<a name="l1171"></a> sel_mode=</span><span class=cF3>SEL_MESH_EQU</span><span class=cF0>;
<a name="l1172"></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="l1173"></a> sel_mode=</span><span class=cF3>SEL_MESH_AND</span><span class=cF0>;
<a name="l1174"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1175"></a> sel_mode=</span><span class=cF3>SEL_MESH_OR</span><span class=cF0>;
<a name="l1176"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|
<a name="l1177"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>
<a name="l1178"></a> !=</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1179"></a> </span><span class=cF5>Beep</span><span class=cF0>; </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1180"></a> </span><span class=cF1>goto</span><span class=cF0> me_restart;
<a name="l1181"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1182"></a> e.x1=arg1; e.y1=arg2;
<a name="l1183"></a> e.x2=arg1; e.y2=arg2;
<a name="l1184"></a> e.sel_rect=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1185"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1186"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|
<a name="l1187"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>|
<a name="l1188"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>);
<a name="l1189"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>) {
<a name="l1190"></a> e.x2=arg1; e.y2=arg2;
<a name="l1191"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>) {
<a name="l1192"></a> e.x2=arg1; e.y2=arg2;
<a name="l1193"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1194"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1195"></a> e.sel_rect=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1196"></a> </span><span class=cF5>Beep</span><span class=cF0>; </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1197"></a> </span><span class=cF1>goto</span><span class=cF0> me_restart;
<a name="l1198"></a> }
<a name="l1199"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1200"></a> e.sel_rect=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1201"></a> </span><span class=cF5>MeshTriSelRect</span><span class=cF0>(&amp;e,sel_mode,e.x1,e.x2,e.y1,e.y2);
<a name="l1202"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode!=</span><span class=cF6>'t'</span><span class=cF0>)
<a name="l1203"></a> </span><span class=cF5>MeshVertexSelRect</span><span class=cF0>(&amp;e,sel_mode,e.x1,e.x2,e.y1,e.y2);
<a name="l1204"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1205"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1206"></a> make_tri_vertex_num=0;
<a name="l1207"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1208"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLB</span><span class=cF0>:
<a name="l1209"></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="l1210"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1211"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLC</span><span class=cF0>:
<a name="l1212"></a>me_clip_copy:
<a name="l1213"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode==</span><span class=cF6>'t'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1214"></a> </span><span class=cF5>Beep</span><span class=cF0>;</span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1215"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1216"></a> </span><span class=cF5>MeshClipCopy</span><span class=cF0>(&amp;e);
<a name="l1217"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1218"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLV</span><span class=cF0>:
<a name="l1219"></a>me_clip_paste:
<a name="l1220"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode==</span><span class=cF6>'t'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1221"></a> </span><span class=cF5>Beep</span><span class=cF0>;</span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1222"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1223"></a> </span><span class=cF5>MeshClipPaste</span><span class=cF0>(&amp;e);
<a name="l1224"></a> e.ed_mode=</span><span class=cF6>'m'</span><span class=cF0>;
<a name="l1225"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1226"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1227"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLX</span><span class=cF0>:
<a name="l1228"></a>me_clip_cut:
<a name="l1229"></a> </span><span class=cF1>if</span><span class=cF0> (e.ed_mode==</span><span class=cF6>'t'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1230"></a> </span><span class=cF5>Beep</span><span class=cF0>;</span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1231"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1232"></a> </span><span class=cF5>MeshClipCut</span><span class=cF0>(&amp;e);
<a name="l1233"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1234"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l1235"></a> save_and_exit=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1236"></a> </span><span class=cF1>goto</span><span class=cF0> me_done;
<a name="l1237"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l1238"></a> save_and_exit=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1239"></a> </span><span class=cF1>goto</span><span class=cF0> me_done;
<a name="l1240"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
<a name="l1241"></a> </span><span class=cF5>MeshScaleZoom</span><span class=cF0>(&amp;e,1.5);
<a name="l1242"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1243"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'Z'</span><span class=cF0>:
<a name="l1244"></a> </span><span class=cF5>MeshScaleZoom</span><span class=cF0>(&amp;e,1/1.5);
<a name="l1245"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1246"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
<a name="l1247"></a> e.cur_color=</span><span class=cF5>PopUpColorLighting</span><span class=cF0>;
<a name="l1248"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1249"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>:
<a name="l1250"></a> i=</span><span class=cF5>PopUpRangeI64</span><span class=cF0>(1,25,1,</span><span class=cF6>&quot;New Snap\n&quot;</span><span class=cF0>);
<a name="l1251"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;=1)
<a name="l1252"></a> e.cur_snap=i;
<a name="l1253"></a> </span><span class=cF5>MeshCurSnap</span><span class=cF0>(&amp;e);
<a name="l1254"></a> </span><span class=cF5>MeshRecalcCxCy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>,&amp;e);
<a name="l1255"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1256"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'g'</span><span class=cF0>:
<a name="l1257"></a> e.grid_on=!e.grid_on;
<a name="l1258"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1259"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'V'</span><span class=cF0>:
<a name="l1260"></a> e.vertex_on=!e.vertex_on;
<a name="l1261"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1262"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'N'</span><span class=cF0>:
<a name="l1263"></a> s-&gt;sx=s-&gt;sy=s-&gt;sz=0;
<a name="l1264"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1265"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'y'</span><span class=cF0>:
<a name="l1266"></a> e.flip_y=!e.flip_y;
<a name="l1267"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1268"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'j'</span><span class=cF0>:
<a name="l1269"></a> </span><span class=cF1>if</span><span class=cF0> (moving)
<a name="l1270"></a> </span><span class=cF5>MeshVertexIgnoreSet</span><span class=cF0>(&amp;e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1271"></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="l1272"></a> </span><span class=cFB>ms</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="l1273"></a> </span><span class=cFB>ms</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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1274"></a> </span><span class=cF5>Noise</span><span class=cF0>(25,86,110);
<a name="l1275"></a> e.ms_z=</span><span class=cF5>RoundI64</span><span class=cF0>(tmpv-&gt;p.z,e.cur_snap);
<a name="l1276"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1277"></a> </span><span class=cF5>Beep</span><span class=cF0>; </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1278"></a> e.ms_z=0;
<a name="l1279"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1280"></a> </span><span class=cF5>MeshVertexIgnoreSet</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1281"></a> </span><span class=cF1>if</span><span class=cF0> (moving) </span><span class=cF7>{</span><span class=cF0>
<a name="l1282"></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="l1283"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1284"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,0,0,z-p0a.z);
<a name="l1285"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1286"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,x-p0a.x,y-p0a.y,z-p0a.z);
<a name="l1287"></a> p0a.x=x;
<a name="l1288"></a> p0a.y=y;
<a name="l1289"></a> p0a.z=z;
<a name="l1290"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1291"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1292"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1293"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'1'</span><span class=cF0>:
<a name="l1294"></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="l1295"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1296"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'2'</span><span class=cF0>:
<a name="l1297"></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="l1298"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1299"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'3'</span><span class=cF0>:
<a name="l1300"></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="l1301"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'4'</span><span class=cF0>:
<a name="l1303"></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="l1304"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1305"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'5'</span><span class=cF0>:
<a name="l1306"></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="l1307"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1308"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'6'</span><span class=cF0>:
<a name="l1309"></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="l1310"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1311"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'r'</span><span class=cF0>:
<a name="l1312"></a> </span><span class=cF1>if</span><span class=cF0> (e.cur_tri)
<a name="l1313"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;e.cur_tri-&gt;t[1],&amp;e.cur_tri-&gt;t[2]);
<a name="l1314"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1315"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'C'</span><span class=cF0>:
<a name="l1316"></a> </span><span class=cF5>MeshColorTris</span><span class=cF0>(&amp;e);
<a name="l1317"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1318"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'R'</span><span class=cF0>:
<a name="l1319"></a> </span><span class=cF5>MeshRevTris</span><span class=cF0>(&amp;e);
<a name="l1320"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1321"></a> }
<a name="l1322"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1323"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>:
<a name="l1324"></a> </span><span class=cF1>switch</span><span class=cF0> (e.ed_mode) {
<a name="l1325"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l1326"></a> </span><span class=cF1>if</span><span class=cF0> (!moving) </span><span class=cF7>{</span><span class=cF0>
<a name="l1327"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l1328"></a> </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="l1329"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1330"></a> e.ms_z=</span><span class=cF5>RoundI64</span><span class=cF0>(tmpv-&gt;p.z,e.cur_snap);
<a name="l1331"></a> }
<a name="l1332"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0>) {
<a name="l1333"></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="l1334"></a> p0a.x=x;
<a name="l1335"></a> p0a.y=y;
<a name="l1336"></a> p0a.z=z;
<a name="l1337"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1338"></a> moving=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1339"></a> }
<a name="l1340"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1341"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1342"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'M'</span><span class=cF0>:
<a name="l1343"></a> </span><span class=cF1>if</span><span class=cF0> (!adjusting_z &amp;&amp; !moving) </span><span class=cF7>{</span><span class=cF0>
<a name="l1344"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l1345"></a> </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="l1346"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1347"></a> e.ms_z=</span><span class=cF5>RoundI64</span><span class=cF0>(tmpv-&gt;p.z,e.cur_snap);
<a name="l1348"></a> }
<a name="l1349"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MeshSelCnt</span><span class=cF7>(</span><span class=cF0>&amp;e</span><span class=cF7>)</span><span class=cF0>) {
<a name="l1350"></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="l1351"></a> p0a.x=x;
<a name="l1352"></a> p0a.y=y;
<a name="l1353"></a> p0a.z=z;
<a name="l1354"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1355"></a> moving=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1356"></a>
<a name="l1357"></a> p0b.x=</span><span class=cFB>ms</span><span class=cF0>.presnap.x;
<a name="l1358"></a> p0b.y=</span><span class=cFB>ms</span><span class=cF0>.presnap.y;
<a name="l1359"></a> p0b.z=e.ms_z;
<a name="l1360"></a> adjusting_z=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1361"></a> </span><span class=cF5>Snd</span><span class=cF0>(</span><span class=cF5>ClampI64</span><span class=cF7>(</span><span class=cF5>Freq2Ona</span><span class=cF0>(3*e.ms_z+1500),0,</span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l1362"></a> }
<a name="l1363"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1364"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1365"></a> }
<a name="l1366"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1367"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>:
<a name="l1368"></a> </span><span class=cF1>switch</span><span class=cF0> (e.ed_mode) {
<a name="l1369"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l1370"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>:
<a name="l1371"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1372"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l1373"></a> </span><span class=cF5>Noise</span><span class=cF0>(25,86,110);
<a name="l1374"></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="l1375"></a> e.cur_vertex=</span><span class=cF5>MeshVertexNew</span><span class=cF0>(&amp;e,x,y,z);
<a name="l1376"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1377"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l1378"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'M'</span><span class=cF0>:
<a name="l1379"></a> </span><span class=cF1>if</span><span class=cF0> (moving) </span><span class=cF7>{</span><span class=cF0>
<a name="l1380"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z) {
<a name="l1381"></a> e.ms_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>ms</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0>
<a name="l1382"></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>ms</span><span class=cF0>.presnap.x)+</span><span class=cF5>Sqr</span><span class=cF0>(p0b.y-</span><span class=cFB>ms</span><span class=cF0>.presnap.y)</span><span class=cF7>)</span><span class=cF0>
<a name="l1383"></a> +p0b.z,e.cur_snap);
<a name="l1384"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l1385"></a> adjusting_z=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1386"></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="l1387"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,0,0,z-p0a.z);
<a name="l1388"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1389"></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="l1390"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,x-p0a.x,y-p0a.y,z-p0a.z);
<a name="l1391"></a> }
<a name="l1392"></a> </span><span class=cF5>MeshTriSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1393"></a> </span><span class=cF5>MeshVertexSelAll</span><span class=cF0>(&amp;e,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1394"></a> moving=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1395"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1396"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1397"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l1398"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1399"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;make_tri_vertex_num;i++)
<a name="l1400"></a> </span><span class=cF1>if</span><span class=cF0> (va[i]==tmpv) {
<a name="l1401"></a> </span><span class=cF5>Beep</span><span class=cF0>; </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l1402"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1403"></a> }
<a name="l1404"></a> </span><span class=cF1>if</span><span class=cF0> (i==make_tri_vertex_num) {
<a name="l1405"></a> </span><span class=cF5>Noise</span><span class=cF0>(25,86,110);
<a name="l1406"></a> va[make_tri_vertex_num++]=tmpv;
<a name="l1407"></a> tmpv-&gt;flags|=</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1408"></a> </span><span class=cF1>if</span><span class=cF0> (make_tri_vertex_num==3) </span><span class=cF7>{</span><span class=cF0>
<a name="l1409"></a> e.cur_tri=</span><span class=cF5>MeshTriNew</span><span class=cF0>(&amp;e,e.cur_color,va[0],va[1],va[2]);
<a name="l1410"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;make_tri_vertex_num;i++)
<a name="l1411"></a> va[i]-&gt;flags&amp;=~</span><span class=cF3>VF_SEL</span><span class=cF0>;
<a name="l1412"></a> make_tri_vertex_num=0;
<a name="l1413"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1414"></a> }
<a name="l1415"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1416"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1417"></a> }
<a name="l1418"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1419"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>:
<a name="l1420"></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="l1421"></a> </span><span class=cF7>(</span><span class=cF0>e.chain_pred==e.vertex_head.last ||
<a name="l1422"></a> 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>) {
<a name="l1423"></a> </span><span class=cF1>if</span><span class=cF0> (moving) </span><span class=cF7>{</span><span class=cF0>
<a name="l1424"></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="l1425"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,x-p0a.x,y-p0a.y,z-p0a.z);
<a name="l1426"></a> p0a.x=x;
<a name="l1427"></a> p0a.y=y;
<a name="l1428"></a> p0a.z=z;
<a name="l1429"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1430"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1431"></a> p0b.x=</span><span class=cFB>ms</span><span class=cF0>.presnap.x;
<a name="l1432"></a> p0b.y=</span><span class=cFB>ms</span><span class=cF0>.presnap.y;
<a name="l1433"></a> p0b.z=e.ms_z;
<a name="l1434"></a> adjusting_z=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1435"></a> </span><span class=cF5>Snd</span><span class=cF0>(</span><span class=cF5>ClampI64</span><span class=cF7>(</span><span class=cF5>Freq2Ona</span><span class=cF0>(3*e.ms_z+1500),0,</span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l1436"></a> }
<a name="l1437"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1438"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>:
<a name="l1439"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z) {
<a name="l1440"></a> e.ms_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>ms</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0>
<a name="l1441"></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>ms</span><span class=cF0>.presnap.x)+</span><span class=cF5>Sqr</span><span class=cF0>(p0b.y-</span><span class=cFB>ms</span><span class=cF0>.presnap.y)</span><span class=cF7>)</span><span class=cF0>
<a name="l1442"></a> +p0b.z,e.cur_snap);
<a name="l1443"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l1444"></a> adjusting_z=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1445"></a> </span><span class=cF1>if</span><span class=cF0> (moving) </span><span class=cF7>{</span><span class=cF0>
<a name="l1446"></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="l1447"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,0,0,z-p0a.z);
<a name="l1448"></a> p0a.x=x;
<a name="l1449"></a> p0a.y=y;
<a name="l1450"></a> p0a.z=z;
<a name="l1451"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1452"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1453"></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="l1454"></a> </span><span class=cF1>if</span><span class=cF0> (e.chain_pred &amp;&amp; e.chain_pred!=e.vertex_head.last)
<a name="l1455"></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="l1456"></a> arg1=e.ed_mode;
<a name="l1457"></a> </span><span class=cF1>goto</span><span class=cF0> me_chain;
<a name="l1458"></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="l1459"></a> </span><span class=cF1>if</span><span class=cF0> (e.chain_pred &amp;&amp; e.chain_pred!=e.vertex_head.last)
<a name="l1460"></a> </span><span class=cF5>MeshFence</span><span class=cF0>(&amp;e);
<a name="l1461"></a> arg1=e.ed_mode;
<a name="l1462"></a> </span><span class=cF1>goto</span><span class=cF0> me_chain;
<a name="l1463"></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="l1464"></a> </span><span class=cF1>if</span><span class=cF0> (e.chain_pred &amp;&amp; e.chain_pred!=e.vertex_head.last)
<a name="l1465"></a> </span><span class=cF5>MeshPrism</span><span class=cF0>(&amp;e);
<a name="l1466"></a> arg1=e.ed_mode;
<a name="l1467"></a> </span><span class=cF1>goto</span><span class=cF0> me_chain;
<a name="l1468"></a> }
<a name="l1469"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1470"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>:
<a name="l1471"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z) {
<a name="l1472"></a> e.ms_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>ms</span><span class=cF0>.presnap.y</span><span class=cF7>)</span><span class=cF0>
<a name="l1473"></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>ms</span><span class=cF0>.presnap.x)+</span><span class=cF5>Sqr</span><span class=cF0>(p0b.y-</span><span class=cFB>ms</span><span class=cF0>.presnap.y)</span><span class=cF7>)</span><span class=cF0>
<a name="l1474"></a> +p0b.z,e.cur_snap);
<a name="l1475"></a> </span><span class=cF5>Snd</span><span class=cF0>(</span><span class=cF5>ClampI64</span><span class=cF7>(</span><span class=cF5>Freq2Ona</span><span class=cF0>(3*e.ms_z+1500),0,</span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l1476"></a> }
<a name="l1477"></a> </span><span class=cF1>if</span><span class=cF0> (moving) {
<a name="l1478"></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="l1479"></a> </span><span class=cF1>if</span><span class=cF0> (adjusting_z)
<a name="l1480"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,0,0,z-p0a.z);
<a name="l1481"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1482"></a> </span><span class=cF5>MeshP0Offset</span><span class=cF0>(&amp;e,x-p0a.x,y-p0a.y,z-p0a.z);
<a name="l1483"></a> p0a.x=x;
<a name="l1484"></a> p0a.y=y;
<a name="l1485"></a> p0a.z=z;
<a name="l1486"></a> </span><span class=cF5>MeshP0Capture</span><span class=cF0>(&amp;e);
<a name="l1487"></a> }
<a name="l1488"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1489"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1490"></a> }
<a name="l1491"></a>me_done:
<a name="l1492"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
<a name="l1493"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1494"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l1495"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l1496"></a> </span><span class=cF1>if</span><span class=cF0> (save_and_exit)
<a name="l1497"></a> head=</span><span class=cF5>MeshSave</span><span class=cF0>(&amp;e,_size);
<a name="l1498"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1499"></a> head=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1500"></a> </span><span class=cF5>MeshCleanUp</span><span class=cF0>(&amp;e);
<a name="l1501"></a> </span><span class=cF5>FramePtrDel</span><span class=cF0>(</span><span class=cF6>&quot;CMeshFrame&quot;</span><span class=cF0>);
<a name="l1502"></a> </span><span class=cF1>if</span><span class=cF0> (old_s) </span><span class=cF7>{</span><span class=cF0>
<a name="l1503"></a> </span><span class=cF5>MemCpy</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="l1504"></a> </span><span class=cF5>Free</span><span class=cF0>(old_s);
<a name="l1505"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1506"></a> </span><span class=cF5>ViewAnglesDel</span><span class=cF0>;
<a name="l1507"></a> </span><span class=cF1>return</span><span class=cF0> head;
<a name="l1508"></a>}
</span></pre></body>
</html>