render_cpp: render an array of nodes
This commit is contained in:
parent
07df5d9a1d
commit
32cc14106d
5
gltf.hpp
5
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
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
#define GLTF_INSTANCE_HPP_
|
||||
|
||||
struct NodeInstance {
|
||||
const Node * node;
|
||||
D3DXVECTOR3 translation;
|
||||
D3DXQUATERNION rotation;
|
||||
D3DXVECTOR3 scale;
|
||||
|
||||
@ -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"]):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user