marching cubes算法


基于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_26control.txt

     文件        135  2003-01-31 12:01  mc算法Mce_26CRYSTALS_scriptS
eadme.txt

     文件       6857  2003-01-30 18:19  mc算法Mce_26CRYSTALS_scriptSslant.scp

     文件       6926  2003-01-30 18:11  mc算法Mce_26CRYSTALS_scriptSvcont.scp

     文件      13236  2003-03-21 08:57  mc算法Mce_26CRYSTALS_scriptSxcont.scp

     文件      48704  2012-09-03 11:21  mc算法Mce_26DebugBuildLog.htm

     文件      13702  2012-09-03 11:21  mc算法Mce_26DebugInterlaceStencil.obj

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugInterlaceStencil.sbr

     文件       7264  2012-09-03 11:21  mc算法Mce_26DebugLOG.obj

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugLOG.sbr

     文件      32877  2012-09-03 11:21  mc算法Mce_26DebugMainFrm.obj

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugMainFrm.sbr

     文件    7310336  2012-09-03 11:21  mc算法Mce_26DebugMCE.bsc

     文件    2446336  2012-09-03 11:21  mc算法Mce_26DebugMCE.exe

     文件        406  2012-09-03 11:21  mc算法Mce_26DebugMCE.exe.embed.manifest

     文件        472  2012-09-03 11:21  mc算法Mce_26DebugMCE.exe.embed.manifest.res

     文件        381  2012-09-03 11:21  mc算法Mce_26DebugMCE.exe.intermediate.manifest

     文件    7222004  2012-09-03 11:21  mc算法Mce_26DebugMCE.ilk

     文件      36929  2012-09-03 11:21  mc算法Mce_26DebugMCE.obj

     文件   28114944  2012-09-03 11:20  mc算法Mce_26DebugMCE.pch

     文件   13241344  2012-09-03 11:21  mc算法Mce_26DebugMCE.pdb

     文件      30968  2012-09-03 11:21  mc算法Mce_26DebugMCE.res

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugMCE.sbr

     文件     200591  2012-09-03 11:21  mc算法Mce_26DebugMCEDataEngine.obj

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugMCEDataEngine.sbr

     文件      19601  2012-09-03 11:21  mc算法Mce_26DebugMCEDoc.obj

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugMCEDoc.sbr

     文件      19072  2012-09-03 11:21  mc算法Mce_26DebugMCEGeneralSetup.obj

     文件          0  2012-09-03 11:20  mc算法Mce_26DebugMCEGeneralSetup.sbr

     文件      68553  2012-09-03 11:21  mc算法Mce_26DebugMCELevelControlPrimary.obj

............此处省略123个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)