Skip to content

Add common DragCubeTool, now with caching#1

Merged
siimav merged 3 commits into
masterfrom
MyGodItsFullOfDragCubes
Jul 23, 2025
Merged

Add common DragCubeTool, now with caching#1
siimav merged 3 commits into
masterfrom
MyGodItsFullOfDragCubes

Conversation

@siimav

@siimav siimav commented Sep 1, 2024

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Sep 1, 2024

Copy link
Copy Markdown

Download the artifacts for this pull request:

Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated

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

Copy link
Copy Markdown
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

Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Magic constant

Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
Comment thread Source/ROUtils/Utils/DragCubeTool.cs Outdated
@siimav siimav force-pushed the MyGodItsFullOfDragCubes branch from fc2a1fa to f6b6b75 Compare July 23, 2025 20:47
@siimav siimav merged commit c9ad102 into master Jul 23, 2025
3 checks passed
@siimav siimav deleted the MyGodItsFullOfDragCubes branch July 23, 2025 20:49
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