Parse data function

BlitzMax Forums/OpenGL Module/Parse data function

Akat(Posted 2005) [#1]
[\code]
Global g_triangles:Vertex[6]
RestoreData g_trianglesData
For i = 0 Until 6
g_triangles:Vertex[i] = New Vertex
ReadData g_triangles[i].r
ReadData g_triangles[i].g
ReadData g_triangles[i].b
ReadData g_triangles[i].a
ReadData g_triangles[i].x
ReadData g_triangles[i].y
ReadData g_triangles[i].z
Next
Global g_triangleStrip:Vertex[8]
RestoreData g_triangleStripData
For i = 0 Until 8
g_triangleStrip:Vertex[i] = New Vertex
ReadData g_triangleStrip[i].r
ReadData g_triangleStrip[i].g
ReadData g_triangleStrip[i].b
ReadData g_triangleStrip[i].a
ReadData g_triangleStrip[i].x
ReadData g_triangleStrip[i].y
ReadData g_triangleStrip[i].z
Next
i have this codes inside my program.. i wanna short this out into a function.. anyone please help how to parse it into a function calling.. the parameters for the function should be:
1. name of the new types
2. size of the types array
3. name of the data it will call

and i assume it should be like this, but its not rite, something wrong at the data parsing.. anyone have a solution?:


Function vertexFunction(ArraySize:Int, Dataname, name:Vertex[])
RestoreData Dataname
Local i:Int
For i = 0 Until ArraySize
name = name:Vertex[..i+1]
name:Vertex[i] = New Vertex
ReadData name[i].r
ReadData name[i].g
ReadData name[i].b
ReadData name[i].a
ReadData name[i].x
ReadData name[i].y
ReadData name[i].z
Next
EndFunction
[code]


Leiden(Posted 2005) [#2]
lmao- you got the tags around the wrong way and your text now in a code box.

It goes [code ] [/code ] without the spaces.


Akat(Posted 2005) [#3]
yeah i know... and i cant edit it once i post it... btw, do u guys know how? i mean to parse that codes into function, not the [code ] and [/code ] function for the post..


Perturbatio(Posted 2005) [#4]
and i cant edit it once i post it... btw, do u guys know how?

click edit at the top right of your post?


Chris C(Posted 2005) [#5]
not sure quite what you mean, but I'd recommend working with data files rather than data statements and write your own loader.

or even use existing code to load 3ds objects...
theres a milkshape loader that works nicely in the nehe max examples