Dim and re-Dim of arrays
Blitz3D Forums/Blitz3D Beginners Area/Dim and re-Dim of arrays
| ||
Part of some code that someone (oops can't remember who now :S) wrote for me on here was a vertex deformation thing. It involved storing the vertex coords in a little array matrix before manipulating them in turn. However, I wanted to pull the deform code out into a separate function which means the Array is re-DIMmed in the function because its dimensions are dependant on the surface's number of verts I think. I added a preliminary Dim statement in the main program, but either receive an "Expected )" error if I just try to add to the array in the function, or a "Duplicate Identifier" error if I re-Dim within the function. Is it possible to re-Dim within a function? Here's the relevant bits of the function code: Dim VertexMatrix#(CountVertices(CurrentSurface)-1,3) For CurrentVert=0 To CountVertices(CurrentSurface)-1 Debug("DISTORT MESH","CHECKING COORDS FOR MESH: "+Mesh+" SURFACE: "+CurrentSurface+" VERTEX: "+CurrentVert) VertexMatrix#(CurrentVert,0)=VertexX(CurrentSurface,CurrentVert) VertexMatrix#(CurrentVert,1)=VertexY(CurrentSurface,CurrentVert) VertexMatrix#(CurrentVert,2)=VertexZ(CurrentSurface,CurrentVert) VertexMatrix#(CurrentVert,3)=0 |
| ||
Not to worry - Solved it. I had included the VertexMatrix# handle as a parameter for the function. Blitz didn't liek that at all. All sorted now :) |