13 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
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
17 changed files with 1185 additions and 1073 deletions

View File

@@ -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
@@ -60,7 +73,7 @@ TinyObjLoader is successfully used in ...
* 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! (Letting us know via github issue is welcome!) * 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

@@ -1,3 +0,0 @@
git add *
git commit -m %1
git push origin master

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

@@ -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;

File diff suppressed because it is too large Load Diff