1 registered members (AndrewAMD),
1,018
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: A way to reset a model's vertices after vec_to_mesh
[Re: jumpman]
#384500
10/04/11 00:47
10/04/11 00:47
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Read up on ent_purge(ENTITY*). But I dunno if its CScript or lite-c only.
Be cautious and read up on it, it affects textures and decals too...
best of luck.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: A way to reset a model's vertices after vec_to_mesh
[Re: jumpman]
#384502
10/04/11 04:31
10/04/11 04:31
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
ent_purge is DIFFERENT from ent_remove.
It only unloads the mesh and the texture and the decals.
Next time it appears on-screen, both mesh and texture are reloaded from the MDL file in cache, thereby resetting them.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: A way to reset a model's vertices after vec_to_mesh
[Re: bart_the_13th]
#384570
10/04/11 22:30
10/04/11 22:30
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
[...]store the original mesh vertex position into an array before you do any transformation and use it to restore it back? That's what I do - within A8, but it shouldn't make a difference in A6. Something like the following:
var vertices_stored[20][2000][4];
function store_model_vertices()
{
if(vertices_store_slot <= vertices_stored_max)
{
vertices_store_slot += 1;
vertices_stored_last = vertices_store_slot;
vertices_max = ent_status(my, 0);
vertex_counter = 0;
while(vertex_counter < vertices_max)//save all vertices in an array to get them for resetting the model
{
vec_for_mesh(temp, me, vertex_counter);
vertices_stored[vertices_store_slot][vertex_counter][0] = vertex_counter;
vertices_stored[vertices_store_slot][vertex_counter][1] = temp.x;
vertices_stored[vertices_store_slot][vertex_counter][2] = temp.y;
vertices_stored[vertices_store_slot][vertex_counter][3] = temp.z;
vertex_counter += 1;
}
vertex_counter = 0;
}
}
function reset_model_vertices()
{
if(vertices_store_slot < vertices_stored_last)
{
vertices_store_slot += 1;
vertices_max = ent_status(my, 0);
vertex_counter = 0;
while(vertex_counter < vertices_max)
{
temp.x = vertices_stored[vertices_store_slot][vertex_counter][1];
temp.y = vertices_stored[vertices_store_slot][vertex_counter][2];
temp.z = vertices_stored[vertices_store_slot][vertex_counter][3];
vec_to_mesh(temp, me, vertex_counter);
vertex_counter += 1;
}
vertex_counter = 0;
ent_fixnormals(my,0);//recalculate the normal after moving the vertices
c_updatehull(me,1);//recalculate the collision
}
}
|
|
|
Re: A way to reset a model's vertices after vec_to_mesh
[Re: Pappenheimer]
#384598
10/05/11 09:41
10/05/11 09:41
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
OK, so ent-purge was a bust. Sounds like you tested it sufficiently to me. Next idea... NO idea on memory usage or effect on bones/animation ...
// lite_c
ent_morph(player, player.type);
// c_script (or my ATTEMPTS s CScript anyway)
ent_morph(player, str_for_entfile(NULL, player));
or
STRING* temp_name = str_create("#256");
str_for_entfile(temp_name, player));
ent_morph(player, temp_name);
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|