Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cgltf, remove a morphing constraint. #5688

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ A new header is inserted each time a *tag* is created.
- materials: add a new `instanced` material parameter that is now mandatory in order to call `getInstanceIndex()`
- gltfio: UbershaderProvider now takes the ubershader archive in its constructor [⚠️ **API Change**]
- gltfio: Fix morphing with sparse accessors.
- gltfio: Fix models that use signed integers for morphing.
- engine: Documentation improvements regarding SkinningBuffer and fix an off-by-one assert when setting a SkinningBuffer.
- picking is now exposed to JavaScript
- gltf_viewer: Exercise picking functionality.
Expand Down
3 changes: 3 additions & 0 deletions libs/gltfio/src/Animator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ static void createSampler(const cgltf_animation_sampler& src, Sampler& dst) {
case cgltf_interpolation_type_cubic_spline:
dst.interpolation = Sampler::CUBIC;
break;
case cgltf_interpolation_type_max_enum:
break;
}
}

Expand All @@ -139,6 +141,7 @@ static void setTransformType(const cgltf_animation_channel& src, Channel& dst) {
case cgltf_animation_path_type_weights:
dst.transformType = Channel::WEIGHTS;
break;
case cgltf_animation_path_type_max_enum:
case cgltf_animation_path_type_invalid:
GLTFIO_WARN("Unsupported channel path.");
break;
Expand Down
6 changes: 4 additions & 2 deletions libs/gltfio/src/AssetLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,7 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
const cgltf_accessor* accessor = attribute.data;
const cgltf_attribute_type atype = attribute.type;
if (atype == cgltf_attribute_type_position) {
// All position attributes must have the same data type.
assert_invariant(!previous || previous->component_type == accessor->component_type);
// All position attributes must have the same number of components.
assert_invariant(!previous || previous->type == accessor->type);
previous = accessor;
BufferSlot slot = { accessor };
Expand Down Expand Up @@ -1136,6 +1135,8 @@ MaterialInstance* FAssetLoader::createMaterialInstance(const cgltf_data* srcAsse
case cgltf_alpha_mode_blend:
matkey.alphaMode = AlphaMode::BLEND;
break;
case cgltf_alpha_mode_max_enum:
break;
}

// Check if this material has an extras string.
Expand Down Expand Up @@ -1395,6 +1396,7 @@ bool FAssetLoader::primitiveHasVertexColor(const cgltf_primitive* inPrim) const

LightManager::Type FAssetLoader::getLightType(const cgltf_light_type light) {
switch (light) {
case cgltf_light_type_max_enum:
case cgltf_light_type_invalid:
case cgltf_light_type_directional:
return LightManager::Type::DIRECTIONAL;
Expand Down
1 change: 1 addition & 0 deletions libs/gltfio/src/GltfEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ inline bool getPrimitiveType(cgltf_primitive_type in,
return true;
case cgltf_primitive_type_line_loop:
case cgltf_primitive_type_triangle_fan:
case cgltf_primitive_type_max_enum:
return false;
}
return false;
Expand Down
7 changes: 4 additions & 3 deletions third_party/cgltf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ cgltf also supports some glTF extensions:
- KHR_draco_mesh_compression (requires a library like [Google's Draco](https://github.com/google/draco) for decompression though)
- KHR_lights_punctual
- KHR_materials_clearcoat
- KHR_materials_emissive_strength
- KHR_materials_ior
- KHR_materials_pbrSpecularGlossiness
- KHR_materials_sheen
Expand All @@ -111,9 +112,8 @@ cgltf also supports some glTF extensions:
- KHR_materials_unlit
- KHR_materials_variants
- KHR_materials_volume
- KHR_texture_transform
- KHR_texture_basisu (requires a library like [Binomial Basisu](https://github.com/BinomialLLC/basis_universal) for transcoding to native compressed texture)
- KHR_materials_emissive_strength
- KHR_texture_transform

cgltf does **not** yet support unlisted extensions. However, unlisted extensions can be accessed via "extensions" member on objects.

Expand All @@ -133,14 +133,15 @@ Everyone is welcome to contribute to the library. If you find any problems, you
## Dependencies
None.

C headers being used by implementation:
C headers being used by the implementation:
```
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <assert.h> // If asserts are enabled.
```

Note, this library has a copy of the [JSMN JSON parser](https://github.com/zserge/jsmn) embedded in its source.
Expand Down
Loading