From 1030e8e762d0c069ec85b4d267c69e193c8434bd Mon Sep 17 00:00:00 2001 From: jonwd7 <jon.wd7@gmail.com> Date: Tue, 29 Mar 2016 12:45:57 -0400 Subject: [PATCH] [FO4] Vertex Format Overhaul Combined VF6 and VF7, created <bitflags> after rigorous testing. Rigorous catch-all compound instead of the mess before. Removed edge case compounds as they are no longer needed. Left optimized compounds for NifSkope speed issues. --- nif.xml | 117 +++++++++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 61 deletions(-) diff --git a/nif.xml b/nif.xml index 531eb62..8ea8f42 100644 --- a/nif.xml +++ b/nif.xml @@ -6297,6 +6297,25 @@ <!-- Fallout 4 Geometry --> + <bitflags name="VertexFlags" storage="ushort"> + <option value="0" name="VF_Unknown_1" /> <!-- & 1 --> + <option value="1" name="VF_Unknown_2" /> <!-- & 2 --> + <option value="2" name="VF_Unknown_3" /> <!-- & 4 --> + <option value="3" name="VF_Unknown_4" /> <!-- & 8 --> + <option value="4" name="VF_Vertex" /> <!-- & 16 --> + <option value="5" name="VF_UVs" /> <!-- & 32 --> + <option value="6" name="VF_Unknown_5" /> <!-- & 64 --> + <option value="7" name="VF_Normals" /> <!-- & 128 --> + <option value="8" name="VF_Tangents" /> <!-- & 256 --> + <option value="9" name="VF_Vertex_Colors" /> <!-- & 512 --> + <option value="10" name="VF_Skinned" /> <!-- & 1024 --> + <option value="11" name="VF_Unknown_6" /> <!-- & 2048 --> + <option value="12" name="VF_Male_Eyes" /> <!-- & 4096 --> + <option value="13" name="VF_Unknown_7" /> <!-- & 8192 --> + <option value="14" name="VF_Full_Precision" /> <!-- & 16384 --> + <option value="15" name="VF_Unknown_8" /> <!-- & 32768 --> + </bitflags> + <compound name="BSVertexDataRigid"> Rigid Vertex Data compound <add name="Vertex" type="HalfVector3" /> @@ -6306,7 +6325,7 @@ <add name="Bitangent Y" type="byte" /> <add name="Tangent" type="ByteVector3" /> <add name="Bitangent Z" type="byte" /> - <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 2) != 0" /> + <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 512) != 0" /> </compound> <compound name="BSVertexDataSkinned"> @@ -6318,26 +6337,28 @@ <add name="Bitangent Y" type="byte" /> <add name="Tangent" type="ByteVector3" /> <add name="Bitangent Z" type="byte" /> - <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 2) != 0" /> + <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 512) != 0" /> <add name="Bone Weights" type="hfloat" arr1="4" /> <add name="Bone Indices" type="byte" arr1="4" /> - <add name="Unknown Int 2" type="uint" cond="(ARG & 16) != 0" /> </compound> <compound name="BSVertexData"> Catch all Vertex Data compound, SLOW - <add name="Vertex" type="HalfVector3" /> - <add name="Bitangent X" type="hfloat" cond="((ARG != 6) && (ARG > 4))" /> - <add name="Unknown Short 1" type="ushort" cond="((ARG == 6) || (ARG < 5))" /> - <add name="UV" type="HalfTexCoord" cond="(ARG > 2) && (ARG != 4)" /> - <add name="Normal" type="ByteVector3" cond="((ARG > 3) && (ARG != 7))" /> - <add name="Bitangent Y" type="byte" cond="((ARG > 3) && (ARG != 7))" /> - <add name="Tangent" type="ByteVector3" cond="((ARG > 3) && (ARG != 7))" /> - <add name="Bitangent Z" type="byte" cond="((ARG > 3) && (ARG != 7))" /> - <add name="Vertex Colors" type="ByteColor4" cond="((ARG == 6) || (ARG == 7) || (ARG == 9) || (ARG == 10))" /> - <add name="Bone Weights" type="hfloat" cond="ARG > 6" arr1="4" /> - <add name="Bone Indices" type="byte" cond="ARG > 6" arr1="4" /> - <add name="Unknown Int 2" type="uint" cond="ARG == 10" /> + <add name="Vertex" type="HalfVector3" cond="((ARG & 16) != 0) && ((ARG & 16384) == 0)" /> + <add name="Bitangent X" type="hfloat" cond="((ARG & 256) != 0) && ((ARG & 16384) == 0)" /> + <add name="Unknown Short" type="ushort" cond="((ARG & 256) == 0) && ((ARG & 16384) == 0)" /> + <add name="Vertex" type="Vector3" cond="((ARG & 16) != 0) && ((ARG & 16384) != 0)" /> + <add name="Bitangent X" type="float" cond="((ARG & 256) != 0) && ((ARG & 16384) != 0)" /> + <add name="Unknown Int" type="uint" cond="((ARG & 256) == 0) && ((ARG & 16384) != 0)" /> + <add name="UV" type="HalfTexCoord" cond="(ARG & 32) != 0" /> + <add name="Normal" type="ByteVector3" cond="(ARG & 128) != 0" /> + <add name="Bitangent Y" type="byte" cond="(ARG & 128) != 0" /> + <add name="Tangent" type="ByteVector3" cond="((ARG & 128) != 0) && ((ARG & 256) != 0)" /> + <add name="Bitangent Z" type="byte" cond="((ARG & 128) != 0) && ((ARG & 256) != 0)" /> + <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 512) != 0" /> + <add name="Bone Weights" type="hfloat" arr1="4" cond="(ARG & 1024) != 0" /> + <add name="Bone Indices" type="byte" arr1="4" cond="(ARG & 1024) != 0" /> + <add name="Unknown Int 2" type="uint" cond="(ARG & 4096) != 0" /> </compound> <compound name="BSVertexDataFloat"> @@ -6349,28 +6370,9 @@ <add name="Bitangent Y" type="byte" /> <add name="Tangent" type="ByteVector3" /> <add name="Bitangent Z" type="byte" /> - <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 2) != 0" /> - <add name="Bone Weights" type="hfloat" cond="(ARG & 4) != 0" arr1="4" /> - <add name="Bone Indices" type="byte" cond="(ARG & 4) != 0" arr1="4" /> - </compound> - - <compound name="BSVertexDataNoTangents"> - TODO: Temporary - <add name="Vertex" type="HalfVector3" /> - <add name="Unknown Short 1" type="ushort" /> - <add name="Normal" type="ByteVector3" /> - <add name="Unknown Byte 1" type="byte" /> - <add name="Vertex Colors" type="ByteColor4" cond="ARG == 4" /> - </compound> - - <compound name="BSVertexDataNoNormals"> - TODO: Temporary - <add name="Vertex" type="HalfVector3" /> - <add name="Unknown Short 1" type="ushort" /> - <add name="UV" type="HalfTexCoord" /> - <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 2) != 0" /> - <add name="Bone Weights" type="hfloat" cond="(ARG & 4) != 0" arr1="4" /> - <add name="Bone Indices" type="byte" cond="(ARG & 4) != 0" arr1="4" /> + <add name="Vertex Colors" type="ByteColor4" cond="(ARG & 512) != 0" /> + <add name="Bone Weights" type="hfloat" cond="(ARG & 1024) != 0" arr1="4" /> + <add name="Bone Indices" type="byte" cond="(ARG & 1024) != 0" arr1="4" /> </compound> <niobject name="BSTriShape" abstract="0" inherit="NiAVObject"> @@ -6378,37 +6380,30 @@ <add name="Bounding Sphere" type="SphereBV" /> <add name="Skin" type="Ref" template="NiObject" /> <add name="BS Properties" type="Ref" template="NiProperty" arr1="2" /> - <add name="VF1" type="byte" /> - <add name="VF2" type="byte" /> + <add name="Vertex Size" type="byte" /> + <add name="Float Size" type="byte" /> <add name="VF3" type="byte" /> <add name="VF4" type="byte" /> <add name="VF5" type="byte" /> - <add name="VF6" type="byte" /> - <add name="VF7" type="byte" /> + <add name="VF" type="VertexFlags" /> <add name="VF8" type="byte" /> <add name="Num Triangles" type="uint" /> <add name="Num Vertices" type="ushort" /> <add name="Data Size" type="uint" /> - <!-- Below are several compounds to bypass the inability to check multiple flags via multiple ARG passing --> - <!-- NifSkope performance is also **extremely** poor with ARG passing and so optimized compounds for the majority of cases were created --> - <!-- Rigid (Optimized) --> - <add name="Vertex Data" type="BSVertexDataRigid" arr1="Num Vertices" arg="VF7" - cond="(Data Size > 0) && ((VF7 & 64) == 0) && ((VF7 & 1) != 0) && ((VF7 & 4) == 0) && (VF6 == 176)" /> - <!-- Skinned (Optimized) --> - <add name="Vertex Data" type="BSVertexDataSkinned" arr1="Num Vertices" arg="VF7" - cond="(Data Size > 0) && ((VF7 & 64) == 0) && ((VF7 & 1) != 0) && ((VF7 & 4) != 0) && (VF6 == 176)" /> - <!-- Catch All (SLOW) --> - <add name="Vertex Data" type="BSVertexData" arr1="Num Vertices" arg="VF1" - cond="(Data Size > 0) && ((VF7 & 64) == 0) && ((VF7 & 1) == 0) && ((VF6 == 176) || (VF6 == 16))" /> - <!-- Float Replacement (SCOL folder) --> - <add name="Vertex Data" type="BSVertexDataFloat" arr1="Num Vertices" arg="VF7" - cond="(Data Size > 0) && ((VF7 & 64) != 0) && (VF6 == 176)" /> - <!-- Edge Case #1 (VF6 == 48) --> - <add name="Vertex Data" type="BSVertexDataNoNormals" arr1="Num Vertices" arg="VF7" - cond="(Data Size > 0) && ((VF7 & 64) == 0) && (VF6 == 48)" /> - <!-- Edge Case #2 (VF6 == 144) --> - <add name="Vertex Data" type="BSVertexDataNoTangents" arr1="Num Vertices" arg="VF1" - cond="(Data Size > 0) && ((VF7 & 64) == 0) && (VF6 == 144)" /> + <!-- NifSkope performance is **extremely** poor with ARG passing and so optimized compounds for the majority of cases were created --> + <!-- Rigid (Optimized) --> + <add name="Vertex Data" type="BSVertexDataRigid" arr1="Num Vertices" arg="VF" + cond="(Data Size > 0) && ((VF == 432) || (VF == 944))" /> + <!-- Skinned (Optimized) --> + <add name="Vertex Data" type="BSVertexDataSkinned" arr1="Num Vertices" arg="VF" + cond="(Data Size > 0) && ((VF == 1456) || (VF == 1968))" /> + <!-- Catch All (SLOW) --> + <add name="Vertex Data" type="BSVertexData" arr1="Num Vertices" arg="VF" + cond="(Data Size > 0) && ((VF & 16384) == 0) && ((VF != 432) && (VF != 944) && (VF != 1456) && (VF != 1968))" /> + <!-- Float Replacement (SCOL folder) --> + <add name="Vertex Data" type="BSVertexDataFloat" arr1="Num Vertices" arg="VF" + cond="(Data Size > 0) && ((VF & 16384) != 0)" /> + <add name="Triangles" type="Triangle" arr1="Num Triangles" cond="Data Size > 0" /> </niobject> -- GitLab