Ich habe Code, der eine Landschaft erzeugt, sie in ein Netz umwandelt und dann rendert.Verwalteter Direct3DX-Mesh-Vertex/Index-Grenzwert?
Die Landschaft basiert auf einer dreidimensionalen Tabelle und generiert 4 Punkte pro positivem Tabelleneintrag. Ich definiere die Tischgröße am Anfang.
Das Problem gibt es
Mesh mesh = new Mesh(indexes.Count/3,vertexes.Count, MeshFlags.Managed, CustomVertex.PositionNormalTextured.Format, device);
wo Indizes eine Reihe von Shorts für Indizes und Scheiteln ist ein Array von CustomVertex.PositionNormalTextured meine Ecken halten.
Mein Code in Ordnung für kleine Größen arbeitet (zB 32x32x32), aber für so etwas wie 64x64x64 stürzt es auf der oberen Zeile mit dem folgenden Fehler
Microsoft.DirectX.Direct3D.Direct3DXException was unhandled
Message=Error in the application.
Source=Microsoft.DirectX.Direct3DX
ErrorCode=-2005530516
ErrorString=D3DERR_INVALIDCALL
StackTrace:
at Microsoft.DirectX.Direct3D.Mesh..ctor(Int32 numFaces, Int32 numVertices, MeshFlags options, VertexFormats vertexFormat, Device device)
at mycode.Form1.Landscape() in d:\Files\My Documents\Visual Studio 2010\Projects\mycode\mycode\Form1.cs:line 488
at mycode.Form1.GenerateGeometry() in d:\Files\My Documents\Visual Studio 2010\Projects\mycode\mycode\Form1.cs:line 223
at mycode.Form1..ctor() in d:\Files\My Documents\Visual Studio 2010\Projects\mycode\mycode\Form1.cs:line 40
at mycode.Program.Main() in d:\Files\My Documents\Visual Studio 2010\Projects\mycode\mycode\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
An dem Punkt, an dem es Indizes stürzt hat eine Anzahl von 231.480 und Scheitelpunkte hat eine Anzahl von 154,320
wäre es eine bessere Idee, es in 64 Maschen, eine für jede Z-Ebene?
Nun, die Aufteilung der Landschaft in 32x32x32 Blöcke scheint zu funktionieren, seltsam, dass der Fehler überhaupt auftritt. –
Wie kann DirectX9 angewiesen werden, 32-Bit-Indexpuffer zu aktivieren? – zionpi