Armature

Undocumented in source.

Constructors

this
this(string name, Matrix4f transform)
Undocumented in source.

Members

Functions

addChild
void addChild(string bone, string childName, Batch mesh, Matrix4f transform)
Undocumented in source. Be warned that the author may not have intended to support it.
addChild
void addChild(Bone* bone, string childName, Batch mesh, Matrix4f transform)
Undocumented in source. Be warned that the author may not have intended to support it.
addRoot
void addRoot(string childName, Batch mesh, Matrix4f transform)
Undocumented in source. Be warned that the author may not have intended to support it.
findBoneByName
Bone* findBoneByName(string bone)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref Bone) dg)

Iterates over each bone in the tree structure by ref

Structs

Bone
struct Bone
Undocumented in source.

Variables

fullBuffer
Buffer!Bone fullBuffer;

Buffer which has reserved as many items as bones exist in this armature, can be used for recursive iteration.

name
string name;
Undocumented in source.
root
Bone root;
Undocumented in source.

Examples

import voxelman.graphics.color : Colors;

Batch head = Batch.cube(vec3(0.5f, 0.5f, 0.5f), Colors.white, true);
Batch body_ = Batch.cube(vec3(0.5f, 0.8f, 0.5f), Colors.white, true);

Armature armature = Armature("human", translationMatrix(vec3(0, 1.5f, 0)));
armature.addRoot("body", body_, Matrix4f.identity);
armature.addChild("body", "head", head, translationMatrix(vec3(0, 0.65f, 0)));

// after adding all bones

auto bodyBone = armature.findBoneByName("body");
auto headBone = armature.findBoneByName("head");
// bones should not be modified at this point as they might mess up bone references

bodyBone.rotate(vec3(degtorad(90.0f), 0, 0));
headBone.rotate(vec3(0, degtorad(90.0f), 0));

// should be bent down, looking left now

Meta