Skip to content

Commit

Permalink
Update cgltf to v1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
prideout committed Mar 24, 2021
1 parent 40b8667 commit c4a12fe
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 135 deletions.
8 changes: 4 additions & 4 deletions libs/gltfio/src/DracoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ static void convertFaces(cgltf_accessor* target, const draco::Mesh* mesh) {
const cgltf_size size = mesh->num_faces() * 3 * sizeof(T);
cgltf_buffer_view* view = target->buffer_view;
cgltf_buffer* buffer = view->buffer;
*buffer = { size, nullptr, malloc(size) };
*view = { buffer, 0, size, 0, cgltf_buffer_view_type_indices };
*buffer = { nullptr, size, nullptr, malloc(size) };
*view = { nullptr, buffer, 0, size, 0, cgltf_buffer_view_type_indices };
T* dest = (T*) buffer->data;
for (uint32_t id = 0, n = mesh->num_faces(); id < n; ++id) {
draco::Mesh::Face face = mesh->face(draco::FaceIndex(id));
Expand All @@ -94,8 +94,8 @@ static void convertAttribs(cgltf_accessor* target, const draco::PointAttribute*
const uint32_t size = target->stride * n;
cgltf_buffer_view* view = target->buffer_view;
cgltf_buffer* buffer = view->buffer;
*buffer = { size, nullptr, malloc(size) };
*view = { buffer, 0, size, 0, cgltf_buffer_view_type_vertices };
*buffer = { nullptr, size, nullptr, malloc(size) };
*view = { nullptr, buffer, 0, size, 0, cgltf_buffer_view_type_vertices };
T* dest = (T*) buffer->data;
for (draco::PointIndex i(0); i < n; ++i, dest += ncomps) {
attr->ConvertValue(attr->mapped_index(i), ncomps, dest);
Expand Down
15 changes: 15 additions & 0 deletions third_party/cgltf/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: build

on: [push, pull_request]

jobs:
generic:
strategy:
matrix:
os: [windows, ubuntu, macos]
name: ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
steps:
- uses: actions/checkout@v1
- name: test
run: cd test && python test_all.py
4 changes: 1 addition & 3 deletions third_party/cgltf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if (result == cgltf_result_success)
```

Note that cgltf does not load the contents of extra files such as buffers or images into memory by default. You'll need to read these files yourself using URIs from `data.buffers[]` or `data.images[]` respectively.
For buffer data, you can alternatively call `cgltf_load_buffers`, which will use `FILE*` APIs to open and read buffer files.
For buffer data, you can alternatively call `cgltf_load_buffers`, which will use `FILE*` APIs to open and read buffer files. This automatically decodes base64 data URIs in buffers. For data URIs in images, you will need to use `cgltf_load_buffer_base64`.

**For more in-depth documentation and a description of the public interface refer to the top of the `cgltf.h` file.**

Expand Down Expand Up @@ -83,8 +83,6 @@ if (written != size)

Note that cgltf does not write the contents of extra files such as buffers or images. You'll need to write this data yourself.

Writing does not yet support "extras" data.

**For more in-depth documentation and a description of the public interface refer to the top of the `cgltf_write.h` file.**


Expand Down
Loading

0 comments on commit c4a12fe

Please sign in to comment.