<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=US-ASCII"> <meta name="generator" content="ZealOS V1.08"> <style type="text/css"> body {background-color:#1f1f1f;} .cF0{color:#e3e3e3;background-color:#1f1f1f;} .cF1{color:#4f84a6;background-color:#1f1f1f;} .cF2{color:#73a255;background-color:#1f1f1f;} .cF3{color:#297582;background-color:#1f1f1f;} .cF4{color:#b34f4b;background-color:#1f1f1f;} .cF5{color:#8a52c3;background-color:#1f1f1f;} .cF6{color:#b7822f;background-color:#1f1f1f;} .cF7{color:#444444;background-color:#1f1f1f;} .cF8{color:#6d6d6d;background-color:#1f1f1f;} .cF9{color:#94bfde;background-color:#1f1f1f;} .cFA{color:#a1ce97;background-color:#1f1f1f;} .cFB{color:#6db4be;background-color:#1f1f1f;} .cFC{color:#e88e88;background-color:#1f1f1f;} .cFD{color:#ca94e8;background-color:#1f1f1f;} .cFE{color:#d4b475;background-color:#1f1f1f;} .cFF{color:#1f1f1f;background-color:#1f1f1f;} </style> </head> <body> <pre style="font-family:monospace;font-size:12pt"> <a name="l1"></a><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4299"><span class=cF4>CDC</span></a><span class=cF0>'s have a 4x4 matrix for rotating, scaling, skewing and shifting in 3 dimensions. To make the graphics routines use the <a name="l2"></a>transform, you must set the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4270"><span class=cF4>DCF_TRANSFORMATION</span></a><span class=cF0> flag. <a name="l3"></a> <a name="l4"></a>The matrix consists of ints that have been scaled 32 bits (</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.ZC.html#l4"><span class=cF4>GR_SCALE</span></a><span class=cF0>). See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Lectures/FixedPoint.ZC.html#l1"><span class=cF4>::/Demo/Lectures/FixedPoint.ZC</span></a><span class=cF0> to learn why. <a name="l5"></a> <a name="l6"></a>See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.ZC.html#l27"><span class=cF4>Mat4x4IdentEqu</span></a><span class=cF0>(), </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.ZC.html#l38"><span class=cF4>Mat4x4IdentNew</span></a><span class=cF0>(), </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l130"><span class=cF4>Mat4x4Equ</span></a><span class=cF0>() and </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l137"><span class=cF4>Mat4x4New</span></a><span class=cF0>(). See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l142"><span class=cF4>Mat4x4RotX</span></a><span class=cF0>(), </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l158"><span class=cF4>Mat4x4RotY</span></a><span class=cF0>(), </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l174"><span class=cF4>Mat4x4RotZ</span></a><span class=cF0>() and </span><span class=cF4> <a name="l7"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l190"><span class=cF4>Mat4x4Scale</span></a><span class=cF0>() to rotate about axes and scale. Combine them with </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l104"><span class=cF4>Mat4x4MulMat4x4Equ</span></a><span class=cF0>()/</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l124"><span class=cF4>Mat4x4MulMat4x4New</span></a><span class=cF0>() and assign them to <a name="l8"></a>the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4299"><span class=cF4>CDC</span></a><span class=cF0>.</span><span class=cF2>dc</span><span class=cF0> with </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.ZC.html#l51"><span class=cF4>DCMat4x4Set</span></a><span class=cF0>(). See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Graphics/Box.ZC.html#l1"><span class=cF4>::/Demo/Graphics/Box.ZC</span></a><span class=cF0>. <a name="l9"></a> <a name="l10"></a>You can rotate single points using </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.ZC.html#l6"><span class=cF4>Mat4x4MulXYZ</span></a><span class=cF0>(). <a name="l11"></a> <a name="l12"></a>The 4th dimension allows a neat trick where you can place pos shifts (translations), into the matrix and </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l104"><span class=cF4>Mat4x4MulMat4x4Equ</span></a><span class=cF0>/</span><span class=cF4> <a name="l13"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l124"><span class=cF4>Mat4x4MulMat4x4New</span></a><span class=cF0> them to combine rotation/shift operations. Normally, you can't combine pos shift operations. See </span><span class=cF4> <a name="l14"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrMath.ZC.html#l216"><span class=cF4>Mat4x4TranslationEqu</span></a><span class=cF0>() and </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Graphics/Transform.ZC.html#l1"><span class=cF4>::/Demo/Graphics/Transform.ZC</span></a><span class=cF0>. <a name="l15"></a> <a name="l16"></a>Finally, </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4299"><span class=cF4>CDC</span></a><span class=cF0>'s have an </span><span class=cF2>x</span><span class=cF0>, </span><span class=cF2>y</span><span class=cF0> and </span><span class=cF2>z</span><span class=cF0> which is an additional shift (translation). <a name="l17"></a> <a name="l18"></a>The transformation is implemented as a callback on the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4299"><span class=cF4>CDC</span></a><span class=cF0>'s </span><span class=cF2>transform()</span><span class=cF0> member. The default </span><span class=cF2>transform()</span><span class=cF0> callback is </span><span class=cF4> <a name="l19"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.ZC.html#l18"><span class=cF4>DCTransform</span></a><span class=cF0>(). See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Games/Talons.ZC.html#l1"><span class=cF4>::/Demo/Games/Talons.ZC</span></a><span class=cF0> or </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Games/CastleFrankenstein.ZC.html#l1"><span class=cF4>::/Demo/Games/CastleFrankenstein.ZC</span></a><span class=cF0> to see how to change the </span><span class=cF2>transform()</span><span class=cF0> <a name="l20"></a>callback for foreshortening. </span></pre></body> </html>