资源简介
用MFC做的3D动画小车,两辆小跑车3D外形,白色纹理,可在3D的蓝色小山坡上运动。一辆用小键盘上下左右键控制,一辆用大键盘W,D键控制。十分适合做图形学和动画的学习资料和作业,绝对物超所值。
代码片段和文件信息
//***********************************************************************//
// //
// - “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 “stdafx.h“
#include
#include
#include
#include
#include
#include
#include // Header File For The OpenGL32 Library
#include // Header File For The GLu32 Library
#include
#include
using namespace std;
#include “3ds.h“
#include
#include
#include
#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 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*
void CreateTexture(UINT textureArray[] LPSTR strFileName int textureID)
{
AUX_RGBImageRec *pBitmap = NULL;
if(!strFileName) // Return from the function if no file name was passed in
return;
pBitmap = auxDIBImageLoad(strFileName); // Load the bitmap and store the data
if(pBitmap == NULL) // If we can‘t load the file quit!
exit(0);
// Generate a texture with the associative texture ID stored in the array
glGenTextures(1 &textureArray[textureID]);
// This sets the alignment requirements for the start of each pixel row in memory.
glPixelStorei (GL_UNPACK_ALIGNMENT 1);
// Bind the texture to the texture arrays index and init the texture
glBindTexture(GL_TEXTURE_2D textureArray[textureID]);
// Build Mipmaps (builds different versions of the picture for distances - looks better)
gluBuild2DMipmaps(GL_TEXTURE_2D 3 pBitmap->sizeX pBitmap->sizeY GL_RGB GL_UNSIGNED_BYTE pBitmap->data);
// Lastly we need to tell OpenGL the quality of our texture map. GL_LINEAR_MIPMAP_LINEAR
// is the smoothest. GL_LINEAR_MIPMAP_NEAREST is faster than GL_LINEAR_MIPMAP_LINEAR
// but looks blochy and pixilated. Good for s
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-03-20 16:34 3D小车\
文件 42443 2004-07-31 01:24 3D小车\3ds.cpp
文件 6803 2004-07-23 11:22 3D小车\3ds.h
文件 26180 2004-09-27 20:53 3D小车\AICar.aps
文件 1831 2004-10-11 21:40 3D小车\AICar.clw
文件 4098 2004-09-27 21:02 3D小车\AICar.cpp
文件 4642 2004-09-28 00:45 3D小车\AICar.dsp
文件 533 2004-09-27 20:50 3D小车\AICar.dsw
文件 1345 2004-09-27 20:50 3D小车\AICar.h
文件 99328 2013-03-20 16:34 3D小车\AICar.ncb
文件 53760 2013-03-20 16:34 3D小车\AICar.opt
文件 244 2013-03-20 16:33 3D小车\AICar.plg
文件 9144 2004-09-27 20:50 3D小车\AICar.rc
文件 1722 2004-09-27 20:50 3D小车\AICarDoc.cpp
文件 1464 2004-09-27 20:50 3D小车\AICarDoc.h
文件 16078 2004-10-13 18:49 3D小车\AICarView.cpp
文件 3007 2004-10-11 20:05 3D小车\AICarView.h
文件 455541 2004-09-28 00:23 3D小车\car.3DS
目录 0 2004-09-27 21:05 3D小车\data\
文件 786486 2004-09-27 23:17 3D小车\data\map.bmp
目录 0 2013-03-20 16:32 3D小车\Debug\
文件 70658 2013-03-20 16:32 3D小车\Debug\3ds.obj
文件 200752 2013-03-20 16:32 3D小车\Debug\AICar.exe
文件 559944 2013-03-20 16:32 3D小车\Debug\AICar.ilk
文件 23062 2013-03-20 16:32 3D小车\Debug\AICar.obj
文件 5511180 2013-03-20 16:32 3D小车\Debug\AICar.pch
文件 549888 2013-03-20 16:32 3D小车\Debug\AICar.pdb
文件 5756 2013-03-20 16:32 3D小车\Debug\AICar.res
文件 14440 2013-03-20 16:32 3D小车\Debug\AICarDoc.obj
文件 82843 2013-03-20 16:32 3D小车\Debug\AICarView.obj
文件 18372 2013-03-20 16:32 3D小车\Debug\MainFrm.obj
............此处省略14个文件信息
- 上一篇:C++MFC实训_计算器_附实训报告
- 下一篇:五个小程序 VC++的源代码
评论
共有 条评论