Skip to content

Instantly share code, notes, and snippets.

Avatar

pharan pharan

View GitHub Profile
@pharan
pharan / Atlas.cs
Last active Nov 9, 2018
NumberStyle-specified version of the Atlas.cs Spine atlas loader.
View Atlas.cs
/******************************************************************************
* 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
@pharan
pharan / Spine-Special-Skeleton-Grayscale.shader
Last active Sep 17, 2020
"Spine/Special/Skeleton Grayscale" shader
View Spine-Special-Skeleton-Grayscale.shader
// - Unlit
// - Premultiplied Alpha Blending (Optional straight alpha input)
// - Double-sided, no depth
Shader "Spine/Special/Skeleton Grayscale" {
Properties {
_GrayPhase ("Phase", Range(0, 1)) = 1
[NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {}
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
@pharan
pharan / BlendModeMaterialsAsset.cs
Last active Sep 16, 2018
Initial implementation of slot blend mode processing on the attachment level for Spine-Unity.
View BlendModeMaterialsAsset.cs
/******************************************************************************
* 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
@pharan
pharan / SpineMeshUVResizeCalculator.cs
Last active Aug 30, 2018
How to calculate how much to trim unused space on backing image for a Spine mesh, and output new UVs that map to the trimmed image.
View SpineMeshUVResizeCalculator.cs
using System;
public static class SpineMeshUVResizeCalculator {
public struct MeshUVData {
public float[] uvs;
public float imageWidth;
public float imageHeight;
public float trimLeft;
public float trimRight;
@pharan
pharan / AnimationTools.cs
Last active Jun 6, 2018
Preview of the spine-unity AnimationTools static class module.
View AnimationTools.cs
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2018, 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
@pharan
pharan / PaintBrush.cs
Created Nov 11, 2017
Unity PaintBrush MonoBehaviour class based on https://pastebin.com/rMx1PVXi
View PaintBrush.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PaintBrush : MonoBehaviour
{
public int resolution = 512;
Texture2D whiteMap;
public float brushSize;
public Texture2D brushTexture;
@pharan
pharan / Spine-SkeletonSpriteMaskable.shader
Last active Aug 4, 2020
A version of Spine/Skeleton shader that can be drawn within a Unity 2017 SpriteMask.
View Spine-SkeletonSpriteMaskable.shader
Shader "Spine/Skeleton SpriteMaskable" {
Properties {
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
_StencilRef ("Stencil Reference", Float) = 1.0
_StencilComp ("Stencil Compare", Float) = 4.0 // For float values, see https://docs.unity3d.com/Manual/SL-Stencil.html under "Comparison Function" heading
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
@pharan
pharan / AnimationMixer.cs
Created Jul 29, 2017
Spine.AnimationMixer. For adapting native Spine Animation Mixing into external animation track systems.
View AnimationMixer.cs
/******************************************************************************
* 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
@pharan
pharan / AttachmentTools.cs
Last active Jul 17, 2017
Caching version of AttachmentTools
View AttachmentTools.cs
/******************************************************************************
* 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
@pharan
pharan / SkeletonDataAssetInspector.cs
Created Jun 26, 2017
SkeletonDataAssetInspector for Spine 3.5 that allows both Spine.Unity.AtlasAssets and TK2D sprite collections.
View SkeletonDataAssetInspector.cs
/******************************************************************************
* 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
You can’t perform that action at this time.