PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Jacco's & Billcow's Line functions / benchmark, feedback

hi there, i've spend some time to test different line algo. and i wanted to give you some feedback here. I made a simple bench wich consists in a main loop of 10 seconds.
in this loop:
1/ draw 250 lines (from 0,0 to 239,319)
3/ add one to counter
2/ update
then i display counter to know how many times we have drawn these 250 lines during these 10 seconds.

i had 3 line functions to test, here are the results:

Jacco EasyCE 1.6 FP line: 165 times (4125 line / sec)
Billcow line1: 173 times ( 4325 line / sec )
Billcow line2: 164 times (4100 line / sec )

5% gain on a full line stuff is not bad is it ?!
C basic stuff questions:
i have a vertex struct:
Code:

struct wvertex
{
int x;
int y;
int z;
};


i want to push it in a function that rotateX this a vertex and MODIFY the values

Code:

wvertex dummy;
dummy.x = 100;
dummy.y = 100;
dummy.z = 100;
rotatex( dummy, 15 ) // 15 = angle


of course, in the rotatex function, i modify the vertex with a matrix (who hasn't done that stuff yet ? :p )

Code:

void rotatex( wvertex p, angle )
{
p.y = ...
p.z = ...
}


but when i get out of the function, the vertex stays unmoved, just like when you pass parameters by value, not by adress.

i understood passing parametres by adress with simple variables or arrays but i don't know how to do this with a struct :/

can someone help ?
There is two possibility...

1) Using a pointer:

Code:

void rotatex( wvertex* vertex )
{
vertex->x = ...
}



2) Using a reference:

Code:

void rotatex( wvertex& vertex )
{
vertex.x = ...
}
(I'm not particularly practiced at C, so this is my interpretation from the C reference manual "The C Programming Language" :) If you're serious about C programming, it should be sitting on your desk somewhere):

Call the function as:

rotatex(&dummy, angle);

and declare it as:

void rotatex( struct wvertex *p, int angle )
{
p->y = ...
p->z = ...
}

Essentially, you're wanting to pass the *address* of the structure to the function, so it can directly access the passed structure, NOT a copy. The function then has to dereference the individual members of the structure, x, y, z.

You could also write (*p).x = ... , if that's any clearer for you. You're dereferencing the pointer (structure address) and accessing the individual item in the structure.

Cheers, hope that helps,

Refractor
yesssssss :) thx all

*my secret wish: take Focus, translate to PPC and replace with FP ... one can dream ... i'll buy that book :)*
Focus? That's mine. :)
Focus ? of course that's your :P
lot of work to make it run (fast) on ppc isn't it ? :)

focus has become my bible :twisted:
Hm, should be possible on the PPC. But that would be too much work. It has floating point all over the place, including in the main loop of the tmapper. The Pentiums allow for simulaneous calculation of FP stuff and integer stuff. But, it should be possible. But who cares? We'll just add good 3D support to the Overloaded library. :)
MirekCz forgot his pass;) · 08 May 2002, 16:26 UTC — Mirek
well, I have got a 3d engine for PPC;P
It works even quite well and after a lot of hard work it supports real 3d frustrum culling/clipping with bounding spheres and AABB.(all in all, real 3d clipping is fucking slow comparing to a 2d solution)
But doing it without asm fixedpoint math routines was so fucking shitty...
All in all, my engine world is like 64mx64mx64m :) If I just had the damn asm routines I could go with about 2^12 the size and no fucking tweaking to the last bit and fighting overflows:/
I don't use persp. correct tmapping and my engine speed is acceptable. With some asm and persp.correct tmapping it should work very well:)
It can draw few k polys per scene with about 10fps.
But well, I won't finish it cause no fucking PPC around:/ anyone wants some source?
laurnet · 08 May 2002, 20:06 UTC — 3d
arf, if i could understand what the f*ck your talking about(3d) , i' ll be happy to finish your 3d engine!
If you're serious about the source, I'd like a copy.

Pam
But doing it without asm fixedpoint math routines was so fucking shitty...
All in all, my engine world is like 64mx64mx64m If I just had the damn asm routines I could go with about 2^12 the size and no fucking tweaking to the last bit and fighting overflows:/
I don't use persp. correct tmapping and my engine speed is acceptable. With some asm and persp.correct tmapping it should work very well:)


If you're interested in somebody to code/optimise some routines in ARM assembler for you, private-message me. :)
(And if you're giving out source I'm always keen to see how other people are doing things :D)

Cheers,
Refractor
blah blah MirekCz · 08 May 2002, 23:59 UTC
ok If I have some time tommorow I will try if it compiles fine under emu and then pack it all together and put somewhere on www for download.
Yeah Jacco, this was before reading overload stuff :') ... this is really a lot of homework :p

of course understanding overload and starting coding around becoes a priority ... :roll: