Path: chuka.playstation.co.uk!news From: "Matthew Hardingham" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Elevation data Date: Wed, 8 Dec 1999 15:40:58 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 69 Message-ID: <82luhc$6qr1@chuka.playstation.co.uk> NNTP-Posting-Host: modem-42.thalidomide.dialup.pol.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Right here we go then, At the moment I have a set of elevation points stored in an array (128x128) from this I'm creating a link list of vertices. For some reason it is running very slow or the program is crashing out. Why ? It's bugging me me now. Here's the vertex structure -- /* Vertex list */ typedef struct Vertex { unsigned short IdxX, IdxZ; VECTOR Vert; /* Vector */ struct Vertex *Next; } VERTEX; Heres a snippet of code where the elevation data is extracted from the array -- /* Loop through the mesh */ for(MeshZ=0; MeshZIdxX = BlockX; NewVert->IdxZ = BlockZ; printf("\n Z - %ld X - %ld", MeshZ, MeshX); /* Set vertices values */ NewVert->Vert.vx = (MeshX*MESH_INTERVAL); NewVert->Vert.vy = HeightArray[MeshZ][MeshX]; NewVert->Vert.vz = (MeshZ*MESH_INTERVAL); /* Change the pointers and link list positions */ CurrentVert->Next = NewVert; NewVert->Next = NULL; CurrentVert = NewVert; } } Here's the allocation part --- /* Vertex memory allocation */ VERTEX *AllocateVertex(void) { VERTEX *V = NULL; V = (VERTEX *)malloc(sizeof(VERTEX)); V->IdxX = 0; V->IdxZ = 0; /* Vertice values */ V->Vert.vx = 0; V->Vert.vy = 0; V->Vert.vz = 0; V->Next = NULL; return(V); }