templeos-info/public/Wb/Demo/Graphics/3DPoly.HC.HTML

149 lines
8.5 KiB
HTML
Executable File

<!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=cF1>U0</span><span class=cF0> Main()
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF1>F64</span><span class=cF0> theta=0,phi=0,omega=0;
<a name="l4"></a> </span><span class=cF9>CD3I32</span><span class=cF0> poly[4];
<a name="l5"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
<a name="l6"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l7"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>|</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l8"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l9"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>ScanChar</span><span class=cF0>) {
<a name="l10"></a> </span><span class=cF5>DCDepthBufRst</span><span class=cF0>(dc);
<a name="l11"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height/2,
<a name="l12"></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="l13"></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);
<a name="l14"></a> dc-&gt;color=</span><span class=cF3>LTBLUE</span><span class=cF0>;
<a name="l15"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height/2,
<a name="l16"></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="l17"></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);
<a name="l18"></a>
<a name="l19"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(dc-&gt;r);
<a name="l20"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc-&gt;r,omega);
<a name="l21"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dc-&gt;r,phi);
<a name="l22"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc-&gt;r,theta);
<a name="l23"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc,dc-&gt;r);
<a name="l24"></a>
<a name="l25"></a> dc-&gt;x=</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2;
<a name="l26"></a> dc-&gt;y=</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height/2;
<a name="l27"></a> dc-&gt;z=500;
<a name="l28"></a>
<a name="l29"></a> dc-&gt;color=</span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l30"></a> poly[0].x=50;
<a name="l31"></a> poly[0].y=150;
<a name="l32"></a> poly[0].z=0;
<a name="l33"></a> poly[1].x=275;
<a name="l34"></a> poly[1].y=100;
<a name="l35"></a> poly[1].z=0;
<a name="l36"></a> poly[2].x=155;
<a name="l37"></a> poly[2].y=200;
<a name="l38"></a> poly[2].z=0;
<a name="l39"></a> poly[3].x=100;
<a name="l40"></a> poly[3].y=200;
<a name="l41"></a> poly[3].z=0;
<a name="l42"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
<a name="l43"></a>
<a name="l44"></a> dc-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l45"></a> poly[0].x=50;
<a name="l46"></a> poly[0].y=150;
<a name="l47"></a> poly[0].z=50;
<a name="l48"></a> poly[1].x=275;
<a name="l49"></a> poly[1].y=100;
<a name="l50"></a> poly[1].z=50;
<a name="l51"></a> poly[2].x=155;
<a name="l52"></a> poly[2].y=200;
<a name="l53"></a> poly[2].z=50;
<a name="l54"></a> poly[3].x=100;
<a name="l55"></a> poly[3].y=200;
<a name="l56"></a> poly[3].z=50;
<a name="l57"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
<a name="l58"></a>
<a name="l59"></a> dc-&gt;color=</span><span class=cF3>BLUE</span><span class=cF0>;
<a name="l60"></a> poly[0].x=50;
<a name="l61"></a> poly[0].y=150;
<a name="l62"></a> poly[0].z=-50;
<a name="l63"></a> poly[1].x=275;
<a name="l64"></a> poly[1].y=100;
<a name="l65"></a> poly[1].z=-50;
<a name="l66"></a> poly[2].x=155;
<a name="l67"></a> poly[2].y=200;
<a name="l68"></a> poly[2].z=-50;
<a name="l69"></a> poly[3].x=100;
<a name="l70"></a> poly[3].y=200;
<a name="l71"></a> poly[3].z=-50;
<a name="l72"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
<a name="l73"></a>
<a name="l74"></a> dc-&gt;color=</span><span class=cF3>RED</span><span class=cF0>+</span><span class=cF3>GREEN</span><span class=cF0>&lt;&lt;16+</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l75"></a> poly[0].x=50;
<a name="l76"></a> poly[0].y=150;
<a name="l77"></a> poly[0].z=50;
<a name="l78"></a> poly[1].x=275;
<a name="l79"></a> poly[1].y=100;
<a name="l80"></a> poly[1].z=50;
<a name="l81"></a> poly[2].x=275;
<a name="l82"></a> poly[2].y=100;
<a name="l83"></a> poly[2].z=0;
<a name="l84"></a> poly[3].x=50;
<a name="l85"></a> poly[3].y=150;
<a name="l86"></a> poly[3].z=0;
<a name="l87"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
<a name="l88"></a>
<a name="l89"></a> dc-&gt;color=</span><span class=cF3>BLUE</span><span class=cF0>+</span><span class=cF3>GREEN</span><span class=cF0>&lt;&lt;16+</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l90"></a> poly[0].x=100;
<a name="l91"></a> poly[0].y=200;
<a name="l92"></a> poly[0].z=-50;
<a name="l93"></a> poly[1].x=155;
<a name="l94"></a> poly[1].y=200;
<a name="l95"></a> poly[1].z=-50;
<a name="l96"></a> poly[2].x=155;
<a name="l97"></a> poly[2].y=200;
<a name="l98"></a> poly[2].z=0;
<a name="l99"></a> poly[3].x=100;
<a name="l100"></a> poly[3].y=200;
<a name="l101"></a> poly[3].z=0;
<a name="l102"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
<a name="l103"></a>
<a name="l104"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l106"></a> theta+=2.1*</span><span class=cF3>pi</span><span class=cF0>/180.0;
<a name="l107"></a> phi+=1.1*</span><span class=cF3>pi</span><span class=cF0>/180.0;
<a name="l108"></a> omega+=0.5*</span><span class=cF3>pi</span><span class=cF0>/180.0;
<a name="l109"></a> }
<a name="l110"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
<a name="l111"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l112"></a>
<a name="l113"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l114"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l115"></a>}
<a name="l116"></a>
<a name="l117"></a>Main;
</span></pre></body>
</html>