資源簡介
基于marching cubes的三維重建方法,效果很不錯,當然還有很多需要改進的地方
代碼片段和文件信息
//?InterlaceStencil.cpp:?implementation?of?the?CInterlaceStencil?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“mce.h“
#include?“InterlaceStencil.h“
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
CInterlaceStencil::CInterlaceStencil()
{
}
CInterlaceStencil::~CInterlaceStencil()
{
}
void?CInterlaceStencil::interlace_stencil_horizontal(int?gliWindowWidth?int?gliWindowHeight)
{
GLint?gliY;
//?seting?screen-corresponding?geometry
glViewport(00gliWindowWidthgliWindowHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode?(GL_PROJECTION);
glLoadIdentity();
// gluOrtho2D(0.0gliWindowWidth-10.0gliWindowHeight-1);
//?-0.32?instead?of?1?to?avoid?rounding?errors?(especiali?on?Nvidia?chipsets)
gluOrtho2D(0.0gliWindowWidth-0.320.0gliWindowHeight-0.32);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//?clearing?and?configuring?stencil?drawing
glDrawBuffer(GL_BACK);
glEnable(GL_STENCIL_TEST);
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glStencilOp?(GL_REPLACE?GL_REPLACE?GL_REPLACE);?//?colorbuffer?is?copied?to?stencil
glDisable(GL_DEPTH_TEST);
glStencilFunc(GL_ALWAYS11);?//?to?avoid?interaction?with?stencil?content
???????
//?drawing?stencil?pattern
glColor4f(1110); //?alfa?is?0?not?to?interfere?with?alpha?tests
for?(gliY=0;?gliY {
glLineWidth(1);
glBegin(GL_LINES);
glVertex2i(0gliY);
glVertex2i(gliWindowWidthgliY);
glEnd();
}
glStencilOp?(GL_KEEP?GL_KEEP?GL_KEEP);?//?disabling?changes?in?stencil?buffer
glFlush();
}
void?CInterlaceStencil::interlace_stencil_vertical(int?gliWindowWidth?int?gliWindowHeight)
{
GLint?gliX;
//?seting?screen-corresponding?geometry
glViewport(00gliWindowWidthgliWindowHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode?(GL_PROJECTION);
glLoadIdentity();
// gluOrtho2D(0.0gliWindowWidth-10.0gliWindowHeight-1);
//?-0.32?instead?of?1?to?avoid?rounding?errors?(especiali?on?Nvidia?chipsets)
gluOrtho2D(0.0gliWindowWidth-0.320.0gliWindowHeight-0.32);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//?clearing?and?configuring?stencil?drawing
glDrawBuffer(GL_BACK);
glEnable(GL_STENCIL_TEST);
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glStencilOp?(GL_REPLACE?GL_REPLACE?GL_REPLACE);?//?colorbuffer?is?copied?to?stencil
glDisable(GL_DEPTH_TEST);
glStencilFunc(GL_ALWAYS11);?//?to?avoid?interaction?with?stencil?content
???????
//?drawing?stencil?pattern
glColor4f(1110); //?alfa?is?0?not?to?interfere?with?alpha?tests
for?(gliX=0;?gliX {
glLineWidth(1);
glBegin(GL_LINE
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????215??2003-02-16?20:43??mc算法\Mce_26\control.txt
?????文件????????135??2003-01-31?12:01??mc算法\Mce_26\CRYSTALS_sc
?????文件???????6857??2003-01-30?18:19??mc算法\Mce_26\CRYSTALS_sc
?????文件???????6926??2003-01-30?18:11??mc算法\Mce_26\CRYSTALS_sc
?????文件??????13236??2003-03-21?08:57??mc算法\Mce_26\CRYSTALS_sc
?????文件??????48704??2012-09-03?11:21??mc算法\Mce_26\Debug\BuildLog.htm
?????文件??????13702??2012-09-03?11:21??mc算法\Mce_26\Debug\InterlaceStencil.obj
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\InterlaceStencil.sbr
?????文件???????7264??2012-09-03?11:21??mc算法\Mce_26\Debug\LOG.obj
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\LOG.sbr
?????文件??????32877??2012-09-03?11:21??mc算法\Mce_26\Debug\MainFrm.obj
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\MainFrm.sbr
?????文件????7310336??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.bsc
?????文件????2446336??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.exe
?????文件????????406??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.exe.em
?????文件????????472??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.exe.em
?????文件????????381??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.exe.intermediate.manifest
?????文件????7222004??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.ilk
?????文件??????36929??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.obj
?????文件???28114944??2012-09-03?11:20??mc算法\Mce_26\Debug\MCE.pch
?????文件???13241344??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.pdb
?????文件??????30968??2012-09-03?11:21??mc算法\Mce_26\Debug\MCE.res
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\MCE.sbr
?????文件?????200591??2012-09-03?11:21??mc算法\Mce_26\Debug\MCEDataEngine.obj
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\MCEDataEngine.sbr
?????文件??????19601??2012-09-03?11:21??mc算法\Mce_26\Debug\MCEDoc.obj
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\MCEDoc.sbr
?????文件??????19072??2012-09-03?11:21??mc算法\Mce_26\Debug\MCEGeneralSetup.obj
?????文件??????????0??2012-09-03?11:20??mc算法\Mce_26\Debug\MCEGeneralSetup.sbr
?????文件??????68553??2012-09-03?11:21??mc算法\Mce_26\Debug\MCELevelControlPrimary.obj
............此處省略123個文件信息
評論
共有 條評論