mirror of
https://github.com/4sval/FModel.git
synced 2026-04-04 16:15:52 -05:00
only setup the needed one
This commit is contained in:
parent
41319ad2a3
commit
59973f95d6
|
|
@ -24,6 +24,7 @@ public class Cache : IDisposable
|
|||
public bool TryGetModel(FGuid guid, out Model model) => _models.TryGetValue(guid, out model);
|
||||
public bool TryGetTexture(FGuid guid, out Texture texture) => _textures.TryGetValue(guid, out texture);
|
||||
|
||||
public void Setup(FGuid guid) => _models[guid].Setup();
|
||||
public void Setup()
|
||||
{
|
||||
foreach (var model in _models.Values)
|
||||
|
|
@ -31,6 +32,7 @@ public class Cache : IDisposable
|
|||
model.Setup();
|
||||
}
|
||||
}
|
||||
|
||||
public void Render(Shader shader)
|
||||
{
|
||||
foreach (var model in _models.Values)
|
||||
|
|
|
|||
|
|
@ -20,12 +20,15 @@ public class Snooper : GameWindow
|
|||
private Camera _camera;
|
||||
private float _previousSpeed;
|
||||
|
||||
private bool _init;
|
||||
|
||||
public Snooper(GameWindowSettings gwSettings, NativeWindowSettings nwSettings) : base(gwSettings, nwSettings)
|
||||
{
|
||||
// _framebuffer = new FramebufferObject(Size);
|
||||
_skybox = new Skybox();
|
||||
_grid = new Grid();
|
||||
_renderer = new Renderer();
|
||||
_init = false;
|
||||
}
|
||||
|
||||
public void SwapMaterial(UMaterialInstance mi) => _renderer.Swap(mi);
|
||||
|
|
@ -53,6 +56,12 @@ public class Snooper : GameWindow
|
|||
|
||||
protected override void OnLoad()
|
||||
{
|
||||
if (_init)
|
||||
{
|
||||
_renderer.Cache.Setup(_renderer.Settings.SelectedModel);
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnLoad();
|
||||
|
||||
GL.ClearColor(Color4.Red);
|
||||
|
|
@ -66,6 +75,7 @@ public class Snooper : GameWindow
|
|||
_skybox.Setup();
|
||||
_grid.Setup();
|
||||
_renderer.Setup();
|
||||
_init = true;
|
||||
}
|
||||
|
||||
protected override void OnRenderFrame(FrameEventArgs args)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user