Меш гружу так:
- Код: Выделить всё
Public Function InitGeometry() As Boolean
Plane = CreateGameMesh(App.Path + "\Plane.x")
End Function
создаю меш и открываю текстуру:
- Код: Выделить всё
Private Function CreateGameMesh(FileName As String) As GameMesh
Dim MtrlBuffer As D3DXBuffer
Dim i As Long
Set CreateGameMesh.Model = d3dx.LoadMeshFromX(FileName, D3DXMESH_MANAGED, _
d3dDevice, Nothing, MtrlBuffer, CreateGameMesh.NumMaterials)
ReDim CreateGameMesh.MeshMaterials(CreateGameMesh.NumMaterials)
For i = 0 To CreateGameMesh.NumMaterials - 1
d3dx.BufferGetMaterial MtrlBuffer, i, CreateGameMesh.MeshMaterials(i)
CreateGameMesh.MeshMaterials(i).Ambient = CreateGameMesh.MeshMaterials(i).diffuse
Next
Set TexWater = d3dx.CreateTextureFromFile(d3dDevice, App.Path + "\Water.dds")
Set MtrlBuffer = Nothing
End Function
В рендере:
- Код: Выделить всё
d3dDevice.SetTexture 0, TexWater
DrawGameMesh Water, 0, 0, 0