www.xbdev.net xbdev - software development
Monday December 10, 2018
home | about | contact | Donations

     
 

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.

 

 

DownloadSourceCode

 

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 :)

 
 Visitor: 9534626  { 209.237.238.175 } Copyright (c) 2002-2017 xbdev.net - All rights reserved.
Designated tutorial and software are the property of their respective owners.