diff --git a/spine-ue4/Config/DefaultEngine.ini b/spine-ue4/Config/DefaultEngine.ini index 6c63e6306..a919619a9 100644 --- a/spine-ue4/Config/DefaultEngine.ini +++ b/spine-ue4/Config/DefaultEngine.ini @@ -58,4 +58,3 @@ SyncSceneSmoothingFactor=0.000000 InitialAverageFrameRate=0.016667 PhysXTreeRebuildRate=10 DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2) - diff --git a/spine-ue4/Content/Test/NewWorld.umap b/spine-ue4/Content/Test/NewWorld.umap index 051798ef7..2fb03bd29 100644 Binary files a/spine-ue4/Content/Test/NewWorld.umap and b/spine-ue4/Content/Test/NewWorld.umap differ diff --git a/spine-ue4/Plugins/SpinePlugin/Content/SpineLitNormalMaterial.uasset b/spine-ue4/Plugins/SpinePlugin/Content/SpineLitNormalMaterial.uasset new file mode 100644 index 000000000..b0a92fc20 Binary files /dev/null and b/spine-ue4/Plugins/SpinePlugin/Content/SpineLitNormalMaterial.uasset differ diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp index 8352b94ad..2df45a985 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp @@ -170,14 +170,15 @@ void USpineSkeletonRendererComponent::UpdateRenderer(USpineSkeletonComponent* sk } } -void USpineSkeletonRendererComponent::Flush (int &Idx, TArray &Vertices, TArray &Indices, TArray &Uvs, TArray &Colors, TArray& Colors2, UMaterialInstanceDynamic* Material) { +void USpineSkeletonRendererComponent::Flush (int &Idx, TArray &Vertices, TArray &Indices, TArray &Normals, TArray &Uvs, TArray &Colors, TArray& Colors2, UMaterialInstanceDynamic* Material) { if (Vertices.Num() == 0) return; SetMaterial(Idx, Material); - CreateMeshSection(Idx, Vertices, Indices, TArray(), Uvs, Colors, TArray(), bCreateCollision); + CreateMeshSection(Idx, Vertices, Indices, Normals, Uvs, Colors, TArray(), bCreateCollision); Vertices.SetNum(0); Indices.SetNum(0); + Normals.SetNum(0); Uvs.SetNum(0); Colors.SetNum(0); Colors2.SetNum(0); @@ -187,6 +188,7 @@ void USpineSkeletonRendererComponent::Flush (int &Idx, TArray &Vertices void USpineSkeletonRendererComponent::UpdateMesh(Skeleton* Skeleton) { TArray vertices; TArray indices; + TArray normals; TArray uvs; TArray colors; TArray darkColors; @@ -299,7 +301,7 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton* Skeleton) { } if (lastMaterial != material) { - Flush(meshSection, vertices, indices, uvs, colors, darkColors, lastMaterial); + Flush(meshSection, vertices, indices, normals, uvs, colors, darkColors, lastMaterial); lastMaterial = material; idx = 0; } @@ -319,6 +321,7 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton* Skeleton) { colors.Add(FColor(r, g, b, a)); darkColors.Add(FVector(dr, dg, db)); vertices.Add(FVector(attachmentVertices[j], depthOffset, attachmentVertices[j + 1])); + normals.Add(FVector(0, -1, 0)); uvs.Add(FVector2D(attachmentUvs[j], attachmentUvs[j + 1])); } @@ -332,7 +335,7 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton* Skeleton) { clipper.clipEnd(*slot); } - Flush(meshSection, vertices, indices, uvs, colors, darkColors, lastMaterial); + Flush(meshSection, vertices, indices, normals, uvs, colors, darkColors, lastMaterial); clipper.clipEnd(); } diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonRendererComponent.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonRendererComponent.h index 10dd578ab..aaf5d921a 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonRendererComponent.h +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonRendererComponent.h @@ -97,7 +97,7 @@ public: protected: void UpdateMesh (spine::Skeleton* Skeleton); - void Flush (int &Idx, TArray &Vertices, TArray &Indices, TArray &Uvs, TArray &Colors, TArray &Colors2, UMaterialInstanceDynamic* Material); + void Flush (int &Idx, TArray &Vertices, TArray &Indices, TArray &Normals, TArray &Uvs, TArray &Colors, TArray &Colors2, UMaterialInstanceDynamic* Material); spine::Vector worldVertices; spine::SkeletonClipping clipper;