Merge remote-tracking branch 'origin/master'

This commit is contained in:
NathanSweet 2014-07-22 23:44:34 +02:00
commit cd146f24a8
3 changed files with 93 additions and 12 deletions

View File

@ -104,10 +104,10 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
texture = (Texture*)((AtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
RegionAttachment_computeWorldVertices(regionAttachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices);
Uint8 r = skeleton->r * slot->r * 255;
Uint8 g = skeleton->g * slot->g * 255;
Uint8 b = skeleton->b * slot->b * 255;
Uint8 a = skeleton->a * slot->a * 255;
Uint8 r = static_cast<Uint8>(skeleton->r * slot->r * 255);
Uint8 g = static_cast<Uint8>(skeleton->g * slot->g * 255);
Uint8 b = static_cast<Uint8>(skeleton->b * slot->b * 255);
Uint8 a = static_cast<Uint8>(skeleton->a * slot->a * 255);
Vector2u size = texture->getSize();
vertices[0].color.r = r;
@ -159,10 +159,10 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
MeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
Uint8 r = skeleton->r * slot->r * 255;
Uint8 g = skeleton->g * slot->g * 255;
Uint8 b = skeleton->b * slot->b * 255;
Uint8 a = skeleton->a * slot->a * 255;
Uint8 r = static_cast<Uint8>(skeleton->r * slot->r * 255);
Uint8 g = static_cast<Uint8>(skeleton->g * slot->g * 255);
Uint8 b = static_cast<Uint8>(skeleton->b * slot->b * 255);
Uint8 a = static_cast<Uint8>(skeleton->a * slot->a * 255);
vertex.color.r = r;
vertex.color.g = g;
vertex.color.b = b;
@ -184,10 +184,10 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
SkinnedMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
Uint8 r = skeleton->r * slot->r * 255;
Uint8 g = skeleton->g * slot->g * 255;
Uint8 b = skeleton->b * slot->b * 255;
Uint8 a = skeleton->a * slot->a * 255;
Uint8 r = static_cast<Uint8>(skeleton->r * slot->r * 255);
Uint8 g = static_cast<Uint8>(skeleton->g * slot->g * 255);
Uint8 b = static_cast<Uint8>(skeleton->b * slot->b * 255);
Uint8 a = static_cast<Uint8>(skeleton->a * slot->a * 255);
vertex.color.r = r;
vertex.color.g = g;
vertex.color.b = b;

View File

@ -0,0 +1,73 @@
using UnityEngine;
using System.Collections;
using Spine;
public static class SkeletonExtensions {
public static void SetColor(this Slot slot, Color color){
slot.A = color.a;
slot.R = color.r;
slot.G = color.g;
slot.B = color.b;
}
public static void SetColor(this Slot slot, Color32 color){
slot.A = color.a / 255f;
slot.R = color.r / 255f;
slot.G = color.g / 255f;
slot.B = color.b / 255f;
}
public static void SetColor(this RegionAttachment attachment, Color color){
attachment.A = color.a;
attachment.R = color.r;
attachment.G = color.g;
attachment.B = color.b;
}
public static void SetColor(this RegionAttachment attachment, Color32 color){
attachment.A = color.a / 255f;
attachment.R = color.r / 255f;
attachment.G = color.g / 255f;
attachment.B = color.b / 255f;
}
public static void SetColor(this MeshAttachment attachment, Color color){
attachment.A = color.a;
attachment.R = color.r;
attachment.G = color.g;
attachment.B = color.b;
}
public static void SetColor(this MeshAttachment attachment, Color32 color){
attachment.A = color.a / 255f;
attachment.R = color.r / 255f;
attachment.G = color.g / 255f;
attachment.B = color.b / 255f;
}
public static void SetColor(this SkinnedMeshAttachment attachment, Color color){
attachment.A = color.a;
attachment.R = color.r;
attachment.G = color.g;
attachment.B = color.b;
}
public static void SetColor(this SkinnedMeshAttachment attachment, Color32 color){
attachment.A = color.a / 255f;
attachment.R = color.r / 255f;
attachment.G = color.g / 255f;
attachment.B = color.b / 255f;
}
public static void SetPosition(this Bone bone, Vector2 position){
bone.X = position.x;
bone.Y = position.y;
}
public static void SetPosition(this Bone bone, Vector3 position){
bone.X = position.x;
bone.Y = position.y;
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ea85c8f6a91a6ab45881b0dbdaabb7d0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: