-
Notifications
You must be signed in to change notification settings - Fork 55
feat(): grid labels #199
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
Open
ShaMan123
wants to merge
7
commits into
ThatOpen:main
Choose a base branch
from
ShaMan123:feat/grid-labels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(): grid labels #199
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d0e86f9
feat(): grid labels
ShaMan123 d42a30d
fix(): expose getter/setter + dispose
ShaMan123 66a911a
refactor(): next line + label under axis group
ShaMan123 208656d
expose label
ShaMan123 7bf1820
refine example
ShaMan123 dd23b4f
add offset to config
ShaMan123 11248eb
review
ShaMan123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,46 @@ | ||
| import * as THREE from "three"; | ||
| import { | ||
| AttributesUniqueValuesParams, | ||
| AttrsChange, | ||
| BIMMesh, | ||
| MaterialDefinition, | ||
| CurrentLod, | ||
| Identifier, | ||
| ItemInformationType, | ||
| ItemsDataConfig, | ||
| RectangleRaycastData, | ||
| RaycastData, | ||
| SnappingRaycastData, | ||
| VirtualModelConfig, | ||
| ItemSelectionType, | ||
| ItemInformationType, | ||
| SelectionInputType, | ||
| ResultInputType, | ||
| AttrsChange, | ||
| Identifier, | ||
| RelsChange, | ||
| ItemsQueryParams, | ||
| AttributesUniqueValuesParams, | ||
| CurrentLod, | ||
| ItemsQueryConfig, | ||
| ItemsQueryParams, | ||
| LodMode, | ||
| MaterialDefinition, | ||
| RaycastData, | ||
| RectangleRaycastData, | ||
| RelsChange, | ||
| ResultInputType, | ||
| SelectionInputType, | ||
| SnappingRaycastData, | ||
| VirtualModelConfig, | ||
| } from "./model-types"; | ||
|
|
||
| import { MiscHelper } from "../utils"; | ||
| import { FragmentsConnection } from "../multithreading/fragments-connection"; | ||
| import { MiscHelper } from "../utils"; | ||
| import { MeshManager } from "./mesh-manager"; | ||
|
|
||
| import { AlignmentsManager } from "./alignments-manager"; | ||
| import { DataMap, EditRequest, Event } from "../../../Utils"; | ||
| import { SetupManager } from "./setup-manager"; | ||
| import { Editor } from "../edit"; | ||
| import { AlignmentsManager } from "./alignments-manager"; | ||
| import { BoxManager } from "./box-manager"; | ||
| import { CoordinatesManager } from "./coordinates-manager"; | ||
| import { DataManager } from "./data-manager"; | ||
| import { EditManager } from "./edit-manager"; | ||
| import { GridsConfig, GridsManager } from "./grids-manager"; | ||
| import { HighlightManager } from "./highlight-manager"; | ||
| import { ItemsManager } from "./items-manager"; | ||
| import { ViewManager } from "./view-manager"; | ||
| import { RaycastManager } from "./raycast-manager"; | ||
| import { VisibilityManager } from "./visibility-manager"; | ||
| import { HighlightManager } from "./highlight-manager"; | ||
| import { SectionManager } from "./section-manager"; | ||
| import { DataManager } from "./data-manager"; | ||
| import { SequenceManager } from "./sequence-manager"; | ||
| import { EditManager } from "./edit-manager"; | ||
| import { Editor } from "../edit"; | ||
| import { GridsManager } from "./grids-manager"; | ||
| import { SetupManager } from "./setup-manager"; | ||
| import { ViewManager } from "./view-manager"; | ||
| import { VisibilityManager } from "./visibility-manager"; | ||
|
|
||
| /** | ||
| * The main class for managing a 3D model loaded from a fragments file. Handles geometry, materials, visibility, highlighting, sections, and more. This class orchestrates multiple specialized managers to handle different aspects of the model like mesh management, item data, raycasting, etc. It maintains the overall state and provides the main interface for interacting with the model. The model data is loaded and processed asynchronously across multiple threads. | ||
|
|
@@ -492,7 +492,7 @@ export class FragmentsModel { | |
| this.modelId, | ||
| "getAttributesUniqueValues", | ||
| [params], | ||
| )) as Record<string, { value: any, localIds: number[] }[]>; | ||
| )) as Record<string, { value: any; localIds: number[] }[]>; | ||
| return values; | ||
| } | ||
|
|
||
|
|
@@ -651,18 +651,26 @@ export class FragmentsModel { | |
| /** | ||
| * Get the grids of the model (if any). | ||
| * | ||
| * Returns a `THREE.Group` with one child per grid (each child carries | ||
| * `userData.id = localId` and `userData.kind = "grid"`). Each grid's | ||
| * children are `THREE.Line` instances with `userData.kind = "axis"`, | ||
| * `userData.tag` (the axis label), and `userData.axis` ("uAxes", | ||
| * "vAxes", or "wAxes"). | ||
| * Returns a `THREE.Group` with one child per grid (each child is a `THREE.Group` | ||
| * that carries `userData.id = localId` and `userData.kind = "grid"`). | ||
| * | ||
| * Each grid's children are `THREE.Group` instances with `userData.kind = "axis"`, | ||
| * acting as an axis container. | ||
| * A `THREE.LINE` instance with `userData.kind = "line"` is appended to it. | ||
| * | ||
| * When opting in to showing labels, two `THREE.SHAPE` instances with | ||
| * `userData.kind = "label"` and `userData.index` (the label's index, `0` or `1`) | ||
| * are appended to the axis container. | ||
| * | ||
| * All grid's descendants (`"axis"`, `"line"`, `"label"`) carry `userData.tag` (the axis label value) | ||
| * and `userData.axis` (`"uAxes"`, `"vAxes"`, or `"wAxes"`). | ||
| */ | ||
| async getGrids() { | ||
| return this._gridsManager.getGrids(); | ||
| async getGrids(config?: GridsConfig) { | ||
| return this._gridsManager.getGrids(config); | ||
| } | ||
|
|
||
| /** | ||
| * The shared `LineDashedMaterial` used to render every grid axis line. | ||
| * The shared material used to render every grid axis line. | ||
| * Mutating its properties (color, opacity, dash sizes, etc.) updates all | ||
| * rendered grid lines immediately. Use `setGridMaterial` to swap to a | ||
| * different material instance. | ||
|
|
@@ -675,10 +683,28 @@ export class FragmentsModel { | |
| * Replace the shared grid material. The previous material is disposed | ||
| * after the swap. | ||
| */ | ||
| setGridMaterial(material: THREE.LineDashedMaterial) { | ||
| setGridMaterial(material: THREE.LineBasicMaterial) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps I should add that the default is a dash line material |
||
| this._gridsManager.setGridMaterial(material); | ||
| } | ||
|
|
||
| /** | ||
| * The shared material used to render every grid axis label. | ||
| * Mutating its properties (color, opacity, dash sizes, etc.) updates all | ||
| * rendered grid labels immediately. Use `setGridLabelMaterial` to swap to a | ||
| * different material instance. | ||
| */ | ||
| getGridLabelMaterial() { | ||
| return this._gridsManager.getLabelMaterial(); | ||
| } | ||
|
|
||
| /** | ||
| * Replace the shared grid label material. The previous material is disposed | ||
| * after the swap. | ||
| */ | ||
| setGridLabelMaterial(material: THREE.Material) { | ||
| this._gridsManager.setLabelMaterial(material); | ||
| } | ||
|
|
||
| /** | ||
| * Sets a camera for the model. The model will use it to load tiles dinamically depending on the users view | ||
| * (e.g. hiding items that are not in the view, setting the LOD to far away items, etc). | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we should run prettier on the entire repo to it cleanup and include organizing imports.
We should also add
.vscode/settings.jsonto cover organizing imports.If you are troubled by the noise in the diff I will revert and cleanup.