protected override void Load() { Debug.Profile("Loading assets", true, new Task(() => { Debug.Profile("Loading textures", true, new Task(() => { // Load textures TextureRegistry.Register(Texture.Load("loading_texture", "textures/gui/loading.png")); TextureRegistry.Register(Texture.Load("block_placeholder", "textures/blocks/placeholder.png")); })); Debug.Profile("Loading shaders", true, new Task(() => { // Load shaders ShaderRegistry.Register(Shader.Load("interface_shader", "shaders/ui_shader.vert", "shaders/ui_shader.frag")); })); /*Debug.Profile("Loading models", true, new Task(() => * { * * }));*/ /*Debug.Profile("Loading sounds", true, new Task(() => * { * * }));*/ /*Debug.Profile("Loading music", true, new Task(() => * { * * }));*/ })); }
protected override void PreWarm() { Debug.LogDebug($"Profiler resolution: {Debug.GetProfilerResolution():n0} ticks/sec, High res: {(Debug.IsProfilerHighResolution() ? "Yes" : "No")}"); TextureRegistry.CheckIn(); ShaderRegistry.CheckIn(); __BlockInformation.GetAllBlockInformation(); }
public void Set(string bundleName, string shaderName) { if (bundleName == null) { throw new CYFException("shader.Set: The first argument, the name of the AssetBundle to load, is nil."); } if (shaderName == null) { throw new CYFException("shader.Set: The second argument, the name of the shader to load, is nil."); } material = Object.Instantiate(ShaderRegistry.Get(bundleName, shaderName)); switch (mode) { case "camera": { CameraShader cs = gameObject.GetComponent <CameraShader>(); cs.enabled = true; cs.material = material; material.EnableKeyword("CYF_SHADER_IS_CAMERA"); break; } case "event": gameObject.GetComponent <SpriteRenderer>().material = material; break; default: gameObject.GetComponent <Image>().material = material; break; } _isActive = true; }
static void ProcessArguments(IReadOnlyList <string> args) { if (args.Count == 2) { if (args[0] == "-install") { ShaderRegistry.Install(args[1]); } } }
private static void PreLoad() { Debug.LogInfo("Loading shaders", p_post: Indent); { Shader.Load("ui_shader", "ui_shader"); ui_shader = ShaderRegistry.Get("ui_shader"); } Debug.LogInfo("Shaders loaded", p_pre: Unindent); GUIAtlas = TextureAtlas.Build("gui_texture_atlas", "GUI", "gui"); BlocksAtlas = TextureAtlas.Build("blocks_texture_atlas", "Blocks", "block"); }
protected override void OnLoad(EventArgs e) { GL.ClearColor(Color.Black); InitVbo(); ShaderInfo shader = Config.ShaderName != null?ShaderRegistry.Get(Config.ShaderName) : ShaderRegistry.First(); SetShaders(shader?.VertexCode, shader?.FragmentCode); base.OnLoad(e); }
public DisplayWindow() : base(1, 1, GraphicsMode.Default, Reference.NAME, GameWindowFlags.FixedWindow) { Win32.SetWindowAsDesktopChild(WindowInfo.Handle); WindowBorder = WindowBorder.Hidden; Location = new Point(0, 0); Size = new Size(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height); Config.FramesPerSecondChange += (sender, i) => TargetRenderFrequency = i; Config.UpdatesPerSecondChange += (sender, i) => TargetUpdateFrequency = i; Config.ShaderChange += (sender, s) => queue.Enqueue(ShaderRegistry.Get(s)); Instance = this; }
public static void InitAll(bool shaders = false) { if (!Initialized && (!GlobalControls.isInFight || GlobalControls.modDev)) { //UnitaleUtil.createFile(); Stopwatch sw = new Stopwatch(); //benchmarking terrible loading times sw.Start(); ScriptRegistry.Init(); sw.Stop(); UnityEngine.Debug.Log("Script registry loading time: " + sw.ElapsedMilliseconds + "ms"); sw.Reset(); sw.Start(); SpriteRegistry.Init(); sw.Stop(); UnityEngine.Debug.Log("Sprite registry loading time: " + sw.ElapsedMilliseconds + "ms"); sw.Reset(); sw.Start(); AudioClipRegistry.Init(); sw.Stop(); UnityEngine.Debug.Log("Audio clip registry loading time: " + sw.ElapsedMilliseconds + "ms"); sw.Reset(); sw.Start(); SpriteFontRegistry.Init(); sw.Stop(); UnityEngine.Debug.Log("Sprite font registry loading time: " + sw.ElapsedMilliseconds + "ms"); sw.Reset(); if (shaders) { sw.Start(); ShaderRegistry.Init(); sw.Stop(); UnityEngine.Debug.Log("Shader registry loading time: " + sw.ElapsedMilliseconds + "ms"); sw.Reset(); } } else { Initialized = true; } LateUpdater.Init(); // must be last; lateupdater's initialization is for classes that depend on the above registries MusicManager.src = Camera.main.GetComponent <AudioSource>(); SendLoaded(); //CurrENCOUNTER = ENCOUNTER; //CurrMODFOLDER = MODFOLDER; }
public static void Start() { if (!firstInit) { firstInit = true; SpriteRegistry.Start(); AudioClipRegistry.Start(); SpriteFontRegistry.Start(); ShaderRegistry.Start(); } if (string.IsNullOrEmpty(MODFOLDER)) { MODFOLDER = EDITOR_MODFOLDER; } //if (CurrMODFOLDER != MODFOLDER || CurrENCOUNTER != ENCOUNTER) InitAll(); Initialized = true; }
static void Main(string[] args) { if (mutex.WaitOne(TimeSpan.Zero, true)) { Logger.FilePath = "./latest.log"; ShaderRegistry.Load(); Config.Load(); ProcessArguments(args); Application.SetCompatibleTextRenderingDefault(false); Application.EnableVisualStyles(); Application.Run(new Context()); Config.Save(); mutex.ReleaseMutex(); } mutex.ReleaseMutex(); }