Added flx3d thing

This commit is contained in:
NeeEoo
2024-02-11 18:25:41 +01:00
parent 1057c035d3
commit 6592648448
2 changed files with 14 additions and 6 deletions
+13 -5
View File
@@ -13,6 +13,7 @@ import flixel.FlxG;
* Help from Ne_Eo
* @see https://twitter.com/Ne_Eo_Twitch
*/
@:access(away3d.core.managers.Stage3DManager)
class Flx3DUtil
{
#if THREE_D_SUPPORT
@@ -25,18 +26,25 @@ class Flx3DUtil
return FlxG.stage.stage3Ds.length;
}
/**
* Returns the total amount of 3D stages that are in use
* @return Int
*/
public static inline function getUsed3D():Int
{
return Stage3DManager._numStageProxies;
}
/**
* Returns if a Stage3D is available
* @return Bool
*/
public static inline function is3DAvailable():Bool
{
@:privateAccess {
if (Stage3DManager._stageProxies == null)
return true;
if (Stage3DManager._stageProxies == null)
return true;
return Stage3DManager._numStageProxies < Stage3DManager._stageProxies.length;
}
return Stage3DManager._numStageProxies < Stage3DManager._stageProxies.length;
}
/**
+1 -1
View File
@@ -36,7 +36,7 @@ class Flx3DView extends FlxView3D {
var meshes:Array<Mesh> = [];
public function new(x:Float = 0, y:Float = 0, width:Int = -1, height:Int = -1) {
if (!Flx3DUtil.is3DAvailable())
throw "[Flx3DView] 3D is not available on this platform. Stages in use: " + Flx3DUtil.getTotal3D() + ", Max stages allowed: " + FlxG.stage.stage3Ds.length + ".";
throw "[Flx3DView] 3D is not available on this platform. Stages in use: " + Flx3DUtil.getUsed3D() + ", Max stages allowed: " + Flx3DUtil.getTotal3D() + ".";
super(x, y, width, height);
__cur3DStageID = __3DIDS++;
}