0 Members and 1 Guest are viewing this topic.
:.FASTCUBE:#ExprOn:FnOff:Data(‾40r,40r,‾40r)→°Verts:Data(40r,40r,‾40r):Data(40r,‾40r,‾40r):Data(‾40r,‾40r,‾40r):Data(‾40r,40r,40r):Data(40r,40r,40r):Data(40r,‾40r,40r):Data(‾40r,‾40r,40r)::Buff(6)→°Back::L3→°CosLUT::L3+512→°CosX+2→°CosY+2→°SinX+2→°SinY+2→°CXCY+2→°CXSY+2→°SXCY+2→°SXSY::‾1:For(256):Select(+1,cos(→r1)→{r1*2+°CosLUT}r):End::0→X→Y::While 1:Sin(X)→SinX:Cos(Y)→CosY:Sin(Y)→SinY:*SinX//128→SXSY:Cos(X)→CosX*CosY//128→CXCY:‾CosX*SinY//128→CXSY:CosY*SinX//128→SXCY::°Verts-6:For(8):{+6→r2}r*CosY+(SinY*{r2+4}r)//128→{°Back}r:SXSY*{r2}r+(CosX*{r2+2}r)-(SXCY*{r2+4}r)//128→{°Back+2}r:CXSY*{r2}r+(SinX*{r2+2}r)+(CXCY*{r2+4}r)//128+192→{°Back+4}r::Rect({°Back}r*64//{°Back+4}r+48,{°Back+2}r*64//{°Back+4}r+32,2,):r2:End::DispGraphClrDraw:getKey(3)-getKey(2)*4+Y→Y:getKey(4)-getKey(1)*4+X→X:EndIf getKey(15):Return::Lbl Sin:-64:Lbl Cos:{^256*2+°CosLUT}rGenerated by the BBify'r (http://clrhome.org/bbify/)
For this latter, it's very simple : divide the 3D X and Y coordinates by the Z one to get the 2D coordinates. Make sure to multiply the 3D X/Y coordinates by a zoom factor to lower visual distortion. Also, remember that (0,0) must be the center of the screen, so just add 48 and 32 to the 2D X and Y coordinate resectively.
Thanks guys @XiiR3CR34T10N : I only use very basic 3D here (simple usually means fast). All you have to know is the rotation matrices (I multiplied the X one by the Y one, you can find all three X, Y and Z on the internet, even on Wikipedia by searching "rotation matrix"), how to multiply a 3D point by a matrix and how to project a 3D point on a 2D screen.For this latter, it's very simple : divide the 3D X and Y coordinates by the Z one to get the 2D coordinates. Make sure to multiply the 3D X/Y coordinates by a zoom factor to lower visual distortion. Also, remember that (0,0) must be the center of the screen, so just add 48 and 32 to the 2D X and Y coordinate resectively.Of course, the source code is here to help you
.TE2->^^oGCameraprgmGCOREData(40^^r,~40^^r,40^^r)->^^oVerticesData(40^^r,40^^r,40^^rData(~40^^r,~40^^r,40^^rData(~40^^r,40^^r,40^^rData(40^^r,~40^^r,~40^^rData(40^^r,40^^r,~40^^rData(~40^^r,~40^^r,~40^^rData(~40^^r,40^^r,~40^^rWhile 1GInit()^^oVertices-6For(8)GSpac2Scr({+6->r5}^^r,{r5+2}^^r,{r5+4}^^rRect(,{^^oGVertex+2}^^r,2,r5EndGGetkey()DispGraphClrDrawEndIf getKey(15)