Merge branch 'dev' of github.com:syoyo/tinyusdz into dev

This commit is contained in:
Syoyo Fujita
2024-01-31 21:04:13 +09:00
6 changed files with 104 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ endif ()
if (EMSCRIPTEN)
set(TINYUSDZ_DEFAULT_NO_WERROR ON)
set(TINYUSDZ_DEFAULT_PRODUCTION_BUILD On)
set(TINYUSDZ_DEFAULT_WITH_BUILTIN_IMAGE_LOADER On)
set(TINYUSDZ_DEFAULT_BUILD_TESTS Off)
@@ -33,6 +34,7 @@ if (EMSCRIPTEN)
elseif(NOT PROJECT_IS_TOP_LEVEL)
# assume tinyusdz is added from add_subdirectory()
# disable tools, tests and examples build by default.
set(TINYUSDZ_DEFAULT_NO_WERROR OFF)
set(TINYUSDZ_DEFAULT_PRODUCTION_BUILD Off)
set(TINYUSDZ_DEFAULT_WITH_BUILTIN_IMAGE_LOADER On)
set(TINYUSDZ_DEFAULT_BUILD_TESTS Off)
@@ -43,6 +45,7 @@ elseif(NOT PROJECT_IS_TOP_LEVEL)
set(TINYUSDZ_DEFAULT_WITH_USDA_PARSER Off)
set(TINYUSDZ_DEFAULT_WITH_USDC_PARSER Off)
else()
set(TINYUSDZ_DEFAULT_NO_WERROR OFF)
set(TINYUSDZ_DEFAULT_PRODUCTION_BUILD Off)
set(TINYUSDZ_DEFAULT_WITH_BUILTIN_IMAGE_LOADER On)
set(TINYUSDZ_DEFAULT_BUILD_TESTS On)
@@ -641,9 +644,14 @@ endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(TUSDZ_COMPILE_FLAGS
"-Weverything -Werror -Wno-poison-system-directories -Wno-padded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function"
"-Weverything -Wno-poison-system-directories -Wno-padded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function"
)
option(TINYUSDZ_NO_WERROR "Don't set -Werror when building the tinyusdz library" ${TINYUSDZ_DEFAULT_NO_WERROR})
if (NOT TINYUSDZ_NO_WERROR)
set(TUSDZ_COMPILE_FLAGS "${TUSDZ_COMPILE_FLAGS} -Werror")
endif()
# clang17 seems enable -Wunsafe-buffer-usage when `-Weverything` is defined,
# resulting compilation error for some raw array access without bound check.
# https://reviews.llvm.org/D138940

View File

@@ -169,12 +169,12 @@ We have a plan to manage TinyUSDZ project under Light Transport Entertainment In
## Projects using TinyUSDZ
* usd2glb: USD to glTF 2.0 GLB converter https://github.com/fynv/usd2glb
* webgpu-cpp-usdz: WebGPU C++/Wasm USDZ Renderer(NOTE: It doesn't support much yet!) https://github.com/Twinklebear/webgpu-cpp-usdz
### Other related projects
* UsdzSharpie: C# Simple implementation of Usdz file format ( https://github.com/UkooLabs/UsdzSharpie )
* TinyGLTF: glTF 2.0 loader/saver ( https://github.com/syoyo/tinygltf )
* USD-build-aarch64: Full USD build for AARCH64(Linux and Android): https://github.com/syoyo/USD-build-aarch64
* BlenderUSDZ: It contains their own Python USDC parser/serializer. https://github.com/robmcrosby/BlenderUSDZ
## Supported platforms

View File

@@ -71,8 +71,8 @@ set(TINYUSDZ_DEP_SOURCES
#../../src/external/string_id/string_id.cpp
#../../src/external/string_id/error.cpp
#../../src/external/string_id/database.cpp
../../src/external/staticstruct.cc
../../src/external/tinyxml2/tinyxml2.cpp
#../../src/external/staticstruct.cc
#../../src/external/tinyxml2/tinyxml2.cpp
)
#../../src/external/ryu/ryu/s2d.c
#../../src/external/ryu/ryu/s2f.c)

View File

@@ -17,7 +17,7 @@ $ make
### Binary size
Currently is less than 4MB when compiled with `-DCMAKE_BUILD_TYPE=MinSizeRel` (650 KB when gzip compressed).
Currently it is less than 4MB when compiled with `-DCMAKE_BUILD_TYPE=MinSizeRel` (650 KB when gzip compressed).
## Run
@@ -33,3 +33,8 @@ Install `wasmtime`, then copy example USD file to `build` folder(where `tinyusdz
$ cp ../../../models/cube-previewsurface.usda .
$ wasmtime --dir=. tinyusdz_wasi cube-previewsurface.usda
```
## TODO
* [ ] Unify CMakeList.txt with <tinyusdz>/CMakelist.txt
* [ ] Write WASI specific AssetResolution/FileSystemHandler example.

View File

@@ -14,10 +14,33 @@ Currently Tydra is considering following three usecases in mind:
- Scene conversion to Ray tracing renderer(e.g. Vulkan/OptiX ray tracing)
See `../../examples/sdlviewer/` for SW raytracing example.
## Status
Work in progres. API and feature is subject to change.
## RenderScene
Scene graph representation suited for OpenGL/Vulkan renderer.
### Status
* [ ] Node xform
* [x] Triangulate mesh
* [ ] Subdivision surface support(subdivide mesh using OpenSubdiv)
* [ ] Resolve Material binding
* [ ] GeomSubset material binding
* [ ] Collection material binding
* [ ] Load and setup Texture
* Colorspace conversion
* [x] sRGB <-> Linear
* [x] rec709 <-> Linear
* [ ] OCIO LUT
*
* [ ] Skinning
* [ ] BlendShape
* [ ] Animation
* [ ] Lights
## TODO
- Data structure suited for realtime DCC.

View File

@@ -2031,6 +2031,69 @@ enum class TimeSampleInterpolationType {
bool IsLerpSupportedType(uint32_t tyid);
template<class T>
struct LerpTraits
{
static constexpr bool supported() {
return false;
}
};
#define DEFINE_LERP_TRAIT(ty) \
template <> \
struct LerpTraits<ty> { \
static constexpr bool supported() { \
return true; \
} \
};
DEFINE_LERP_TRAIT(value::half)
DEFINE_LERP_TRAIT(value::half2)
DEFINE_LERP_TRAIT(value::half3)
DEFINE_LERP_TRAIT(value::half4)
DEFINE_LERP_TRAIT(float)
DEFINE_LERP_TRAIT(value::float2)
DEFINE_LERP_TRAIT(value::float3)
DEFINE_LERP_TRAIT(value::float4)
DEFINE_LERP_TRAIT(double)
DEFINE_LERP_TRAIT(value::double2)
DEFINE_LERP_TRAIT(value::double3)
DEFINE_LERP_TRAIT(value::double4)
DEFINE_LERP_TRAIT(value::quath)
DEFINE_LERP_TRAIT(value::quatf)
DEFINE_LERP_TRAIT(value::quatd)
DEFINE_LERP_TRAIT(value::matrix2f)
DEFINE_LERP_TRAIT(value::matrix3f)
DEFINE_LERP_TRAIT(value::matrix4f)
DEFINE_LERP_TRAIT(value::matrix2d)
DEFINE_LERP_TRAIT(value::matrix3d)
DEFINE_LERP_TRAIT(value::matrix4d)
DEFINE_LERP_TRAIT(value::timecode)
DEFINE_LERP_TRAIT(value::normal3h)
DEFINE_LERP_TRAIT(value::normal3f)
DEFINE_LERP_TRAIT(value::normal3d)
DEFINE_LERP_TRAIT(value::vector3h)
DEFINE_LERP_TRAIT(value::vector3f)
DEFINE_LERP_TRAIT(value::vector3d)
DEFINE_LERP_TRAIT(value::point3h)
DEFINE_LERP_TRAIT(value::point3f)
DEFINE_LERP_TRAIT(value::point3d)
DEFINE_LERP_TRAIT(value::color3h)
DEFINE_LERP_TRAIT(value::color3f)
DEFINE_LERP_TRAIT(value::color3d)
DEFINE_LERP_TRAIT(value::color4h)
DEFINE_LERP_TRAIT(value::color4f)
DEFINE_LERP_TRAIT(value::color4d)
DEFINE_LERP_TRAIT(value::texcoord2h)
DEFINE_LERP_TRAIT(value::texcoord2f)
DEFINE_LERP_TRAIT(value::texcoord2d)
DEFINE_LERP_TRAIT(value::texcoord3h)
DEFINE_LERP_TRAIT(value::texcoord3f)
DEFINE_LERP_TRAIT(value::texcoord3d)
DEFINE_LERP_TRAIT(value::frame4d)
#undef DEFINE_LERP_TRAIT
///
/// @param[in] dt interpolator [0.0, 1.0)
///