xbdev - software development
Wednesday February 21, 2024
home | contact | Support

The Maths of 3D

You can't have 3D without a little maths...


Rasterization : Wire Triangle...Easy...

by bkenwright@xbdev.net


If you have a line drawing algorithm, well drawing a wire triangle is going to be a snap... but still its not that simple :)  I'm sure you'll use it loads and loads in your debugging... wire triangle view is very useful in debugging 3D code.





void wire_triangle(unsigned int* pBits, int w, int h, int pitch,

                           int x0, int y0,

                           int x1, int y1,

                           int x2, int y2,

                           DWORD dwColour)



      line(pBits, w, h, pitch,   x0, y0,  x1, y1, dwColour);

      line(pBits, w, h, pitch,   x1, y1,  x2, y2, dwColour);

      line(pBits, w, h, pitch,   x2, y2,  x0, y0, dwColour);


}// End of wire_triangle(..)



Of course where not doing any gradual colour changes yet....per point lighting etc....we'll get to that later :)

Advert (Support Website)

Copyright (c) 2002-2024 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.