

3d-grapher
#41
Posted 12 November 2002 - 12:32 PM

#42
Posted 12 November 2002 - 01:07 PM
I've sent it again

If you use messenger, I can transfer it directly to you..

#43
Posted 12 November 2002 - 05:05 PM
#44
Posted 16 November 2002 - 07:25 PM
enjoy

if you still want the full source, please contact me be e-mail or msn messenger
#45
Posted 18 November 2002 - 11:02 PM

It's not the first time i come, but now i think i have a lot of things to learn among you, so i decided to register me as member...

To present me in a few words, i'm a 18 y.o belgian boy, and i have programmed in basic language on casio CFX-models for 2 years.
Now i also have an algebra-fx2 ( rom 1.02 ) and i began to work in C/asm 2 monthes ago...
Actually i'm admin of the Forum Commun Casio, which concerns only the Basic language ( my current nick is Julien ), and now i use to go to the french Forum G100 to learn C/asm languages ...

As you can see my english isn't perfect, sorry about that, but i'm sure it will be a good training for me to come here!

Anyway, why am i telling that in this topic?

I would ask to BiTwhise which technic he's using to create rotations, because i did it with rotation's matrixes, it works, but it's sooooo slow

To end this post i just want to ask if some people is still working with the Basic language here ( making RPG of so


#46
Posted 19 November 2002 - 05:21 AM

#47
Posted 19 November 2002 - 11:50 AM

#48
Posted 19 November 2002 - 11:42 PM
Anyway, why am i telling that in this topic? <_<
Simply because i'm really impressed by the work of BiTwhise: when i tried to do the same ( in C language ) a few days ago i realized it was time for me to improve my skills ()...
I would ask to BiTwhise which technic he's using to create rotations, because i did it with rotation's matrixes, it works, but it's sooooo slow

THANKS!!
Well, basically I use normal rotation matrixes. However, I've written the routines myself, in assembler, and use only fixed point math...
If your using floating points, that should explain any drastic performance hit.. since the calc doesn't have an fpu

As for the structure of my program, it's quite streamlined.. that is, most functions are inline.
Things you could do to speed up your program:
* use inline function.. so you don't have to do so many jumps
* use asm libraries for graphics (probably doing so already). in most cases this will be more cpu intensive than the rotations...
* if you're (like in my case) drawing tons of short lines one after another in a loop, make your line drawing procedure inline... that will speed things up a bit
* try to limit data acces as much as you can, align data and use string functions (I know this can be a bit tricky in c.. you can always use inline asm)
* write the entire thing in asm

Anyway, Welcome to the forum, and good luck with your programming

#49
Posted 21 November 2002 - 04:37 PM
I just browsed through the french forum, and came across the source of your 3d programe

I'm sitting at school right now, so I haven't uploaded and tried it, but from a brief look at your source I can tell you why it's much slower...
(probably mentioned lots of this in my previos post, but anyway)
* you use doubles for coordinates and roations... that means lots of floating point math... your calc just isn't up for that, and the difference in onscreen result isn't really visible (major performance hit)
* graphical function... well, you do have som inline asm, but you do function calls too often. you use a function inside your line algorithm, wich means you do a call for EVERY pixel, calculating the effective address of EVERY pixel!! (major performance hit)
* use while loops instead of for loops, basically do all you transformations in reverse order... doing this will make the loop compile to a loop statement with the counter in cx, or at least a loop where the counter is only checked for zero, rather than compared for a value. you might even consider asm for inline loops... (minor performance hit)
you can easilly do some minor tweaks to your programe..
* get hold af a line drawing function in asm, pass paramaters as a pointer to 1 structure, rather than x,y values... or, for best perfomance, make it inline
* calculate the memory address of the current page in the start of each frame -> pass this value instead of the page number (or just store it in es, the compiler will probably not change this unless you use string functions for writing to mem)
* as mentioned, reverse your loops, make them while loops (inner loops that is, outers aren't really that important)
Well, that's all I could think of right away, need any help or more suggestions, just post or e-mail me

#50
Posted 22 November 2002 - 08:56 AM

Sorry i forgot to tell my sources were available on the french forum

Well, i suppose you saw it on the forum: 2072 has the same ideas as you

* i know the float type isn't really appropriate for this program, but what would be the most efficient way to replace it ? I tried to work with int type multiplied by 1e4 or another factor, and then divided by the same factor to put the points on screen, but the speed is the same...
* i've put the pixel function inline in the Line one, but i think it would be better to work with some asm function to draw line between 2 points of screen than with for loops like the one i use... Maybe someone has that for me?

* i didn't thought about the differences between the loops... but now, perhaps i can try without loops to multiply the rotation matrixes ( 9 lines by multiplication

This 3d program was just to have a liitle break in the production of the other; i did it cuz i saw your work and i just wanted to compare the results (now i've seen!

Actually i made the same 3d program in Basic a couple of monthes ago ( for CFX models only), sure the speed wasn't the same but for basic language i obtained good results: it draws cubes, spheres, torres ( you know, the donut-like form

I keep on mind all your advices, it will certainly help me in another projects, and when i'll have collected enough experience i will try 3d programs again!

#51
Posted 22 November 2002 - 03:40 PM
What you need to do is work with fixed point ingeteger math.. that does not mean dividing by ANY constant factor, it has to be a factor in the power of 2... so you can you bitwise manipulation to obtain the integer, or fraction part of the number. you do this be shifting the number, left (to multiply) and right (to divide)... if you want to compensate for truncation rounding error, you perform an 'adc variable, 0' after the last right shift (or you do an 'inc varible' before the shift)i know the float type isn't really appropriate for this program, but what would be the most efficient way to replace it ? I tried to work with int type multiplied by 1e4 or another factor, and then divided by the same factor to put the points on screen, but the speed is the same...
Using regular division and multiplication to do this is very costly... about 30 ticks for one multiply (I think)
Putting the pixel function inline should speed things up a bit (only a bit), so getting a line function in asm would be the best idea. If you use the 'D3' linear screen mode, I have some line drawing functions you can use. If you use casio's standard 'C3' mode, I'm shure someone else can give you those functionsi've put the pixel function inline in the Line one, but i think it would be better to work with some asm function to draw line between 2 points of screen than with for loops like the one i use... Maybe someone has that for me?
Uncrolling loops, like your matrix multiplications is a good idea.... and it doesn't affect program size that much.. I mean...look at you code.. it's not YOUR code that make the program size 50 - 60 K, it's all the C include filesi didn't thought about the differences between the loops... but now, perhaps i can try without loops to multiply the rotation matrixes ( 9 lines by multiplication )... it isn't really great for the program's size but...

Glad to help, and the best of luck with you diary project

2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users