mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-26 03:31:24 +08:00
[unity] Minor interface consistency fixes.
This commit is contained in:
parent
0b74269207
commit
369cda4335
@ -42,7 +42,14 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
readonly ExposedList<SubmeshTriangleBuffer> submeshBuffers = new ExposedList<SubmeshTriangleBuffer>();
|
readonly ExposedList<SubmeshTriangleBuffer> submeshBuffers = new ExposedList<SubmeshTriangleBuffer>();
|
||||||
Material[] sharedMaterials = new Material[0];
|
Material[] sharedMaterials = new Material[0];
|
||||||
|
|
||||||
public MeshAndMaterials GenerateMesh (ExposedList<SubmeshInstruction> instructions, int startSubmesh, int endSubmesh) {
|
/// <summary>
|
||||||
|
/// Generates a mesh based on a subset of instructions.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A UnityEngine.Mesh.</returns>
|
||||||
|
/// <param name="instructions">A list of SubmeshInstructions.</param>
|
||||||
|
/// <param name="startSubmesh">The index of the starting submesh.</param>
|
||||||
|
/// <param name="endSubmesh">The exclusive upper bound of the last submesh to be included.</param>
|
||||||
|
public MeshAndMaterials GenerateMesh (ExposedList<SubmeshInstruction> instructions, int startSubmesh, int endSubmesh, float scale = 1f) {
|
||||||
// STEP 0: Prepare instructions.
|
// STEP 0: Prepare instructions.
|
||||||
var paramItems = instructions.Items;
|
var paramItems = instructions.Items;
|
||||||
currentInstructions.Clear(false);
|
currentInstructions.Clear(false);
|
||||||
@ -122,6 +129,15 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
this.sharedMaterials = currentInstructions.GetUpdatedMaterialArray(this.sharedMaterials);
|
this.sharedMaterials = currentInstructions.GetUpdatedMaterialArray(this.sharedMaterials);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scale != 1f) {
|
||||||
|
for (int i = 0; i < vertexCount; i++) {
|
||||||
|
meshVertices[i].x *= scale;
|
||||||
|
meshVertices[i].y *= scale;
|
||||||
|
//meshVertices[i].z *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// STEP 3: Assign the buffers into the Mesh.
|
// STEP 3: Assign the buffers into the Mesh.
|
||||||
smartMesh.Set(this.meshVertices, this.meshUVs, this.meshColors32, workingAttachments, currentInstructions);
|
smartMesh.Set(this.meshVertices, this.meshUVs, this.meshColors32, workingAttachments, currentInstructions);
|
||||||
mesh.bounds = ArraysMeshGenerator.ToBounds(meshBoundsMin, meshBoundsMax);
|
mesh.bounds = ArraysMeshGenerator.ToBounds(meshBoundsMin, meshBoundsMax);
|
||||||
|
|||||||
@ -41,6 +41,7 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
public List<Slot> Separators { get { return this.separators; } }
|
public List<Slot> Separators { get { return this.separators; } }
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
|
// ArraysMeshGenerator.PremultiplyAlpha
|
||||||
public float ZSpacing { get; set; }
|
public float ZSpacing { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,7 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
List<Slot> Separators { get; }
|
List<Slot> Separators { get; }
|
||||||
|
|
||||||
float ZSpacing { get; set; }
|
float ZSpacing { get; set; }
|
||||||
|
bool PremultiplyVertexColors { get; set; }
|
||||||
bool AddNormals { get; set; }
|
bool AddNormals { get; set; }
|
||||||
bool AddTangents { get; set; }
|
bool AddTangents { get; set; }
|
||||||
}
|
}
|
||||||
@ -55,7 +56,7 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
// Step 3: Call GenerateMesh. You'll get a Mesh and Materials.
|
// Step 3: Call GenerateMesh. You'll get a Mesh and Materials.
|
||||||
// Step 4: Put the Mesh in MeshFilter. Put the Materials in MeshRenderer.sharedMaterials.
|
// Step 4: Put the Mesh in MeshFilter. Put the Materials in MeshRenderer.sharedMaterials.
|
||||||
public interface ISubmeshSetMeshGenerator {
|
public interface ISubmeshSetMeshGenerator {
|
||||||
MeshAndMaterials GenerateMesh (ExposedList<SubmeshInstruction> instructions, int startSubmesh, int endSubmesh);
|
MeshAndMaterials GenerateMesh (ExposedList<SubmeshInstruction> instructions, int startSubmesh, int endSubmesh, float scale = 1f);
|
||||||
|
|
||||||
float ZSpacing { get; set; }
|
float ZSpacing { get; set; }
|
||||||
bool PremultiplyVertexColors { get; set; }
|
bool PremultiplyVertexColors { get; set; }
|
||||||
|
|||||||
@ -163,11 +163,11 @@ namespace Spine.Unity {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update () {
|
public void Update () {
|
||||||
Update(Time.deltaTime);
|
Update(Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update (float deltaTime) {
|
public void Update (float deltaTime) {
|
||||||
if (!valid)
|
if (!valid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ namespace Spine.Unity {
|
|||||||
animationTable.Add(a.Name.GetHashCode(), a);
|
animationTable.Add(a.Name.GetHashCode(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update () {
|
public void Update () {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
if (layerMixModes.Length < animator.layerCount)
|
if (layerMixModes.Length < animator.layerCount)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user