mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ue4] render component actually only renders first sub section. Bug in procedural mesh component?
This commit is contained in:
parent
277920b7fa
commit
74850f67a3
Binary file not shown.
BIN
spine-ue4/Content/Test/Textures/skeleton.uasset
Normal file
BIN
spine-ue4/Content/Test/Textures/skeleton.uasset
Normal file
Binary file not shown.
BIN
spine-ue4/Content/Test/Textures/skeleton2.uasset
Normal file
BIN
spine-ue4/Content/Test/Textures/skeleton2.uasset
Normal file
Binary file not shown.
BIN
spine-ue4/Content/Test/skeleton.uasset
Normal file
BIN
spine-ue4/Content/Test/skeleton.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -163,7 +163,25 @@ void USpineSkeletonRendererComponent::UpdateMesh(spSkeleton* Skeleton) {
|
|||||||
if (attachment->type == SP_ATTACHMENT_REGION) {
|
if (attachment->type == SP_ATTACHMENT_REGION) {
|
||||||
spRegionAttachment* regionAttachment = (spRegionAttachment*)attachment;
|
spRegionAttachment* regionAttachment = (spRegionAttachment*)attachment;
|
||||||
spAtlasRegion* region = (spAtlasRegion*)regionAttachment->rendererObject;
|
spAtlasRegion* region = (spAtlasRegion*)regionAttachment->rendererObject;
|
||||||
UMaterialInstanceDynamic* material = pageToNormalBlendMaterial[region->page];
|
|
||||||
|
UMaterialInstanceDynamic* material = nullptr;
|
||||||
|
|
||||||
|
switch(slot->data->blendMode) {
|
||||||
|
case SP_BLEND_MODE_NORMAL:
|
||||||
|
material = pageToNormalBlendMaterial[region->page];
|
||||||
|
break;
|
||||||
|
/*case SP_BLEND_MODE_ADDITIVE:
|
||||||
|
material = pageToAdditiveBlendMaterial[region->page];
|
||||||
|
break;
|
||||||
|
case SP_BLEND_MODE_MULTIPLY:
|
||||||
|
material = pageToMultiplyBlendMaterial[region->page];
|
||||||
|
break;
|
||||||
|
case SP_BLEND_MODE_SCREEN:
|
||||||
|
material = pageToScreenBlendMaterial[region->page];
|
||||||
|
break;*/
|
||||||
|
default:
|
||||||
|
material = pageToNormalBlendMaterial[region->page];
|
||||||
|
}
|
||||||
|
|
||||||
if (lastMaterial != material) {
|
if (lastMaterial != material) {
|
||||||
Flush(meshSection, vertices, indices, uvs, colors, lastMaterial);
|
Flush(meshSection, vertices, indices, uvs, colors, lastMaterial);
|
||||||
@ -201,8 +219,6 @@ void USpineSkeletonRendererComponent::UpdateMesh(spSkeleton* Skeleton) {
|
|||||||
indices.Add(idx + 3);
|
indices.Add(idx + 3);
|
||||||
idx += 4;
|
idx += 4;
|
||||||
depthOffset += this->DepthOffset;
|
depthOffset += this->DepthOffset;
|
||||||
|
|
||||||
SetMaterial(meshSection, material);
|
|
||||||
} else if (attachment->type == SP_ATTACHMENT_MESH) {
|
} else if (attachment->type == SP_ATTACHMENT_MESH) {
|
||||||
spMeshAttachment* mesh = (spMeshAttachment*)attachment;
|
spMeshAttachment* mesh = (spMeshAttachment*)attachment;
|
||||||
spAtlasRegion* region = (spAtlasRegion*)mesh->rendererObject;
|
spAtlasRegion* region = (spAtlasRegion*)mesh->rendererObject;
|
||||||
|
|||||||
@ -42,15 +42,20 @@ protected:
|
|||||||
|
|
||||||
void Flush (int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, UMaterialInstanceDynamic* Material);
|
void Flush (int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, UMaterialInstanceDynamic* Material);
|
||||||
|
|
||||||
|
// Need to hold on to the dynamic instances, or the GC will kill us while updating them
|
||||||
|
UPROPERTY()
|
||||||
TArray<UMaterialInstanceDynamic*> atlasNormalBlendMaterials;
|
TArray<UMaterialInstanceDynamic*> atlasNormalBlendMaterials;
|
||||||
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToNormalBlendMaterial;
|
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToNormalBlendMaterial;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
TArray<UMaterialInstanceDynamic*> atlasAdditiveBlendMaterials;
|
TArray<UMaterialInstanceDynamic*> atlasAdditiveBlendMaterials;
|
||||||
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToAdditiveBlendMaterial;
|
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToAdditiveBlendMaterial;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
TArray<UMaterialInstanceDynamic*> atlasMultiplyBlendMaterials;
|
TArray<UMaterialInstanceDynamic*> atlasMultiplyBlendMaterials;
|
||||||
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToMultiplyBlendMaterial;
|
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToMultiplyBlendMaterial;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
TArray<UMaterialInstanceDynamic*> atlasScreenBlendMaterials;
|
TArray<UMaterialInstanceDynamic*> atlasScreenBlendMaterials;
|
||||||
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToScreenBlendMaterial;
|
TMap<spAtlasPage*, UMaterialInstanceDynamic*> pageToScreenBlendMaterial;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user