利用opengl 读取建筑物模型 obj文件并加载出来
本项目主要通过利用OpenGL读取obj模型,并且加载obj模型 暂时没有用到关于纹理和法向量,只是先通过顶点坐标加载模型。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-27 19:30 OPENGLOBJ
目录 0 2017-11-27 15:54 OPENGLOBJDebug
文件 112640 2017-11-27 16:06 OPENGLOBJDebugOPENGLOBJ.exe
文件 632092 2017-11-27 16:06 OPENGLOBJDebugOPENGLOBJ.ilk
文件 1092608 2017-11-27 16:06 OPENGLOBJDebugOPENGLOBJ.pdb
目录 0 2017-11-27 09:30 OPENGLOBJipch
目录 0 2017-11-27 16:30 OPENGLOBJipchopenglobj-6cb5d755
文件 33357824 2017-11-27 16:30 OPENGLOBJipchopenglobj-6cb5d755openglobj-d1e6676c.ipch
目录 0 2017-11-27 15:27 OPENGLOBJOPENGLOBJ
文件 32722944 2017-11-27 19:30 OPENGLOBJOPENGLOBJ.sdf
文件 894 2017-11-22 13:34 OPENGLOBJOPENGLOBJ.sln
文件 31744 2017-11-27 19:30 OPENGLOBJOPENGLOBJ.suo
文件 9928 2017-11-27 16:06 OPENGLOBJOPENGLOBJCamera.cpp
文件 2686 2017-11-27 15:52 OPENGLOBJOPENGLOBJCamera.h
目录 0 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebug
文件 41888 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugCamera.obj
文件 3178 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugcl.command.1.tlog
文件 52990 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugCL.read.1.tlog
文件 3906 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugCL.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink-cvtres.read.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink-cvtres.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10104-cvtres.read.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10104-cvtres.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10104.read.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10104.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10140-cvtres.read.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10140-cvtres.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10140.read.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10140.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10192-cvtres.read.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebuglink.10192-cvtres.write.1.tlog
............此处省略64个文件信息
//***********************************************************************//
// //
// - “Talk to me like I‘m a 3 year old!“ Programming Lessons - //
// //
// $Author: DigiBen DigiBen@GameTutorials.com //
// //
// $Program: Camera5 (strafing) //
// //
// $Description: Demonstrates camera strafing right and left //
// //
// $Date: 1/1/02 //
// //
//***********************************************************************//
//#include “main.h“
#include
#include
#include // Header File For The Glaux Library
//#include “vector.h“
#define SCREEN_WIDTH 800 // We want our screen width 800 pixels
#define SCREEN_HEIGHT 600 // We want our screen height 600 pixels
#define SCREEN_DEPTH 16 // We want 16 bits per pixel
#include “Camera.h“
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// This is how fast our camera moves (Sped up a bit due to normalizing our vectors)
#define kSpeed 5.5f
CCamera::CCamera()
{
CVector3 vZero = CVector3(0.0 500 200); // Init a vVector to 0 0 0 for our position
CVector3 vView = CVector3(0.0 1.0 0.5); // Init a starting view vVector (looking up and out the screen)
CVector3 vUp = CVector3(0.0 1.0 0.1); // Init a standard up vVector (Rarely ever changes)
m_vPosition = vZero; // Init the position to zero
m_vView = vView; // Init the view to a std starting view
m_vUpVector = vUp; // Init the UpVector
}
///////////////////////////////// POSITION CAMERA \\\\\\\\\\\\\\\\*
/////
///// This function sets the camera‘s position and view and up vVector.
/////
///////////////////////////////// POSITION CAMERA \\\\\\\\\\\\\\\\*
void CCamera::PositionCamera(float positionX float positionY float positionZ
float viewX float viewY float viewZ
float upVectorX float upVectorY float upVectorZ)
{
CVector3 vPosition = CVector3(positionX positionY positionZ);
CVector3 vView = CVector3(viewX viewY viewZ);
CVector3 vUpVector = CVector3(upVectorX upVectorY upVectorZ);
// The code above just makes it cleaner to set the variables.
// Otherwise we would have to set each variable x y and z.
m_vPosition = vPosition; // Assign the position
m_vView = vView; // Assign the view
m_vUpVector = vUpVector; // Assign the up vector
//
/* char buf[128];
wsprintf(buf“Position:%d %d %d LookAt:%d %d %d“int(m_vPosition.x)int(m_vPosition.y)int(m_vPosition.z)int(m_vView.x)int(m_vView.y)int(m_vView.z));
if(m_pText)
m_pText->EditItem(m_nTextID0.0f1.0f0.0fbuf);
*/
}
///////////////////////////////// SET VIEW BY MOUSE \\\\\\\\\\\\\\\\*
/////
/////
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-27 19:30 OPENGLOBJ
目录 0 2017-11-27 15:54 OPENGLOBJDebug
文件 112640 2017-11-27 16:06 OPENGLOBJDebugOPENGLOBJ.exe
文件 632092 2017-11-27 16:06 OPENGLOBJDebugOPENGLOBJ.ilk
文件 1092608 2017-11-27 16:06 OPENGLOBJDebugOPENGLOBJ.pdb
目录 0 2017-11-27 09:30 OPENGLOBJipch
目录 0 2017-11-27 16:30 OPENGLOBJipchopenglobj-6cb5d755
文件 33357824 2017-11-27 16:30 OPENGLOBJipchopenglobj-6cb5d755openglobj-d1e6676c.ipch
目录 0 2017-11-27 15:27 OPENGLOBJOPENGLOBJ
文件 32722944 2017-11-27 19:30 OPENGLOBJOPENGLOBJ.sdf
文件 894 2017-11-22 13:34 OPENGLOBJOPENGLOBJ.sln
文件 31744 2017-11-27 19:30 OPENGLOBJOPENGLOBJ.suo
文件 9928 2017-11-27 16:06 OPENGLOBJOPENGLOBJCamera.cpp
文件 2686 2017-11-27 15:52 OPENGLOBJOPENGLOBJCamera.h
目录 0 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebug
文件 41888 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugCamera.obj
文件 3178 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugcl.command.1.tlog
文件 52990 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugCL.read.1.tlog
文件 3906 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugCL.write.1.tlog
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
文件 2 2017-11-27 16:06 OPENGLOBJOPENGLOBJDebugli
............此处省略64个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)