0 Members and 1 Guest are viewing this topic.
float ddy,dy,dx; edge.dh=(v1->sx-v0->sx)/(ddy=v1->sy-v0->sy); edge.dl=(v2->sx-v1->sx)/(v2->sy-v1->sy); scan.dz=(v1->sz-(v0->sz+(edge.dz=(v2->sz-v0->sz)*(dy=1.0f/(v2->sy-v0->sy)))*ddy))* (dx=1.0f/(v1->sx-(v0->sx+(edge.dx=(v2->sx-v0->sx)*dy)*ddy))); scan.dr=(v1->sr-(v0->sr+(edge.dr=(v2->sr-v0->sr)*dy)*ddy))*dx; scan.dg=(v1->sg-(v0->sg+(edge.dg=(v2->sg-v0->sg)*dy)*ddy))*dx; scan.db=(v1->sb-(v0->sb+(edge.db=(v2->sb-v0->sb)*dy)*ddy))*dx; scan.du=(v1->su-(v0->su+(edge.du=(v2->su-v0->su)*dy)*ddy))*dx; scan.dv=(v1->sv-(v0->sv+(edge.dv=(v2->sv-v0->sv)*dy)*ddy))*dx;
struct Attributes { float z, r,g,b, u,v; };struct Vertex { float x,y; Attributes attribs; }Attributes edge= (v1->attribs - v2->attribs) * dy;Attributes scan= (v1->attribs - (v0->attribs+edge*ddy))*dx;
Philosophically speaking, does any software engineering guru still think that operator overloading is 'a good thing' TM?
In my opinion it's perfectly fine if an operator does *exactly* what you think it does.
I can't help thinking that using overloaded operators on the attributes type would result in a lot more mem/stack accessing than otherwise
a.f0 = b.f0 + c.f0 + d.f0;a.f1 = b.f1 + c.f1 + d.f1;a.f2 = b.f2 + c.f2 + d.f2;a.f3 = b.f3 + c.f3 + d.f3;
Ah right. So are overloaded operators called as some sort of function if they're not inline?