2 registered members (AndrewAMD, TipmyPip),
12,555
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Visible entities higher than created entities?
#380806
08/21/11 16:24
08/21/11 16:24
|
Joined: Mar 2009
Posts: 88
Walori
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2009
Posts: 88
|
Picture says it all:  What I'm missing here? Creating an entity creates 2 visible entities? There is nothing special in entity creation itself. The entity is created runtime and its pointed to structure then. c_mimax called for each entity. Flags I'm using are(is) UNLIT, nothing more. Their material's are changed every 1 second if needed and are not dynamic. There is only one sky entity. Tried with simple code that creates 100 cubes and it didn't occur there. What could cause this? Any thoughts appreceated.
|
|
|
Re: Visible entities higher than created entities?
[Re: Walori]
#380856
08/22/11 06:11
08/22/11 06:11
|
chris_oat
Unregistered
|
chris_oat
Unregistered
|
its probably the sky entity. Try to remove it for testing, then the "ent" and "vis" should be the same.
|
|
|
Re: Visible entities higher than created entities?
[Re: Asgadir]
#380868
08/22/11 09:07
08/22/11 09:07
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
Hmm, You use the older A7.862 version, try to A7.866 patch it here. But anyway better is to testing with the newer A8.2 version from here.
|
|
|
Re: Visible entities higher than created entities?
[Re: bart_the_13th]
#380928
08/22/11 18:29
08/22/11 18:29
|
Joined: Mar 2009
Posts: 88
Walori
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2009
Posts: 88
|
its probably the sky entity. Try to remove it for testing, then the "ent" and "vis" should be the same.
Tried to remove, no change. Hmm, You use the older A7.862 version, try to A7.866 patch it here. But anyway better is to testing with the newer A8.2 version from here.
Happens in both versions, 8.20 and 7.86 could be caused by another view... Do you accidentally include any postprocessing effect? I know that free version can't use shader, but it does can create another view
Nope, I'm only attaching materials to entities. And removing those materials doesn't fix it. Below the crucial codes: Entity creation
ACTOR[id]->entity = ent_create(ACTOR[id]->mesh,vector(ACTOR[id]->x,ACTOR[id]->y,ACTOR[id]->z),NULL);
ACTOR[id]->entity->scale_x = ACTOR[id]->scale.x;
ACTOR[id]->entity->scale_y = ACTOR[id]->scale.y;
ACTOR[id]->entity->scale_z = ACTOR[id]->scale.z;
ACTOR[id]->entity->pan = ACTOR[id]->pan;
ACTOR[id]->entity->tilt = ACTOR[id]->tilt;
ACTOR[id]->entity->roll = ACTOR[id]->roll;
ACTOR[id]->entity->flags |= SHADOW|UNLIT|CAST;
wait(1);
c_setminmax(ACTOR[id]->entity);
ACTOR[id]->entity->skill1 = id;
ACTOR[id]->entity->skill2 = 1;
ACTOR[id]->entity->skill3 = ACTOR[id];
Material assigment function
ENTITY* ent = NULL;
while(1)
{
ent = ent_next(NULL);
while(ent)
{
if(ent != ent_select && ent.skill3 != NULL)
{
if(ent.skill2 < 3 ||ent.skill2 == 4)
{
if(ent_type(ent) != 4)ent.material = NULL;
else ent.material = mtl_terraintex;
}
else if(ent.skill2 == 3) ent.material = NULL;
else if(ent.skill2 == 5) ent.material = NULL ;
else ent.material =NULL;
ent.emask &=~DYNAMIC;
ent.flags &=~LIGHT;
}
else if(ent == ent_select)
{
ent.material = mtl_red;
ent.emask |=DYNAMIC;
ent.flags |=LIGHT;
}
ent = ent_next(ent);
}
if(ent_select)
{
if(win_ent.pos_x == -1110)
{
win_edit_ent.pos_x = 0;
win_ent.pos_x = screen_size.x-300;
LBG_update_window(win_ent);
LBG_update_window(win_edit_ent);
}
if(!key_ctrl && mouse_panel)
{
UpdateModelFrom();
}
}
else
{
lock_select = 0;
if(win_ent.pos_x != -1110)
{
win_edit_ent.pos_x = -1110;
win_ent.pos_x = -1110;
LBG_update_window(win_ent);
LBG_update_window(win_edit_ent);
}
}
wait(-0.5);
}
The struct that's linked to entity:
typedef struct MODEL
{
var id;
var flags;
var use_billboard;
VECTOR scale;
var x;
var y;
var z;
VECTOR size;
var pan;
var tilt;
var roll;
var ambient;
var red;
var blue;
var green;
var lightrange;
STRING* mesh;
ENTITY* entity;
}MODEL;
|
|
|
Re: Visible entities higher than created entities?
[Re: Walori]
#381593
08/30/11 07:22
08/30/11 07:22
|
Joined: Mar 2009
Posts: 88
Walori
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2009
Posts: 88
|
Any thoughts about this? The weird thing is, when I remove the entity/model wit this function:
function DeleteModel(MODEL* model)
{
if(!model)return 0;
if(model->entity)
{
switch(model->entity.skill2)
{
case 1:
ACTOR[model->entity.skill1] = NULL;
actor_count--;
break;
case 2:
MAP_TERRAIN[model->entity.skill1] = NULL;
terrain_count--;
break;
case 3:
ALIGHT[model->entity.skill1] = NULL;
light_count--;
break;
case 4:
PORTAL[model->entity.skill1] = NULL;
portal_count--;
break;
case 5:
WATER[model->entity.skill1] = NULL;
water_count--;
break;
}
ptr_remove(model->entity);
}
model_count--;
if(model->mesh)ptr_remove(model->mesh);
memset(model,0,sizeof(MODEL));
free(model);
return 1;
}
The entity is deleted as should, however the visible entities also decrease by two.
|
|
|
Re: Visible entities higher than created entities?
[Re: Walori]
#381629
08/30/11 13:29
08/30/11 13:29
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
As bart said, this is something that would be caused by having another view. However, I don't think a pp-view would do it.
Do a search for "VIEW" and tell us how many you've got going.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
|