mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Remove obsolete EffectLibrary
This commit is contained in:
@@ -7,103 +7,6 @@ using GlitchyEngine.Content;
|
|||||||
|
|
||||||
namespace GlitchyEngine.Renderer;
|
namespace GlitchyEngine.Renderer;
|
||||||
|
|
||||||
/*/// Obsolete because of the ContentManager?
|
|
||||||
public class EffectLibrary
|
|
||||||
{
|
|
||||||
private Dictionary<String, Effect> _effects = new .() ~ delete _;
|
|
||||||
|
|
||||||
private List<String> _ownedStrings = new .() ~ DeleteContainerAndItems!(_);
|
|
||||||
|
|
||||||
public this()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ~this()
|
|
||||||
{
|
|
||||||
for(let pair in _effects)
|
|
||||||
{
|
|
||||||
pair.value.ReleaseRef();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(Effect effect, String effectName = null)
|
|
||||||
{
|
|
||||||
Debug.Profiler.ProfileResourceFunction!();
|
|
||||||
|
|
||||||
String name;
|
|
||||||
|
|
||||||
if(effectName == null)
|
|
||||||
{
|
|
||||||
name = effect.Name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name = new String(effectName);
|
|
||||||
_ownedStrings.Add(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.EngineLogger.AssertDebug(!Exists(name), "Can't add two effects with the same name to library.");
|
|
||||||
|
|
||||||
_effects.Add(name, effect..AddRef());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the effect with the given file name.
|
|
||||||
* @param filepath The path to the effect file.
|
|
||||||
* @param effectName The optional custom effect name which will be used to identify the effect.
|
|
||||||
* @returns The loaded Effect. Note: This function will increment the reference counter of the effect, so the programmer must decrement it once it's not used anymore.
|
|
||||||
* If the return-value is not needed, use LoadNoRefInc instead.
|
|
||||||
*/
|
|
||||||
public Effect Load(String filepath, String effectName = null)
|
|
||||||
{
|
|
||||||
Debug.Profiler.ProfileResourceFunction!();
|
|
||||||
|
|
||||||
String name = effectName;
|
|
||||||
|
|
||||||
if(name == null)
|
|
||||||
{
|
|
||||||
name = scope:: String();
|
|
||||||
Path.GetFileNameWithoutExtension(filepath, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Exists(name))
|
|
||||||
{
|
|
||||||
return Get(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.EngineLogger.AssertDebug(!Exists(name), "Can't add two effects with the same name to library.");
|
|
||||||
|
|
||||||
Effect effect = new Effect(filepath, name);
|
|
||||||
Add(effect);
|
|
||||||
|
|
||||||
return effect;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the effect with the given file name.
|
|
||||||
* @param filepath The path to the effect file.
|
|
||||||
* @param effectName The optional custom effect name which will be used to identify the effect.
|
|
||||||
*/
|
|
||||||
public void LoadNoRefInc(String filepath, String effectName = null)
|
|
||||||
{
|
|
||||||
var v = Load(filepath, effectName);
|
|
||||||
v.ReleaseRef();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Effect Get(String effectName)
|
|
||||||
{
|
|
||||||
Debug.Profiler.ProfileResourceFunction!();
|
|
||||||
|
|
||||||
Log.EngineLogger.AssertDebug(Exists(effectName), "Effect not found!");
|
|
||||||
|
|
||||||
return _effects.GetValue(effectName).Get()..AddRef();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Exists(String effectName) => _effects.ContainsKey(effectName);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public enum TextureDimension
|
public enum TextureDimension
|
||||||
{
|
{
|
||||||
Unknown,
|
Unknown,
|
||||||
|
|||||||
Reference in New Issue
Block a user