Code Source:salvia
Code Show
Template<class t> void Crasterizer::rasttri_constcoltex (int iy0,int iy1,sfbyte8* buf,zbuf_type* zbuf,t_ Rasterizier_point attribute,t col,t_material* material) {int affine=m_run_flags&rast_affine;int nline=0;for (int iy = iy0;iy>=iy1;--iy,buf+=m_linebytes,++nline) {int ix0 = Idmath::ftoifast (attribute.pl.x); int ix1 = Idmath:: Ftoifast (attribute.pr.x); zbuf_type* zbuf = M_zbuf + (M_context->getparam ()->height-iy-1) *m_context->getparam ()->width; t* screenbuf = (t*) buf;screenbuf +=ix0;if (affine) scanline_coltex_affine (Screenbuf, ix0,ix1,col,attribute,material); Elsescanline_coltex (Screenbuf, zbuf+ix0,ix0,ix1,col,attribute,material); Attribute.interpolateverticalcol ();}}
Conclusion Analysis
Triangles, where the Y value becomes smaller, and then the Xright-xleft gap becomes larger.
*
**
***
****
Code Detail Tags:
Process of Call Stack:
softcore.exe! crasterizer::scanline_coltex<unsigned int>//Basic function, but it's just the location of the discovery softcore.exe! crasterizer::rasttri_constcoltex<unsigned int>//Trigonometric functions here, using templates, softcore.exe! Crasterizer::d Rawtriangle_coltex (std::vector<crasterizer::t_rast_triangle,std::allocator<crasterizer::t_ Rast_triangl softcore.exe! Crasterizer::flush ()
Swipe out of buffer contents softcore.exe! Csoftrender::rasterizer ()
Final rasterization, including texture softcore.exe! Csoftrender::renderframe () line 505c++ softcore.exe! Cchildview::runframe () line 205c++ softcore.exe! Cmainframe::runframe () line 105c++ softcore.exe! Csoftcoreapp::run () line 172c++
Every frame is called here mfc90d.dll! Afxwinmain (hinstance__ * hinstance=0x00400000, hinstance__ * hprevinstance=0x00000000, char * lpCmdLine=0x00185289, int ncmdshow=0x00000001) rows + 0xd bytes C + + softcore.exe! WinMain (hinstance__ * hinstance=0x00400000, hinstance__ * hprevinstance=0x00000000, char * lpcmdline=0x00185289, int ncmdshow=0x00000001) line 30c++ softcore.exe!__tmaincrtstartup () row 574 + 0x35 byte c softcore.exe! WinMainCRTStartup () line 399C
Follow up: Add a dynamic demo diagram that you want to expand from a simple 3d model rendering
Those years I saw the rasterization algorithm in the Open source project