Results 1 to 7 of 7

Thread: Help Converting a Mesh to a PMesh

  1. #1

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    Arrow 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.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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)

  3. #3

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    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.

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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)

  5. #5

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    ahhhhhhh

    Dim Mesh as D3DXMESH
    BTW, Thanks for all your help

    Member of the anti-gay cross-dressing trans-species wolves alliance.

  6. #6
    Zaei
    Guest
    Try using something like 4 for "MinValue".

    Z.

  7. #7

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    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
  •  



Click Here to Expand Forum to Full Width