slashandburn
Mar 18th, 2000, 10:02 AM
In some of the games I have made I ususlly Use BitBlt and make a 64X64 grid. But Now I want to take this same Idea of the grid But add more to it. My question is In Dirext x 7 for vb How could I generate a 64 X 64 Mesh that I know how to make the X,Y,Z locations to work. but how could I generate it?
SYAlam
Mar 22nd, 2000, 01:52 AM
This should help:
Sub loadmap(file$)
Dim title$, i%
Dim mesh As Direct3DRMMeshBuilder
Dim txt(4) As Direct3DRMTexture
'load up the default textures
For i% = 1 To 4
D3DRM.LoadTexture App.Path & "\txt" & i% & ".bmp", txt(i%)
Next
block% = 0
Open file$ For Input As #1
Input #1, title$
Do
Input #1, btyp(block%), bx(block%), bz(block%), by(block%)
'make a mesh and a frame to hold it
D3DRM.CreateMeshBuilder mesh
D3DRM.CreateFrame WorldFrame, bframe(block%)
'now load the mesh as set the texture
'the 256 is flags loadfromfile and instancebyreference
mesh.Load App.Path & "\menbox" & btyp(block%) & ".x", 0, 256, 0, 0
mesh.SetTexture txt(btyp(block%))
'add the mesh to the frame, and scale it
bframe(block%).AddVisual mesh
bframe(block%).AddScale D3DRMCOMBINE_BEFORE, 3, 3, 3
'scale positions
bx(block%) = bx(block%) * 300
by(block%) = by(block%) * 300 - 60
bz(block%) = bz(block%) * 300 '+ 2000
'position the frame based on the map
bframe(block%).SetPosition WorldFrame, bx(block%), by(block%), bz(block%)
Set mesh = Nothing
block% = block% + 1
Loop Until EOF(1)
Close
End Sub