Skip to content

πŸ‘˜ Single-file VRM 1.0 loader written in C99, extending cgltf.

License

Notifications You must be signed in to change notification settings

tcoppex/cgltf_vrm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘˜ cgltf_vrm

Single-file C99 VRM 1.0 loader companion to cgltf.

Stage: alpha

This library depends on cgltf.h to work (tested against v1.14).

Extensions support

Basic usage

The main concern is to include the cgltf_vrm implementation in the same file and after the cgltf implementation as it depends on some of its static functions to work.

Loading from an existing cgltf_data object
#include <stdlib.h>

#define CGLTF_IMPLEMENTATION
#include "cgltf.h"
#include "cgltf_vrm.h"

int main(int argc, char **argv[])
{
  cgltf_options options{};
  cgltf_result result{};
  cgltf_data* gltf = NULL;
  cgltf_vrm_data vrm;

  result = cgltf_parse_file(&options, "avatar.vrm", &gltf);
  if (result != cgltf_result_success)
  {
    return EXIT_FAILURE;
  }

  result = cgltf_vrm_parse_cgltf_data(&options, gltf, &vrm);
  if (result != cgltf_result_success)
  {
    cgltf_free(gltf);
    return EXIT_FAILURE;
  }

  /* process data here */

  cgltf_vrm_free(&vrm);
  cgltf_free(gltf);

  return EXIT_SUCCESS;
}

See also

About

πŸ‘˜ Single-file VRM 1.0 loader written in C99, extending cgltf.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages