diff --git a/images/bullet.png b/images/bullet.png index 22ea543..0614eb6 100644 Binary files a/images/bullet.png and b/images/bullet.png differ diff --git a/index.html b/index.html index 5145f68..7b01a04 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Tiny obj loader by syoyo - +
+

Tiny obj loader

Tiny but powerful single file wavefront obj loader


Project maintained by syoyo - Hosted on GitHub Pages — Theme by mattgraham + Hosted on GitHub Pages — Theme by mattgraham
+

+tinyobjloader

-

Tiny but poweful single file wavefront obj loader written in C++. No dependencies except for C++ STL. It can parse over 10M polygons with moderate memory and time.

+

Join the chat at https://gitter.im/syoyo/tinyobjloader

-

A great .obj loader for embedding into your (global illumination) renderer ;-)

- -

http://syoyo.github.io/tinyobjloader/

+

Build Status

-

Features

+

wercker status

- - -

Example

+

Build status

-

tinyobjloader can successfully load the Rungholt scene with 6M triangles.
+

Coverage Status

- Source: http://graphics.cs.williams.edu/data/meshes.xml

- -

Rungholt

+

http://syoyo.github.io/tinyobjloader/

-

Usage

+

Tiny but powerful single file wavefront obj loader written in C++. No dependency except for C++ STL. It can parse 10M over polygons with moderate memory and time.

-

First, load your mesh from file, storing the shapes and materials separately.

+

tinyobjloader is good for embedding .obj loader to your (global illumination) renderer ;-)

+ +

+Notice!

+ +

master branch will be replaced with develop branch in the near future: https://github.com/syoyo/tinyobjloader/tree/develop +develop branch has more better support and clean API interface for loading .obj and also it has optimized multi-threaded parser(probably 10x faster than master). If you are new to use TinyObjLoader, I highly recommend to use develop branch.

+ +

+What's new

+ + + +

+Example

+ +

Rungholt

+ +

tinyobjloader can successfully load 6M triangles Rungholt scene. +http://graphics.cs.williams.edu/data/meshes.xml

+ +

+Use case

+ +

TinyObjLoader is successfully used in ...

+ + + +

+Features

+ + + +

+TODO

+ + + +

+License

+ +

Licensed under 2 clause BSD.

+ +

+Usage

+ +

TinyObjLoader triangulate input .obj by default.

+ +
#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc
+#include "tiny_obj_loader.h"
+
+std::string inputfile = "cornell_box.obj";
+std::vector<tinyobj::shape_t> shapes;
+std::vector<tinyobj::material_t> materials;
 
-
std::string inputfile = "cornell_box.obj";
-std::vector<tinyobj::shape_t> shapes;
-std::vector<tinyobj::material_t> materials;
 std::string err;
+bool ret = tinyobj::LoadObj(shapes, materials, err, inputfile.c_str());
 
-if(!tinyobj::LoadObj(shapes, materials, err, inputfile.c_str()))
-	std::cerr << err << std::endl;
+if (!err.empty()) { // `err` may contain warning message.
+  std::cerr << err << std::endl;
 }
 
-std::cout << "# of shapes    : " << shapes.size() << std::endl;
-std::cout << "# of materials : " << materials.size() << std::endl;
-
+if (!ret) { + exit(1); +} -

Now that you have loaded the shape and material data from file, you can iterate through each vector to get the information that you need.

-

Each shape will contain vertex indices, positions, normals, UV coordinates and per-face material IDs.

+std::cout << "# of shapes : " << shapes.size() << std::endl; +std::cout << "# of materials : " << materials.size() << std::endl; -
for (size_t i = 0; i < shapes.size(); i++) {
-  printf("shape[%ld].name = %s\n", i, shapes[i].name.c_str());
-  printf("Size of shape[%ld].indices: %ld\n", i, shapes[i].mesh.indices.size());
-  printf("Size of shape[%ld].material_ids: %ld\n", i, shapes[i].mesh.material_ids.size());
-  assert((shapes[i].mesh.indices.size() % 3) == 0);
-  for (size_t f = 0; f < shapes[i].mesh.indices.size() / 3; f++) {
-    printf("  idx[%ld] = %d, %d, %d. mat_id = %d\n", f, shapes[i].mesh.indices[3*f+0], shapes[i].mesh.indices[3*f+1], shapes[i].mesh.indices[3*f+2], shapes[i].mesh.material_ids[f]);
+for (size_t i = 0; i < shapes.size(); i++) {
+  printf("shape[%ld].name = %s\n", i, shapes[i].name.c_str());
+  printf("Size of shape[%ld].indices: %ld\n", i, shapes[i].mesh.indices.size());
+  printf("Size of shape[%ld].material_ids: %ld\n", i, shapes[i].mesh.material_ids.size());
+  assert((shapes[i].mesh.indices.size() % 3) == 0);
+  for (size_t f = 0; f < shapes[i].mesh.indices.size() / 3; f++) {
+    printf("  idx[%ld] = %d, %d, %d. mat_id = %d\n", f, shapes[i].mesh.indices[3*f+0], shapes[i].mesh.indices[3*f+1], shapes[i].mesh.indices[3*f+2], shapes[i].mesh.material_ids[f]);
   }
 
-  printf("shape[%ld].vertices: %ld\n", i, shapes[i].mesh.positions.size());
-  assert((shapes[i].mesh.positions.size() % 3) == 0);
-  for (size_t v = 0; v < shapes[i].mesh.positions.size() / 3; v++) {
-    printf("  v[%ld] = (%f, %f, %f)\n", v,
-      shapes[i].mesh.positions[3*v+0],
-      shapes[i].mesh.positions[3*v+1],
-      shapes[i].mesh.positions[3*v+2]);
+  printf("shape[%ld].vertices: %ld\n", i, shapes[i].mesh.positions.size());
+  assert((shapes[i].mesh.positions.size() % 3) == 0);
+  for (size_t v = 0; v < shapes[i].mesh.positions.size() / 3; v++) {
+    printf("  v[%ld] = (%f, %f, %f)\n", v,
+      shapes[i].mesh.positions[3*v+0],
+      shapes[i].mesh.positions[3*v+1],
+      shapes[i].mesh.positions[3*v+2]);
   }
-}
+} -

The per-face material IDs can be used to reference the materials in the materials vector.

- -
for (size_t i = 0; i < materials.size(); i++) {
-  printf("material[%ld].name = %s\n", i, materials[i].name.c_str());
-  printf("  material.Ka = (%f, %f ,%f)\n", materials[i].ambient[0], materials[i].ambient[1], materials[i].ambient[2]);
-  printf("  material.Kd = (%f, %f ,%f)\n", materials[i].diffuse[0], materials[i].diffuse[1], materials[i].diffuse[2]);
-  printf("  material.Ks = (%f, %f ,%f)\n", materials[i].specular[0], materials[i].specular[1], materials[i].specular[2]);
-  printf("  material.Tr = (%f, %f ,%f)\n", materials[i].transmittance[0], materials[i].transmittance[1], materials[i].transmittance[2]);
-  printf("  material.Ke = (%f, %f ,%f)\n", materials[i].emission[0], materials[i].emission[1], materials[i].emission[2]);
-  printf("  material.Ns = %f\n", materials[i].shininess);
-  printf("  material.Ni = %f\n", materials[i].ior);
-  printf("  material.dissolve = %f\n", materials[i].dissolve);
-  printf("  material.illum = %d\n", materials[i].illum);
-  printf("  material.map_Ka = %s\n", materials[i].ambient_texname.c_str());
-  printf("  material.map_Kd = %s\n", materials[i].diffuse_texname.c_str());
-  printf("  material.map_Ks = %s\n", materials[i].specular_texname.c_str());
-  printf("  material.map_Ns = %s\n", materials[i].normal_texname.c_str());
-  std::map::const_iterator it(materials[i].unknown_parameter.begin());
-  std::map::const_iterator itEnd(materials[i].unknown_parameter.end());
-  for (; it != itEnd; it++) {
-    printf("  material.%s = %s\n", it->first.c_str(), it->second.c_str());
+for (size_t i = 0; i < materials.size(); i++) {
+  printf("material[%ld].name = %s\n", i, materials[i].name.c_str());
+  printf("  material.Ka = (%f, %f ,%f)\n", materials[i].ambient[0], materials[i].ambient[1], materials[i].ambient[2]);
+  printf("  material.Kd = (%f, %f ,%f)\n", materials[i].diffuse[0], materials[i].diffuse[1], materials[i].diffuse[2]);
+  printf("  material.Ks = (%f, %f ,%f)\n", materials[i].specular[0], materials[i].specular[1], materials[i].specular[2]);
+  printf("  material.Tr = (%f, %f ,%f)\n", materials[i].transmittance[0], materials[i].transmittance[1], materials[i].transmittance[2]);
+  printf("  material.Ke = (%f, %f ,%f)\n", materials[i].emission[0], materials[i].emission[1], materials[i].emission[2]);
+  printf("  material.Ns = %f\n", materials[i].shininess);
+  printf("  material.Ni = %f\n", materials[i].ior);
+  printf("  material.dissolve = %f\n", materials[i].dissolve);
+  printf("  material.illum = %d\n", materials[i].illum);
+  printf("  material.map_Ka = %s\n", materials[i].ambient_texname.c_str());
+  printf("  material.map_Kd = %s\n", materials[i].diffuse_texname.c_str());
+  printf("  material.map_Ks = %s\n", materials[i].specular_texname.c_str());
+  printf("  material.map_Ns = %s\n", materials[i].specular_highlight_texname.c_str());
+  std::map<std::string, std::string>::const_iterator it(materials[i].unknown_parameter.begin());
+  std::map<std::string, std::string>::const_iterator itEnd(materials[i].unknown_parameter.end());
+  for (; it != itEnd; it++) {
+    printf("  material.%s = %s\n", it->first.c_str(), it->second.c_str());
   }
-  printf("\n");
-}
+ printf("\n"); +}
-

Notes

+

Reading .obj without triangulation. Use num_vertices[i] to iterate over faces(indices). num_vertices[i] stores the number of vertices for ith face.

- - -
-

Licensed under 2 clause BSD.

-
+
#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc
+#include "tiny_obj_loader.h"
+
+std::string inputfile = "cornell_box.obj";
+std::vector<tinyobj::shape_t> shapes;
+std::vector<tinyobj::material_t> materials;
+
+std::string err;
+int flags = 1; // see load_flags_t enum for more information.
+bool ret = tinyobj::LoadObj(shapes, materials, err, inputfile.c_str(), flags);
+
+if (!err.empty()) { // `err` may contain warning message.
+  std::cerr << err << std::endl;
+}
+
+if (!ret) {
+  exit(1);
+}
+
+for (size_t i = 0; i < shapes.size(); i++) {
+
+  size_t indexOffset = 0;
+  for (size_t n = 0; n < shapes[i].mesh.num_vertices.size(); n++) {
+    int ngon = shapes[i].mesh.num_vertices[n];
+    for (size_t f = 0; f < ngon; f++) {
+      unsigned int v = shapes[i].mesh.indices[indexOffset + f];
+      printf("  face[%ld] v[%ld] = (%f, %f, %f)\n", n,
+        shapes[i].mesh.positions[3*v+0],
+        shapes[i].mesh.positions[3*v+1],
+        shapes[i].mesh.positions[3*v+2]);
+
+    }
+    indexOffset += ngon;
+  }
+
+}
+
- diff --git a/params.json b/params.json index bac3380..76b9ecf 100644 --- a/params.json +++ b/params.json @@ -1 +1,7 @@ -{"name":"Tiny obj loader","tagline":"Tiny but powerful single file wavefront obj loader","body":"tinyobjloader\r\n=============\r\n\r\nhttp://syoyo.github.io/tinyobjloader/\r\n\r\nTiny but poweful single file wavefront obj loader written in C++. No dependency except for C++ STL. It can parse 10M over polygons with moderate memory and time.\r\n\r\nGood for embedding .obj loader to your (global illumination) renderer ;-)\r\n\r\n\r\nExample\r\n-------\r\n\r\n![Rungholt](https://github.com/syoyo/tinyobjloader/blob/master/images/rungholt.jpg?raw=true)\r\n\r\ntinyobjloader can successfully load 6M triangles Rungholt scene.\r\nhttp://graphics.cs.williams.edu/data/meshes.xml\r\n\r\nFeatures\r\n--------\r\n\r\n* Group\r\n* Vertex\r\n* Texcoord\r\n* Normal\r\n* Material\r\n * Unknown material attributes are treated as key-value.\r\n\r\nNotes\r\n-----\r\n\r\nPolygon is converted into triangle.\r\n\r\nLicense\r\n-------\r\n\r\nLicensed under 2 clause BSD.\r\n\r\nUsage\r\n-----\r\n\r\n std::string inputfile = \"cornell_box.obj\";\r\n std::vector shapes;\r\n \r\n std::string err = tinyobj::LoadObj(shapes, inputfile.c_str());\r\n \r\n if (!err.empty()) {\r\n std::cerr << err << std::endl;\r\n exit(1);\r\n }\r\n \r\n std::cout << \"# of shapes : \" << shapes.size() << std::endl;\r\n \r\n for (size_t i = 0; i < shapes.size(); i++) {\r\n printf(\"shape[%ld].name = %s\\n\", i, shapes[i].name.c_str());\r\n printf(\"shape[%ld].indices: %ld\\n\", i, shapes[i].mesh.indices.size());\r\n assert((shapes[i].mesh.indices.size() % 3) == 0);\r\n for (size_t f = 0; f < shapes[i].mesh.indices.size(); f++) {\r\n printf(\" idx[%ld] = %d\\n\", f, shapes[i].mesh.indices[f]);\r\n }\r\n \r\n printf(\"shape[%ld].vertices: %ld\\n\", i, shapes[i].mesh.positions.size());\r\n assert((shapes[i].mesh.positions.size() % 3) == 0);\r\n for (size_t v = 0; v < shapes[i].mesh.positions.size() / 3; v++) {\r\n printf(\" v[%ld] = (%f, %f, %f)\\n\", v,\r\n shapes[i].mesh.positions[3*v+0],\r\n shapes[i].mesh.positions[3*v+1],\r\n shapes[i].mesh.positions[3*v+2]);\r\n }\r\n \r\n printf(\"shape[%ld].material.name = %s\\n\", i, shapes[i].material.name.c_str());\r\n printf(\" material.Ka = (%f, %f ,%f)\\n\", shapes[i].material.ambient[0], shapes[i].material.ambient[1], shapes[i].material.ambient[2]);\r\n printf(\" material.Kd = (%f, %f ,%f)\\n\", shapes[i].material.diffuse[0], shapes[i].material.diffuse[1], shapes[i].material.diffuse[2]);\r\n printf(\" material.Ks = (%f, %f ,%f)\\n\", shapes[i].material.specular[0], shapes[i].material.specular[1], shapes[i].material.specular[2]);\r\n printf(\" material.Tr = (%f, %f ,%f)\\n\", shapes[i].material.transmittance[0], shapes[i].material.transmittance[1], shapes[i].material.transmittance[2]);\r\n printf(\" material.Ke = (%f, %f ,%f)\\n\", shapes[i].material.emission[0], shapes[i].material.emission[1], shapes[i].material.emission[2]);\r\n printf(\" material.Ns = %f\\n\", shapes[i].material.shininess);\r\n printf(\" material.map_Ka = %s\\n\", shapes[i].material.ambient_texname.c_str());\r\n printf(\" material.map_Kd = %s\\n\", shapes[i].material.diffuse_texname.c_str());\r\n printf(\" material.map_Ks = %s\\n\", shapes[i].material.specular_texname.c_str());\r\n printf(\" material.map_Ns = %s\\n\", shapes[i].material.normal_texname.c_str());\r\n std::map::iterator it(shapes[i].material.unknown_parameter.begin());\r\n std::map::iterator itEnd(shapes[i].material.unknown_parameter.end());\r\n for (; it != itEnd; it++) {\r\n printf(\" material.%s = %s\\n\", it->first.c_str(), it->second.c_str());\r\n }\r\n printf(\"\\n\");\r\n }\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file +{ + "name": "Tiny obj loader", + "tagline": "Tiny but powerful single file wavefront obj loader", + "body": "tinyobjloader\r\n=============\r\n\r\n[![Join the chat at https://gitter.im/syoyo/tinyobjloader](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/syoyo/tinyobjloader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\r\n\r\n[![Build Status](https://travis-ci.org/syoyo/tinyobjloader.svg)](https://travis-ci.org/syoyo/tinyobjloader)\r\n\r\n[![wercker status](https://app.wercker.com/status/495a3bac400212cdacdeb4dd9397bf4f/m \"wercker status\")](https://app.wercker.com/project/bykey/495a3bac400212cdacdeb4dd9397bf4f)\r\n\r\n[![Build status](https://ci.appveyor.com/api/projects/status/tlb421q3t2oyobcn/branch/master?svg=true)](https://ci.appveyor.com/project/syoyo/tinyobjloader/branch/master)\r\n\r\n[![Coverage Status](https://coveralls.io/repos/github/syoyo/tinyobjloader/badge.svg?branch=master)](https://coveralls.io/github/syoyo/tinyobjloader?branch=master)\r\n\r\nhttp://syoyo.github.io/tinyobjloader/\r\n\r\nTiny but powerful single file wavefront obj loader written in C++. No dependency except for C++ STL. It can parse 10M over polygons with moderate memory and time.\r\n\r\n`tinyobjloader` is good for embedding .obj loader to your (global illumination) renderer ;-)\r\n\r\nNotice!\r\n-------\r\n\r\n`master` branch will be replaced with `develop` branch in the near future: https://github.com/syoyo/tinyobjloader/tree/develop\r\n`develop` branch has more better support and clean API interface for loading .obj and also it has optimized multi-threaded parser(probably 10x faster than `master`). If you are new to use `TinyObjLoader`, I highly recommend to use `develop` branch.\r\n\r\n\r\nWhat's new\r\n----------\r\n\r\n* Mar 13, 2016 : Introduce `load_flag_t` and flat normal calculation flag! Thanks Vazquinhos!\r\n* Jan 29, 2016 : Support n-polygon(no triangulation) and OpenSubdiv crease tag! Thanks dboogert!\r\n* Nov 26, 2015 : Now single-header only!.\r\n* Nov 08, 2015 : Improved API.\r\n* Jun 23, 2015 : Various fixes and added more projects using tinyobjloader. Thanks many contributors!\r\n* Mar 03, 2015 : Replace atof() with hand-written parser for robust reading of numeric value. Thanks skurmedel!\r\n* Feb 06, 2015 : Fix parsing multi-material object\r\n* Sep 14, 2014 : Add support for multi-material per object/group. Thanks Mykhailo!\r\n* Mar 17, 2014 : Fixed trim newline bugs. Thanks ardneran!\r\n* Apr 29, 2014 : Add API to read .obj from std::istream. Good for reading compressed .obj or connecting to procedural primitive generator. Thanks burnse!\r\n* Apr 21, 2014 : Define default material if no material definition exists in .obj. Thanks YarmUI!\r\n* Apr 10, 2014 : Add support for parsing 'illum' and 'd'/'Tr' statements. Thanks mmp!\r\n* Jan 27, 2014 : Added CMake project. Thanks bradc6!\r\n* Nov 26, 2013 : Performance optimization by NeuralSandwich. 9% improvement in his project, thanks!\r\n* Sep 12, 2013 : Added multiple .obj sticher example.\r\n\r\nExample\r\n-------\r\n\r\n![Rungholt](https://github.com/syoyo/tinyobjloader/blob/master/images/rungholt.jpg?raw=true)\r\n\r\ntinyobjloader can successfully load 6M triangles Rungholt scene.\r\nhttp://graphics.cs.williams.edu/data/meshes.xml\r\n\r\nUse case\r\n--------\r\n\r\nTinyObjLoader is successfully used in ...\r\n\r\n* bullet3 https://github.com/erwincoumans/bullet3\r\n* pbrt-v2 https://github.com/mmp/pbrt-v2\r\n* OpenGL game engine development http://swarminglogic.com/jotting/2013_10_gamedev01\r\n* mallie https://lighttransport.github.io/mallie\r\n* IBLBaker (Image Based Lighting Baker). http://www.derkreature.com/iblbaker/\r\n* Stanford CS148 http://web.stanford.edu/class/cs148/assignments/assignment3.pdf\r\n* Awesome Bump http://awesomebump.besaba.com/about/\r\n* sdlgl3-wavefront OpenGL .obj viewer https://github.com/chrisliebert/sdlgl3-wavefront\r\n* pbrt-v3 https://github.com/mmp/pbrt-v3\r\n* cocos2d-x https://github.com/cocos2d/cocos2d-x/\r\n* Android Vulkan demo https://github.com/SaschaWillems/Vulkan\r\n* voxelizer https://github.com/karimnaaji/voxelizer\r\n* Probulator https://github.com/kayru/Probulator\r\n* OptiX Prime baking https://github.com/nvpro-samples/optix_prime_baking\r\n* FireRays SDK https://github.com/GPUOpen-LibrariesAndSDKs/FireRays_SDK\r\n* parg, tiny C library of various graphics utilities and GL demos https://github.com/prideout/parg\r\n* Opengl unit of ChronoEngine https://github.com/projectchrono/chrono-opengl\r\n* Your project here!\r\n\r\nFeatures\r\n--------\r\n\r\n* Group(parse multiple group name)\r\n* Vertex\r\n* Texcoord\r\n* Normal\r\n* Material\r\n * Unknown material attributes are returned as key-value(value is string) map.\r\n* Crease tag('t'). This is OpenSubdiv specific(not in wavefront .obj specification)\r\n\r\n\r\nTODO\r\n----\r\n\r\n* [ ] Support different indices for vertex/normal/texcoord\r\n\r\nLicense\r\n-------\r\n\r\nLicensed under 2 clause BSD.\r\n\r\nUsage\r\n-----\r\n\r\nTinyObjLoader triangulate input .obj by default.\r\n```c++\r\n#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc\r\n#include \"tiny_obj_loader.h\"\r\n\r\nstd::string inputfile = \"cornell_box.obj\";\r\nstd::vector shapes;\r\nstd::vector materials;\r\n \r\nstd::string err;\r\nbool ret = tinyobj::LoadObj(shapes, materials, err, inputfile.c_str());\r\n \r\nif (!err.empty()) { // `err` may contain warning message.\r\n std::cerr << err << std::endl;\r\n}\r\n\r\nif (!ret) {\r\n exit(1);\r\n}\r\n\r\nstd::cout << \"# of shapes : \" << shapes.size() << std::endl;\r\nstd::cout << \"# of materials : \" << materials.size() << std::endl;\r\n \r\nfor (size_t i = 0; i < shapes.size(); i++) {\r\n printf(\"shape[%ld].name = %s\\n\", i, shapes[i].name.c_str());\r\n printf(\"Size of shape[%ld].indices: %ld\\n\", i, shapes[i].mesh.indices.size());\r\n printf(\"Size of shape[%ld].material_ids: %ld\\n\", i, shapes[i].mesh.material_ids.size());\r\n assert((shapes[i].mesh.indices.size() % 3) == 0);\r\n for (size_t f = 0; f < shapes[i].mesh.indices.size() / 3; f++) {\r\n printf(\" idx[%ld] = %d, %d, %d. mat_id = %d\\n\", f, shapes[i].mesh.indices[3*f+0], shapes[i].mesh.indices[3*f+1], shapes[i].mesh.indices[3*f+2], shapes[i].mesh.material_ids[f]);\r\n }\r\n\r\n printf(\"shape[%ld].vertices: %ld\\n\", i, shapes[i].mesh.positions.size());\r\n assert((shapes[i].mesh.positions.size() % 3) == 0);\r\n for (size_t v = 0; v < shapes[i].mesh.positions.size() / 3; v++) {\r\n printf(\" v[%ld] = (%f, %f, %f)\\n\", v,\r\n shapes[i].mesh.positions[3*v+0],\r\n shapes[i].mesh.positions[3*v+1],\r\n shapes[i].mesh.positions[3*v+2]);\r\n }\r\n}\r\n\r\nfor (size_t i = 0; i < materials.size(); i++) {\r\n printf(\"material[%ld].name = %s\\n\", i, materials[i].name.c_str());\r\n printf(\" material.Ka = (%f, %f ,%f)\\n\", materials[i].ambient[0], materials[i].ambient[1], materials[i].ambient[2]);\r\n printf(\" material.Kd = (%f, %f ,%f)\\n\", materials[i].diffuse[0], materials[i].diffuse[1], materials[i].diffuse[2]);\r\n printf(\" material.Ks = (%f, %f ,%f)\\n\", materials[i].specular[0], materials[i].specular[1], materials[i].specular[2]);\r\n printf(\" material.Tr = (%f, %f ,%f)\\n\", materials[i].transmittance[0], materials[i].transmittance[1], materials[i].transmittance[2]);\r\n printf(\" material.Ke = (%f, %f ,%f)\\n\", materials[i].emission[0], materials[i].emission[1], materials[i].emission[2]);\r\n printf(\" material.Ns = %f\\n\", materials[i].shininess);\r\n printf(\" material.Ni = %f\\n\", materials[i].ior);\r\n printf(\" material.dissolve = %f\\n\", materials[i].dissolve);\r\n printf(\" material.illum = %d\\n\", materials[i].illum);\r\n printf(\" material.map_Ka = %s\\n\", materials[i].ambient_texname.c_str());\r\n printf(\" material.map_Kd = %s\\n\", materials[i].diffuse_texname.c_str());\r\n printf(\" material.map_Ks = %s\\n\", materials[i].specular_texname.c_str());\r\n printf(\" material.map_Ns = %s\\n\", materials[i].specular_highlight_texname.c_str());\r\n std::map::const_iterator it(materials[i].unknown_parameter.begin());\r\n std::map::const_iterator itEnd(materials[i].unknown_parameter.end());\r\n for (; it != itEnd; it++) {\r\n printf(\" material.%s = %s\\n\", it->first.c_str(), it->second.c_str());\r\n }\r\n printf(\"\\n\");\r\n}\r\n```\r\n\r\nReading .obj without triangulation. Use `num_vertices[i]` to iterate over faces(indices). `num_vertices[i]` stores the number of vertices for ith face.\r\n```c++\r\n#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc\r\n#include \"tiny_obj_loader.h\"\r\n\r\nstd::string inputfile = \"cornell_box.obj\";\r\nstd::vector shapes;\r\nstd::vector materials;\r\n \r\nstd::string err;\r\nint flags = 1; // see load_flags_t enum for more information.\r\nbool ret = tinyobj::LoadObj(shapes, materials, err, inputfile.c_str(), flags);\r\n \r\nif (!err.empty()) { // `err` may contain warning message.\r\n std::cerr << err << std::endl;\r\n}\r\n\r\nif (!ret) {\r\n exit(1);\r\n}\r\n\r\nfor (size_t i = 0; i < shapes.size(); i++) {\r\n\r\n size_t indexOffset = 0;\r\n for (size_t n = 0; n < shapes[i].mesh.num_vertices.size(); n++) {\r\n int ngon = shapes[i].mesh.num_vertices[n];\r\n for (size_t f = 0; f < ngon; f++) {\r\n unsigned int v = shapes[i].mesh.indices[indexOffset + f];\r\n printf(\" face[%ld] v[%ld] = (%f, %f, %f)\\n\", n,\r\n shapes[i].mesh.positions[3*v+0],\r\n shapes[i].mesh.positions[3*v+1],\r\n shapes[i].mesh.positions[3*v+2]);\r\n \r\n }\r\n indexOffset += ngon;\r\n }\r\n\r\n}\r\n```\r\n", + "google": "", + "note": "Don't delete this file! It's used internally to help with page regeneration." +} \ No newline at end of file diff --git a/stylesheets/github-dark.css b/stylesheets/github-dark.css new file mode 100644 index 0000000..f8dbbdf --- /dev/null +++ b/stylesheets/github-dark.css @@ -0,0 +1,124 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +.pl-c /* comment */ { + color: #969896; +} + +.pl-c1 /* constant, variable.other.constant, support, meta.property-name, support.constant, support.variable, meta.module-reference, markup.raw, meta.diff.header */, +.pl-s .pl-v /* string variable */ { + color: #0099cd; +} + +.pl-e /* entity */, +.pl-en /* entity.name */ { + color: #9774cb; +} + +.pl-smi /* variable.parameter.function, storage.modifier.package, storage.modifier.import, storage.type.java, variable.other */, +.pl-s .pl-s1 /* string source */ { + color: #ddd; +} + +.pl-ent /* entity.name.tag */ { + color: #7bcc72; +} + +.pl-k /* keyword, storage, storage.type */ { + color: #cc2372; +} + +.pl-s /* string */, +.pl-pds /* punctuation.definition.string, string.regexp.character-class */, +.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, +.pl-sr /* string.regexp */, +.pl-sr .pl-cce /* string.regexp constant.character.escape */, +.pl-sr .pl-sre /* string.regexp source.ruby.embedded */, +.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */ { + color: #3c66e2; +} + +.pl-v /* variable */ { + color: #fb8764; +} + +.pl-id /* invalid.deprecated */ { + color: #e63525; +} + +.pl-ii /* invalid.illegal */ { + color: #f8f8f8; + background-color: #e63525; +} + +.pl-sr .pl-cce /* string.regexp constant.character.escape */ { + font-weight: bold; + color: #7bcc72; +} + +.pl-ml /* markup.list */ { + color: #c26b2b; +} + +.pl-mh /* markup.heading */, +.pl-mh .pl-en /* markup.heading entity.name */, +.pl-ms /* meta.separator */ { + font-weight: bold; + color: #264ec5; +} + +.pl-mq /* markup.quote */ { + color: #00acac; +} + +.pl-mi /* markup.italic */ { + font-style: italic; + color: #ddd; +} + +.pl-mb /* markup.bold */ { + font-weight: bold; + color: #ddd; +} + +.pl-md /* markup.deleted, meta.diff.header.from-file */ { + color: #bd2c00; + background-color: #ffecec; +} + +.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { + color: #55a532; + background-color: #eaffea; +} + +.pl-mdr /* meta.diff.range */ { + font-weight: bold; + color: #9774cb; +} + +.pl-mo /* meta.output */ { + color: #264ec5; +} + diff --git a/stylesheets/normalize.css b/stylesheets/normalize.css index bc2ba93..16a1351 100644 --- a/stylesheets/normalize.css +++ b/stylesheets/normalize.css @@ -1,4 +1,4 @@ -/* normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */ +/* normalize.css 2012-02-07T12:37 UTC - https://github.com/necolas/normalize.css */ /* ============================================================================= HTML5 display definitions ========================================================================== */ diff --git a/stylesheets/styles.css b/stylesheets/styles.css index 3d9cb2d..9f6e68e 100644 --- a/stylesheets/styles.css +++ b/stylesheets/styles.css @@ -68,7 +68,7 @@ -webkit-font-smoothing: antialiased; } -/* normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */ +/* normalize.css 2012-02-07T12:37 UTC - https://github.com/necolas/normalize.css */ /* ============================================================================= HTML5 display definitions ========================================================================== */ @@ -529,8 +529,8 @@ table { } body { - padding: 0; - margin: 0; + padding: 0px 0 20px 0px; + margin: 0px; font: 14px/1.5 "OpenSansRegular", "Helvetica Neue", Helvetica, Arial, sans-serif; color: #f0e7d5; font-weight: normal; @@ -605,7 +605,7 @@ strong { } .wrapper { - max-width: 960px; + max-width: 650px; margin: 0 auto; position: relative; padding: 0 20px; @@ -709,7 +709,7 @@ dt { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); } #header nav { - max-width: 960px; + max-width: 650px; margin: 0 auto; padding: 0 10px; background: blue; @@ -781,8 +781,8 @@ dt { } section { - max-width: 960px; - padding: 30px 0 0 0; + max-width: 650px; + padding: 30px 0px 50px 0px; margin: 20px 0; margin-top: 70px; } @@ -819,10 +819,6 @@ section #title .credits.left { section #title .credits.right { float: right; } -footer { - border-top: 2px solid #434343; - padding-top: 20px; -} @media print, screen and (max-width: 720px) { #title .credits { @@ -849,12 +845,7 @@ footer { margin-top: 40px; } - #header nav { - margin: 15px auto; - text-align: center; - } - - #header nav .downloads, #header nav .title { + nav { display: none; } }