Skip to content

Use linear color #335

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

Merged

Conversation

zhuxudong
Copy link
Member

@zhuxudong zhuxudong commented May 23, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

Summary by CodeRabbit

  • Style
    • Updated various interface colors to use more nuanced and precise shades for axes, icons, outlines, navigation gizmo elements, and skeleton viewer visuals. These changes result in improved visual consistency and a more refined look across the application. No changes to functionality or controls.

Copy link

coderabbitai bot commented May 23, 2025

Walkthrough

This update standardizes and refines the RGBA color values used throughout several visualization and utility classes. The changes affect the initialization of color properties and materials, adjusting their red, green, and blue components to more precise floating-point values. No logic, control flow, or public API signatures are altered.

Changes

File(s) Change Summary
packages/gizmo/src/Axis.ts Updated the green component of _yellowColor and the RGB values of _grayColor to more precise values.
packages/gizmo/src/Utils.ts Refined the RGB color values for various static materials and meshes in the Utils.init method, including translation, rotation, scaling, and rectangle states. Adjusted the axis arrow mesh cone height.
packages/gizmo/src/icon/Icon.ts Adjusted the RGBA values for gray and blue base colors in the Icon class constructor and setGray method to more nuanced values.
packages/navigation-gizmo/src/NavigationGizmo.ts Changed the color parameters for the positive X, Y, and Z axis ends to more precise RGBA values in the _createEnd method calls.
packages/navigation-gizmo/src/Utils.ts Updated the baseColor property of several PlainColorMaterial instances to use more precise RGBA values for red, green, blue, and grey materials.
packages/outline/src/OutlineManager.ts Modified the default RGBA values of _outlineMainColor and _outlineSubColor to deeper, more saturated tones.
packages/skeleton-viewer/src/SkeletonViewer.ts Changed the default values of colorMin and colorMax properties to darker and medium gray tones, respectively.

Suggested reviewers

  • cptbtptpbcptdtptp

Poem

In the palette of code, new colors arise,
Soft grays and bold reds now dazzle our eyes.
From skeletons shaded to icons anew,
Each line a brushstroke, each value a hue.
With every commit, the spectrum expands—
A rabbit’s delight in these colorful lands!
🐇🎨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cptbtptpbcptdtptp cptbtptpbcptdtptp merged commit 2296668 into galacean:main May 23, 2025
1 check passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (7)
packages/gizmo/src/Axis.ts (1)

9-10: Extract magic color literals for maintainability

The updated RGBA values for _yellowColor and _grayColor correctly implement the refined palette. To avoid scattering precision-heavy literals across components, consider moving these hardcoded colors into a shared constants or theme module. This will improve maintainability and ensure consistency if these values need tweaking again.
Also, you may round the float precision (e.g., 0.5225 instead of 0.5225215539683921) without noticeable visual impact.

packages/gizmo/src/icon/Icon.ts (1)

43-46: Consolidate gray/blue magic numbers

The new gray (0.5225,0.5225,0.5225,1) and blue (0,0.3372,1,1) baseColor values align with the updated theme. To prevent divergence, extract these literals into shared color constants or a theme file, rather than duplicating them in both setGray and the constructor.

packages/outline/src/OutlineManager.ts (1)

60-61: Centralize outline color definitions

The adjusted _outlineMainColor and _outlineSubColor reflect the PR’s new color scheme. To maintain consistency across all outline-related components, consider extracting these into a shared palette module or constants file. This reduces duplication and risk of mismatched values in the future.

packages/navigation-gizmo/src/Utils.ts (4)

37-37: Extract red material color literal

The new red shade (1.0, 0.0509, 0.0509, 1.0) aligns with the palette. To avoid duplication with NavigationGizmo.ts, consider centralizing this value into a shared theme constant.


42-42: Extract green material color literal

The updated green (0.2140, 0.6038, 0.0331, 1.0) matches the axis end theme. Centralizing these magic numbers will improve maintainability.


47-47: Extract blue material color literal

The refined blue (0.0732, 0.2140, 1.0, 1.0) is correct. To prevent mismatches, pull this literal into a shared palette.


57-57: Extract grey material color literal

The grey (0.2140, 0.2140, 0.2140, 1) now aligns with the theme. As with other colors, centralizing it will reduce duplication.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd15cdd and 2adc22c.

📒 Files selected for processing (7)
  • packages/gizmo/src/Axis.ts (1 hunks)
  • packages/gizmo/src/Utils.ts (1 hunks)
  • packages/gizmo/src/icon/Icon.ts (2 hunks)
  • packages/navigation-gizmo/src/NavigationGizmo.ts (1 hunks)
  • packages/navigation-gizmo/src/Utils.ts (2 hunks)
  • packages/outline/src/OutlineManager.ts (1 hunks)
  • packages/skeleton-viewer/src/SkeletonViewer.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/navigation-gizmo/src/Utils.ts (1)
packages/custom-material/src/plain-color/PlainColorMaterial.ts (1)
  • PlainColorMaterial (6-42)
🪛 Biome (1.9.4)
packages/gizmo/src/Utils.ts

[error] 58-58: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 65-65: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 73-73: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 80-80: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 88-88: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 95-95: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 103-103: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 106-106: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 113-113: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 120-120: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 127-127: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 128-128: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 130-130: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 132-132: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 135-135: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 142-142: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 149-149: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 156-156: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 163-163: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 170-170: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 173-173: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 180-180: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

🔇 Additional comments (3)
packages/gizmo/src/icon/Icon.ts (1)

104-105: Verify default baseColor override

The constructor now applies the refined blue shade by default. Ensure no downstream logic or styling relies on the previous default (0, 157/255, 1). You may run a search for any direct uses of the old values to confirm that this change has no unintended side effects.

packages/skeleton-viewer/src/SkeletonViewer.ts (1)

33-35: Excellent color space conversion to linear values!

The updated color values appear to be properly converted from sRGB to linear color space using gamma correction (approximately 2.2 gamma). This is a significant improvement for graphics rendering accuracy.

  • colorMin: 0.35 sRGB → 0.10048... linear
  • colorMax: 0.7 sRGB → 0.44798... linear

This ensures colors are correctly represented in the linear color space used by the graphics pipeline.

packages/gizmo/src/Utils.ts (1)

184-184: Note geometric change to axis arrow.

The cone height for axisArrowMesh has been reduced from 0.3 to approximately 0.073. This appears to be intentional sizing adjustment that aligns with the overall visual refinements in this PR.

Comment on lines +189 to +209
this._createEnd(
endXEntity,
utils.xEndTranslateVector,
utils.redMaterial,
"X",
new Color(1.0, 0.05087608817155679, 0.05087608817155679, 1.0)
);
this._createEnd(
endYEntity,
utils.yEndTranslateVector,
utils.greenMaterial,
"Y",
new Color(0.21404114048223255, 0.6038273388553378, 0.033104766570885055, 1.0)
);
this._createEnd(
endZEntity,
utils.zEndTranslateVector,
utils.blueMaterial,
"Z",
new Color(0.07323895587840543, 0.21404114048223255, 1.0, 1.0)
);
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Abstract end-marker color literals

The RGBA tweaks for the positive axis ends (X, Y, Z) correctly follow the refined palette. However, these magic numbers are duplicated in both this file and Utils.ts. Extract them into a single source of truth (e.g., a ColorPalette constant) to prevent future drift.
Also, please confirm these precise decimal values match design requirements.


🏁 Script executed:

#!/bin/bash
set -e

# Locate all Utils.ts files in the repo
UTIL_FILES=$(fd --extension ts Utils.ts)
echo "Found Utils files:"
echo "$UTIL_FILES"

# Search for the specific magic RGBA values in those Utils.ts files
rg "0\.05087608817155679|0\.21404114048223255|0\.6038273388553378|0\.033104766570885055|0\.07323895587840543" -n $UTIL_FILES || echo "No matches found in Utils.ts"

Length of output: 2777


Abstract end-marker colors into a shared palette

The RGBA values for the positive‐axis ends (X, Y, Z) are currently duplicated in:

  • packages/navigation-gizmo/src/NavigationGizmo.ts
  • packages/navigation-gizmo/src/Utils.ts
  • packages/gizmo/src/Utils.ts (multiple occurrences)

To prevent drift and simplify future tweaks, extract these three colors into a single ColorPalette constant (e.g. in a new common or core module) and import it everywhere instead of using hard-coded literals. Also, please confirm that the decimal values below exactly match the design spec before finalizing:

• X-end: (1.0, 0.05087608817155679, 0.05087608817155679, 1.0)
• Y-end: (0.21404114048223255, 0.6038273388553378, 0.033104766570885055, 1.0)
• Z-end: (0.07323895587840543, 0.21404114048223255, 1.0, 1.0)

🤖 Prompt for AI Agents
In packages/navigation-gizmo/src/NavigationGizmo.ts around lines 189 to 209, the
RGBA color values for the positive axis ends (X, Y, Z) are hard-coded and
duplicated in multiple files including Utils.ts. To fix this, extract these
color values into a single shared ColorPalette constant in a new common or core
module, then replace all hard-coded instances in NavigationGizmo.ts and all
Utils.ts files with imports from this shared palette. Also verify that the
decimal values exactly match the design specifications before finalizing the
change.

Comment on lines +58 to 180
0.21404114048223255,
1.0
);
Utils.lightBlueMaterial = this._createPlainColorMaterial(
engine,
State.translate,
0.07323895587840543,
0.21404114048223255,
1.0,
0.9
);
Utils.invisibleMaterialTrans = this._createPlainColorMaterial(engine, State.translate, 0, 0, 0, 0);

// rotate material
Utils.redArcMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.25, 0.25);
Utils.greenArcMaterial = this._createPlainColorMaterial(engine, State.rotate, 0.5, 0.8, 0.2);
Utils.blueArcMaterial = this._createPlainColorMaterial(engine, State.rotate, 0.3, 0.5, 1.0);
Utils.yellowMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.95, 0.0, 1.0);
Utils.rotatePlaneMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.95, 0.0, 0.2);
Utils.redArcMaterial = this._createPlainColorMaterial(
engine,
State.rotate,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.greenArcMaterial = this._createPlainColorMaterial(
engine,
State.rotate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.blueArcMaterial = this._createPlainColorMaterial(
engine,
State.rotate,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.yellowMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0);
Utils.rotatePlaneMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0, 0.2);
Utils.rotatePlaneMaterial.renderState.rasterState.cullMode = CullMode.Off;
Utils.invisibleMaterialRotate = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
Utils.invisibleMaterialRotate.renderState.rasterState.cullMode = CullMode.Off;
Utils.invisibleMaterialCircle = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);

// scale material
Utils.redMaterialScale = this._createPlainColorMaterial(engine, State.scale, 1.0, 0.25, 0.25, 1.0);
Utils.greenMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0.5, 0.8, 0.2, 1.0);
Utils.blueMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0.3, 0.5, 1.0, 1.0);
Utils.greyMaterial = this._createPlainColorMaterial(engine, State.scale, 0.75, 0.75, 0.75, 1.0);
Utils.lightMaterial = this._createPlainColorMaterial(engine, State.scale, 0.7, 0.7, 0.7, 1.0);
Utils.redMaterialScale = this._createPlainColorMaterial(
engine,
State.scale,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.greenMaterialScale = this._createPlainColorMaterial(
engine,
State.scale,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.blueMaterialScale = this._createPlainColorMaterial(
engine,
State.scale,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.greyMaterial = this._createPlainColorMaterial(
engine,
State.scale,
0.5225215539683921,
0.5225215539683921,
0.5225215539683921
);
Utils.lightMaterial = this._createPlainColorMaterial(
engine,
State.scale,
0.44798841244188325,
0.44798841244188325,
0.44798841244188325
);
Utils.invisibleMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0, 0, 0, 0);

// rect material
Utils.visibleMaterialRect = this._createPlainColorMaterial(engine, State.rect, 163 / 255, 171 / 255, 180 / 255, 1);
Utils.visibleMaterialRect = this._createPlainColorMaterial(
engine,
State.rect,
0.3662525955988395,
0.4072402119017367,
0.45641102318040466
);
Utils.invisibleMaterialRect = this._createPlainColorMaterial(engine, State.rect, 0, 0, 0, 0);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix static context usage and approve linear color conversions.

Issues to address:

  1. Static context usage: Using this in static methods is confusing and should be replaced with the class name Utils.

  2. Linear color conversion: The color value updates appear to be proper sRGB to linear color space conversions, which is excellent for graphics accuracy.

Apply this diff to fix the static context usage:

-    Utils.redMaterialTrans = this._createPlainColorMaterial(
+    Utils.redMaterialTrans = Utils._createPlainColorMaterial(
-    Utils.lightRedMaterial = this._createPlainColorMaterial(
+    Utils.lightRedMaterial = Utils._createPlainColorMaterial(
-    Utils.greenMaterialTrans = this._createPlainColorMaterial(
+    Utils.greenMaterialTrans = Utils._createPlainColorMaterial(
-    Utils.lightGreenMaterial = this._createPlainColorMaterial(
+    Utils.lightGreenMaterial = Utils._createPlainColorMaterial(
-    Utils.blueMaterialTrans = this._createPlainColorMaterial(
+    Utils.blueMaterialTrans = Utils._createPlainColorMaterial(
-    Utils.lightBlueMaterial = this._createPlainColorMaterial(
+    Utils.lightBlueMaterial = Utils._createPlainColorMaterial(
-    Utils.invisibleMaterialTrans = this._createPlainColorMaterial(engine, State.translate, 0, 0, 0, 0);
+    Utils.invisibleMaterialTrans = Utils._createPlainColorMaterial(engine, State.translate, 0, 0, 0, 0);
-    Utils.redArcMaterial = this._createPlainColorMaterial(
+    Utils.redArcMaterial = Utils._createPlainColorMaterial(
-    Utils.greenArcMaterial = this._createPlainColorMaterial(
+    Utils.greenArcMaterial = Utils._createPlainColorMaterial(
-    Utils.blueArcMaterial = this._createPlainColorMaterial(
+    Utils.blueArcMaterial = Utils._createPlainColorMaterial(
-    Utils.yellowMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0);
+    Utils.yellowMaterial = Utils._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0);
-    Utils.rotatePlaneMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0, 0.2);
+    Utils.rotatePlaneMaterial = Utils._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0, 0.2);
-    Utils.invisibleMaterialRotate = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
+    Utils.invisibleMaterialRotate = Utils._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
-    Utils.invisibleMaterialCircle = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
+    Utils.invisibleMaterialCircle = Utils._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
-    Utils.redMaterialScale = this._createPlainColorMaterial(
+    Utils.redMaterialScale = Utils._createPlainColorMaterial(
-    Utils.greenMaterialScale = this._createPlainColorMaterial(
+    Utils.greenMaterialScale = Utils._createPlainColorMaterial(
-    Utils.blueMaterialScale = this._createPlainColorMaterial(
+    Utils.blueMaterialScale = Utils._createPlainColorMaterial(
-    Utils.greyMaterial = this._createPlainColorMaterial(
+    Utils.greyMaterial = Utils._createPlainColorMaterial(
-    Utils.lightMaterial = this._createPlainColorMaterial(
+    Utils.lightMaterial = Utils._createPlainColorMaterial(
-    Utils.invisibleMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0, 0, 0, 0);
+    Utils.invisibleMaterialScale = Utils._createPlainColorMaterial(engine, State.scale, 0, 0, 0, 0);
-    Utils.visibleMaterialRect = this._createPlainColorMaterial(
+    Utils.visibleMaterialRect = Utils._createPlainColorMaterial(
-    Utils.invisibleMaterialRect = this._createPlainColorMaterial(engine, State.rect, 0, 0, 0, 0);
+    Utils.invisibleMaterialRect = Utils._createPlainColorMaterial(engine, State.rect, 0, 0, 0, 0);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Utils.redMaterialTrans = this._createPlainColorMaterial(
engine,
State.translate,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.lightRedMaterial = this._createPlainColorMaterial(
engine,
State.translate,
1.0,
0.05087608817155679,
0.05087608817155679,
0.9
);
Utils.greenMaterialTrans = this._createPlainColorMaterial(
engine,
State.translate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.lightGreenMaterial = this._createPlainColorMaterial(
engine,
State.translate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055,
0.9
);
Utils.blueMaterialTrans = this._createPlainColorMaterial(
engine,
State.translate,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.lightBlueMaterial = this._createPlainColorMaterial(
engine,
State.translate,
0.07323895587840543,
0.21404114048223255,
1.0,
0.9
);
Utils.invisibleMaterialTrans = this._createPlainColorMaterial(engine, State.translate, 0, 0, 0, 0);
// rotate material
Utils.redArcMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.25, 0.25);
Utils.greenArcMaterial = this._createPlainColorMaterial(engine, State.rotate, 0.5, 0.8, 0.2);
Utils.blueArcMaterial = this._createPlainColorMaterial(engine, State.rotate, 0.3, 0.5, 1.0);
Utils.yellowMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.95, 0.0, 1.0);
Utils.rotatePlaneMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.95, 0.0, 0.2);
Utils.redArcMaterial = this._createPlainColorMaterial(
engine,
State.rotate,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.greenArcMaterial = this._createPlainColorMaterial(
engine,
State.rotate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.blueArcMaterial = this._createPlainColorMaterial(
engine,
State.rotate,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.yellowMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0);
Utils.rotatePlaneMaterial = this._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0, 0.2);
Utils.rotatePlaneMaterial.renderState.rasterState.cullMode = CullMode.Off;
Utils.invisibleMaterialRotate = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
Utils.invisibleMaterialRotate.renderState.rasterState.cullMode = CullMode.Off;
Utils.invisibleMaterialCircle = this._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
// scale material
Utils.redMaterialScale = this._createPlainColorMaterial(engine, State.scale, 1.0, 0.25, 0.25, 1.0);
Utils.greenMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0.5, 0.8, 0.2, 1.0);
Utils.blueMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0.3, 0.5, 1.0, 1.0);
Utils.greyMaterial = this._createPlainColorMaterial(engine, State.scale, 0.75, 0.75, 0.75, 1.0);
Utils.lightMaterial = this._createPlainColorMaterial(engine, State.scale, 0.7, 0.7, 0.7, 1.0);
Utils.redMaterialScale = this._createPlainColorMaterial(
engine,
State.scale,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.greenMaterialScale = this._createPlainColorMaterial(
engine,
State.scale,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.blueMaterialScale = this._createPlainColorMaterial(
engine,
State.scale,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.greyMaterial = this._createPlainColorMaterial(
engine,
State.scale,
0.5225215539683921,
0.5225215539683921,
0.5225215539683921
);
Utils.lightMaterial = this._createPlainColorMaterial(
engine,
State.scale,
0.44798841244188325,
0.44798841244188325,
0.44798841244188325
);
Utils.invisibleMaterialScale = this._createPlainColorMaterial(engine, State.scale, 0, 0, 0, 0);
// rect material
Utils.visibleMaterialRect = this._createPlainColorMaterial(engine, State.rect, 163 / 255, 171 / 255, 180 / 255, 1);
Utils.visibleMaterialRect = this._createPlainColorMaterial(
engine,
State.rect,
0.3662525955988395,
0.4072402119017367,
0.45641102318040466
);
Utils.invisibleMaterialRect = this._createPlainColorMaterial(engine, State.rect, 0, 0, 0, 0);
Utils.redMaterialTrans = Utils._createPlainColorMaterial(
engine,
State.translate,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.lightRedMaterial = Utils._createPlainColorMaterial(
engine,
State.translate,
1.0,
0.05087608817155679,
0.05087608817155679,
0.9
);
Utils.greenMaterialTrans = Utils._createPlainColorMaterial(
engine,
State.translate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.lightGreenMaterial = Utils._createPlainColorMaterial(
engine,
State.translate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055,
0.9
);
Utils.blueMaterialTrans = Utils._createPlainColorMaterial(
engine,
State.translate,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.lightBlueMaterial = Utils._createPlainColorMaterial(
engine,
State.translate,
0.07323895587840543,
0.21404114048223255,
1.0,
0.9
);
Utils.invisibleMaterialTrans = Utils._createPlainColorMaterial(engine, State.translate, 0, 0, 0, 0);
// rotate material
Utils.redArcMaterial = Utils._createPlainColorMaterial(
engine,
State.rotate,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.greenArcMaterial = Utils._createPlainColorMaterial(
engine,
State.rotate,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.blueArcMaterial = Utils._createPlainColorMaterial(
engine,
State.rotate,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.yellowMaterial = Utils._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0);
Utils.rotatePlaneMaterial = Utils._createPlainColorMaterial(engine, State.rotate, 1.0, 0.8900054069935289, 0.0, 0.2);
Utils.rotatePlaneMaterial.renderState.rasterState.cullMode = CullMode.Off;
Utils.invisibleMaterialRotate = Utils._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
Utils.invisibleMaterialRotate.renderState.rasterState.cullMode = CullMode.Off;
Utils.invisibleMaterialCircle = Utils._createPlainColorMaterial(engine, State.rotate, 0, 0, 0, 0);
// scale material
Utils.redMaterialScale = Utils._createPlainColorMaterial(
engine,
State.scale,
1.0,
0.05087608817155679,
0.05087608817155679
);
Utils.greenMaterialScale = Utils._createPlainColorMaterial(
engine,
State.scale,
0.21404114048223255,
0.6038273388553378,
0.033104766570885055
);
Utils.blueMaterialScale = Utils._createPlainColorMaterial(
engine,
State.scale,
0.07323895587840543,
0.21404114048223255,
1.0
);
Utils.greyMaterial = Utils._createPlainColorMaterial(
engine,
State.scale,
0.5225215539683921,
0.5225215539683921,
0.5225215539683921
);
Utils.lightMaterial = Utils._createPlainColorMaterial(
engine,
State.scale,
0.44798841244188325,
0.44798841244188325,
0.44798841244188325
);
Utils.invisibleMaterialScale = Utils._createPlainColorMaterial(engine, State.scale, 0, 0, 0, 0);
// rect material
Utils.visibleMaterialRect = Utils._createPlainColorMaterial(
engine,
State.rect,
0.3662525955988395,
0.4072402119017367,
0.45641102318040466
);
Utils.invisibleMaterialRect = Utils._createPlainColorMaterial(engine, State.rect, 0, 0, 0, 0);
🧰 Tools
🪛 Biome (1.9.4)

[error] 58-58: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 65-65: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 73-73: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 80-80: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 88-88: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 95-95: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 103-103: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 106-106: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 113-113: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 120-120: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 127-127: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 128-128: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 130-130: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 132-132: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 135-135: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 142-142: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 149-149: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 156-156: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 163-163: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 170-170: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 173-173: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 180-180: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

🤖 Prompt for AI Agents
In packages/gizmo/src/Utils.ts between lines 58 and 180, replace all instances
of 'this' used in static methods with the class name 'Utils' to avoid confusion
and adhere to proper static context usage. The linear color conversions are
correct and should be kept as is.

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