diff --git a/spine-c/spine-c/include/spine/dll.h b/spine-c/spine-c/include/spine/dll.h index 02714ca45..caae94198 100644 --- a/spine-c/spine-c/include/spine/dll.h +++ b/spine-c/spine-c/include/spine/dll.h @@ -1,48 +1,52 @@ /****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ #ifndef SPINE_SHAREDLIB_H #define SPINE_SHAREDLIB_H #ifdef _WIN32 - #define DLLIMPORT __declspec(dllimport) - #define DLLEXPORT __declspec(dllexport) +#define DLLIMPORT __declspec(dllimport) +#define DLLEXPORT __declspec(dllexport) #else - #define DLLIMPORT - #define DLLEXPORT +#ifndef DLLIMPORT +#define DLLIMPORT +#endif +#ifndef DLLEXPORT +#define DLLEXPORT +#endif #endif #ifdef SPINEPLUGIN_API - #define SP_API SPINEPLUGIN_API +#define SP_API SPINEPLUGIN_API #else - #define SP_API +#define SP_API #endif #endif /* SPINE_SHAREDLIB_H */ diff --git a/spine-c/spine-c/include/spine/extension.h b/spine-c/spine-c/include/spine/extension.h index b5a947eb1..da971f35c 100644 --- a/spine-c/spine-c/include/spine/extension.h +++ b/spine-c/spine-c/include/spine/extension.h @@ -61,6 +61,8 @@ #ifndef SPINE_EXTENSION_H_ #define SPINE_EXTENSION_H_ +#include + /* All allocation uses these. */ #define MALLOC(TYPE,COUNT) ((TYPE*)_spMalloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__)) #define CALLOC(TYPE,COUNT) ((TYPE*)_spCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__)) @@ -170,11 +172,11 @@ void* _spRealloc(void* ptr, size_t size); void _spFree (void* ptr); float _spRandom (); -void _spSetMalloc (void* (*_malloc) (size_t size)); -void _spSetDebugMalloc (void* (*_malloc) (size_t size, const char* file, int line)); -void _spSetRealloc(void* (*_realloc) (void* ptr, size_t size)); -void _spSetFree (void (*_free) (void* ptr)); -void _spSetRandom(float (*_random) ()); +SP_API void _spSetMalloc (void* (*_malloc) (size_t size)); +SP_API void _spSetDebugMalloc (void* (*_malloc) (size_t size, const char* file, int line)); +SP_API void _spSetRealloc(void* (*_realloc) (void* ptr, size_t size)); +SP_API void _spSetFree (void (*_free) (void* ptr)); +SP_API void _spSetRandom(float (*_random) ()); char* _spReadFile (const char* path, int* length); diff --git a/spine-starling/spine-starling-example/src/spine/examples/Shape.as b/spine-starling/spine-starling-example/src/spine/examples/Shape.as new file mode 100644 index 000000000..1bdef3c0d --- /dev/null +++ b/spine-starling/spine-starling-example/src/spine/examples/Shape.as @@ -0,0 +1,76 @@ +package spine.examples { + import starling.animation.IAnimatable; + import starling.textures.Texture; + import flash.display.BitmapData; + import flash.geom.Point; + import spine.starling.SkeletonMesh; + + import starling.display.DisplayObject; + import starling.rendering.IndexData; + import starling.rendering.Painter; + import starling.utils.Color; + + + public class Shape extends DisplayObject implements IAnimatable { + private var r: Number = 1, g: Number = 1, b: Number = 1, a: Number = 1; + private var mesh: SkeletonMesh; + private var vertices: Vector.; + + public function Shape() { + var bitmapData: BitmapData = new BitmapData(16, 16, false, 0xffffffff); + mesh = new SkeletonMesh(Texture.fromBitmapData(bitmapData)); + setVertices(new [0, 0, 100, 0, 100, 100, 0, 100]); + setColor(1, 0, 0, 1); + } + + public function setVertices(vertices: Vector.): void { + this.vertices = vertices; + } + + public function setColor(r: Number, g: Number, b: Number, a: Number): void { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + override public function render(painter : Painter) : void { + var indices: IndexData = mesh.getIndexData(); + var idx: int = 0; + var x:Number = vertices[0], y:Number = vertices[1]; + for (var i:int = 2; i < vertices.length - 2; i+=2) { + var x2:Number = vertices[i], y2:Number = vertices[i+1]; + var x3:Number = vertices[i+2], y3:Number = vertices[i+3]; + indices.setIndex(idx, idx); + indices.setIndex(idx+1, idx+1); + indices.setIndex(idx+2, idx+2); + mesh.setVertexPosition(idx, x, y); + mesh.setTexCoords(idx++, 0, 0); + mesh.setVertexPosition(idx, x2, y2); + mesh.setTexCoords(idx++, 0, 0); + mesh.setVertexPosition(idx, x3, y3); + mesh.setTexCoords(idx++, 0, 0); + } + indices.numIndices = idx; + indices.trim(); + mesh.getVertexData().numVertices = idx; + + var rgb: uint = Color.rgb(r * 255, g * 255, b * 255); + var alpha: uint = a * 255; + mesh.getVertexData().colorize("color", 0xffffffff, 0xff); + + mesh.setVertexDataChanged(); + mesh.setIndexDataChanged(); + + painter.batchMesh(mesh); + } + + public function advanceTime(time : Number) : void { + this.setRequiresRedraw(); + } + + override public function hitTest(localPoint : Point) : DisplayObject { + return null; + } + } +} \ No newline at end of file diff --git a/spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as b/spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as index dc2cbe8a4..189715f47 100644 --- a/spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as +++ b/spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as @@ -29,6 +29,10 @@ *****************************************************************************/ package spine.examples { + import starling.display.Image; + import starling.textures.Texture; + import flash.display.BitmapData; + import spine.attachments.BoundingBoxAttachment; import spine.*; import spine.animation.AnimationStateData; import spine.animation.TrackEntry; @@ -54,7 +58,8 @@ package spine.examples { [Embed(source = "/spineboy.png")] static public const SpineboyAtlasTexture : Class; - private var skeleton : SkeletonAnimation; + private var skeleton : SkeletonAnimation; + private var shape: Shape; public function SpineboyExample() { var spineAtlas : Atlas = new Atlas(new SpineboyAtlas(), new StarlingTextureLoader(new SpineboyAtlasTexture())); @@ -71,6 +76,7 @@ package spine.examples { skeleton = new SkeletonAnimation(skeletonData, stateData); skeleton.x = 400; skeleton.y = 560; + skeleton.scale = 0.5; skeleton.state.onStart.add(function(entry : TrackEntry) : void { trace(entry.trackIndex + " start: " + entry.animation.name); @@ -97,10 +103,29 @@ package spine.examples { skeleton.state.addAnimationByName(0, "run", true, 0); addChild(skeleton); - Starling.juggler.add(skeleton); + Starling.juggler.add(skeleton); + + shape = new Shape(); + shape.setVertices(new [0, 0, 400, 600, 800, 0]); + shape.setColor(1, 0, 0, 1); + addChild(shape); + Starling.juggler.add(shape); + addEventListener(starling.events.Event.ENTER_FRAME, onUpdate); addEventListener(TouchEvent.TOUCH, onClick); } + + private function onUpdate() : void { + var slot:Slot = skeleton.skeleton.findSlot("head-bb"); + var bb:BoundingBoxAttachment = skeleton.skeleton.getAttachmentForSlotIndex(slot.data.index, "head") as BoundingBoxAttachment; + var worldVertices:Vector. = new Vector.(bb.worldVerticesLength); + bb.computeWorldVertices(slot, 0, bb.worldVerticesLength, worldVertices, 0, 2); + for (var i:int = 0; i < worldVertices.length; i+=2) { + worldVertices[i] = worldVertices[i] * skeleton.scale + skeleton.x; + worldVertices[i + 1] = worldVertices[i + 1] * skeleton.scale + skeleton.y; + } + shape.setVertices(worldVertices); + } private function onClick(event : TouchEvent) : void { var touch : Touch = event.getTouch(this); diff --git a/spine-ue4/Config/DefaultEngine.ini b/spine-ue4/Config/DefaultEngine.ini index 244a1d163..e01a3674a 100644 --- a/spine-ue4/Config/DefaultEngine.ini +++ b/spine-ue4/Config/DefaultEngine.ini @@ -6,4 +6,45 @@ AppliedTargetedHardwareClass=Desktop DefaultGraphicsPerformance=Maximum AppliedDefaultGraphicsPerformance=Maximum +[/Script/Engine.PhysicsSettings] +DefaultGravityZ=-980.000000 +DefaultTerminalVelocity=4000.000000 +DefaultFluidFriction=0.300000 +SimulateScratchMemorySize=262144 +RagdollAggregateThreshold=4 +TriangleMeshTriangleMinAreaThreshold=5.000000 +bEnableAsyncScene=False +bEnableShapeSharing=False +bEnablePCM=True +bEnableStabilization=False +bWarnMissingLocks=True +bEnable2DPhysics=False +LockedAxis=Invalid +DefaultDegreesOfFreedom=Full3D +BounceThresholdVelocity=200.000000 +FrictionCombineMode=Average +RestitutionCombineMode=Average +MaxAngularVelocity=3600.000000 +MaxDepenetrationVelocity=0.000000 +ContactOffsetMultiplier=0.020000 +MinContactOffset=2.000000 +MaxContactOffset=8.000000 +bSimulateSkeletalMeshOnDedicatedServer=True +DefaultShapeComplexity=CTF_UseSimpleAndComplex +bDefaultHasComplexCollision=True +bSuppressFaceRemapTable=False +bSupportUVFromHitResults=False +bDisableActiveActors=False +bDisableCCD=False +bEnableEnhancedDeterminism=False +MaxPhysicsDeltaTime=0.033333 +bSubstepping=False +bSubsteppingAsync=False +MaxSubstepDeltaTime=0.016667 +MaxSubsteps=6 +SyncSceneSmoothingFactor=0.000000 +AsyncSceneSmoothingFactor=0.990000 +InitialAverageFrameRate=0.016667 +PhysXTreeRebuildRate=10 + diff --git a/spine-ue4/Content/Test/Test.umap b/spine-ue4/Content/Test/Test.umap index ff900fe8f..6e2bd3332 100644 Binary files a/spine-ue4/Content/Test/Test.umap and b/spine-ue4/Content/Test/Test.umap differ diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineAtlasImportFactory.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineAtlasImportFactory.cpp index 0caaccce9..a7b4cae8b 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineAtlasImportFactory.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineAtlasImportFactory.cpp @@ -37,7 +37,6 @@ #include "Developer/AssetTools/Public/IAssetTools.h" #include "Developer/DesktopPlatform/Public/IDesktopPlatform.h" #include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h" -#include "spine/spine.h" #include #include #include diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineEditorPlugin.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineEditorPlugin.cpp index af2bfcd45..3b0fbcf5d 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineEditorPlugin.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineEditorPlugin.cpp @@ -39,11 +39,11 @@ class FSpineEditorPlugin: public ISpineEditorPlugin { IMPLEMENT_MODULE(FSpineEditorPlugin, ISpineEditorPlugin) +void FSpineEditorPlugin::StartupModule () { +} - -void FSpineEditorPlugin::StartupModule () { } - -void FSpineEditorPlugin::ShutdownModule () { } +void FSpineEditorPlugin::ShutdownModule () { +} diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineSkeletonImportFactory.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineSkeletonImportFactory.cpp index e9ff88eb3..8ebeff1e8 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineSkeletonImportFactory.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineSkeletonImportFactory.cpp @@ -37,7 +37,6 @@ #include "Developer/AssetTools/Public/IAssetTools.h" #include "Developer/DesktopPlatform/Public/IDesktopPlatform.h" #include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h" -#include "spine/spine.h" #include #include #include diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/SpineEditorPlugin.Build.cs b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/SpineEditorPlugin.Build.cs index 258106bb0..c0c78d618 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/SpineEditorPlugin.Build.cs +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/SpineEditorPlugin.Build.cs @@ -9,7 +9,7 @@ namespace UnrealBuildTool.Rules PublicIncludePaths.AddRange(new string[] { "SpineEditorPlugin/Public", "SpinePlugin/Public/spine-c/include" }); PrivateIncludePaths.AddRange(new string[] { "SpineEditorPlugin/Private", "SpinePlugin/Public/spine-c/include" }); - + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePlugin.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePlugin.cpp index c0dc79974..9dd2b22bf 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePlugin.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePlugin.cpp @@ -37,8 +37,28 @@ class FSpinePlugin : public SpinePlugin { IMPLEMENT_MODULE( FSpinePlugin, SpinePlugin ) -void FSpinePlugin::StartupModule() { } +// These should be filled with UE4's specific allocator functions. +extern "C" { + void _spSetMalloc( void* ( *_malloc ) ( size_t size ) ); + void _spSetFree( void( *_free ) ( void* ptr ) ); + void _spSetRealloc( void* ( *_realloc ) ( void* ptr, size_t size ) ); +} +static void * SpineMalloc( size_t size ) { + return FMemory::Malloc( size ); +} + +static void * SpineRealloc( void* ptr, size_t size ) { + return FMemory::Realloc( ptr, size ); +} + +void FSpinePlugin::StartupModule() { +#if !UE_EDITOR + _spSetMalloc( &SpineMalloc ); + _spSetRealloc( &SpineRealloc ); + _spSetFree( FMemory::Free ); +#endif +} void FSpinePlugin::ShutdownModule() { } diff --git a/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs b/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs index e38546d0c..c87e493a4 100644 --- a/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs +++ b/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs @@ -1824,11 +1824,7 @@ namespace Spine.Unity.Editor { } public static void DrawDot (Vector3 position, float size) { - #if UNITY_5_6_OR_NEWER - Handles.DotHandleCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position), EventType.Ignore); - #else - Handles.DotCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position)); - #endif + Handles.DotHandleCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position), EventType.Ignore); //Handles.DotCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position)); } public static void DrawBoundingBoxes (Transform transform, Skeleton skeleton) { @@ -1839,9 +1835,9 @@ namespace Spine.Unity.Editor { } public static void DrawBoundingBox (Slot slot, BoundingBoxAttachment box, Transform t) { - if (box.Vertices.Length <= 0) return; // Handle cases where user creates a BoundingBoxAttachment but doesn't actually define it. + if (box.Vertices.Length <= 2) return; // Handle cases where user creates a BoundingBoxAttachment but doesn't actually define it. - var worldVerts = new float[box.Vertices.Length]; + var worldVerts = new float[box.WorldVerticesLength]; box.ComputeWorldVertices(slot, worldVerts); Handles.color = Color.green; diff --git a/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha.meta b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha.meta new file mode 100644 index 000000000..e423168d0 --- /dev/null +++ b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d6f7e10049c6d6348ae5c92ccb3825e0 +folderAsset: yes +timeCreated: 1521392482 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader new file mode 100644 index 000000000..a4c0eba5a --- /dev/null +++ b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader @@ -0,0 +1,56 @@ +// - Unlit + no shadow +// - Double-sided, no depth + +Shader "Spine/Straight Alpha/Skeleton Fill" { + Properties { + _FillColor ("FillColor", Color) = (1,1,1,1) + _FillPhase ("FillPhase", Range(0, 1)) = 0 + [NoScaleOffset]_MainTex ("MainTex", 2D) = "white" {} + } + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + Blend One OneMinusSrcAlpha + Cull Off + ZWrite Off + Lighting Off + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + sampler2D _MainTex; + float4 _FillColor; + float _FillPhase; + + struct VertexInput { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + float4 vertexColor : COLOR; + }; + + struct VertexOutput { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + float4 vertexColor : COLOR; + }; + + VertexOutput vert (VertexInput v) { + VertexOutput o = (VertexOutput)0; + o.uv = v.uv; + o.vertexColor = v.vertexColor; + o.pos = UnityObjectToClipPos(v.vertex); + return o; + } + + float4 frag (VertexOutput i) : COLOR { + float4 rawColor = tex2D(_MainTex,i.uv); + float finalAlpha = (rawColor.a * i.vertexColor.a); + float3 finalColor = lerp((rawColor.rgb * i.vertexColor.rgb * rawColor.a), (_FillColor.rgb * finalAlpha), _FillPhase); + return fixed4(finalColor, finalAlpha); + } + ENDCG + } + } + FallBack "Diffuse" +} \ No newline at end of file diff --git a/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader.meta b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader.meta new file mode 100644 index 000000000..38c4a7cd7 --- /dev/null +++ b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ec3c686f972ccf5459c2b55555e6635f +timeCreated: 1492385797 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader new file mode 100644 index 000000000..85d89cf89 --- /dev/null +++ b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader @@ -0,0 +1,99 @@ +// - Two color tint +// - unlit +// - No depth, no backface culling, no fog. + +Shader "Spine/Straight Alpha/Skeleton Tint" { + Properties { + _Color ("Tint Color", Color) = (1,1,1,1) + _Black ("Black Point", Color) = (0,0,0,0) + [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend One OneMinusSrcAlpha + Lighting Off + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + sampler2D _MainTex; + float4 _Color; + float4 _Black; + + struct VertexInput { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + float4 vertexColor : COLOR; + }; + + struct VertexOutput { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + float4 vertexColor : COLOR; + }; + + VertexOutput vert (VertexInput v) { + VertexOutput o; + o.pos = UnityObjectToClipPos(v.vertex); // replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + o.uv = v.uv; + o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor. + return o; + } + + float4 frag (VertexOutput i) : COLOR { + float4 texColor = tex2D(_MainTex, i.uv); + texColor = float4(texColor.rgb * texColor.a, texColor.a); + return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * _Black.rgb * texColor.a*_Color.a*i.vertexColor.a), 0); + } + ENDCG + } + + Pass { + Name "Caster" + Tags { "LightMode"="ShadowCaster" } + Offset 1, 1 + ZWrite On + ZTest LEqual + + Fog { Mode Off } + Cull Off + Lighting Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #pragma fragmentoption ARB_precision_hint_fastest + #include "UnityCG.cginc" + sampler2D _MainTex; + fixed _Cutoff; + + struct VertexOutput { + V2F_SHADOW_CASTER; + float2 uv : TEXCOORD1; + }; + + VertexOutput vert (appdata_base v) { + VertexOutput o; + o.uv = v.texcoord; + TRANSFER_SHADOW_CASTER(o) + return o; + } + + float4 frag (VertexOutput i) : COLOR { + fixed4 texcol = tex2D(_MainTex, i.uv); + clip(texcol.a - _Cutoff); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } + } +} diff --git a/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader.meta b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader.meta new file mode 100644 index 000000000..e2b0cbebd --- /dev/null +++ b/spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c9a84b3418d033a4f9749511a6ac36d6 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: