opengl三维迷宫


图形学试验,三维迷宫
资源截图
代码片段和文件信息
/*/
//                 MD2 Viewer (c) 1999 by Mete Ciragan
//
// file:           md2.c
// last modified:  Apr 28 1999 Mete Ciragan
// copyright:      The programs and associated files contained in this
//                 distribution were developed by Mete Ciragan. The programs
//                 are not in the public domain but they are freely
//                 distributable without licensing fees. These programs are
//                 provided without guarantee or warrantee expressed or
//                 implied.
//
// version:        1.4
//
// email:          mete@swissquake.ch
// web:            http://www.swissquake.ch/chumbalum-soft/
/*/
#include “StdAfx.h“
#include 
#include 
#include  /* memset */
#include  /* sqrt */
//#include 
#include 
#include 
#include “md2.h“

#define NUMVERTEXNORMALS 162

float avertexnormals[NUMVERTEXNORMALS][3] = {
#include “anorms.h“
};

static int g_glcmds = 1; /* use glcommands */
static int g_interp = 1; /* interpolate frames */



/*
 * load model
 */
md2_model_t*
md2_readModel (const char *filename)
{
FILE *file;
md2_model_t *model;
byte buffer[MD2_MAX_frameSIZE];
int i;

model = (md2_model_t *) malloc (sizeof (md2_model_t));
if (!model)
return 0;

file = fopen (filename “rb“);
if (!file)
{
free (model);
return 0;
}

/* initialize model and read header */
memset (model 0 sizeof (md2_model_t));
fread (&model->header sizeof (md2_header_t) 1 file);
#if 0
printf (“magic: %d
“ model->header.magic);
printf (“version: %d
“ model->header.version);
printf (“skinWidth: %d
“ model->header.skinWidth);
printf (“skinHeight: %d
“ model->header.skinHeight);
printf (“frameSize: %d
“ model->header.frameSize);
printf (“numSkins: %d
“ model->header.numSkins);
printf (“numVertices: %d
“ model->header.numVertices);
printf (“numTexCoords: %d
“ model->header.numTexCoords);
printf (“numTriangles: %d
“ model->header.numTriangles);
printf (“numGlCommands: %d
“ model->header.numGlCommands);
printf (“numframes: %d
“ model->header.numframes);
printf (“offsetSkins: %d
“ model->header.offsetSkins);
printf (“offsetTexCoords: %d
“ model->header.offsetTexCoords);
printf (“offsetTriangles: %d
“ model->header.offsetTriangles);
printf (“offsetframes: %d
“ model->header.offsetframes);
printf (“offsetGlCommands: %d
“ model->header.offsetGlCommands);
printf (“offsetEnd: %d
“ model->header.offsetEnd);
#endif
if (model->header.magic != (int) ((‘2‘ << 24) + (‘P‘ << 16) + (‘D‘ << 8) + ‘I‘))
{
fclose (file);
free (model);
return 0;
}

/* read skins */
fseek (file model->header.offsetSkins SEEK_SET);
if (model->header.numSkins > 0)
{
model->skins = (md2_skin_t *) malloc (sizeof (md2_skin_t) * model->header.numSkins);
if (!model->skins)
{
md2_freeM

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-06-02 20:26  实验2+陈彩娟+201300130003
     目录           0  2016-06-02 20:19  实验2+陈彩娟+201300130003代码
     目录           0  2016-06-02 20:19  实验2+陈彩娟+201300130003代码Debug
     文件       61678  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugCL.read.1.tlog
     文件        3136  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugCL.write.1.tlog
     文件      169472  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.exe
     文件         406  2012-12-12 20:42  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.exe.embed.manifest
     文件         472  2012-12-12 20:42  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.exe.embed.manifest.res
     文件         381  2012-12-21 15:40  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.exe.intermediate.manifest
     文件     1593764  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.ilk
     文件         115  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.lastbuildstate
     文件        3273  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.log
     文件      264099  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.obj
     文件     1179648  2016-05-03 10:18  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.pch
     文件     1436672  2016-05-12 09:58  实验2+陈彩娟+201300130003代码DebugOpenGLexp3.pdb
     文件         210  2012-12-12 20:42  实验2+陈彩娟+201300130003代码DebugOpenGLexp3_manifest.rc
     文件        7406  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debugcl.command.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink-cvtres.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink-cvtres.write.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10016-cvtres.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10016-cvtres.write.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10016.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10016.write.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10048-cvtres.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10048-cvtres.write.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10048.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10048.write.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10064-cvtres.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10064-cvtres.write.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10064.read.1.tlog
     文件           2  2016-05-12 09:58  实验2+陈彩娟+201300130003代码Debuglink.10064.write.1.tlog
............此处省略207个文件信息

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

发表评论

评论列表(条)