Repository navigation
Export browser-ready 3D scenes (.glb, rvtio-scene/1) and standalone HTML viewer - #186
Closed
AndreyStartsev wants to merge 1 commit into
Closed
AndreyStartsev wants to merge 1 commit into
AndreyStartsev wants to merge 1 commit into
Conversation
…TML viewer - Add RvtIO.Scene public API (SceneExporter, ModelScene, SceneExportOptions, HtmlViewerExporter, HtmlViewerOptions, SceneJsonSerializer) - Export binary glTF 2.0 (.glb) with reusable symbol meshes, mirrored instance handling (det < 0), PBR materials/transparency, Z-up to Y-up conversion, and node.extras identity metadata - Export versioned rvtio-scene/1 JSON with compact Base64 mesh buffers, RTC large-coordinate centering, room/space volume boundaries, datum grids, and completeness reporting - Export self-contained zero-CDN WebGL 3D HTML viewer (.html) with orbit/pan/zoom, ViewCube, 3D raycast picking, category hierarchy search, property inspector, isolate/hide, X/Y/Z section box, 3D measurement, theme toggle, and strict XSS escaping - Wire CLI scene/viewer flags and format auto-detection (.glb, .html, --format scene-json) with ExportReport integration - Add 35 unit/CLI/XSS tests across net8.0 and net10.0 and DocFX guide (docs/scene-export.md) Closes IOExtend#24 Closes IOExtend#25
5 tasks
Collaborator
|
Thank you for contributing this implementation. We have revised the architecture for viewer support:
We are closing this PR in favor of that architecture. The integration remains tracked in #25; see the architecture update. The goal is still planned, rather than completed by closing this PR. Your implementation remains available as reference for the integration. If we reuse your work, we will preserve attribution and credit you as a co-author of the corresponding commits using Thank you again for the work on this feature. |
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.
What changes and why
Implements browser-ready 3D scene export (
.glbglTF 2.0 and versionedrvtio-scene/1JSON) and standalone zero-dependency 3D HTML viewer export (.html) directly from decoded.rvtprojects and.rfafamilies without Revit or external runtime dependencies.Closes #24
Closes #25
1. Browser-ready 3D scene export (
RvtIO.Scene— #24)SceneExporter,SceneExportOptions,ModelScene(SceneMesh,SceneSubmesh,SceneMaterial,SceneInstance,SceneElement,ScenePropertyGroup,SceneProperty,SceneGridLine,SceneCompleteness), andSceneJsonSerializer.GeoSolidprofiles with subtracted rectangular wall/slab openings, and spatial room/MEP space boundaries whenIncludeRooms = true.4x4transforms.det < 0) transforms and emits reversed-winding mesh variants so outward normals and backface culling remain valid in standard glTF / WebGL viewers.0x00BBGGRRmaterial colors, material transparency (OPAQUE/BLEND), shininess-derived PBR roughness/metallic factors, glazing heuristics, and category fallback palettes.UseSharedCoordinates = true) and automatically applies Relative-to-Center (RtcOffset) origin shifting when coordinates exceed100 mto preservefloat32vertex precision.Id,UniqueId,CategoryId,TypeId,HostId,ParentId,Level), supports subset filtering (IncludedElementIds,IncludedCategoryIds) and caller-selected metadata (IncludedParameterNames,IncludeTypeParameters,MaxParametersPerElement), and reports omitted / non-visual records cleanly viaSceneCompletenessandSkipLogwithout leaking internal exceptions..glb&rvtio-scene/1JSON:GlbSceneWriterwrites standard binary glTF 2.0 (.glb) with Z-up to Y-up root conversion, PBR metallic-roughness materials, category -> element -> subpart node hierarchy, and element identity innode.extras.SceneJsonSerializerreads and writes the versionedrvtio-scene/1JSON contract with Base64-encodedfloat32/uint32mesh buffers.2. Self-contained 3D HTML viewer (
HtmlViewerExporter— #25)HtmlViewerExporterandHtmlViewerOptionsgenerate a single standalone.htmldocument embedding a zero-dependency WebGL renderer and thervtio-scene/1payload with zero external scripts, stylesheets, fonts, or network requests.Fitto model/selection, and interactiveViewCube(TOP,FRONT,RIGHT,BACK,LEFT,ISO), with pre-sorted mesh/material VBO batching (opaqueDrawOrder) across thousands of placed instances.tmin-sorted CPU raycast picking with early exit, synchronized with a lazy/paginated virtualized category/element tree (TREE_PAGE_SIZE, pre-indexed search, event delegation) and groupedElement Propertiesinspector.Isolate,Hide,Show All, per-category and per-element toggles), interactive 6-plane X/Y/ZSection Boxclipping in fragment shaders, two-point 3D surfaceMeasuretool,Dark/Lighttheme toggle, and aScene Completeness Summarymodal.JavaScriptEncoder.Default(escaping<,>,&, quotes) inside<script type="application/json">, HTML-encodes document<title>/ chrome labels, and populates dynamic DOM labels strictly viatextContent.3. CLI & documentation
rvtioCLI (ExportCommand,Program,SceneCliOptions) with.glb,.html/.htm, and.scene.jsonextension detection,--scene-json,--scene-pretty,--scene-categories,--scene-ids,--scene-no-parameters,--scene-parameter-names,--scene-shared-coordinates,--scene-include-rooms,--scene-no-grids,--glb-z-up,--viewer-title,--viewer-theme, andExportReportintegration.docs/scene-export.mdand updatesREADME.md,docs/public-api.md,docs/export-report.md,docs/getting-started.md,docs/index.md, anddocs/toc.yml.How it was checked
dotnet build RvtIO.slnx -c Releasehas no warnings insrc/RvtIOorsrc/RvtIO.Cli(TreatWarningsAsErrors=trueandGenerateDocumentationFile=trueacrossnet8.0andnet10.0)dotnet testpasses:SceneExportTestsandHtmlViewerExporterTests: 36 passed, 0 failed on bothnet8.0andnet10.0(covering hole triangulation, wall openings, 20-instance shared symbol + mirroreddet < 0outward winding,0x00BBGGRRmaterial color & transparency, georeferenced RTC sub-millimetre precision, subset/parameter filtering, room space boundaries,rvtio-scene/1round-trip, 2,500-instance partial-completeness reporting, untrusted XSS payload neutralization, CLI flags, and--reportexit codes).RvtIO.Testssuite (net10.0, without privateRVTIO_TEST_FILES): 10,383 passed, 0 failed, 437 skipped.dotnet pack RvtIO.slnx -c Release --no-buildbuildsRvtIOandRvtIO.CliNuGet packages cleanly with no new package dependenciesdotnet docfx docfx.json --warningsAsErrorssucceeds with 0 warnings, 0 errors.rvtsample models (702kto1.165Mtriangles,6,542–8,5803D elements,16,012placed instances; scene +.glb/.htmlexport in2.7–9.8 s) and live WebGL browser verification: 0 console/WebGL errors, 0 external network requests, instant virtualized search/filtering, front-to-back 3D raycast picking, isolate/hide/show-all, X/Y/Z section box, measurement tool, ViewCube, theme switching, and completeness modal