add method to retrieve rest local transforms
This commit is contained in:
@@ -150,6 +150,8 @@ extern "C"
|
|||||||
float frameLengthInMs);
|
float frameLengthInMs);
|
||||||
EMSCRIPTEN_KEEPALIVE void get_local_transform(void *sceneManager,
|
EMSCRIPTEN_KEEPALIVE void get_local_transform(void *sceneManager,
|
||||||
EntityId entityId, float* const);
|
EntityId entityId, float* const);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void get_rest_local_transforms(void *sceneManager,
|
||||||
|
EntityId entityId, int skinIndex, float* const out, int numBones);
|
||||||
EMSCRIPTEN_KEEPALIVE void get_world_transform(void *sceneManager,
|
EMSCRIPTEN_KEEPALIVE void get_world_transform(void *sceneManager,
|
||||||
EntityId entityId, float* const);
|
EntityId entityId, float* const);
|
||||||
EMSCRIPTEN_KEEPALIVE void get_inverse_bind_matrix(void *sceneManager,
|
EMSCRIPTEN_KEEPALIVE void get_inverse_bind_matrix(void *sceneManager,
|
||||||
|
|||||||
@@ -485,6 +485,24 @@ extern "C"
|
|||||||
out[15] = transform[3][3];
|
out[15] = transform[3][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void get_rest_local_transforms(void *sceneManager,
|
||||||
|
EntityId entityId, int skinIndex, float* const out, int numBones) {
|
||||||
|
const auto transforms = ((SceneManager*)sceneManager)->getBoneRestTranforms(entityId, skinIndex);
|
||||||
|
auto numTransforms = transforms->size();
|
||||||
|
if(numTransforms != numBones) {
|
||||||
|
Log("Error - %d bone transforms available but you only specified %d.", numTransforms, numBones);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(int boneIndex = 0; boneIndex < numTransforms; boneIndex++) {
|
||||||
|
const auto transform = transforms->at(boneIndex);
|
||||||
|
for(int colNum = 0; colNum < 4; colNum++) {
|
||||||
|
for(int rowNum = 0; rowNum < 4; rowNum++) {
|
||||||
|
out[(boneIndex * 16) + (colNum * 4) + rowNum] = transform[colNum][rowNum];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void get_inverse_bind_matrix(void *sceneManager,
|
EMSCRIPTEN_KEEPALIVE void get_inverse_bind_matrix(void *sceneManager,
|
||||||
EntityId entityId, int skinIndex, int boneIndex, float* const out) {
|
EntityId entityId, int skinIndex, int boneIndex, float* const out) {
|
||||||
auto transform = ((SceneManager*)sceneManager)->getInverseBindMatrix(entityId, skinIndex, boneIndex);
|
auto transform = ((SceneManager*)sceneManager)->getInverseBindMatrix(entityId, skinIndex, boneIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user