Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Matrefeytontias on March 02, 2013, 03:44:39 pm

Title: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 02, 2013, 03:44:39 pm
Hi guys !

Some of you may be aware of my "super-secret-project", and now that it reached a releasable state, I don't make you wait any more :P

So, the project I'm working on is an axiom (ASM for Axe so) which allows you to work with 3D vertices in a high-level way. Before saying anything, please know that I didn't made any 3D calculus during the development of this axiom. I just ported the 3D routine set Juha3D (http://tift.tuxfamily.org/projects/juha3d) by yhean from pure ASM to Axe-friendly ASM, which still was a PITA that took me 27 days, especially because I've fully done it with Mimas (yeah, I'm a great Mimas fan) ;D So, all credits goes to him (wherever he is now) for the 3D calculations (and I would especially thank him for his wonderful macros and SMC that aren't allowed in an axiom coded with Mimas and which gave me strong headaches).

Instead of explaining the way it works any further, have a look at the 3 current commands of the axiom, which are all available in the [PRB] menu ([math][?]) :

CommandTokenEffect
CalcMatrx(x_angle,y_angle,z_angle)randInt(Calculates the rotation matrix given the X, Y and Z angles. The matrix is written to the whole 9 bytes of OP1, this means that it got destroyed by float{}, GetCalc or a call to Ans (tell me if I forgot something).
RotVertx(x_coord,y_coord,z_coord,outputArea)randNorm(Rotate a vertex given its X, Y and Z coordinates according to the rotation matrix calculated with a previous call to CalcMatrx and writes the resulting coordinates to the 6 bytes starting at outputArea.
ProjVertex(x_coord,y_coord,z_coord)randBin(Converts 3D coordinates into 2D ones. Basically, it takes a point in space and converts it into a point on screen. It returns the X coordinate in L and the Y coordinate in H, so make a modulus 256 on the returned value to have the X coordinate, and divide it by 256 to have the Y coordinate. Don't forget that you'll need to use a camera offset (distance from the camera to the plan) to avoid having the vertices display right on your face !

And now ... examples time :D !

The classic cube :
(http://mattias.refeyton.fr/espace-ti/axeJuha3D/exampleCube.gif)
8 vertices, 12 links, 4 calls to getKey, 29 FPS

Omnimaga's logo :D :
(http://mattias.refeyton.fr/espace-ti/axeJuha3D/exampleOmniLogo.gif)
20 vertices, 30 links, 4 calls to getKey, and still strong - 14 FPS !

Trip through the galaxy !
(http://mattias.refeyton.fr/espace-ti/axeJuha3D/exampleStarfield.gif)
32 vertices, no links, 4 calls to getKey, moving camera, 12 FPS

I attached the axiom itself, AXMJH3D.8xv, and the source of the cube program as a small example, CUBE.8xp.

Note that it's not a complete project. Yeah, it's only a port of Juha3D, but I'm actually looking for people who would want to get into it with me in order to build a full axiom that could provide by himself all the functionalities that working with volumetric objects would require (scaled down to calc dev of course, so I'd be really happy only with polygon filling, but I'm sure people can think - and realize - better than only that ;) ).

So, to make it clear : if you want to team up with me to carry this axiom even further, do a big up ;)

Have fun, and share comments !



LAST UPDATE : http://ourl.ca/18452/346582
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Geekboy1011 on March 02, 2013, 03:51:08 pm
Ok that is really cool. i wonder what kinda 3d games we might get out of this now :D

Also one thing that i think would help a project like this is writing a custom screen drawing routine so you can shove some of the math/maintenance code in the lcd delay for a hopefully decent speed up where applicable
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 02, 2013, 03:56:36 pm
Thanks :D I first thought about a Star Fox like or something ...
/me dreams about nice things

EDIT to answer your EDIT ;D : the axiom itself only does calculations and doesn't draw anything, I'm just using Axe's routines to display something.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: ben_g on March 02, 2013, 05:03:31 pm
Matrefeytontias and me just decided on IRC to team up for this project.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Geekboy1011 on March 02, 2013, 06:10:47 pm
What im saying is. If you were to offer a function to handle screen updates you could put some of the work in the delay and there for save some clock cycles. Its just an idea.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Hayleia on March 03, 2013, 01:10:47 am
Thanks :D I first thought about a Star Fox like or something ...
/me dreams about nice things
There is already a StarFox project by thepenguin77, but it only runs for 15MHz models, so not for your 83+.

Will the Axiom support solid walls (even if they are only white, with no textures) or only wires ?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: DJ Omnimaga on March 03, 2013, 01:46:45 am
Wow looks very nice. THe first two screenshots look quite fast and the 3rd one reminds me of Final Fantasy ending splash screens. :)

Also I didn't know Juha3D was actually released. Back in 2003 the official site was just a giant ASCII art with no more download link.
Thanks :D I first thought about a Star Fox like or something ...
/me dreams about nice things
There is already a StarFox project by thepenguin77, but it only runs for 15MHz models, so not for your 83+.

Will the Axiom support solid walls (even if they are only white, with no textures) or only wires ?
That Starfox project used plenty of cheating techniques to simulate 3D and get around limitations, though, so it might not be 100% 3D (although I think if you modify the source it's perfectly useable for games and levels)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 03, 2013, 06:33:50 am
Thanks :D I first thought about a Star Fox like or something ...
/me dreams about nice things
There is already a StarFox project by thepenguin77, but it only runs for 15MHz models, so not for your 83+.

Will the Axiom support solid walls (even if they are only white, with no textures) or only wires ?

This project is by long discontinued. Also yeah, I forgot to mention that the programs on the screenshot all runs at 6 MHz ;)

And yeah, solid surfaces are my next item on my list. That's why I mentionned polygon filling.

And thanks DJ_O :)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Hayleia on March 03, 2013, 06:36:34 am
And yeah, solid surfaces are my next item on my list. That's why I mentionned polygon filling.
Ah, that's what you meant by "polygon filling" :P
That's great to hear anyway :D
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Xeda112358 on March 03, 2013, 06:49:34 am
Matrefeytontias: This is amazing o.o It works so smoothly! I had just finally figured out 3D stuff yesterday, so I made a BASIC program, but this is gorgeous o.o I am now looking forward to the upcoming TI-Concours stuff in Axe/Assembly O.O If we do Snake or something, are you going to make it 3D? XD
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 03, 2013, 07:01:16 am
Unfortunately, I don't think I'll participate to the contest, mostly because the family didn't like my grades during the first trimester. Dunno why ;D

But after the polygon filling is done, I think I'll start with a terrain generator, so you'll can walk on it :)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TIfanx1999 on March 03, 2013, 07:32:17 am
So this is the secret project you've been going on about. ;D Pretty cool stuff! ^^
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 03, 2013, 07:49:37 am
Yeah that's it, and thanks :)

Also, if you cant think of more things that you would like have added to the axiom, say it ;)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: pimathbrainiac on March 03, 2013, 01:26:51 pm
So this is what you were keeping secret from us...

/me downloads to try it out.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 03, 2013, 02:12:22 pm
Yes this is. Will you forgive me ? :P
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Streetwalrus on March 03, 2013, 02:31:59 pm
*.*
Holy crap, that's awesome. I'll be sure to use it to make cool stuff.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Hayleia on March 03, 2013, 03:31:15 pm
Also, if you cant think of more things that you would like have added to the axiom, say it ;)
I think that with solid walls (or polygon filling as you say) would be enough but textures would be a great addition (but it will be harder to implement I guess).
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 03, 2013, 03:37:04 pm
Yeah, maybe we'll (with ben_g) do that, but first we have to get the solid surfaces working :)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Sorunome on March 03, 2013, 03:55:35 pm
Holy
That
Looks
AWESOME!
:crazy:
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: pimathbrainiac on March 04, 2013, 09:53:45 am
methinks you should add some automagic stuffs, such as an automagic running the commands in sequence for display with specified input.

Edit: there is a small with the starting coordinate plane: the Z plane is parallel to your line of sight... It should be where Y currently is, X should be where Z currently is, and Y should be where X currently is
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: DJ Omnimaga on March 04, 2013, 03:25:36 pm
Will filled polygons be grayscale or will it be checkerboards like in tr1p1ea's engine??
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on March 04, 2013, 03:30:50 pm
We'll try with greyscales (most likely 3), and if it's too ugly, we'll go with checkerboards.

@pimathbrainiac for me the 3D coordinates always were :
Code: [Select]
^ Y
|
|
|         __--> Z
|  __--
|-------------------> X
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Hayleia on March 04, 2013, 03:59:04 pm
We'll try with greyscales (most likely 3), and if it's too ugly, we'll go with checkerboards.

@pimathbrainiac for me the 3D coordinates always were :
Code: [Select]
^ Y
|
|
|         __--> Z
|  __--
|-------------------> X
Yeah, that's what he meant. People usually do this:
Code: [Select]
          ^ Z
          |
          |
          |
          |
          |-------------------> Y
     __
X <--
But as long as the code works, that is not really a problem with good documentation :)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: pimathbrainiac on March 04, 2013, 04:07:16 pm
/me was confuzzled when he first programmed...

Just wanted to make things less confusing for those who learned it the way Hayleia said.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: pimathbrainiac on April 21, 2013, 01:42:19 pm
Bump!

2 things:

1: May I please have a look at the source for this? I want to see it.

2: When I use this code:

Code: [Select]
.A

#Axiom(AXJH3D)

ProjVertex(1,1,5)->A

While 1
ClrDraw
Pxl-On(A^256,A/256)
DispGraph
EndIf (getKey(15))


The program just exits when I run it. Will you please create a tutorial on the usage of the Axiom?

Edit: Wait a sec. This was due to my compile settings being bad. Disregard the second bit.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 21, 2013, 03:50:35 pm
Well, I'm on a phone right now, so if you don't want to wait until tomorrow evening of my time (in 20 hours) ask ben_g.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: ben_g on April 21, 2013, 04:10:00 pm
Can I just post the source code in this topic?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 21, 2013, 04:22:07 pm
Yeah, please do.

Also, I think I'll let this project like it is. I overestimated myself, I realized that I had just enough knowledges to make an axiom out of already existing code. So I'll gladly let my place to whoever thinks (s)he can bring the axiom further. Maybe I'll work on it again, but later.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: ben_g on April 21, 2013, 04:36:37 pm
Ok then. Here's the source code:
Code: [Select]
;#SECTION "MAIN", CODE
.nolist
#include "ti83plus.inc"
.list
sub_Axiom2 equ 3F61h
AX equ OP1
AY equ AX + 1
AZ equ AY + 1
BX equ AZ + 1
BY equ BX + 1
BZ equ BY + 1
CX equ BZ + 1
CY equ CX + 1
CZ equ CY + 1
 dw 0C0DEh
; CalcRotMatrix
; Calculates the rotation
; matrix relative to 3 angles
 dw CalcRotMatrixEnd + 34
 db 00111111b
 db 0BBh, 0Ah     ; randInt(
 db 1
 db 3
; HL = Z angle
; Stack : Y angle, X angle ,ret
 rorg 0
 ld c, l
 pop hl
 pop de
 ld a, e
 pop de
 ld b, e
 push hl
; jh_CalcRotationMatrix:
 di
 ld d, c
 ld c, b
 ld b, a
; b, c, d
; ax = (sin(- b + c + d) + sin(b -
; c + d) + sin(b + c - d) + sin(- b
; - c - d) + 2*(cos(c - d) +
; cos(c + d)))/4
 ld a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; cos(c - d)
 exx
 ld a, c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(c + d)
 add hl, bc
 add hl, hl
 exx
 ld a, c
 sub b
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(- b + c + d)
 add hl, bc
 exx
 ld a, b
 sub c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b - c + d)
 add hl, bc
 exx
 ld a, b
 add a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b + c - d)
 add hl, bc
 exx
 xor a
 sub b
 sub c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(- b - c - d)
 add hl, bc
 ld a, l
 rr h
 rra
 rr h
 rra
 ld (AX), a
; ay = (sin(- b + d) + sin(b +
; d))/2
 exx
 ld a, d
 sub b
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; sin(- b + d)
 exx
 ld a, b
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b + d)
 add hl, bc
 ld a, l
 rr h
 rra
 ld (AY), a
; az = (cos(b - c - d) + cos(b -
; c + d + $80) + cos(b + c - d) +
; cos(b + c + d + $80) +
; 2*(sin(- c + d) + sin(- c -
; d)))/4
 exx
 ld a, d
 sub c
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; sin(- c + d)
 exx
 xor a
 sub c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(- c - d)
 add hl, bc
 add hl, hl
 exx
 ld a, b
 sub c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; (cos(b - c - d)
 add hl, bc
 exx
 ld a, 80h
 add a, b
 sub c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b - c + d + $80)
 add hl, bc
 exx
 ld a, b
 add a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b + c - d)
 add hl, bc
 exx
 ld a, 80h
 add a, b
 add a, c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b + c + d + $80)
 add hl, bc
 ld a, l
 rr h
 rra
 rr h
 rra
 ld (AZ), a
; bx = (cos(b - c - d) + cos(b -
; c + d) + cos(b + c - d + $80) +
; cos(b + c + d + $80) +
; 2*(sin(c - d) + sin(- c -
; d)))/4
 exx
 ld a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; sin(c - d)
 exx
 xor a
 sub c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(- c - d)
 add hl, bc
 add hl, hl
 exx
 ld a, b
 sub c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b - c - d)
 add hl, bc
 exx
 ld a, b
 sub c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b - c + d)
 add hl, bc
 exx
 ld a, 80h
 add a, b
 add a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b + c - d + $80)
 add hl, bc
 exx
 ld a, 80h
 add a, b
 add a, c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b + c + d + $80)
 add hl, bc
 ld a, l
 rr h
 rra
 rr h
 rra
 ld (BX), a
; by = (cos(b - d) + cos(b +
; d))/2
 exx
 ld a, b
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; cos(b - d)
 exx
 ld a, b
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b + d)
 add hl, bc
 ld a, l
 rr h
 rra
 ld (BY), a
; bz = (sin(b - c - d) + sin(b - c
; + d) + sin(b + c - d) + sin(b + c
; + d) + 2*(cos(c - d) + cos(c
; + d + $80)))/4
 exx
 ld a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; cos(c - d)
 exx
 ld a, 80h
 add a, c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(c + d + $80)
 add hl, bc
 add hl, hl
 exx
 ld a, b
 sub c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b - c - d)
 add hl, bc
 exx
 ld a, b
 sub c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b - c + d)
 add hl, bc
 exx
 ld a, b
 add a, c
 sub d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b + c - d)
 add hl, bc
 exx
 ld a, b
 add a, c
 add a, d
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b + c + d)
 add hl, bc
 ld a, l
 rr h
 rra
 rr h
 rra
 ld (BZ), a
; cx = (sin(- b + c) + sin(b +
; c))/2
 exx
 ld a, c
 sub b
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; sin(- b + c)
 exx
 ld a, b
 add a, c
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; sin(b + c)
 add hl, bc
 ld a, l
 rr h
 rra
 ld (CX), a
; cy = sin(- b)
 exx
 xor a
 sub b
 db 7Fh
 rorg $ - 1
 call _GetSin
 exx
 ld (CY), a
; cz = (cos(b - c) + cos(b +
; c))/2
 exx
 ld a, b
 sub c
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld l, a
 rla
 sbc a, a
 ld h, a
; cos(b - c)
 exx
 ld a, b
 add a, c
 db 7Fh
 rorg $ - 1
 call _GetCos
 exx
 ld c, a
 rla
 sbc a, a
 ld b, a
; cos(b + c)
 add hl, bc
 ld a, l
 rr h
 rra
 ld (CZ), a
 ei
 ret

_GetSin:
 sub 40h
_GetCos:
 db 7Fh
 rorg $ - 1
 ld hl, sub_Axiom2
 add a, l
 ld l, a
 ld a, 0
 adc a, h
 ld h, a
 ld a, (hl)
 ret

CalcRotMatrixEnd:
; CoSineTable
 dw CoSineTableEnd
 db 00111111b
 db 0, 0      ; not callable
 db 00010000b
 db 0
 rorg 0
 db 40h, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Eh, 3Eh, 3Eh, 3Dh, 3Dh, 3Ch, 3Ch, 3Bh
 db 3Bh, 3Ah, 3Ah, 39h, 38h, 37h, 37h, 36h, 35h, 34h, 33h, 33h, 31h, 31h, 2Fh, 2Eh
 db 2Dh, 2Ch, 2Bh, 29h, 29h, 27h, 26h, 25h, 23h, 22h, 20h, 1Fh, 1Fh, 1Dh, 1Ch, 1Ah
 db 19h, 17h, 15h, 14h, 12h, 11h, 10h, 0Eh, 0Dh, 0Bh, 0Ah, 08h, 06h, 05h, 03h, 02h
 db 00h, 0FFh, 0FEh, 0FCh, 0FBh, 0F9h, 0F8h, 0F6h, 0F4h, 0F3h, 0F1h, 0F0h, 0EFh, 0EDh, 0ECh, 0EAh
 db 0E9h, 0E7h, 0E5h, 0E4h, 0E2h, 0E1h, 0E0h, 0DFh, 0DEh, 0DCh, 0DBh, 0DAh, 0D8h, 0D7h, 0D6h, 0D5h
 db 0D3h, 0D2h, 0D2h, 0D0h, 0CFh, 0CEh, 0CDh, 0CDh, 0CBh, 0CBh, 0CAh, 0C9h, 0C9h, 0C7h, 0C7h, 0C6h
 db 0C6h, 0C5h, 0C4h, 0C4h, 0C3h, 0C3h, 0C3h, 0C2h, 0C2h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h
 db 0C0h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C2h, 0C2h, 0C2h, 0C3h, 0C3h, 0C4h, 0C4h, 0C5h
 db 0C5h, 0C6h, 0C6h, 0C7h, 0C8h, 0C9h, 0C9h, 0CAh, 0CBh, 0CCh, 0CDh, 0CDh, 0CFh, 0CFh, 0D1h, 0D2h
 db 0D3h, 0D4h, 0D5h, 0D7h, 0D7h, 0D9h, 0DAh, 0DBh, 0DDh, 0DEh, 0E0h, 0E1h, 0E1h, 0E3h, 0E4h, 0E6h
 db 0E7h, 0E9h, 0EBh, 0ECh, 0EEh, 0EFh, 0F0h, 0F2h, 0F3h, 0F5h, 0F6h, 0F8h, 0FAh, 0FBh, 0FDh, 0FEh
 db 00h, 01h, 02h, 04h, 05h, 07h, 08h, 0Ah, 0Ch, 0Dh, 0Fh, 10h, 11h, 13h, 14h, 16h
 db 17h, 19h, 1Bh, 1Ch, 1Eh, 1Fh, 20h, 21h, 22h, 24h, 25h, 26h, 28h, 29h, 2Ah, 2Bh
 db 2Dh, 2Eh, 2Eh, 30h, 31h, 32h, 33h, 33h, 35h, 35h, 36h, 37h, 37h, 39h, 39h, 3Ah
 db 3Ah, 3Bh, 3Ch, 3Ch, 3Dh, 3Dh, 3Dh, 3Eh, 3Eh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh
CoSineTableEnd:
;
; RotVertex
; Rotate the given vertex
; with the matrix calculated
; with a previous call to
; CalcRotMatrix
 dw RotVertexEnd + 32
 db 00111111b
 db 0BBh, 1Fh        ; randNorm(
 db 1
 db 4
; HL = output area
; Stack : X, Y, Z coordinate,ret
 rorg 0
 pop af
 pop de
 pop bc
 push af
 ex (sp), hl
 pop af
 ex (sp), hl
 push af
; jh_RotateVertex:
 db 7Fh
 rorg $ - 1
 ld (x3d), hl
 db 7Fh
 rorg $ - 1
 ld (y3d), bc
 db 7Fh
 rorg $ - 1
 ld (z3d), de
 ld a, (AX)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 push af
 push hl
 db 7Fh
 rorg $ - 1
 ld hl, (y3d)
 ld a, (AY)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 push af
 push hl
 db 7Fh
 rorg $ - 1
 ld hl, (z3d)
 ld a, (AZ)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 pop de
 pop bc
 add hl, de
 adc a, b
 pop de
 pop bc
 add hl, de
 adc a, b
 db 7Fh
 rorg $ - 1
 call _iDivAHLby64
 db 7Fh
 rorg $ - 1
 ld (nx3d + 1), hl
 db 7Fh
 rorg $ - 1
 ld hl, (x3d)
 ld a, (BX)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 push af
 push hl
 db 7Fh
 rorg $ - 1
 ld hl, (y3d)
 ld a, (BY)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 push af
 push hl
 db 7Fh
 rorg $ - 1
 ld hl, (z3d)
 ld a, (BZ)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 pop de
 pop bc
 add hl, de
 adc a, b
 pop de
 pop bc
 add hl, de
 adc a, b
 db 7Fh
 rorg $ - 1
 call _iDivAHLby64
 db 7Fh
 rorg $ - 1
 ld (ny3d + 1), hl
 db 7Fh
 rorg $ - 1
 ld hl, (x3d)
 ld a, (CX)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 push af
 push hl
 db 7Fh
 rorg $ - 1
 ld hl, (y3d)
 ld a, (CY)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 push af
 push hl
 db 7Fh
 rorg $ - 1
 ld hl, (z3d)
 ld a, (CZ)
 db 7Fh
 rorg $ - 1
 call _iMulAbyHL
 pop de
 pop bc
 add hl, de
 adc a, b
 pop de
 pop bc
 add hl, de
 adc a, b
 db 7Fh
 rorg $ - 1
 call _iDivAHLby64
 ex de, hl
nx3d:
 ld hl, 0
ny3d:
 ld bc, 0
;
 ex de, hl
 ex (sp), hl
 ld (hl), e
 inc hl
 ld (hl), d
 inc hl
 ld (hl), c
 inc hl
 ld (hl), b
 inc hl
 pop de
 ld (hl), e
 inc hl
 ld (hl), d
 ret

_iMulAbyHL:
 ld de, 0
 ld b, d
 ld c, e
 ex de, hl
 cp 80h
 jr c, noNegA
 neg
 inc b
noNegA:
 bit 7, d
 jr z, noNegDE
 or a
 sbc hl, de
 ex de, hl
 ld h, c
 ld l, c
 dec b
noNegDE:
 add a, a
 jr nc, $ + 4
 ld h, d
 ld l, e
 db 7Fh
 rorg $ - 1
 call mulOP
 db 7Fh
 rorg $ - 1
 call mulOP
 db 7Fh
 rorg $ - 1
 call mulOP
 db 7Fh
 rorg $ - 1
 call mulOP
 db 7Fh
 rorg $ - 1
 call mulOP
 db 7Fh
 rorg $ - 1
 call mulOP
 db 7Fh
 rorg $ - 1
 call mulOP
 rr b
 ret nc
 ld b, a
 ld d, c
 ld e, c
 xor a
 ex de, hl
 sbc hl, de
 sbc a, b
 ret

_iDivAHLby64:
 ld b, l
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 ld l, h
 ld h, a
 rla
 ret nc
 bit 0, b
 ret z
 inc hl
 ret

mulOP:
 add hl, hl
 rla
 jr nc, $ + 4
 add hl, de
 adc a, c
 ret

x3d:
 dw 0
y3d:
 dw 0
z3d:
 dw 0
RotVertexEnd:
; ProjectVertex
; Converts the 3D
; coordinates into 2D ones
 dw ProjectVertexEnd + 26
 db 00111111b
 db 0BBh, 0Bh       ; randBin(
 db 1
 db 3
; HL = Z coordinate
; Stack : X,Y coordinate,ret
 rorg 0
 pop af
 push hl
 pop de
 pop bc
 pop hl
 push af
; jh_ProjectVertex:
 ld a, d
 or e
 ret z
 bit 7, d
 ret nz
 push bc
 push de
 ld a, h
 rla
 sbc a, a
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 ld b, a
 ld d, h
 ld e, l
 add hl, hl
 adc a, a
 add hl, de
 adc a, b
 pop de
 push de
 db 7Fh
 rorg $ - 1
 call _iDivAHLbyDE
 ld de, 96 / 2
 add hl, de
 adc a, 0
 pop de
 pop bc
 push af
 push hl
 ld h, b
 ld l, c
 push de
 ld a, h
 rla
 sbc a, a
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 add hl, hl
 adc a, a
 ld b, a
 ld d, h
 ld e, l
 add hl, hl
 adc a, a
 add hl, de
 adc a, b
 pop de
 db 7Fh
 rorg $ - 1
 call _iDivAHLbyDE
 ld de, 64 / 2
 add hl, de
 adc a, 0
 ld b, a
 ex de, hl
 pop hl
 pop af
 ld h, e
 ret

_iDivAHLbyDE:
 ld b, h
 ld c, l
 ld hl, 0
 cp 80h
 push af
 jr c, noNegABC
 sbc hl, bc
 ld b, h
 ld c, l
 ld h, 0
 ld l, a
 ld a, h
 sbc a, l
 ld l, h
noNegABC:
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 db 7Fh
 rorg $ - 1
 call divOP
 ld h, b
 ld l, c
 ld e, a
 pop af
 ld a, e
 ret c
 xor a
 ld h, a
 ld l, a
 sbc hl, bc
 sbc a, e
 ret

divOP:
; SLL C
 db 0CBh, 31h
 rl b
 rla
 adc hl, hl
 sbc hl, de
 jr nc, $ + 4
 add hl, de
 dec c
 ret

ProjectVertexEnd:
 dw 00h
;
 dw 03BEh
 db 9
 db "CalcMtrx("
 dw 03E8h
 db 9
 db "RotVertx("
 dw 03C0h
 db 10
 db "ProjVertx("
.end
.end
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Dapianokid on April 21, 2013, 05:16:00 pm
This makes me wonder how tr1plea is doing with his game
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 21, 2013, 05:38:42 pm
What game are you talking about ?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Dapianokid on April 21, 2013, 05:39:02 pm
his 3d?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 21, 2013, 05:40:29 pm
You mean SolidFrame ? I don't know actually. I'm bad at 3D stuffs.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: DJ Omnimaga on April 24, 2013, 03:57:49 am
Sucks that this died :(. That said I think TheMachine02 needed help with his 3D lib in Axe, so I wonder if you could team up with him or something to help?

Also I think a 3D Axiom should have a non-rendered mode, for people who wants max speed but don't care about quality/seeing through polygons. Space Dementia was like that and it did the job pretty well as a game.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: alex99 on April 29, 2013, 05:22:04 am
its interesting,cause whith an good axiom you can maybe make more 3d games and maybe minecraft too
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: turiqwalrus on April 29, 2013, 08:56:45 am
its interesting,cause whith an good axiom you can maybe make more 3d games and maybe minecraft too


Well, likely not at any decent speed. Remember, with MC, you would need to implement worldgen(ok, maybe that's not TOO hard), mobs, fluid mechanics(albeit simplified), textures, combat mechanics, experience, and a bunch more.

Also, bear in mind that the minecraft-demo Chokosta was working on only had block placement, solid colored textures and save-load files, and that was already nearly at its limit :/
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: alex99 on April 29, 2013, 09:18:23 am
ok then
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TheMachine02 on April 29, 2013, 10:04:13 am
it's sure that a MC can't be done on a z80 even in 15MHz... it's require too much game mechanics, but I think that a VERY simplified engine can be done, though.
(like in black and white, no texture, only wired...)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: pimathbrainiac on April 29, 2013, 12:49:46 pm
Portal could be possible with TheMachine02's library... after proper line/polygon clipping is done.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 29, 2013, 01:39:55 pm
No it's not ... It's too much camera work to handle. And you don't seem to see what long it takes to render an entire world each time you press a key.

Anyway, I had a genius flash some days ago, and I'm glad (and proud) to say that I'm back on this project (that was a short but useful pause :P).

Aaaaand I'm bringing a huge bunch of updates.

First, I wrote the Triangle( command, a real and efficient triangle filler. With ben_g, we started working on it three months ago (yes, three months), but we couldn't make it work properly, so a few days ago I got tired, and said that I gave up. BUT, the genius flash I talked about above permitted me to find the only (and silly ;D) error, so now it works !

(http://img.removedfromgame.com/imgs/doubleFilledRectangle.gif)

Also, since some people asked for some automagic (hello pimathbrainiac ;D), well, I wrote some :P

So, I added the Tri( function (not to mistake with the previously described command), which draws a 3D triangle out of three offsets and a vertices table, and the Quad( function, which draws a 3D rectangle out of four offsets and a vertices table.

I still need to work on the triangle filler, particularly to make it able to take a fourth parameter which will be the colour (0 → all black, 1 → white with borders, 2 → all white).

Anyway, using a little bit modified version of the axiom (I only changed the colour of the triangle filler) and some work on the Axe side, I got ...

SOLID DRAWING :crazy:

(http://img.removedfromgame.com/imgs/solidCube.gif)

Unfortunately, you won't be able to get solid drawing for now using the axiom, since I changed back the default colour of the triangle filler to black (it's just to show how easy it is, I only had to change 2 bytes in the axiom and add a mere 200 bytes in the Axe program). I think I'll made a tutorial on the technique I used (which is still very bad).

Last thing, I moved all the functions to the DISTR menu [2nd] [vars]. So I'll have 15 fields left for commands (including the ones already used) :thumbsup:

Anyway. I attached AXMJH3D.8xv, which is the axiom, TEST.8xp, which is the source of the program running on the first screenshot, and a readme.txt, which you will need to read if you want to program with AXMJH3D.

As ever, all of these screenshots are made at 6Mhz. And as ever, share comments :)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Hayleia on April 29, 2013, 01:53:16 pm
*.*
+1

'Nuff said.

No seriously, that is awesome. I just had a question since your screenshots don't show it: does it support clipping ?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: pimathbrainiac on April 29, 2013, 02:07:47 pm
Matrefeytontias++

*.*

Hayleia said it.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 29, 2013, 02:49:20 pm
Thanks everyone :D I forgot to mention it, unfortunately it doesn't support clipping for now, but I'm working on it ;)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Dapianokid on April 29, 2013, 05:23:39 pm
/me *dies*

THIS IS AMAZING
So, if I can make triangles, with a little bit of trickery, I can create, say, an icosihedron? :D
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Joshuasm32 on April 29, 2013, 05:24:53 pm
 :w00t:  This is really cool!
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 29, 2013, 05:40:14 pm
Just to know, what's an icosihedron ? :P
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Dapianokid on April 29, 2013, 05:41:34 pm
20 triangles arranged completely uniform. Google it.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: tr1p1ea on April 29, 2013, 05:46:17 pm
Wow looks awesome!
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 29, 2013, 06:25:43 pm
Dapianokid it may be possible, but very slow =] you're free to try ;)

tr1p1ea thanks ^^
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TheMachine02 on April 30, 2013, 08:42:21 am
you know that you are making my librairy useless   >:D ?

anyway, it's very good job.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 30, 2013, 09:12:40 am
Are you kidding ? Your librairy handles so many more things than mine ;)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TheMachine02 on April 30, 2013, 09:16:31 am
yep, but you do thing with a lot moar optimized way
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 30, 2013, 09:19:28 am
Since it's pure ASM (with Axe's functions, but still) yeah, it's way faster. But if it wasn't, either you were a crazily awesome Axe programmer, or me a terrible ASM coder :P
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TheMachine02 on April 30, 2013, 09:24:09 am
maybe a hybrid axe/asm librairy is the solution...  ;D 
*TheMachine02 dreams of very beautiful things
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on April 30, 2013, 11:14:16 am
Well, that's what I'm doing in some way, since it's an axiom :P I can still write some Axe commands, themselves using AxeJh3D's functions.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Dapianokid on April 30, 2013, 08:35:41 pm
You two should just work together, Matty and Machine. TheMachineTias! Axiom!

By the way, I have no idea how to code an Icosihedron in Axe and I'd want solid drawing to do so.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: tr1p1ea on April 30, 2013, 11:10:51 pm
I was wondering if orientation is stored in x,y,z angles currently. If so do you plan on migrating this to a full 6dof system? (Where orientation is stored in matrices, as opposed to a matrix being generated from updated x,y,z angles every frame ... if that makes sense?)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on May 01, 2013, 06:25:10 am
As I said, I didn't coded the three first functions, so I can't really touch to the 3D calculations.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: tr1p1ea on May 01, 2013, 09:07:46 pm
Well it would be fine for projects that dont require full 3D movement (like space sims). But for say an FPS it should be ok. It does cut out a lot of overhead this way which can get you performance, which is good :).
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: DJ Omnimaga on May 02, 2013, 01:51:44 am
WHy hasn't anyone ever tried to make a 3D RPG? Just random battles like Final Fantasy and no action-based enemy movement outside battles, but instead of 2D villages/dungeons, they're 3D.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: tr1p1ea on May 02, 2013, 02:05:35 am
I suppose because there would still be a lot of detail required and calc 3D is pretty limited in complexity. But still worth a shot.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TheMachine02 on May 02, 2013, 11:37:46 am
3d rpg is my final goal with glib  :P
and if I ever do it, it will be very simplified  ;D  (like only rooms, I not very sure how we can do optimized nature place, though)
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on May 04, 2013, 04:56:02 am
Small update :)

All drawing commands now takes an additional argument : 0 for black drawing, 1 for solid white. This makes solid display possible for you guys :thumbsup:

Also, if you can think of any functionality that you'd like to see in the axiom, please tell us because I'm a bit out of inspiration :P
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Hayleia on May 04, 2013, 04:57:49 am
Small update :)

All drawing commands now takes an additional argument : 0 for black drawing, 1 for solid white. This makes solid display possible for you guys :thumbsup:
Great :D

Also, if you can think of any functionality that you'd like to see in the axiom, please tell us because I'm a bit out of inspiration :P
Well you already know them: clipping and textures :P
(I think clipping is more of a priority than textures if you support solid drawing with "colors")
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on May 04, 2013, 04:59:29 am
Textures will come later (they'll come ;D), but yeah I forgot about clipping :P I'll take care of that, even if it's not a functionality.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on May 14, 2013, 01:52:07 pm
Good news :)

I wrote a perfectly working (100% success rate :thumbsup:) clipped triangle routine in Axe, and I'm working on editing the current ASM triangle routine :D  It's not too much things added, so you'll probably see it in ASM before next week.

(http://img.removedfromgame.com/imgs/clippedTriangle.gif)

It's going so fast that I don't have the time to release the button while it draws another triangle :P

Also, ben_g and me are working on a SortFaces(Zarray, facesArray, outputArea) automagic, to sort your faces to handle occlusion and make your life easier ;D
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on May 28, 2013, 12:13:22 pm
Bad news ...

I can't write a proper clipped triangle. I don't know why, but this just doesn't want to work. I re-read the code many many times and still can't see the error. If you guys wanna help me with this, here is the complete AxeJh3D code at pastebin (http://pastebin.com/DyK1MiGZ).

Actually, clipping works perfectly with y < 0, y > 63, x > 95 but not with x < 0. I also attached a small Axe program to test the routine, if you want to see what's wrong or to fix it.

I need to explain some things related to the way I draw the triangle. First, I constantly use 3 variables : startX1 and startX2, two 16.8 numbers, which refers to the left and right pixels of the line to draw (because I draw the triangle with horizontal lines), startY, which is the Y coordinate of the line. I also constantly add two 8.8 variables to startX1 and startX2, namely dx1 and dx2, which are the slope of each side (dx1 is updated during the process to the slope of the 3rd edge of the triangle). I did it that way because with only 8.8 startX*, the triangle went too fast from 127 to -128, making the triangle being drawn wrongly. So by doing that, my goal was to fix that error, since it's harder to go from 32767 to -32768.

EDIT : with help from Runer112 on IRC, we made it that the triangle is properly clipped when x < 0 ; but the 127→-128 thing still appears, so the problem is not solved yet.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: DJ Omnimaga on June 10, 2013, 11:55:00 pm
How do I compile the program? If I try to, the calc just shuts off then I get a RAM Clear ???
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: tr1p1ea on June 11, 2013, 01:13:58 am
Since you are clipping triangles in 2D, you will need to see if the length of any slice is > 128 and dont draw if this is so. This usually means that the triangle is ultra close to the viewer anyway so should be ok.

If you are wanting to make an indoor room however, you might need to look at 3D clipping techniques.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Eiyeron on August 19, 2013, 06:00:02 pm
How that works? I understood that MatrxRot prepare the matrix, that RotVertx rotates coordonates with the matrix and ProjVertew give us some coords, but why when using on a simple point it gets crazy rotztuons?

Code: [Select]
0->I
Repeat GetKey(15)
CalcMatrx(I,0,)
RotVertx(10,0,0,L1)
ProjVertx({L1}^r, {L1+2}^r, {L1+4}^r)->A
Pxl-On(A^256, A/256)
DispGraphClearDraw
I++
End
Why do I get a point that goes berzerk and go erratically?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on August 19, 2013, 06:24:39 pm
You need to add an offset to {L1+4}r (150 works fine) so that the point doesn't project right at your eyes, but a little further. I'm very glad to finally see someone trying to use the axiom ^^
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Eiyeron on August 19, 2013, 06:29:29 pm
Yay I got a spinning dot! 3D can finally be studyied, thanks!
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on August 19, 2013, 07:06:57 pm
You're welcome :) keep us informed about your work ! I'd love to see moar 3D stuffs coming up !
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Eiyeron on August 19, 2013, 07:13:48 pm
I just noted that Quad should need vertices in order, right? Oh, and xhat's the offset for quad?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on August 20, 2013, 08:52:13 am
Quad( will need the inputted vertices to be ... inputted as follows :
Code: [Select]
1---------2
|         |
4---------3
Rotated in any way of course.
You use the function in that way :

Quad(OFFSETS, TABLE, COLOR)

OFFSETS is a pointer on 41-bytes values, which are multiples of 6 : they will be added to TABLE, which is a pointer on a table of 6-bytes vertices (don't forget to rotate them before drawing). COLOR is 0 for black and 1 for solid white. Example :

Quad(Data(24,48,6,12), GDB1ROT, 1)

Will draw a white quad out of the 4th, 8th, 1st and 2nd vertices of the vertices table situated at GDB1ROT.

EDIT : not sure about the multiples of 6, I guess you can just test it. Maybe in the example it's just Data(4,8,1,2), I don't remember :/
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Eiyeron on August 20, 2013, 08:58:38 am
Ah, it's a pointer to a vertice table, isn't it?
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on August 20, 2013, 10:57:18 am
Yeah, exactly. This table is intended to contain rotated vertices, not the original ones, because the Quad function only does drawing.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: neuronix on November 26, 2015, 03:16:41 pm
Would it be possible to obtain the source code?  ;)
Thank you in advance
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: Matrefeytontias on November 29, 2015, 03:50:14 pm
Yeah sure, here it is.
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: E37 on December 08, 2015, 03:53:12 pm
Is there a version of code that is modifiable on calc with mimas?
I am trying to learn mimas.
(Sorry if I over looked the download)
Thanks!
Title: Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
Post by: TIfanx1999 on December 28, 2015, 08:25:37 am
It doesn't work with mimas? What file type does mimas require?