code source:salvia
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);
else
scanLine_ColTex(screenbuf ,zbuf+ix0,ix0,ix1,col,attribute,material);
attribute.interpolateVerticalCol();
}
}
三角形,如下情形,y值变小,然后xright-xleft的差距越来越大
*
**
***
****
softcore.exe!CRasterizer::scanLine_ColTex<unsigned int> //基础的函数,但是还只是发现位置而已 softcore.exe!CRasterizer::rastTri_constColTex<unsigned int> //这里的画三角函数,使用模板, softcore.exe!CRasterizer::drawTriangle_colTex(std::vector<CRasterizer::t_rast_triangle,std::allocator<CRasterizer::t_rast_triangl softcore.exe!CRasterizer::flush() 行386 C++
//刷出buffer内容 softcore.exe!CSoftrender::rasterizer() 行721 C++
//最后光栅化处理 ,包含纹理 softcore.exe!CSoftrender::renderFrame() 行505 C++ softcore.exe!CChildView::RunFrame() 行205 C++ softcore.exe!CMainFrame::RunFrame() 行105 C++ softcore.exe!CsoftcoreApp::Run() 行172 C++
//每一帧都在这里调用 mfc90d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00185289, int nCmdShow=0x00000001) 行47 + 0xd 字节 C++ softcore.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00185289, int nCmdShow=0x00000001) 行30 C++ softcore.exe!__tmainCRTStartup() 行574 + 0x35 字节 C softcore.exe!WinMainCRTStartup() 行399 C
原文地址:http://blog.csdn.net/titer1/article/details/40867301