First of all, I'd like to greet and say thanks to TGC community. I've been reading forum and learning for quite a while, but right now I can't find a solution myself.
The issue is about using SET INDEXDATA command. I know that objects created via DBP memblocks don't have index data and was hoping to add indexes after creating. But this doesn't seem to work either.
Here's a small piece of code to show what I mean:
sync on
VertTotal=6
MBSize=VertTotal*36+12
MBNum=1
MeshNum=1
ObjNum=1
TileSize=16
X#=0.0
Y#=0.0
Z#=0.0
NX#=0.0
NY#=1.0
NZ#=0.0
U#=0.0
V#=1.0
UStep#=1.0
VStep#=1.0
Color=rgb(255,255,255)
make memblock MBNum, MBSize
write memblock dword MBNum, 0, 338
write memblock dword MBNum, 4, 36
write memblock dword MBNum, 8, VertTotal
MemPos=12
Create_Vertex(MBNUm, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color,U#, V#)
inc MemPos, 36
inc Z#, TileSize: dec V#, VStep#
Create_Vertex(MBNUm, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color,U#, V#)
inc MemPos, 36
inc X#, TileSize: inc U#, UStep#
Create_Vertex(MBNUm, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color,U#, V#)
inc MemPos, 36
dec X#, TileSize: dec Z#, TileSize: dec U#, UStep#: inc V#, VStep#
Create_Vertex(MBNUm, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color,U#, V#)
inc MemPos, 36
inc X#, TileSize: inc Z#, TileSize: inc U#, UStep#: dec V#, VStep#
Create_Vertex(MBNUm, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color,U#, V#)
inc MemPos, 36
dec Z#, TileSize: inc V#, VStep#
Create_Vertex(MBNUm, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color,U#, V#)
inc MemPos, 36
make mesh from memblock MeshNum, MBNum
lock vertexdata for mesh MeshNum
VertCount=get vertexdata vertex count()
IndCount=get vertexdata index count()
unlock vertexdata
make object ObjNum, MeshNum, 0
delete memblock MBNum
delete mesh MeshNum
do
text 1,13, "Vertex count: "+str$(VertCount)
text 1,25, "Index count: "+str$(IndCount)
text 1,37, "Press SPACE to test SET INDEXDATA command"
if spacekey()
lock vertexdata for limb 1,0
for i=0 to VertCount
set indexdata i,i
next i
IndCount=get vertexdata index count()
unlock vertexdata
text 1,49, "It doesn't work :-("
endif
sync
loop
FUNCTION Create_Vertex(MBNum, MemPos, X#, Y#, Z#, NX#, NY#, NZ#, Color as dword ,U#, V#)
write memblock float MBNum, MemPos, X#
write memblock float MBNum, MemPos+4, Y#
write memblock float MBNum, MemPos+8, Z#
write memblock float MBNum, MemPos+12, NX#
write memblock float MBNum, MemPos+16, NY#
write memblock float MBNum, MemPos+20, NZ#
write memblock dword MBNum, MemPos+24, Color
write memblock float MBNum, MemPos+28, U#
write memblock float MBNum, MemPos+32, V#
ENDFUNCTION
I am aware that you can set indexes for memblock meshes with Ian M's Matrix1Utils. These plugins are great (so far I use only one to output data to debugger though), but I want to know:
1)Is it possible to set index data natively?
2)Am I doing something wrong or is it a bug?
I am using the latest version of DBPro with update.
Thank you in advance. I noticed that even usefull threads with tons of precious information are often left without a single reply, so I will bump mine once a while.