Compare commits

..
Author SHA1 Message Date
Syoyo Fujita 246654a15a Code clean-up. Reviewed by @Squareeyes. 2018-03-21 20:32:22 +09:00
Syoyo Fujita ba28ddcc9e Modify error message. 2018-03-21 20:05:11 +09:00
Syoyo Fujita 8e2c24fb92 Refactor ParseImage function.
Returns error when both `bufferView` and `uri` are defined in Image.
2018-03-21 19:54:38 +09:00
Syoyo Fujita ba809ff52f Merge branch 'devel' of github.com:syoyo/tinygltf into devel 2018-03-21 18:52:53 +09:00
Syoyo Fujita 70d8b7a42b Merge pull request #53 from Ybalrid/gltfutil
Gltf utility
2018-03-20 11:01:22 +09:00
Syoyo Fujita 3f1c5a90d3 Merge pull request #54 from Ybalrid/fix_msvc_build_usage
Fix MSVC build: removing static keyowrd befor tinygltf::LoadImageData
2018-03-20 10:36:26 +09:00
Arthur Brainville 2960379eba Can select image file format with -f argument in gltf util
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 20:24:00 +01:00
Arthur Brainville 4ba01f5968 Add a "not specified" option to the enum class for image formats
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 20:06:59 +01:00
Arthur Brainville cd366ddd1d Fix MSVC build: removing static keyowrd befor tinygltf::LoadImageData
This is peculiar:
It looks like MSVC doesn't want to build when multiple compilation units
(e.g. multiple .cc files) uses tiny_gltf and this funciton is static.

The only one file that will build without error is the one that defined
the `TINYGLTF_IMPLEMENTATION` macro.

Removing `static` here solves the issue...

Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 19:54:05 +01:00
Arthur Brainville 68174a3fb3 Fix MSVC build: removing static keyowrd befor tinygltf::LoadImageData
This is peculiar:
It looks like MSVC doesn't want to build when multiple compilation units
(e.g. multiple .cc files) uses tiny_gltf and this funciton is static.

The only one file that will build without error is the one that defined
the `TINYGLTF_IMPLEMENTATION` macro.

Removing `static` here solves the issue...

Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 19:40:04 +01:00
Arthur Brainville (Ybalrid) 34c8b60325 Can specify output directory for dumped texture with -o
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 17:21:18 +01:00
Arthur Brainville (Ybalrid) 8d8840f809 Added basic texture dumper
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 17:11:53 +01:00
Arthur Brainville ea2b1c5e5d Start working on a gltf utility program
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-19 15:49:14 +01:00
Syoyo Fujita f1cdd1c4cb Merge pull request #52 from Selmar/opt_out_external_image_loading
Allow opting out of external image loading
2018-03-16 17:26:49 -05:00
Selmar Kok 5b8eb9b429 Merge branch 'devel' into opt_out_external_image_loading 2018-03-16 12:15:13 +01:00
Selmar 67af3c98aa Allow opting out of external image loading
We do not require image loading for external files, we have separate texture directories at the moment.

I've also added saving the image->uri when loading a binary gltf.
2018-03-16 11:48:19 +01:00
Syoyo Fujita 580d7c8b9f Parse defaultScene value correcrly. Fixes #47. 2018-03-15 22:09:01 -05:00
Syoyo Fujita e69069d53c Loading a GLB file without BIN data fails. Fixes #49. 2018-03-15 22:01:18 -05:00
Syoyo Fujita d42767e63f Store relative URI in Buffer serializer. Fixes #48.
Apply clang-format.
Add simple saver sample.
2018-03-15 21:52:00 -05:00
Syoyo Fujita 20244e1e4e Fix storing uri to Buffer.uri. Fixes #50.
Fix decoding DataURI with 'data:application/gltf-buffer;base64' mime.
2018-03-15 11:01:05 -05:00
Syoyo Fujita 4f0b893d73 Merge pull request #45 from Squareys/custom-image-loaders
Allow custom image loaders
2018-03-14 10:07:49 +09:00
Squareys 2d3594de22 Allow opting out of STB_IMAGE dependency
Signed-off-by: Squareys <squareys@googlemail.com>
2018-03-13 23:08:03 +01:00
Squareys ff644d82c9 Allow specifying custom image loader callback
Signed-off-by: Squareys <squareys@googlemail.com>
2018-03-13 23:08:03 +01:00
Squareys f99f760b07 Clean up obsolete debug output
Signed-off-by: Squareys <squareys@googlemail.com>
2018-03-13 22:29:31 +01:00
Squareys 4337463c79 Remove trailing whitespaces
Signed-off-by: Squareys <squareys@googlemail.com>
2018-03-13 22:20:48 +01:00
Squareys 188965b11e Fix minor typo
Signed-off-by: Squareys <squareys@googlemail.com>
2018-03-13 22:20:01 +01:00
Syoyo Fujita 179edbf054 Fix empty serialization. Fixes #44. 2018-03-06 12:04:51 +09:00
Syoyo Fujita 1e94d05012 Merge pull request #43 from Ybalrid/devel
raytrace: remove code that ouput the 1st loaded texture as PPM
2018-03-03 02:15:44 +09:00
Arthur Brainville 92000ddeed raytrace: remove code that ouput the 1st loaded texture as PPM
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-02 16:58:30 +01:00
Syoyo Fujita abf4bd1800 Merge pull request #42 from Ybalrid/pr_raytrace_texture_loading
raytrace: add simple code that load texture data
2018-03-03 00:55:58 +09:00
Syoyo Fujita c14616d21c Merge pull request #41 from Ybalrid/pr_upgrade_imgui_imguizmo_raytrace
Upgraded dear imgui and ImGuizmo to the latest version
2018-03-03 00:43:18 +09:00
Arthur Brainville e832baf229 Restored previous behavior when moving node in scene
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-02 16:21:28 +01:00
Arthur Brainville df9003ea08 Update scene when moving gizmo
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-02 16:10:20 +01:00
Arthur Brainville ab156c7d18 Upgraded dear imgui and ImGuizmo to the latest version
The Gizmo feels a little bit nicer to use in the latest version

Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-02 15:49:01 +01:00
Arthur Brainville dd45c56927 raytrace: add simple code that load texture data
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-03-02 13:57:37 +01:00
Syoyo Fujita 0b01361d15 Fix return location. 2018-02-28 19:59:32 +09:00
Syoyo Fujita 493cad4e64 Merge pull request #40 from Ybalrid/pr_raytrace_example
Pr raytrace example
2018-02-28 00:04:07 +09:00
Arthur Brainville c227c5bddb Fixed triangle fan indices
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-27 12:47:06 +01:00
Arthur Brainville (Ybalrid) de8e3a6e6b Enforece some const correctness. Add comments.
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-25 01:23:04 +01:00
Arthur Brainville (Ybalrid) a5a03a2d44 Reorder UVs in vacevaying order
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-25 01:14:57 +01:00
Arthur Brainville (Ybalrid) 6cf0228fa7 Handle all types of triangle-based vertex buffer.
Some small codepath changes too.

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-25 00:52:50 +01:00
Arthur Brainville (Ybalrid) 1cd3b0f756 Fix pesudo -> pseudo typo
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-25 00:42:35 +01:00
Arthur Brainville (Ybalrid) 0e0a884378 Check the type of vectors before checking the type of their component
This order makes more sense.

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-24 22:09:17 +01:00
Arthur Brainville (Ybalrid) 8eb0fbb3d4 Fix the loading of normals by putting them into facevarying order
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-24 21:52:53 +01:00
Arthur Brainville (Ybalrid) 0da2b35085 Fixes problem when mesh in glTF file doesn't have a name
a "unnamed_X" name will be genrated.

This fixes the loading of Trinagle.gltf from khronos

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-23 15:15:33 +01:00
Arthur Brainville (Ybalrid) 55bff342c2 Merge branch 'pr_raytrace_example' of github.com:Ybalrid/tinygltf into pr_raytrace_example 2018-02-23 14:26:55 +01:00
Arthur Brainville (Ybalrid) 37ba0ae481 Log the types of data used by the currently loaded GLTF file
This will help test and improve compatibilitiy.

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-23 14:23:30 +01:00
Arthur Brainville (Ybalrid) 27ae4ba9c1 load texture coordinates
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:24 +01:00
Arthur Brainville 07e6c5c109 Small code cleanup
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:23 +01:00
Arthur Brainville 0b4f54162b Switch to unsigned int for the int arrays. Fix compatibility issue
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:23 +01:00
Arthur Brainville db1e8b3e8b added loading of doubles for position
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:23 +01:00
Arthur Brainville 2b211221c8 Add double type vector. Remove by default byte_stride value
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:22 +01:00
Arthur Brainville (Ybalrid) 72f535e198 Move defined types (array adapter templates) to the header
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:22 +01:00
Arthur Brainville (Ybalrid) 02fce26c6c Use default material as the 1st material on the array
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:22 +01:00
Arthur Brainville (Ybalrid) 7218e40bfd Fix pivot. Hack material to prevent crash
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:22 +01:00
Arthur Brainville (Ybalrid) 2b10d88e42 Load inside the scene graph the gltf mesh (like the obj)
pivot is still invalid

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:21 +01:00
Arthur Brainville aad6f06208 Fix linux build in C++11 strict
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:21 +01:00
Arthur Brainville b62e95f414 Load the normal vectors of the primitive
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:21 +01:00
Arthur Brainville ffc79a719b Also access the position attribute of the primitive
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:20 +01:00
Arthur Brainville (Ybalrid) ce75870894 Now load index buffer
Added some template infrastructure to read arrays where type is defined by a value.

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:20 +01:00
Arthur Brainville (Ybalrid) 49721f0fd4 Add the entry point for loading gltf files.
Also switch on the primitive mode of each mesh. Will only attempt to
load lists of triangles for now...

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:20 +01:00
Arthur Brainville (Ybalrid) 62da4688af Only attempt to load the obj file if the obj_filename is defined in json
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:20 +01:00
Arthur Brainville (Ybalrid) 365e56b779 Small adjustment to the NanoSG readme
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:19 +01:00
Arthur Brainville (Ybalrid) 1baa211450 Add files to .gitignore
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:19 +01:00
Arthur Brainville 01bf27443e Fix where stb image is actually implemented
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:18 +01:00
Arthur Brainville (Ybalrid) 7e91e9bb9f Setup CI for raytrace example
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:18 +01:00
Arthur Brainville (Ybalrid) 67f5fbd79e Add a gltf_filename feild to the renderconfig struct
This is to get the filename that will be given to the gltf-loader

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:18 +01:00
Arthur Brainville (Ybalrid) a6cbf3d35b Applyind clang-format on main.cc. Included gltf-loader
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:17 +01:00
Arthur Brainville (Ybalrid) 3903446bfc Move the implementation of stbi to it's own .cc file
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:17 +01:00
Arthur Brainville (Ybalrid) 8066a54415 Build the tinygltf loader code
Also remove the implementation of STB-Image from obj-loader.cc

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:17 +01:00
Arthur Brainville (Ybalrid) 3d63a08ce2 Make this code buildable as is
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:16 +01:00
Arthur Brainville (Ybalrid) d868aff1d1 Add the current code of nanort + nanosg
This implementation will be based on commit
b31dc0bd92eb7ac896079849a2205fac4abbd087 from the nanort project

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:16 +01:00
Arthur Brainville (Ybalrid) 6233b2e6bb Remove old nanort/nanosg code. Keep the gltf-loader class on hand
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-22 21:50:15 +01:00
Syoyo Fujita b09d660c38 Update premake script for glview example. Fixes #39. 2018-02-23 01:14:13 +09:00
Arthur Brainville (Ybalrid) 0dca478817 load texture coordinates
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-21 10:02:04 +01:00
Arthur Brainville b7bf01c679 Switch to unsigned int for the int arrays. Fix compatibility issue
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 21:47:22 +01:00
Arthur Brainville dc07a50ab7 added loading of doubles for position
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 21:43:07 +01:00
Arthur Brainville 6edd3a7f60 Add double type vector. Remove by default byte_stride value
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 21:40:55 +01:00
Arthur Brainville (Ybalrid) fac0ad9243 Move defined types (array adapter templates) to the header
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 15:55:23 +01:00
Arthur Brainville (Ybalrid) 58baa51463 Use default material as the 1st material on the array
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:57 +01:00
Arthur Brainville (Ybalrid) d095ef53c4 Fix pivot. Hack material to prevent crash
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:57 +01:00
Arthur Brainville (Ybalrid) 9993a71410 Load inside the scene graph the gltf mesh (like the obj)
pivot is still invalid

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:57 +01:00
Arthur Brainville e64e6d2d2a Fix linux build in C++11 strict
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:56 +01:00
Arthur Brainville db5b272a1b Load the normal vectors of the primitive
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:56 +01:00
Arthur Brainville 5682cb4542 Also access the position attribute of the primitive
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:56 +01:00
Arthur Brainville (Ybalrid) 7c54677acd Now load index buffer
Added some template infrastructure to read arrays where type is defined by a value.

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:56 +01:00
Arthur Brainville (Ybalrid) b8040e2a19 Add the entry point for loading gltf files.
Also switch on the primitive mode of each mesh. Will only attempt to
load lists of triangles for now...

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:56 +01:00
Arthur Brainville (Ybalrid) e42ba4e404 Only attempt to load the obj file if the obj_filename is defined in json
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:56 +01:00
Arthur Brainville (Ybalrid) cc4fd4be8e Small adjustment to the NanoSG readme
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:37 +01:00
Arthur Brainville (Ybalrid) f4fbee1cdf Add files to .gitignore
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:42:11 +01:00
Arthur Brainville 088aa0210f Fix where stb image is actually implemented
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:40:50 +01:00
Arthur Brainville (Ybalrid) 1340e62848 Setup CI for raytrace example
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-20 14:40:33 +01:00
Syoyo Fujita d800c88d09 Merge branch 'devel' of github.com:syoyo/tinygltf into devel 2018-02-19 19:28:17 +09:00
Syoyo Fujita ca8cfee824 Add link to Vulkan-glTF-PBR. 2018-02-19 18:05:47 +09:00
Arthur Brainville (Ybalrid) c9ec1ea7b6 Add a gltf_filename feild to the renderconfig struct
This is to get the filename that will be given to the gltf-loader

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 21:01:59 +01:00
Arthur Brainville (Ybalrid) adfe936dd3 Applyind clang-format on main.cc. Included gltf-loader
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 20:24:57 +01:00
Arthur Brainville (Ybalrid) e1e868a704 Move the implementation of stbi to it's own .cc file
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 20:09:24 +01:00
Arthur Brainville (Ybalrid) 75af411fda Build the tinygltf loader code
Also remove the implementation of STB-Image from obj-loader.cc

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 19:55:02 +01:00
Arthur Brainville (Ybalrid) 90ff6f7ce9 Make this code buildable as is
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 19:21:38 +01:00
Arthur Brainville (Ybalrid) c81be8f87d Add the current code of nanort + nanosg
This implementation will be based on commit
b31dc0bd92eb7ac896079849a2205fac4abbd087 from the nanort project

Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 19:16:16 +01:00
Arthur Brainville (Ybalrid) fb7ebb955e Remove old nanort/nanosg code. Keep the gltf-loader class on hand
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-18 19:13:57 +01:00
Syoyo Fujita c7ae1a3e76 Merge pull request #38 from o-micron/patch-2
Fix LoadImageData return value when error occurs
2018-02-10 16:53:00 +09:00
Omar C. F d492efc38a Fix return value when error occurs 2018-02-10 09:50:35 +02:00
Syoyo Fujita 568f05fec9 Merge pull request #37 from o-micron/patch-1
Add missing bmp and gif mimetypes
2018-02-10 16:11:35 +09:00
Omar C. F f8a8d9caa0 Add missing bmp and gif mimetypes 2018-02-10 09:09:41 +02:00
Syoyo Fujita 0d9a495fd1 Merge pull request #36 from Ybalrid/devel_add_gitignore
Add gitignore file
2018-02-02 00:57:32 +09:00
Arthur Brainville (Ybalrid) a62e955a52 Add gitignore file
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-02-01 15:38:34 +01:00
Syoyo Fujita 89cd83e22f Merge branch 'devel' of github.com:syoyo/tinygltf into devel 2018-01-21 12:20:00 +09:00
Syoyo Fujita 476a8b21b0 Set GL_DOUBLE value from OpenGL spec. Fixes #35. 2018-01-21 12:19:01 +09:00
Syoyo Fujita 05e0bf1cdc Suppress clang warnigns.
Refactor code to use C++11 features.
2018-01-16 18:55:13 +09:00
Syoyo Fujita f2aba36638 Add more note on Visual Studio version. 2018-01-11 14:06:10 +09:00
Syoyo Fujita 688236a3a8 Merge pull request #34 from Ybalrid/patch-1
Add language tags on code snippets in README
2018-01-10 20:52:24 +09:00
Arthur Brainville d93364e63f Add language tag on code snippets in README 2018-01-10 12:04:51 +01:00
Syoyo Fujita e3a7aef197 Describe note on Visual Studio version. 2018-01-10 18:32:51 +09:00
Syoyo Fujita 85ed1ac824 Merge pull request #33 from Ybalrid/CI_fix
Attempt to fix continuous integration (fix #31)
2018-01-10 18:30:45 +09:00
Arthur Brainville (Ybalrid) 760c1a5065 Change VS version to one that is better compatible with C++11
Signed-off by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-01-10 09:09:21 +01:00
Syoyo Fujita f0606e83d3 Merge pull request #32 from Ybalrid/narrowingConversionWarning
Silence a MSVC warning about narrowing conversion
2018-01-10 12:20:28 +09:00
Arthur Brainville 8ce4e54394 Silence a MSVC warning about narrowing conversion
We actually want to convert a size_t value into an int value in this
return statement.

Fix the annoying MSVC warning by actually casting the bytestride to an
int

Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-01-10 01:27:12 +01:00
Syoyo Fujita 45c29dc54d Update README of gltf-validator. 2018-01-09 14:28:16 +09:00
Syoyo Fujita 1b482fe0be Merge pull request #30 from Ybalrid/simplerMaterial
Simpler material data retreival
2018-01-09 12:19:03 +09:00
Arthur Brainville 9585391311 rename Color to ColorFactor
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-01-08 18:37:44 +01:00
Arthur Brainville 41fe772058 Const qualify const methods
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-01-08 18:32:48 +01:00
Arthur Brainville 5845319b1a Add little utility methods to access the content of a Parameter object
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-01-08 18:25:52 +01:00
Syoyo Fujita 1ebd29d84e Remove unnecessary text. 2018-01-05 20:21:27 +09:00
Syoyo Fujita f5318cc759 Describe more about C++ exception. 2018-01-05 20:17:37 +09:00
Syoyo Fujita 17cfbcc976 Fix argument to catch claus was wrong.
Add support to compile TinyGLTF with no C++ exception(TINYGLTF_NOEXCEPTION). Fixes #18.
Add initial unit tests.
2018-01-05 20:14:46 +09:00
Syoyo Fujita 584f8c0ddf Add method for computing byteStride to Accessor struct.
This would fix issue #29.
2018-01-03 17:47:08 +09:00
Syoyo Fujita 3ab8ee1f87 Add name of Adrien and many contributrors. 2017-12-31 18:36:02 +09:00
Syoyo Fujita daa726ec7c Merge pull request #28 from Ybalrid/devel
Create LICENSE file according to the terms of the MIT License agreement
2017-12-31 15:02:01 +09:00
Arthur Brainville 5194b47a16 Create LICENSE
This library is an awesome project, and I can imagine a lot of 3D application written in C++ would happily use it to load glTF assets ;-)

However, the license wasn't properly stated on the project. To actually put work under the term of the MIT license agreement, a copyright notice **needs** to be distributed alongside the source code.

It is also standard practice to add a warranty disclaimer. This prevent people to hold you liable if (at least they think) something doesn't work because of this library.

I took the liberty to put the file in place, with your full name as stated on your GitHub profile as the copyright holder. This is the text that states that you, the author, grants the to other people to use this as a free/open-source software, with all the thing that comes with it (access to source code, right to modify, redistribute, redistribute modified version, and use for any purpose they like) 

Sorry for the annoyance ^^"
2017-12-31 04:07:06 +00:00
Syoyo Fujita b66d68f3fb Report error message. 2017-12-19 18:45:22 +09:00
Syoyo Fujita 85591954ab Update README. 2017-12-19 18:29:34 +09:00
Syoyo Fujita dac2a89b63 Fix wrong return value(Fixes #26) 2017-12-19 17:58:32 +09:00
Syoyo Fujita 660256062b Update premake5.exe binary(5.0.0 alpha12). 2017-12-10 00:44:29 +09:00
Syoyo Fujita 87a76e1679 Merge branch 'patch-1' of https://github.com/cemdervis/tinygltf into cemdervis-patch-1 2017-12-10 00:39:52 +09:00
Syoyo Fujita 6bdd54f709 Rename premake config script. 2017-12-08 19:45:33 +09:00
Cemalettin Dervis f889d2b0dc Fixed typo ("RPEAT") 2017-12-07 21:58:15 +01:00
Cemalettin Dervis 246d866961 Fixed typo ("RPEAT") 2017-12-07 20:29:51 +01:00
Syoyo Fujita 06096520b8 Update README. 2017-12-03 17:26:25 +09:00
Syoyo Fujita aec35f10c0 Update README. 2017-12-03 17:19:55 +09:00
Syoyo Fujita 802b4df991 Merge branch 'validator' into jsoncpp 2017-12-03 17:17:03 +09:00
Syoyo Fujita 738a13ebf4 Use C++11 in Travis build and appveyor build. 2017-12-02 21:22:58 +09:00
Syoyo Fujita 7ce4a42fc3 Fix compilation. 2017-12-02 21:21:06 +09:00
Syoyo Fujita 0501a46612 Use C++11 flag. 2017-12-02 21:18:59 +09:00
Syoyo Fujita 836753132b Merge branch 'devel' into jsoncpp 2017-12-02 21:14:13 +09:00
Syoyo Fujita a415cf477c Add workaround for parsing glTF schemas 2017-11-25 19:55:28 +09:00
Syoyo Fujita e59de221ff Add json-schema-validator code. 2017-11-25 18:32:56 +09:00
Syoyo Fujita cd1ddf341d Describe supported platforms in README.
Better isnan/isinf availabity test(I guess).
2017-11-15 13:55:14 +09:00
Syoyo Fujita b23f6fe492 Fix compile on iOS. Fixes #24. 2017-11-15 01:03:09 +09:00
Syoyo Fujita 1657cf6a1d Merge pull request #23 from e-schrade/devel
Parse KHR_Lights_cmn extension
2017-11-08 01:56:08 +09:00
Emanuel Schrade 186322bed6 Parse KHR_Lights_cmn extension 2017-11-06 11:14:49 +01:00
Syoyo Fujita ef2f49ff19 User lowercase for Windows.h. Fixes #22. 2017-11-05 17:18:46 +09:00
Syoyo Fujita 2e21be7e19 Use json.hpp instead of picojson(W.I.P.) 2017-11-05 17:13:24 +09:00
Syoyo Fujita 57c1018f89 Improve error message. 2017-10-19 18:48:26 +09:00
Syoyo Fujita dfe8c70d9a Merge pull request #21 from thestr4ng3r/devel
Disable wordexp for Android
2017-09-23 00:07:20 +09:00
Florian Märkl d525e19582 Disable wordexp for Android 2017-09-22 15:25:48 +02:00
Syoyo Fujita 1aba9cf663 Merge pull request #20 from jianghaosen/devel
fix(row1728): accessor->normalize is a local variables and forget ini…
2017-08-29 22:29:57 +09:00
jianghaosen 4748ad61c0 fix(row1728): accessor->normalize is a local variables and forget initial it. Beside, the value of p
accessor->normalize is a local variables and forget initial it, it may be true or false. Beside, the
value of parse glTF do not assign to normalize.
2017-08-29 20:08:37 +08:00
Syoyo Fujita 1065728429 Remove installing cpp-coverage tool 2017-08-26 17:05:05 +09:00
Syoyo Fujita dadcfa5306 Merge pull request #19 from jianghaosen/devel
fix(row926): a bug that filename is empty when parse glb
2017-08-26 17:03:58 +09:00
jianghaosen b721fb76c6 fix(row926): a bug that filename is empty when parse glb
when parse glb, filename maybe a empty value, it will be wrong
2017-08-25 21:01:17 +08:00
Syoyo Fujita 59130d1a19 Check if JSON element is valid JSON object or not. Now all fuzz input passes. Fixes #16. 2017-08-01 20:23:11 +09:00
Syoyo Fujita cdf849061c Wrap picojson::parse with exception clause to catch JSON parsing error. 2017-08-01 20:12:08 +09:00
Syoyo Fujita 2b0307f397 Hardened parsing and solved some issue found by fuzzer(issue 16). 2017-08-01 18:15:52 +09:00
Syoyo Fujita 9c0c665eb4 Fix config setting. 2017-07-23 19:21:04 +09:00
Syoyo Fujita cd5c5f0ea0 Add codes for raytrace example(W.I.P.) 2017-07-23 19:11:39 +09:00
Syoyo Fujita c0beef73a1 Update travis badge URL. 2017-07-14 01:15:34 +09:00
Syoyo Fujita 259c9b2802 Update README. 2017-07-13 18:23:29 +09:00
Syoyo Fujita 7b6edab3a9 Initial support of parsing/serializing Camera. 2017-07-13 18:20:14 +09:00
Syoyo Fujita 06402256c7 Remove binary extension since glTF 2.0 supports binary format in native manner. 2017-07-13 01:28:55 +09:00
Syoyo Fujita d9d012a5df Accessor.min and Accessor.max are now optional parameter.
Set BufferView.byteStride default value to 0(= tightly packed). Fixes #13.
2017-07-12 18:29:29 +09:00
Syoyo Fujita 965071b309 Merge pull request #12 from Teybeo/devel
Update Readme.md
2017-07-12 15:28:18 +09:00
Teybeo 9ec8137dd0 Update Readme.md 2017-07-09 20:45:28 +02:00
Syoyo Fujita 168d0595ef Remove Accessor.byteStride. 2017-07-03 00:56:16 +09:00
Syoyo Fujita 822788921e Delete Accessor.byteStride field which was removed in glTF 2.0 spec. 2017-06-26 17:54:34 +09:00
Syoyo Fujita a12620f378 Fix bufferView.byteStride is read into byteLength property. Fixes #9 2017-06-24 20:57:05 +09:00
Syoyo Fujita 06a2be8d9d Merge branch 'devel' of github.com:syoyo/tinygltf into devel 2017-06-23 00:26:14 +09:00
Syoyo Fujita 4df5f94eb7 Fix appveyor script. 2017-06-23 00:24:24 +09:00
Syoyo Fujita 72d5af4d9e Merge pull request #8 from soma-arc/fix-naming
Fix file/define/class name referenced in glview
2017-06-23 00:23:54 +09:00
soma_arc 74a94f5068 Fix file/define/class name referenced in glview 2017-06-22 13:34:53 +09:00
Syoyo Fujita 2840a0eb48 Rename filename/define/class name. 2017-06-21 02:52:11 +09:00
Syoyo Fujita 73cd7b9c1d Fix build on Visual Studio. 2017-06-20 03:02:57 +09:00
Syoyo Fujita 9a1ea7e300 Merge branch 'feature/serialize-gltf' of https://github.com/sketchfab/tinygltf into sketchfab-feature/serialize-gltf 2017-06-20 02:17:28 +09:00
Aurélien Chatelain cc8ba99179 Adds serialization functions 2017-06-19 14:32:27 +00:00
Aurélien Chatelain 756ee6ba4d Adds extensionsRequired object 2017-06-19 14:32:27 +00:00
Aurélien Chatelain 8d5e0a75e8 Fixes typos and useless data 2017-06-19 14:32:27 +00:00
Aurélien Chatelain 2682c6fb4b Fixes morph targets parsing 2017-06-19 14:32:24 +00:00
Syoyo Fujita 168da25539 Update build script. 2017-06-05 01:58:26 +09:00
Syoyo Fujita 5b40745f7a Remove unused examples.
Refactor source code.
2017-06-04 17:42:41 +09:00
Syoyo Fujita 4ebd5a9f82 Merge pull request #2 from sketchfab/devel
Devel
2017-05-31 00:17:45 +09:00
Syoyo Fujita 2fb2f92997 Merge pull request #3 from syoyo/revert-1-feature/update-tinygltf-20
Revert "Feature/update tinygltf 20"
2017-05-31 00:17:29 +09:00
Syoyo Fujita 08c9d25629 Revert "Feature/update tinygltf 20" 2017-05-31 00:16:45 +09:00
Syoyo Fujita 80249464ae Merge pull request #1 from sketchfab/feature/update-tinygltf-20
Feature/update tinygltf 20
2017-05-31 00:16:15 +09:00
Aurélien Chatelain 6d3bfd7e1b Fix image parsing (2.0) 2017-05-30 15:04:35 +00:00
Aurélien Chatelain 0aab1575d5 Update buffer parsing (2.0) 2017-05-30 15:03:57 +00:00
Syoyo Fujita 40c4a0a60a Update binary glTF header check(Reading binary glTF is still in progress) 2017-05-30 01:21:36 +09:00
Syoyo Fujita d7ec19c3dc Fix Animation dumper. 2017-05-30 00:52:00 +09:00
Syoyo Fujita 90e1ed21bc byteOffset in Accessor and BufferViews are optional; 2017-05-30 00:47:37 +09:00
Syoyo Fujita d17ff66b3d BufferView.byteOffset is optional(default = 0). 2017-05-29 02:53:12 +09:00
Syoyo Fujita d941f6d1eb Update test runner. 2017-05-29 02:20:05 +09:00
Syoyo Fujita e01fc67380 Merge branch 'devel' of github.com:syoyo/tinygltf into devel 2017-05-28 01:21:32 +09:00
Syoyo Fujita e4ef6c070c Upadate README. 2017-05-28 01:20:59 +09:00
Syoyo Fujita b7f71e6786 Upadate README. 2017-05-28 01:20:05 +09:00
Syoyo Fujita 2d8edf5c8b Merge branch 'sketchfab-feature/update-tinygltf-20' into devel 2017-05-27 23:57:04 +09:00
Syoyo Fujita 1866e11237 Add Cube test model. 2017-05-27 23:55:32 +09:00
Syoyo Fujita f612015ac2 Keep up with loader_example.cc
Update picojson.h
2017-05-27 23:51:23 +09:00
Syoyo Fujita 2057b1ae6e Merge branch 'feature/update-tinygltf-20' of https://github.com/sketchfab/tinygltf into sketchfab-feature/update-tinygltf-20 2017-05-26 02:16:49 +09:00
Syoyo Fujita c8d3c76bb1 Sync with tinygltfloader 2017-05-25 01:42:38 +09:00
Aurélien Chatelain 38a6a7565c Supports glTF morph (glTF 2.0, not tested) 2017-05-24 13:48:10 +00:00
Aurélien Chatelain 8cb98950ff Supports glTF skinning (glTF 2.0) 2017-05-24 13:48:10 +00:00
Aurélien Chatelain 5cb4346a32 Adds workaround for unsupported images 2017-05-24 13:48:10 +00:00
Aurélien Chatelain d48bbdcd90 Updates asset object (glTF 2.0) 2017-05-24 13:48:10 +00:00
Aurélien Chatelain ab7b218385 Updates materials (glTF 2.0)
glTF 2.0 has now PBR materials.
Core material is Metallic/Roughness material
Specular/glossiness is still in an extension

Material properties can be number arrays (colors/factors) or JSON objects (textures)
2017-05-24 13:48:10 +00:00
Aurélien Chatelain a25e495fd9 Updates camera object (glTF 2.0) 2017-05-24 13:48:10 +00:00
Aurélien Chatelain ee4693e3a1 Supports glTF 2.0 schema
- Renaming 'Scene' to 'Model' to avoid confusion
- glTF top objects are now arrays, and objects are referenced by index instead of id
- added a few comments (required)
- default values
2017-05-24 13:48:10 +00:00
Aurélien Chatelain f4f4ae4d89 Removes Technique/Shader/Program support (glTF 2.0) 2017-05-24 13:47:58 +00:00
Syoyo Fujita 36289fb59f Merge pull request #15 from missmah/master
Possible fix for child values not being properly deserialized
2017-05-08 15:16:44 +09:00
Layla 1dbfe0ee13 Possible fix for child values not being properly deserialized.
* Add the child_value parsed by ParseObjectProperty to the return value

The omission of adding child_value to the return object appears to have been an oversight, as it is the only case where the parsed value is not added, and because child_value is otherwise unreferenced.

This change also does give us the value that we are expecting in our use case after loading our glTF.

Was this an oversight or an intentional omission?
2017-05-07 16:56:55 -04:00
Syoyo Fujita 6158f3489e Update README. 2016-11-25 01:26:21 +09:00
Syoyo Fujita 036166d121 Do not emit empty Curves primitive. 2016-11-25 01:22:02 +09:00
Syoyo Fujita bb3884e04e Update README. 2016-11-24 18:28:49 +09:00
Syoyo Fujita 87dc2753da Merge branch 'master' of github.com:syoyo/tinygltfloader 2016-11-24 18:21:18 +09:00
Syoyo Fujita 6df009e737 Update README. 2016-11-24 17:56:56 +09:00
Syoyo Fujita b083093db4 Show geomeric normal for mesh object. 2016-11-24 17:55:20 +09:00
Syoyo Fujita 025c880879 Fix nodes emission. 2016-11-24 17:42:18 +09:00
Syoyo Fujita 6239faff48 Fix draw length for GL_LINES. 2016-11-24 17:41:44 +09:00
Syoyo Fujita af4109e6e3 Update glTF sample model repo path. 2016-11-24 16:20:57 +09:00
Syoyo Fujita 4be2f888f7 Fix memory leak of stb_image data. 2016-11-24 16:20:34 +09:00
Syoyo Fujita 15eb9bdf67 Initial support of node hierarchy. 2016-11-24 03:10:02 +09:00
Syoyo Fujita dfb87ab0b9 Fix nodes generation. 2016-11-24 03:09:43 +09:00
Syoyo Fujita b15a26e357 Fix mouse button state management. 2016-11-23 21:41:53 +09:00
Syoyo Fujita cb0f560fbd Compute geometric normal. 2016-11-23 21:40:57 +09:00
Syoyo Fujita dfab1f7c5d Emit "name" for each "mesh" object. 2016-11-23 18:27:19 +09:00
Syoyo Fujita 8598af65b0 Rename function. 2016-11-23 18:26:49 +09:00
Syoyo Fujita 67fa87c18d Comented debug printf. 2016-11-23 18:22:04 +09:00
Syoyo Fujita b21b24e072 Initial support of node hierarchy. 2016-11-23 17:59:17 +09:00
Syoyo Fujita 9e2f479270 Improve UI for one-button mouse. 2016-11-23 17:45:35 +09:00
Syoyo Fujita 7aa09d1c1d Fix gltf semantic. 2016-11-23 02:13:55 +09:00
Syoyo Fujita 814b3fce56 Fix gltf gen(WIP). 2016-11-23 01:42:51 +09:00
Syoyo Fujita 8ffc4e400d Refactor scene graph(WIP). 2016-11-22 20:14:42 +09:00
Syoyo Fujita 29d4dc5247 Start to add node hierarchy support(W.I.P.) 2016-11-22 17:54:47 +09:00
Syoyo Fujita 3890ae276a Refactor class. 2016-11-21 19:29:04 +09:00
Syoyo Fujita 5442071f99 Update README. 2016-10-25 01:48:44 +09:00
Syoyo Fujita de004dfe0d Newline 2016-10-25 01:45:10 +09:00
Syoyo Fujita f847e74d4d Add screenshot of cyhair. 2016-10-25 01:44:19 +09:00
Syoyo Fujita 3b17371648 Add cyhair2gltf converter. 2016-10-25 01:30:40 +09:00
Syoyo Fujita 72f3f77840 Update doc. 2016-10-18 21:16:34 +09:00
Syoyo Fujita ebce2521b2 Initial GL rendering support of curves primitive(render as GL_LINES). 2016-10-18 20:39:33 +09:00
Syoyo Fujita 8038965d33 Fix typo(extra -> extras)
Add some curves support to glview.
2016-10-17 20:00:19 +09:00
Syoyo Fujita a5e63705a3 Remove GL_TRINANGLES restriction for mode in primitive parameter. 2016-10-17 18:05:42 +09:00
Syoyo Fujita 7680abf54d Remove inttypes dependency in TinyGLTFLoader header definition. 2016-10-17 18:02:45 +09:00
Syoyo Fujita f3447a236b Fix build on some compilers. 2016-10-17 13:18:08 +09:00
Syoyo Fujita f696c6f188 Initial support of "extras" property.
Change license from BSD to MIT.
2016-10-17 03:48:55 +09:00
Syoyo Fujita 1db9a358a7 Initial support of converting Alembic curve to .gltf. 2016-10-15 20:12:23 +09:00
Syoyo Fujita c39d93879a Merge branch 'master' of github.com:syoyo/tinygltfloader 2016-10-14 19:00:58 +09:00
Syoyo Fujita e08ef2fbd5 Initial working abc2gltf converter. 2016-10-14 18:50:33 +09:00
Syoyo Fujita 0614eb8fa6 Improve error messsage a bit. 2016-10-14 18:50:14 +09:00
Syoyo Fujita f91a3b7f0e Initial abc -> gltf converter. 2016-10-13 16:48:53 +09:00
Syoyo Fujita 8d6fc9ece6 W.I.P. alembic to gltf converter. 2016-10-11 01:41:08 +09:00
Syoyo Fujita 0976b09d4f Merge pull request #12 from r-lyeh/master
Fix .glb loading (Windows)
2016-08-30 14:45:43 +09:00
r-lyeh 66c1063995 Fix .glb loading (Windows)
Fixes loading of https://github.com/KhronosGroup/glTF/blob/master/sampleModels/Duck/glTF-Binary/Duck.glb
2016-08-29 16:56:18 +02:00
Syoyo Fujita d112d0969d Merge pull request #11 from lukesanantonio/texture-wrap-fix
Use correct value for TEXTURE_WRAP_MIRRORED_REPEAT
2016-08-20 15:20:09 +09:00
Luke San Antonio Bialecki 904612cd23 Use correct value for TEXTURE_WRAP_MIRRORED_REPEAT 2016-08-19 17:28:03 -04:00
Syoyo Fujita fcaacde94c Pretty print output JSON. 2016-07-20 20:00:34 +09:00
Syoyo Fujita 5d8c5c832b Merge pull request #10 from lukesanantonio/feature-conditional-section-checking
Support conditional checking of glTF sections
2016-06-24 12:44:47 +09:00
Syoyo Fujita 90f6ccb55b Merge pull request #9 from lukesanantonio/feature-texture-formats
Add macros for more texture formats
2016-06-24 12:44:35 +09:00
Syoyo Fujita b209c29d39 Merge pull request #8 from lukesanantonio/fix-empty-file-segfault
Prevent a segfault when loading an empty file
2016-06-24 12:44:11 +09:00
Luke San Antonio 9e36b61ed5 Support conditional checking of glTF sections 2016-06-23 15:16:21 -04:00
Luke San Antonio b310b4a32e Prevent a segfault when loading an empty file
If the size of the file is zero, we just signal an error and return false.
2016-06-23 15:15:07 -04:00
Luke San Antonio 6d616f5f06 Add macros for more texture formats 2016-06-23 14:33:54 -04:00
Syoyo Fujita cf6e07b1ec Suppress clang compiler warnings. 2016-06-21 21:18:12 +09:00
Syoyo Fujita c261563b0b Parse sampler 2016-06-19 21:56:06 +09:00
Syoyo Fujita 10c55cc3b5 Update TODO 2016-06-19 18:19:09 +09:00
Syoyo Fujita 8c5ab0344f Initial support of animation. 2016-06-19 18:16:10 +09:00
Syoyo Fujita 330f6da818 Small fix on README. 2016-06-17 00:36:45 +09:00
Syoyo Fujita 5bab26d37e Merge pull request #7 from lukesanantonio/master
Print shaders, programs, and techniques in loader_example.cc
2016-06-16 13:41:37 +09:00
Luke San Antonio 5415f413b8 Print shaders, programs, and techniques in loader_example.cc
This changes the way parameters for materials and techniques are
printed. Now only one of either the number array or string value will be
printed. Before, both would be printed with the same name being used.
2016-06-15 14:11:55 -04:00
Syoyo Fujita 3cdfb3bd07 Support loading binary shader source data for binary glTF. 2016-06-15 20:58:42 +09:00
Syoyo Fujita 4904852e4e Merge branch 'master' of github.com:syoyo/tinygltfloader 2016-06-15 20:44:19 +09:00
Syoyo Fujita 36c718386c Update README.
Fix exec name in test_runner.py
2016-06-15 15:48:18 +09:00
Syoyo Fujita 92cb3d9c4d Merge pull request #5 from lukesanantonio/feature_technique
Support shaders, programs, and techniques
2016-06-15 15:35:07 +09:00
Syoyo Fujita 7b91552bb1 Merge pull request #6 from lukesanantonio/master
Only use valid (triangle) primitive sets
2016-06-15 15:33:13 +09:00
Luke San Antonio caa24b0513 Support plain text data URIs 2016-06-15 02:23:09 -04:00
Luke San Antonio 10a3e1da81 Only use valid (triangle) primitive sets
ParsePrimitive returns false immediately on error but the return value
wasn't being checked in ParseMesh so invalid / uninitialized primitives
were being added to the mesh.
2016-06-15 02:15:23 -04:00
Luke San Antonio da8b5d148c Add newline to error messages in LoadExternalFile 2016-06-14 22:52:06 -04:00
Luke San Antonio cdf4cb79ed Add support for shaders, programs, and techniques 2016-06-14 22:51:53 -04:00
Luke San Antonio 19894c7806 Add function to parse string dictionaries
A string dictionary in the glTF spec is called a "dictionary object of
strings." For example: mesh.primitives.attributes, technique.attributes,
and technique.uniforms.
2016-06-14 22:47:50 -04:00
Syoyo Fujita a5c15e9e76 Merge branch 'master' of github.com:syoyo/tinygltfloader 2016-06-11 16:33:46 +09:00
Syoyo Fujita 89ac0b45cb Update README. 2016-06-11 16:33:32 +09:00
Syoyo Fujita 8317ffbe8a Improve windows build.
Don't report error when `in_normal` is not used in the shader.
2016-06-11 16:10:39 +09:00
Syoyo Fujita 9a478238c7 Format source. 2016-06-06 01:26:57 +09:00
Syoyo Fujita 0a3b09f33e Initial glTF writer example(W.I.P). 2016-06-06 01:26:18 +09:00
Syoyo Fujita 064d177448 Print warning when bufferView.target == 0. 2016-06-06 01:20:52 +09:00
Syoyo Fujita d286bd9ac0 Print bufferView.target. 2016-06-06 01:20:32 +09:00
Syoyo Fujita b37b7de27c Retinal display fix for glview. 2016-06-05 22:35:37 +09:00
Syoyo Fujita e04b1b56d8 Add error check for scenes property. 2016-06-05 22:31:20 +09:00
Syoyo Fujita fbc6118c6a Missing indices print. 2016-06-05 22:17:19 +09:00
Syoyo Fujita 8c6774c6db Suppress VS2015 warning. 2016-05-01 20:36:29 +09:00
Syoyo Fujita 6fd9162ed0 Make some compiler happy. 2016-05-01 20:27:30 +09:00
Syoyo Fujita beded611b7 Initial support of loading binary glTF(.glb). 2016-05-01 20:03:43 +09:00
Syoyo Fujita ec39a523c2 Merge branch 'master' of github.com:syoyo/tinygltfloader
Conflicts:
	tiny_gltf_loader.h
2016-05-01 18:33:31 +09:00
Syoyo Fujita 643ce10979 Suppress clang warnings for external code. 2016-05-01 17:19:37 +09:00
Syoyo Fujita 5eebbdc87c Suppress VC2015 warnings. 2016-04-20 14:13:08 +09:00
Syoyo Fujita 523c9bfbc2 Apply cpplint.
Use Google C++ style.
2016-04-20 14:06:56 +09:00
Syoyo Fujita 46ae360e15 Update test.cc 2016-03-18 00:55:21 +09:00
Syoyo Fujita e1bef8cacb Apply cpplint and format source code. 2016-03-17 21:31:13 +09:00
Syoyo Fujita 41426b6134 Merge branch 'master' of github.com:syoyo/tinygltfloader 2016-03-11 00:42:31 +09:00
Syoyo Fujita 719315f5f4 Disable ASAN for clang 3.7. 2016-03-11 00:41:49 +09:00
Syoyo Fujita 5bc17bdf5f Merge pull request #2 from dgough/master
Fixed loading child nodes
2016-03-08 17:11:12 +09:00
Darryl Gough bc9f2b2544 Fixed loading child nodes
Fixed a bug that was preventing child nodes from being loaded.
2016-03-08 00:19:40 -05:00
Syoyo Fujita 7c87797176 Refactor source code.
Add compiler matrix in Travis build.
2016-03-08 01:31:49 +09:00
Syoyo Fujita c4bc323c0e Update README. 2016-02-07 17:46:55 +09:00
Syoyo Fujita e9a0cd9210 Update screen shot. 2016-02-07 17:45:17 +09:00
Syoyo Fujita bde7021b94 texture support. 2016-02-07 17:38:17 +09:00
Syoyo Fujita b495603c67 Update README. 2016-02-06 17:28:42 +09:00
Syoyo Fujita 61fb52b57d Support loading glTF from memory(string). 2016-02-06 17:26:44 +09:00
Syoyo Fujita d8959696c0 Merge branch 'master' of github.com:syoyo/tinygltfloader 2016-01-02 23:42:55 +09:00
Syoyo Fujita 620eed154b Add image/jpeg and image/png MIME support.
Add simple unit test runner.
2016-01-02 23:37:12 +09:00
Syoyo Fujita 582226ac48 Add travis badge. 2015-12-21 11:56:54 +09:00
Syoyo Fujita 44430496d2 Add travis script. 2015-12-21 11:54:36 +09:00
Syoyo Fujita ed4d7ad34b Add box.gltf. 2015-12-21 11:50:21 +09:00
Syoyo Fujita ba26657a01 Use GLFW_INCLUDE_GLU 2015-12-21 11:48:32 +09:00
Syoyo Fujita f6a31fa22e Update appveyor yaml. 2015-12-21 01:23:00 +09:00
Syoyo Fujita ad9ef023ea Add AppVeyor badge. 2015-12-21 01:22:12 +09:00
Syoyo Fujita 47de00b91f Fix markdown. 2015-12-21 01:21:03 +09:00
Syoyo Fujita c717f1859f Add appveyor file. 2015-12-21 01:20:35 +09:00
1451 changed files with 21714 additions and 132212 deletions
-13
View File
@@ -1,13 +0,0 @@
# These are supported funding model platforms
github: syoyo
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
-1
View File
@@ -1 +0,0 @@
blank_issues_enabled: false
-30
View File
@@ -1,30 +0,0 @@
---
name: Issue report
about: Create a report
title: ''
labels: ''
assignees: ''
---
**Describe the issue**
A clear and concise description of what the issue is.
**To Reproduce**
- OS
- Compiler, compiler version, compile options
- Please attach minimal and reproducible .glTF file if you got an issue related to .glTF data
**Expected behaviour**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
-45
View File
@@ -1,45 +0,0 @@
## Description
What does this PR do? Provide a brief summary of the changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Refactoring (no functional changes)
- [ ] Documentation update
- [ ] Other (please describe):
## Checklist
### Required for All PRs
- [ ] Reproducible glTF test file(s) are included (e.g., `models/regression/`, `tests/issue-***.gltf`, etc.)
- [ ] Unit tests are written and pass locally (`cd tests && make run`)
### Required for Feature PRs
- [ ] Specification document is included (e.g., `docs/spec/<feature-name>.md`)
- The spec should cover: purpose, API design, usage examples, and edge cases
### Security Policy
This project manages CVE assignments exclusively through GitHub Security Advisories.
PRs that include or reference independently obtained CVE IDs or external vulnerability disclosures will be closed.
## Test Instructions
How can reviewers verify your changes?
```
# Example:
cd build && cmake .. && make test
```
## Related Issues
Link related issues:
## Additional Notes
Any other context, screenshots, or information relevant to the review.
-68
View File
@@ -1,68 +0,0 @@
name: C/C++ CI
on: [push, pull_request]
jobs:
# compile with mingw gcc cross
build-mingw-cross:
runs-on: ubuntu-latest
name: Build v3 C tests with MinGW gcc cross
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build
run: |
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y mingw-w64
cd tests
x86_64-w64-mingw32-gcc -I../ -std=c11 -DTINYGLTF3_ENABLE_FS -o tester_v3_c.exe tester_v3_c.c ../tiny_gltf_v3.c
# Windows(x64) + MSVC build (VS version agnostic: msvc-dev-cmd locates
# whatever Visual Studio the runner image ships, e.g. VS2022 or VS2026)
build-windows-msvc:
runs-on: windows-latest
name: Build v3 C tests on Windows(x64, MSVC)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: cmake -B build -G Ninja -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build
- name: Run tests
run: ctest --test-dir build --output-on-failure
build-linux:
runs-on: ubuntu-latest
name: Build v3 C tests with gcc
steps:
- uses: actions/checkout@v5
- name: build
run: |
cd tests
cc -I../ -std=c11 -g -O0 -DTINYGLTF3_ENABLE_FS -o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c
- name: test
run: |
./tests/tester_v3_c models/Cube/Cube.gltf
- name: tests
run: |
cd tests
make all
./tester_v3_c
./tester_v3_c_v1port
./tester_v3_json_c
./tester_v3_freestanding
cd ..
-389
View File
@@ -1,389 +0,0 @@
name: Comprehensive CI
on:
push:
branches:
- master
- release
- devel
pull_request:
branches:
- master
- release
- devel
workflow_dispatch:
permissions:
contents: read
jobs:
# Linux x64 - GCC
linux-gcc-x64:
runs-on: ubuntu-latest
name: Linux x64 (GCC)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure
run: cmake -B build -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build
- name: Run tester_v3_c on a sample model
run: ./build/tester_v3_c models/Cube/Cube.gltf
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Linux x64 - Clang 21
linux-clang-x64:
runs-on: ubuntu-24.04
name: Linux x64 (Clang 21)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Clang 21
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21
- name: Configure
run: |
cmake -B build -DCMAKE_C_COMPILER=clang-21 -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build
- name: Run tester_v3_c on a sample model
run: ./build/tester_v3_c models/Cube/Cube.gltf
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Linux ARM64 - GCC (native)
linux-arm64:
runs-on: ubuntu-24.04-arm
name: Linux ARM64 (GCC)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure
run: cmake -B build -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build
- name: Run tester_v3_c on a sample model
run: ./build/tester_v3_c models/Cube/Cube.gltf
- name: Run tests
run: ctest --test-dir build --output-on-failure
# macOS ARM64 Apple Silicon
macos-arm64:
runs-on: macos-14
name: macOS ARM64 Apple Silicon (Clang)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure
run: cmake -B build -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build
- name: Run tester_v3_c on a sample model
run: ./build/tester_v3_c models/Cube/Cube.gltf
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Windows x64 - MSVC (VS version agnostic; msvc-dev-cmd locates the
# Visual Studio shipped with the runner image, e.g. VS2022 or VS2026)
windows-msvc-x64:
runs-on: windows-latest
name: Windows x64 (MSVC)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: cmake -B build -G Ninja -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build
- name: Run tester_v3_c on a sample model
run: |
.\build\tester_v3_c.exe models\Cube\Cube.gltf
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Windows MinGW - MSYS2
windows-mingw-msys2:
runs-on: windows-latest
name: Windows x64 (MinGW MSYS2)
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: base-devel
pacboy: >-
cc:p cmake:p ninja:p
update: true
release: false
- name: Build with CMake
run: |
cmake -G"Ninja" -S . -B build -DTINYGLTF3_BUILD_TESTS=ON
cmake --build build
- name: Run tester_v3_c on a sample model
run: |
./build/tester_v3_c models/Cube/Cube.gltf
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Linux -> Windows MinGW Cross-compile
linux-mingw-cross:
runs-on: ubuntu-latest
name: Linux→Windows (MinGW Cross) - Build Only
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install MinGW
run: |
sudo apt-get update
sudo apt-get install -y build-essential mingw-w64
- name: Build
run: |
cd tests
x86_64-w64-mingw32-gcc -I../ -std=c11 -g -O0 -DTINYGLTF3_ENABLE_FS -o tester_v3_c.exe tester_v3_c.c ../tiny_gltf_v3.c
# v3 C tests through Meson on the primary desktop platforms.
v3-c-meson:
runs-on: ${{ matrix.os }}
name: v3 C Meson (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Meson
run: python -m pip install meson ninja
- name: Configure
run: meson setup build-meson -Dtests=true
- name: Build
run: meson compile -C build-meson
- name: Run v3 C tests
run: meson test -C build-meson --print-errorlogs
# v3 C runtime: internal security regression tests + ported v1 unit tests.
v3-c-tests:
runs-on: ubuntu-latest
name: v3 C tests (Linux x64, GCC)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build tester_v3_c
run: |
cd tests
cc -I../ -std=c11 -g -O0 -Wall -Wextra -Wpedantic -Werror -DTINYGLTF3_ENABLE_FS \
-o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c
- name: Build tester_v3_c_v1port
run: |
cd tests
cc -I../ -std=c11 -g -O0 -Wall -Wextra -Wpedantic -Werror -DTINYGLTF3_ENABLE_FS \
-o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c
- name: Run tester_v3_c (security regressions)
run: |
cd tests
./tester_v3_c
- name: Run tester_v3_c_v1port (ported unit tests)
run: |
cd tests
./tester_v3_c_v1port
# v3 C runtime under stock Ubuntu clang.
v3-c-tests-clang:
runs-on: ubuntu-latest
name: v3 C tests (Linux x64, Clang)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install clang
run: |
sudo apt-get update
sudo apt-get install -y clang
- name: Build tester_v3_c
run: |
cd tests
clang -I../ -std=c11 -g -O0 -Werror -Weverything \
-Wno-padded -Wno-unsafe-buffer-usage -Wno-switch-default \
-Wno-format-nonliteral -Wno-float-equal -Wno-cast-align \
-Wno-declaration-after-statement -Wno-unknown-warning-option \
-Wno-pre-c11-compat \
-DTINYGLTF3_ENABLE_FS \
-o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c
- name: Build tester_v3_c_v1port
run: |
cd tests
clang -I../ -std=c11 -g -O0 -Werror -Weverything \
-Wno-padded -Wno-unsafe-buffer-usage -Wno-switch-default \
-Wno-format-nonliteral -Wno-float-equal -Wno-cast-align \
-Wno-declaration-after-statement -Wno-unknown-warning-option \
-Wno-pre-c11-compat \
-DTINYGLTF3_ENABLE_FS \
-o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c
- name: Run tester_v3_c
run: |
cd tests
./tester_v3_c
- name: Run tester_v3_c_v1port
run: |
cd tests
./tester_v3_c_v1port
# v3 C runtime under bleeding-edge clang 21 (matches local dev environment).
v3-c-tests-clang21:
runs-on: ubuntu-24.04
name: v3 C tests (Linux x64, Clang 21)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install clang 21
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21
- name: Build tester_v3_c
run: |
cd tests
clang-21 -I../ -std=c11 -g -O0 -Werror -Weverything \
-Wno-padded -Wno-unsafe-buffer-usage -Wno-switch-default \
-Wno-format-nonliteral -Wno-float-equal -Wno-cast-align \
-Wno-declaration-after-statement -Wno-unknown-warning-option \
-Wno-pre-c11-compat \
-DTINYGLTF3_ENABLE_FS \
-o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c
- name: Build tester_v3_c_v1port
run: |
cd tests
clang-21 -I../ -std=c11 -g -O0 -Werror -Weverything \
-Wno-padded -Wno-unsafe-buffer-usage -Wno-switch-default \
-Wno-format-nonliteral -Wno-float-equal -Wno-cast-align \
-Wno-declaration-after-statement -Wno-unknown-warning-option \
-Wno-pre-c11-compat \
-DTINYGLTF3_ENABLE_FS \
-o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c
- name: Run tester_v3_c
run: |
cd tests
./tester_v3_c
- name: Run tester_v3_c_v1port
run: |
cd tests
./tester_v3_c_v1port
# v3 C runtime built with MSVC at warning-level 4 (/W4 /WX).
v3-c-tests-msvc:
runs-on: windows-latest
name: v3 C tests (Windows x64, MSVC /W4)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Build and run tester_v3_c
shell: cmd
run: |
cd tests
cl /nologo /W4 /WX /std:c11 /Zi /Od /D_CRT_SECURE_NO_WARNINGS /DTINYGLTF3_ENABLE_FS /I.. tester_v3_c.c ..\tiny_gltf_v3.c /Fe:tester_v3_c.exe
tester_v3_c.exe
- name: Build and run tester_v3_c_v1port
shell: cmd
run: |
cd tests
cl /nologo /W4 /WX /std:c11 /Zi /Od /D_CRT_SECURE_NO_WARNINGS /DTINYGLTF3_ENABLE_FS /I.. tester_v3_c_v1port.c ..\tiny_gltf_v3.c /Fe:tester_v3_c_v1port.exe
tester_v3_c_v1port.exe
# v3 C runtime under ASan + UBSan for memory-safety + UB checks.
v3-c-tests-sanitizers:
runs-on: ubuntu-latest
name: v3 C tests (Clang ASan + UBSan)
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build tester_v3_c with ASan + UBSan
run: |
cd tests
clang -I../ -std=c11 -g -O1 -DTINYGLTF3_ENABLE_FS \
-fsanitize=address,undefined -fno-omit-frame-pointer \
-o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c
- name: Build tester_v3_c_v1port with ASan + UBSan
run: |
cd tests
clang -I../ -std=c11 -g -O1 -DTINYGLTF3_ENABLE_FS \
-fsanitize=address,undefined -fno-omit-frame-pointer \
-o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c
- name: Run tester_v3_c
env:
ASAN_OPTIONS: detect_leaks=1:halt_on_error=1
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
run: |
cd tests
./tester_v3_c
- name: Run tester_v3_c_v1port
env:
ASAN_OPTIONS: detect_leaks=1:halt_on_error=1
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
run: |
cd tests
./tester_v3_c_v1port
-53
View File
@@ -1,53 +0,0 @@
name: MSYS2 MinGW-w64 Windows 64bit Build
on:
push:
branches:
- release
- devel
paths:
- 'tiny_gltf.*'
- 'tinygltf_json_c.h'
- 'CMakeLists.txt'
- 'meson.build'
- 'meson_options.txt'
- 'tests/tester_v3*.c'
- '.github/workflows/mingw-w64-msys2.yml'
pull_request:
workflow_dispatch:
jobs:
mingw-w64-msys2-build:
name: MSYS2 MinGW-w64 Windows Build
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v5
- name: Install core & build dependencies
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: base-devel
pacboy: >-
cc:p cmake:p ninja:p
update: true
release: false
- name: Configure
run: |
cmake \
-G"Ninja" \
-S . \
-B build \
-DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: |
cmake --build build
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
+2 -23
View File
@@ -1,5 +1,4 @@
# CMake
/build/
CMakeCache.txt
CMakeFiles
CMakeScripts
@@ -22,13 +21,9 @@ premake5.tar.gz
*.vcxproj*
.vs
# default cmake build dir
build/
#binary directories
bin/
obj/
out/
#runtime gui config
imgui.ini
@@ -70,22 +65,6 @@ imgui.ini
*.app
loader_example
# Compiled test binaries (built by tests/Makefile, CMakeLists.txt, meson.build)
tests/tester_v3
tests/tester_v3_c
tests/tester_v3_c_cpp
tests/tester_v3_c_v1port
tests/tester_v3_c_v1port_cpp
tests/tester_v3_freestanding
tests/tester_v3_json_c
tests/v3/fuzzer/fuzz_gltf_v3
tests/v3/fuzzer/fuzz_gltf_v3_c
tests/tester
tests/tester_noexcept
# Generated by web/Makefile (make / make sample)
web/tinygltf_v3.js
web/tinygltf_v3.wasm
web/Cube.glb
# unignore
!Makefile
!tests/Makefile
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
brew upgrade
curl -o premake5.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-macosx.tar.gz
else
wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake5.tar.gz
fi
tar xzf premake5.tar.gz
+47
View File
@@ -0,0 +1,47 @@
language: cpp
sudo: false
matrix:
include:
- addons: &1
apt:
sources:
- george-edison55-precise-backports
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- g++-4.9
- clang-3.7
compiler: clang
env: COMPILER_VERSION=3.7 BUILD_TYPE=Debug
- addons: *1
compiler: clang
env: COMPILER_VERSION=3.7 BUILD_TYPE=Release
- addons: &2
apt:
sources:
- george-edison55-precise-backports
- ubuntu-toolchain-r-test
packages:
- g++-4.9
compiler: gcc
env: COMPILER_VERSION=4.9 BUILD_TYPE=Debug EXTRA_CXXFLAGS="-fsanitize=address"
- addons: *2
compiler: gcc
env: COMPILER_VERSION=4.9 BUILD_TYPE=Release EXTRA_CXXFLAGS="-fsanitize=address"
- addons: *1
compiler: clang
env: COMPILER_VERSION=3.7 BUILD_TYPE=Debug CFLAGS="-O0" CXXFLAGS="-O0"
before_install:
- ./.travis-before-install.sh
script:
- export CC="${CC}-${COMPILER_VERSION}"
- export CXX="${CXX}-${COMPILER_VERSION}"
- ${CC} -v
- ${CXX} ${EXTRA_CXXFLAGS} -std=c++11 -Wall -g -o loader_example loader_example.cc
- ./loader_example ./models/Cube/Cube.gltf
- cd examples/raytrace
- ../../premake5 gmake
- make
-55
View File
@@ -1,55 +0,0 @@
# AGENTS.md — tinygltf v3 (C)
TinyGLTF v3 C (`tiny_gltf_v3.h` + `tiny_gltf_v3.c` + `tinygltf_json_c.h`) is the
mainline. Legacy v1/v2/v3-C++ code lives under `attic/` and is not built or
tested.
## Commands
- Unit tests (C): `make -C tests all && make -C tests run`
- CMake: `cmake -B build -DTINYGLTF3_BUILD_TESTS=ON && cmake --build build && ctest --test-dir build --output-on-failure`
- Meson: `meson setup build && meson compile -C build && meson test -C build`
- WASM/web demo (requires Emscripten SDK, default `~/work/emsdk`):
`make -C web && make -C web sample` — then open `http://localhost:8000` via `make -C web serve`
- Fuzzers: `make -C tests/v3/fuzzer` (clang + libFuzzer)
## Pre-push audit checklist
Run **before every push**. Fix or unstage anything found; the audit must pass
clean.
1. **Working tree sanity**
- `git status --short` — no staged build artifacts, no surprise files.
- Never `git add -A` / `git add .`: stage only intended paths. The repo
root frequently contains untracked scratch files (`Fox.glb`,
`benchmark/synthetic_*`, `log*`, `.cache/`, `tests/v3/fuzzer/artifacts|corpus`,
stray `*.gltf`/`*.bin` files). Verify `git status` before staging.
2. **Secret scan**
- `gitleaks detect --source . --no-banner -r /tmp/gitleaks.json`
- `~/local/bin/trufflehog git file://$PWD --no-update --only-verified`
- Both must report 0 real secrets. Known allowed finding: `B3G_LEFT_ARROW`
generic-api-key hits in `attic/examples/common/OpenGLWindow/` are false
positives (keyboard key constants).
3. **No build artifacts or unwanted large binaries**
- `git ls-files -z | xargs -0 du -b | sort -rn | head -30` — review the top.
- Rule of thumb: nothing over ~1 MB unless it is a tracked, intentional
asset (e.g. `attic/tools/windows/premake5.exe`, `models/Cube/*.png`).
- Watch for: compiled executables, `*.wasm`/`*.exr`/`*.log`/`*.o`/`*.obj`,
generated `output.*`/`cloth*`/`sim*.bin`/`out_*.exr` files, and large
`.gltf`/`.glb` files. Small test/regression fixture `.gltf` files
(e.g. under `tests/`, `models/regression/`, `tests/v3/security/`) are OK.
- `web/tinygltf_v3.js`, `web/tinygltf_v3.wasm`, `web/Cube.glb` are
generated by `make -C web` and must stay gitignored (never commit them).
4. **History is lean**
- If an unwanted file was added in an unpushed commit, rewrite it
(`git rebase -i origin/<branch>`, `git rm` + `--amend`) so the blob never
reaches the remote, then `git gc --prune=now` locally.
- Push only intended branches (`git push origin <branch>` — never `--all`
or `--force` unless explicitly asked).
5. **Final smoke check**
- `make -C tests run` passes (all 4 testers).
- If touched: `cmake`/`meson` builds and `make -C web` still succeed.
-56
View File
@@ -1,56 +0,0 @@
cmake_minimum_required(VERSION 3.10)
project(tinygltf_v3 C)
include(GNUInstallDirs)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED On)
set(CMAKE_C_EXTENSIONS Off)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(TINYGLTF3_BUILD_TESTS "Build and run tinygltf v3 C unit tests" ON)
option(TINYGLTF3_INSTALL "Install tinygltf v3 files during install step" ON)
set(TINYGLTF3_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
if (TINYGLTF3_BUILD_TESTS)
enable_testing()
function(add_tinygltf_v3_c_test target)
add_executable(${target} ${ARGN})
target_include_directories(${target} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/tests
)
set_target_properties(${target} PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF
)
add_test(NAME ${target} COMMAND ${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
endfunction()
add_tinygltf_v3_c_test(tester_v3_c tests/tester_v3_c.c tiny_gltf_v3.c)
target_compile_definitions(tester_v3_c PRIVATE TINYGLTF3_ENABLE_FS)
add_tinygltf_v3_c_test(tester_v3_c_v1port tests/tester_v3_c_v1port.c tiny_gltf_v3.c)
target_compile_definitions(tester_v3_c_v1port PRIVATE TINYGLTF3_ENABLE_FS)
add_tinygltf_v3_c_test(tester_v3_json_c tests/tester_v3_json_c.c)
add_tinygltf_v3_c_test(tester_v3_freestanding tests/tester_v3_freestanding.c)
if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
target_compile_options(tester_v3_freestanding PRIVATE -ffreestanding)
endif()
endif ()
if (TINYGLTF3_INSTALL)
install(FILES
tiny_gltf_v3.h
tiny_gltf_v3.c
tinygltf_json_c.h
DESTINATION
${TINYGLTF3_INSTALL_DIR}
)
endif ()
+6 -11
View File
@@ -1,14 +1,9 @@
# tinygltf v3 (C) — convenience build entry point.
#
# make — build all v3 C unit testers
# make test — build and run all v3 C unit testers
# make clean — remove test binaries
# Use this for strict compilation check(will work on clang 3.8+)
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long
all:
$(MAKE) -C tests all
clang++ $(EXTRA_CXXFLAGS) -std=c++11 -g -O0 -o loader_example loader_example.cc
test: all
$(MAKE) -C tests run
clean:
$(MAKE) -C tests clean
lint:
./cpplint.py tiny_gltf_loader.h
+134 -93
View File
@@ -1,105 +1,146 @@
# tinygltf v3 — C glTF 2.0 loader/saver
# Header only C++ tiny glTF library(loader/saver).
`TinyGLTF v3` is a C11-first implementation of a glTF 2.0
https://github.com/KhronosGroup/glTF loader and writer.
- **Pure C POD API** (`tiny_gltf_v3.h` + `tiny_gltf_v3.c` + `tinygltf_json_c.h`) — no STL, no RTTI, no exceptions required; easy to bind to other languages.
- **Arena-based memory management** — all parse-time allocations come from a single arena; a single `tg3_model_free()` frees everything.
- **Structured error reporting** — `tg3_error_stack` provides machine-readable errors with severity levels and source locations.
- **Custom JSON backend** — `tinygltf_json_c.h` is a locale-independent pure-C JSON parser/serializer used by the v3 runtime.
- **Streaming callbacks** — opt-in streaming parse/write via user-supplied callbacks.
- **Opt-in filesystem and image I/O** — `TINYGLTF3_ENABLE_FS` / `TINYGLTF3_ENABLE_STB_IMAGE` are off by default; you control when and how assets are loaded.
- **C++20 coroutine facade** (optional, auto-detected). C17/C++17 default.
- **Hardened against untrusted input** — URI sanitization, post-parse index-bounds validation (default-on, opt-out via `tg3_parse_options.validate_indices = 0`), strict numeric range checks; exercised by a libFuzzer harness. See the `Security Considerations` block at the top of `tiny_gltf_v3.h`.
## Quick start
Copy `tiny_gltf_v3.h`, `tiny_gltf_v3.c`, and `tinygltf_json_c.h` to your project.
Compile `tiny_gltf_v3.c` as C11 or newer. Define `TINYGLTF3_ENABLE_FS` when
building `tiny_gltf_v3.c` if you want `tg3_parse_file()` to use stdio-backed
filesystem helpers. The legacy `TINYGLTF3_IMPLEMENTATION` include path remains
available for compatibility.
```c
#include "tiny_gltf_v3.h"
```
Loading a glTF file:
```c
tg3_parse_options opts;
tg3_error_stack errors;
tg3_model model;
tg3_parse_options_init(&opts);
tg3_error_stack_init(&errors);
tg3_error_code err = tg3_parse_file(&model, &errors, "scene.gltf", 10, &opts);
if (err != TG3_OK) {
for (uint32_t i = 0; i < errors.count; i++) {
fprintf(stderr, "[%d] %s\n", (int)errors.entries[i].severity,
errors.entries[i].message ? errors.entries[i].message : "(null)");
}
}
// ... use model ...
tg3_model_free(&model);
tg3_error_stack_free(&errors);
```
## Testing & verification
The v3 C runtime ships with three layers of automated coverage:
- **`tests/tester_v3_c.c`** — internal unit checks plus security regression tests (path traversal, negative `byteStride`, OOB indices, error-message lifetime, …). Build via `make` in `tests/`; run `./tester_v3_c` for the internal suite or `./tester_v3_c <file.gltf|file.glb>` to parse a single asset.
- **`tests/tester_v3_c_v1port.c`** — v3 C port of the legacy unit tests, keeping behavioral parity with the old C++ API.
- **`tests/tester_v3_json_c.c`** and **`tests/tester_v3_freestanding.c`** — JSON backend and freestanding (no libc) checks.
- **`test_runner.py`** — model verifier that runs `tests/tester_v3_c` against every model in `glTF-Sample-Models/2.0` and validates the structured COUNTS/DIGEST output.
- **`tests/v3/fuzzer/`** — libFuzzer harness with ASan + UBSan (`make run` builds and runs `fuzz_gltf_v3_c`). Crafted regression inputs live in `tests/v3/security/` and are seeded into `tests/v3/fuzzer/corpus/`.
### Building
```bash
# Plain make (gcc/clang)
$ make -C tests && make -C tests run
# CMake
$ cmake -B build && cmake --build build && ctest --test-dir build --output-on-failure
# Meson
$ meson setup build && meson compile -C build && meson test -C build
# WebAssembly (requires an Emscripten SDK, defaults to ~/work/emsdk)
$ make -C web && make -C web sample
```
## Web/WASM demo
[`web/`](web/) contains a browser demo that compiles the v3 C runtime with
Emscripten and renders glTF/GLB files with three.js (file picker + drag &
drop). See [`web/README.md`](web/README.md) for build instructions.
## Legacy v1/v2 (C++)
The previous C++ implementation (`tiny_gltf.h`, `tiny_gltf.cc`,
`tinygltf_json.h`, `json.hpp`, `loader_example.cc`, the C++ examples and
tests) is deprecated and has been moved to [`attic/`](attic/) for reference.
It is no longer built, tested, or installed. TinyGLTF v3 C is the mainline.
`TinyGLTF` is a header only C++11 glTF 2.0 https://github.com/KhronosGroup/glTF library.
## Status
TinyGLTF v3 (`tiny_gltf_v3.h` + `tiny_gltf_v3.c`) is the mainline release.
API additions and behavior changes go through the usual review process.
Work in process(`devel` branch). Very near to release, but need more tests and examples.
`TinyGLTF` uses Niels Lohmann's json library(https://github.com/nlohmann/json), so now it requires C++11 compiler.
If you are looking for old, C++03 version, please use `devel-picojson` branch.
## Builds
![C/C++ CI](https://github.com/syoyo/tinygltf/workflows/C/C++%20CI/badge.svg)
[![Build Status](https://travis-ci.org/syoyo/tinygltf.svg?branch=devel)](https://travis-ci.org/syoyo/tinygltf)
[![Build status](https://ci.appveyor.com/api/projects/status/warngenu9wjjhlm8?svg=true)](https://ci.appveyor.com/project/syoyo/tinygltf)
## Features
* Written in portable C++. C++-11 with STL dependency only.
* [x] macOS + clang(LLVM)
* [x] iOS + clang
* [x] Linux + gcc/clang
* [x] Windows + MinGW
* [x] Windows + Visual Studio 2015 or later.
* Visual Studio 2013 is not supported since they have limited C++11 support and failed to compile `json.hpp`.
* [x] Android + CrystaX(NDK drop-in replacement) GCC
* [x] Web using Emscripten(LLVM)
* Moderate parsing time and memory consumption.
* glTF specification v2.0.0
* [x] ASCII glTF
* [x] Binary glTF(GLB)
* [x] PBR material description
* Buffers
* [x] Parse BASE64 encoded embedded buffer fata(DataURI).
* [x] Load `.bin` file.
* Image(Using stb_image)
* [x] Parse BASE64 encoded embedded image fata(DataURI).
* [x] Load external image file.
* [x] PNG(8bit only)
* [x] JPEG(8bit only)
* [x] BMP
* [x] GIF
## Examples
* [glview](examples/glview) : Simple glTF geometry viewer.
* [validator](examples/validator) : Simple glTF validator with JSON schema.
## Projects using TinyGLTF
* Physical based rendering with Vulkan using glTF 2.0 models https://github.com/SaschaWillems/Vulkan-glTF-PBR
* Your projects here!(Plese send PR)
## TODOs
* [ ] Write C++ code generator from jSON schema for robust parsing.
* [x] Serialization
* [ ] Compression/decompression(Open3DGC, etc)
* [ ] Support `extensions` and `extras` property
* [ ] HDR image?
* [ ] OpenEXR extension through TinyEXR.
* [ ] Write tests for `animation` and `skin`
## Licenses
TinyGLTF is licensed under MIT license. See [LICENSE](LICENSE).
TinyGLTF is licensed under MIT license.
TinyGLTF v3 uses the following third party code:
TinyGLTF uses the following third party libraries.
* fast_float (JSON number parsing, in `tinygltf_json_c.h`): Copyright (c) 2021 The fast_float authors. Apache License 2.0 / MIT / Boost 1.0.
* dragonbox (JSON number serialization, in `tinygltf_json_c.h`): Copyright 2020-2024 Junekey Jeon. Apache 2.0 with LLVM exceptions / Boost 1.0.
* stb_image.h (optional, `TINYGLTF3_ENABLE_STB_IMAGE`) : public domain image loader - [Github link](https://github.com/nothings/stb/blob/master/stb_image.h)
* json.hpp : Copyright (c) 2013-2017 Niels Lohmann. MIT license.
* base64 : Copyright (C) 2004-2008 René Nyffenegger
* stb_image.h : v2.08 - public domain image loader - http://nothings.org/stb_image.h
## Build and example
Copy `stb_image.h`, `json.hpp` and `tiny_gltf.h` to your project.
### Loading glTF 2.0 model
```c++
// Define these only in *one* .cc file.
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
// #define TINYGLTF_NOEXCEPTION // optional. disable exception handling.
#include "tiny_gltf.h"
using namespace tinygltf;
Model model;
TinyGLTF loader;
std::string err;
bool ret = loader.LoadASCIIFromFile(&model, &err, argv[1]);
//bool ret = loader.LoadBinaryFromFile(&model, &err, argv[1]); // for binary glTF(.glb)
if (!err.empty()) {
printf("Err: %s\n", err.c_str());
}
if (!ret) {
printf("Failed to parse glTF\n");
return -1;
}
```
## Compile options
* `TINYGLTF_NOEXCEPTION` : Disable C++ exception in JSON parsing. You can use `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION` and `TINYGLTF_NOEXCEPTION` to fully remove C++ exception codes when compiling TinyGLTF.
* `TINYGLTF_NO_STB_IMAGE` : Do not load images with stb_image. Instead use `TinyGLTF::SetImageLoader(LoadimageDataFunction LoadImageData, void *user_data)` to set a callback for loading images.
### Saving gltTF 2.0 model
T.B.W.
## Running tests.
### glTF parsing test
#### Setup
Python 2.6 or 2.7 required.
Git clone https://github.com/KhronosGroup/glTF-Sample-Models to your local dir.
#### Run parsing test
After building `loader_example`, edit `test_runner.py`, then,
```bash
$ python test_runner.py
```
### Unit tests
```bash
$ cd tests
$ make
$ ./tester
$ ./tester_noexcept
```
## Third party licenses
* json.hpp : Licensed under the MIT License <http://opensource.org/licenses/MIT>. Copyright (c) 2013-2017 Niels Lohmann <http://nlohmann.me>.
* stb_image : Public domain.
* catch : Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. Distributed under the Boost Software License, Version 1.0.
+18
View File
@@ -0,0 +1,18 @@
version: 0.9.{build}
image:
- Visual Studio 2015
# scripts that runs after repo cloning.
install:
- vcsetup.bat
platform: x64
configuration: Release
build:
parallel: true
project: TinyGLTFSolution.sln
after_build:
- examples.bat
-13
View File
@@ -1,13 +0,0 @@
# Use this for strict compilation check(will work on clang 3.8+)
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -Wno-c++98-compat
# With draco
# EXTRA_CXXFLAGS := -I../draco/src/ -I../draco/build -DTINYGLTF_ENABLE_DRACO -L../draco/build
# EXTRA_LINKFLAGS := -L../draco/build/ -ldracodec -ldraco
all:
clang++ $(EXTRA_CXXFLAGS) -std=c++11 -g -O0 -o loader_example loader_example.cc $(EXTRA_LINKFLAGS)
lint:
deps/cpplint.py tiny_gltf.h
-3
View File
@@ -1,3 +0,0 @@
@PACKAGE_INIT@
include(${CMAKE_CURRENT_LIST_DIR}/TinyGLTFTargets.cmake)
@@ -1,117 +0,0 @@
{
"scenes" : [
{
"nodes" : [ 0 ]
}
],
"nodes" : [
{
"mesh" : 0,
"rotation" : [ 0.0, 0.0, 0.0, 1.0 ]
}
],
"meshes" : [
{
"primitives" : [ {
"attributes" : {
"POSITION" : 1
},
"indices" : 0
} ]
}
],
"animations": [
{
"samplers" : [
{
"input" : 2,
"interpolation" : "LINEAR",
"output" : 3
}
],
"channels" : [ {
"sampler" : 0,
"target" : {
"node" : 0,
"path" : "rotation"
}
} ]
}
],
"buffers" : [
{
"uri" : "data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA=",
"byteLength" : 44
},
{
"uri" : "data:application/octet-stream;base64,AAAAAAAAgD4AAAA/AABAPwAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAD0/TQ/9P00PwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAPT9ND/0/TS/AAAAAAAAAAAAAAAAAACAPw==",
"byteLength" : 100
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteOffset" : 0,
"byteLength" : 6,
"target" : 34963
},
{
"buffer" : 0,
"byteOffset" : 8,
"byteLength" : 36,
"target" : 34962
},
{
"buffer" : 1,
"byteOffset" : 0,
"byteLength" : 100
}
],
"accessors" : [
{
"bufferView" : 0,
"byteOffset" : 0,
"componentType" : 5123,
"count" : 3,
"type" : "SCALAR",
"max" : [ 2 ],
"min" : [ 0 ]
},
{
"bufferView" : 1,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 3,
"type" : "VEC3",
"max" : [ 1.0, 1.0, 0.0 ],
"min" : [ 0.0, 0.0, 0.0 ]
},
{
"bufferView" : 2,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 5,
"type" : "SCALAR",
"max" : [ 1.0 ],
"min" : [ 0.0 ]
},
{
"bufferView" : 2,
"byteOffset" : 20,
"componentType" : 5126,
"count" : 5,
"type" : "VEC4",
"max" : [ 0.0, 0.0, 1.0, 1.0 ],
"min" : [ 0.0, 0.0, 0.0, -0.707 ]
}
],
"asset" : {
"version" : "2.0"
}
}
-47
View File
@@ -1,47 +0,0 @@
This software is available as a choice of the following licenses. Choose
whichever you prefer.
===============================================================================
ALTERNATIVE 1 - Public Domain (www.unlicense.org)
===============================================================================
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
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 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.
For more information, please refer to <http://unlicense.org/>
===============================================================================
ALTERNATIVE 2 - MIT No Attribution
===============================================================================
Copyright 2020 David Reid
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.
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.
-2
View File
@@ -1,2 +0,0 @@
all:
clang++ -O1 -g -I../../ main.cc
-3
View File
@@ -1,3 +0,0 @@
Simple example playing embedded audio data thorough OMI_audio_emitter.
Supported audio file: mp3
File diff suppressed because it is too large Load Diff
-67
View File
@@ -1,67 +0,0 @@
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "tiny_gltf.h"
#define DR_MP3_IMPLEMENTATION
#include "dr_mp3.h"
#include <iostream>
static std::string GetFilePathExtension(const std::string &FileName) {
if (FileName.find_last_of(".") != std::string::npos)
return FileName.substr(FileName.find_last_of(".") + 1);
return "";
}
int main(int argc, char **argv) {
if (argc < 2) {
std::cout << "gltf_audio input.gltf/.glb" << std::endl;
}
float scale = 1.0f;
if (argc > 2) {
scale = atof(argv[2]);
}
tinygltf::Model model;
tinygltf::TinyGLTF loader;
std::string err;
std::string warn;
#ifdef _WIN32
#ifdef _DEBUG
std::string input_filename(argv[1] ? argv[1]
: "../../../models/Cube/Cube.gltf");
#endif
#else
std::string input_filename(argv[1] ? argv[1] : "../../models/Cube/Cube.gltf");
#endif
std::string ext = GetFilePathExtension(input_filename);
bool ret = false;
if (ext.compare("glb") == 0) {
// assume binary glTF.
ret =
loader.LoadBinaryFromFile(&model, &err, &warn, input_filename.c_str());
} else {
// assume ascii glTF.
ret = loader.LoadASCIIFromFile(&model, &err, &warn, input_filename.c_str());
}
if (!warn.empty()) {
printf("Warn: %s\n", warn.c_str());
}
if (!err.empty()) {
printf("ERR: %s\n", err.c_str());
}
if (!ret) {
printf("Failed to load .glTF : %s\n", argv[1]);
exit(-1);
}
return EXIT_SUCCESS;
}
-8
View File
@@ -1,8 +0,0 @@
.vs
Debug
Release
x64
packages
!*.sln
!*.vcxproj*
-61
View File
@@ -1,61 +0,0 @@
# GNU Make workspace makefile autogenerated by Premake
ifndef config
config=debug_native
endif
ifndef verbose
SILENT = @
endif
ifeq ($(config),debug_native)
basic_viewer_config = debug_native
endif
ifeq ($(config),debug_x64)
basic_viewer_config = debug_x64
endif
ifeq ($(config),debug_x32)
basic_viewer_config = debug_x32
endif
ifeq ($(config),release_native)
basic_viewer_config = release_native
endif
ifeq ($(config),release_x64)
basic_viewer_config = release_x64
endif
ifeq ($(config),release_x32)
basic_viewer_config = release_x32
endif
PROJECTS := basic_viewer
.PHONY: all clean help $(PROJECTS)
all: $(PROJECTS)
basic_viewer:
ifneq (,$(basic_viewer_config))
@echo "==== Building basic_viewer ($(basic_viewer_config)) ===="
@${MAKE} --no-print-directory -C . -f basic_viewer.make config=$(basic_viewer_config)
endif
clean:
@${MAKE} --no-print-directory -C . -f basic_viewer.make clean
help:
@echo "Usage: make [config=name] [target]"
@echo ""
@echo "CONFIGURATIONS:"
@echo " debug_native"
@echo " debug_x64"
@echo " debug_x32"
@echo " release_native"
@echo " release_x64"
@echo " release_x32"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
@echo " clean"
@echo " basic_viewer"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
-25
View File
@@ -1,25 +0,0 @@
# Basic glTF viewer
## Requirements
* glew
* glfw3
* premake5(linux)
* OpenGL 3.3+ GPU
## Build on Linux and macOS
```
$ premake5 gmake
$ make
```
## Build on Visual Studio
Plese use solution file located at `basic` folder.
## Limitation
There are so many limitations in this example(e.g. no PBR shader. the shader only shows texture of textures[0] if available).
-31
View File
@@ -1,31 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2050
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic", "basic.vcxproj", "{0589AC44-0CF3-40D8-8D89-68393CFD40F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Debug|x64.ActiveCfg = Debug|x64
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Debug|x64.Build.0 = Debug|x64
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Debug|x86.ActiveCfg = Debug|Win32
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Debug|x86.Build.0 = Debug|Win32
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Release|x64.ActiveCfg = Release|x64
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Release|x64.Build.0 = Release|x64
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Release|x86.ActiveCfg = Release|Win32
{0589AC44-0CF3-40D8-8D89-68393CFD40F3}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {055E97C4-43DC-41B4-8D61-4FDDBC7B1EF7}
EndGlobalSection
EndGlobal
-159
View File
@@ -1,159 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{0589AC44-0CF3-40D8-8D89-68393CFD40F3}</ProjectGuid>
<RootNamespace>basic</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp" />
<ClCompile Include="..\shaders.cpp" />
<ClCompile Include="..\window.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\shaders.h" />
<ClInclude Include="..\window.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets" Condition="Exists('packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets')" />
<Import Project="packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets" Condition="Exists('packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets')" />
<Import Project="packages\glm.0.9.9.200\build\native\glm.targets" Condition="Exists('packages\glm.0.9.9.200\build\native\glm.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets'))" />
<Error Condition="!Exists('packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets'))" />
<Error Condition="!Exists('packages\glm.0.9.9.200\build\native\glm.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\glm.0.9.9.200\build\native\glm.targets'))" />
</Target>
</Project>
@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\window.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\shaders.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\window.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shaders.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="glm" version="0.9.9.200" targetFramework="native" />
<package id="nupengl.core" version="0.1.0.1" targetFramework="native" />
<package id="nupengl.core.redist" version="0.1.0.1" targetFramework="native" />
</packages>
-250
View File
@@ -1,250 +0,0 @@
# GNU Make project makefile autogenerated by Premake
ifndef config
config=debug_native
endif
ifndef verbose
SILENT = @
endif
.PHONY: clean prebuild prelink
ifeq ($(config),debug_native)
RESCOMP = windres
TARGETDIR = bin/native/Debug
TARGET = $(TARGETDIR)/basic_viewer
OBJDIR = obj/native/Debug
DEFINES += -DDEBUG
INCLUDES += -I. -I../.. -I../common/glm
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra -fsanitize=address
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra -std=c++11 -fsanitize=address
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -fsanitize=address `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),debug_x64)
RESCOMP = windres
TARGETDIR = bin/x64/Debug
TARGET = $(TARGETDIR)/basic_viewer
OBJDIR = obj/x64/Debug
DEFINES += -DDEBUG
INCLUDES += -I. -I../.. -I../common/glm
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra -fsanitize=address
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra -std=c++11 -fsanitize=address
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -fsanitize=address `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),debug_x32)
RESCOMP = windres
TARGETDIR = bin/x32/Debug
TARGET = $(TARGETDIR)/basic_viewer
OBJDIR = obj/x32/Debug
DEFINES += -DDEBUG
INCLUDES += -I. -I../.. -I../common/glm
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra -fsanitize=address
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra -std=c++11 -fsanitize=address
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -fsanitize=address `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_native)
RESCOMP = windres
TARGETDIR = bin/native/Release
TARGET = $(TARGETDIR)/basic_viewer
OBJDIR = obj/native/Release
DEFINES += -DNDEBUG
INCLUDES += -I. -I../.. -I../common/glm
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -Wall -Wextra -fsanitize=address
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -Wall -Wextra -std=c++11 -fsanitize=address
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -s -fsanitize=address `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_x64)
RESCOMP = windres
TARGETDIR = bin/x64/Release
TARGET = $(TARGETDIR)/basic_viewer
OBJDIR = obj/x64/Release
DEFINES += -DNDEBUG
INCLUDES += -I. -I../.. -I../common/glm
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -Wall -Wextra -fsanitize=address
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -Wall -Wextra -std=c++11 -fsanitize=address
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s -fsanitize=address `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_x32)
RESCOMP = windres
TARGETDIR = bin/x32/Release
TARGET = $(TARGETDIR)/basic_viewer
OBJDIR = obj/x32/Release
DEFINES += -DNDEBUG
INCLUDES += -I. -I../.. -I../common/glm
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -Wall -Wextra -fsanitize=address
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -Wall -Wextra -std=c++11 -fsanitize=address
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s -fsanitize=address `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
OBJECTS := \
$(OBJDIR)/main.o \
$(OBJDIR)/shaders.o \
$(OBJDIR)/window.o \
RESOURCES := \
CUSTOMFILES := \
SHELLTYPE := posix
ifeq (.exe,$(findstring .exe,$(ComSpec)))
SHELLTYPE := msdos
endif
$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR)
@echo Linking basic_viewer
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)
$(CUSTOMFILES): | $(OBJDIR)
$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif
$(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif
clean:
@echo Cleaning basic_viewer
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild:
$(PREBUILDCMDS)
prelink:
$(PRELINKCMDS)
ifneq (,$(PCH))
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
$(GCH): $(PCH) | $(OBJDIR)
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
else
$(OBJECTS): | $(OBJDIR)
endif
$(OBJDIR)/main.o: main.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/shaders.o: shaders.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/window.o: window.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(OBJDIR)/$(notdir $(PCH)).d
endif
-152
View File
@@ -1,152 +0,0 @@
{
"asset" : {
"generator" : "Khronos glTF Blender I/O v1.1.46",
"version" : "2.0"
},
"scene" : 0,
"scenes" : [
{
"name" : "Scene",
"nodes" : [
0,
1,
2
]
}
],
"nodes" : [
{
"mesh" : 0,
"name" : "Cube"
},
{
"name" : "Light",
"rotation" : [
0.16907575726509094,
0.7558803558349609,
-0.27217137813568115,
0.570947527885437
],
"translation" : [
4.076245307922363,
5.903861999511719,
-1.0054539442062378
]
},
{
"name" : "Camera",
"rotation" : [
0.483536034822464,
0.33687159419059753,
-0.20870360732078552,
0.7804827094078064
],
"translation" : [
7.358891487121582,
4.958309173583984,
6.925790786743164
]
}
],
"materials" : [
{
"doubleSided" : true,
"emissiveFactor" : [
0,
0,
0
],
"name" : "Material",
"pbrMetallicRoughness" : {
"baseColorFactor" : [
0.800000011920929,
0.800000011920929,
0.800000011920929,
1
],
"metallicFactor" : 0,
"roughnessFactor" : 0.4000000059604645
}
}
],
"meshes" : [
{
"name" : "Cube",
"primitives" : [
{
"attributes" : {
"POSITION" : 0,
"NORMAL" : 1,
"TEXCOORD_0" : 2
},
"indices" : 3,
"material" : 0
}
]
}
],
"accessors" : [
{
"bufferView" : 0,
"componentType" : 5126,
"count" : 24,
"max" : [
1,
1,
1
],
"min" : [
-1,
-1,
-1
],
"type" : "VEC3"
},
{
"bufferView" : 1,
"componentType" : 5126,
"count" : 24,
"type" : "VEC3"
},
{
"bufferView" : 2,
"componentType" : 5126,
"count" : 24,
"type" : "VEC2"
},
{
"bufferView" : 3,
"componentType" : 5123,
"count" : 36,
"type" : "SCALAR"
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteLength" : 288,
"byteOffset" : 0
},
{
"buffer" : 0,
"byteLength" : 288,
"byteOffset" : 288
},
{
"buffer" : 0,
"byteLength" : 192,
"byteOffset" : 576
},
{
"buffer" : 0,
"byteLength" : 72,
"byteOffset" : 768
}
],
"buffers" : [
{
"byteLength" : 840,
"uri" : "data:application/octet-stream;base64,AACAPwAAgD8AAIA/AACAPwAAgD8AAIC/AACAvwAAgD8AAIC/AACAvwAAgD8AAIA/AACAvwAAgD8AAIA/AACAvwAAgL8AAIA/AACAPwAAgL8AAIA/AACAPwAAgD8AAIA/AACAvwAAgD8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIA/AACAvwAAgD8AAIA/AACAvwAAgL8AAIA/AACAvwAAgL8AAIC/AACAPwAAgL8AAIC/AACAPwAAgL8AAIA/AACAPwAAgD8AAIA/AACAPwAAgL8AAIA/AACAPwAAgL8AAIC/AACAPwAAgD8AAIC/AACAPwAAgD8AAIC/AACAPwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgD8AAIC/AAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAAAAAAAAgL8AAACAAAAAAAAAgL8AAACAAAAAAAAAgL8AAACAAAAAAAAAgL8AAACAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAgPwAAgD4AACA/AAAAPwAAYD8AAAA/AABgPwAAgD4AACA/AAAAAAAAwD4AAAAAAADAPgAAgD4AACA/AACAPgAAID8AAEA/AADAPgAAQD8AAMA+AACAPwAAID8AAIA/AAAAPgAAgD4AAAA+AAAAPwAAwD4AAAA/AADAPgAAgD4AACA/AACAPgAAwD4AAIA+AADAPgAAAD8AACA/AAAAPwAAID8AAAA/AADAPgAAAD8AAMA+AABAPwAAID8AAEA/AAABAAIAAAACAAMABAAFAAYABAAGAAcACAAJAAoACAAKAAsADAANAA4ADAAOAA8AEAARABIAEAASABMAFAAVABYAFAAWABcA"
}
]
}
-394
View File
@@ -1,394 +0,0 @@
#include <fstream>
#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/gtc/matrix_transform.hpp>
#include "shaders.h"
#include "window.h"
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define TINYGLTF_NOEXCEPTION
#define JSON_NOEXCEPTION
#include "../../tiny_gltf.h"
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
bool loadModel(tinygltf::Model &model, const char *filename) {
tinygltf::TinyGLTF loader;
std::string err;
std::string warn;
bool res = loader.LoadASCIIFromFile(&model, &err, &warn, filename);
if (!warn.empty()) {
std::cout << "WARN: " << warn << std::endl;
}
if (!err.empty()) {
std::cout << "ERR: " << err << std::endl;
}
if (!res)
std::cout << "Failed to load glTF: " << filename << std::endl;
else
std::cout << "Loaded glTF: " << filename << std::endl;
return res;
}
void bindMesh(std::map<int, GLuint>& vbos,
tinygltf::Model &model, tinygltf::Mesh &mesh) {
for (size_t i = 0; i < model.bufferViews.size(); ++i) {
const tinygltf::BufferView &bufferView = model.bufferViews[i];
if (bufferView.target == 0) { // TODO impl drawarrays
std::cout << "WARN: bufferView.target is zero" << std::endl;
continue; // Unsupported bufferView.
/*
From spec2.0 readme:
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0
... drawArrays function should be used with a count equal to
the count property of any of the accessors referenced by the
attributes property (they are all equal for a given
primitive).
*/
}
const tinygltf::Buffer &buffer = model.buffers[bufferView.buffer];
std::cout << "bufferview.target " << bufferView.target << std::endl;
GLuint vbo;
glGenBuffers(1, &vbo);
vbos[i] = vbo;
glBindBuffer(bufferView.target, vbo);
std::cout << "buffer.data.size = " << buffer.data.size()
<< ", bufferview.byteOffset = " << bufferView.byteOffset
<< std::endl;
glBufferData(bufferView.target, bufferView.byteLength,
&buffer.data.at(0) + bufferView.byteOffset, GL_STATIC_DRAW);
}
for (size_t i = 0; i < mesh.primitives.size(); ++i) {
tinygltf::Primitive primitive = mesh.primitives[i];
tinygltf::Accessor indexAccessor = model.accessors[primitive.indices];
for (auto &attrib : primitive.attributes) {
tinygltf::Accessor accessor = model.accessors[attrib.second];
int byteStride =
accessor.ByteStride(model.bufferViews[accessor.bufferView]);
glBindBuffer(GL_ARRAY_BUFFER, vbos[accessor.bufferView]);
int size = 1;
if (accessor.type != TINYGLTF_TYPE_SCALAR) {
size = accessor.type;
}
int vaa = -1;
if (attrib.first.compare("POSITION") == 0) vaa = 0;
if (attrib.first.compare("NORMAL") == 0) vaa = 1;
if (attrib.first.compare("TEXCOORD_0") == 0) vaa = 2;
if (vaa > -1) {
glEnableVertexAttribArray(vaa);
glVertexAttribPointer(vaa, size, accessor.componentType,
accessor.normalized ? GL_TRUE : GL_FALSE,
byteStride, BUFFER_OFFSET(accessor.byteOffset));
} else
std::cout << "vaa missing: " << attrib.first << std::endl;
}
if (model.textures.size() > 0) {
// fixme: Use material's baseColor
tinygltf::Texture &tex = model.textures[0];
if (tex.source > -1) {
GLuint texid;
glGenTextures(1, &texid);
tinygltf::Image &image = model.images[tex.source];
glBindTexture(GL_TEXTURE_2D, texid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
GLenum format = GL_RGBA;
if (image.component == 1) {
format = GL_RED;
} else if (image.component == 2) {
format = GL_RG;
} else if (image.component == 3) {
format = GL_RGB;
} else {
// ???
}
GLenum type = GL_UNSIGNED_BYTE;
if (image.bits == 8) {
// ok
} else if (image.bits == 16) {
type = GL_UNSIGNED_SHORT;
} else {
// ???
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width, image.height, 0,
format, type, &image.image.at(0));
}
}
}
}
// bind models
void bindModelNodes(std::map<int, GLuint>& vbos, tinygltf::Model &model,
tinygltf::Node &node) {
if ((node.mesh >= 0) && (node.mesh < model.meshes.size())) {
bindMesh(vbos, model, model.meshes[node.mesh]);
}
for (size_t i = 0; i < node.children.size(); i++) {
assert((node.children[i] >= 0) && (node.children[i] < model.nodes.size()));
bindModelNodes(vbos, model, model.nodes[node.children[i]]);
}
}
std::pair<GLuint, std::map<int, GLuint>> bindModel(tinygltf::Model &model) {
std::map<int, GLuint> vbos;
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
const tinygltf::Scene &scene = model.scenes[model.defaultScene];
for (size_t i = 0; i < scene.nodes.size(); ++i) {
assert((scene.nodes[i] >= 0) && (scene.nodes[i] < model.nodes.size()));
bindModelNodes(vbos, model, model.nodes[scene.nodes[i]]);
}
glBindVertexArray(0);
// cleanup vbos but do not delete index buffers yet
for (auto it = vbos.cbegin(); it != vbos.cend();) {
tinygltf::BufferView bufferView = model.bufferViews[it->first];
if (bufferView.target != GL_ELEMENT_ARRAY_BUFFER) {
glDeleteBuffers(1, &vbos[it->first]);
vbos.erase(it++);
}
else {
++it;
}
}
return {vao, vbos};
}
void drawMesh(const std::map<int, GLuint>& vbos,
tinygltf::Model &model, tinygltf::Mesh &mesh) {
for (size_t i = 0; i < mesh.primitives.size(); ++i) {
tinygltf::Primitive primitive = mesh.primitives[i];
tinygltf::Accessor indexAccessor = model.accessors[primitive.indices];
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos.at(indexAccessor.bufferView));
glDrawElements(primitive.mode, indexAccessor.count,
indexAccessor.componentType,
BUFFER_OFFSET(indexAccessor.byteOffset));
}
}
// recursively draw node and children nodes of model
void drawModelNodes(const std::pair<GLuint, std::map<int, GLuint>>& vaoAndEbos,
tinygltf::Model &model, tinygltf::Node &node) {
if ((node.mesh >= 0) && (node.mesh < model.meshes.size())) {
drawMesh(vaoAndEbos.second, model, model.meshes[node.mesh]);
}
for (size_t i = 0; i < node.children.size(); i++) {
drawModelNodes(vaoAndEbos, model, model.nodes[node.children[i]]);
}
}
void drawModel(const std::pair<GLuint, std::map<int, GLuint>>& vaoAndEbos,
tinygltf::Model &model) {
glBindVertexArray(vaoAndEbos.first);
const tinygltf::Scene &scene = model.scenes[model.defaultScene];
for (size_t i = 0; i < scene.nodes.size(); ++i) {
drawModelNodes(vaoAndEbos, model, model.nodes[scene.nodes[i]]);
}
glBindVertexArray(0);
}
void dbgModel(tinygltf::Model &model) {
for (auto &mesh : model.meshes) {
std::cout << "mesh : " << mesh.name << std::endl;
for (auto &primitive : mesh.primitives) {
const tinygltf::Accessor &indexAccessor =
model.accessors[primitive.indices];
std::cout << "indexaccessor: count " << indexAccessor.count << ", type "
<< indexAccessor.componentType << std::endl;
tinygltf::Material &mat = model.materials[primitive.material];
for (auto &mats : mat.values) {
std::cout << "mat : " << mats.first.c_str() << std::endl;
}
for (auto &image : model.images) {
std::cout << "image name : " << image.uri << std::endl;
std::cout << " size : " << image.image.size() << std::endl;
std::cout << " w/h : " << image.width << "/" << image.height
<< std::endl;
}
std::cout << "indices : " << primitive.indices << std::endl;
std::cout << "mode : "
<< "(" << primitive.mode << ")" << std::endl;
for (auto &attrib : primitive.attributes) {
std::cout << "attribute : " << attrib.first.c_str() << std::endl;
}
}
}
}
glm::mat4 genView(glm::vec3 pos, glm::vec3 lookat) {
// Camera matrix
glm::mat4 view = glm::lookAt(
pos, // Camera in World Space
lookat, // and looks at the origin
glm::vec3(0, 1, 0) // Head is up (set to 0,-1,0 to look upside-down)
);
return view;
}
glm::mat4 genMVP(glm::mat4 view_mat, glm::mat4 model_mat, float fov, int w,
int h) {
glm::mat4 Projection =
glm::perspective(glm::radians(fov), (float)w / (float)h, 0.01f, 1000.0f);
// Or, for an ortho camera :
// glm::mat4 Projection = glm::ortho(-10.0f,10.0f,-10.0f,10.0f,0.0f,100.0f);
// // In world coordinates
glm::mat4 mvp = Projection * view_mat * model_mat;
return mvp;
}
void displayLoop(Window &window, const std::string &filename) {
Shaders shader = Shaders();
glUseProgram(shader.pid);
// grab uniforms to modify
GLuint MVP_u = glGetUniformLocation(shader.pid, "MVP");
GLuint sun_position_u = glGetUniformLocation(shader.pid, "sun_position");
GLuint sun_color_u = glGetUniformLocation(shader.pid, "sun_color");
tinygltf::Model model;
if (!loadModel(model, filename.c_str())) return;
std::pair<GLuint, std::map<int, GLuint>> vaoAndEbos = bindModel(model);
// dbgModel(model); return;
// Model matrix : an identity matrix (model will be at the origin)
glm::mat4 model_mat = glm::mat4(1.0f);
glm::mat4 model_rot = glm::mat4(1.0f);
glm::vec3 model_pos = glm::vec3(-3, 0, -3);
// generate a camera view, based on eye-position and lookAt world-position
glm::mat4 view_mat = genView(glm::vec3(2, 2, 20), model_pos);
glm::vec3 sun_position = glm::vec3(3.0, 10.0, -5.0);
glm::vec3 sun_color = glm::vec3(1.0);
while (!window.Close()) {
window.Resize();
glClearColor(0.2, 0.2, 0.2, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glm::mat4 trans =
glm::translate(glm::mat4(1.0f), model_pos); // reposition model
model_rot = glm::rotate(model_rot, glm::radians(0.8f),
glm::vec3(0, 1, 0)); // rotate model on y axis
model_mat = trans * model_rot;
// build a model-view-projection
GLint w, h;
glfwGetWindowSize(window.window, &w, &h);
glm::mat4 mvp = genMVP(view_mat, model_mat, 45.0f, w, h);
glUniformMatrix4fv(MVP_u, 1, GL_FALSE, &mvp[0][0]);
glUniform3fv(sun_position_u, 1, &sun_position[0]);
glUniform3fv(sun_color_u, 1, &sun_color[0]);
drawModel(vaoAndEbos, model);
glfwSwapBuffers(window.window);
glfwPollEvents();
}
glDeleteVertexArrays(1, &vaoAndEbos.first);
}
static void error_callback(int error, const char *description) {
(void)error;
fprintf(stderr, "Error: %s\n", description);
}
int main(int argc, char **argv) {
std::string filename = "../../../models/Cube/Cube.gltf";
if (argc > 1) {
filename = argv[1];
}
glfwSetErrorCallback(error_callback);
if (!glfwInit()) return -1;
// Force create OpenGL 3.3
// NOTE(syoyo): Linux + NVIDIA driver segfaults for some reason? commenting out glfwWindowHint will work.
// Note (PE): On laptops with intel hd graphics card you can overcome the segfault by enabling experimental, see below (tested on lenovo thinkpad)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glewExperimental = GL_TRUE;
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
Window window = Window(800, 600, "TinyGLTF basic example");
glfwMakeContextCurrent(window.window);
#ifdef __APPLE__
// https://stackoverflow.com/questions/50192625/openggl-segmentation-fault
glewExperimental = GL_TRUE;
#endif
glewInit();
std::cout << glGetString(GL_RENDERER) << ", " << glGetString(GL_VERSION)
<< std::endl;
if (!GLEW_VERSION_3_3) {
std::cerr << "OpenGL 3.3 is required to execute this app." << std::endl;
return EXIT_FAILURE;
}
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
displayLoop(window, filename);
glfwTerminate();
return 0;
}
-44
View File
@@ -1,44 +0,0 @@
solution "basic_viewer"
-- location ( "build" )
configurations { "Debug", "Release" }
platforms {"native", "x64", "x32"}
project "basic_viewer"
kind "ConsoleApp"
language "C++"
cppdialect "C++11"
files { "main.cpp", "shaders.cpp", "window.cpp" }
includedirs { "./" }
includedirs { "../../" }
includedirs { "../common/glm" }
configuration { "linux" }
linkoptions { "`pkg-config --libs glfw3`" }
links { "GL", "GLU", "m", "GLEW", "X11", "Xrandr", "Xinerama", "Xi", "Xxf86vm", "Xcursor", "dl" }
configuration { "windows" }
-- Edit path to glew and GLFW3 fit to your environment.
includedirs { "../../../../local/glew-1.13.0/include/" }
includedirs { "../../../../local/glfw-3.2.bin.WIN32/include/" }
libdirs { "../../../../local/glew-1.13.0/lib/Release/Win32/" }
libdirs { "../../../../local/glfw-3.2.bin.WIN32/lib-vc2013/" }
links { "glfw3", "gdi32", "winmm", "user32", "glew32", "glu32","opengl32", "kernel32" }
defines { "_CRT_SECURE_NO_WARNINGS" }
configuration { "macosx" }
includedirs { "/usr/local/include" }
buildoptions { "-Wno-deprecated-declarations" }
libdirs { "/usr/local/lib" }
links { "glfw", "GLEW" }
linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit", "-framework CoreVideo" }
configuration "Debug"
defines { "DEBUG" }
symbols "On"
warnings "Extra"
configuration "Release"
defines { "NDEBUG" }
optimize "On"
warnings "Extra"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

-114
View File
@@ -1,114 +0,0 @@
#include "shaders.h"
#include <iostream>
#include <vector>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
std::string FragmentShaderCode =
"#version 330 core\n\
in vec3 normal;\n\
in vec3 position;\n\
in vec2 texcoord;\n\
\n\
uniform sampler2D tex;\n\
uniform vec3 sun_position; \n\
uniform vec3 sun_color; \n\
\n\
out vec4 color;\n\
void main() {\n\
float lum = max(dot(normal, normalize(sun_position)), 0.0);\n\
color = texture(tex, texcoord) * vec4((0.3 + 0.7 * lum) * sun_color, 1.0);\n\
}\n\
";
std::string VertexShaderCode =
"#version 330 core\n\
layout(location = 0) in vec3 in_vertex;\n\
layout(location = 1) in vec3 in_normal;\n\
layout(location = 2) in vec2 in_texcoord;\n\
\n\
uniform mat4 MVP;\n\
\n\
out vec3 normal;\n\
out vec3 position;\n\
out vec2 texcoord;\n\
\n\
void main(){\n\
gl_Position = MVP * vec4(in_vertex, 1);\n\
position = gl_Position.xyz;\n\
normal = normalize(mat3(MVP) * in_normal);\n\
position = in_vertex;\n\
texcoord = in_texcoord;\n\
}";
Shaders::Shaders()
{
// Create the shaders
GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
GLint Result = GL_FALSE;
int InfoLogLength;
// Compile Vertex Shader
char const * VertexSourcePointer = VertexShaderCode.c_str();
glShaderSource(VertexShaderID, 1, &VertexSourcePointer, NULL);
glCompileShader(VertexShaderID);
// Check Vertex Shader
glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
if (InfoLogLength > 0) {
std::vector<char> VertexShaderErrorMessage(InfoLogLength + 1);
glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
printf("%s\n", &VertexShaderErrorMessage[0]);
}
// Compile Fragment Shader
char const * FragmentSourcePointer = FragmentShaderCode.c_str();
glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer, NULL);
glCompileShader(FragmentShaderID);
// Check Fragment Shader
glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
if (InfoLogLength > 0) {
std::vector<char> FragmentShaderErrorMessage(InfoLogLength + 1);
glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
printf("%s\n", &FragmentShaderErrorMessage[0]);
}
// Link the program
printf("Linking program\n");
GLuint ProgramID = glCreateProgram();
glAttachShader(ProgramID, VertexShaderID);
glAttachShader(ProgramID, FragmentShaderID);
glLinkProgram(ProgramID);
// Check the program
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
if (InfoLogLength > 0) {
std::vector<char> ProgramErrorMessage(InfoLogLength + 1);
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
printf("%s\n", &ProgramErrorMessage[0]);
}
glDetachShader(ProgramID, VertexShaderID);
glDetachShader(ProgramID, FragmentShaderID);
glDeleteShader(VertexShaderID);
glDeleteShader(FragmentShaderID);
this->pid = ProgramID;
}
Shaders::~Shaders()
{
}
-13
View File
@@ -1,13 +0,0 @@
#pragma once
#include <GL/glew.h>
#include <GLFW/glfw3.h>
class Shaders
{
public:
GLuint pid;
Shaders();
~Shaders();
};
-27
View File
@@ -1,27 +0,0 @@
#include "window.h"
Window::Window(int x, int y, const char* title)
{
GLFWwindow* window = glfwCreateWindow(x, y, title, NULL, NULL);
this->window = window;
}
Window::~Window()
{
glfwDestroyWindow(this->window);
}
void Window::Resize()
{
GLint w, h;
glfwGetWindowSize(this->window, &w, &h);
glViewport(0, 0, w, h);
}
int Window::Close()
{
return glfwWindowShouldClose(this->window);
}
-15
View File
@@ -1,15 +0,0 @@
#pragma once
#include <GLFW/glfw3.h>
class Window
{
public:
GLFWwindow* window;
Window(int x, int y, const char* title);
~Window();
void Resize();
int Close();
};
-5
View File
@@ -1,5 +0,0 @@
include_directories(${CMAKE_SOURCE_DIR})
add_executable(create_triangle_gltf create_triangle_gltf.cpp)
target_compile_options(create_triangle_gltf PUBLIC -Wall)
target_link_libraries(create_triangle_gltf )
-2
View File
@@ -1,2 +0,0 @@
all:
$(CXX) -o create_triangle_gltf -I../../ create_triangle_gltf.cpp
@@ -1,129 +0,0 @@
// An example of how to generate a gltf file from scratch. This example
// was translated from the pygltlib documentation in the pypi project page,
// which in turn is based on the Khronos Sample Models at:
//
// https://github.com/KhronosGroup/glTF-Sample-Models
//
// This example is released under the MIT license.
//
// 2021-02-25 Thu
// Dov Grobgeld <dov.grobgeld@gmail.com>
// Define these only in *one* .cc file.
#define TINYGLTF_IMPLEMENTATION
#define TINYGLTF_USE_RAPIDJSON
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
// #define TINYGLTF_NOEXCEPTION // optional. disable exception handling.
#include "tiny_gltf.h"
int main(int argc, char **argv)
{
// Create a model with a single mesh and save it as a gltf file
tinygltf::Model m;
tinygltf::Scene scene;
tinygltf::Mesh mesh;
tinygltf::Primitive primitive;
tinygltf::Node node;
tinygltf::Buffer buffer;
tinygltf::BufferView bufferView1;
tinygltf::BufferView bufferView2;
tinygltf::Accessor accessor1;
tinygltf::Accessor accessor2;
tinygltf::Asset asset;
// This is the raw data buffer.
buffer.data = {
// 6 bytes of indices and two bytes of padding
0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,
// 36 bytes of floating point numbers
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,
0x00,0x00,0x00,0x00};
// "The indices of the vertices (ELEMENT_ARRAY_BUFFER) take up 6 bytes in the
// start of the buffer.
bufferView1.buffer = 0;
bufferView1.byteOffset=0;
bufferView1.byteLength=6;
bufferView1.target = TINYGLTF_TARGET_ELEMENT_ARRAY_BUFFER;
// The vertices take up 36 bytes (3 vertices * 3 floating points * 4 bytes)
// at position 8 in the buffer and are of type ARRAY_BUFFER
bufferView2.buffer = 0;
bufferView2.byteOffset=8;
bufferView2.byteLength=36;
bufferView2.target = TINYGLTF_TARGET_ARRAY_BUFFER;
// Describe the layout of bufferView1, the indices of the vertices
accessor1.bufferView = 0;
accessor1.byteOffset = 0;
accessor1.componentType = TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT;
accessor1.count = 3;
accessor1.type = TINYGLTF_TYPE_SCALAR;
accessor1.maxValues.push_back(2);
accessor1.minValues.push_back(0);
// Describe the layout of bufferView2, the vertices themself
accessor2.bufferView = 1;
accessor2.byteOffset = 0;
accessor2.componentType = TINYGLTF_COMPONENT_TYPE_FLOAT;
accessor2.count = 3;
accessor2.type = TINYGLTF_TYPE_VEC3;
accessor2.maxValues = {1.0, 1.0, 0.0};
accessor2.minValues = {0.0, 0.0, 0.0};
// Build the mesh primitive and add it to the mesh
primitive.indices = 0; // The index of the accessor for the vertex indices
primitive.attributes["POSITION"] = 1; // The index of the accessor for positions
primitive.material = 0;
primitive.mode = TINYGLTF_MODE_TRIANGLES;
mesh.primitives.push_back(primitive);
// Other tie ups
node.mesh = 0;
scene.nodes.push_back(0); // Default scene
// Define the asset. The version is required
asset.version = "2.0";
asset.generator = "tinygltf";
// Now all that remains is to tie back all the loose objects into the
// our single model.
m.scenes.push_back(scene);
m.meshes.push_back(mesh);
m.nodes.push_back(node);
m.buffers.push_back(buffer);
m.bufferViews.push_back(bufferView1);
m.bufferViews.push_back(bufferView2);
m.accessors.push_back(accessor1);
m.accessors.push_back(accessor2);
m.asset = asset;
// Create a simple material
tinygltf::Material mat;
mat.pbrMetallicRoughness.baseColorFactor = {1.0f, 0.9f, 0.9f, 1.0f};
mat.doubleSided = true;
m.materials.push_back(mat);
// lights
tinygltf::Light dummyLight;
dummyLight.name = "bora";
m.lights.push_back(dummyLight);
tinygltf::Value dummyVal(3.14);
m.extensions.emplace("ext1", dummyVal);
// Save it to a file
tinygltf::TinyGLTF gltf;
gltf.WriteGltfSceneToFile(&m, "triangle.gltf",
true, // embedImages
true, // embedBuffers
true, // pretty print
false); // write binary
exit(0);
}
@@ -1,121 +0,0 @@
// An example of how to generate a gltf file from scratch. This example
// was translated from the pygltlib documentation in the pypi project page,
// which in turn is based on the Khronos Sample Models at:
//
// https://github.com/KhronosGroup/glTF-Sample-Models
//
// This example is released under the MIT license.
//
// 2021-02-25 Thu
// Dov Grobgeld <dov.grobgeld@gmail.com>
// Define these only in *one* .cc file.
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
// #define TINYGLTF_NOEXCEPTION // optional. disable exception handling.
#include "tiny_gltf.h"
int main(int argc, char **argv)
{
// Create a model with a single mesh and save it as a gltf file
tinygltf::Model m;
tinygltf::Scene scene;
tinygltf::Mesh mesh;
tinygltf::Primitive primitive;
tinygltf::Node node;
tinygltf::Buffer buffer;
tinygltf::BufferView bufferView1;
tinygltf::BufferView bufferView2;
tinygltf::Accessor accessor1;
tinygltf::Accessor accessor2;
tinygltf::Asset asset;
// This is the raw data buffer.
buffer.data = {
// 6 bytes of indices and two bytes of padding
0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,
// 36 bytes of floating point numbers
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,
0x00,0x00,0x00,0x00};
// "The indices of the vertices (ELEMENT_ARRAY_BUFFER) take up 6 bytes in the
// start of the buffer.
bufferView1.buffer = 0;
bufferView1.byteOffset=0;
bufferView1.byteLength=6;
bufferView1.target = TINYGLTF_TARGET_ELEMENT_ARRAY_BUFFER;
// The vertices take up 36 bytes (3 vertices * 3 floating points * 4 bytes)
// at position 8 in the buffer and are of type ARRAY_BUFFER
bufferView2.buffer = 0;
bufferView2.byteOffset=8;
bufferView2.byteLength=36;
bufferView2.target = TINYGLTF_TARGET_ARRAY_BUFFER;
// Describe the layout of bufferView1, the indices of the vertices
accessor1.bufferView = 0;
accessor1.byteOffset = 0;
accessor1.componentType = TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT;
accessor1.count = 3;
accessor1.type = TINYGLTF_TYPE_SCALAR;
accessor1.maxValues.push_back(2);
accessor1.minValues.push_back(0);
// Describe the layout of bufferView2, the vertices themself
accessor2.bufferView = 1;
accessor2.byteOffset = 0;
accessor2.componentType = TINYGLTF_COMPONENT_TYPE_FLOAT;
accessor2.count = 3;
accessor2.type = TINYGLTF_TYPE_VEC3;
accessor2.maxValues = {1.0, 1.0, 0.0};
accessor2.minValues = {0.0, 0.0, 0.0};
// Build the mesh primitive and add it to the mesh
primitive.indices = 0; // The index of the accessor for the vertex indices
primitive.attributes["POSITION"] = 1; // The index of the accessor for positions
primitive.material = 0;
primitive.mode = TINYGLTF_MODE_TRIANGLES;
mesh.primitives.push_back(primitive);
// Other tie ups
node.mesh = 0;
scene.nodes.push_back(0); // Default scene
// Define the asset. The version is required
asset.version = "2.0";
asset.generator = "tinygltf";
// Now all that remains is to tie back all the loose objects into the
// our single model.
m.scenes.push_back(scene);
m.meshes.push_back(mesh);
m.nodes.push_back(node);
m.buffers.push_back(buffer);
m.bufferViews.push_back(bufferView1);
m.bufferViews.push_back(bufferView2);
m.accessors.push_back(accessor1);
m.accessors.push_back(accessor2);
m.asset = asset;
// Create a simple material
tinygltf::Material mat;
mat.pbrMetallicRoughness.baseColorFactor = {1.0f, 0.9f, 0.9f, 1.0f};
mat.doubleSided = true;
m.materials.push_back(mat);
// Save it to a file
tinygltf::TinyGLTF gltf;
gltf.WriteGltfSceneToFile(&m, "triangle.gltf",
true, // embedImages
true, // embedBuffers
true, // pretty print
false); // write binary
exit(0);
}
Binary file not shown.
-94
View File
@@ -1,94 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"componentType": 5123,
"count": 3,
"max": [
2
],
"min": [
0
],
"type": "SCALAR"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 3,
"max": [
1.0,
1.0,
0.0
],
"min": [
0.0,
0.0,
0.0
],
"type": "VEC3"
}
],
"asset": {
"generator": "tinygltf",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 6,
"target": 34963
},
{
"buffer": 0,
"byteLength": 36,
"byteOffset": 8,
"target": 34962
}
],
"buffers": [
{
"byteLength": 44,
"uri": "data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA="
}
],
"materials": [
{
"doubleSided": true,
"pbrMetallicRoughness": {
"baseColorFactor": [
1.0,
0.8999999761581421,
0.8999999761581421,
1.0
]
}
}
],
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 1
},
"indices": 0,
"material": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0
}
],
"scenes": [
{
"nodes": [
0
]
}
]
}
-21
View File
@@ -1,21 +0,0 @@
Copyright (c) 2005-2018 Lode Vandevenne
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-36
View File
@@ -1,36 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(dxview)
find_package(glfw3 CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
add_executable(dxview
src/Viewer.h
src/Viewer.cc
src/dxview.cc
)
target_include_directories(dxview
PRIVATE
../../
)
target_compile_definitions(dxview
PRIVATE
DXVIEW_SWAP_CHAIN_BUFFER_COUNT=3
DXVIEW_RES_DIR=L"${PROJECT_SOURCE_DIR}/res"
)
target_link_libraries(dxview
PRIVATE
dxgi
d3dcompiler
d3d12
glfw
spdlog::spdlog
)
set_target_properties(dxview
PROPERTIES
CXX_STANDARD 17
)
-37
View File
@@ -1,37 +0,0 @@
# DirectX glTF Viewer
## Overview
This project was motivated by a lack of sample code demonstrating the graphics API agnostic nature of the glTF specification. The sample code is written using modern C++ and DirectX 12 for the client application.
## Features
* [x] DirectX 12
* [ ] Loader
* [ ] Animation
* [ ] Morph Target
* [ ] Physical Base Rendering
* [ ] Environment Map
## Dependencies
* [CMake](https://github.com/Kitware/CMake)
* [Vcpkg](https://github.com/Microsoft/vcpkg)
* [GLFW](https://github.com/glfw/glfw)
* [spdlog](https://github.com/gabime/spdlog)
## Building
### Install dependencies
```
vcpkg install glfw3:x64-windows
vcpkg install spdlog:x64-windows
```
### Generate Project Files
```
mkdir build
cmake . -B build -DCMAKE_TOOLCHAIN_FILE=${VCPKG_DIR}/script/buildsystem/vcpkg.cmake
```
-3
View File
@@ -1,3 +0,0 @@
float4 main() : SV_Target {
return float4(0.5, 0.5, 0.5, 1.0);
}
-52
View File
@@ -1,52 +0,0 @@
struct RS2PS {
float4 position : SV_POSITION;
#ifdef HAS_TEXCOORD_0
float2 texcoord_0: TEXCOORD_0;
#endif
};
struct TextureInfo {
uint textureIndex;
uint samplerIndex;
};
struct PBRMetallicRoughness {
float4 baseColorFactor;
TextureInfo baseColorTexture;
float metallicFactor;
float roughnessFactor;
TextureInfo metallicRoughnessTexture;
};
cbuffer Material : register(b2) {
PBRMetallicRoughness pbrMetallicRoughness;
};
Texture2D textures[5] : register(t0);
SamplerState samplerState[5] : register(s0);
float4 getBaseColor(float2 uv) {
float4 baseColor = pbrMetallicRoughness.baseColorFactor;
#ifdef HAS_TEXCOORD_0
TextureInfo baseColorTexture = pbrMetallicRoughness.baseColorTexture;
if (baseColorTexture.textureIndex >= 0) {
baseColor *= textures[baseColorTexture.textureIndex].Sample(samplerState[baseColorTexture.samplerIndex], uv);
}
#endif
return baseColor;
}
float4 main(RS2PS input) : SV_Target {
float2 uv = float2(0.0, 0.0);
#ifdef HAS_TEXCOORD_0
uv = input.texcoord_0;
#endif
float4 color = getBaseColor(uv);
return color;
}
-46
View File
@@ -1,46 +0,0 @@
struct IA2VS {
float3 position : POSITION;
#ifdef HAS_NORMAL
float3 normal : NORMAL;
#endif
#ifdef HAS_TANGENT
float4 tangent : TANGENT;
#endif
#ifdef HAS_TEXCOORD_0
float2 texcoord_0: TEXCOORD_0;
#endif
};
struct VS2RS {
float4 position : SV_POSITION;
#ifdef HAS_TEXCOORD_0
float2 texcoord_0: TEXCOORD_0;
#endif
};
cbuffer Camera : register(b0) {
float4x4 V;
float4x4 P;
float4x4 VP;
};
cbuffer Node : register(b1) {
float4x4 M;
};
VS2RS main(IA2VS input) {
VS2RS output;
output.position = mul(float4(input.position, 1.0), M);
output.position = mul(output.position, V);
output.position = mul(output.position, P);
#ifdef HAS_TEXCOORD_0
output.texcoord_0 = input.texcoord_0;
#endif
return output;
}
File diff suppressed because it is too large Load Diff
-130
View File
@@ -1,130 +0,0 @@
#ifndef DXVIEW_VIEWER_GUARD
#define DXVIEW_VIEWER_GUARD
#include <DirectXMath.h>
#include <d3d12.h>
#include <dxgi1_6.h>
#include <tiny_gltf.h>
#include <wrl.h>
#include <filesystem>
#include <map>
#include <string>
#include <vector>
using Microsoft::WRL::ComPtr;
enum RenderPassType { RENDER_PASS_TYPE_PRESENT = 0, RENDER_PASS_TYPE_COUNT };
struct RenderTarget {
ComPtr<ID3D12Resource> pTexture;
D3D12_CPU_DESCRIPTOR_HANDLE viewDescriptor;
};
struct TextureInfo {
int32_t textureIndex;
int32_t samplerIndex;
};
struct PBRMetallicRoughness {
DirectX::XMFLOAT4 baseColorFactor;
TextureInfo baseColorTexture;
float metallicFactor;
float roughnessFactor;
TextureInfo metallicRoughnessTexture;
};
struct Material {
std::string name;
D3D12_BLEND_DESC blendDesc;
D3D12_RASTERIZER_DESC rasterizerDesc;
ComPtr<ID3D12Resource> pBuffer;
void* pBufferData;
ComPtr<ID3D12DescriptorHeap> pSRVDescriptorHeap;
ComPtr<ID3D12DescriptorHeap> pSamplerDescriptorHeap;
};
struct Attribute {
std::string name;
DXGI_FORMAT format;
D3D12_VERTEX_BUFFER_VIEW vertexBufferView;
};
struct Primitive {
std::vector<Attribute> attributes;
uint32_t vertexCount;
D3D12_PRIMITIVE_TOPOLOGY primitiveTopology;
D3D12_INDEX_BUFFER_VIEW indexBufferView;
uint32_t indexCount;
Material* pMaterial;
ComPtr<ID3D12RootSignature> pRootSignature;
ComPtr<ID3D12PipelineState> pPipelineState;
};
struct Mesh {
std::string name;
std::vector<Primitive> primitives;
};
struct Node {
DirectX::XMFLOAT4X4 M;
};
struct Camera {
DirectX::XMFLOAT4X4 V;
DirectX::XMFLOAT4X4 P;
DirectX::XMFLOAT4X4 VP;
};
class Viewer {
public:
Viewer(HWND window, tinygltf::Model* pModel);
void update(double deltaTime);
void render(double deltaTime);
private:
void initDirectX(HWND window);
void buildRenderTargets();
void buildResources();
void buildBuffers(std::vector<ComPtr<ID3D12Resource> >* pStagingResources);
void buildImages(std::vector<ComPtr<ID3D12Resource> >* pStagingResources);
void buildSamplerDescs();
void buildMaterials();
void buildMeshes();
void buildNodes();
void drawNode(uint64_t nodeIndex);
private:
tinygltf::Model* pModel_;
ComPtr<IDXGIFactory1> pFactory_;
ComPtr<IDXGIAdapter1> pAdapter_;
ComPtr<ID3D12Device> pDevice_;
ComPtr<ID3D12CommandQueue> pDirectCommandQueue_;
UINT64 directFenceValue_;
ComPtr<ID3D12Fence> pDirectFence_;
ComPtr<ID3D12CommandQueue> pCopyCommandQueue_;
UINT64 copyFenceValue_;
ComPtr<ID3D12Fence> pCopyFence_;
ComPtr<IDXGISwapChain3> pSwapChain_;
ComPtr<ID3D12Resource> pSwapChainBuffers_[DXVIEW_SWAP_CHAIN_BUFFER_COUNT];
ComPtr<ID3D12CommandAllocator>
pDirectCommandAllocators_[DXVIEW_SWAP_CHAIN_BUFFER_COUNT];
ComPtr<ID3D12GraphicsCommandList> pDirectCommandList_;
ComPtr<ID3D12CommandAllocator> pCopyCommandAllocator_;
ComPtr<ID3D12GraphicsCommandList> pCopyCommandList_;
UINT descriptorIncrementSize_[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES];
ComPtr<ID3D12DescriptorHeap>
pRTVDescriptorHeaps_[DXVIEW_SWAP_CHAIN_BUFFER_COUNT];
std::vector<RenderTarget> renderTargets_[DXVIEW_SWAP_CHAIN_BUFFER_COUNT];
std::vector<ComPtr<ID3D12Resource> > pBuffers_;
std::vector<ComPtr<ID3D12Resource> > pTextures_;
std::vector<D3D12_SAMPLER_DESC> samplerDescs_;
std::vector<Material> materials_;
std::vector<Mesh> meshes_;
std::vector<ComPtr<ID3D12Resource> > pNodeBuffers_;
ComPtr<ID3D12Resource> pCameraBuffer_;
};
#endif
-90
View File
@@ -1,90 +0,0 @@
#define GLFW_EXPOSE_NATIVE_WIN32
#define TINYGLTF_IMPLEMENTATION
#define STBI_MSC_SECURE_CRT
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#include <spdlog/spdlog.h>
#include <tiny_gltf.h>
#undef GLFW_EXPOSE_NATIVE_WIN32
#undef TINYGLTF_IMPLEMENTATION
#undef STBI_MSC_SECURE_CRT
#undef STB_IMAGE_IMPLEMENTATION
#undef STB_IMAGE_WRITE_IMPLEMENTATION
#include <iostream>
#include <string>
#include "Viewer.h"
static void onError(int error, const char* message) {
spdlog::error("[{}] {}", error, message);
}
static void onRender(Viewer* pViewer, double deltaTime) {
pViewer->update(deltaTime);
pViewer->render(deltaTime);
}
int main(int argc, char* argv[]) {
tinygltf::TinyGLTF context;
tinygltf::Model model;
std::string error;
std::string warning;
if (!context.LoadASCIIFromFile(&model, &error, &warning, argv[1])) {
if (!error.empty()) {
spdlog::error("{}", error);
}
if (!warning.empty()) {
spdlog::warn("{}", warning);
}
exit(EXIT_FAILURE);
}
GLFWwindow* pWindow;
glfwSetErrorCallback(onError);
if (!glfwInit()) {
spdlog::error("Fail to initialize GLFW!!!");
exit(EXIT_FAILURE);
}
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
pWindow = glfwCreateWindow(512, 512, "dxview", nullptr, nullptr);
if (!pWindow) {
spdlog::error("Fail to create GLFWwindow!!!");
glfwTerminate();
exit(EXIT_FAILURE);
}
auto pViewer = std::make_unique<Viewer>(glfwGetWin32Window(pWindow), &model);
if (!pViewer) {
spdlog::error("Fail to create Viewer");
glfwDestroyWindow(pWindow);
glfwTerminate();
exit(EXIT_FAILURE);
}
auto prevTimeStamp = glfwGetTime();
while (!glfwWindowShouldClose(pWindow)) {
auto currTimeStamp = glfwGetTime();
onRender(pViewer.get(), currTimeStamp - prevTimeStamp);
prevTimeStamp = currTimeStamp;
glfwPollEvents();
}
glfwDestroyWindow(pWindow);
glfwTerminate();
exit(EXIT_SUCCESS);
}
-16
View File
@@ -1,16 +0,0 @@
cmake_minimum_required(VERSION 3.6)
project(gltfutil)
set(CMAKE_CXX_STANDARD 11)
include_directories(../../)
include_directories(../common/)
file(GLOB gltfutil_sources *.cc *.h)
add_executable(gltfutil ${gltfutil_sources} ../common/lodepng.cpp)
install ( TARGETS
gltfutil
DESTINATION
bin
)
-169
View File
@@ -1,169 +0,0 @@
#include <algorithm>
#include <iostream>
#include "stb_image_write.h"
#include "texture_dumper.h"
#include "lodepng.h" // ../common
#include "tinyexr.h"
#include <tiny_gltf.h>
using namespace gltfutil;
using namespace tinygltf;
using std::cout;
static LodePNGColorType GetLodePNGColorType(int channels) {
if (channels == 1) {
return LodePNGColorType::LCT_GREY;
} else if (channels == 2) {
return LodePNGColorType::LCT_GREY_ALPHA;
} else if (channels == 3) {
return LodePNGColorType::LCT_RGB;
} else if (channels == 4) {
return LodePNGColorType::LCT_RGBA;
} else {
std::cerr << "??? unsupported channels " << channels << "\n";
return LodePNGColorType::LCT_RGB; // FIXME(syoyo): Raise error
}
}
static void ToBigEndian(std::vector<uint8_t>* image) {
assert(image->size() % 2 == 0);
union {
unsigned int i;
char c[4];
} bint = {0x01020304};
bool is_big_endian = (bint.c[0] == 1);
if (is_big_endian) {
return;
}
uint16_t *ptr = reinterpret_cast<uint16_t *>(image->data());
size_t n = image->size() / 2;
for (size_t i = 0; i < n; i++) {
ptr[i] = ((0xFF00 & ptr[i]) >> 8) | ((0x00FF & ptr[i]) << 8);
}
}
static bool Save16bitImageAsEXR(const std::string& filename,
const tinygltf::Image& image) {
assert(image.bits == 16);
std::vector<float> buf(image.width * image.height * image.component);
// widen to float image.
// Store as is(i.e, pixel value range is [0.0, 65535.0])
const unsigned short* ptr =
reinterpret_cast<const unsigned short*>(image.image.data());
for (size_t i = 0; i < image.width * image.height * image.component; i++) {
buf[i] = float(ptr[i]);
}
const char* err = nullptr;
int ret = SaveEXR(buf.data(), image.width, image.height, image.component,
/* save_as_fp16 */ 0, filename.c_str(), &err);
if (err) {
std::cerr << "EXR err: " << err << std::endl;
FreeEXRErrorMessage(err);
return false;
}
return (ret == TINYEXR_SUCCESS);
}
texture_dumper::texture_dumper(const Model& input)
: model(input), configured_format(texture_output_format::png) {
cout << "Texture dumper\n";
}
void texture_dumper::dump_to_folder(const std::string& path) {
cout << "dumping to folder " << path << '\n';
cout << "model file has " << model.textures.size() << " textures.\n";
size_t index = 0;
for (const auto& texture : model.textures) {
index++;
const auto& image = model.images[texture.source];
cout << "image name is: \"" << image.name << "\"\n";
cout << "image size is: " << image.width << 'x' << image.height << '\n';
cout << "pixel channel count :" << image.component << '\n';
cout << "pixel bit depth :" << image.bits << '\n';
std::string basename =
image.name.empty() ? std::to_string(index) : image.name;
unsigned char* bytes_to_write =
const_cast<unsigned char*>(image.image.data());
std::string filename;
switch (configured_format) {
case texture_output_format::png:
filename = path + "/" + basename + ".png";
if (this->use_exr) {
if (image.pixel_type == TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT) {
filename = path + "/" + basename + ".exr";
}
}
std::cout << "Image will be written to " << filename << '\n';
if (image.pixel_type == TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT) {
if (this->use_exr) {
bool ret = Save16bitImageAsEXR(filename, image);
assert(ret);
} else {
// Use lodepng to save 16bit PNG.
// NOTE(syoyo): `loadpng::encode` requires image data must be stored in big endian.
std::vector<uint8_t> tmp = image.image; // copy
ToBigEndian(&tmp);
unsigned ret = lodepng::encode(
filename, tmp.data(), image.width, image.height,
GetLodePNGColorType(image.component), /* bits */ 16);
assert(ret == 0); // 0 = no err.
}
} else {
// TODO(syoyo): check status
stbi_write_png(filename.c_str(), image.width, image.height,
image.component, bytes_to_write, 0);
}
break;
case texture_output_format::bmp:
filename = path + "/" + basename + ".bmp";
std::cout << "Image will be written to " << filename << '\n';
stbi_write_bmp(filename.c_str(), image.width, image.height,
image.component, bytes_to_write);
break;
case texture_output_format::tga:
filename = path + "/" + basename + ".tga";
std::cout << "Image will be written to " << filename << '\n';
stbi_write_tga(filename.c_str(), image.width, image.height,
image.component, bytes_to_write);
break;
}
}
}
void texture_dumper::set_output_format(texture_output_format format) {
configured_format = format;
}
texture_dumper::texture_output_format texture_dumper::get_fromat_from_string(
const std::string& str) {
std::string type = str;
std::transform(str.begin(), str.end(), type.begin(), ::tolower);
if (type == "png") return texture_output_format::png;
if (type == "bmp") return texture_output_format::bmp;
if (type == "tga") return texture_output_format::tga;
return texture_output_format::not_specified;
}
-7
View File
@@ -1,7 +0,0 @@
.vs
Debug
x64
packages
!*.sln
!*.vcxproj*
-69
View File
@@ -1,69 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(glview)
set ( CMAKE_PREFIX_PATH cmake )
set ( DRACO_DIR "" CACHE STRING "Path to draco" )
find_package ( GLEW REQUIRED )
find_package ( GLFW3 REQUIRED )
find_package ( OpenGL REQUIRED )
if (APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(COREVIDEO_LIBRARY CoreVideo)
find_library(IOKIT_LIBRARY IOKit)
else ()
if (NOT WIN32)
# This means it is Unices
set ( GLFW3_UNIX_LINK_LIBRARIES X11 Xxf86vm Xrandr Xi Xinerama Xcursor )
find_package (Threads)
endif()
endif (APPLE)
set(CMAKE_CXX_STANDARD 11)
if (DEFINED DRACO_DIR)
if (DRACO_DIR STREQUAL "")
else ()
# TODO(syoyo): better CMake script for draco
add_definitions(-DTINYGLTF_ENABLE_DRACO)
include_directories(${DRACO_DIR}/include)
link_directories(${DRACO_DIR}/lib)
set(DRACO_LIBRARY draco)
endif ()
endif()
include_directories(
../../
../common
# ${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLFW3_INCLUDE_DIR}
)
add_executable(glview
glview.cc
../common/trackball.cc
)
target_link_libraries ( glview
${DRACO_LIBRARY}
${GLFW3_UNIX_LINK_LIBRARIES}
${GLEW_LIBRARIES}
${GLFW3_glfw_LIBRARY}
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
${COCOA_LIBRARY}
${COREVIDEO_LIBRARY}
${IOKIT_LIBRARY}
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
)
install ( TARGETS
glview
DESTINATION
bin
)
-61
View File
@@ -1,61 +0,0 @@
# GNU Make workspace makefile autogenerated by Premake
ifndef config
config=debug_native
endif
ifndef verbose
SILENT = @
endif
ifeq ($(config),debug_native)
glview_config = debug_native
endif
ifeq ($(config),debug_x64)
glview_config = debug_x64
endif
ifeq ($(config),debug_x32)
glview_config = debug_x32
endif
ifeq ($(config),release_native)
glview_config = release_native
endif
ifeq ($(config),release_x64)
glview_config = release_x64
endif
ifeq ($(config),release_x32)
glview_config = release_x32
endif
PROJECTS := glview
.PHONY: all clean help $(PROJECTS)
all: $(PROJECTS)
glview:
ifneq (,$(glview_config))
@echo "==== Building glview ($(glview_config)) ===="
@${MAKE} --no-print-directory -C . -f glview.make config=$(glview_config)
endif
clean:
@${MAKE} --no-print-directory -C . -f glview.make clean
help:
@echo "Usage: make [config=name] [target]"
@echo ""
@echo "CONFIGURATIONS:"
@echo " debug_native"
@echo " debug_x64"
@echo " debug_x32"
@echo " release_native"
@echo " release_x64"
@echo " release_x32"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
@echo " clean"
@echo " glview"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
@@ -1,71 +0,0 @@
#-*-cmake-*-
#
# yue.nicholas@gmail.com
#
# This auxiliary CMake file helps in find the glfw3 headers and libraries
#
# GLFW3_FOUND set if glfw3 is found.
# GLFW3_INCLUDE_DIR glfw3's include directory
# GLFW3_LIBRARY_DIR glfw3's library directory
# GLFW3_LIBRARIES all glfw3 libraries
FIND_PACKAGE (Threads)
FIND_PACKAGE ( PackageHandleStandardArgs )
FIND_PATH( GLFW3_LOCATION include/GLFW/glfw3.h
"$ENV{GLFW3_HOME}"
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS ( GLFW3
REQUIRED_VARS GLFW3_LOCATION
)
IF (GLFW3_FOUND)
SET( GLFW3_INCLUDE_DIR "${GLFW3_LOCATION}/include" CACHE STRING "GLFW3 include path")
IF (GLFW3_USE_STATIC_LIBS)
FIND_LIBRARY ( GLFW3_glfw_LIBRARY libglfw3.a ${GLFW3_LOCATION}/lib
)
ELSE (GLFW3_USE_STATIC_LIBS)
# On windows build, we need to look for glfw3
IF (WIN32)
SET ( GLFW3_LIBRARY_NAME glfw3 )
ELSE ()
SET ( GLFW3_LIBRARY_NAME glfw )
ENDIF()
FIND_LIBRARY ( GLFW3_glfw_LIBRARY ${GLFW3_LIBRARY_NAME} ${GLFW3_LOCATION}/lib
)
ENDIF (GLFW3_USE_STATIC_LIBS)
IF (APPLE)
FIND_LIBRARY ( COCOA_LIBRARY Cocoa )
FIND_LIBRARY ( IOKIT_LIBRARY IOKit )
FIND_LIBRARY ( COREVIDEO_LIBRARY CoreVideo )
ELSEIF (UNIX AND NOT APPLE)
SET ( GLFW3_REQUIRED_X11_LIBRARIES
X11
Xi
Xrandr
Xinerama
Xcursor
Xxf86vm
m
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
)
ENDIF ()
SET ( GLFW3_LIBRARIES
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
${GLFW3_glfw_LIBRARY}
# UNIX
${GLFW3_REQUIRED_X11_LIBRARIES}
# APPLE
${COCOA_LIBRARY}
${IOKIT_LIBRARY}
${COREVIDEO_LIBRARY}
CACHE STRING "GLFW3 required libraries"
)
ENDIF ()
-246
View File
@@ -1,246 +0,0 @@
# GNU Make project makefile autogenerated by Premake
ifndef config
config=debug_native
endif
ifndef verbose
SILENT = @
endif
.PHONY: clean prebuild prelink
ifeq ($(config),debug_native)
RESCOMP = windres
TARGETDIR = bin/native/Debug
TARGET = $(TARGETDIR)/glview
OBJDIR = obj/native/Debug
DEFINES += -DDEBUG
INCLUDES += -I. -I../.. -I../common
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra -std=c++11
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),debug_x64)
RESCOMP = windres
TARGETDIR = bin/x64/Debug
TARGET = $(TARGETDIR)/glview
OBJDIR = obj/x64/Debug
DEFINES += -DDEBUG
INCLUDES += -I. -I../.. -I../common
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra -std=c++11
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),debug_x32)
RESCOMP = windres
TARGETDIR = bin/x32/Debug
TARGET = $(TARGETDIR)/glview
OBJDIR = obj/x32/Debug
DEFINES += -DDEBUG
INCLUDES += -I. -I../.. -I../common
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra -std=c++11
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_native)
RESCOMP = windres
TARGETDIR = bin/native/Release
TARGET = $(TARGETDIR)/glview
OBJDIR = obj/native/Release
DEFINES += -DNDEBUG
INCLUDES += -I. -I../.. -I../common
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -Wall -Wextra
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -Wall -Wextra -std=c++11
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -s `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_x64)
RESCOMP = windres
TARGETDIR = bin/x64/Release
TARGET = $(TARGETDIR)/glview
OBJDIR = obj/x64/Release
DEFINES += -DNDEBUG
INCLUDES += -I. -I../.. -I../common
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -Wall -Wextra
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -Wall -Wextra -std=c++11
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
ifeq ($(config),release_x32)
RESCOMP = windres
TARGETDIR = bin/x32/Release
TARGET = $(TARGETDIR)/glview
OBJDIR = obj/x32/Release
DEFINES += -DNDEBUG
INCLUDES += -I. -I../.. -I../common
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -Wall -Wextra
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -Wall -Wextra -std=c++11
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lGL -lGLU -lm -lGLEW -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s `pkg-config --libs glfw3`
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
all: prebuild prelink $(TARGET)
@:
endif
OBJECTS := \
$(OBJDIR)/trackball.o \
$(OBJDIR)/glview.o \
RESOURCES := \
CUSTOMFILES := \
SHELLTYPE := posix
ifeq (.exe,$(findstring .exe,$(ComSpec)))
SHELLTYPE := msdos
endif
$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR)
@echo Linking glview
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)
$(CUSTOMFILES): | $(OBJDIR)
$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif
$(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif
clean:
@echo Cleaning glview
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild:
$(PREBUILDCMDS)
prelink:
$(PRELINKCMDS)
ifneq (,$(PCH))
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
$(GCH): $(PCH) | $(OBJDIR)
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
else
$(OBJECTS): | $(OBJDIR)
endif
$(OBJDIR)/trackball.o: ../common/trackball.cc
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/glview.o: glview.cc
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(OBJDIR)/$(notdir $(PCH)).d
endif
-31
View File
@@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2050
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glview", "glview\glview.vcxproj", "{D078BB24-377E-497B-8045-03AF2A0547ED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x64.ActiveCfg = Debug|x64
{D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x64.Build.0 = Debug|x64
{D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x86.ActiveCfg = Debug|Win32
{D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x86.Build.0 = Debug|Win32
{D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x64.ActiveCfg = Release|x64
{D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x64.Build.0 = Release|x64
{D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x86.ActiveCfg = Release|Win32
{D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB7C2F91-06C9-4BD8-95BF-04814E0C62DA}
EndGlobalSection
EndGlobal
-152
View File
@@ -1,152 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{D078BB24-377E-497B-8045-03AF2A0547ED}</ProjectGuid>
<RootNamespace>glview</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib;glu32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib;glu32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib;glu32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib;glu32.lib</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\common\trackball.cc" />
<ClCompile Include="..\glview.cc" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets" Condition="Exists('..\packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets')" />
<Import Project="..\packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets" Condition="Exists('..\packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets'))" />
<Error Condition="!Exists('..\packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets'))" />
</Target>
</Project>
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\glview.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\common\trackball.cc">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nupengl.core" version="0.1.0.1" targetFramework="native" />
<package id="nupengl.core.redist" version="0.1.0.1" targetFramework="native" />
</packages>
-12
View File
@@ -1,12 +0,0 @@
Jsonnet representation of glTF
https://jsonnet.org/
# Benefit
You can assign id programatically
```
{
```
@@ -1,11 +0,0 @@
newmtl hairSG
Ka 0.000000 0.000000 0.000000
Kd 0.000000 0.000000 0.000000
Ks 0.000000 0.000000 0.000000
Kt 1.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ns 1.000000
Ni 1.000000
illum 4
map_Kd color.png
-102
View File
@@ -1,102 +0,0 @@
newmtl _blinn1SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl blinn1SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd skin_dif.tif
Ni 1.00
Ks 0.28 0.28 0.28
newmtl eyeMTLSG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl eyebrows_hairTubeShader2SG1
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl eyelushes_hairTubeShader3SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl face_eye_mouth_blinn2SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd HWI_male_gum_dif.jpg
Ni 1.00
Ks 0.50 0.50 0.50
newmtl hairFrontHair_hairTubeShader1SG1
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl hairMainHair_hairTubeShader1SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl hairStrayHair_hairTubeShader1SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl hairTopFix_hairTubeShader1SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl hairTopFix_surfaceShader13SG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl initialShadingGroup
illum 4
Kd 0.37 0.37 0.37
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 1.00
newmtl irisMTLSG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl skinSG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd skin_dif.tif
Ni 1.00
Ks 0.14 0.14 0.14
newmtl teethMTLSG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
newmtl tongueMTLSG
illum 4
Kd 0.00 0.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 0.00
File diff suppressed because it is too large Load Diff
@@ -1,11 +0,0 @@
{
"sim": {
"version": 1,
"id": "sim",
"name": "1",
"kind": "Puppeteer",
"mood": null,
"postPlaybackMood": null,
"duration": 3.75
}
}
File diff suppressed because it is too large Load Diff
@@ -1,11 +0,0 @@
{
"lowpoly": {
"version": 1,
"id": "lowpoly",
"name": "1",
"kind": "Puppeteer",
"mood": null,
"postPlaybackMood": null,
"duration": 62.5
}
}
File diff suppressed because it is too large Load Diff
-128
View File
@@ -1,128 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"componentType": 5125,
"count": 11532,
"max": [
11531.0
],
"min": [
0.0
],
"type": "SCALAR"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 11532,
"max": [
14679.0,
1.0,
9728.0
],
"min": [
14678.0,
0.0,
9216.0
],
"type": "VEC3"
},
{
"bufferView": 2,
"componentType": 5126,
"count": 11532,
"max": [
1.0,
1.0,
1.0
],
"min": [
-1.0,
-1.0,
-1.0
],
"type": "VEC3"
},
{
"bufferView": 3,
"componentType": 5126,
"count": 11532,
"max": [
0.96875,
0.96875
],
"min": [
0.03125,
0.03125
],
"type": "VEC2"
}
],
"asset": {
"generator": "mesh-modify",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 46128,
"target": 34963
},
{
"buffer": 0,
"byteLength": 138384,
"byteOffset": 46128,
"target": 34962
},
{
"buffer": 0,
"byteLength": 138384,
"byteOffset": 184512,
"target": 34962
},
{
"buffer": 0,
"byteLength": 92256,
"byteOffset": 322896,
"target": 34962
}
],
"buffers": [
{
"byteLength": 415152,
"name": "bufffer0",
"uri": "output.bin"
}
],
"meshes": [
{
"name": "r.28.18.obj",
"primitives": [
{
"attributes": {
"NORMAL": 2,
"POSITION": 1,
"TEXCOORD_0": 3
},
"indices": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0,
"name": "mesh"
}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
]
}
-185
View File
@@ -1,185 +0,0 @@
{
"asset": {
"copyright": "(C)2020 syoyo",
"generator": "maya2glTF master d293e09",
"version": "2.0"
},
"scenes": [
{
"nodes": [
0
]
}
],
"scene": 0,
"nodes": [
{
"name": "pPlane1",
"mesh": 0
}
],
"meshes": [
{
"name": "pPlaneShape1",
"extras": {
"targetNames": []
},
"primitives": [
{
"attributes": {
"NORMAL": 1,
"POSITION": 2,
"TANGENT": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"mode": 4,
"material": 0
}
]
}
],
"materials": [
{
"name": "lambert1",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.4000000059604645,
0.4000000059604645,
0.4000000059604645,
1.0
],
"metallicFactor": 0.0,
"roughnessFactor": 1.0
}
}
],
"accessors": [
{
"name": "pPlaneShape1#0/indices",
"bufferView": 0,
"byteOffset": 0,
"componentType": 5123,
"count": 24,
"max": [
8
],
"min": [
0
],
"type": "SCALAR"
},
{
"name": "pPlaneShape1#0/vertices/NORMAL",
"bufferView": 1,
"byteOffset": 0,
"componentType": 5126,
"count": 9,
"max": [
0.0,
1.0,
0.0
],
"min": [
0.0,
1.0,
0.0
],
"type": "VEC3"
},
{
"name": "pPlaneShape1#0/vertices/POSITION",
"bufferView": 1,
"byteOffset": 108,
"componentType": 5126,
"count": 9,
"max": [
0.5,
0.0,
0.5
],
"min": [
-0.5,
0.0,
-0.5
],
"type": "VEC3"
},
{
"name": "pPlaneShape1#0/vertices/TANGENT",
"bufferView": 2,
"byteOffset": 0,
"componentType": 5126,
"count": 9,
"max": [
1.0,
0.0,
0.0,
1.0
],
"min": [
1.0,
0.0,
0.0,
1.0
],
"type": "VEC4"
},
{
"name": "pPlaneShape1#0/vertices/TEXCOORD_0",
"bufferView": 3,
"byteOffset": 0,
"componentType": 5126,
"count": 9,
"max": [
1.0,
1.0
],
"min": [
0.0,
0.0
],
"type": "VEC2"
}
],
"bufferViews": [
{
"name": "plane/data/indices-2",
"buffer": 0,
"byteOffset": 432,
"byteLength": 48,
"target": 34963
},
{
"name": "plane/data/vertices-12",
"buffer": 0,
"byteOffset": 144,
"byteLength": 216,
"byteStride": 12,
"target": 34962
},
{
"name": "plane/data/vertices-16",
"buffer": 0,
"byteOffset": 0,
"byteLength": 144,
"byteStride": 16,
"target": 34962
},
{
"name": "plane/data/vertices-8",
"buffer": 0,
"byteOffset": 360,
"byteLength": 72,
"byteStride": 8,
"target": 34962
}
],
"buffers": [
{
"name": "plane/data",
"byteLength": 480,
"uri": "plane0.bin"
}
]
}
Binary file not shown.
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
./mesh-conv --op gltf2obj -i ../hairsimtest/sim.gltf
#./mesh-conv --op obj2gltf --verbose -i hair_bfShape_0.obj
./mesh-conv --op obj2gltf -i hair_bfShape_1.obj -o hair_bfShape_1.gltf
@@ -1,224 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"componentType": 5123,
"count": 36,
"max": [
35
],
"min": [
0
],
"type": "SCALAR"
},
{
"bufferView": 1,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
1,
1.000001
],
"min": [
-1,
-1,
-1
],
"type": "VEC3"
},
{
"bufferView": 2,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
1,
1
],
"min": [
-1,
-1,
-1
],
"type": "VEC3"
},
{
"bufferView": 3,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
-0,
-0,
1
],
"min": [
0,
-0,
-1,
-1
],
"type": "VEC4"
},
{
"bufferView": 4,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
1
],
"min": [
-1,
-1
],
"type": "VEC2"
}
],
"asset": {
"generator": "VKTS glTF 2.0 exporter",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 72,
"byteOffset": 0,
"target": 34963
},
{
"buffer": 0,
"byteLength": 432,
"byteOffset": 72,
"target": 34962
},
{
"buffer": 0,
"byteLength": 432,
"byteOffset": 504,
"target": 34962
},
{
"buffer": 0,
"byteLength": 576,
"byteOffset": 936,
"target": 34962
},
{
"buffer": 0,
"byteLength": 288,
"byteOffset": 1512,
"target": 34962
}
],
"buffers": [
{
"byteLength": 1800,
"uri": "Cube.bin"
}
],
"images": [
{
"0comment": "Use Cube_MetallicRoughness.png to reduce scene filesize",
"uri": "Cube_MetallicRoughness.png"
},
{
"uri": "Cube_MetallicRoughness.png"
}
],
"materials": [
{
"emissiveTexture": {
"index": 0,
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
1
],
"scale": [
1,
-1
]
}
}
}
},
{
"name": "Cube",
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0
},
"metallicRoughnessTexture": {
"index": 1,
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
1
],
"rotation": 1.57079632679,
"scale": [
0.5,
0.5
]
}
}
}
}
}
],
"meshes": [
{
"name": "Cube",
"primitives": [
{
"attributes": {
"NORMAL": 2,
"POSITION": 1,
"TANGENT": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"material": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0,
"name": "Cube"
}
],
"samplers": [
{}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
],
"textures": [
{
"sampler": 0,
"source": 0
},
{
"sampler": 0,
"source": 1
}
]
}
@@ -1,224 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"componentType": 5123,
"count": 36,
"max": [
35
],
"min": [
0
],
"type": "SCALAR"
},
{
"bufferView": 1,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
1,
1.000001
],
"min": [
-1,
-1,
-1
],
"type": "VEC3"
},
{
"bufferView": 2,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
1,
1
],
"min": [
-1,
-1,
-1
],
"type": "VEC3"
},
{
"bufferView": 3,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
-0,
-0,
1
],
"min": [
0,
-0,
-1,
-1
],
"type": "VEC4"
},
{
"bufferView": 4,
"byteOffset": 0,
"componentType": 5126,
"count": 36,
"max": [
1,
1
],
"min": [
-1,
-1
],
"type": "VEC2"
}
],
"asset": {
"generator": "VKTS glTF 2.0 exporter",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 72,
"byteOffset": 0,
"target": 34963
},
{
"buffer": 0,
"byteLength": 432,
"byteOffset": 72,
"target": 34962
},
{
"buffer": 0,
"byteLength": 432,
"byteOffset": 504,
"target": 34962
},
{
"buffer": 0,
"byteLength": 576,
"byteOffset": 936,
"target": 34962
},
{
"buffer": 0,
"byteLength": 288,
"byteOffset": 1512,
"target": 34962
}
],
"buffers": [
{
"byteLength": 1800,
"uri": "Cube.bin"
}
],
"images": [
{
"0comment": "Use Cube_MetallicRoughness.png to reduce scene filesize",
"uri": "Cube_MetallicRoughness.png"
},
{
"uri": "Cube_MetallicRoughness.png"
}
],
"materials": [
{
"emissiveTexture": {
"index": 0,
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
1
],
"scale": [
1,
-1
]
}
}
}
},
{
"name": "Cube",
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0
},
"metallicRoughnessTexture": {
"index": 1,
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
1
],
"rotation": 1.57079632679,
"scale": [
0.5,
0.5
]
}
}
}
}
}
],
"meshes": [
{
"name": "Cube",
"primitives": [
{
"attributes": {
"NORMAL": 2,
"POSITION": 1,
"TANGENT": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"material": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0,
"name": "Cube"
}
],
"samplers": [
{}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
],
"textures": [
{
"sampler": 0,
"source": 0
},
{
"sampler": 0,
"source": 1
}
]
}
@@ -1,3 +0,0 @@
all:
python concat_mesh.py hair_bfShape_1.gltf hair_bfShape_0.gltf sim.gltf merged-sim.gltf
# python replace_attrib.py merged-sim.gltf replaced.gltf "added/hair_bfShape_1.obj" "hair_bfShape" 0 1
File diff suppressed because it is too large Load Diff
@@ -1,288 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"componentType": 5125,
"count": 79434,
"max": [
28135.0
],
"min": [
0.0
],
"name": "hair_bfShape_1.obj#0/indices",
"type": "SCALAR"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 28136,
"max": [
11.10669994354248,
170.1320037841797,
7.035999774932861
],
"min": [
-11.581600189208984,
142.8719940185547,
-15.023500442504883
],
"name": "hair_bfShape_1.obj#0/POSITION",
"type": "VEC3"
},
{
"bufferView": 2,
"componentType": 5126,
"count": 28136,
"max": [
0.9999430179595947,
0.9999679923057556,
0.9999390244483948
],
"min": [
-0.9997580051422119,
-0.8950620293617249,
-0.9999200105667114
],
"name": "hair_bfShape_1.obj#0/NORMAL",
"type": "VEC3"
},
{
"bufferView": 3,
"componentType": 5126,
"count": 28136,
"max": [
0.889851987361908,
0.998104989528656
],
"min": [
0.0014202300226315856,
-0.0010660899570211768
],
"name": "hair_bfShape_1.obj#0/TEXCOORD_0",
"type": "VEC2"
},
{
"bufferView": 4,
"componentType": 5123,
"count": 28136,
"max": [
97.0,
97.0,
94.0,
93.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/JOINTS_0",
"type": "VEC4"
},
{
"bufferView": 5,
"componentType": 5123,
"count": 28136,
"max": [
93.0,
93.0,
92.0,
92.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/JOINTS_1",
"type": "VEC4"
},
{
"bufferView": 6,
"componentType": 5123,
"count": 28136,
"max": [
91.0,
0.0,
0.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/JOINTS_2",
"type": "VEC4"
},
{
"bufferView": 7,
"componentType": 5126,
"count": 28136,
"max": [
1.0,
0.5,
0.3330000042915344,
0.24390600621700287
],
"min": [
0.2014250010251999,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/WEIGHTS_0",
"type": "VEC4"
},
{
"bufferView": 8,
"componentType": 5126,
"count": 28136,
"max": [
0.18594099581241608,
0.11678200215101242,
0.10268200188875198,
0.03563150018453598
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/WEIGHTS_1",
"type": "VEC4"
},
{
"bufferView": 9,
"componentType": 5126,
"count": 28136,
"max": [
0.001464050030335784,
0.0,
0.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/WEIGHTS_2",
"type": "VEC4"
}
],
"asset": {
"generator": "mesh-modify",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 317736,
"target": 34963
},
{
"buffer": 0,
"byteLength": 337632,
"byteOffset": 317736,
"target": 34962
},
{
"buffer": 0,
"byteLength": 337632,
"byteOffset": 655368,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 993000,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 1218088,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 1443176,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 1668264,
"target": 34962
},
{
"buffer": 0,
"byteLength": 450176,
"byteOffset": 1893352,
"target": 34962
},
{
"buffer": 0,
"byteLength": 450176,
"byteOffset": 2343528,
"target": 34962
},
{
"buffer": 0,
"byteLength": 450176,
"byteOffset": 2793704,
"target": 34962
}
],
"buffers": [
{
"byteLength": 3243880,
"name": "bufffer0",
"uri": "hair_bfShape_1.bin"
}
],
"meshes": [
{
"name": "hair_bfShape_1.obj",
"primitives": [
{
"attributes": {
"JOINTS_0": 4,
"JOINTS_1": 5,
"JOINTS_2": 6,
"NORMAL": 2,
"POSITION": 1,
"TEXCOORD_0": 3,
"WEIGHTS_0": 7,
"WEIGHTS_1": 8,
"WEIGHTS_2": 9
},
"indices": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0,
"name": "mesh"
}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
]
}
@@ -1,288 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"componentType": 5125,
"count": 79434,
"max": [
28135.0
],
"min": [
0.0
],
"name": "hair_bfShape_1.obj#0/indices",
"type": "SCALAR"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 28136,
"max": [
11.10669994354248,
170.1320037841797,
7.035999774932861
],
"min": [
-11.581600189208984,
142.8719940185547,
-15.023500442504883
],
"name": "hair_bfShape_1.obj#0/POSITION",
"type": "VEC3"
},
{
"bufferView": 2,
"componentType": 5126,
"count": 28136,
"max": [
0.9999430179595947,
0.9999679923057556,
0.9999390244483948
],
"min": [
-0.9997580051422119,
-0.8950620293617249,
-0.9999200105667114
],
"name": "hair_bfShape_1.obj#0/NORMAL",
"type": "VEC3"
},
{
"bufferView": 3,
"componentType": 5126,
"count": 28136,
"max": [
0.889851987361908,
0.998104989528656
],
"min": [
0.0014202300226315856,
-0.0010660899570211768
],
"name": "hair_bfShape_1.obj#0/TEXCOORD_0",
"type": "VEC2"
},
{
"bufferView": 4,
"componentType": 5123,
"count": 28136,
"max": [
97.0,
97.0,
94.0,
93.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/JOINTS_0",
"type": "VEC4"
},
{
"bufferView": 5,
"componentType": 5123,
"count": 28136,
"max": [
93.0,
93.0,
92.0,
92.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/JOINTS_1",
"type": "VEC4"
},
{
"bufferView": 6,
"componentType": 5123,
"count": 28136,
"max": [
91.0,
0.0,
0.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/JOINTS_2",
"type": "VEC4"
},
{
"bufferView": 7,
"componentType": 5126,
"count": 28136,
"max": [
1.0,
0.5,
0.3330000042915344,
0.24390600621700287
],
"min": [
0.2014250010251999,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/WEIGHTS_0",
"type": "VEC4"
},
{
"bufferView": 8,
"componentType": 5126,
"count": 28136,
"max": [
0.18594099581241608,
0.11678200215101242,
0.10268200188875198,
0.03563150018453598
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/WEIGHTS_1",
"type": "VEC4"
},
{
"bufferView": 9,
"componentType": 5126,
"count": 28136,
"max": [
0.001464050030335784,
0.0,
0.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"name": "hair_bfShape_1.obj#0/WEIGHTS_2",
"type": "VEC4"
}
],
"asset": {
"generator": "mesh-modify",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 317736,
"target": 34963
},
{
"buffer": 0,
"byteLength": 337632,
"byteOffset": 317736,
"target": 34962
},
{
"buffer": 0,
"byteLength": 337632,
"byteOffset": 655368,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 993000,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 1218088,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 1443176,
"target": 34962
},
{
"buffer": 0,
"byteLength": 225088,
"byteOffset": 1668264,
"target": 34962
},
{
"buffer": 0,
"byteLength": 450176,
"byteOffset": 1893352,
"target": 34962
},
{
"buffer": 0,
"byteLength": 450176,
"byteOffset": 2343528,
"target": 34962
},
{
"buffer": 0,
"byteLength": 450176,
"byteOffset": 2793704,
"target": 34962
}
],
"buffers": [
{
"byteLength": 3243880,
"name": "bufffer0",
"uri": "hair_bfShape_1.bin"
}
],
"meshes": [
{
"name": "hair_bfShape_1.obj",
"primitives": [
{
"attributes": {
"JOINTS_0": 4,
"JOINTS_1": 5,
"JOINTS_2": 6,
"NORMAL": 2,
"POSITION": 1,
"TEXCOORD_0": 3,
"WEIGHTS_0": 7,
"WEIGHTS_1": 8,
"WEIGHTS_2": 9
},
"indices": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0,
"name": "mesh"
}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-278
View File
@@ -1,278 +0,0 @@
{
"accessors": [
{
"bufferView": 0,
"componentType": 5125,
"count": 120,
"max": [
41.0
],
"min": [
0.0
],
"type": "SCALAR"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 42,
"max": [
7.569169998168945,
158.69000244140625,
0.8566960096359253
],
"min": [
6.6432600021362305,
151.98899841308594,
-3.55295991897583
],
"type": "VEC3"
},
{
"bufferView": 2,
"componentType": 5126,
"count": 42,
"max": [
0.980184018611908,
0.3233279883861542,
0.4895069897174835
],
"min": [
0.8707389831542969,
-0.3086549937725067,
-0.2010059952735901
],
"type": "VEC3"
},
{
"bufferView": 3,
"componentType": 5126,
"count": 42,
"max": [
0.7207019925117493,
0.8640819787979126
],
"min": [
0.7156370282173157,
0.8067020177841187
],
"type": "VEC2"
},
{
"bufferView": 4,
"componentType": 5123,
"count": 42,
"max": [
0.0,
74.0,
73.0,
75.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"type": "VEC4"
},
{
"bufferView": 5,
"componentType": 5123,
"count": 42,
"max": [
68.0,
78.0,
70.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"type": "VEC4"
},
{
"bufferView": 6,
"componentType": 5123,
"count": 42,
"max": [
0.0,
0.0,
0.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"type": "VEC4"
},
{
"bufferView": 7,
"componentType": 5126,
"count": 42,
"max": [
1.0,
0.02313319966197014,
0.01985890045762062,
0.005621309857815504
],
"min": [
0.9537339806556702,
0.0,
0.0,
0.0
],
"type": "VEC4"
},
{
"bufferView": 8,
"componentType": 5126,
"count": 42,
"max": [
0.0003756110090762377,
0.0002766030083876103,
2.8980000479350565e-06,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"type": "VEC4"
},
{
"bufferView": 9,
"componentType": 5126,
"count": 42,
"max": [
0.0,
0.0,
0.0,
0.0
],
"min": [
0.0,
0.0,
0.0,
0.0
],
"type": "VEC4"
}
],
"asset": {
"generator": "mesh-modify",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 480,
"target": 34963
},
{
"buffer": 0,
"byteLength": 504,
"byteOffset": 480,
"target": 34962
},
{
"buffer": 0,
"byteLength": 504,
"byteOffset": 984,
"target": 34962
},
{
"buffer": 0,
"byteLength": 336,
"byteOffset": 1488,
"target": 34962
},
{
"buffer": 0,
"byteLength": 336,
"byteOffset": 1824,
"target": 34962
},
{
"buffer": 0,
"byteLength": 336,
"byteOffset": 2160,
"target": 34962
},
{
"buffer": 0,
"byteLength": 336,
"byteOffset": 2496,
"target": 34962
},
{
"buffer": 0,
"byteLength": 672,
"byteOffset": 2832,
"target": 34962
},
{
"buffer": 0,
"byteLength": 672,
"byteOffset": 3504,
"target": 34962
},
{
"buffer": 0,
"byteLength": 672,
"byteOffset": 4176,
"target": 34962
}
],
"buffers": [
{
"byteLength": 4848,
"name": "bufffer0",
"uri": "output.bin"
}
],
"meshes": [
{
"name": "hair_bfShape_0.obj",
"primitives": [
{
"attributes": {
"JOINTS_0": 4,
"JOINTS_1": 5,
"JOINTS_2": 6,
"NORMAL": 2,
"POSITION": 1,
"TEXCOORD_0": 3,
"WEIGHTS_0": 7,
"WEIGHTS_1": 8,
"WEIGHTS_2": 9
},
"indices": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"mesh": 0,
"name": "mesh"
}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
]
}
File diff suppressed because it is too large Load Diff
@@ -1,2 +0,0 @@
all:
python strip-buffer.py cloth.gltf
@@ -1,3 +0,0 @@
# Strip unused buffer data.
T.B.W.
File diff suppressed because it is too large Load Diff
@@ -1,24 +0,0 @@
import json
import struct
import sys
if len(sys.argv) < 2:
print("Need input.gltf")
sys.exit(-1)
gltf_file = sys.argv[1]
#bin_file = sys.argv[1]
gltf = json.loads(open(gltf_file, "r", encoding='utf-8').read())
print(gltf)
#data = open(bin_file, "rb").read()
#print(len(data))
#
#out = data[100:]
#print(len(out))
#
#with open("output.bin", "wb") as f:
# f.write(out)
#
#print("DONE!")
-1
View File
@@ -1 +0,0 @@
{ "buffer" : 0 }
-6
View File
@@ -1,6 +0,0 @@
local lib = import 'lowpoly-nodes.gltf';
{
//"muda": lib.skins[0].joints,
"bora": if std.length(lib.assets) then 0 else 1,
}
-6
View File
@@ -1,6 +0,0 @@
newmtl initialShadingGroup
illum 4
Kd 0.50 0.50 0.50
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 1.00

Some files were not shown because too many files have changed in this diff Show More