scenario:
say i have a mesh and i want to create two entities. one with skeleton A and another with skeleton B. (both skeletons are identical except each has a different combinations of animations)
1. should i clone the mesh so there is a 1-1 relationship between mesh and skeleton? this produces 3 identical meshes but each with a different skeleton.
Code: Select all
// pseudocode
auto meshA = mesh->clone(); // meshA will use skeletonA
meshA->notifySkeleton (skeletonA);
auto entityA = scene->createEntity (meshA); // entityA uses skeletonA
auto meshB = mesh->clone(); // meshB will use skeletonB
meshB->notifySkeleton (skeletonB);
auto entityB = scene->createEntity (meshB); // entityB uses skeletonB
2. or can i reuse the same mesh which saves memory and assign the skeleton to the mesh just prior to creating each entity?
Code: Select all
// pseudocode
mesh->notifySkeleton (skeletonA);
auto entityA = scene->createEntity (mesh); // entityA uses skeletonA
mesh->notifySkeleton (skeletonB);
auto entityB = scene->createEntity (mesh); // entityB uses skeletonB
mesh->notifySkeleton (master); // restore the original master skeleton
thanks!