y'a un sous-rep texedit:
c'est un truc qui te sort un tableau de polygones,
pour afficher des images'vectorielles' avec la routine filldots
tu devrais vite comprendre le fonctionnement.
j'ai fait le A_NORMAL,A_REVERSE et A_XOR parce que j'en avait en fait besoin.

fabetal_ > Hier, je me suis fait monter par un pote
redangel > et en chevals, ça donne quoi?
Nil> OMG I think I'm gay
Spipu Le 05/02/2002 à 15:30 je viens de faire une routine de remplissage de triangle : elle me permet d'afficher 750 tri a la sec au lieu des 150 de filltriangle
as tu au moins essayé les routines qu'on t'a proposé?

fabetal_ > Hier, je me suis fait monter par un pote
redangel > et en chevals, ça donne quoi?
Nil> OMG I think I'm gay
Spipu Le 05/02/2002 à 15:38 vi, j'ai combiner celles de hyper.c et d'autres fournis dans l'autre topic
d'ailleurs, j'aimerais utiliser ta fnc hline, mais qui remplirais avec du blanc, mais g pas compris comment la modifier... tu pourais me l'expliquer svp ?
void HLine(short x1,short x2,short y,char mode,char *buf)
{
short bx=x1;
char *addrf;
if(x1>x2)
{x1=x2;x2=bx;}
addrf=buf+((y<<5)-(y<<1))+(x2>>3);
buf+=((y<<5)-(y<<1))+(x1>>3);//va à la ligne
if(mode==A_NORMAL)
{if(buf!=addrf)
{
*buf++|=255>>(x1&7);
while(buf<addrf)
*buf++=255;
*buf|=255<<(8-(x2&7));
}
else
{
*buf|=(255>>(x1&7))&(255<<(8-(x2&7)));
}
}
else
if(mode==A_REVERSE)
{if(buf!=addrf)
{
*buf++&=~(255>>(x1&7));
while(buf<addrf)
*buf++=0;
*buf&=~(255<<(8-(x2&7)));
}
else
{
*buf&=~((255>>(x1&7))&(255<<(8-(x2&7))));
}
}
else
if(mode==A_XOR)
{if(buf!=addrf)
{
*buf++^=255>>(x1&7);
while(buf<addrf)
*buf++^=255;
*buf^=255<<(8-(x2&7));
}
else
{
*buf^=(255>>(x1&7))&(255<<(8-(x2&7)));
}
}
}
voila!
ça marche en NORMAL, REVERSE et XOR
tu n'as qu'à rajouter l'option dans les autres fcts

fabetal_ > Hier, je me suis fait monter par un pote
redangel > et en chevals, ça donne quoi?
Nil> OMG I think I'm gay
void FillTria(short xb1,short yb1,short xb2,short yb2,short xb3,short yb3,char mode,char *p)
{
register signed short yi,xs,xe,y1,y2,y3,x1,x2,x3;
//trie les points dans l'ordre
if(yb1<=yb2&&yb1<=yb3)
{
y1=yb1;
x1=xb1;
if(yb2<=yb3)
{
y2=yb2;y3=yb3;
x2=xb2;x3=xb3;
}
else
{
y2=yb3;y3=yb2;
x2=xb3;x3=xb2;
}
}
else
if(yb1>=yb2&&yb1>=yb3)
{
y3=yb1;
x3=xb1;
if(yb2<=yb3)
{
y1=yb2;y2=yb3;
x1=xb2;x2=xb3;
}
else
{
y1=yb3;y2=yb2;
x1=xb3;x2=xb2;
}
}
else
{
y2=yb1;
x2=xb1;
if(yb2<=yb3)
{
y1=yb2;y3=yb3;
x1=xb2;x3=xb3;
}
else
{
y1=yb3;y3=yb2;
x1=xb3;x3=xb2;
}
}
if(y1==y2)
HLine(x1,x2,y1,mode,p);
else
for(yi=y1;yi<y2;yi++)
{
xs=x1+(yi-y1)*(x2-x1)/NOT_NULL(y2-y1);
xe=x1+(yi-y1)*(x3-x1)/NOT_NULL(y3-y1);
HLine(xs,xe,yi,mode,p);
}
if(y3==y2)
HLine(x3,x2,y2,mode,p);
else
for(yi=y2;yi<y3;yi++)
{
xs=x2+(yi-y2)*(x3-x2)/NOT_NULL(y3-y2);
xe=x1+(yi-y1)*(x3-x1)/NOT_NULL(y3-y1);
HLine(xs,xe,yi,mode,p);
}
}

fabetal_ > Hier, je me suis fait monter par un pote
redangel > et en chevals, ça donne quoi?
Nil> OMG I think I'm gay
Spipu Le 05/02/2002 à 17:12 c impec !
j'ai combiné ton hline avec une proc de remplissage un peu comme la tienne mais ki evite les divisions : voici les resultats :
en 10 sec :
FillTriangle : 150 tri par sec
ma fnc : 1194 tri par sec !!!! ca c du rapide !!
franchement, merci a tous !!!!
si tu pouvais poster ta routine de triangle...

fabetal_ > Hier, je me suis fait monter par un pote
redangel > et en chevals, ça donne quoi?
Nil> OMG I think I'm gay
dis, c'est particulièrement optimisé ça
xs=x1+(yi-y1)*(x2-x1)/NOT_NULL(y2-y1);
xe=x1+(yi-y1)*(x3-x1)/NOT_NULL(y3-y1);
dans la boucle principale de remplissage en plus!
In many respects the Yoshi is like a beautiful woman. A man can come so enamoured that he bestows on her all his time, his energy and his fortune.
- Fred whipple, 1960
*** Ne sous-estimez pas la puissance de la Marmotte ***
©
Marmotte Team : LaMarmotte, sBibi, Vark & Sabrina
Spipu Le 07/02/2002 à 17:46 na pour tout il fo diviser par 10
donc c quand meme 10* plus râpide
bon, zut c dommage que t'aie pas fait 1190 polys par seconde...
dc Filltriangle, c'est 15 polys/sec... GLface 50*+ rapid -> 750 polys/sec
vu ke je pense pas que PpHd aie codé son remplisseur comme un porc, ça doit être assez près du maximum atteignable...
en C ça doit être faisable 200-300 polys/sec...
In many respects the Yoshi is like a beautiful woman. A man can come so enamoured that he bestows on her all his time, his energy and his fortune.
- Fred whipple, 1960
*** Ne sous-estimez pas la puissance de la Marmotte ***
©
Marmotte Team : LaMarmotte, sBibi, Vark & Sabrina