public void LoadGameSettings(LSLib.LS.Enums.Game game) { switch (game) { case LSLib.LS.Enums.Game.DivinityOriginalSin: Is64Bit = false; AlternateSignature = false; VersionTag = LSLib.Granny.GR2.Header.Tag_DOS; ModelInfoFormat = DivinityModelInfoFormat.None; break; case LSLib.LS.Enums.Game.DivinityOriginalSinEE: Is64Bit = true; AlternateSignature = true; VersionTag = LSLib.Granny.GR2.Header.Tag_DOSEE; ModelInfoFormat = DivinityModelInfoFormat.UserDefinedProperties; break; case LSLib.LS.Enums.Game.DivinityOriginalSin2: Is64Bit = true; AlternateSignature = true; VersionTag = LSLib.Granny.GR2.Header.Tag_DOSEE; ModelInfoFormat = DivinityModelInfoFormat.LSMv1; break; case LSLib.LS.Enums.Game.DivinityOriginalSin2DE: default: Is64Bit = true; AlternateSignature = true; VersionTag = LSLib.Granny.GR2.Header.Tag_DOS2DE; ModelInfoFormat = DivinityModelInfoFormat.LSMv1; break; } }
public static DivinityMeshExtendedData MakeMeshExtendedData(Mesh mesh, DivinityModelInfoFormat format, DivinityModelFlag modelFlagOverrides) { var extendedData = DivinityMeshExtendedData.Make(); DivinityModelFlag modelFlags = modelFlagOverrides; if (mesh.HasDefiniteModelType) { modelFlags = mesh.ModelType; } if (mesh.VertexFormat.HasBoneWeights) { modelFlags |= DivinityModelFlag.Skinned; } if (mesh.VertexFormat.ColorMaps > 0) { modelFlags |= DivinityModelFlag.HasColor; } else { modelFlags &= ~DivinityModelFlag.Cloth; } extendedData.UserDefinedProperties = DivinityHelpers.ModelFlagsToUserDefinedProperties(modelFlags); if (format == DivinityModelInfoFormat.UserDefinedProperties) { extendedData.LSMVersion = 0; extendedData.UserMeshProperties = null; } else { extendedData.UserMeshProperties.MeshFlags = modelFlags; if (format == DivinityModelInfoFormat.LSMv3) { extendedData.LSMVersion = 3; extendedData.UserMeshProperties.FormatDescs = DivinityFormatDesc.FromVertexFormat(mesh.VertexFormat); extendedData.UserMeshProperties.LodDistance = new float[] { 3.40282347E+38f }; extendedData.UserMeshProperties.IsImpostor = new Int32[] { 0 }; } else if (format == DivinityModelInfoFormat.LSMv1) { extendedData.LSMVersion = 1; extendedData.UserMeshProperties.FormatDescs = DivinityFormatDesc.FromVertexFormat(mesh.VertexFormat); } else { extendedData.LSMVersion = 0; extendedData.UserMeshProperties.FormatDescs = new List <DivinityFormatDesc>(); } } return(extendedData); }
public static DivinityMeshExtendedData MakeMeshExtendedData(Mesh mesh, DivinityModelInfoFormat format, DivinityModelType meshModelType) { var extendedData = DivinityMeshExtendedData.Make(); if (mesh.ModelType != DivinityModelType.Undefined) { meshModelType = mesh.ModelType; } if (meshModelType == DivinityModelType.Cloth && mesh.VertexFormat.ColorMaps == 0) { meshModelType = DivinityModelType.Normal; } if (meshModelType == DivinityModelType.Undefined) { meshModelType = DivinityHelpers.DetermineModelType(mesh); } extendedData.UserDefinedProperties = DivinityHelpers.ModelTypeToUserDefinedProperties(meshModelType); if (format == DivinityModelInfoFormat.UserDefinedProperties) { extendedData.LSMVersion = 0; extendedData.UserMeshProperties = null; } else { DivinityModelFlag flags = 0; if (mesh.VertexFormat.HasBoneWeights) { flags |= DivinityModelFlag.Skinned; } if (mesh.VertexFormat.ColorMaps > 0) { flags |= DivinityModelFlag.HasColor; } switch (meshModelType) { case DivinityModelType.Normal: // No special flag should be set here break; case DivinityModelType.Cloth: flags |= DivinityModelFlag.Cloth; break; case DivinityModelType.Rigid: flags |= DivinityModelFlag.Rigid; break; case DivinityModelType.MeshProxy: flags |= DivinityModelFlag.MeshProxy; break; default: throw new NotImplementedException(); } extendedData.UserMeshProperties.MeshFlags = flags; if (format == DivinityModelInfoFormat.LSMv1) { extendedData.LSMVersion = 1; extendedData.UserMeshProperties.FormatDescs = DivinityFormatDesc.FromVertexFormat(mesh.VertexFormat); } else { extendedData.LSMVersion = 0; extendedData.UserMeshProperties.FormatDescs = new List <DivinityFormatDesc>(); } } return(extendedData); }