Hello all, I have an ofxassimp model issue again.
I have an animated ofxassimp model. I draw the same model 25 times per frame on the screen. I don’t instantiate the model. I draw the same instance multiple times to save the memory. These are 25 game characters using the same ofx assimp model (for example 25 soldiers). I change only the animation position and I draw the model 25 times in a loop.
//my ofx assimp model
ofxAssimpModelLoader assimpmodel;
assimpmodel.loadModel("animatedmodel.dae");
//character num to draw
short character_num = 25;
//animation position store for the characters. Let's tell; all of them are in the 0. pose, only the first 2 are in the 1000. pose
float character_pose[character_num];
for (short i=0; i<2; i++) character_pose[i] = 1000;
for (short i=2; i<character_num; i++) character_pose[i] = 0;
//now i am drawing the same model 25 times with different poses in the draw() method
void testApp::draw() {
for (short i=0; i<character_num; i++) {
assimpmodel.getAnimation(0).setPosition(character_pose[i]);
assimpmodel.update();
assimpmodel.drawFaces();
}
}
This code looks working.
If I don’t add assimpmodel.update(); line, the code is not working. All the characters are drawn in 0 position. The first 2 characters are not drawn in 1000. position.
But this assimpmodel.update(); line slow down the game. As I invoke it 25 times in each frame, it makes a huge difference in the fps.
How I can draw different poses of an ofx assimp model in 1 frame, without invoking each time assimpmodel.update()? Is it possible? Or is there another way to do that?