mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2025-01-10 07:42:56 +08:00
Moved DX-dependent vertex types stuff to Rendering namespace
This commit is contained in:
parent
14e1ce6ffd
commit
96638b8317
@ -304,7 +304,7 @@
|
||||
<Compile Include="GameFiles\Resources\ResourceFile.cs" />
|
||||
<Compile Include="GameFiles\Resources\ResourceBaseTypes.cs" />
|
||||
<Compile Include="GameFiles\Resources\RpfManager.cs" />
|
||||
<Compile Include="GameFiles\Resources\VertexTypes.cs" />
|
||||
<Compile Include="GameFiles\Resources\VertexType.cs" />
|
||||
<Compile Include="GameFiles\FileTypes\YddFile.cs" />
|
||||
<Compile Include="GameFiles\FileTypes\YdrFile.cs" />
|
||||
<Compile Include="GameFiles\FileTypes\YftFile.cs" />
|
||||
@ -370,6 +370,7 @@
|
||||
<Compile Include="Rendering\Utils\UnitCylinder.cs" />
|
||||
<Compile Include="Rendering\Utils\UnitDisc.cs" />
|
||||
<Compile Include="Rendering\Utils\UnitSphere.cs" />
|
||||
<Compile Include="Rendering\VertexTypes.cs" />
|
||||
<Compile Include="SelectFolderForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -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<VertexTypePC> verts = new List<VertexTypePC>(vc);
|
||||
VertexTypePC v0 = new VertexTypePC();
|
||||
VertexTypePC v1 = new VertexTypePC();
|
||||
VertexTypePC v2 = new VertexTypePC();
|
||||
VertexTypePC v3 = new VertexTypePC();
|
||||
List<EditorVertex> verts = new List<EditorVertex>(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<VertexTypePC> verts = new List<VertexTypePC>(vc);
|
||||
VertexTypePC v0 = new VertexTypePC();
|
||||
VertexTypePC v1 = new VertexTypePC();
|
||||
VertexTypePC v2 = new VertexTypePC();
|
||||
VertexTypePC v3 = new VertexTypePC();
|
||||
List<EditorVertex> verts = new List<EditorVertex>(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();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace CodeWalker.GameFiles
|
||||
public List<YnvPoly> 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<VertexTypePC> rverts = new List<VertexTypePC>();
|
||||
List<EditorVertex> rverts = new List<EditorVertex>();
|
||||
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;
|
||||
}
|
||||
|
62
GameFiles/Resources/VertexType.cs
Normal file
62
GameFiles/Resources/VertexType.cs
Normal file
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -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<VertexTypePC>();
|
||||
var v1 = new VertexTypePC();
|
||||
var v2 = new VertexTypePC();
|
||||
var v3 = new VertexTypePC();
|
||||
var v4 = new VertexTypePC();
|
||||
var vlist = new List<EditorVertex>();
|
||||
var v1 = new EditorVertex();
|
||||
var v2 = new EditorVertex();
|
||||
var v3 = new EditorVertex();
|
||||
var v4 = new EditorVertex();
|
||||
|
||||
foreach (var group in Groups.Values)
|
||||
{
|
||||
|
@ -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<VertexTypePC> pathverts = new List<VertexTypePC>();
|
||||
List<EditorVertex> pathverts = new List<EditorVertex>();
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ namespace CodeWalker.World
|
||||
|
||||
//join the dots....
|
||||
//StringBuilder sb = new StringBuilder();
|
||||
List<VertexTypePC> tverts = new List<VertexTypePC>();
|
||||
List<EditorVertex> tverts = new List<EditorVertex>();
|
||||
List<YndLink> tlinks = new List<YndLink>();
|
||||
List<YndLink> nlinks = new List<YndLink>();
|
||||
foreach (var ynd in AllYnds.Values)
|
||||
@ -605,7 +605,7 @@ namespace CodeWalker.World
|
||||
ynd.Links = tlinks.ToArray();
|
||||
|
||||
}
|
||||
public void BuildYndVerts(YndFile ynd, List<VertexTypePC> tverts = null)
|
||||
public void BuildYndVerts(YndFile ynd, List<EditorVertex> 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<VertexTypePC>();
|
||||
if(tverts==null) tverts = new List<EditorVertex>();
|
||||
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<VertexTypePC> tverts = null, List<YndLink> tlinks = null, List<YndLink> nlinks = null)
|
||||
public void BuildYndData(YndFile ynd, List<EditorVertex> tverts = null, List<YndLink> tlinks = null, List<YndLink> nlinks = null)
|
||||
{
|
||||
|
||||
BuildYndLinks(ynd, tlinks, nlinks);
|
||||
|
@ -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);
|
||||
|
4
WorldForm.Designer.cs
generated
4
WorldForm.Designer.cs
generated
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user