Open
Conversation
Added outline opacity
StandardMaterial (_opaque/_transparent) was never used for rendering — all VIM meshes use ModelMaterial. Removed the fields, modelColor, sectionStroke*, useFastMaterials, standard, and section settings that were wired exclusively to them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This branch is a major architectural overhaul preparing vim-web for the 1.0 release. It covers five broad areas: a new public API surface, a complete outline rendering rewrite, a GPU picking system, geometry loading performance, and a thorough dead code purge.
Public API & Exports
ViewerApiabstraction: Both WebGL and Ultra viewers now expose a unifiedViewerApihandle (WebglViewerApi/UltraViewerApi) throughVIM.React.Webgl.createViewer()andVIM.React.Ultra.createViewer(). Direct class access is no longer needed for any common use case.I-prefixed interfaces (IVim,ICamera,ISelectable,IMarker,IMaterials, etc.). Concrete classes are@internal.viewer.core.settingsremoved: Settings are consumed at construction time only — exposing them as a field was misleading. Removed fromIWebglViewer.IMaterialsnow only exposes user-facing properties (ghostOpacity,ghostColor,outlineOpacity,outlineThickness,outlineColor,clippingPlanes). Internal system materials are hidden behind asystemgetter.Element3Dinterface:IElement3Dexposes only BIM-facing properties; mesh internals are hidden.viewer.core.inputswith typedPointerModeenum, configurable key handlers, and clean mouse/touch callbacks. Removed spacebar bindings.snap()/lerp(duration)API for instant vs animated camera moves. Unifiedframe(),orbit(),orbitTowards(),zoomTo(). RemovedlookAtparameter. Rotation axes clarified (x = horizontal/yaw, y = vertical/pitch).viewer.react.camera→viewer.framingfor clarity.onXxxevent properties typed as read-only signal interfaces, not mutable dispatchers.container,isolation,sectionBox, etc.), control bar customization via hook param, no leaked RPC internals.GPU Picking (WebGL)
Replaced CPU raycasting as the primary picking method with a GPU-based approach:
vimIndex << 24 | elementIndex), depth, and surface normals per fragment.packPickingId()/unpackPickingId()utilities pre-pack IDs at mesh build time — zero overhead per frame.packedIdattribute withMARKER_VIM_INDEXsentinel).GpuPickerreads a 1×1 region on click, resolves vim + element in one readback.raycaster.ts) retained as fallback.Outline Rendering Rewrite
The outline effect was completely rewritten from depth-based to mask-based silhouette detection:
Pipeline:
Scene (MSAA) → Selection Mask → Outline Edge Detect → Merge → ScreenmaskMaterialto a dedicated render target. Edge detection runs on the mask, not the depth buffer — eliminates depth precision artifacts at long range.scene.backgroundfix: Background color was leaking into the mask buffer and breaking edge detection. Background is now nulled during the outline composer render and restored after.thicknessuniform (range 1–5) controls how many Chebyshev ring levels are sampled per fragment. Higher values = thicker outlines at a proportional sampling cost.outlineOpacity(0–1) andoutlineColorexposed onIMaterials. Both live on the merge pass for clean separation.camera,depthBuffer,color,precisionand associated uniforms removed fromOutlineMaterial.OutlinePassno longer receives or wires a camera.Material System Cleanup
StandardMaterialremoved:_opaque/_transparentStandardMaterialfields deleted fromMaterials. VIM meshes have always usedModelMaterial(custom GLSL3 shader) —StandardMaterialwas never in the rendering path.skybox,skylight,sunlights— defined, parsed, never consumeduseFastMaterials,materials.standard.color— toggle with no effectmaterials.section.strokeWidth/Falloff/Color— only applied toStandardMaterialshader, which was unusedmodelColor,sectionStroke*removed fromIMaterials— dead wiring to removed materials.MaterialSettingsnow contains onlyghostandoutline.MaterialSet: New value type{ opaque, transparent, hidden }for per-mesh material assignment.applyMaterial()helper is the single place that callsMaterialSet.get().Geometry Loading & Performance
DataTexture(25³ = 15,625 quantized colors).ModelMaterialreads colors viatexelFetch— no per-vertex color upload on color changes.texelFetch/ WebGL2: Replacedtexture2DwithtexelFetchin shaders for direct texel access.G3dSubsetand offsets: IntroducedG3dSubsetas a filtered view of G3d instances.G3dMeshOffsetspre-computes vertex/index counts per mesh for buffer allocation.InsertableGeometrychunking: Merged mesh geometry split at 16M indices to stay within buffer limits.InstancedMeshFactory: Instanced meshes (>5 instances) built with per-instancepackedIdandignoreattributes pre-packed at build time.vimx: Legacy vimx loading code removed.Camera & Controls
lockMovement/lockRotation: Per-axis movement and rotation locks onViewerSettings.camera.Ultra Viewer Updates
element.color = new RGBA32(...)overrides, aligned with WebGL API.nodeState→state: Renamed for clarity.element.state = VisibilityState.GHOSTED(enum:VISIBLE,HIDDEN,GHOSTED,HIGHLIGHTED).Gizmos
packedIdattribute for GPU picker hit detection.IGizmo*interfaces.Developer Experience
@internaltags: System-only classes and methods marked throughout.Breaking Changes
viewer.core.settingsremoved fromIWebglViewerStandardMaterial,modelColor,sectionStroke*removed fromIMaterialsMaterialSettings.useFastMaterials,.standard,.sectionremovedskybox,skylight,sunlightsremoved fromViewerSettingsviewer.react.camerarenamed toviewer.framingnodeStaterenamed tostate(Ultra); useVisibilityStateenuminputs.keyboard.registerKeyDown()lookAtparameter removed — useorbitTowards()orset(position, target)