mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[ue4] SpineSkeletonRendererComponent explicitely generates normals now. Added SpineLitNormalMaterial, a masked material for use with UE4s lighting.
This commit is contained in:
parent
a28eafaac1
commit
f6f3ed9542
@ -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)
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -170,14 +170,15 @@ void USpineSkeletonRendererComponent::UpdateRenderer(USpineSkeletonComponent* sk
|
||||
}
|
||||
}
|
||||
|
||||
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<FVector> &Normals, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, TArray<FVector>& Colors2, UMaterialInstanceDynamic* Material) {
|
||||
if (Vertices.Num() == 0) return;
|
||||
SetMaterial(Idx, Material);
|
||||
|
||||
CreateMeshSection(Idx, Vertices, Indices, TArray<FVector>(), Uvs, Colors, TArray<FProcMeshTangent>(), bCreateCollision);
|
||||
CreateMeshSection(Idx, Vertices, Indices, Normals, Uvs, Colors, TArray<FProcMeshTangent>(), 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<FVector> &Vertices
|
||||
void USpineSkeletonRendererComponent::UpdateMesh(Skeleton* Skeleton) {
|
||||
TArray<FVector> vertices;
|
||||
TArray<int32> indices;
|
||||
TArray<FVector> normals;
|
||||
TArray<FVector2D> uvs;
|
||||
TArray<FColor> colors;
|
||||
TArray<FVector> 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();
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
protected:
|
||||
void UpdateMesh (spine::Skeleton* Skeleton);
|
||||
|
||||
void Flush (int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, TArray<FVector> &Colors2, UMaterialInstanceDynamic* Material);
|
||||
void Flush (int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector> &Normals, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, TArray<FVector> &Colors2, UMaterialInstanceDynamic* Material);
|
||||
|
||||
spine::Vector<float> worldVertices;
|
||||
spine::SkeletonClipping clipper;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user