GeezerVison is showing github.com — Merge branch 'master' into python_add_materialids · SimiPro/tinyobjloader@8972259
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: CMakeLists.txt +16-3Lines changed: 16 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,6 @@ set(TINYOBJLOADER_VERSION 1.0.4) | 10 | 10 | option(TINYOBJLOADER_USE_DOUBLE "Build library with double precision instead of single (float)" OFF) | 11 | 11 |
| 12 | 12 | if(TINYOBJLOADER_USE_DOUBLE) | 13 | | - add_definitions(-DTINYOBJLOADER_USE_DOUBLE) | 14 | 13 | set(LIBRARY_NAME ${PROJECT_NAME}_double) | 15 | 14 | else() | 16 | 15 | set(LIBRARY_NAME ${PROJECT_NAME}) | @@ -56,6 +55,10 @@ if(BUILD_SHARED_LIBS) | 56 | 55 | ) | 57 | 56 | endif() | 58 | 57 |
| | 58 | +if(TINYOBJLOADER_USE_DOUBLE) | | 59 | + target_compile_definitions(${LIBRARY_NAME} PUBLIC TINYOBJLOADER_USE_DOUBLE) | | 60 | +endif() | | 61 | + | 59 | 62 | set_target_properties(${LIBRARY_NAME} PROPERTIES VERSION ${TINYOBJLOADER_VERSION}) | 60 | 63 |
| 61 | 64 | target_include_directories(${LIBRARY_NAME} INTERFACE | @@ -87,7 +90,7 @@ include(CMakePackageConfigHelpers) | 87 | 90 |
| 88 | 91 | configure_package_config_file( | 89 | 92 | ${PROJECT_NAME}-config.cmake.in | 90 | | - ${LIBRARY_NAME}-config.cmake | | 93 | + ${PROJECT_NAME}-config.cmake | 91 | 94 | INSTALL_DESTINATION | 92 | 95 | ${TINYOBJLOADER_CMAKE_DIR} | 93 | 96 | PATH_VARS | @@ -96,7 +99,7 @@ configure_package_config_file( | 96 | 99 | NO_CHECK_REQUIRED_COMPONENTS_MACRO | 97 | 100 | ) | 98 | 101 |
| 99 | | -write_basic_package_version_file(${LIBRARY_NAME}-config-version.cmake | | 102 | +write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake | 100 | 103 | VERSION | 101 | 104 | ${TINYOBJLOADER_VERSION} | 102 | 105 | COMPATIBILITY | @@ -145,3 +148,13 @@ install(FILES | 145 | 148 | DESTINATION | 146 | 149 | ${TINYOBJLOADER_PKGCONFIG_DIR} | 147 | 150 | ) | | 151 | + | | 152 | +if(NOT TARGET uninstall) | | 153 | + configure_file( | | 154 | + ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in | | 155 | + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) | | 156 | + | | 157 | + add_custom_target( | | 158 | + uninstall COMMAND ${CMAKE_COMMAND} -P | | 159 | + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) | | 160 | +endif() |
Collapse file Copy file name to clipboardExpand all lines: README.md +5-3Lines changed: 5 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # tinyobjloader | 2 | 2 |
| 3 | | -[](https://gitter.im/syoyo/tinyobjloader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | 4 | | - | 5 | | -[](https://travis-ci.org/syoyo/tinyobjloader) | | 3 | +[](https://travis-ci.org/tinyobjloader/tinyobjloader) | 6 | 4 |
| 7 | 5 | [](https://dev.azure.com/syoyo/lte%20oss/_build/latest?definitionId=2&branchName=master) | 8 | 6 |
| | 12 | 10 |
| 13 | 11 | [](https://bintray.com/conan/conan-center/tinyobjloader%3A_/_latestVersion) | 14 | 12 |
| | 13 | +[](https://gitter.im/syoyo/tinyobjloader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) (inactive. gitter chat will be removed in the future. Please use github issue if you have questions and got issues) | | 14 | + | | 15 | + | 15 | 16 | Tiny but powerful single file wavefront obj loader written in C++03. No dependency except for C++ STL. It can parse over 10M polygons with moderate memory and time. | 16 | 17 |
| 17 | 18 | `tinyobjloader` is good for embedding .obj loader to your (global illumination) renderer ;-) | @@ -26,6 +27,7 @@ Old version is available as `v0.9.x` branch https://github.com/syoyo/tinyobjload | 26 | 27 |
| 27 | 28 | ## What's new | 28 | 29 |
| | 30 | +* 19 Feb, 2020 : The repository has been moved to https://github.com/tinyobjloader/tinyobjloader ! | 29 | 31 | * 18 May, 2019 : Python binding!(See `python` folder. Also see https://pypi.org/project/tinyobjloader/) | 30 | 32 | * 14 Apr, 2019 : Bump version v2.0.0 rc0. New C++ API and python bindings!(1.x API still exists for backward compatibility) | 31 | 33 | * 20 Aug, 2016 : Bump version v1.0.0. New data structure and API! | |
Collapse file Copy file name to clipboardExpand all lines: azure-pipelines.yml +18-47Lines changed: 18 additions & 47 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,86 +11,57 @@ jobs: | 11 | 11 | make && ./tester | 12 | 12 | displayName: Run unit tests | 13 | 13 |
| 14 | | - - job: python_linux | 15 | | - pool: { vmImage: "Ubuntu-16.04" } | | 14 | + - job: linux | | 15 | + pool: {vmImage: "Ubuntu-16.04"} | 16 | 16 | steps: | 17 | 17 | - task: UsePythonVersion@0 | 18 | 18 | - bash: | | | 19 | + python -m pip install --upgrade pip | | 20 | + pip install cibuildwheel==1.1.0 | 19 | 21 | # Make the header files available to the build. | 20 | 22 | cp *.h python | 21 | | - python -m pip install --upgrade pip | 22 | | - pip install cibuildwheel==0.12.0 | 23 | 23 | cd python | 24 | 24 | cibuildwheel --output-dir wheelhouse . | 25 | 25 | - task: PublishBuildArtifacts@1 | 26 | | - inputs: { pathtoPublish: "python/wheelhouse" } | | 26 | + inputs: {pathtoPublish: 'python/wheelhouse'} | 27 | 27 | - script: | | 28 | 28 | pip install black==19.10b0 | 29 | 29 | black --check python/ | 30 | 30 | displayName: Check Python code format | 31 | 31 |
| 32 | | - - job: python_macos | 33 | | - pool: { vmImage: "macOS-10.13" } | | 32 | + - job: macos | | 33 | + pool: {vmImage: 'macOS-10.13'} | 34 | 34 | variables: | 35 | 35 | # Support C++11: https://github.com/joerick/cibuildwheel/pull/156 | 36 | 36 | MACOSX_DEPLOYMENT_TARGET: 10.9 | 37 | 37 | steps: | 38 | 38 | - task: UsePythonVersion@0 | 39 | 39 | - bash: | | | 40 | + python -m pip install --upgrade pip | | 41 | + pip install cibuildwheel==1.1.0 | 40 | 42 | # Make the header files available to the build. | 41 | 43 | cp *.h python | 42 | | - python -m pip install --upgrade pip | 43 | | - pip install cibuildwheel==0.12.0 | 44 | 44 | cd python | 45 | 45 | cibuildwheel --output-dir wheelhouse . | 46 | 46 | - task: PublishBuildArtifacts@1 | 47 | | - inputs: { pathtoPublish: "python/wheelhouse" } | | 47 | + inputs: {pathtoPublish: 'python/wheelhouse'} | 48 | 48 |
| 49 | | - - job: python_windows | 50 | | - pool: { vmImage: "vs2017-win2016" } | | 49 | + - job: windows | | 50 | + pool: {vmImage: 'vs2017-win2016'} | 51 | 51 | steps: | 52 | | - - { | 53 | | - task: UsePythonVersion@0, | 54 | | - inputs: { versionSpec: "2.7", architecture: x86 }, | 55 | | - } | 56 | | - - { | 57 | | - task: UsePythonVersion@0, | 58 | | - inputs: { versionSpec: "2.7", architecture: x64 }, | 59 | | - } | 60 | | - - { | 61 | | - task: UsePythonVersion@0, | 62 | | - inputs: { versionSpec: "3.5", architecture: x86 }, | 63 | | - } | 64 | | - - { | 65 | | - task: UsePythonVersion@0, | 66 | | - inputs: { versionSpec: "3.5", architecture: x64 }, | 67 | | - } | 68 | | - - { | 69 | | - task: UsePythonVersion@0, | 70 | | - inputs: { versionSpec: "3.6", architecture: x86 }, | 71 | | - } | 72 | | - - { | 73 | | - task: UsePythonVersion@0, | 74 | | - inputs: { versionSpec: "3.6", architecture: x64 }, | 75 | | - } | 76 | | - - { | 77 | | - task: UsePythonVersion@0, | 78 | | - inputs: { versionSpec: "3.7", architecture: x86 }, | 79 | | - } | 80 | | - - { | 81 | | - task: UsePythonVersion@0, | 82 | | - inputs: { versionSpec: "3.7", architecture: x64 }, | 83 | | - } | | 52 | + - task: UsePythonVersion@0 | 84 | 53 | - script: choco install vcpython27 -f -y | 85 | 54 | displayName: Install Visual C++ for Python 2.7 | 86 | 55 | - bash: | | 87 | | - cp *.h python | 88 | 56 | python -m pip install --upgrade pip | 89 | | - pip install cibuildwheel==0.12.0 | | 57 | + pip install cibuildwheel==1.1.0 | | 58 | + # Make the header files available to the build. | | 59 | + cp *.h python | 90 | 60 | cd python | 91 | 61 | cibuildwheel --output-dir wheelhouse . | 92 | 62 | - task: PublishBuildArtifacts@1 | 93 | | - inputs: { pathtoPublish: "python/wheelhouse" } | | 63 | + inputs: {pathtoPublish: 'python/wheelhouse'} | | 64 | + | 94 | 65 |
| 95 | 66 | trigger: | 96 | 67 | - master | |
Collapse file Copy file name to clipboard +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | | 2 | + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | | 3 | +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | | 4 | + | | 5 | +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | | 6 | +string(REGEX REPLACE "\n" ";" files "${files}") | | 7 | +foreach(file ${files}) | | 8 | + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") | | 9 | + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | | 10 | + exec_program( | | 11 | + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" | | 12 | + OUTPUT_VARIABLE rm_out | | 13 | + RETURN_VALUE rm_retval | | 14 | + ) | | 15 | + if(NOT "${rm_retval}" STREQUAL 0) | | 16 | + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") | | 17 | + endif(NOT "${rm_retval}" STREQUAL 0) | | 18 | + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | | 19 | + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") | | 20 | + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | | 21 | +endforeach(file) |
Collapse file Copy file name to clipboardExpand all lines: examples/viewer/README.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 37 | 37 |
| 38 | 38 | ## TODO | 39 | 39 |
| | 40 | +* [ ] Alpha texturing. | 40 | 41 | * [ ] Support per-face material. | 41 | 42 | * [ ] Use shader-based GL rendering. | 42 | 43 | * [ ] PBR shader support. |
Collapse file Copy file name to clipboardExpand all lines: experimental/viewer.cc +17-17Lines changed: 17 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | #include <limits> | 10 | 10 | #include <cmath> | 11 | 11 | #include <cassert> | 12 | | -#include <cstring> | 13 | | -#include <algorithm> | | 12 | +#include <cstring> | | 13 | +#include <algorithm> | 14 | 14 |
| 15 | 15 | #if defined(ENABLE_ZLIB) | 16 | 16 | #include <zlib.h> | @@ -81,7 +81,7 @@ void CalcNormal(float N[3], float v0[3], float v1[3], float v2[3]) { | 81 | 81 | float len2 = N[0] * N[0] + N[1] * N[1] + N[2] * N[2]; | 82 | 82 | if (len2 > 0.0f) { | 83 | 83 | float len = sqrtf(len2); | 84 | | - | | 84 | + | 85 | 85 | N[0] /= len; | 86 | 86 | N[1] /= len; | 87 | 87 | } | @@ -96,7 +96,7 @@ const char *mmap_file(size_t *len, const char* filename) | 96 | 96 |
| 97 | 97 | HANDLE fileMapping = CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL); | 98 | 98 | assert(fileMapping != INVALID_HANDLE_VALUE); | 99 | | - | | 99 | + | 100 | 100 | LPVOID fileMapView = MapViewOfFile(fileMapping, FILE_MAP_READ, 0, 0, 0); | 101 | 101 | auto fileMapViewChar = (const char*)fileMapView; | 102 | 102 | assert(fileMapView != NULL); | @@ -140,7 +140,7 @@ const char *mmap_file(size_t *len, const char* filename) | 140 | 140 | } | 141 | 141 |
| 142 | 142 | if (!S_ISREG (sb.st_mode)) { | 143 | | - fprintf (stderr, "%s is not a file\n", "lineitem.tbl"); | | 143 | + fprintf (stderr, "%s is not a file\n", filename); | 144 | 144 | return nullptr; | 145 | 145 | } | 146 | 146 |
| @@ -159,7 +159,7 @@ const char *mmap_file(size_t *len, const char* filename) | 159 | 159 | (*len) = fileSize; | 160 | 160 |
| 161 | 161 | return p; | 162 | | - | | 162 | + | 163 | 163 | #endif | 164 | 164 | } | 165 | 165 |
| @@ -175,11 +175,11 @@ bool gz_load(std::vector<char>* buf, const char* filename) | 175 | 175 | return false; | 176 | 176 | } | 177 | 177 | while (1) { | 178 | | - int err; | | 178 | + int err; | 179 | 179 | int bytes_read; | 180 | 180 | unsigned char buffer[1024]; | 181 | 181 | bytes_read = gzread (file, buffer, 1024); | 182 | | - buf->insert(buf->end(), buffer, buffer + 1024); | | 182 | + buf->insert(buf->end(), buffer, buffer + 1024); | 183 | 183 | //printf ("%s", buffer); | 184 | 184 | if (bytes_read < 1024) { | 185 | 185 | if (gzeof (file)) { | @@ -305,7 +305,7 @@ const char* get_file_data(size_t *len, const char* filename) | 305 | 305 | data_len = buf.size(); | 306 | 306 | } | 307 | 307 | } else { | 308 | | - | | 308 | + | 309 | 309 | data = mmap_file(&data_len, filename); | 310 | 310 |
| 311 | 311 | } | @@ -385,7 +385,7 @@ bool LoadObjAndConvert(float bmin[3], float bmax[3], const char* filename, int n | 385 | 385 |
| 386 | 386 | float n[3][3]; | 387 | 387 |
| 388 | | - if (attrib.normals.size() > 0) { | | 388 | + if (attrib.normals.size() > 0) { | 389 | 389 | int nf0 = idx0.normal_index; | 390 | 390 | int nf1 = idx1.normal_index; | 391 | 391 | int nf2 = idx2.normal_index; | @@ -424,7 +424,7 @@ bool LoadObjAndConvert(float bmin[3], float bmax[3], const char* filename, int n | 424 | 424 | float len2 = c[0] * c[0] + c[1] * c[1] + c[2] * c[2]; | 425 | 425 | if (len2 > 1.0e-6f) { | 426 | 426 | float len = sqrtf(len2); | 427 | | - | | 427 | + | 428 | 428 | c[0] /= len; | 429 | 429 | c[1] /= len; | 430 | 430 | c[2] /= len; | @@ -433,7 +433,7 @@ bool LoadObjAndConvert(float bmin[3], float bmax[3], const char* filename, int n | 433 | 433 | vb.push_back(c[1] * 0.5 + 0.5); | 434 | 434 | vb.push_back(c[2] * 0.5 + 0.5); | 435 | 435 | } | 436 | | - } | | 436 | + } | 437 | 437 | face_offset += attrib.face_num_verts[v]; | 438 | 438 | } | 439 | 439 |
| @@ -448,7 +448,7 @@ bool LoadObjAndConvert(float bmin[3], float bmax[3], const char* filename, int n | 448 | 448 |
| 449 | 449 | gDrawObjects.push_back(o); | 450 | 450 | } | 451 | | - | | 451 | + | 452 | 452 | printf("bmin = %f, %f, %f\n", bmin[0], bmin[1], bmin[2]); | 453 | 453 | printf("bmax = %f, %f, %f\n", bmax[0], bmax[1], bmax[2]); | 454 | 454 |
| @@ -562,7 +562,7 @@ void Draw(const std::vector<DrawObject>& drawObjects) | 562 | 562 | if (o.vb < 1) { | 563 | 563 | continue; | 564 | 564 | } | 565 | | - | | 565 | + | 566 | 566 | glBindBuffer(GL_ARRAY_BUFFER, o.vb); | 567 | 567 | glEnableClientState(GL_VERTEX_ARRAY); | 568 | 568 | glEnableClientState(GL_NORMAL_ARRAY); | @@ -586,7 +586,7 @@ void Draw(const std::vector<DrawObject>& drawObjects) | 586 | 586 | if (o.vb < 1) { | 587 | 587 | continue; | 588 | 588 | } | 589 | | - | | 589 | + | 590 | 590 | glBindBuffer(GL_ARRAY_BUFFER, o.vb); | 591 | 591 | glEnableClientState(GL_VERTEX_ARRAY); | 592 | 592 | glEnableClientState(GL_NORMAL_ARRAY); | @@ -677,7 +677,7 @@ int main(int argc, char **argv) | 677 | 677 | return -1; | 678 | 678 | } | 679 | 679 |
| 680 | | - std::cout << "GLFW OK." << std::endl; | | 680 | + std::cout << "GLFW Init OK." << std::endl; | 681 | 681 |
| 682 | 682 |
| 683 | 683 | window = glfwCreateWindow(width, height, "Obj viewer", NULL, NULL); | @@ -738,7 +738,7 @@ int main(int argc, char **argv) | 738 | 738 |
| 739 | 739 | // Centerize object. | 740 | 740 | glTranslatef(-0.5*(bmax[0] + bmin[0]), -0.5*(bmax[1] + bmin[1]), -0.5*(bmax[2] + bmin[2])); | 741 | | - | | 741 | + | 742 | 742 | Draw(gDrawObjects); | 743 | 743 |
| 744 | 744 | glfwSwapBuffers(window); | |
Collapse file Copy file name to clipboard +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# .mtl is located at tests/assets | | 2 | +mtllib issue-244.mtl | | 3 | + | | 4 | +v -1.000000 1.202466 1.000000 | | 5 | +v 1.000000 1.202466 1.000000 | | 6 | +v -1.000000 1.202466 -1.000000 | | 7 | +v 1.000000 1.202466 -1.000000 | | 8 | +vn 0.0000 1.0000 0.0000 | | 9 | +v -1.000000 0.000000 1.000000 | | 10 | +v 1.000000 0.000000 1.000000 | | 11 | +v -1.000000 0.000000 -1.000000 | | 12 | +v 1.000000 0.000000 -1.000000 | | 13 | +vn 0.0000 1.0000 0.0000 | | 14 | + | | 15 | +usemtl None | | 16 | +o Plane.001 | | 17 | +f 1//1 2//1 4//1 | | 18 | + | | 19 | +# Following geometry is ignored without fix for #235 | | 20 | +usemtl None1 | | 21 | +o Plane | | 22 | +f 5//2 6//2 8//2 |
Collapse file Copy file name to clipboard +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +newmtl 1 | | 2 | +Ka 0 0 0 | | 3 | +Kd 1 1 1 | | 4 | +Ks 0 0 0 |
|