Files
CodenameEngine/source/flx3d/Flx3DUtil.hx
NeeEoo 66a6283167 Fixed some bugs + Typo fixes
Fixed newgrounds logo not showing and causing errors
Small optimizations
2023-01-13 06:04:58 +01:00

52 lines
970 B
Haxe

package flx3d;
import away3d.core.managers.Stage3DManager;
import away3d.library.assets.IAsset;
import flixel.FlxG;
/**
* @author lunarclient
* @see https://twitter.com/lunarcleint
*
* Help from Ne_Eo
* @see https://twitter.com/Ne_Eo_Twitch
*/
class Flx3DUtil
{
/**
* Returns the total amount of 3D stages (not excluding the ones in use)
* @return Int
*/
public static inline function getTotal3D():Int
{
return FlxG.stage.stage3Ds.length;
}
/**
* Returns if a Stage3D is available
* @return Bool
*/
public static inline function is3DAvailable():Bool
{
@:privateAccess {
if (Stage3DManager._stageProxies == null)
return true;
return Stage3DManager._numStageProxies < Stage3DManager._stageProxies.length;
}
}
/**
* Calls dispose() (destroy) on a Away3D asset
* @param obj
* @return null
*/
public static inline function dispose<T:IAsset>(obj:Null<T>):T
{
if (obj != null)
obj.dispose();
return null;
}
}