-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e541305
commit a06fa73
Showing
8 changed files
with
596 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ name: Build Game | |
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [ main, experimental ] | ||
branches: [main, experimental] | ||
pull_request: | ||
branches: [ main, experimental ] | ||
branches: [main, experimental] | ||
|
||
# For release builds | ||
workflow_call: | ||
|
@@ -41,10 +41,13 @@ jobs: | |
sudo apt-get install libvlccore-dev | ||
haxelib setup ~/haxelib | ||
haxelib install hxcpp > /dev/null --quiet | ||
haxelib git systools https://github.com/haya3218/retools | ||
haxelib install format > nul | ||
haxe -cp ./setup -D analyzer-optimize -main Main --interp | ||
- name: Skip SScript setup mode | ||
run: echo 'oy9:showMacroty8:loopCosti25y10:includeAllfg' >> ~/settings.cocoa | ||
- name: Rebuild systools | ||
run: lime rebuild systools linux | ||
- name: Create Version Tag | ||
run: echo "${{github.run_id}}" > VERSION | ||
- name: Compile | ||
|
@@ -53,7 +56,7 @@ jobs: | |
uses: actions/[email protected] | ||
with: | ||
name: linuxBuild | ||
path: 'export/release/linux/bin' | ||
path: "export/release/linux/bin" | ||
buildWindows: | ||
runs-on: windows-latest | ||
|
||
|
@@ -69,12 +72,15 @@ jobs: | |
run: | | ||
haxelib setup C:/haxelib | ||
haxelib install hxcpp > /dev/null --quiet | ||
haxelib git systools https://github.com/haya3218/retools | ||
haxelib install format > nul | ||
haxe -cp ./setup -D analyzer-optimize -main Main --interp | ||
shell: cmd | ||
- name: Skip SScript setup mode | ||
run: echo 'oy9:showMacroty8:loopCosti25y10:includeAllfg' >> %USERPROFILE%/settings.cocoa | ||
shell: cmd | ||
- name: Rebuild systools | ||
run: lime rebuild systools windows | ||
- name: Create Version Tag | ||
run: echo "${{github.run_id}}" > VERSION | ||
- name: Compile | ||
|
@@ -99,10 +105,13 @@ jobs: | |
run: | | ||
haxelib setup ~/haxelib | ||
haxelib install hxcpp > /dev/null --quiet | ||
haxelib git systools https://github.com/haya3218/retools | ||
haxelib install format > nul | ||
haxe -cp ./setup -D analyzer-optimize -main Main --interp | ||
- name: Skip SScript setup mode | ||
run: echo 'oy9:showMacroty8:loopCosti25y10:includeAllfg' >> ~/settings.cocoa | ||
- name: Rebuild systools | ||
run: lime rebuild systools mac | ||
- name: Create Version Tag | ||
run: echo "${{github.run_id}}" > VERSION | ||
- name: Compile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
package extraflixel; | ||
|
||
import flixel.math.FlxPoint; | ||
import flixel.math.FlxAngle; | ||
import math.VectorHelpers; | ||
import math.Vector3; | ||
import flixel.graphics.frames.FlxFrame.FlxFrameType; | ||
import openfl.Vector; | ||
import openfl.geom.ColorTransform; | ||
import openfl.display.Shader; | ||
import flixel.system.FlxAssets.FlxShader; | ||
|
||
class FlxSprite3D extends FlxSprite { | ||
public var z:Float = 0; | ||
|
||
public var yaw:Float = 0; | ||
public var pitch:Float = 0; | ||
@:isVar | ||
public var roll(get, set):Float = 0; | ||
|
||
function get_roll() return angle; | ||
|
||
function set_roll(val:Float) return angle = val; | ||
|
||
override public function draw():Void | ||
{ | ||
checkEmptyFrame(); | ||
|
||
if(alpha == 0 || _frame.type == FlxFrameType.EMPTY) return; | ||
|
||
if(dirty) // rarely | ||
calcFrame(useFramePixels); | ||
|
||
// TODO: take origin into consideration properly | ||
var wid = frameWidth; | ||
var hei = frameHeight; | ||
|
||
var halfW = wid * 0.5; | ||
var halfH = hei * 0.5; | ||
|
||
var camPos = new Vector3(0, 0, 1280); | ||
var camOrigin = new Vector3(FlxG.width / 2, FlxG.height / 2); // vertex origin | ||
|
||
// TODO: take origin into account properly without this bandaid fix vv | ||
|
||
var bandaidOrigin = FlxPoint.weak(); | ||
bandaidOrigin.set(origin.x - halfW, origin.y - halfH); | ||
for (camera in cameras) | ||
{ | ||
if(!camera.visible || !camera.exists || camera.canvas == null || camera.canvas.graphics == null) | ||
continue; | ||
|
||
var quad = [ | ||
new Vector3(-halfW, -halfH, 0), | ||
new Vector3(halfW, -halfH, 0), | ||
new Vector3(-halfW, halfH, 0), | ||
new Vector3(halfW, halfH, 0) | ||
]; | ||
|
||
getScreenPosition(_point, camera).subtractPoint(offset); | ||
//_point.add(bandaidOrigin.x, bandaidOrigin.y); | ||
var pos = new Vector3(_point.x, _point.y, z); | ||
|
||
for (idx => vert in quad) | ||
{ | ||
if(flipX) vert.x *= -1; | ||
if(flipY) vert.y *= -1; | ||
vert.x -= bandaidOrigin.x; | ||
vert.y -= bandaidOrigin.y; | ||
vert.x *= scale.x; | ||
vert.y *= scale.y; | ||
|
||
var vert = VectorHelpers.rotateV3(vert, FlxAngle.TO_RAD * pitch, FlxAngle.TO_RAD * yaw, FlxAngle.TO_RAD * roll); | ||
var originMod = vert.add(pos).subtract(camOrigin); | ||
var projected = VectorHelpers.project(originMod.subtract(camPos)); | ||
vert = projected.subtract(pos).add(camOrigin); // puts the vertex back to default pos | ||
|
||
vert.x += bandaidOrigin.x; | ||
vert.y += bandaidOrigin.y; | ||
|
||
quad[idx] = vert; | ||
|
||
} | ||
var frameRect = frame.frame; | ||
var sourceBitmap = graphic.bitmap; | ||
|
||
var leftUV = frameRect.left / sourceBitmap.width; | ||
var rightUV = frameRect.right / sourceBitmap.width; | ||
var topUV = frameRect.top / sourceBitmap.height; | ||
var bottomUV = frameRect.bottom / sourceBitmap.height; | ||
|
||
// order should be LT, RT, RB, LT, LB, RB | ||
// R is right L is left T is top B is bottom | ||
// order matters! so LT is left, top because they're represented as x, y | ||
var vertices = new Vector<Float>(12, false, [ | ||
quad[0].x, quad[0].y, | ||
quad[1].x, quad[1].y, | ||
quad[3].x, quad[3].y, | ||
|
||
quad[0].x, quad[0].y, | ||
quad[2].x, quad[2].y, | ||
quad[3].x, quad[3].y | ||
]); | ||
|
||
var uvData = new Vector<Float>(12, false, [ | ||
leftUV, topUV, | ||
rightUV, topUV, | ||
rightUV, bottomUV, | ||
|
||
leftUV, topUV, | ||
leftUV, bottomUV, | ||
rightUV, bottomUV, | ||
]); | ||
|
||
var shader = this.shader != null ? this.shader : new FlxShader(); | ||
if (this.shader != shader) | ||
this.shader = shader; | ||
|
||
shader.bitmap.input = graphic.bitmap; | ||
shader.bitmap.filter = antialiasing ? LINEAR : NEAREST; | ||
|
||
|
||
var transforms:Array<ColorTransform> = []; | ||
var transfarm:ColorTransform = new ColorTransform(); | ||
transfarm.redMultiplier = colorTransform.redMultiplier; | ||
transfarm.greenMultiplier = colorTransform.greenMultiplier; | ||
transfarm.blueMultiplier = colorTransform.blueMultiplier; | ||
transfarm.redOffset = colorTransform.redOffset; | ||
transfarm.greenOffset = colorTransform.greenOffset; | ||
transfarm.blueOffset = colorTransform.blueOffset; | ||
transfarm.alphaOffset = colorTransform.alphaOffset; | ||
transfarm.alphaMultiplier = colorTransform.alphaMultiplier * camera.alpha; | ||
|
||
for (n in 0...Std.int(vertices.length / 3)) transforms.push(transfarm); | ||
|
||
|
||
var indices = new Vector<Int>(vertices.length, false, cast [for (i in 0...vertices.length) i]); | ||
var drawItem = camera.startTrianglesBatch(graphic, antialiasing, true, null, true, shader); | ||
|
||
@:privateAccess | ||
{ | ||
drawItem.addTrianglesColorArray(vertices, indices, uvData, null, _point, camera._bounds, transforms); | ||
} | ||
|
||
#if FLX_DEBUG | ||
FlxBasic.visibleCount++; | ||
#end | ||
} | ||
bandaidOrigin.putWeak(); | ||
|
||
|
||
#if FLX_DEBUG | ||
if(FlxG.debugger.drawDebug) drawDebug(); | ||
#end | ||
} | ||
} |
Oops, something went wrong.