|
-
May 9th, 2001, 05:07 PM
#1
Thread Starter
Addicted Member
Help Converting a Mesh to a PMesh
Right now I have this code, but it cuases a "This Program Has Preformed an Illegal opration" error:
Code:
Dim Vertices As Long
Vertices = Mesh.GetNumVertices
Set PMesh = D3DX.GeneratePMesh(Mesh, adj, ByVal 0, _
ByVal 0,Vertices, D3DXMESHSIMP_VERTEX)
What am I doing wrong?
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
May 9th, 2001, 05:30 PM
#2
Good Ol' Platypus
You have used variables not in your code. Could you show us a full code example?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 9th, 2001, 05:58 PM
#3
Thread Starter
Addicted Member
ok
Code:
Dim mtrlBuffer As D3DXBuffer '//Holds some useful data for us...
Dim i As Long 'Loop variable
Dim TextureFile As String 'the texture required
Dim PMesh As D3DXPMesh
'//1. Get the data from the file
Set Mesh = D3DX.LoadMeshFromX(MeshS, D3DXMESH_MANAGED, Device, adj, mtrlBuffer, NumMaterials)
'//2. Allocate the space required for the materials and textures used:
ReDim Materials(NumMaterials) As D3DMATERIAL8
ReDim Textures(NumMaterials) As Direct3DTexture8
'//3. Now we fill our arrays with the information required
For i = 0 To NumMaterials - 1
On Error Resume Next
DoEvents
'//Get D3DX to copy the data that we loaded from the file into our structure
D3DX.BufferGetMaterial mtrlBuffer, i, Materials(i)
'//get the name of the texture used for this part of the mesh
TextureFile = D3DX.BufferGetTextureName(mtrlBuffer, i)
'//Now create the texture
If TextureFile <> "" Then 'Dont try to create a texture from an empty string
Set Textures(i) = D3DX.CreateTextureFromFileEx(Device, TextureRootPath & "\" & TextureFile, 0, 0, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_LINEAR, D3DX_FILTER_LINEAR, 0, ByVal 0, ByVal 0)
End If
Next i
D3DX.ComputeBoundingBoxFromMesh Mesh, B_Box.v1, B_Box.v2
Dim Vertices As Long
Vertices = Mesh.GetNumVertices
Set PMesh = D3DX.GeneratePMesh(Mesh, adj, ByVal 0, ByVal 0, Vertices, D3DXMESHSIMP_VERTEX)
Set mtrlBuffer = Nothing
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
May 9th, 2001, 06:23 PM
#4
Good Ol' Platypus
You still havent declared mesh!!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 9th, 2001, 07:35 PM
#5
Thread Starter
Addicted Member
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
May 9th, 2001, 08:35 PM
#6
Try using something like 4 for "MinValue".
Z.
-
May 10th, 2001, 04:54 PM
#7
Thread Starter
Addicted Member
hmmm
I tried 0-10, it either freezes or crashes
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|