mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
new wacky matrix stuff lil messy teehee
This commit is contained in:
parent
2bd4a91e7e
commit
a6a4ed2c44
3 changed files with 128 additions and 29 deletions
|
@ -18,6 +18,7 @@ import flixel.system.FlxAssets.FlxGraphicAsset;
|
|||
import haxe.format.JsonParser;
|
||||
import openfl.Assets;
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.geom.Matrix;
|
||||
import openfl.geom.Rectangle;
|
||||
|
||||
class FlxAnimate extends FlxSymbol
|
||||
|
@ -34,7 +35,9 @@ class FlxAnimate extends FlxSymbol
|
|||
|
||||
sprGrp = new FlxTypedGroup<FlxSymbol>();
|
||||
|
||||
var folder:String = "tightBarsLol";
|
||||
var tests:Array<String> = ['tightBarsLol', 'tightestBars'];
|
||||
|
||||
var folder:String = tests[1];
|
||||
|
||||
frames = FlxAnimate.fromAnimate(Paths.file('images/' + folder + "/spritemap1.png"), Paths.file('images/$folder/spritemap1.json'));
|
||||
|
||||
|
@ -75,10 +78,7 @@ class FlxAnimate extends FlxSymbol
|
|||
**/
|
||||
function generateSpriteShit()
|
||||
{
|
||||
sprGrp.kill(); // kills group, maybe dont need to do this one so broadly?
|
||||
|
||||
// just used for sum default shit?
|
||||
var normalSpr:FlxSymbol = new FlxSymbol(0, 0);
|
||||
sprGrp.kill(); // kills group, maybe dont need to do this one so broadly? ehh whatev
|
||||
|
||||
for (frameSorted in ParseAnimate.frameList)
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ class FlxAnimate extends FlxSymbol
|
|||
var spr:FlxSymbol = sprGrp.recycle(FlxSymbol); // redo this to recycle from a list later
|
||||
spr.frames = frames;
|
||||
spr.frame = spr.frames.getByName(i.frameName); // this one is fine
|
||||
spr.updateHitbox();
|
||||
|
||||
// move this? wont work here!
|
||||
if (FlxG.keys.justPressed.I)
|
||||
|
@ -98,20 +99,53 @@ class FlxAnimate extends FlxSymbol
|
|||
}
|
||||
|
||||
// cuz its in group, gets a lil fuckie when animated, need to go thru and properly reset each thing for shit like matrix!
|
||||
spr.transformMatrix.copyFrom(normalSpr.transformMatrix);
|
||||
// merely resets the matrix to normal ass one!
|
||||
spr.transformMatrix.identity();
|
||||
spr.setPosition();
|
||||
|
||||
for (swagMatrix in i.matrixArray)
|
||||
/* for (swagMatrix in i.matrixArray)
|
||||
{
|
||||
var alsoSwag:FlxMatrix = new FlxMatrix(swagMatrix[0], swagMatrix[1], swagMatrix[4], swagMatrix[5], swagMatrix[12], swagMatrix[13]);
|
||||
spr.matrixExposed = true;
|
||||
spr.transformMatrix.concat(alsoSwag);
|
||||
}*/
|
||||
|
||||
// i.fullMatrix.concat
|
||||
|
||||
spr.matrixExposed = true;
|
||||
|
||||
// trace(i.fullMatrix);
|
||||
|
||||
if (i.fullMatrix.a < 0)
|
||||
{
|
||||
var alsoSwag:FlxMatrix = new FlxMatrix(swagMatrix[0], swagMatrix[1], swagMatrix[4], swagMatrix[5], swagMatrix[12], swagMatrix[13]);
|
||||
spr.matrixExposed = true;
|
||||
spr.transformMatrix.concat(alsoSwag);
|
||||
trace('negative?');
|
||||
trace(i.fullMatrix);
|
||||
}
|
||||
|
||||
// spr.alpha = 0.3;
|
||||
spr.transformMatrix.concat(i.fullMatrix);
|
||||
|
||||
if (i.fullMatrix.a < 0)
|
||||
{
|
||||
trace('negative?');
|
||||
trace(i.fullMatrix);
|
||||
trace(spr.transformMatrix);
|
||||
}
|
||||
|
||||
// trace(spr.transformMatrix);
|
||||
|
||||
spr.origin.set();
|
||||
|
||||
/* for (trpShit in i.trpArray)
|
||||
{
|
||||
spr.origin.x -= trpShit[0];
|
||||
spr.origin.y -= trpShit[1];
|
||||
}
|
||||
*/
|
||||
// spr.alpha = 0.3;
|
||||
|
||||
spr.antialiasing = true;
|
||||
sprGrp.add(spr);
|
||||
// spr.alpha = 0.5;
|
||||
spr.alpha = 0.5;
|
||||
|
||||
/* if (i == "0225")
|
||||
{
|
||||
|
|
|
@ -154,6 +154,7 @@ class FlxSymbol extends FlxSprite
|
|||
|
||||
dumbassMatrix.concat(_matrix);
|
||||
spr.matrixExposed = true;
|
||||
|
||||
spr.transformMatrix.concat(dumbassMatrix);
|
||||
// spr._matrix.concat(spr.transformMatrix);
|
||||
|
||||
|
@ -248,18 +249,18 @@ class FlxSymbol extends FlxSprite
|
|||
}
|
||||
else
|
||||
{
|
||||
if (bakedRotationAngle <= 0)
|
||||
{
|
||||
updateTrig();
|
||||
|
||||
if (angle != 0)
|
||||
_matrix.rotateWithTrig(_cosAngle, _sinAngle);
|
||||
}
|
||||
|
||||
updateSkewMatrix();
|
||||
_matrix.concat(_skewMatrix);
|
||||
}
|
||||
|
||||
if (bakedRotationAngle <= 0)
|
||||
{
|
||||
updateTrig();
|
||||
|
||||
if (angle != 0)
|
||||
_matrix.rotateWithTrig(_cosAngle, _sinAngle);
|
||||
}
|
||||
|
||||
_point.addPoint(origin);
|
||||
_matrix.translate(_point.x, _point.y);
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package animate;
|
|||
|
||||
import haxe.format.JsonParser;
|
||||
import openfl.Assets;
|
||||
import openfl.geom.Matrix3D;
|
||||
import openfl.geom.Matrix;
|
||||
import sys.io.File;
|
||||
|
||||
/**
|
||||
|
@ -109,20 +111,30 @@ class ParseAnimate
|
|||
*/
|
||||
public static var matrixHelp:Array<Array<Array<Float>>> = [];
|
||||
|
||||
public static var trpHelpIDK:Array<Array<Float>> = [];
|
||||
public static var trpHelpIDK:Array<Array<Array<Float>>> = [];
|
||||
|
||||
public static var loopedFrameShit:Int = 0;
|
||||
|
||||
public static var funnyMatrix:Matrix = new Matrix();
|
||||
public static var matrixFlipper:Array<Matrix> = [];
|
||||
|
||||
// clean up all the crazy ass arrays
|
||||
|
||||
public static function resetFrameList()
|
||||
{
|
||||
// funnyMatrix.identity();
|
||||
|
||||
frameList = [];
|
||||
frameList.push([]);
|
||||
matrixHelp = [];
|
||||
matrixHelp.push([]);
|
||||
|
||||
trpHelpIDK = [];
|
||||
trpHelpIDK.push([]);
|
||||
}
|
||||
|
||||
public static var isFlipped:Bool = false;
|
||||
|
||||
public static function parseTimeline(TL:Timeline, tabbed:Int = 0, ?frameInput:Int)
|
||||
{
|
||||
var strTab:String = "";
|
||||
|
@ -185,27 +197,76 @@ class ParseAnimate
|
|||
{
|
||||
matrixHelp[matrixHelp.length - 1].push(element.ASI.M3D);
|
||||
|
||||
var m3D = element.ASI.M3D;
|
||||
var lilMatrix:Matrix = new Matrix(m3D[0], m3D[1], m3D[4], m3D[5], m3D[12], m3D[13]);
|
||||
matrixFlipper.push(lilMatrix);
|
||||
|
||||
// matrixFlipper.reverse();
|
||||
|
||||
// funnyMatrix.identity();
|
||||
|
||||
// for (m in matrixFlipper)
|
||||
// funnyMatrix.concat(m);
|
||||
|
||||
if (isFlipped)
|
||||
{
|
||||
trace("MORE FLIPPED SHIT");
|
||||
trace("MORE FLIPPED SHIT");
|
||||
trace("MORE FLIPPED SHIT");
|
||||
trace(funnyMatrix);
|
||||
trace(matrixFlipper);
|
||||
}
|
||||
|
||||
// trace(funnyMatrix);
|
||||
|
||||
funnyMatrix.concat(lilMatrix);
|
||||
// trace(funnyMatrix);
|
||||
|
||||
frameList[frameList.length - 1].push({
|
||||
frameName: element.ASI.N,
|
||||
M3D: element.ASI.M3D,
|
||||
depthString: depthTypeBeat,
|
||||
matrixArray: matrixHelp[matrixHelp.length - 1],
|
||||
trpArray: trpHelpIDK
|
||||
trpArray: trpHelpIDK[trpHelpIDK.length - 1],
|
||||
fullMatrix: funnyMatrix.clone()
|
||||
});
|
||||
|
||||
// flips the matrix once?? I cant remember exactly why it needs to be flipped
|
||||
// matrixHelp[matrixHelp.length - 1].reverse();
|
||||
|
||||
trpHelpIDK = [];
|
||||
// trpHelpIDK = [];
|
||||
|
||||
// push the matrix array after each symbol?
|
||||
|
||||
funnyMatrix.identity();
|
||||
matrixFlipper = [];
|
||||
|
||||
depthTypeBeat = "";
|
||||
curLoopType = "";
|
||||
loopedFrameShit = 0;
|
||||
|
||||
isFlipped = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var m3D = element.SI.M3D;
|
||||
var lilMatrix:Matrix = new Matrix(m3D[0], m3D[1], m3D[4], m3D[5], m3D[12], m3D[13]);
|
||||
|
||||
if (lilMatrix.a == -1)
|
||||
{
|
||||
isFlipped = true;
|
||||
|
||||
trace('IS THE NEGATIVE ONE');
|
||||
}
|
||||
|
||||
if (isFlipped)
|
||||
trace(lilMatrix);
|
||||
|
||||
funnyMatrix.concat(lilMatrix);
|
||||
matrixFlipper.push(lilMatrix);
|
||||
// trace(funnyMatrix);
|
||||
|
||||
matrixHelp[matrixHelp.length - 1].push(element.SI.M3D);
|
||||
trpHelpIDK.push([element.SI.TRP.x, element.SI.TRP.y]);
|
||||
trpHelpIDK[trpHelpIDK.length - 1].push([element.SI.TRP.x, element.SI.TRP.y]); // trpHelpIDK.push();
|
||||
depthTypeBeat += "->" + element.SI.SN;
|
||||
curLoopType = element.SI.LP;
|
||||
|
||||
|
@ -222,6 +283,11 @@ class ParseAnimate
|
|||
|
||||
parseTimeline(symbolMap.get(element.SI.SN).TL, tabbed + 1, inputFrame);
|
||||
}
|
||||
|
||||
// idk if this should go per layer or per element / object?
|
||||
|
||||
matrixHelp.push([]);
|
||||
trpHelpIDK.push([]);
|
||||
}
|
||||
|
||||
if (tabbed == 0)
|
||||
|
@ -229,8 +295,6 @@ class ParseAnimate
|
|||
frameList[frameList.length - 1].reverse();
|
||||
frameList.push([]); // new layer essentially
|
||||
}
|
||||
|
||||
matrixHelp.push([]);
|
||||
}
|
||||
|
||||
frameList.reverse();
|
||||
|
@ -240,10 +304,10 @@ class ParseAnimate
|
|||
typedef VALIDFRAME =
|
||||
{
|
||||
frameName:String,
|
||||
M3D:Array<Float>,
|
||||
depthString:String,
|
||||
matrixArray:Array<Array<Float>>,
|
||||
trpArray:Array<Array<Float>>
|
||||
trpArray:Array<Array<Float>>,
|
||||
fullMatrix:Matrix
|
||||
}
|
||||
|
||||
typedef AnimJson =
|
||||
|
|
Loading…
Reference in a new issue