diff --git a/gltf.hpp b/gltf.hpp index deb9f69..936c45a 100644 --- a/gltf.hpp +++ b/gltf.hpp @@ -34,7 +34,7 @@ struct Node { struct Skin { const D3DXMATRIX * inverse_bind_matrices; // accessor - const Node ** joints; + const int * joints; DWORD joints_length; }; @@ -59,5 +59,4 @@ struct AnimationChannel { } target; }; -#ifndef GLTF_HPP_ -#define GLTF_HPP_ +#endif diff --git a/gltf_instance.hpp b/gltf_instance.hpp index 2ae1f31..385c52a 100644 --- a/gltf_instance.hpp +++ b/gltf_instance.hpp @@ -2,7 +2,6 @@ #define GLTF_INSTANCE_HPP_ struct NodeInstance { - const Node * node; D3DXVECTOR3 translation; D3DXQUATERNION rotation; D3DXVECTOR3 scale; diff --git a/render_cpp.py b/render_cpp.py index 66f2ef8..7707943 100644 --- a/render_cpp.py +++ b/render_cpp.py @@ -127,11 +127,17 @@ def render_nodes(gltf): yield f"{render_value(scale, 'D3DXVECTOR3')}, // scale" yield "};" + yield "const Node * nodes[] = {" + for node_ix in range(len(gltf.json["nodes"])): + yield f"&node_{node_ix}," + yield "};" + yield f"const int nodes_length = (sizeof (nodes)) / (sizeof (nodes[0]));" + def render_skins(gltf): for skin_ix, skin in enumerate(gltf.json["skins"]): - yield f"const Node * skin_{skin_ix}__joints[] = {{" + yield f"const int skin_{skin_ix}__joints[] = {{" for joint in skin["joints"]: - yield f"&node_{joint}," + yield f"{joint}," yield "};" for skin_ix, skin in enumerate(gltf.json["skins"]):