Merge branch 'main' into splashpack

This commit is contained in:
aliaksei.kalosha
2025-04-01 20:37:50 +02:00
10 changed files with 778 additions and 40 deletions

View File

@@ -3,15 +3,15 @@ using UnityEngine;
namespace SplashEdit.RuntimeCode
{
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(Renderer))]
public class PSXObjectExporter : MonoBehaviour
{
public PSXBPP BitDepth = PSXBPP.TEX_8BIT; // Defines the bit depth of the texture (e.g., 4BPP, 8BPP)
[HideInInspector]
public List<PSXTexture2D> Textures = new List<PSXTexture2D>(); // Stores the converted PlayStation-style texture
public List<PSXTexture2D> Textures { get; set; } = new List<PSXTexture2D>(); // Stores the converted PlayStation-style texture
public PSXMesh Mesh { get; set; } // Stores the converted PlayStation-style mesh
[HideInInspector]
public PSXMesh Mesh; // Stores the converted PlayStation-style mesh
public bool PreviewNormals = false;
public float normalPreviewLength = 0.5f; // Length of the normal lines
@@ -84,6 +84,17 @@ namespace SplashEdit.RuntimeCode
}
}
}
else
{
//TODO: Better handle object with default texture
Texture = new PSXTexture2D()
{
BitDepth = BitDepth,
Width = 0,
Height = 0,
};
Texture.OriginalTexture = null;
}
}
private Texture2D ConvertToTexture2D(Texture texture)
@@ -112,6 +123,11 @@ namespace SplashEdit.RuntimeCode
{
Mesh = PSXMesh.CreateFromUnityRenderer(renderer, GTEScaling, transform, Textures);
}
else
{
// Dynamic meshes do not consider object transformation
Mesh = PSXMesh.CreateFromUnityMesh(meshFilter.sharedMesh, Texture.Width, Texture.Height);
}
}
}
}