导入3dmax模型的VC++程序


导入3dmax模型的VC++程序,适用于初学者实用查看
资源截图
代码片段和文件信息
//***********************************************************************//
//  //
// - “Talk to me like I‘m a 3 year old!“ Programming Lessons -  //
//                                                                       //
// $Author: DigiBen digiben@gametutorials.com  //
//  //
// $Program: 3DS Loader  //
//  //
// $Description: Demonstrates how to load a .3ds file format  //
//  //
// $Date: 10/6/01  //
//  //
//***********************************************************************//

#include “main.h“
#include “3ds.h“
#include 

// Global
int gBuffer[50000] = {0}; // This is used to read past unwanted data

// This file handles all of the code needed to load a .3DS file.
// Basically how it works is you load a chunk then you check
// the chunk ID.  Depending on the chunk ID you load the information
// that is stored in that chunk.  If you do not want to read that information
// you read past it.  You know how many bytes to read past the chunk because
// every chunk stores the length in bytes of that chunk.

///////////////////////////////// CLOAD3DS \\\\\\\\\\\\\\\\*
/////
///// This constructor initializes the tChunk data
/////
///////////////////////////////// CLOAD3DS \\\\\\\\\\\\\\\\*

CLoad3DS::CLoad3DS()
{
m_FilePointer = NULL;
}

///////////////////////////////// IMPORT 3DS \\\\\\\\\\\\\\\\*
/////
///// This is called by the client to open the .3ds file read it then clean up
/////
///////////////////////////////// IMPORT 3DS \\\\\\\\\\\\\\\\*

bool CLoad3DS::Import3DS(t3DModel *pModel char *strFileName)
{
char strMessage[255] = {0};
tChunk currentChunk = {0};

// Open the 3DS file
m_FilePointer = fopen(strFileName “rb“);

// Make sure we have a valid file pointer (we found the file)
if(!m_FilePointer) 
{
sprintf(strMessage “Unable to find the file: %s!“ strFileName);
MessageBox(NULL strMessage “Error“ MB_OK);
return false;
}

// Once we have the file open we need to read the very first data chunk
// to see if it‘s a 3DS file.  That way we don‘t read an invalid file.
// If it is a 3DS file then the first chunk ID will be equal to PRIMARY (some hex num)

// Read the first chuck of the file to see if it‘s a 3DS file
ReadChunk(¤tChunk);

// Make sure this is a 3DS file
if (currentChunk.ID != PRIMARY)
{
sprintf(strMessage “Unable to load PRIMARY chuck from file: %s!“ strFileName);
MessageBox(NULL strMessage “Error“ MB_OK);
return false;
}

// Now we actually start reading in the data.  ProcessNextChunk() is recursive

// Begin loading objects by calling this recursive function
ProcessNextChunk(pModel ¤tChunk);

// After we have read the whole 3DS file we want to calculate our own vertex normals.

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      79176  2001-09-10 09:43  导入3ds模型的程序3ds Format.rtf

     文件       5033  2006-03-27 19:57  导入3ds模型的程序3DS Loader.dsp

     文件        543  2006-03-27 19:57  导入3ds模型的程序3DS Loader.dsw

     文件      73728  2004-10-18 10:41  导入3ds模型的程序3DS Loader.exe

     文件        909  2004-10-18 10:18  导入3ds模型的程序3DS Loader.sln

     文件       4469  2004-10-18 10:18  导入3ds模型的程序3DS Loader.vcproj

     文件      37032  2004-10-18 10:40  导入3ds模型的程序3ds.cpp

     文件       3804  2003-07-03 23:55  导入3ds模型的程序3ds.h

     文件      78873  2001-09-24 21:38  导入3ds模型的程序face.3DS

     文件     921656  2001-09-10 08:59  导入3ds模型的程序face.bmp

     文件      12987  2004-10-18 10:21  导入3ds模型的程序Init.cpp

     文件      24065  2004-10-18 10:41  导入3ds模型的程序Main.cpp

     文件       7316  2002-01-08 14:53  导入3ds模型的程序main.h

     文件       2337  2004-10-18 10:43  导入3ds模型的程序ReadMe - 3DS Loader.txt

     文件      41984  2007-08-15 16:33  导入3ds模型的程序3DS Loader.ncb

     文件     159744  2007-08-15 16:33  导入3ds模型的程序Debugvc60.pdb

     文件      50176  2007-08-15 16:33  导入3ds模型的程序Debugvc60.idb

     文件      66483  2007-08-15 16:33  导入3ds模型的程序Debug3ds.obj

     文件      29137  2007-08-15 16:33  导入3ds模型的程序DebugInit.obj

     文件    6014028  2007-08-15 16:33  导入3ds模型的程序Debug3DS Loader.pch

     文件      43981  2007-08-15 16:33  导入3ds模型的程序DebugMain.obj

     文件     394432  2007-08-15 16:33  导入3ds模型的程序Debug3DS Loader.ilk

     文件     254019  2007-08-15 16:33  导入3ds模型的程序Debug3DS Loader.exe

     文件     574464  2007-08-15 16:33  导入3ds模型的程序Debug3DS Loader.pdb

     文件       1312  2007-08-15 16:33  导入3ds模型的程序3DS Loader.plg

     文件      53760  2007-08-15 16:33  导入3ds模型的程序3DS Loader.opt

     目录          0  2007-08-15 16:33  导入3ds模型的程序Debug

     目录          0  2007-08-15 16:28  导入3ds模型的程序

----------- ---------  ---------- -----  ----

              8935666                    29

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

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

发表评论

评论列表(条)