2 registered members (TipmyPip, 1 invisible),
18,731
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_preload, entitiy skins, changing of those, and timing
#449890
04/01/15 23:12
04/01/15 23:12
|
Joined: Jul 2002
Posts: 3,208 Germany
Error014
OP
Expert
|
OP
Expert
Joined: Jul 2002
Posts: 3,208
Germany
|
Wow, that's a mouthful of a topic subject! Here's my problem. I'm changing the skin of an entity. To do so, I get it via bmap_for_entity. That's nice. However, the thing is: as soon as the entity is visible, the changed skin is overwritten with the original skin's content. So it seems like the skin is loaded only when the entity becomes visible (meaning is in the camera's view frustum) - regardless of preload_mode and/or ent_preload. Here's a quick code snippet to try it out. You need an image called "ent.bmp" to run it. Run it, then press SPACE. A red square (skin AFTER change!) appears in the top left corner. Hit space again and the entity is made visible, and the original skin (your "ent.bmp") appears. Now, comment the "camera.pan=180;" - line. Now the entity was visible shortly in the view's frustum and it works as expected - the red square changes (the changes are not overwritten). Good. Now, comment the "wait(2);"-line. Now the entity is created in the view-frustum, but immediatly set invisible. And you have the old behaviour again. You also get that behaviour if its a "wait(1)" instead of a "wait(2)". Am I misunderstanding ent_preload? I thought the entity skin would then be loaded regardless of the engine's take on its visibility and usefulness of that, but it seems that this is not the case.
void main() {
ENTITY* testent;
level_load(NULL);
preload_mode = 3;
camera.pan=180; //Hello! Comment me out to
testent = ent_create("ent.bmp",vector(100,0,0),NULL);
ent_preload(testent);
wait(2);
set(testent,INVISIBLE);
while(!key_space)wait(1);
while(key_space)wait(1);
bmap_fill(bmap_for_entity(testent,0),COLOR_RED,100);
camera.pan=0;
while(1) {
DEBUG_BMAP(bmap_for_entity(testent,0),1,4);
if(key_space) reset(testent,INVISIBLE); else set(testent,INVISIBLE);
wait(1);
}
}
Last edited by Error014; 04/01/15 23:13. Reason: removed a unnecessary line
Perhaps this post will get me points for originality at least.
Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
|
|
|
Re: ent_preload, entitiy skins, changing of those, and timing
[Re: Error014]
#449892
04/01/15 23:20
04/01/15 23:20
|
Malice
Unregistered
|
Malice
Unregistered
|
Did you see this in ent_preload? For preloading an entity that you dynamically create at runtime, temporarily create, preload, and remove it already after level loading. This puts the entity model in the internal texture and mesh cache. However, I did not run the test you asked.
Last edited by Malice; 04/01/15 23:22.
|
|
|
Re: ent_preload, entitiy skins, changing of those, and timing
[Re: ]
#449893
04/01/15 23:44
04/01/15 23:44
|
Joined: Jul 2002
Posts: 3,208 Germany
Error014
OP
Expert
|
OP
Expert
Joined: Jul 2002
Posts: 3,208
Germany
|
Yeah, I saw that. But see the test - there's a created, preloaded entity (granted, not removed, but I want to keep it around). It still "overwrites its own skin". Placing ent_preload before the wait also didn't change things.
Perhaps this post will get me points for originality at least.
Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
|
|
|
Re: ent_preload, entitiy skins, changing of those, and timing
[Re: Error014]
#449894
04/02/15 01:39
04/02/15 01:39
|
Malice
Unregistered
|
Malice
Unregistered
|
I ran the test and it is always red for me. I never saw white(My original skin color).
This would point to a hardware issue, correct??
I'm am running Intel hd 4000 I believe my demo is now in free mode. not sure
Last edited by Malice; 04/02/15 01:55.
|
|
|
|