Author Topic: Glib : a 3D graphics axe library  (Read 93973 times)

0 Members and 1 Guest are viewing this topic.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #90 on: April 30, 2013, 09:29:36 am »
ahh ! so It's when I create the dist list that I sort it ?
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #91 on: April 30, 2013, 09:45:54 am »
That's the idea. See, right now, you are creating a list. That's one n. Then, you are sorting that list using an n^2 method. After that, you effectively sort the resulting ID list as you parse through it, presumably with a "Go until you find the right one" approach, which , when sent through the list n times for n vertexes, is sum(1,n).

Altogether this comes to n+n^2+sum(1,n). For a 6-member list this is 6+36+21=53. n^2 is 36.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #92 on: April 30, 2013, 09:54:14 am »
that not exactly this

I create my list : n
I sort it, and directly create the id list : n²
then I read,to the id list to render :n

I have 2n+n² in all,wich is ... slow.
But how can I sort and create the ID while creating the distance list?
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #93 on: April 30, 2013, 11:12:09 am »
Then don't create any ID list, but directly sort the distance list instead. So you'll come up with a single sorted list.

I'll try to implement the sorting method I used with AxeJh3D.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #94 on: April 30, 2013, 01:05:11 pm »
I need the id list to render polygon, I can't skip it  :P

but it's sure that optimization is possible
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #95 on: April 30, 2013, 01:37:07 pm »
I see what I think is an optimisation, I'll just make an Axe-like algorithm out of it :

Lbl GSortID
...
GDB1ZFACE is a nbFaces*2 large free area
GDB1FACE contains the face definition in the form of Data(0,4,2,...)
GDB1ZVERT contains the 2-bytes Z coordinate of each vertex
GDB1SORT is a nbFaces large free area
...

.Z-average value for each face
For(r2,0,nbFaces)
  0→{r2*2+GDB1ZFACE→r3}r
  For(r1,0,nbVerticesForThisFace)
    {{r2*nbVerticesForThisFace+GDB1FACE}*2+GDB1ZVERT}r+{r3}r→{r3}r
  End
  {r3}r//nbVerticesForThisFace→{r3}r
End

.Sort
While 1
  0→F
  For(r1,0,nbFaces-1)
    If {{r1+GDB1SORT}*2+GDB1ZFACE}r<<{{r1+GDB1SORT+1}*2+GDB1ZFACE}r
      1→F
      Exch(r1+GDB1SORT,r1+GDB1SORT+1,1)
    End
  End
End!If F
Return


With that you have your list in GDB1SORT. I can't really test it since I'm really not familiar with GLib's environment, so I let you test. Ask if you don't understand something.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #96 on: April 30, 2013, 07:01:17 pm »
If we implement the in-place sort, the ID list becomes unnecessary, as it's implied that it goes {0 1 2 3 .. highest ID}

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #97 on: May 01, 2013, 10:02:15 am »
Matrefeytontias you're code work perfectly, I just need to do speed test.

If we implement the in-place sort, the ID list becomes unnecessary, as it's implied that it goes {0 1 2 3 .. highest ID}

I really don't know how to do in-place sort...
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #98 on: May 01, 2013, 02:06:43 pm »
What he means is that instead of using a list containing all offsets to vertices in a sorted order, just sort the vertices themselves. With that you can access vertices directly, thus retrieving a significant number of calculations.

I'll rewrite my algorithm to use this method.
« Last Edit: May 01, 2013, 02:07:26 pm by Matrefeytontias »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #99 on: May 10, 2013, 05:51:31 am »
I test one place sort,and... forget it. The speed is just horrible  :w00t:

But you will be happy to know that I work on this, and a update will come soon, with some  new commands.... who are just awesome  ;D
I will upload it when I can.

(ohh, and Matrefeytontias can you send me the data you use for the omnimaga logo (test program of your axiom) ?   ;) )
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #100 on: May 10, 2013, 08:03:07 am »
I can, but 1) in a bunch of hours 2) there are no faces, it's just a bunch of Data(Xr,Yr,Zr).

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #101 on: May 10, 2013, 01:15:17 pm »
Bump,

There you go, all the 20 vertices :

:ΔList(-40r,40r,5r)→GDB1IN
:ΔList(-40r,-40r,5r)
:ΔList(40r,-40r,5r)
:ΔList(40r,30r,5r)
:ΔList(60r,30r,5r)
:ΔList(60r,40r,5r)
:ΔList(-30r,30r,5r)
:ΔList(-30r,-30r,5r)
:ΔList(30r,-30r,5r)
:ΔList(30r,30r,5r)
:ΔList(-40r,40r,-5r)
:ΔList(-40r,-40r,-5r)
:ΔList(40r,-40r,-5r)
:ΔList(40r,30r,-5r)
:ΔList(60r,30r,-5r)
:ΔList(60r,40r,-5r)
:ΔList(-30r,30r,-5r)
:ΔList(-30r,-30r,-5r)
:ΔList(30r,-30r,-5r)
:ΔList(30r,30r,-5r)
« Last Edit: May 10, 2013, 01:16:54 pm by Matrefeytontias »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #102 on: July 01, 2013, 12:31:08 pm »
Necro ..? I hope not.

Is this still being worked on ? It would be too bad that it died.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #103 on: July 02, 2013, 04:58:46 am »
no don't worry, it's not dead at all  ;)     I currently work actively on it....
It's just I prepare you a super mega update of the death  :P

Anyway, here is the last progress :
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: GLIB a graphics axe 3d librairy
« Reply #104 on: July 02, 2013, 05:10:02 am »
And that on 8-9FPS? Impressive! :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!