斯坦福兔子和其他图形学模型数据下载

常见模型的下载地址:http://www.cc.gatech.edu/projects/large_models/

斯坦福兔子的下载地址:http://www.cc.gatech.edu/projects/large_models/bunny.html

斯坦福兔子的官方主页:http://www.cc.gatech.edu/~turk/bunny/bunny.html

                                    http://graphics.stanford.edu/data/3Dscanrep/


其他的一些模型:http://www.cc.gatech.edu/~turk/zipper/zipper.html

  • 16
    点赞
  • 61
    收藏
    觉得还不错? 一键收藏
  • 18
    评论
要绘制斯坦福兔子模型,首先需要加载模型文件。可以使用Assimp库来加载模型文件。接下来,需要使用OpenGL来渲染模型。 下面是一个简单的OpenGL C代码片段,可以绘制斯坦福兔子模型: ```c #include <GL/gl.h> #include <GL/glut.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <assimp/cimport.h> #include <assimp/scene.h> #include <assimp/postprocess.h> void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // 绘制斯坦福兔子模型 glPushMatrix(); glColor3f(1.0, 1.0, 1.0); glScalef(0.02, 0.02, 0.02); glTranslatef(-20.0, -10.0, 0.0); glRotatef(-90.0, 1.0, 0.0, 0.0); aiVector3D zero(0.0f, 0.0f, 0.0f); const aiScene* scene = aiImportFile("bunny.obj", aiProcessPreset_TargetRealtime_MaxQuality); aiMesh* mesh = scene->mMeshes[0]; glBegin(GL_TRIANGLES); for (GLuint i = 0; i < mesh->mNumFaces; i++) { const aiFace& face = mesh->mFaces[i]; for (GLuint j = 0; j < 3; j++) { aiVector3D pos = mesh->mVertices[face.mIndices[j]]; glVertex3f(pos.x, pos.y, pos.z); } } glEnd(); aiReleaseImport(scene); glPopMatrix(); glutSwapBuffers(); } void init() { glClearColor(0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(640, 480); glutCreateWindow("Stanford Bunny"); init(); glutDisplayFunc(display); glutMainLoop(); return 0; } ``` 其中,bunny.obj是斯坦福兔子模型模型文件,需要放在代码所在目录或指定路径下。在display函数中,通过Assimp库加载模型文件,并使用OpenGL绘制模型。需要注意的是,需要设置适当的缩放、平移和旋转来调整模型的位置和大小。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 18
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值