removed deprecated away3d support

This commit is contained in:
Yoshman29
2022-12-17 14:11:00 +01:00
parent b2ee424300
commit 8e90740ccf
17 changed files with 13 additions and 170 deletions
+1 -1
View File
@@ -87,10 +87,10 @@
<!-- _________________________________ Custom _______________________________ -->
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
<icon path="art/iconOG.png" />
<icon path="art/icon16.png" size='16'/>
<icon path="art/icon32.png" size='32'/>
<icon path="art/icon64.png" size='64'/>
<icon path="art/iconOG.png" />
<!-- _________________________________ Engine Settings _______________________________ -->
+1 -1
View File
@@ -1 +1 @@
1513
1516
@@ -214,7 +214,6 @@ class SpriteSymbol extends Sprite {
}
private function createLayers():Void {
// todo safety check for not initialiing twice
if (_layers != null) {
throw new Error("You must not call this twice");
}
@@ -201,7 +201,6 @@ class TileContainerSymbol extends TileContainer {
}
private function createLayers():Void {
// todo safety check for not initialiing twice
if (_layers != null) {
throw new Error("You must not call this twice");
}
+1
View File
@@ -40,6 +40,7 @@ class FlxView3D extends FlxSprite
view.width = width == -1 ? FlxG.width : width;
view.height = height == -1 ? FlxG.height : height;
view.backgroundAlpha = 0;
view.alpha = 0;
bmp = new BitmapData(Std.int(view.width), Std.int(view.height), true, 0x0);
loadGraphic(bmp);
-5
View File
@@ -1,5 +0,0 @@
package funkin.away3d;
interface Flx3DObject {
public function destroy():Void;
}
-113
View File
@@ -1,113 +0,0 @@
package funkin.away3d;
import away3d.loaders.parsers.OBJParser;
import away3d.events.Asset3DEvent;
import openfl.utils.ByteArray;
import flixel.util.typeLimit.OneOfTwo;
import away3d.entities.Mesh;
import openfl.utils.Assets;
import hscript.Bytes;
import openfl.display.Sprite;
import flixel.FlxG;
import flixel.FlxObject;
import away3d.containers.View3D;
import away3d.loaders.Loader3D;
import away3d.loaders.misc.AssetLoaderToken;
import away3d.loaders.misc.AssetLoaderContext;
import openfl.display.BitmapData;
import flixel.FlxSprite;
import haxe.io.Path;
class Flx3DView extends FlxSprite {
// STATIC STUFF
#if REGION
private static var __sprite:Sprite;
public static function init() {
__sprite = new Sprite();
FlxG.game.addChild(__sprite);
}
#end
private var __bitmap:BitmapData;
private var __loader:Loader3D = new Loader3D();
public var view3d:View3D;
public var meshes:Array<Mesh> = [];
public function new(x:Float, y:Float, width:Int = 0, height:Int = 0) {
super(x, y);
__loader.addEventListener(Asset3DEvent.ASSET_COMPLETE, assetComplete);
view3d = new View3D();
view3d.scene.addChild(__loader);
if (width <= 0) width = FlxG.width;
if (height <= 0) height = FlxG.height;
resizeBitmap(width, height);
__sprite.addChild(view3d);
}
public function assetComplete(event:Asset3DEvent) {
}
public function loadMesh(asset:String, callback:Mesh->Void) {
try {
var meshContent:ByteArrayData = Assets.getBytes(asset);
if (meshContent == null)
throw "Mesh Asset is null or does not exist.";
var context = new AssetLoaderContext();
var mtlPath = '${Path.withoutExtension(asset)}.mtl';
trace(Path.withoutDirectory(mtlPath));
context.mapUrlToData(Path.withoutDirectory(mtlPath), Assets.getBytes(mtlPath));
var token = __loader.loadData(meshContent, context, null, new OBJParser());
token.addEventListener(Asset3DEvent.MESH_COMPLETE, function(ev:Asset3DEvent) {
if (ev.asset is Mesh) {
var mesh:Mesh = cast ev.asset;
addMesh(mesh);
callback(mesh);
}
});
} catch(e) {
trace(e.details());
}
}
public function addMesh(mesh:Mesh) {
if (mesh == null) return;
meshes.push(mesh);
}
private function resizeBitmap(width:Int, height:Int) {
if (__bitmap != null)
__bitmap.dispose();
__bitmap = new BitmapData(width, height, true, 0);
loadGraphic(__bitmap);
}
public override function draw() {
var filters = FlxG.game.filters;
FlxG.game.filters = null;
view3d.renderer.queueSnapshot(__bitmap);
view3d.render();
FlxG.game.filters = filters;
super.draw();
}
public override function destroy() {
__sprite.removeChild(view3d);
view3d.dispose();
super.destroy();
}
}
-30
View File
@@ -1,30 +0,0 @@
package funkin.away3d;
import away3d.core.base.Geometry;
import flixel.util.FlxDestroyUtil.IFlxDestroyable;
import away3d.loaders.Loader3D;
import haxe.io.Bytes;
import flixel.util.typeLimit.OneOfTwo;
import away3d.entities.Mesh;
class FlxMesh extends Mesh implements IFlxDestroyable implements Flx3DObject {
var __loader:Loader3D = new Loader3D();
public function new(asset:OneOfTwo<Bytes, String>, textures:Array<String> = null) {
if (textures == null) textures = [];
var meshContent:Bytes = null;
if (asset is String)
meshContent = Assets.getBytes(asset);
else if (asset is Bytes)
meshContent = cast(asset, Bytes);
if (meshContent == null)
throw "Mesh Asset is null or does not exist.";
__loader.loadData(meshContent);
super(__loader.loadData());
}
public function destroy() {
loader.dispose();
}
}
-1
View File
@@ -1 +0,0 @@
ISNT DONE YET! EARLY BETA! DO NOT USE!
-1
View File
@@ -45,7 +45,6 @@ class HealthIcon extends FlxSprite
var path = Paths.image('icons/$char');
if (!Assets.exists(path)) path = Paths.image('icons/face');
// TODO: Icon Jsons?? (maybe not not to mess with sparrows but perhaps)
loadGraphic(path, true, 150, 150);
animation.add(char, [for(i in 0...frames.frames.length) i], 0, false, isPlayer);
+6 -5
View File
@@ -229,7 +229,7 @@ class PlayState extends MusicBeatState
#if desktop
// TODO: Scriptable custom RPC
iconRPC = SONG.player2;
iconRPC = (dad != null && dad.icon != null) ? dad.icon : SONG.player2;
detailsText = isStoryMode ? ("Story Mode: " + storyWeek.name) : "Freeplay";
@@ -842,8 +842,9 @@ class PlayState extends MusicBeatState
public function pauseGame() {
// TODO: Cancellable game pause
scripts.call("onGamePause");
var e = scripts.event("onGamePause", new CancellableEvent());
if (e.cancelled) return;
persistentUpdate = false;
persistentDraw = true;
paused = true;
@@ -1105,10 +1106,10 @@ class PlayState extends MusicBeatState
if (SONG.validScore)
{
#if !switch
// TODO: Accuracy stuff
Highscore.saveScore(SONG.song, {
score: songScore,
misses: misses
misses: misses,
accuracy: accuracy
}, difficulty);
#end
}
+1 -2
View File
@@ -34,8 +34,7 @@ class Stage extends FlxBasic implements IBeatReceiver {
try {
if (Assets.exists(stagePath)) stageXML = new Access(Xml.parse(Assets.getText(stagePath)).firstElement());
} catch(e) {
// TODO: handler
trace(e.details());
Logs.trace('Couldn\'t load stage "$stage": ${e.message}', ERROR);
}
if (stageXML != null) {
+2 -3
View File
@@ -25,9 +25,8 @@ class CustomShader extends FunkinShader {
var fragCode = Assets.exists(fragShaderPath) ? Assets.getText(fragShaderPath) : null;
var vertCode = Assets.exists(vertShaderPath) ? Assets.getText(vertShaderPath) : null;
if (fragCode != null && vertCode != null) {
// TODO: logging!!
}
if (fragCode == null && vertCode == null)
Logs.trace('Shader "$name" couldn\'t be found.', ERROR);
super(fragCode, vertCode, glslVersion);
}
-2
View File
@@ -87,8 +87,6 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
{
program = __context.createProgram(GLSL);
// TODO
// program.uploadSources (vertex, fragment);
@:privateAccess program.__glProgram = __createGLProgram(vertex, fragment);
@:privateAccess __context.__programs.set(id, program);
-1
View File
@@ -308,7 +308,6 @@ class CoolUtil
} else if (Assets.exists('$noExt/Animation.json')
&& Assets.exists('$noExt/spritemap.json')
&& Assets.exists('$noExt/spritemap.png')) {
// TODO: Credit Smokey555!!
return AtlasFrameMaker.construct(noExt);
} else if (Assets.exists('$noExt.xml')) {
return Paths.getSparrowAtlasAlt(noExt);
-2
View File
@@ -1,6 +1,5 @@
package funkin.system;
import funkin.away3d.Flx3DView;
import openfl.utils.AssetLibrary;
import openfl.utils.AssetCache;
import openfl.text.TextFormat;
@@ -137,7 +136,6 @@ class Main extends Sprite
Logs.init();
Paths.init();
ModsFolder.init();
Flx3DView.init();
#if MOD_SUPPORT
ModsFolder.switchMod("introMod");
#end
+1 -1
View File
@@ -177,7 +177,7 @@ class ZipUtils {
fileTime: Date.now(),
dataSize: 0,
data: fileContent,
crc32: Crc32.make(fileContent), // TODO???
crc32: Crc32.make(fileContent),
compressed: false
};
Tools.compress(entry, 1);