Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common DragCubeTool, now with caching #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

siimav
Copy link
Contributor

@siimav siimav commented Sep 1, 2024

Rendering the same drag cube for the 10th time isn't a particularly good use of resources.

Copy link

github-actions bot commented Sep 1, 2024

Download the artifacts for this pull request:

Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved

if (_cacheDict.Count > MaxCacheSize)
{
Debug.Log($"[DragCubeTool] Cache limit reached ({_cacheDict.Count} / {MaxCacheSize}), emptying...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there's no collection type that does LRU or something


private static bool VectorsNearlyEqual(Vector3 v1, Vector3 v2)
{
return (v1 - v2).sqrMagnitude < 2.5E-5f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic constant

Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
Source/ROUtils/Utils/DragCubeTool.cs Outdated Show resolved Hide resolved
@siimav siimav force-pushed the MyGodItsFullOfDragCubes branch from 3e6da24 to 0fdcab3 Compare September 20, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants