-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Use linear color #335
Conversation
WalkthroughThis 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
Suggested reviewers
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit 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. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 maintainabilityThe 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 of0.5225215539683921
) without noticeable visual impact.packages/gizmo/src/icon/Icon.ts (1)
43-46
: Consolidate gray/blue magic numbersThe 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 bothsetGray
and the constructor.packages/outline/src/OutlineManager.ts (1)
60-61
: Centralize outline color definitionsThe 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 literalThe new red shade
(1.0, 0.0509, 0.0509, 1.0)
aligns with the palette. To avoid duplication withNavigationGizmo.ts
, consider centralizing this value into a shared theme constant.
42-42
: Extract green material color literalThe 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 literalThe 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 literalThe 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
📒 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 overrideThe 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... linearcolorMax
: 0.7 sRGB → 0.44798... linearThis 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.
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) | ||
); |
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix static context usage and approve linear color conversions.
Issues to address:
-
Static context usage: Using
this
in static methods is confusing and should be replaced with the class nameUtils
. -
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.
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.
Please check if the PR fulfills these requirements
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