I am trying to load an Object and assign a skin to it during runtime. The model does not contain a skin and i don't want to include skins to the model, because there are too many.
the function ent_morphskin() accepts only filenames, but no bmaps. I don't want to create a bmap, save it to a file and then load it again to make this work! How can I put a bmap directly onto a model?
Now, I tried to use bmap_for_entity. The Result was not as I expectet. By modifying the returned bmap, the skins of all entities of the same kind change.
Code:
BMAP* test;
test = bmap_for_entity(my,0);
bmap_fill(test,vector(random(255),random(255),random(255)),100);
When i add
Code:
test = bmap_createblack(16,16,32);
above bmap_fill(), all entities are black. Without that line, all entities have the same random color.
even by using ent_clone or ent_cloneskin the skins of all entities changes...perhaps its another problem, my code looks like this:
Code:
BMAP* test;
for (i=0,i<100,i++)
{
my = ent_create([.....]);
ent_clone(my);//ent_cloneskin(my);
test = bmap_createblack(16,16,32);
bmap_fill(test,vector(random(255),random(255),random(255)),100);
ent_setskin(my,test,1);
}
perhaps i'm using the same pointer to the bmap inside the whole loop...