Skip to content

Commit

Permalink
fix tornado asked
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryImMouse committed Jul 14, 2024
1 parent 30cdeee commit f90493c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Hypercube.Client/Graphics/Rendering/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ private void OnStartup(ref RuntimeStartupEvent args)
InitOpenGL();

_resourceCacher.PreloadTextures();
_resourceCacher.PreloadShaders();
_resourceCacher.PreloadAudio();

OnLoad();
}
Expand Down
9 changes: 0 additions & 9 deletions Hypercube.Client/Graphics/Texturing/TextureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public TextureManager()
StbImage.stbi_set_flip_vertically_on_load(1);
}


#region PublicAPI

public ITextureHandle GetTextureHandle(ResourcePath path, ITextureCreationSettings settings)
{
return GetTextureHandleInternal(path, settings);
Expand All @@ -50,10 +47,6 @@ public ITextureHandle GetTextureHandle(ITexture texture, ITextureCreationSetting
return GetTextureHandleInternal(texture.Path, settings);
}

#endregion

#region Internal

internal ITexture GetTextureInternal(ResourcePath path)
{
var texture = CreateTexture(path);
Expand Down Expand Up @@ -87,6 +80,4 @@ internal ITextureHandle CreateTextureHandle(ITexture texture, ITextureCreationSe
{
return new TextureHandle(texture, settings);
}

#endregion
}
13 changes: 9 additions & 4 deletions Hypercube.Client/Resources/Caching/ResourceCacher.Preload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ public partial class ResourceCacher

public void PreloadTextures()
{
var container = DependencyManager.GetContainer();
PreloadTextures(container);
PreloadShaders(container);
PreloadAudio(container);
PreloadTextures(_container);
}
public void PreloadShaders()
{
PreloadShaders(_container);
}
public void PreloadAudio()
{
PreloadAudio(_container);
}

private void PreloadTextures(DependenciesContainer container)
Expand Down
2 changes: 2 additions & 0 deletions Hypercube.Shared/Resources/Caching/IResourceCacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ void CacheResource<T>(ResourcePath path, T resource)
where T : Resource.Resource, new();

void PreloadTextures();
void PreloadShaders();
void PreloadAudio();
}

0 comments on commit f90493c

Please sign in to comment.