资源简介
LIB3DS例子,OpenGL显示3DS文件,编译example时,只要把example/glstub.h.in中的 #include
改成你的glut.h所在目录
代码片段和文件信息
/*
* The 3D Studio File Format Library
* Copyright (C) 1996-2001 by J.E. Hoffmann
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not write to the Free Software Foundation
* Inc. 675 Mass Ave Cambridge MA 02139 USA.
*
* $Id: 3ds2rib.cv 1.3 2001/07/07 19:05:30 jeh Exp $
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef WITH_DMALLOC
#include
#endif
#include
/*!
\example 3ds2rib.c
Simple 3DS to RIB (RenderMan Interface Bytestream) converter.
\code
Syntax: 3ds2rib [options] filename [options]
Options:\n“
-h/--help This help
-o/--output Write output to instead of stdout
-c/--camera Use camera for rendering
-a/--all Render all frames
-f/--frame # Render frame #
-d/--downcuts # Render # frames of animation
\endcode
\author J.E. Hoffmann
*/
static void
help()
{
fprintf(stderr
“The 3D Studio File Format Library - 3ds2rib Version “ VERSION “\n“
“Copyright (C) 1996-2001 by J.E. Hoffmann \n“
“All rights reserved.\n“
“\n“
“Syntax: 3ds2rib [options] filename [options]\n“
“\n“
“Options:\n“
“ -h/--help This help\n“
“ -o/--output Write output to instead of stdout\n“
“ -c/--camera Use camera for rendering\n“
“ -a/--all Render all frames\n“
“ -f/--frame # Render frame #\n“
“ -d/--downcuts # Render # frames of animation\n“
“\n“
);
exit(1);
}
typedef enum _Flags {
LIB3DS2RIB_ALL =0x0001
} Flags;
static const char* filename=0;
static const char* output=0;
static Lib3dsDword flags=0;
static float frame=0.0f;
static const char* camera=0;
static int downcuts=0;
static void
parse_args(int argc char **argv)
{
int i;
for (i=1; i if (argv[i][0]==‘-‘) {
if ((strcmp(argv[i]“-h“)==0) || (strcmp(argv[i]“--help“)==0)) {
help();
}
else
if ((strcmp(argv[i]“-o“)==0) || (strcmp(argv[i]“--output“)==0)) {
++i;
if (output || (i>=argc)) {
help();
}
评论
共有 条评论