[ue4] Cleaned up base example. More to come. Fixed crash bug in material reevaluation in renderer component

This commit is contained in:
badlogic 2016-12-15 14:15:16 +01:00
parent 7b27ecda89
commit b8e94a84a9
17 changed files with 4 additions and 70 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,26 +0,0 @@
skeleton.png
size: 275,302
format: RGBA8888
filter: Linear,Linear
repeat: none
head
rotate: false
xy: 2, 2
size: 271, 298
orig: 271, 298
offset: 0, 0
index: -1
skeleton2.png
size: 496,156
format: RGBA8888
filter: Linear,Linear
repeat: none
hoverboard_board
rotate: false
xy: 2, 2
size: 492, 152
orig: 492, 152
offset: 0, 0
index: -1

View File

@ -1,40 +0,0 @@
{
"skeleton": { "hash": "MTiZgk2LS7dpxtEZykSk3BMgpHM", "spine": "3.5.43", "width": 821.13, "height": 902.82, "images": "./images/" },
"bones": [
{ "name": "root" },
{ "name": "bone", "parent": "root", "x": -155.24, "y": 59.79 },
{ "name": "bone2", "parent": "root", "x": 231.1, "y": 40.28 },
{ "name": "bone3", "parent": "root", "x": 243.36, "y": -301.04 },
{ "name": "bone4", "parent": "root", "x": -170.12, "y": -308.37 },
{ "name": "bone5", "parent": "root", "x": -196.27, "y": -618.03 }
],
"slots": [
{ "name": "head", "bone": "bone", "attachment": "head" },
{ "name": "head2", "bone": "bone2", "attachment": "head", "blend": "additive" },
{ "name": "head3", "bone": "bone3", "attachment": "head", "blend": "screen" },
{ "name": "head4", "bone": "bone4", "attachment": "head", "blend": "multiply" },
{ "name": "hoverboard_board", "bone": "bone5", "attachment": "hoverboard_board" }
],
"skins": {
"default": {
"head": {
"head": { "width": 271, "height": 298 }
},
"head2": {
"head": { "y": 1.27, "width": 271, "height": 298 }
},
"head3": {
"head": { "width": 271, "height": 298 }
},
"head4": {
"head": { "y": -0.86, "width": 271, "height": 298 }
},
"hoverboard_board": {
"hoverboard_board": { "width": 492, "height": 152 }
}
}
},
"animations": {
"animation": {}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

View File

@ -118,7 +118,7 @@ void USpineSkeletonRendererComponent::TickComponent (float DeltaTime, ELevelTick
UTexture* oldTexture = nullptr;
UMaterialInstanceDynamic* current = atlasNormalBlendMaterials[i];
if(!current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
if(!current || !current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
UMaterialInstanceDynamic* material = UMaterialInstanceDynamic::Create(NormalBlendMaterial, owner);
material->SetTextureParameterValue(TextureParameterName, texture);
atlasNormalBlendMaterials[i] = material;
@ -126,7 +126,7 @@ void USpineSkeletonRendererComponent::TickComponent (float DeltaTime, ELevelTick
pageToNormalBlendMaterial.Add(currPage, atlasNormalBlendMaterials[i]);
current = atlasAdditiveBlendMaterials[i];
if(!current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
if(!current || !current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
UMaterialInstanceDynamic* material = UMaterialInstanceDynamic::Create(AdditiveBlendMaterial, owner);
material->SetTextureParameterValue(TextureParameterName, texture);
atlasAdditiveBlendMaterials[i] = material;
@ -134,7 +134,7 @@ void USpineSkeletonRendererComponent::TickComponent (float DeltaTime, ELevelTick
pageToAdditiveBlendMaterial.Add(currPage, atlasAdditiveBlendMaterials[i]);
current = atlasMultiplyBlendMaterials[i];
if(!current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
if(!current || !current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
UMaterialInstanceDynamic* material = UMaterialInstanceDynamic::Create(MultiplyBlendMaterial, owner);
material->SetTextureParameterValue(TextureParameterName, texture);
atlasMultiplyBlendMaterials[i] = material;
@ -142,7 +142,7 @@ void USpineSkeletonRendererComponent::TickComponent (float DeltaTime, ELevelTick
pageToMultiplyBlendMaterial.Add(currPage, atlasMultiplyBlendMaterials[i]);
current = atlasScreenBlendMaterials[i];
if(!current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
if(!current || !current->GetTextureParameterValue(TextureParameterName, oldTexture) || oldTexture != texture) {
UMaterialInstanceDynamic* material = UMaterialInstanceDynamic::Create(ScreenBlendMaterial, owner);
material->SetTextureParameterValue(TextureParameterName, texture);
atlasScreenBlendMaterials[i] = material;