Эх сурвалжийг харах

[ue4] Using packed vertex format, implemented two color tint in test material.

badlogic 8 жил өмнө
parent
commit
8ae6f56294

BIN
spine-ue4/Content/Test/Assets/TestMaterial.uasset


BIN
spine-ue4/Content/Test/Test.umap


+ 3 - 1
spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Private/RuntimeMeshGenericVertex.cpp

@@ -7,6 +7,7 @@
 // Finish all the built in vertex types.
 // Finish all the built in vertex types.
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexSimple);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexSimple);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexDualUV);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexDualUV);
+DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexTripleUV);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexNoPosition);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexNoPosition);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexNoPositionDualUV);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexNoPositionDualUV);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexHiPrecisionNormals);
 DEFINE_RUNTIME_MESH_VERTEX(FRuntimeMeshVertexHiPrecisionNormals);
@@ -21,7 +22,8 @@ const FRuntimeMeshVertexTypeInfo* FRuntimeMeshComponentVerticesBuilder::GetVerte
 {
 {
 	if (HasUVComponent(1))
 	if (HasUVComponent(1))
 	{
 	{
-		return &FRuntimeMeshVertexDualUV::TypeInfo;
+		if (HasUVComponent(2)) return &FRuntimeMeshVertexTripleUV::TypeInfo;
+		else return &FRuntimeMeshVertexDualUV::TypeInfo;
 	}
 	}
 	else
 	else
 	{
 	{

+ 3 - 0
spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Public/RuntimeMeshGenericVertex.h

@@ -1249,6 +1249,9 @@ DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexSimple, true, true, true,
 /** Simple vertex with 2 UV channels */
 /** Simple vertex with 2 UV channels */
 DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexDualUV, true, true, true, true, 2, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
 DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexDualUV, true, true, true, true, 2, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
 
 
+/** Simple vertex with 3 UV channels */
+DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexTripleUV, true, true, true, true, 3, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
+
 /** Simple vertex with 1 UV channel and NO position component (Meant to be used with separate position buffer) */
 /** Simple vertex with 1 UV channel and NO position component (Meant to be used with separate position buffer) */
 DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexNoPosition, false, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
 DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexNoPosition, false, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
 
 

+ 7 - 7
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp

@@ -169,19 +169,19 @@ void USpineSkeletonRendererComponent::TickComponent (float DeltaTime, ELevelTick
 	}
 	}
 }
 }
 
 
+
 void USpineSkeletonRendererComponent::Flush (int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, TArray<FVector>& Colors2, UMaterialInstanceDynamic* Material) {
 void USpineSkeletonRendererComponent::Flush (int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, TArray<FVector>& Colors2, UMaterialInstanceDynamic* Material) {
 	if (Vertices.Num() == 0) return;
 	if (Vertices.Num() == 0) return;
 	SetMaterial(Idx, Material);
 	SetMaterial(Idx, Material);
-	TArray<FVector2D> darkRG;
-	TArray<FVector2D> darkB;
 
 
-	for (int32 i = 0; i < Colors2.Num(); i++) {
-		FVector darkColor = Colors2[i];
-		darkRG.Add(FVector2D(darkColor.X, darkColor.Y));
-		darkB.Add(FVector2D(darkColor.Z, 0));
+	TArray<FRuntimeMeshVertexTripleUV> verts;
+	for (int32 i = 0; i < Vertices.Num(); i++) {
+		verts.Add(FRuntimeMeshVertexTripleUV(Vertices[i], FVector(), FVector(), Colors[i], Uvs[i], FVector2D(Colors2[i].X, Colors2[i].Y), FVector2D(Colors2[i].Z, 0)));
 	}
 	}
 
 
-	CreateMeshSection(Idx, Vertices, Indices, TArray<FVector>(), Uvs, darkRG, Colors, TArray<FRuntimeMeshTangent>(), false);
+	CreateMeshSection(Idx, verts, Indices);
+
+	// CreateMeshSection(Idx, Vertices, Indices, TArray<FVector>(), Uvs, darkRG, Colors, TArray<FRuntimeMeshTangent>(), false);
 	Vertices.SetNum(0);
 	Vertices.SetNum(0);
 	Indices.SetNum(0);
 	Indices.SetNum(0);
 	Uvs.SetNum(0);
 	Uvs.SetNum(0);