资源简介
lib3ds is an overall software library for managing 3D-Studio Release 3 and 4 ".3DS" files. It is a free alternative to Autodesk's 3DS File Toolkit for managing 3DS files. It started out in 1996 to be released in 1999 under the GNU General Public License (GPL) as Open-Source software. In 2000, the li
代码片段和文件信息
/*
Copyright (C) 2008 by Jan Eric Kyprianidis
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.
Thisprogram 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 see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef _MSC_VER
#pragma warning ( disable : 4996 )
#endif
/**
@example 3ds2obj.cpp
This example shows how to convert a 3DS file to a Wavefront OBJ file.
*/
static void
help() {
fprintf(stderr
“Syntax: 3ds2obj 3ds-file [obj-file] [mtl-file]\n“
);
exit(1);
}
static const char* input = 0;
static char* obj_file = 0;
static char* mtl_file = 0;
static int max_vertices = 0;
static int max_texcos = 0;
static int max_normals = 0;
void parse_args(int argc char **argv) {
int i;
for (i = 1; i < argc; ++i) {
if (argv[i][0] == ‘-‘) {
if ((strcmp(argv[i] “-h“) == 0) || (strcmp(argv[i] “--help“) == 0)) {
help();
} else {
help();
}
} else {
if (!input) {
input = argv[i];
} else if (!obj_file) {
obj_file = argv[i];
} else if (!mtl_file) {
mtl_file = argv[i];
} else {
help();
}
}
}
if (input) {
size_t input_len = strlen(input);
if ((input_len > 4) && (strcmp(input + input_len - 4 “.3ds“) == 0)) {
if (!obj_file) {
obj_file = (char*)malloc(sizeof(char*) * (input_len + 1));
strcpy(obj_file input);
strcpy(obj_file + input_len - 4 “.obj“);
}
if (!mtl_file) {
mtl_file = (char*)malloc(sizeof(char*) * (input_len + 1));
strcpy(mtl_file input);
strcpy(mtl_file + input_len - 4 “.mtl“);
}
}
}
if (!input || !obj_file) {
help();
}
}
void write_mtl(FILE *mtl Lib3dsFile *f) {
int i j;
fprintf(mtl “# Wavefront material file\n“);
fprintf(mtl “# Converted by 3ds2obj\n“);
fprintf(mtl “# http://www.lib3ds.org\n\n“);
{
int unique = 1;
for
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2008-09-09 13:43 lib3ds-20080909\
文件 22257 2008-09-09 13:43 lib3ds-20080909\Makefile.in
目录 0 2008-09-09 13:43 lib3ds-20080909\src\
文件 20852 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_mesh.c
文件 31071 2008-09-09 13:41 lib3ds-20080909\src\lib3ds.h
文件 17986 2008-09-09 13:43 lib3ds-20080909\src\Makefile.in
文件 7459 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_atmosphere.c
文件 1760 2008-09-09 13:41 lib3ds-20080909\src\lib3ds.rc
文件 26698 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_material.c
文件 8499 2008-09-09 13:41 lib3ds-20080909\src\lib3ds.vcproj
文件 2025 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_math.c
文件 2897 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_util.c
文件 5258 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_vector.c
文件 12355 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_viewport.c
文件 9906 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_io.c
文件 696 2008-09-09 13:41 lib3ds-20080909\src\Makefile.am
文件 6359 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_quat.c
文件 2997 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_shadow.c
文件 9741 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_light.c
文件 6014 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_background.c
文件 36628 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_node.c
文件 15741 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_track.c
文件 39629 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_file.c
文件 10116 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_chunktable.c
文件 4487 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_camera.c
文件 15236 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_impl.h
文件 10972 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_matrix.c
文件 3806 2008-09-09 13:41 lib3ds-20080909\src\lib3ds_chunk.c
文件 1343 2008-09-09 13:41 lib3ds-20080909\lib3ds-config.in
文件 32724 2007-10-23 19:18 lib3ds-20080909\config.sub
文件 2821 2008-09-09 13:41 lib3ds-20080909\lib3ds.m4
............此处省略36个文件信息
- 上一篇:基于P2P技术的局域网聊天工具
- 下一篇:0-1背包问题——动态规划
评论
共有 条评论