From 0f28b86d4f36f2288118aa91b4b38d32e37460ff Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:58:12 +0100 Subject: [PATCH] Add default model handling (defaults unfinished) --- PCK-Studio/Internal/GameModelImporter.cs | 1 + PCK-Studio/Internal/Json/JsonDefaultModel.cs | 52 +++ PCK-Studio/MainForm.cs | 100 +++++- PCK-Studio/PckStudio.csproj | 2 + PCK-Studio/Properties/Resources.Designer.cs | 103 +++--- PCK-Studio/Properties/Resources.resx | 45 +-- PCK-Studio/Resources/model/defaultModels.json | 302 ++++++++++++++++++ PCK-Studio/Resources/model/modelMetaData.json | 4 +- 8 files changed, 539 insertions(+), 70 deletions(-) create mode 100644 PCK-Studio/Internal/Json/JsonDefaultModel.cs create mode 100644 PCK-Studio/Resources/model/defaultModels.json diff --git a/PCK-Studio/Internal/GameModelImporter.cs b/PCK-Studio/Internal/GameModelImporter.cs index 8c6a6aa8..98c0ce4b 100644 --- a/PCK-Studio/Internal/GameModelImporter.cs +++ b/PCK-Studio/Internal/GameModelImporter.cs @@ -46,6 +46,7 @@ namespace PckStudio.Internal public ModelExportSettings ExportSettings { get; } = new ModelExportSettings(); internal static ReadOnlyDictionary ModelMetaData { get; } = JsonConvert.DeserializeObject>(Resources.modelMetaData); + internal static ReadOnlyDictionary DefaultModels { get; } = JsonConvert.DeserializeObject>(Resources.defaultModels); private GameModelImporter() { diff --git a/PCK-Studio/Internal/Json/JsonDefaultModel.cs b/PCK-Studio/Internal/Json/JsonDefaultModel.cs new file mode 100644 index 00000000..1735d428 --- /dev/null +++ b/PCK-Studio/Internal/Json/JsonDefaultModel.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace PckStudio.Internal.Json +{ + internal class DefaultModel + { + [JsonProperty("textureSize", Required = Required.Always)] + public Vector2 TextureSize { get; set; } + + [JsonProperty("parts", Required = Required.Always)] + public DefaultPart[] Parts { get; set; } = Array.Empty(); + } + + internal class DefaultPart + { + [JsonProperty("name", Required = Required.Always)] + public string Name { get; set; } + + [JsonProperty("translation")] + public Vector3 Translation { get; set; } = Vector3.Zero; + + [JsonProperty("rotation")] + public Vector3 Rotation { get; set; } = Vector3.Zero; + + [JsonProperty("boxes")] + public ModelDefaultBox[] Boxes { get; set; } + } + + internal class ModelDefaultBox + { + [JsonProperty("pos")] + public Vector3 Position { get; set; } + + [JsonProperty("size")] + public Vector3 Size { get; set; } + + [JsonProperty("uv")] + public Vector2 Uv { get; set; } + + [JsonProperty("mirror")] + public bool Mirror { get; set; } = false; + + [JsonProperty("inflate")] + public float Inflate { get; set; } = 0f; + } +} diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index d9673da6..5aa75929 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -41,7 +41,8 @@ using PckStudio.Internal.Serializer; using PckStudio.Internal.App; using PckStudio.Internal.Skin; using PckStudio.Interfaces; -using System.Collections.ObjectModel; +using PckStudio.Rendering; +using MetroFramework.Forms; namespace PckStudio { @@ -449,7 +450,52 @@ namespace PckStudio } } - private void HandleTextureFile(PckAsset asset) + private static Model HandleDefaultEntityModel(string modelName) + { + if (!GameModelImporter.DefaultModels.TryGetValue(modelName, out DefaultModel defaultModel) || defaultModel is null) + { + MessageBox.Show("No Default Model found."); + return null; + } + Model model = new Model(modelName, new Size((int)defaultModel.TextureSize.X, (int)defaultModel.TextureSize.Y)); + + foreach (DefaultPart defaultPart in defaultModel.Parts) + { + ModelPart modelPart = new ModelPart(defaultPart.Name, "", defaultPart.Translation, defaultPart.Rotation, System.Numerics.Vector3.Zero); + modelPart.AddBoxes(defaultPart.Boxes.Select(defaultBox => new ModelBox(defaultBox.Position, defaultBox.Size, defaultBox.Uv, defaultBox.Inflate, defaultBox.Mirror))); + model.AddPart(modelPart); + } + + return model; + } + + private void ShowSimpleModelRender(Model model, NamedTexture modelTexture) + { + MetroForm form = new MetroForm(); + form.Icon = Resources.ProjectLogo; + form.Theme = MetroFramework.MetroThemeStyle.Dark; + form.Style = MetroFramework.MetroColorStyle.Silver; + form.StartPosition = FormStartPosition.CenterParent; + form.Text = $"{model.Name} - {modelTexture.Name}"; + form.Size = new Size(600, 500); + + ModelRenderer renderer = new ModelRenderer(); + form.Controls.Add(renderer); + + renderer.VSync = true; + renderer.BackColor = Color.FromArgb(30, 30, 30); + renderer.Dock = DockStyle.Fill; + renderer.Texture = modelTexture.Texture; + renderer.LoadModel(model); + renderer.ResetCamera(); + + form.ShowDialog(this); + + renderer.Dispose(); + form.Dispose(); + } + + private void HandleTextureFile(PckAsset asset) { _ = asset.IsMipmappedFile() && currentPCK.TryGetValue(asset.GetNormalPath(), PckAssetType.TextureFile, out asset); @@ -465,8 +511,52 @@ namespace PckStudio switch (resourceLocation.Category) { case ResourceCategory.Unknown: - Debug.WriteLine($"Unknown Resource Category."); - break; + Debug.WriteLine($"Unknown Resource Category."); + break; + case ResourceCategory.MobEntityTextures: + case ResourceCategory.ItemEntityTextures: + { + string texturePath = asset.Filename.Substring(0, asset.Filename.Length - Path.GetExtension(asset.Filename).Length); + string[] modelNames = GameModelImporter.ModelMetaData.Where(kv => kv.Value.TextureLocations.Contains(texturePath)).Select(kv => kv.Key).ToArray(); + + if (modelNames.Length == 0) + { + MessageBox.Show("No Model info found"); + return; + } + + string modelName = modelNames[0]; + if (modelNames.Length > 1) + { + using ItemSelectionPopUp itemSelectionPopUp = new ItemSelectionPopUp(modelNames.ToArray()); + itemSelectionPopUp.ButtonText = "View"; + itemSelectionPopUp.LabelText = "Models:"; + if (itemSelectionPopUp.ShowDialog() == DialogResult.OK && modelNames.IndexInRange(itemSelectionPopUp.SelectedIndex)) + { + modelName = modelNames[itemSelectionPopUp.SelectedIndex]; + } + } + + NamedTexture modelTexture = new NamedTexture(Path.GetFileName(texturePath), asset.GetTexture()); + + Model model = HandleDefaultEntityModel(modelName); + if (currentPCK.TryGetAsset("models.bin", PckAssetType.ModelsFile, out PckAsset modelsAsset)) + { + ModelContainer models = modelsAsset.GetData(new ModelFileReader()); + if (models.ContainsModel(modelName)) + { + Debug.WriteLine($"Custom model for '{modelName}' found."); + model = models.GetModelByName(modelName); + } + } + + if (model is not null) + { + ShowSimpleModelRender(model, modelTexture); + } + } + break; + case ResourceCategory.ItemAnimation: case ResourceCategory.BlockAnimation: Animation animation = asset.GetDeserializedData(AnimationDeserializer.DefaultDeserializer); @@ -504,7 +594,7 @@ namespace PckStudio wasModified = true; BuildMainTreeView(); } - break; + break; default: Debug.WriteLine($"Unhandled Resource Category: {resourceLocation.Category}"); break; diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index e2ac40ff..34e18dc8 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -179,6 +179,7 @@ + @@ -656,6 +657,7 @@ + diff --git a/PCK-Studio/Properties/Resources.Designer.cs b/PCK-Studio/Properties/Resources.Designer.cs index 7f174008..51bcd9e8 100644 --- a/PCK-Studio/Properties/Resources.Designer.cs +++ b/PCK-Studio/Properties/Resources.Designer.cs @@ -316,6 +316,29 @@ namespace PckStudio.Properties { } } + /// + /// Looks up a localized string similar to { + /// "dolphin": { + /// "textureSize": { "X": 64, "Y": 64 }, + /// "parts": [ + /// { + /// "name": "head", + /// "boxes": [ + /// { "pos": { "X": -4, "Y": -7, "Z": -6 }, "size": { "X": 8, "Y": 7, "Z": 6 }, "uv": { "X": 0, "Y": 0 } } + /// ] + /// }, + /// { + /// "name": "nose", + /// "translation": { "X": 0, "Y": 0, "Z": -10 }, + /// "boxes": [ + /// { "pos": { "X": -1, "Y": -2, "Z": 0 }, "size": { "X": 2, "Y": 2, "Z": 4 }, "uv": { "X": 0, "Y": 13 } } [rest of string was truncated]";. + /// + public static string defaultModels { + get { + return ResourceManager.GetString("defaultModels", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -820,35 +843,27 @@ namespace PckStudio.Properties { /// "textureLocations": [ /// "res/mob/bat" /// ], - /// "root": { - /// "head": [ - /// "rightEar", - /// "leftEar" - /// ], - /// "body": [ - /// { - /// "rightWing": [ - /// "rightWingTip" - /// ], - /// "leftWing": [ - /// "leftWingTip" - /// ] - /// } - /// ] - /// } - /// }, - /// "bed": { - /// "textureLocations": [ - /// "res/item/bed" - /// ] - /// }, - /// "blaze": { - /// "textureLocations": [ - /// "res/mob/fire" - /// ] - /// }, - /// "boat": { - /// [rest of string was truncated]";. + /// "materialName": "bat", + /// "parts": [ + /// { + /// "name": "head", + /// "children": [ + /// { "name": "rightEar" }, + /// { "name": "leftEar" } + /// ] + /// }, + /// { + /// "name": "body", + /// "children": [ + /// { + /// "name": "rightWing", + /// "children": [ + /// { "name": "rightWingTip" } + /// ] + /// }, + /// { + /// "name": "leftWing", + /// [rest of string was truncated]";. /// public static string modelMetaData { get { @@ -1077,14 +1092,14 @@ namespace PckStudio.Properties { /// ///layout(location = 0) out vec4 FragColor; /// - ///uniform vec4 baseColor; - ///uniform float intensity; + ///uniform vec4 BlendColor; + ///uniform float Intensity; /// ///in vec4 color; /// ///void main() ///{ - /// FragColor = vec4((color * baseColor).rgb, intensity); + /// FragColor = vec4((color * BlendColor).rgb, Intensity); ///}. /// public static string plainColorFragmentShader { @@ -1254,14 +1269,17 @@ namespace PckStudio.Properties { /// ///layout(location = 0) out vec4 color; /// - ///uniform sampler2D u_Texture; + ///uniform sampler2D Texture; /// ///in vec2 o_TillingFactor; ///in vec2 o_TexCoord; /// ///void main() ///{ - /// color = texture(u_Texture, o_TexCoord * o_TillingFactor); + /// vec4 result = texture(Texture, o_TexCoord * o_TillingFactor); + /// if (result.a <= 0.0) + /// discard; + /// color = result; ///};. /// public static string texturedCubeFragmentShader { @@ -1276,7 +1294,7 @@ namespace PckStudio.Properties { ///layout (triangles) in; ///layout (triangle_strip, max_vertices=3) out; /// - ///uniform vec2 u_TexSize; + ///uniform vec2 TexSize; /// ///out vec2 o_TexCoord; ///out vec2 o_TillingFactor; @@ -1289,14 +1307,15 @@ namespace PckStudio.Properties { ///void FixUV() ///{ /// bool isXBad = - /// dataIn[0].TexCoord.x >= u_TexSize.x && - /// dataIn[1].TexCoord.x >= u_TexSize.x && - /// dataIn[2].TexCoord.x >= u_TexSize.x; + /// dataIn[0].TexCoord.x >= TexSize.x && + /// dataIn[1].TexCoord.x >= TexSize.x && + /// dataIn[2].TexCoord.x >= TexSize.x; /// /// gl_Position = gl_in[0].gl_Position; /// o_TexCoord = dataIn[0].TexCoord; /// if (isXBad) - /// o_TexCoord.x = mod(o_TexCoord.x, u_TexSiz [rest of string was truncated]";. + /// o_TexCoord.x = mod(o_TexCoord.x, TexSize.x); + /// Em [rest of string was truncated]";. /// public static string texturedCubeGeometryShader { get { @@ -1310,8 +1329,8 @@ namespace PckStudio.Properties { ///layout(location = 0) in vec3 vertexPosition; ///layout(location = 1) in vec2 texCoord; /// - ///uniform mat4 u_ViewProjection; - ///uniform mat4 u_Transform; + ///uniform mat4 ViewProjection; + ///uniform mat4 Transform; /// ///out geometryData ///{ @@ -1321,7 +1340,7 @@ namespace PckStudio.Properties { ///void main() ///{ /// dataOut.TexCoord = texCoord; - /// gl_Position = u_ViewProjection * u_Transform * vec4(vertexPosition, 1.0); + /// gl_Position = ViewProjection * Transform * vec4(vertexPosition, 1.0); ///};. /// public static string texturedCubeVertexShader { diff --git a/PCK-Studio/Properties/Resources.resx b/PCK-Studio/Properties/Resources.resx index 93b5dcad..594989cd 100644 --- a/PCK-Studio/Properties/Resources.resx +++ b/PCK-Studio/Properties/Resources.resx @@ -158,7 +158,7 @@ ..\Resources\fileTemplates\tu32colours.col;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\Resources\atlases\moonPhaseData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\moonPhaseData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\iconImageList\PCK ICON.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -200,10 +200,10 @@ ..\Resources\icons\file_paste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\atlases\mapIconData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\mapIconData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\atlases\blockData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\blockData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\fileTemplates\tu19colours.col;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -239,7 +239,7 @@ ..\Resources\atlases\paintingData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - ..\Resources\atlases\entityMaterialsData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\entityMaterialsData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\iconImageList\IMAGE ICON.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -257,7 +257,7 @@ ..\Resources\atlases\terrain.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\atlases\bannerData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\bannerData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\iconImageList\LOC ICON.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -269,7 +269,7 @@ ..\Resources\atlases\experience_orbs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\atlases\entityBehavioursData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\entityBehavioursData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\binka\mss32.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -296,7 +296,7 @@ ..\Resources\external\PS3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\atlases\experienceOrbData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\experienceOrbData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\icons\file_empty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -314,10 +314,10 @@ ..\Resources\iconImageList\INFO ICON.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\atlases\explosionData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\explosionData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\atlases\particleData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\particleData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\atlases\particles.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -362,13 +362,13 @@ ..\Resources\fileTemplates\tu12colours.col;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\Resources\atlases\itemData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\itemData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\fileTemplates\tu14colours.col;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\Resources\atlases\entityModelsData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\atlases\entityModelsData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\fileTemplates\tu69colours.col;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -380,34 +380,34 @@ ..\Resources\icons\Replace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\shader\texturedCubeVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\texturedCubeVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\texturedCubeFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\texturedCubeFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\skybox_texture.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\shader\skyboxFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\skyboxFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\skyboxVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\skyboxVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\texturedCubeGeometryShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\texturedCubeGeometryShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\framebufferFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\framebufferFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\framebufferVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\framebufferVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\plainColorFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\plainColorFragmentShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - ..\Resources\shader\plainColorVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\shader\plainColorVertexShader.glsl;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\armor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -422,6 +422,9 @@ ..\Resources\icons\file_restore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\model\modelMetaData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\model\modelMetaData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 + + + ..\Resources\model\defaultModels.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 \ No newline at end of file diff --git a/PCK-Studio/Resources/model/defaultModels.json b/PCK-Studio/Resources/model/defaultModels.json new file mode 100644 index 00000000..d0edae38 --- /dev/null +++ b/PCK-Studio/Resources/model/defaultModels.json @@ -0,0 +1,302 @@ +{ + "bat": { + "textureSize": { "X": 64, "Y": 64 }, + "parts": [ + { + "name": "head", + "boxes": [ + { "pos": { "X": -3, "Y": -3, "Z": -3 }, "size": { "X": 6, "Y": 6, "Z": 6 }, "uv": { "X": 0, "Y": 0 } } + ] + }, + { + "name": "body", + "boxes": [ + { "pos": { "X": -3, "Y": 4, "Z": -3 }, "size": { "X": 6, "Y": 12, "Z": 6 }, "uv": { "X": 0, "Y": 16 } }, + { "pos": { "X": -5, "Y": 16, "Z": 0 }, "size": { "X": 10, "Y": 6, "Z": 1 }, "uv": { "X": 0, "Y": 34 } } + ] + }, + { + "name": "rightEar", + "boxes": [ + { "pos": { "X": -4, "Y": -6, "Z": -2 }, "size": { "X": 3, "Y": 4, "Z": 1 }, "uv": { "X": 24, "Y": 0 } } + ] + }, + { + "name": "leftEar", + "boxes": [ + { "pos": { "X": 1, "Y": -6, "Z": -2 }, "size": { "X": 3, "Y": 4, "Z": 1 }, "uv": { "X": 24, "Y": 0 }, "mirror": true } + ] + }, + { + "name": "rightWing", + "boxes": [ + { "pos": { "X": -12, "Y": 1, "Z": 1.5 }, "size": { "X": 10, "Y": 16, "Z": 1 }, "uv": { "X": 42, "Y": 0 } } + ] + }, + { + "name": "rightWingTip", + "translation": { "X": -12, "Y": 1, "Z": 1.5 }, + "boxes": [ + { "pos": { "X": -8, "Y": 1, "Z": 0 }, "size": { "X": 8, "Y": 12, "Z": 1 }, "uv": { "X": 24, "Y": 16 } } + ] + }, + { + "name": "leftWing", + + "boxes": [ + { "pos": { "X": 2, "Y": 1, "Z": 1.5 }, "size": { "X": 10, "Y": 16, "Z": 1 }, "uv": { "X": 42, "Y": 0 }, "mirror": true } + ] + }, + { + "name": "leftWingTip", + "translation": { "X": 12, "Y": 1, "Z": 1.5 }, + "boxes": [ + { "pos": { "X": 0, "Y": 1, "Z": 0 }, "size": { "X": 8, "Y": 12, "Z": 1 }, "uv": { "X": 24, "Y": 16 }, "mirror": true } + ] + } + ] + }, + "trident": { + "textureSize": { "X": 32, "Y": 32 }, + "parts": [ + { + "name": "pole", + "boxes": [ + { "pos": { "X": -0.5, "Y": -4, "Z": -0.5 }, "size": { "X": 1, "Y": 31, "Z": 1 }, "uv": { "X": 0, "Y": 0 } }, + { "pos": { "X": -1.5, "Y": 0, "Z": -0.5 }, "size": { "X": 3, "Y": 2, "Z": 1 }, "uv": { "X": 4, "Y": 0 } }, + { "pos": { "X": -2.5, "Y": -3, "Z": -0.5 }, "size": { "X": 1, "Y": 4, "Z": 1 }, "uv": { "X": 4, "Y": 3 } }, + { "pos": { "X": 1.5, "Y": -3, "Z": -0.5 }, "size": { "X": 1, "Y": 4, "Z": 1 }, "uv": { "X": 4, "Y": 3 }, "mirror": true } + ] + } + ] + }, + "irongolem": { + "textureSize": { "X": 128, "Y": 128 }, + "parts": [ + { + "name": "head", + "translation": { "X": 0, "Y": 0, "Z": -2 }, + "boxes": [ + { "pos": { "X": -4, "Y": -12, "Z": -5.5 }, "size": { "X": 8, "Y": 10, "Z": 8 }, "uv": { "X": 0, "Y": 0 } }, + { "pos": { "X": -1, "Y": -5, "Z": -7.5 }, "size": { "X": 2, "Y": 4, "Z": 2 }, "uv": { "X": 24, "Y": 0 } } + ] + }, + { + "name": "body", + "boxes": [ + { "pos": { "X": -9, "Y": -2, "Z": -6 }, "size": { "X": 18, "Y": 12, "Z": 11 }, "uv": { "X": 0, "Y": 40 } }, + { "pos": { "X": -4.5, "Y": 10, "Z": -3 }, "size": { "X": 9, "Y": 5, "Z": 6 }, "uv": { "X": 0, "Y": 70 }, "inflate": 0.5 } + ] + }, + { + "name": "arm0", + "translation": { "X": 0, "Y": 0, "Z": 0 }, + "boxes": [ + { "pos": { "X": -13, "Y": -2.5, "Z": -3 }, "size": { "X": 4, "Y": 30, "Z": 6 }, "uv": { "X": 60, "Y": 58 } } + ] + }, + { + "name": "arm1", + "translation": { "X": 0, "Y": 0, "Z": 0 }, + "boxes": [ + { "pos": { "X": 9, "Y": -2.5, "Z": -3 }, "size": { "X": 4, "Y": 30, "Z": 6 }, "uv": { "X": 60, "Y": 21 } } + ] + }, + { + "name": "leg0", + "translation": { "X": -4, "Y": 18, "Z": 0 }, + "boxes": [ + { "pos": { "X": -3.5, "Y": -3, "Z": -3 }, "size": { "X": 6, "Y": 16, "Z": 5 }, "uv": { "X": 37, "Y": 0 } } + ] + }, + { + "name": "leg1", + "translation": { "X": 5, "Y": 18, "Z": 0 }, + "boxes": [ + { "pos": { "X": -3.5, "Y": -3, "Z": -3 }, "size": { "X": 6, "Y": 16, "Z": 5 }, "uv": { "X": 60, "Y": 0 }, "mirror": true } + ] + } + ] + }, + "dolphin": { + "textureSize": { "X": 64, "Y": 64 }, + "parts": [ + { + "name": "head", + "boxes": [ + { "pos": { "X": -4, "Y": -7, "Z": -6 }, "size": { "X": 8, "Y": 7, "Z": 6 }, "uv": { "X": 0, "Y": 0 } } + ] + }, + { + "name": "nose", + "translation": { "X": 0, "Y": 0, "Z": -10 }, + "boxes": [ + { "pos": { "X": -1, "Y": -2, "Z": 0 }, "size": { "X": 2, "Y": 2, "Z": 4 }, "uv": { "X": 0, "Y": 13 } } + ] + }, + { + "name": "body", + "translation": { "X": 0, "Y": 0, "Z": 0 }, + "rotation": { "X": 0, "Y": 0, "Z": 0 }, + "boxes": [ + { "pos": { "X": -4, "Y": -7, "Z": 0 }, "size": { "X": 8, "Y": 7, "Z": 13 }, "uv": { "X": 0, "Y": 13 } } + ] + }, + { + "name": "back_fin", + "translation": { "X": 0, "Y": -7, "Z": 7 }, + "boxes": [ + { "pos": { "X": -0.5, "Y": -5, "Z": -1 }, "size": { "X": 1, "Y": 5, "Z": 4 }, "uv": { "X": 29, "Y": 0 } } + ] + }, + { + "name": "left_fin", + "translation": { "X": 3, "Y": -1, "Z": 2 }, + "boxes": [ + { "pos": { "X": 0, "Y": -1, "Z": -1 }, "size": { "X": 8, "Y": 1, "Z": 4 }, "uv": { "X": 40, "Y": 0 } } + ] + }, + { + "name": "right_fin", + "translation": { "X": -3, "Y": -1, "Z": 2 }, + "boxes": [ + { "pos": { "X": -8, "Y": -1, "Z": -1 }, "size": { "X": 8, "Y": 1, "Z": 4 }, "uv": { "X": 40, "Y": 6 } } + ] + }, + { + "name": "tail", + "translation": { "X": 0, "Y": -2.5, "Z": 14 }, + "boxes": [ + { "pos": { "X": -2, "Y": -2.5, "Z": -1 }, "size": { "X": 4, "Y": 5, "Z": 11 }, "uv": { "X": 0, "Y": 33 } } + ] + }, + { + "name": "tail_fin", + "translation": { "X": 0, "Y": 0, "Z": 24 }, + "boxes": [ + { "pos": { "X": -5, "Y": -2.5, "Z": -1 }, "size": { "X": 10, "Y": 1, "Z": 6 }, "uv": { "X": 0, "Y": 49 } } + ] + } + ] + }, + "creeper_head": { + "textureSize": { "X": 64, "Y": 32 }, + "parts": [ + { + "name": "head", + "boxes": [ + { "pos": { "X": -4, "Y": -8, "Z": -4 }, "size": { "X": 8, "Y": 8, "Z": 8 }, "uv": { "X": 0, "Y": 0 } } + ] + } + ] + }, + "creeper": { + "textureSize": { "X": 64, "Y": 32 }, + "parts": [ + { + "name": "head", + "translation": { "X": 0, "Y": 6, "Z": 0 }, + "boxes": [ + { "pos": { "X": -4, "Y": -8, "Z": -4 }, "size": { "X": 8, "Y": 8, "Z": 8 }, "uv": { "X": 0, "Y": 0 } } + ] + }, + { + "name": "body", + "translation": { "X": 0, "Y": 6, "Z": 0 }, + "boxes": [ + { "pos": { "X": -4, "Y": 0, "Z": -2 }, "size": { "X": 8, "Y": 12, "Z": 4 }, "uv": { "X": 16, "Y": 16 } } + ] + }, + { + "name": "leg0", + "translation": { "X": -2, "Y": 18, "Z": 4 }, + "boxes": [ + { "pos": { "X": -2, "Y": 0, "Z": -2 }, "size": { "X": 4, "Y": 6, "Z": 4 }, "uv": { "X": 0, "Y": 16 } } + ] + }, + { + "name": "leg1", + "translation": { "X": 2, "Y": 18, "Z": 4 }, + "boxes": [ + { "pos": { "X": -2, "Y": 0, "Z": -2 }, "size": { "X": 4, "Y": 6, "Z": 4 }, "uv": { "X": 0, "Y": 16 } } + ] + }, + { + "name": "leg2", + "translation": { "X": -2, "Y": 18, "Z": -4 }, + "boxes": [ + { "pos": { "X": -2, "Y": 0, "Z": -2 }, "size": { "X": 4, "Y": 6, "Z": 4 }, "uv": { "X": 0, "Y": 16 } } + ] + }, + { + "name": "leg3", + "translation": { "X": 2, "Y": 18, "Z": -4 }, + "boxes": [ + { "pos": { "X": -2, "Y": 0, "Z": -2 }, "size": { "X": 4, "Y": 6, "Z": 4 }, "uv": { "X": 0, "Y": 16 } } + ] + } + ] + }, + "boat": { + "textureSize": { "X": 128, "Y": 64 }, + "parts": [ + { + "name": "bottom", + "translation": { "X": 0, "Y": 3, "Z": 1 }, + "rotation": { "X": 90, "Y": 0, "Z": 0 }, + "boxes": [ + { "pos": { "X": -14, "Y": -9, "Z": -3 }, "size": { "X": 28, "Y": 16, "Z": 3 }, "uv": { "X": 0, "Y": 0 } } + ] + }, + { + "name": "front", + "translation": { "X": 15, "Y": 4, "Z": 0 }, + "rotation": { "X": 0, "Y": 90, "Z": 0 }, + "boxes": [ + { "pos": { "X": -8, "Y": -7, "Z": -1 }, "size": { "X": 16, "Y": 6, "Z": 2 }, "uv": { "X": 0, "Y": 27 } } + ] + }, + { + "name": "back", + "translation": { "X": -15, "Y": 4, "Z": 4 }, + "rotation": { "X": 0, "Y": 270, "Z": 0 }, + "boxes": [ + { "pos": { "X": -13, "Y": -7, "Z": -1 }, "size": { "X": 18, "Y": 6, "Z": 2 }, "uv": { "X": 0, "Y": 19 } } + ] + }, + { + "name": "left", + "translation": { "X": 0, "Y": 4, "Z": 9 }, + "boxes": [ + { "pos": { "X": -14, "Y": -7, "Z": -1 }, "size": { "X": 28, "Y": 6, "Z": 2 }, "uv": { "X": 0, "Y": 43 } } + ] + }, + { + "name": "right", + "translation": { "X": 0, "Y": 4, "Z": -9 }, + "rotation": { "X": 0, "Y": 180, "Z": 0 }, + "boxes": [ + { "pos": { "X": -14, "Y": -7, "Z": -1 }, "size": { "X": 28, "Y": 6, "Z": 2 }, "uv": { "X": 0, "Y": 35 } } + ] + }, + { + "name": "paddle_left", + "translation": { "X": 3, "Y": -5, "Z": 9 }, + "rotation": { "X": 0, "Y": 0, "Z": 11.25 }, + "boxes": [ + { "pos": { "X": -1, "Y": 0, "Z": -5 }, "size": { "X": 2, "Y": 2, "Z": 18 }, "uv": { "X": 62, "Y": 0 } }, + { "pos": { "X": -1.001, "Y": -3, "Z": 8 }, "size": { "X": 1, "Y": 6, "Z": 7 }, "uv": { "X": 62, "Y": 0 } } + ] + }, + { + "name": "paddle_right", + "translation": { "X": 3, "Y": -5, "Z": -9 }, + "rotation": { "X": 0, "Y": 180, "Z": 11.25 }, + "boxes": [ + { "pos": { "X": -1, "Y": 0, "Z": -5 }, "size": { "X": 2, "Y": 2, "Z": 18 }, "uv": { "X": 62, "Y": 20 } }, + { "pos": { "X": 0.001, "Y": -3, "Z": 8 }, "size": { "X": 1, "Y": 6, "Z": 7 }, "uv": { "X": 62, "Y": 20 } } + ] + } + ] + } +} \ No newline at end of file diff --git a/PCK-Studio/Resources/model/modelMetaData.json b/PCK-Studio/Resources/model/modelMetaData.json index a291c6fe..9be05f36 100644 --- a/PCK-Studio/Resources/model/modelMetaData.json +++ b/PCK-Studio/Resources/model/modelMetaData.json @@ -35,7 +35,7 @@ "textureLocations": [ "res/item/bed" ], - "uv_offsets": [ {"X": 0, "Y": 64} ], + "uv_offsets": [ {"X": 0, "Y": 64} ] }, "blaze": { "textureLocations": [ @@ -711,7 +711,7 @@ "res/mob/zombie_villager/professions/shepherd", "res/mob/zombie_villager/professions/stonemason", "res/mob/zombie_villager/professions/toolsmith", - "res/mob/zombie_villager/professions/weaponsmith", + "res/mob/zombie_villager/professions/weaponsmith" ] }, "pillager": {