PDA

View Full Version : Adding a vertex to a surface??


LiveWire
26th September 2004, 05:19 PM
k, im making a plugin, that works with adding vertexs to surfaces...
but i cant figure out how exactly to do this.

do i recreate the whole Surfaces List( List *Currect_Surf_List )?
or do i recreate each surfaces Vertex List?
or is there some ac_command that just adds one...
or somthing else?

thanx
--phil

Andy
27th September 2004, 06:41 AM
You'll need to:

create vertices and add each one to the surface AND the object

There are various functions to create/set a vertex:

Prototype Vertex *new_vertex(void);
Prototype Vertex *new_vertex_set(float x, float y, float z);
Prototype Vertex *vertex_clone(Vertex *p);
Prototype void vertex_set_point(Vertex *v, Point3 *p);

You should never(rarely?) need to modify the lists directly, always use a function to add and remove items from surfaces and objects.

To add the vertex to a surface:
Prototype SVertex *surface_add_vertex(Surface *s, Vertex *p, float tx, float ty);
(a surface maintains a list of SVertex's which contains the vertex pointer and the texture coordinates)

The vertex must also be added to the object which holds the surface.

Prototype void object_add_vertex(ACObject *ob, Vertex *p);


Andy

LiveWire
28th September 2004, 08:43 PM
ahhh add it to the object as well.
who would have thUnk of that.
thanx.

ill try it as soon as my computer finishs defraging.