YDR/YDD/XML conversion

This commit is contained in:
dexy
2020-01-20 02:08:04 +11:00
Unverified
parent 9ed308df7a
commit bec16ea42d
14 changed files with 1213 additions and 437 deletions
+2 -2
View File
@@ -256,7 +256,7 @@ namespace CodeWalker.Rendering
//supported layouts - requires Position, Normal, Colour, Texcoord
layouts.Add(VertexType.Default, new InputLayout(device, vspnctbytes, VertexTypeGTAV.GetLayout(VertexType.Default)));
layouts.Add(VertexType.PNCH2, new InputLayout(device, vspnctbytes, VertexTypeGTAV.GetLayout(VertexType.PNCH2, VertexDeclarationTypes.Types3)));//TODO?
layouts.Add(VertexType.PNCH2, new InputLayout(device, vspnctbytes, VertexTypeGTAV.GetLayout(VertexType.PNCH2, VertexDeclarationTypes.GTAV3)));//TODO?
layouts.Add(VertexType.PNCTT, new InputLayout(device, vspncttbytes, VertexTypeGTAV.GetLayout(VertexType.PNCTT)));
layouts.Add(VertexType.PNCTTT, new InputLayout(device, vspnctttbytes, VertexTypeGTAV.GetLayout(VertexType.PNCTTT)));
layouts.Add(VertexType.PNCCT, new InputLayout(device, vspncctbytes, VertexTypeGTAV.GetLayout(VertexType.PNCCT)));
@@ -267,7 +267,7 @@ namespace CodeWalker.Rendering
//normalmap layouts - requires Position, Normal, Colour, Texcoord, Tangent (X)
layouts.Add(VertexType.DefaultEx, new InputLayout(device, vspnctxbytes, VertexTypeGTAV.GetLayout(VertexType.DefaultEx)));
layouts.Add(VertexType.PCCH2H4, new InputLayout(device, vspnctxbytes, VertexTypeGTAV.GetLayout(VertexType.PCCH2H4, VertexDeclarationTypes.Types2)));
layouts.Add(VertexType.PCCH2H4, new InputLayout(device, vspnctxbytes, VertexTypeGTAV.GetLayout(VertexType.PCCH2H4, VertexDeclarationTypes.GTAV2)));
layouts.Add(VertexType.PNCCTX, new InputLayout(device, vspncctxbytes, VertexTypeGTAV.GetLayout(VertexType.PNCCTX)));
layouts.Add(VertexType.PNCTTX, new InputLayout(device, vspncttxbytes, VertexTypeGTAV.GetLayout(VertexType.PNCTTX)));
layouts.Add(VertexType.PNCCTTX, new InputLayout(device, vspnccttxbytes, VertexTypeGTAV.GetLayout(VertexType.PNCCTTX)));
+2 -2
View File
@@ -113,8 +113,8 @@ namespace CodeWalker.Rendering
layouts.Add(VertexType.PNCCTTTX, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCCTTTX)));
layouts.Add(VertexType.PNCCTT, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCCTT)));
layouts.Add(VertexType.PNCCTX, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCCTX)));
layouts.Add(VertexType.PNCH2, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCH2, VertexDeclarationTypes.Types3)));
layouts.Add(VertexType.PCCH2H4, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PCCH2H4, VertexDeclarationTypes.Types2)));
layouts.Add(VertexType.PNCH2, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCH2, VertexDeclarationTypes.GTAV3)));
layouts.Add(VertexType.PCCH2H4, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PCCH2H4, VertexDeclarationTypes.GTAV2)));
layouts.Add(VertexType.PNCTT, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCTT)));
layouts.Add(VertexType.PNCTTT, new InputLayout(device, vsbytes, VertexTypeGTAV.GetLayout(VertexType.PNCTTT)));
+6 -25
View File
@@ -32,45 +32,26 @@ namespace CodeWalker.Rendering
"BINORMAL",
};
public static int GetVertexComponentTypeSizeInBytes(VertexComponentType type)
{
switch (type)
{
case VertexComponentType.Nothing: return 0;
case VertexComponentType.Float16Two: return 4;
case VertexComponentType.Float: return 4;
case VertexComponentType.Float16Four: return 8;
case VertexComponentType.Float_unk: return 0;
case VertexComponentType.Float2: return 8;
case VertexComponentType.Float3: return 12;
case VertexComponentType.Float4: return 16;
case VertexComponentType.UByte4: return 4;
case VertexComponentType.Color: return 4;
case VertexComponentType.Dec3N: return 4;
default: return 0;
}
}
public static Format GetDXGIFormat(VertexComponentType type)
{
switch (type)
{
case VertexComponentType.Nothing: return Format.Unknown;
case VertexComponentType.Float16Two: return Format.R16G16_Float;
case VertexComponentType.Half2: return Format.R16G16_Float;
case VertexComponentType.Float: return Format.R32_Float;
case VertexComponentType.Float16Four: return Format.R16G16B16A16_Float;
case VertexComponentType.Float_unk: return Format.Unknown;
case VertexComponentType.Half4: return Format.R16G16B16A16_Float;
case VertexComponentType.FloatUnk: return Format.Unknown;
case VertexComponentType.Float2: return Format.R32G32_Float;
case VertexComponentType.Float3: return Format.R32G32B32_Float;
case VertexComponentType.Float4: return Format.R32G32B32A32_Float;
case VertexComponentType.UByte4: return Format.R8G8B8A8_UInt;
case VertexComponentType.Color: return Format.R8G8B8A8_UNorm;
case VertexComponentType.Colour: return Format.R8G8B8A8_UNorm;
case VertexComponentType.Dec3N: return Format.R10G10B10A2_UNorm;
default: return Format.Unknown;
}
}
public static InputElement[] GetLayout(VertexType componentsFlags, VertexDeclarationTypes componentsTypes = VertexDeclarationTypes.Types1)
public static InputElement[] GetLayout(VertexType componentsFlags, VertexDeclarationTypes componentsTypes = VertexDeclarationTypes.GTAV1)
{
List<InputElement> inputElements = new List<InputElement>();
@@ -87,7 +68,7 @@ namespace CodeWalker.Rendering
if (componentType == VertexComponentType.Nothing) continue; // should never hit this
var componentTypeSize = GetVertexComponentTypeSizeInBytes(componentType);
var componentTypeSize = VertexComponentTypes.GetSizeInBytes(componentType);
var format = GetDXGIFormat(componentType);
if (componentTypeSize == 0 || format == Format.Unknown) continue;