32 Commits

Author SHA1 Message Date
Syoyo Fujita
609139f370 Fix compilation on recent clang. 2017-12-28 18:45:14 +09:00
Syoyo Fujita
cc73127bf0 Merge branch 'tigrazone' into devel 2017-12-13 18:37:37 +09:00
Syoyo Fujita
160d6be10f Format code. 2017-12-12 17:31:22 +09:00
Syoyo Fujita
583590767e Fix compilation.
Remove unused file.
2017-12-12 17:30:59 +09:00
tigrazone
dc542d6638 comment for export data and functions block with hashed keywords to other projects 2017-12-10 10:48:05 +02:00
tigrazone
c5976f931b comment for export data and functions block with hashed keywords to other projects 2017-12-10 10:47:32 +02:00
tigrazone
0511658e86 comment for export data and functions block with hashed keywords to other projects 2017-12-10 10:46:35 +02:00
tigrazone
54851f8ac7 comment for export data and functions block with hashed keywords to other projects 2017-12-10 10:46:08 +02:00
tigrazone
a6c1d07560 comment for export data and functions block with hashed keywords to other projects 2017-12-10 10:43:24 +02:00
tigrazone
4fe479453b smallish optimize 2017-12-10 09:34:10 +02:00
tigrazone
af1bcf1e11 errors fix 2017-12-10 00:43:50 +02:00
tigrazone
05f06d09d8 hashed tokens as keys of map. 5% speedup 2017-12-09 13:17:04 +02:00
tigrazone
3c0196bfb7 map vs unordered_map remake 2017-12-09 11:59:33 +02:00
tigrazone
dc4c970262 small speedups - up to 1-3% 2017-12-08 23:39:07 +02:00
tigrazone
aeb0f05c0e remove stringstream for simple string copy 2017-12-08 23:19:31 +02:00
tigrazone
c016910317 minimize token checks 2017-12-08 21:53:36 +02:00
tigrazone
5d7f6bf539 buffered file read 2017-12-08 13:21:45 +02:00
tigrazone
b818a34f1a small fixes2 2017-12-08 09:05:42 +02:00
tigrazone
baa62f4d89 small fixes 2017-12-08 08:43:33 +02:00
tigrazone
b2f07d10aa 1.1.2 : new hashed keywords 2017-12-07 08:38:44 +02:00
tigrazone
ee2c734c15 refactoring for new speedup release1 2017-12-06 22:44:04 +02:00
tigrazone
6e579f027f refactoring for new speedup release 2017-12-06 22:37:44 +02:00
Syoyo Fujita
7b6e33da52 Rename vector type.
Refactor file layout of extperimental code.
2017-11-12 16:46:25 +09:00
Richard Fabian
5896933508 Added ear clipping triangulation. Added a tiny vertex type to the library to facilitate the change. 2017-11-11 22:37:52 +00:00
Syoyo Fujita
b434c2497f Update master URL. 2017-10-16 17:48:45 +09:00
Syoyo Fujita
94fc413466 Fix parsing of crease tags(t)
Support parsing texture filename containing whitespace.
2017-10-13 18:13:36 +09:00
Syoyo Fujita
1c6dbf9bd8 Merge branch 'master' of github.com:syoyo/tinyobjloader 2017-10-13 02:04:11 +09:00
Syoyo Fujita
5cd30b70e0 Merge pull request #142 from Ododo/master
[Python] Fix mapping for #131 and compilation error #139 #132 (related)
2017-10-08 15:09:07 +09:00
Ododo
eb1f395101 Fix mapping for #131 and compilation error #139 #132 (related) 2017-10-08 04:00:14 +02:00
Syoyo Fujita
27bdd547f0 If you use tinyobjloader, please let us know via github issue!. 2017-09-25 02:36:15 +09:00
Syoyo Fujita
75a4bd1d35 Add zero-value check when parsing `f' line. Fixes #140. 2017-09-25 02:30:24 +09:00
Syoyo Fujita
7c7335c907 Add test for parsing bump_multipler for normal map. 2017-09-15 16:34:31 +09:00
23 changed files with 1594 additions and 719 deletions

View File

@@ -10,7 +10,7 @@
[![Coverage Status](https://coveralls.io/repos/github/syoyo/tinyobjloader/badge.svg?branch=master)](https://coveralls.io/github/syoyo/tinyobjloader?branch=master) [![Coverage Status](https://coveralls.io/repos/github/syoyo/tinyobjloader/badge.svg?branch=master)](https://coveralls.io/github/syoyo/tinyobjloader?branch=master)
http://syoyo.github.io/tinyobjloader/ [https://github.com/syoyo/tinyobjloader](https://github.com/syoyo/tinyobjloader)
Tiny but powerful single file wavefront obj loader written in C++. No dependency except for C++ STL. It can parse over 10M polygons with moderate memory and time. Tiny but powerful single file wavefront obj loader written in C++. No dependency except for C++ STL. It can parse over 10M polygons with moderate memory and time.
@@ -26,11 +26,20 @@ Old version is available `v0.9.x` branch https://github.com/syoyo/tinyobjloader/
## What's new ## What's new
### Version 2.x
* Refactor API
* Support triangulation for concave polygons(#151)
### Version 1.x
Avaiable in `v1.x.y` branch.
* 20 Aug, 2016 : Bump version v1.0.0. New data structure and API! * 20 Aug, 2016 : Bump version v1.0.0. New data structure and API!
### Old version ### Older version
Previous old version is avaiable in `v0.9.x` branch. Older version is avaiable in `v0.9.x` branch.
## Example ## Example
@@ -49,7 +58,11 @@ http://casual-effects.com/data/index.html
TinyObjLoader is successfully used in ... TinyObjLoader is successfully used in ...
### New version(v1.0.x) ### New version(v2.x)
* Your project here! (Letting us know via github issue is welcome!)
### Old version(v1.x)
* Double precision support through `TINYOBJLOADER_USE_DOUBLE` thanks to noma * Double precision support through `TINYOBJLOADER_USE_DOUBLE` thanks to noma
* Loading models in Vulkan Tutorial https://vulkan-tutorial.com/Loading_models * Loading models in Vulkan Tutorial https://vulkan-tutorial.com/Loading_models
@@ -58,9 +71,9 @@ TinyObjLoader is successfully used in ...
* cudabox: CUDA Solid Voxelizer Engine https://github.com/gaspardzoss/cudavox * cudabox: CUDA Solid Voxelizer Engine https://github.com/gaspardzoss/cudavox
* Drake: A planning, control, and analysis toolbox for nonlinear dynamical systems https://github.com/RobotLocomotion/drake * Drake: A planning, control, and analysis toolbox for nonlinear dynamical systems https://github.com/RobotLocomotion/drake
* VFPR - a Vulkan Forward Plus Renderer : https://github.com/WindyDarian/Vulkan-Forward-Plus-Renderer * VFPR - a Vulkan Forward Plus Renderer : https://github.com/WindyDarian/Vulkan-Forward-Plus-Renderer
* Your project here! * Your project here! (Letting us know via github issue is welcome!)
### Old version(v0.9.x) ### Older version(v0.9.x)
* bullet3 https://github.com/erwincoumans/bullet3 * bullet3 https://github.com/erwincoumans/bullet3
* pbrt-v2 https://github.com/mmp/pbrt-v2 * pbrt-v2 https://github.com/mmp/pbrt-v2
@@ -228,12 +241,12 @@ for (size_t s = 0; s < shapes.size(); s++) {
for (size_t v = 0; v < fv; v++) { for (size_t v = 0; v < fv; v++) {
// access to vertex // access to vertex
tinyobj::index_t idx = shapes[s].mesh.indices[index_offset + v]; tinyobj::index_t idx = shapes[s].mesh.indices[index_offset + v];
tinyobj::real_t vx = attrib.vertices[3*idx.vertex_index+0]; tinyobj::real_t vx = attrib.vertices[idx.vertex_index].x;
tinyobj::real_t vy = attrib.vertices[3*idx.vertex_index+1]; tinyobj::real_t vy = attrib.vertices[idx.vertex_index].y;
tinyobj::real_t vz = attrib.vertices[3*idx.vertex_index+2]; tinyobj::real_t vz = attrib.vertices[idx.vertex_index].z;
tinyobj::real_t nx = attrib.normals[3*idx.normal_index+0]; tinyobj::real_t nx = attrib.normals[idx.normal_index].x;
tinyobj::real_t ny = attrib.normals[3*idx.normal_index+1]; tinyobj::real_t ny = attrib.normals[idx.normal_index].y;
tinyobj::real_t nz = attrib.normals[3*idx.normal_index+2]; tinyobj::real_t nz = attrib.normals[idx.normal_index].z;
tinyobj::real_t tx = attrib.texcoords[2*idx.texcoord_index+0]; tinyobj::real_t tx = attrib.texcoords[2*idx.texcoord_index+0];
tinyobj::real_t ty = attrib.texcoords[2*idx.texcoord_index+1]; tinyobj::real_t ty = attrib.texcoords[2*idx.texcoord_index+1];
// Optional: vertex colors // Optional: vertex colors

View File

@@ -29,6 +29,12 @@ extern "C" {
#endif #endif
#endif #endif
#ifdef __clang__
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#endif
class timerutil { class timerutil {
public: public:
#ifdef _WIN32 #ifdef _WIN32
@@ -106,24 +112,24 @@ static void PrintInfo(const tinyobj::attrib_t& attrib,
std::cout << "# of shapes : " << shapes.size() << std::endl; std::cout << "# of shapes : " << shapes.size() << std::endl;
std::cout << "# of materials : " << materials.size() << std::endl; std::cout << "# of materials : " << materials.size() << std::endl;
for (size_t v = 0; v < attrib.vertices.size() / 3; v++) { for (size_t v = 0; v < attrib.vertices.size(); v++) {
printf(" v[%ld] = (%f, %f, %f)\n", static_cast<long>(v), printf(" v[%ld] = (%f, %f, %f)\n", static_cast<long>(v),
static_cast<const double>(attrib.vertices[3 * v + 0]), static_cast<const double>(attrib.vertices[v].x),
static_cast<const double>(attrib.vertices[3 * v + 1]), static_cast<const double>(attrib.vertices[v].y),
static_cast<const double>(attrib.vertices[3 * v + 2])); static_cast<const double>(attrib.vertices[v].z));
} }
for (size_t v = 0; v < attrib.normals.size() / 3; v++) { for (size_t v = 0; v < attrib.normals.size(); v++) {
printf(" n[%ld] = (%f, %f, %f)\n", static_cast<long>(v), printf(" n[%ld] = (%f, %f, %f)\n", static_cast<long>(v),
static_cast<const double>(attrib.normals[3 * v + 0]), static_cast<const double>(attrib.normals[v].x),
static_cast<const double>(attrib.normals[3 * v + 1]), static_cast<const double>(attrib.normals[v].y),
static_cast<const double>(attrib.normals[3 * v + 2])); static_cast<const double>(attrib.normals[v].z));
} }
for (size_t v = 0; v < attrib.texcoords.size() / 2; v++) { for (size_t v = 0; v < attrib.texcoords.size(); v++) {
printf(" uv[%ld] = (%f, %f)\n", static_cast<long>(v), printf(" uv[%ld] = (%f, %f)\n", static_cast<long>(v),
static_cast<const double>(attrib.texcoords[2 * v + 0]), static_cast<const double>(attrib.texcoords[v].x),
static_cast<const double>(attrib.texcoords[2 * v + 1])); static_cast<const double>(attrib.texcoords[v].y));
} }
// For each shape // For each shape
@@ -361,7 +367,7 @@ static bool TestStreamLoadObj() {
virtual ~MaterialStringStreamReader() {} virtual ~MaterialStringStreamReader() {}
virtual bool operator()(const std::string& matId, virtual bool operator()(const std::string& matId,
std::vector<material_t>* materials, std::vector<material_t>* materials,
std::map<std::string, int>* matMap, std::map<unsigned int, int>* matMap,
std::string* err) { std::string* err) {
(void)matId; (void)matId;
std::string warning; std::string warning;

View File

@@ -0,0 +1,2 @@
newmtl main
Kd 1 1 1

View File

@@ -0,0 +1,17 @@
mtllib issue-140-zero-face-idx.mtl
v -0.5 -0.5 0
v 0.5 -0.5 0
v 0.5 0.5 0
v -0.5 0.5 0
vt 0 0 0
vt 1 0 0
vt 1 1 0
vt 0 1 0
vn 0 0 -1
usemtl main
f 0/0/0 1/1/0 3/3/0
f 1/1/0 3/3/0 2/2/0

7
models/norm-texopt.mtl Normal file
View File

@@ -0,0 +1,7 @@
newmtl default
Ka 0 0 0
Kd 0 0 0
Ks 0 0 0
Kt 0.1 0.2 0.3
norm -bm 3 normalmap.jpg

7
models/norm-texopt.obj Normal file
View File

@@ -0,0 +1,7 @@
mtllib norm-texopt.mtl
o Test
v 1.864151 -1.219172 -5.532511
v 0.575869 -0.666304 5.896140
v 0.940448 1.000000 -1.971128
usemtl default
f 1 2 3

View File

@@ -0,0 +1,28 @@
newmtl white
Ka 0 0 0
Kd 1 1 1
Ks 0 0 0
# filename with white space.
map_Kd texture 01.png
newmtl red
Ka 0 0 0
Kd 1 0 0
Ks 0 0 0
# texture option + filename with white space.
bump -bm 2 bump 01.png
newmtl green
Ka 0 0 0
Kd 0 1 0
Ks 0 0 0
newmtl blue
Ka 0 0 0
Kd 0 0 1
Ks 0 0 0
newmtl light
Ka 20 20 20
Kd 1 1 1
Ks 0 0 0

View File

@@ -0,0 +1,31 @@
mtllib texture-filename-with-whitespace.mtl
v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
# 8 vertices
g front cube
usemtl white
f 1 2 3 4
g back cube
# expects white material
f 8 7 6 5
g right cube
usemtl red
f 4 3 7 8
g top cube
usemtl white
f 5 1 4 8
g left cube
usemtl green
f 5 6 2 1
g bottom cube
usemtl white
f 2 6 7 3
# 6 elements

View File

@@ -48,7 +48,7 @@ static PyObject* pyLoadObj(PyObject* self, PyObject* args) {
pyshapes = PyDict_New(); pyshapes = PyDict_New();
pymaterials = PyDict_New(); pymaterials = PyDict_New();
pymaterial_indices = PyDict_New(); pymaterial_indices = PyList_New(0);
rtndict = PyDict_New(); rtndict = PyDict_New();
attribobj = PyDict_New(); attribobj = PyDict_New();
@@ -124,53 +124,52 @@ static PyObject* pyLoadObj(PyObject* self, PyObject* args) {
PyDict_SetItemString(pyshapes, (*shape).name.c_str(), meshobj); PyDict_SetItemString(pyshapes, (*shape).name.c_str(), meshobj);
} }
long material_index = 0;
for (std::vector<tinyobj::material_t>::iterator mat = materials.begin(); for (std::vector<tinyobj::material_t>::iterator mat = materials.begin();
mat != materials.end(); mat++) { mat != materials.end(); mat++) {
PyObject* matobj = PyDict_New(); PyObject* matobj = PyDict_New();
PyObject* unknown_parameter = PyDict_New(); PyObject* unknown_parameter = PyDict_New();
for (std::map<std::string, std::string>::iterator p = for (std::map<std::string, std::string>::iterator p =
(*mat).unknown_parameter.begin(); mat->unknown_parameter.begin();
p != (*mat).unknown_parameter.end(); ++p) { p != mat->unknown_parameter.end(); ++p) {
PyDict_SetItemString(unknown_parameter, p->first.c_str(), PyDict_SetItemString(unknown_parameter, p->first.c_str(),
PyUnicode_FromString(p->second.c_str())); PyUnicode_FromString(p->second.c_str()));
} }
PyDict_SetItemString(matobj, "shininess", PyDict_SetItemString(matobj, "shininess",
PyFloat_FromDouble((*mat).shininess)); PyFloat_FromDouble(mat->shininess));
PyDict_SetItemString(matobj, "ior", PyFloat_FromDouble((*mat).ior)); PyDict_SetItemString(matobj, "ior", PyFloat_FromDouble(mat->ior));
PyDict_SetItemString(matobj, "dissolve", PyDict_SetItemString(matobj, "dissolve",
PyFloat_FromDouble((*mat).dissolve)); PyFloat_FromDouble(mat->dissolve));
PyDict_SetItemString(matobj, "illum", PyLong_FromLong((*mat).illum)); PyDict_SetItemString(matobj, "illum", PyLong_FromLong(mat->illum));
PyDict_SetItemString(matobj, "ambient_texname", PyDict_SetItemString(matobj, "ambient_texname",
PyUnicode_FromString((*mat).ambient_texname.c_str())); PyUnicode_FromString(mat->ambient_texname.c_str()));
PyDict_SetItemString(matobj, "diffuse_texname", PyDict_SetItemString(matobj, "diffuse_texname",
PyUnicode_FromString((*mat).diffuse_texname.c_str())); PyUnicode_FromString(mat->diffuse_texname.c_str()));
PyDict_SetItemString(matobj, "specular_texname", PyDict_SetItemString(matobj, "specular_texname",
PyUnicode_FromString((*mat).specular_texname.c_str())); PyUnicode_FromString(mat->specular_texname.c_str()));
PyDict_SetItemString( PyDict_SetItemString(
matobj, "specular_highlight_texname", matobj, "specular_highlight_texname",
PyUnicode_FromString((*mat).specular_highlight_texname.c_str())); PyUnicode_FromString(mat->specular_highlight_texname.c_str()));
PyDict_SetItemString(matobj, "bump_texname", PyDict_SetItemString(matobj, "bump_texname",
PyUnicode_FromString((*mat).bump_texname.c_str())); PyUnicode_FromString(mat->bump_texname.c_str()));
PyDict_SetItemString( PyDict_SetItemString(
matobj, "displacement_texname", matobj, "displacement_texname",
PyUnicode_FromString((*mat).displacement_texname.c_str())); PyUnicode_FromString(mat->displacement_texname.c_str()));
PyDict_SetItemString(matobj, "alpha_texname", PyDict_SetItemString(matobj, "alpha_texname",
PyUnicode_FromString((*mat).alpha_texname.c_str())); PyUnicode_FromString(mat->alpha_texname.c_str()));
PyDict_SetItemString(matobj, "ambient", pyTupleFromfloat3((*mat).ambient)); PyDict_SetItemString(matobj, "ambient", pyTupleFromfloat3(mat->ambient));
PyDict_SetItemString(matobj, "diffuse", pyTupleFromfloat3((*mat).diffuse)); PyDict_SetItemString(matobj, "diffuse", pyTupleFromfloat3(mat->diffuse));
PyDict_SetItemString(matobj, "specular", PyDict_SetItemString(matobj, "specular",
pyTupleFromfloat3((*mat).specular)); pyTupleFromfloat3(mat->specular));
PyDict_SetItemString(matobj, "transmittance", PyDict_SetItemString(matobj, "transmittance",
pyTupleFromfloat3((*mat).transmittance)); pyTupleFromfloat3(mat->transmittance));
PyDict_SetItemString(matobj, "emission", PyDict_SetItemString(matobj, "emission",
pyTupleFromfloat3((*mat).emission)); pyTupleFromfloat3(mat->emission));
PyDict_SetItemString(matobj, "unknown_parameter", unknown_parameter); PyDict_SetItemString(matobj, "unknown_parameter", unknown_parameter);
PyDict_SetItemString(pymaterials, (*mat).name.c_str(), matobj); PyDict_SetItemString(pymaterials, mat->name.c_str(), matobj);
PyDict_SetItemString(pymaterial_indices, PyLong_FromLong(material_index++), (*mat).name.c_str()); PyList_Append(pymaterial_indices, PyUnicode_FromString(mat->name.c_str()));
} }
PyDict_SetItemString(rtndict, "shapes", pyshapes); PyDict_SetItemString(rtndict, "shapes", pyshapes);

View File

@@ -22,22 +22,22 @@ static void PrintInfo(const tinyobj::attrib_t &attrib, const std::vector<tinyobj
for (size_t v = 0; v < attrib.vertices.size() / 3; v++) { for (size_t v = 0; v < attrib.vertices.size() / 3; v++) {
printf(" v[%ld] = (%f, %f, %f)\n", v, printf(" v[%ld] = (%f, %f, %f)\n", v,
static_cast<const double>(attrib.vertices[3*v+0]), static_cast<const double>(attrib.vertices[v].x),
static_cast<const double>(attrib.vertices[3*v+1]), static_cast<const double>(attrib.vertices[v].y),
static_cast<const double>(attrib.vertices[3*v+2])); static_cast<const double>(attrib.vertices[v].z));
} }
for (size_t v = 0; v < attrib.normals.size() / 3; v++) { for (size_t v = 0; v < attrib.normals.size() / 3; v++) {
printf(" n[%ld] = (%f, %f, %f)\n", v, printf(" n[%ld] = (%f, %f, %f)\n", v,
static_cast<const double>(attrib.normals[3*v+0]), static_cast<const double>(attrib.normals[v].x),
static_cast<const double>(attrib.normals[3*v+1]), static_cast<const double>(attrib.normals[v].y),
static_cast<const double>(attrib.normals[3*v+2])); static_cast<const double>(attrib.normals[v].z));
} }
for (size_t v = 0; v < attrib.texcoords.size() / 2; v++) { for (size_t v = 0; v < attrib.texcoords.size() / 2; v++) {
printf(" uv[%ld] = (%f, %f)\n", v, printf(" uv[%ld] = (%f, %f)\n", v,
static_cast<const double>(attrib.texcoords[2*v+0]), static_cast<const double>(attrib.texcoords[v].x),
static_cast<const double>(attrib.texcoords[2*v+1])); static_cast<const double>(attrib.texcoords[v].y));
} }
for (size_t i = 0; i < shapes.size(); i++) { for (size_t i = 0; i < shapes.size(); i++) {
@@ -303,7 +303,8 @@ std::string matStream(
virtual bool operator() ( virtual bool operator() (
const std::string& matId, const std::string& matId,
std::vector<material_t>* materials, std::vector<material_t>* materials,
std::map<std::string, int>* matMap, //std::map<std::string, int>* matMap,
std::map<uint32_t, int>* matMap,
std::string* err) std::string* err)
{ {
(void)matId; (void)matId;
@@ -631,13 +632,14 @@ TEST_CASE("vertex-col-ext", "[Issue144]") {
std::vector<tinyobj::material_t> materials; std::vector<tinyobj::material_t> materials;
std::string err; std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/cube-vertexcol.obj", gMtlBasePath); bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/cube-vertexcol.obj", gMtlBasePath);
if (!err.empty()) { if (!err.empty()) {
std::cerr << err << std::endl; std::cerr << err << std::endl;
} }
PrintInfo(attrib, shapes, materials); //PrintInfo(attrib, shapes, materials);
REQUIRE(true == ret); REQUIRE(true == ret);
REQUIRE((8 * 3) == attrib.colors.size()); REQUIRE((8 * 3) == attrib.colors.size());
@@ -655,6 +657,64 @@ TEST_CASE("vertex-col-ext", "[Issue144]") {
REQUIRE(1 == Approx(attrib.colors[3 * 7 + 0])); REQUIRE(1 == Approx(attrib.colors[3 * 7 + 0]));
REQUIRE(1 == Approx(attrib.colors[3 * 7 + 1])); REQUIRE(1 == Approx(attrib.colors[3 * 7 + 1]));
REQUIRE(1 == Approx(attrib.colors[3 * 7 + 2])); REQUIRE(1 == Approx(attrib.colors[3 * 7 + 2]));
}
TEST_CASE("norm_texopts", "[norm]") {
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/norm-texopt.obj", gMtlBasePath);
if (!err.empty()) {
std::cerr << err << std::endl;
}
REQUIRE(true == ret);
REQUIRE(1 == shapes.size());
REQUIRE(1 == materials.size());
REQUIRE(3.0 == Approx(materials[0].normal_texopt.bump_multiplier));
}
TEST_CASE("zero-face-idx-value", "[Issue140]") {
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/issue-140-zero-face-idx.obj", gMtlBasePath);
if (!err.empty()) {
std::cerr << err << std::endl;
}
REQUIRE(false == ret);
REQUIRE(!err.empty());
}
TEST_CASE("texture-name-whitespace", "[Issue145]") {
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/texture-filename-with-whitespace.obj", gMtlBasePath);
if (!err.empty()) {
std::cerr << "[Issue145] " << err << std::endl;
}
REQUIRE(true == ret);
REQUIRE(err.empty());
REQUIRE(2 < materials.size());
REQUIRE(0 == materials[0].diffuse_texname.compare("texture 01.png"));
REQUIRE(0 == materials[1].bump_texname.compare("bump 01.png"));
REQUIRE(2 == Approx(materials[1].bump_texopt.bump_multiplier));
} }

File diff suppressed because it is too large Load Diff