somewhat successful walk/idle anim impl

This commit is contained in:
minjaesong
2019-01-04 17:44:22 +09:00
parent ae9a1ebcb4
commit 3abca8989a
14 changed files with 192 additions and 81 deletions

View File

@@ -1,7 +1,8 @@
package net.torvald.colourutil
import com.jme3.math.FastMath
import com.badlogic.gdx.graphics.Color
import com.jme3.math.FastMath
import net.torvald.colourutil.CIEXYZUtil.linearise
/**
* Created by minjaesong on 2016-07-26.
@@ -20,4 +21,17 @@ object ColourUtil {
return Color(r, g, b, a)
}
/** Get luminosity level using CIEXYZ colour space. Slow but accurate. */
fun RGB.getLuminosity(): Float {
val new = this.linearise()
return 0.2126729f * new.r + 0.7151522f * new.g + 0.0721750f * new.b // from RGB.toXYZ
}
/** Get luminosity level using CIEXYZ colour space. Slow but accurate. */
fun Color.getLuminosity() = RGB(this).getLuminosity()
/** Get luminosity level using NTSC standard. Fast, less accurate but should be good enough. */
fun RGB.getLuminosityQuick() = 0.3f * this.r + 0.59f * this.g + 0.11f * this.b // NTSC standard
/** Get luminosity level using NTSC standard. Fast, less accurate but should be good enough. */
fun Color.getLuminosityQuick() = 0.3f * this.r + 0.59f * this.g + 0.11f * this.b // NTSC standard
}