vinjn
September 7, 2018, 4:18pm
1
The code is here https://github.com/jing-interactive/MeshViewer
Still in early stage, but it’s working.
I should have it completed in this month (2018-Sept)
4 Likes
Very cool! It will be great to get the animation data working eventually too.
For anyone else getting three unresolved external symbols for tinyGltf::WriteImageData for png jpg and bmp.
All you have to do is add, TINYGLTF_NO_STB_IMAGE_WRITE to Preprocessor.Definition .
Thanks Jing! Great work and looking good!
vinjn
September 14, 2018, 2:37am
6
tiny_obj_loader based OBJ loading is also added in this project, Cinder’s obj loader is sometimes too slow
@vinjn I’ve also been working on a utility for rendering GLTF2 files parsed with tinygltf. It has support for rigid animations and up to 4 blend shapes per mesh.
I wasn’t intending to release it since the implementation is pretty specific for my use case, but the code is up in a Gist. Feel free to use it verbatim or as reference:
gltf_primitive_pbr_fs.glsl
precision highp float;
// The PBR shader below is adapted from the Khronos glTF WebGL example:
// https://github.com/KhronosGroup/glTF-WebGL-PBR/blob/master/shaders/pbr-frag.glsl
struct PBRInfo {
float NdotL; // cos angle between normal and light direction
float NdotV; // cos angle between normal and view direction
float NdotH; // cos angle between normal and half vector
float LdotH; // cos angle between light direction and half vector
This file has been truncated. show original
gltf_primitive_pbr_vs.glsl
precision highp float;
// The TARGET macros here work around GLES3's lack of support for vertex shader attribute arrays.
#if TARGET_COUNT > 0
uniform float targetWeights[TARGET_COUNT];
#define DEF_TARGET_ATTRIBS(i) \
in vec3 targetPosition##i; \
in vec3 targetNormal##i;
DEF_TARGET_ATTRIBS(0)
This file has been truncated. show original
gltf_utils.cpp
#include "gltf_utils.hpp"
#define TINYGLTF_NO_STB_IMAGE_WRITE
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#include "tiny_gltf.h"
#include "cinder/Log.h"
#include "cinder/app/App.h"
#include "cinder/gl/gl.h"
This file has been truncated. show original
There are more than three files. show original
ryan
2 Likes
vinjn
October 18, 2018, 1:25am
8
Looks promising, can you create a buildable project so that we can play with it?
vinjn
January 15, 2019, 5:54am
9
The code base is now split to a reusable lib and a sample.
2 Likes