Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
ASM
»
[AXE/ASM] Improving a textured triangle routine
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [AXE/ASM] Improving a textured triangle routine (Read 2442 times)
0 Members and 1 Guest are viewing this topic.
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
[AXE/ASM] Improving a textured triangle routine
«
on:
March 31, 2014, 11:33:16 am »
Hey guys,
These last days I've been working on a textured triangle routine, mostly for the sake of having done one. For now it's Axe, I think it's rather well optimized (not too much) but it's still way too slow for my taste, so I thought of porting it to ASM.
So far I have this. It doesn't do any clipping on any side, so trying to draw out-screen will mess up your calc real good :
:
E
8000→°DX1+2→°DX2+2→°DX3+2→°X1+2→°X2+2→°DU1+2→°DU2+2→°DU3+2→°DV1+2→°DV2+2→°DV3+2→°DU+2→°DV+2→°U1+2→°U2+2→°V1+2→°V2+2→°SFlag+2→°SMid+2→°SEnd+2→°SX1+2→°SX2+2→°SU+2→°SV
:.Tri(°X1Y1,°X2Y2,°X3Y3,°U1V1,°U2V2,°U3V3)
:.Pic1 is a 16*16 image
:Lbl Tri
:Data(128,64,32,16,8,4,2)→GDB1MASK
:If {r1+1}>{r2+1}
:Exch(°r1,°r2,2
:Exch(°r3,°r4,2
:End
:If {r2+1}>{r3+1}
:Exch(°r2,°r3,2
:Exch(°r4,°r5,2
:End
:If {r1+1}>{r2+1}
:Exch(°r1,°r2,2
:Exch(°r3,°r4,2
:End
:
:{r2+1}-{r1+1}?,+1
:→Θ
:{r2}-{r1}*256//Θ→DX1
:{r5}-{r4}*256//Θ→DU1
:{r5+1}-{r4+1}*256//Θ→DV1
:
:{r3+1}-{r1+1}?,+1
:→Θ
:{r3}-{r1}*256//Θ→DX2
:{r6}-{r4}*256//Θ→DU2
:{r6+1}-{r4+1}*256//Θ→DV2
:
:{r3+1}-{r2+1}?,+1
:→Θ
:{r3}-{r2}*256//Θ→DX3
:{r6}-{r5}*256//Θ→DU3
:{r6+1}-{r5+1}*256//Θ→DV3
:
:DX2-DX1?,1.0
:→Θ
:DU2-DU1/*Θ→DU
:DV2-DV1/*Θ→DV
:0→SFlag
:
:{r1}*256→X1→X2
:{r1+1}→Y
:{r2+1}→SMid
:{r3+1}→SEnd
:{r4}*256→U1→U2
:{r4+1}*256→V1→V2
:
:If DX1-DX2/32768
:°X1+1→SX1
:°X2+1→SX2
:°U1→SU
:°V1→SV
:Else
:°X2+1→SX1
:°X1+1→SX2
:°U2→SU
:°V2→SV
:End
:
:While 1
:.Draw texture slice
:{SX1}→X
:{SX2}→Θ
:{SU}
r
→U
:{SV}
r
→V
:X and 7→r5
:X/2/2/2+(Y*12)+L6→r6
:!If r5
:Else!If -1
:{r6}
:./128
:Asm(3E80A5076F
:Else!If -1
:{r6}
:./64
:Asm(3EC0A507076F
:Else!If -1
:{r6}
:./32
:Asm(3EE0A50707076F
:Else!If -1
:nib{r6*2}
:Else!If -1
:{r6}
:./8
:Asm(CB3DCB3DCB3D
:Else!If -1
:{r6}
:./4
:Asm(CB3DCB3D
:Else!If -1
:{r6}
:./2
:Asm(CB3D
:End
:→r4
:While 1
:r4*2
:+({V/256*2+Pic1}
rr
ee(U/256))→r4
:!If r5+1 and 7→r5
:r4→{r6}
:r6++
:0→r4
:End
:DU+U→U
:DV+V→V
:EndIf X++>Θ
:r5?r4*{r5-1+GDB1MASK} or {r6}→{r6
:
:If SFlag
:DX3+X1→X1
:DU3+U1→U1
:DV3+V1→V1
:Else
:DX1+X1→X1
:DU1+U1→U1
:DV1+V1→V1
:End
:DX2+X2→X2
:DU2+U2→U2
:DV2+V2→V2
:Select(Y++,≥SMid?→SFlag)
:EndIf >SEnd
:Return
It does work, but it's reaaally slow (drawing 2 triangles is 6 FPS at 6 MHz) :
So before starting porting it to ASM (after I've got clipping working, but that is easy with the current code), I wanted to know if there was a better technique to do that. Basically, I'm doing it on a per-pixel logic (of course) but I interpolate every X and every Y, which I think is too slow.
Then I came around that
10-years old ASM scaled sprite routine by Badja
and looking at the source and at how fast it was I felt like that technique could be used, although it can only shrink sprites. Basically, instead of interpolating every X, it calculates how many pixels has to be skipped and does the corresponding shifts according to it.
Would that be something feasible ? I didn't give it much thought by now, but seeing how slow my routine is, I'm pretty confident that there is a faster way. If it's not feasible in Axe but only ASM, it's fine, since I ultimately want to have an ASM textured triangle filler.
«
Last Edit: March 31, 2014, 11:40:31 am by Matrefeytontias
»
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
Re: [AXE/ASM] Improving a textured triangle routine
«
Reply #1 on:
April 04, 2014, 02:34:57 pm »
Bump,
Anyone willing to help ?
I'm really running out of ideas here ...
Also, I'm in the process of converting that routine to assembly for those who are better with this latter.
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Print
Pages: [
1
]
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
ASM
»
[AXE/ASM] Improving a textured triangle routine