diff --git a/CodeWalker.csproj b/CodeWalker.csproj index 2fa8392..2ef8749 100644 --- a/CodeWalker.csproj +++ b/CodeWalker.csproj @@ -304,7 +304,7 @@ - + @@ -370,6 +370,7 @@ + Form diff --git a/GameFiles/FileTypes/YndFile.cs b/GameFiles/FileTypes/YndFile.cs index b46cb74..55a46fb 100644 --- a/GameFiles/FileTypes/YndFile.cs +++ b/GameFiles/FileTypes/YndFile.cs @@ -18,8 +18,8 @@ namespace CodeWalker.GameFiles public YndLink[] Links { get; set; } public YndJunction[] Junctions { get; set; } - public VertexTypePC[] LinkedVerts { get; set; }//populated by the space (needs to use grid of all ynd's!) - public VertexTypePC[] TriangleVerts { get; set; } //used for junctions display + public EditorVertex[] LinkedVerts { get; set; }//populated by the space (needs to use grid of all ynd's!) + public EditorVertex[] TriangleVerts { get; set; } //used for junctions display public Vector4[] NodePositions { get; set; } public Vector3 BBMin { get; set; } @@ -443,11 +443,11 @@ namespace CodeWalker.GameFiles vc = Links.Length * 6; } - List verts = new List(vc); - VertexTypePC v0 = new VertexTypePC(); - VertexTypePC v1 = new VertexTypePC(); - VertexTypePC v2 = new VertexTypePC(); - VertexTypePC v3 = new VertexTypePC(); + List verts = new List(vc); + EditorVertex v0 = new EditorVertex(); + EditorVertex v1 = new EditorVertex(); + EditorVertex v2 = new EditorVertex(); + EditorVertex v3 = new EditorVertex(); if ((Links != null) && (Nodes != null)) { foreach (var node in Nodes) @@ -530,11 +530,11 @@ namespace CodeWalker.GameFiles } } - List verts = new List(vc); - VertexTypePC v0 = new VertexTypePC(); - VertexTypePC v1 = new VertexTypePC(); - VertexTypePC v2 = new VertexTypePC(); - VertexTypePC v3 = new VertexTypePC(); + List verts = new List(vc); + EditorVertex v0 = new EditorVertex(); + EditorVertex v1 = new EditorVertex(); + EditorVertex v2 = new EditorVertex(); + EditorVertex v3 = new EditorVertex(); if (Nodes != null) { foreach (var node in Nodes) @@ -638,11 +638,11 @@ namespace CodeWalker.GameFiles - public VertexTypePC[] GetPathVertices() + public EditorVertex[] GetPathVertices() { return LinkedVerts; } - public VertexTypePC[] GetTriangleVertices() + public EditorVertex[] GetTriangleVertices() { return TriangleVerts; } @@ -1347,8 +1347,8 @@ namespace CodeWalker.GameFiles { //reuse this interface for file types that need to get paths rendered... - VertexTypePC[] GetPathVertices(); - VertexTypePC[] GetTriangleVertices(); + EditorVertex[] GetPathVertices(); + EditorVertex[] GetTriangleVertices(); Vector4[] GetNodePositions(); } diff --git a/GameFiles/FileTypes/YnvFile.cs b/GameFiles/FileTypes/YnvFile.cs index 3f30c8b..583942b 100644 --- a/GameFiles/FileTypes/YnvFile.cs +++ b/GameFiles/FileTypes/YnvFile.cs @@ -17,7 +17,7 @@ namespace CodeWalker.GameFiles public List Polys { get; set; } - public VertexTypePC[] TriangleVerts { get; set; } + public EditorVertex[] TriangleVerts { get; set; } public Vector4[] NodePositions { get; set; } @@ -195,7 +195,7 @@ namespace CodeWalker.GameFiles int vc = Vertices.Count; - List rverts = new List(); + List rverts = new List(); foreach (var ypoly in Polys) { var poly = ypoly.RawData; @@ -218,9 +218,9 @@ namespace CodeWalker.GameFiles { } - VertexTypePC p0 = new VertexTypePC(); - VertexTypePC p1 = new VertexTypePC(); - VertexTypePC p2 = new VertexTypePC(); + EditorVertex p0 = new EditorVertex(); + EditorVertex p1 = new EditorVertex(); + EditorVertex p2 = new EditorVertex(); p0.Colour = colourval; p1.Colour = colourval; p2.Colour = colourval; @@ -257,11 +257,11 @@ namespace CodeWalker.GameFiles - public VertexTypePC[] GetPathVertices() + public EditorVertex[] GetPathVertices() { return null; } - public VertexTypePC[] GetTriangleVertices() + public EditorVertex[] GetTriangleVertices() { return TriangleVerts; } diff --git a/GameFiles/Resources/VertexType.cs b/GameFiles/Resources/VertexType.cs new file mode 100644 index 0000000..4afc0de --- /dev/null +++ b/GameFiles/Resources/VertexType.cs @@ -0,0 +1,62 @@ +using SharpDX; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CodeWalker.GameFiles +{ + + + public enum VertexType : uint + { + Default = 89, //PNCT + DefaultEx = 16473, //PNCTX + PNCCT = 121, + PNCCTTTT = 1017, + PCCNCCTTX = 16639, + PCCNCCT = 127, + PNCTTTX = 16857, + PNCTTX = 16601, + PNCTTTX_2 = 19545, + PNCTTTX_3 = 17113, + PNCCTTX = 16633, + PNCCTTX_2 = 17017, + PNCCTTTX = 17145, + PCCNCCTX = 16511, + PCCNCTX = 16479, + PCCNCT = 95, + PNCCTT = 249, + PNCCTX = 16505, + PCT = 81, + PT = 65, + PTT = 193, + PNC = 25, + PC = 17, + PCC = 7, + PCCH2H4 = 2147500121, //0x80004059 (16473 + 0x80000000) DefaultEx Cloth? + PNCH2 = 2147483737, //0x80000059 (89 + 0x80000000) Default Cloth? + PNCTTTTX = 19673, //normal_spec_detail_dpm_vertdecal_tnt + PNCTTTT = 985, + PCCNCCTT = 255, + PCTT = 209, + PCCCCT = 119, + PCCNC = 31, + PCCNCTT = 223, + PCCNCTTX = 16607, + PCCNCTTT = 479, + PNCTT = 217, + PNCTTT = 473, + } + + + //vertex data to be used by the editor. TODO: maybe move somewhere else. + public struct EditorVertex + { + public Vector3 Position; + public uint Colour; + } + + +} diff --git a/Rendering/Renderable.cs b/Rendering/Renderable.cs index 72c7c13..e7af2ac 100644 --- a/Rendering/Renderable.cs +++ b/Rendering/Renderable.cs @@ -1008,12 +1008,12 @@ namespace CodeWalker.Rendering { public int VertexStride { get { return 16; } } - public VertexTypePC[] PathVertices; + public EditorVertex[] PathVertices; public int PathVertexCount { get; set; } public Buffer PathVertexBuffer { get; set; } public VertexBufferBinding PathVBBinding; - public VertexTypePC[] TriangleVertices; + public EditorVertex[] TriangleVertices; public int TriangleVertexCount { get; set; } public Buffer TriangleVertexBuffer { get; set; } public VertexBufferBinding TriangleVBBinding; diff --git a/GameFiles/Resources/VertexTypes.cs b/Rendering/VertexTypes.cs similarity index 97% rename from GameFiles/Resources/VertexTypes.cs rename to Rendering/VertexTypes.cs index df736fc..403795c 100644 --- a/GameFiles/Resources/VertexTypes.cs +++ b/Rendering/VertexTypes.cs @@ -7,52 +7,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CodeWalker.GameFiles +namespace CodeWalker.Rendering { - public enum VertexType : uint - { - Default = 89, //PNCT - DefaultEx = 16473, //PNCTX - PNCCT = 121, - PNCCTTTT = 1017, - PCCNCCTTX = 16639, - PCCNCCT = 127, - PNCTTTX = 16857, - PNCTTX = 16601, - PNCTTTX_2 = 19545, - PNCTTTX_3 = 17113, - PNCCTTX = 16633, - PNCCTTX_2 = 17017, - PNCCTTTX = 17145, - PCCNCCTX = 16511, - PCCNCTX = 16479, - PCCNCT = 95, - PNCCTT = 249, - PNCCTX = 16505, - PCT = 81, - PT = 65, - PTT = 193, - PNC = 25, - PC = 17, - PCC = 7, - PCCH2H4 = 2147500121, //0x80004059 (16473 + 0x80000000) DefaultEx Cloth? - PNCH2 = 2147483737, //0x80000059 (89 + 0x80000000) Default Cloth? - PNCTTTTX = 19673, //normal_spec_detail_dpm_vertdecal_tnt - PNCTTTT = 985, - PCCNCCTT = 255, - PCTT = 209, - PCCCCT = 119, - PCCNC = 31, - PCCNCTT = 223, - PCCNCTTX = 16607, - PCCNCTTT = 479, - PNCTT = 217, - PNCTTT = 473, - } - - public struct VertexTypeDefault //id: 84500486, stride: 36, flags: 89, refs: 76099 { @@ -1455,6 +1413,4 @@ namespace CodeWalker.GameFiles */ - - } diff --git a/World/PopZone.cs b/World/PopZone.cs index 4adcbe3..2d2a33b 100644 --- a/World/PopZone.cs +++ b/World/PopZone.cs @@ -19,16 +19,16 @@ namespace CodeWalker.World { return null; } - public VertexTypePC[] GetPathVertices() + public EditorVertex[] GetPathVertices() { return null; } - public VertexTypePC[] GetTriangleVertices() + public EditorVertex[] GetTriangleVertices() { return TriangleVerts; } - public VertexTypePC[] TriangleVerts; + public EditorVertex[] TriangleVerts; @@ -103,11 +103,11 @@ namespace CodeWalker.World public void BuildVertices() { - var vlist = new List(); - var v1 = new VertexTypePC(); - var v2 = new VertexTypePC(); - var v3 = new VertexTypePC(); - var v4 = new VertexTypePC(); + var vlist = new List(); + var v1 = new EditorVertex(); + var v2 = new EditorVertex(); + var v3 = new EditorVertex(); + var v4 = new EditorVertex(); foreach (var group in Groups.Values) { diff --git a/World/Scenarios.cs b/World/Scenarios.cs index 3e560e7..86be53b 100644 --- a/World/Scenarios.cs +++ b/World/Scenarios.cs @@ -118,15 +118,15 @@ namespace CodeWalker.World [TypeConverter(typeof(ExpandableObjectConverter))] public class ScenarioRegion : BasePathData { - public VertexTypePC[] PathVerts { get; set; } - public VertexTypePC[] TriangleVerts { get; set; } + public EditorVertex[] PathVerts { get; set; } + public EditorVertex[] TriangleVerts { get; set; } public Vector4[] NodePositions { get; set; } - public VertexTypePC[] GetPathVertices() + public EditorVertex[] GetPathVertices() { return PathVerts; } - public VertexTypePC[] GetTriangleVertices() + public EditorVertex[] GetTriangleVertices() { return TriangleVerts; } @@ -441,7 +441,7 @@ namespace CodeWalker.World public void BuildVertices() { - List pathverts = new List(); + List pathverts = new List(); uint cred = (uint)Color.Red.ToRgba(); uint cblu = (uint)Color.Blue.ToRgba(); @@ -451,8 +451,8 @@ namespace CodeWalker.World if ((Ymt != null) && (Ymt.CScenarioPointRegion != null)) { var r = Ymt.CScenarioPointRegion; - VertexTypePC pv1 = new VertexTypePC(); - VertexTypePC pv2 = new VertexTypePC(); + EditorVertex pv1 = new EditorVertex(); + EditorVertex pv2 = new EditorVertex(); if ((r.Paths != null) && (r.Paths.Nodes != null)) { diff --git a/World/Space.cs b/World/Space.cs index 0ebe523..9a5ac89 100644 --- a/World/Space.cs +++ b/World/Space.cs @@ -522,7 +522,7 @@ namespace CodeWalker.World //join the dots.... //StringBuilder sb = new StringBuilder(); - List tverts = new List(); + List tverts = new List(); List tlinks = new List(); List nlinks = new List(); foreach (var ynd in AllYnds.Values) @@ -605,7 +605,7 @@ namespace CodeWalker.World ynd.Links = tlinks.ToArray(); } - public void BuildYndVerts(YndFile ynd, List tverts = null) + public void BuildYndVerts(YndFile ynd, List tverts = null) { var ynodes = ynd.Nodes; if (ynodes == null) return; @@ -613,7 +613,7 @@ namespace CodeWalker.World int nodecount = ynodes.Length; //build the main linked vertex array (used by the renderable to draw the lines). - if(tverts==null) tverts = new List(); + if(tverts==null) tverts = new List(); tverts.Clear(); for (int i = 0; i < nodecount; i++) { @@ -621,7 +621,7 @@ namespace CodeWalker.World if (node.Links == null) continue; - var nvert = new VertexTypePC(); + var nvert = new EditorVertex(); nvert.Position = node.Position; nvert.Colour = (uint)node.Colour.ToRgba(); @@ -631,7 +631,7 @@ namespace CodeWalker.World YndLink yl = node.Links[l]; var tnode = yl.Node2; if (tnode == null) continue; //invalid links could hit here - var tvert = new VertexTypePC(); + var tvert = new EditorVertex(); tvert.Position = tnode.Position; tvert.Colour = (uint)tnode.Colour.ToRgba(); @@ -679,7 +679,7 @@ namespace CodeWalker.World } } - public void BuildYndData(YndFile ynd, List tverts = null, List tlinks = null, List nlinks = null) + public void BuildYndData(YndFile ynd, List tverts = null, List tlinks = null, List nlinks = null) { BuildYndLinks(ynd, tlinks, nlinks); diff --git a/World/Trains.cs b/World/Trains.cs index 87e7637..dd7e629 100644 --- a/World/Trains.cs +++ b/World/Trains.cs @@ -81,14 +81,14 @@ namespace CodeWalker.World } - public VertexTypePC[] LinkedVerts { get; set; } + public EditorVertex[] LinkedVerts { get; set; } public Vector4[] NodePositions { get; set; } - public VertexTypePC[] GetPathVertices() + public EditorVertex[] GetPathVertices() { return LinkedVerts; } - public VertexTypePC[] GetTriangleVertices() + public EditorVertex[] GetTriangleVertices() { return null; } @@ -245,7 +245,7 @@ namespace CodeWalker.World var lc = nc - 1; var lvc = lc * 2; var np = new Vector4[nc]; - var lv = new VertexTypePC[lvc]; + var lv = new EditorVertex[lvc]; for (int i = 0; i < nc; i++) { np[i] = new Vector4(Nodes[i].Position, 1.0f); diff --git a/WorldForm.Designer.cs b/WorldForm.Designer.cs index ffcf09e..879272b 100644 --- a/WorldForm.Designer.cs +++ b/WorldForm.Designer.cs @@ -2598,7 +2598,7 @@ namespace CodeWalker this.ToolbarCameraModeButton}); this.Toolbar.Location = new System.Drawing.Point(1, 0); this.Toolbar.Name = "Toolbar"; - this.Toolbar.Size = new System.Drawing.Size(522, 25); + this.Toolbar.Size = new System.Drawing.Size(553, 25); this.Toolbar.TabIndex = 6; this.Toolbar.Text = "toolStrip1"; // @@ -2832,7 +2832,7 @@ namespace CodeWalker // this.ToolbarSelectPathButton.Name = "ToolbarSelectPathButton"; this.ToolbarSelectPathButton.Size = new System.Drawing.Size(181, 22); - this.ToolbarSelectPathButton.Text = "Path"; + this.ToolbarSelectPathButton.Text = "Traffic Path"; this.ToolbarSelectPathButton.Click += new System.EventHandler(this.ToolbarSelectPathButton_Click); // // ToolbarSelectTrainTrackButton