From 2d604425277f56c98a5c8351914178480f68bc23 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Fri, 6 Mar 2026 13:30:21 -0800 Subject: Move contrib libraries to contrib repo --- contrib/cgltf-tangents/test/main.c | 86 -------------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 contrib/cgltf-tangents/test/main.c (limited to 'contrib/cgltf-tangents/test/main.c') diff --git a/contrib/cgltf-tangents/test/main.c b/contrib/cgltf-tangents/test/main.c deleted file mode 100644 index 0d70008..0000000 --- a/contrib/cgltf-tangents/test/main.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -Copyright 2022 Marc Sunet - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#include -#define CGLTF_IMPLEMENTATION -#include - -#include - -void print_tangent_buffer(const cgltfTangentBuffer* buffer, int max_vectors) { - printf("Tangent buffer for primitive (%p) (%lu bytes):\n", buffer->primitive, - buffer->size_bytes); - - const float* xyzw = (const float*)buffer->data; - const float* end = (const float*)(buffer->data + buffer->size_bytes); - - for (int i = 0; i < max_vectors && xyzw < end; ++i, xyzw += 4) { - printf("(%3.2f, %3.2f, %3.2f, sign: %3.2f)\n", *xyzw, *(xyzw + 1), - *(xyzw + 2), *(xyzw + 3)); - } - printf("--------------------"); -} - -void usage(const char* argv0) { - fprintf(stderr, "Usage: %s \n", argv0); -} - -int main(int argc, const char** argv) { - cgltf_options options = {0}; - cgltf_data* data = NULL; - - if (argc != 2) { - usage(argv[0]); - return 0; - } - - const char* filepath = argv[1]; - - cgltf_result result = cgltf_parse_file(&options, filepath, &data); - if (result != cgltf_result_success) { - cgltf_free(data); - return 1; - } - - // Must call cgltf_load_buffers() to load buffer data. - result = cgltf_load_buffers(&options, data, filepath); - if (result != cgltf_result_success) { - cgltf_free(data); - return 2; - } - - cgltfTangentBuffer* tangent_buffers = 0; - cgltf_size num_tangent_buffers = 0; - cgltf_compute_tangents(&options, data, &tangent_buffers, - &num_tangent_buffers); - - // cgltf scene not needed beyond this point. - cgltf_free(data); - - for (cgltf_size i = 0; i < num_tangent_buffers; ++i) { - print_tangent_buffer(tangent_buffers, 10); - } - - return 0; -} -- cgit v1.2.3