@guilhermebkel/scenec 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -22
- package/dist/Adapters/FileReaderAdapter.d.ts +4 -0
- package/dist/Adapters/FileReaderAdapter.js +21 -0
- package/dist/Adapters/FontAdapter.d.ts +5 -0
- package/dist/Adapters/FontAdapter.js +9 -0
- package/dist/Adapters/ResvgAdapter.d.ts +11 -0
- package/dist/Adapters/ResvgAdapter.js +18 -0
- package/dist/Commands/BaseCommand.d.ts +11 -0
- package/dist/Commands/BaseCommand.js +13 -0
- package/dist/Commands/CatalogCommand.d.ts +6 -0
- package/dist/Commands/CatalogCommand.js +24 -0
- package/dist/Commands/CheckCommand.d.ts +5 -0
- package/dist/Commands/CheckCommand.js +8 -0
- package/dist/Commands/RenderCommand.d.ts +5 -0
- package/dist/Commands/RenderCommand.js +8 -0
- package/dist/Commands/SceneCommand.d.ts +11 -0
- package/dist/Commands/SceneCommand.js +70 -0
- package/dist/Commands/SchemaCommand.d.ts +5 -0
- package/dist/Commands/SchemaCommand.js +12 -0
- package/dist/Data/cities.json +312 -0
- package/dist/Data/europe.json +1 -0
- package/dist/Errors/SceneError.d.ts +4 -0
- package/dist/Errors/SceneError.js +11 -0
- package/dist/Errors/UnsafeSvgError.d.ts +3 -0
- package/dist/Errors/UnsafeSvgError.js +9 -0
- package/dist/Modules/CheckModule.d.ts +8 -0
- package/dist/Modules/CheckModule.js +16 -0
- package/dist/Modules/CompilationModule.d.ts +18 -0
- package/dist/Modules/CompilationModule.js +137 -0
- package/dist/Modules/CritiqueModule.d.ts +6 -0
- package/dist/Modules/CritiqueModule.js +43 -0
- package/dist/Modules/MapModule.d.ts +24 -0
- package/dist/Modules/MapModule.js +99 -0
- package/dist/Modules/ParsingModule.d.ts +17 -0
- package/dist/Modules/ParsingModule.js +88 -0
- package/dist/Modules/PlaneModule.d.ts +19 -0
- package/dist/Modules/PlaneModule.js +98 -0
- package/dist/Protocols/AssetProtocol.d.ts +62 -0
- package/dist/Protocols/AssetProtocol.js +93 -0
- package/dist/Protocols/CommandProtocol.d.ts +6 -0
- package/dist/Protocols/CommandProtocol.js +0 -0
- package/dist/Protocols/CompilationProtocol.d.ts +110 -0
- package/dist/Protocols/CompilationProtocol.js +0 -0
- package/dist/Protocols/CritiqueProtocol.d.ts +42 -0
- package/dist/Protocols/CritiqueProtocol.js +4 -0
- package/dist/Protocols/CustomAssetProtocol.d.ts +24 -0
- package/dist/Protocols/CustomAssetProtocol.js +0 -0
- package/dist/Protocols/GroupProtocol.d.ts +17 -0
- package/dist/Protocols/GroupProtocol.js +12 -0
- package/dist/Protocols/KitProtocol.d.ts +26 -0
- package/dist/Protocols/KitProtocol.js +17 -0
- package/dist/Protocols/MapProtocol.d.ts +77 -0
- package/dist/Protocols/MapProtocol.js +4 -0
- package/dist/Protocols/OptionsProtocol.js +0 -0
- package/dist/Protocols/PersonProtocol.d.ts +64 -0
- package/dist/Protocols/PersonProtocol.js +40 -0
- package/dist/Protocols/PlaneProtocol.d.ts +140 -0
- package/dist/Protocols/PlaneProtocol.js +4 -0
- package/dist/{pipeline/index.d.ts → Protocols/ResultProtocol.d.ts} +0 -2
- package/dist/Protocols/ResultProtocol.js +0 -0
- package/dist/Protocols/SceneProtocol.d.ts +625 -0
- package/dist/Protocols/SceneProtocol.js +304 -0
- package/dist/{protocols/theme.d.ts → Protocols/ThemeProtocol.d.ts} +4 -0
- package/dist/Protocols/ThemeProtocol.js +28 -0
- package/dist/Resources/Assets/BackpackAsset.d.ts +10 -0
- package/dist/Resources/Assets/BackpackAsset.js +31 -0
- package/dist/Resources/Assets/BallAsset.d.ts +10 -0
- package/dist/Resources/Assets/BallAsset.js +15 -0
- package/dist/Resources/Assets/BalloonsAsset.d.ts +10 -0
- package/dist/Resources/Assets/BalloonsAsset.js +26 -0
- package/dist/Resources/Assets/BaseAsset.d.ts +16 -0
- package/dist/Resources/Assets/BaseAsset.js +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.d.ts +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.js +14 -0
- package/dist/Resources/Assets/BedAsset.d.ts +12 -0
- package/dist/Resources/Assets/BedAsset.js +25 -0
- package/dist/Resources/Assets/BenchAsset.d.ts +11 -0
- package/dist/Resources/Assets/BenchAsset.js +24 -0
- package/dist/Resources/Assets/BicycleAsset.d.ts +10 -0
- package/dist/Resources/Assets/BicycleAsset.js +18 -0
- package/dist/Resources/Assets/BigPlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/BigPlantAsset.js +19 -0
- package/dist/Resources/Assets/BirdAsset.d.ts +10 -0
- package/dist/Resources/Assets/BirdAsset.js +14 -0
- package/dist/Resources/Assets/BoardAsset.d.ts +12 -0
- package/dist/Resources/Assets/BoardAsset.js +44 -0
- package/dist/Resources/Assets/BoatAsset.d.ts +10 -0
- package/dist/Resources/Assets/BoatAsset.js +15 -0
- package/dist/Resources/Assets/BooksAsset.d.ts +10 -0
- package/dist/Resources/Assets/BooksAsset.js +35 -0
- package/dist/Resources/Assets/BookshelfAsset.d.ts +10 -0
- package/dist/Resources/Assets/BookshelfAsset.js +33 -0
- package/dist/Resources/Assets/BuildingAsset.d.ts +14 -0
- package/dist/Resources/Assets/BuildingAsset.js +34 -0
- package/dist/Resources/Assets/BurgerAsset.d.ts +9 -0
- package/dist/Resources/Assets/BurgerAsset.js +23 -0
- package/dist/Resources/Assets/BushAsset.d.ts +10 -0
- package/dist/Resources/Assets/BushAsset.js +17 -0
- package/dist/Resources/Assets/CabinetAsset.d.ts +14 -0
- package/dist/Resources/Assets/CabinetAsset.js +49 -0
- package/dist/Resources/Assets/CablesAsset.d.ts +10 -0
- package/dist/Resources/Assets/CablesAsset.js +16 -0
- package/dist/Resources/Assets/CakeAsset.d.ts +10 -0
- package/dist/Resources/Assets/CakeAsset.js +29 -0
- package/dist/Resources/Assets/CapAsset.d.ts +10 -0
- package/dist/Resources/Assets/CapAsset.js +18 -0
- package/dist/Resources/Assets/CarAsset.d.ts +10 -0
- package/dist/Resources/Assets/CarAsset.js +29 -0
- package/dist/Resources/Assets/CatAsset.d.ts +10 -0
- package/dist/Resources/Assets/CatAsset.js +17 -0
- package/dist/Resources/Assets/ChairAsset.d.ts +11 -0
- package/dist/Resources/Assets/ChairAsset.js +32 -0
- package/dist/Resources/Assets/ClockAsset.d.ts +11 -0
- package/dist/Resources/Assets/ClockAsset.js +22 -0
- package/dist/Resources/Assets/CloudAsset.d.ts +10 -0
- package/dist/Resources/Assets/CloudAsset.js +15 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.d.ts +10 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.js +23 -0
- package/dist/Resources/Assets/CounterAsset.d.ts +11 -0
- package/dist/Resources/Assets/CounterAsset.js +29 -0
- package/dist/Resources/Assets/CupAsset.d.ts +10 -0
- package/dist/Resources/Assets/CupAsset.js +17 -0
- package/dist/Resources/Assets/CustomAsset.d.ts +25 -0
- package/dist/Resources/Assets/CustomAsset.js +58 -0
- package/dist/Resources/Assets/DeskAsset.d.ts +11 -0
- package/dist/Resources/Assets/DeskAsset.js +35 -0
- package/dist/Resources/Assets/DeskSlabAsset.d.ts +18 -0
- package/dist/Resources/Assets/DeskSlabAsset.js +43 -0
- package/dist/Resources/Assets/DiplomaAsset.d.ts +10 -0
- package/dist/Resources/Assets/DiplomaAsset.js +23 -0
- package/dist/Resources/Assets/DogAsset.d.ts +10 -0
- package/dist/Resources/Assets/DogAsset.js +24 -0
- package/dist/Resources/Assets/DrawerUnitAsset.d.ts +14 -0
- package/dist/Resources/Assets/DrawerUnitAsset.js +35 -0
- package/dist/Resources/Assets/FenceAsset.d.ts +10 -0
- package/dist/Resources/Assets/FenceAsset.js +26 -0
- package/dist/Resources/Assets/FigurineAsset.d.ts +10 -0
- package/dist/Resources/Assets/FigurineAsset.js +24 -0
- package/dist/Resources/Assets/FinishFlagAsset.d.ts +10 -0
- package/dist/Resources/Assets/FinishFlagAsset.js +21 -0
- package/dist/Resources/Assets/FloorLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/FloorLampAsset.js +22 -0
- package/dist/Resources/Assets/FlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/FlowersAsset.js +37 -0
- package/dist/Resources/Assets/FrameAsset.d.ts +11 -0
- package/dist/Resources/Assets/FrameAsset.js +24 -0
- package/dist/Resources/Assets/FruitBowlAsset.d.ts +10 -0
- package/dist/Resources/Assets/FruitBowlAsset.js +16 -0
- package/dist/Resources/Assets/GlassShelfAsset.d.ts +17 -0
- package/dist/Resources/Assets/GlassShelfAsset.js +25 -0
- package/dist/Resources/Assets/HeadphonesAsset.d.ts +10 -0
- package/dist/Resources/Assets/HeadphonesAsset.js +23 -0
- package/dist/Resources/Assets/HouseAsset.d.ts +10 -0
- package/dist/Resources/Assets/HouseAsset.js +42 -0
- package/dist/Resources/Assets/LabAsset.d.ts +10 -0
- package/dist/Resources/Assets/LabAsset.js +52 -0
- package/dist/Resources/Assets/LampAsset.d.ts +10 -0
- package/dist/Resources/Assets/LampAsset.js +16 -0
- package/dist/Resources/Assets/LaptopAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopAsset.js +23 -0
- package/dist/Resources/Assets/LaptopOpenAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopOpenAsset.js +29 -0
- package/dist/Resources/Assets/LightSwitchAsset.d.ts +11 -0
- package/dist/Resources/Assets/LightSwitchAsset.js +24 -0
- package/dist/Resources/Assets/MonitorAsset.d.ts +10 -0
- package/dist/Resources/Assets/MonitorAsset.js +40 -0
- package/dist/Resources/Assets/MoonAsset.d.ts +10 -0
- package/dist/Resources/Assets/MoonAsset.js +16 -0
- package/dist/Resources/Assets/MountainAsset.d.ts +10 -0
- package/dist/Resources/Assets/MountainAsset.js +15 -0
- package/dist/Resources/Assets/OfficeChairAsset.d.ts +10 -0
- package/dist/Resources/Assets/OfficeChairAsset.js +45 -0
- package/dist/Resources/Assets/PalmAsset.d.ts +10 -0
- package/dist/Resources/Assets/PalmAsset.js +32 -0
- package/dist/Resources/Assets/PaperCupAsset.d.ts +10 -0
- package/dist/Resources/Assets/PaperCupAsset.js +17 -0
- package/dist/Resources/Assets/PendantLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/PendantLampAsset.js +16 -0
- package/dist/Resources/Assets/PennantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PennantAsset.js +15 -0
- package/dist/Resources/Assets/PersonAsset.d.ts +10 -0
- package/dist/Resources/Assets/PersonAsset.js +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.d.ts +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.js +68 -0
- package/dist/Resources/Assets/PineAsset.d.ts +10 -0
- package/dist/Resources/Assets/PineAsset.js +21 -0
- package/dist/Resources/Assets/PizzaAsset.d.ts +10 -0
- package/dist/Resources/Assets/PizzaAsset.js +17 -0
- package/dist/Resources/Assets/PlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlantAsset.js +17 -0
- package/dist/Resources/Assets/PlasticBagAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlasticBagAsset.js +15 -0
- package/dist/Resources/Assets/PlateAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlateAsset.js +17 -0
- package/dist/Resources/Assets/RollingCartAsset.d.ts +11 -0
- package/dist/Resources/Assets/RollingCartAsset.js +34 -0
- package/dist/Resources/Assets/RugAsset.d.ts +10 -0
- package/dist/Resources/Assets/RugAsset.js +19 -0
- package/dist/Resources/Assets/SandcastleAsset.d.ts +10 -0
- package/dist/Resources/Assets/SandcastleAsset.js +30 -0
- package/dist/Resources/Assets/SchoolAsset.d.ts +10 -0
- package/dist/Resources/Assets/SchoolAsset.js +32 -0
- package/dist/Resources/Assets/ShelfWallAsset.d.ts +11 -0
- package/dist/Resources/Assets/ShelfWallAsset.js +23 -0
- package/dist/Resources/Assets/SofaAsset.d.ts +11 -0
- package/dist/Resources/Assets/SofaAsset.js +38 -0
- package/dist/Resources/Assets/StageAsset.d.ts +10 -0
- package/dist/Resources/Assets/StageAsset.js +44 -0
- package/dist/Resources/Assets/StarAsset.d.ts +10 -0
- package/dist/Resources/Assets/StarAsset.js +14 -0
- package/dist/Resources/Assets/StarsAsset.d.ts +11 -0
- package/dist/Resources/Assets/StarsAsset.js +42 -0
- package/dist/Resources/Assets/StreetlightAsset.d.ts +10 -0
- package/dist/Resources/Assets/StreetlightAsset.js +20 -0
- package/dist/Resources/Assets/SuitcaseAsset.d.ts +10 -0
- package/dist/Resources/Assets/SuitcaseAsset.js +42 -0
- package/dist/Resources/Assets/SunAsset.d.ts +10 -0
- package/dist/Resources/Assets/SunAsset.js +22 -0
- package/dist/Resources/Assets/TableAsset.d.ts +15 -0
- package/dist/Resources/Assets/TableAsset.js +21 -0
- package/dist/Resources/Assets/TrashCanAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrashCanAsset.js +31 -0
- package/dist/Resources/Assets/TreeAsset.d.ts +10 -0
- package/dist/Resources/Assets/TreeAsset.js +23 -0
- package/dist/Resources/Assets/TrophyAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrophyAsset.js +16 -0
- package/dist/Resources/Assets/TumblerAsset.d.ts +10 -0
- package/dist/Resources/Assets/TumblerAsset.js +17 -0
- package/dist/Resources/Assets/TvAsset.d.ts +10 -0
- package/dist/Resources/Assets/TvAsset.js +29 -0
- package/dist/Resources/Assets/TvStandAsset.d.ts +11 -0
- package/dist/Resources/Assets/TvStandAsset.js +34 -0
- package/dist/Resources/Assets/UmbrellaAsset.d.ts +10 -0
- package/dist/Resources/Assets/UmbrellaAsset.js +17 -0
- package/dist/Resources/Assets/UniversityAsset.d.ts +10 -0
- package/dist/Resources/Assets/UniversityAsset.js +22 -0
- package/dist/Resources/Assets/VaseFlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/VaseFlowersAsset.js +16 -0
- package/dist/Resources/Assets/WindowAsset.d.ts +11 -0
- package/dist/Resources/Assets/WindowAsset.js +32 -0
- package/dist/Resources/Groups/BaseGroup.d.ts +7 -0
- package/dist/Resources/Groups/BaseGroup.js +5 -0
- package/dist/Resources/Groups/CelebrationGroup.d.ts +8 -0
- package/dist/Resources/Groups/CelebrationGroup.js +19 -0
- package/dist/Resources/Groups/ConversationGroup.d.ts +9 -0
- package/dist/Resources/Groups/ConversationGroup.js +17 -0
- package/dist/Resources/Groups/DiningGroup.d.ts +8 -0
- package/dist/Resources/Groups/DiningGroup.js +21 -0
- package/dist/Resources/Groups/MeetingGroup.d.ts +8 -0
- package/dist/Resources/Groups/MeetingGroup.js +22 -0
- package/dist/Resources/Groups/ParkBenchGroup.d.ts +8 -0
- package/dist/Resources/Groups/ParkBenchGroup.js +17 -0
- package/dist/Resources/Groups/ReadingCornerGroup.d.ts +8 -0
- package/dist/Resources/Groups/ReadingCornerGroup.js +17 -0
- package/dist/Resources/Groups/WorkspaceGroup.d.ts +10 -0
- package/dist/Resources/Groups/WorkspaceGroup.js +25 -0
- package/dist/Resources/Kits/BaseKit.d.ts +12 -0
- package/dist/Resources/Kits/BaseKit.js +11 -0
- package/dist/Resources/Kits/FlatKit.d.ts +5 -0
- package/dist/Resources/Kits/FlatKit.js +8 -0
- package/dist/Resources/Kits/HatchKit.d.ts +15 -0
- package/dist/Resources/Kits/HatchKit.js +12 -0
- package/dist/Resources/Kits/OutlineKit.d.ts +12 -0
- package/dist/Resources/Kits/OutlineKit.js +10 -0
- package/dist/Resources/Kits/PaperKit.d.ts +11 -0
- package/dist/Resources/Kits/PaperKit.js +11 -0
- package/dist/Resources/Kits/RisoKit.d.ts +16 -0
- package/dist/Resources/Kits/RisoKit.js +11 -0
- package/dist/Resources/Kits/SketchKit.d.ts +9 -0
- package/dist/Resources/Kits/SketchKit.js +11 -0
- package/dist/Resources/Themes/BaseTheme.d.ts +5 -0
- package/dist/Resources/Themes/BaseTheme.js +5 -0
- package/dist/Resources/Themes/BeachTheme.d.ts +6 -0
- package/dist/Resources/Themes/BeachTheme.js +31 -0
- package/dist/Resources/Themes/FlatAutumnTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatAutumnTheme.js +29 -0
- package/dist/Resources/Themes/FlatCoolTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatCoolTheme.js +29 -0
- package/dist/Resources/Themes/NightTheme.d.ts +6 -0
- package/dist/Resources/Themes/NightTheme.js +29 -0
- package/dist/Resources/Themes/WarmCafeTheme.d.ts +6 -0
- package/dist/Resources/Themes/WarmCafeTheme.js +29 -0
- package/dist/Services/AssetService.d.ts +12 -0
- package/dist/Services/AssetService.js +204 -0
- package/dist/Services/BackgroundService.d.ts +33 -0
- package/dist/Services/BackgroundService.js +136 -0
- package/dist/Services/BalanceCritiqueService.d.ts +13 -0
- package/dist/Services/BalanceCritiqueService.js +64 -0
- package/dist/Services/CameraService.d.ts +21 -0
- package/dist/Services/CameraService.js +121 -0
- package/dist/Services/CatalogService.d.ts +29 -0
- package/dist/Services/CatalogService.js +51 -0
- package/dist/Services/ContactCritiqueService.d.ts +19 -0
- package/dist/Services/ContactCritiqueService.js +101 -0
- package/dist/Services/ContextService.d.ts +21 -0
- package/dist/Services/ContextService.js +94 -0
- package/dist/Services/CoverageCritiqueService.d.ts +16 -0
- package/dist/Services/CoverageCritiqueService.js +84 -0
- package/dist/Services/CustomAssetService.d.ts +31 -0
- package/dist/Services/CustomAssetService.js +184 -0
- package/dist/Services/DependencyOrderService.d.ts +12 -0
- package/dist/Services/DependencyOrderService.js +73 -0
- package/dist/Services/DescriptionService.d.ts +9 -0
- package/dist/Services/DescriptionService.js +27 -0
- package/dist/Services/FramingCheckService.d.ts +15 -0
- package/dist/Services/FramingCheckService.js +93 -0
- package/dist/Services/GazeService.d.ts +6 -0
- package/dist/Services/GazeService.js +43 -0
- package/dist/Services/GroupService.d.ts +17 -0
- package/dist/Services/GroupService.js +152 -0
- package/dist/Services/KitService.d.ts +23 -0
- package/dist/Services/KitService.js +96 -0
- package/dist/Services/LightingService.d.ts +24 -0
- package/dist/Services/LightingService.js +119 -0
- package/dist/Services/MapBaseService.d.ts +24 -0
- package/dist/Services/MapBaseService.js +104 -0
- package/dist/Services/MapLabelService.d.ts +26 -0
- package/dist/Services/MapLabelService.js +185 -0
- package/dist/Services/MapLegService.d.ts +23 -0
- package/dist/Services/MapLegService.js +87 -0
- package/dist/Services/MapPanelService.d.ts +16 -0
- package/dist/Services/MapPanelService.js +89 -0
- package/dist/Services/MapPinService.d.ts +11 -0
- package/dist/Services/MapPinService.js +56 -0
- package/dist/Services/MapProjectionService.d.ts +14 -0
- package/dist/Services/MapProjectionService.js +70 -0
- package/dist/Services/MapRouteService.d.ts +17 -0
- package/dist/Services/MapRouteService.js +79 -0
- package/dist/Services/PieceService.d.ts +43 -0
- package/dist/Services/PieceService.js +154 -0
- package/dist/Services/PlacementService.d.ts +60 -0
- package/dist/Services/PlacementService.js +415 -0
- package/dist/Services/PlaneBackgroundService.d.ts +24 -0
- package/dist/Services/PlaneBackgroundService.js +170 -0
- package/dist/Services/PlaneBoxService.d.ts +27 -0
- package/dist/Services/PlaneBoxService.js +209 -0
- package/dist/Services/PlaneDepthService.d.ts +18 -0
- package/dist/Services/PlaneDepthService.js +146 -0
- package/dist/Services/PlaneLabelService.d.ts +13 -0
- package/dist/Services/PlaneLabelService.js +115 -0
- package/dist/Services/PlaneObjectService.d.ts +17 -0
- package/dist/Services/PlaneObjectService.js +147 -0
- package/dist/Services/PlanePathService.d.ts +15 -0
- package/dist/Services/PlanePathService.js +98 -0
- package/dist/Services/PlaneProjectionService.d.ts +16 -0
- package/dist/Services/PlaneProjectionService.js +90 -0
- package/dist/Services/PlaneRoadService.d.ts +13 -0
- package/dist/Services/PlaneRoadService.js +105 -0
- package/dist/Services/PlaneScatterService.d.ts +11 -0
- package/dist/Services/PlaneScatterService.js +48 -0
- package/dist/Services/PlaneSpaceService.d.ts +27 -0
- package/dist/Services/PlaneSpaceService.js +96 -0
- package/dist/Services/PlaneSpriteService.d.ts +29 -0
- package/dist/Services/PlaneSpriteService.js +95 -0
- package/dist/Services/PlaneTitleService.d.ts +17 -0
- package/dist/Services/PlaneTitleService.js +126 -0
- package/dist/Services/PlaneZoneService.d.ts +20 -0
- package/dist/Services/PlaneZoneService.js +121 -0
- package/dist/Services/RasterService.d.ts +10 -0
- package/dist/Services/RasterService.js +68 -0
- package/dist/Services/SchemaService.d.ts +3 -0
- package/dist/Services/SchemaService.js +10 -0
- package/dist/Services/SilhouetteCritiqueService.d.ts +32 -0
- package/dist/Services/SilhouetteCritiqueService.js +155 -0
- package/dist/Services/TextService.d.ts +47 -0
- package/dist/Services/TextService.js +178 -0
- package/dist/Services/ThemeService.d.ts +5 -0
- package/dist/Services/ThemeService.js +18 -0
- package/dist/Utils/BoxUtil.d.ts +4 -0
- package/dist/Utils/BoxUtil.js +8 -0
- package/dist/Utils/ColorUtil.d.ts +20 -0
- package/dist/Utils/ColorUtil.js +51 -0
- package/dist/Utils/CurveUtil.d.ts +6 -0
- package/dist/Utils/CurveUtil.js +35 -0
- package/dist/Utils/FallbackUtil.d.ts +3 -0
- package/dist/Utils/FallbackUtil.js +8 -0
- package/dist/Utils/FormatUtil.d.ts +4 -0
- package/dist/Utils/FormatUtil.js +9 -0
- package/dist/Utils/IdUtil.d.ts +4 -0
- package/dist/Utils/IdUtil.js +11 -0
- package/dist/Utils/NormalizeUtil.d.ts +4 -0
- package/dist/Utils/NormalizeUtil.js +9 -0
- package/dist/Utils/OklabUtil.d.ts +23 -0
- package/dist/Utils/OklabUtil.js +62 -0
- package/dist/Utils/PersonArmUtil.d.ts +19 -0
- package/dist/Utils/PersonArmUtil.js +84 -0
- package/dist/Utils/PersonHeadUtil.d.ts +31 -0
- package/dist/Utils/PersonHeadUtil.js +154 -0
- package/dist/Utils/PersonOutfitUtil.d.ts +48 -0
- package/dist/Utils/PersonOutfitUtil.js +178 -0
- package/dist/Utils/PersonUtil.d.ts +39 -0
- package/dist/Utils/PersonUtil.js +206 -0
- package/dist/Utils/PixelUtil.d.ts +3 -0
- package/dist/Utils/PixelUtil.js +8 -0
- package/dist/Utils/RecolorUtil.d.ts +40 -0
- package/dist/Utils/RecolorUtil.js +155 -0
- package/dist/Utils/RegistryUtil.d.ts +8 -0
- package/dist/Utils/RegistryUtil.js +19 -0
- package/dist/Utils/RequireUtil.d.ts +3 -0
- package/dist/Utils/RequireUtil.js +11 -0
- package/dist/Utils/SanitizeUtil.d.ts +25 -0
- package/dist/Utils/SanitizeUtil.js +210 -0
- package/dist/Utils/SeedUtil.d.ts +6 -0
- package/dist/Utils/SeedUtil.js +15 -0
- package/dist/Utils/ShapeUtil.d.ts +31 -0
- package/dist/Utils/ShapeUtil.js +47 -0
- package/dist/Utils/SuggestUtil.d.ts +7 -0
- package/dist/Utils/SuggestUtil.js +25 -0
- package/dist/Utils/SvgUtil.d.ts +9 -0
- package/dist/Utils/SvgUtil.js +21 -0
- package/dist/Utils/ThemeUtil.d.ts +4 -0
- package/dist/Utils/ThemeUtil.js +13 -0
- package/dist/Utils/TransportUtil.d.ts +24 -0
- package/dist/Utils/TransportUtil.js +108 -0
- package/dist/cli.js +24 -97
- package/dist/index.d.ts +10 -6
- package/dist/index.js +14 -2
- package/dist/render.d.ts +8 -5
- package/dist/render.js +21 -3
- package/dist/schema.d.ts +9 -2
- package/dist/schema.js +29 -5
- package/package.json +3 -2
- package/skills/{scenec → draw-scene}/SKILL.md +15 -19
- package/skills/{scenec → draw-scene}/references/catalog.md +14 -14
- package/skills/{scenec → draw-scene}/references/dsl.md +9 -3
- package/dist/catalog.d.ts +0 -21
- package/dist/catalog.js +0 -35
- package/dist/data/europe.json +0 -1
- package/dist/drawing/assets.d.ts +0 -8
- package/dist/drawing/assets.js +0 -612
- package/dist/drawing/kits.d.ts +0 -7
- package/dist/drawing/kits.js +0 -92
- package/dist/drawing/person.d.ts +0 -18
- package/dist/drawing/person.js +0 -287
- package/dist/drawing/themes.d.ts +0 -4
- package/dist/drawing/themes.js +0 -45
- package/dist/modes/map.d.ts +0 -5
- package/dist/modes/map.js +0 -365
- package/dist/modes/plane.d.ts +0 -5
- package/dist/modes/plane.js +0 -716
- package/dist/pipeline/compile.d.ts +0 -2
- package/dist/pipeline/compile.js +0 -581
- package/dist/pipeline/custom.d.ts +0 -2
- package/dist/pipeline/custom.js +0 -120
- package/dist/pipeline/groups.d.ts +0 -2
- package/dist/pipeline/groups.js +0 -189
- package/dist/pipeline/index.js +0 -7
- package/dist/pipeline/parse.d.ts +0 -10
- package/dist/pipeline/parse.js +0 -80
- package/dist/protocols/options.js +0 -1
- package/dist/protocols/scene.d.ts +0 -299
- package/dist/protocols/scene.js +0 -118
- package/dist/protocols/theme.js +0 -1
- package/dist/render/check.d.ts +0 -6
- package/dist/render/check.js +0 -10
- package/dist/render/critic.d.ts +0 -1
- package/dist/render/critic.js +0 -235
- package/dist/render/files.d.ts +0 -2
- package/dist/render/files.js +0 -16
- package/dist/render/fonts.d.ts +0 -2
- package/dist/render/fonts.js +0 -4
- package/dist/render/png.d.ts +0 -9
- package/dist/render/png.js +0 -13
- package/dist/utils/color.d.ts +0 -5
- package/dist/utils/color.js +0 -35
- package/dist/utils/recolor.d.ts +0 -1
- package/dist/utils/recolor.js +0 -56
- package/dist/utils/sanitize.d.ts +0 -5
- package/dist/utils/sanitize.js +0 -169
- package/dist/utils/suggest.d.ts +0 -1
- package/dist/utils/suggest.js +0 -22
- package/dist/utils/svg.d.ts +0 -2
- package/dist/utils/svg.js +0 -11
- package/skills/scenec/references/fontes.md +0 -8
- /package/dist/{protocols/options.d.ts → Protocols/OptionsProtocol.d.ts} +0 -0
- /package/skills/{scenec/recipes/anuncios-variacoes.yaml → draw-scene/recipes/ad-variations.yaml} +0 -0
- /package/skills/{scenec/recipes/carrossel.yaml → draw-scene/recipes/carousel.yaml} +0 -0
- /package/skills/{scenec/recipes/elearning.yaml → draw-scene/recipes/e-learning.yaml} +0 -0
- /package/skills/{scenec/recipes/reels-explicativo.yaml → draw-scene/recipes/explainer-reel.yaml} +0 -0
- /package/skills/{scenec/recipes/historia-ilustrada.yaml → draw-scene/recipes/illustrated-story.yaml} +0 -0
- /package/skills/{scenec/recipes/mapas-jornadas.yaml → draw-scene/recipes/journey-map.yaml} +0 -0
- /package/skills/{scenec/recipes/wrapped-personalizado.yaml → draw-scene/recipes/personalized-wrapped.yaml} +0 -0
- /package/skills/{scenec/recipes/ilustracoes-produto.yaml → draw-scene/recipes/product-illustration.yaml} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GroundPoint, Road, RoadPosition } from "../Protocols/PlaneProtocol.js";
|
|
2
|
+
import type { PathOptions } from "../Protocols/SceneProtocol.js";
|
|
3
|
+
export declare class PlanePathService {
|
|
4
|
+
private static readonly DEFAULT_WIDTH;
|
|
5
|
+
private static readonly DEFAULT_CHECKPOINT_RADIUS;
|
|
6
|
+
private static readonly SAMPLES_PER_SEGMENT;
|
|
7
|
+
private static readonly SAMPLE;
|
|
8
|
+
private static readonly LENGTH;
|
|
9
|
+
private static readonly FALLBACK_POINT;
|
|
10
|
+
static build(definition: PathOptions | undefined, warnings: string[], pointIdToPosition: Map<string, GroundPoint>): Road;
|
|
11
|
+
static distanceToRoad(road: Road, groundX: number, groundZ: number): number;
|
|
12
|
+
static pointAt(road: Road, fraction: number): RoadPosition;
|
|
13
|
+
private static arcLengths;
|
|
14
|
+
private static nearestSample;
|
|
15
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { CurveUtil } from "../Utils/CurveUtil.js";
|
|
2
|
+
import { RequireUtil } from "../Utils/RequireUtil.js";
|
|
3
|
+
class PlanePathService {
|
|
4
|
+
static DEFAULT_WIDTH = 0.075;
|
|
5
|
+
static DEFAULT_CHECKPOINT_RADIUS = 0.042;
|
|
6
|
+
static SAMPLES_PER_SEGMENT = 40;
|
|
7
|
+
static SAMPLE = "path sample";
|
|
8
|
+
static LENGTH = "path length";
|
|
9
|
+
static FALLBACK_POINT = [0.5, 0.5];
|
|
10
|
+
static build(definition, warnings, pointIdToPosition) {
|
|
11
|
+
const width = definition?.width ?? PlanePathService.DEFAULT_WIDTH;
|
|
12
|
+
const checkpointRadius = definition?.checkpoint_size ?? PlanePathService.DEFAULT_CHECKPOINT_RADIUS;
|
|
13
|
+
if (!definition) {
|
|
14
|
+
return { definition: null, samples: [], arc: [], width, checkpointRadius, checkpoints: [] };
|
|
15
|
+
}
|
|
16
|
+
const points = definition.points ?? [];
|
|
17
|
+
if (points.length < 2) {
|
|
18
|
+
warnings.push("path needs at least 2 points");
|
|
19
|
+
}
|
|
20
|
+
const named = points.map((point, index) => {
|
|
21
|
+
const id = point.id === void 0 || point.id === "" ? `point${index + 1}` : point.id;
|
|
22
|
+
if (point.at === void 0) {
|
|
23
|
+
warnings.push(`path point '${id}' has no 'at: [x, z]'`);
|
|
24
|
+
}
|
|
25
|
+
const at = point.at ?? PlanePathService.FALLBACK_POINT;
|
|
26
|
+
pointIdToPosition.set(id, at);
|
|
27
|
+
return { point, id, at };
|
|
28
|
+
});
|
|
29
|
+
const samples = CurveUtil.catmullRom(named.map((entry) => entry.at), PlanePathService.SAMPLES_PER_SEGMENT);
|
|
30
|
+
const arc = PlanePathService.arcLengths(samples);
|
|
31
|
+
const checkpoints = named.map(({ point, id, at }) => ({
|
|
32
|
+
id,
|
|
33
|
+
at,
|
|
34
|
+
arc: RequireUtil.defined(arc[PlanePathService.nearestSample(samples, at)], "path arc length"),
|
|
35
|
+
label: point.label,
|
|
36
|
+
zone: point.zone,
|
|
37
|
+
isFinish: point.finish === true,
|
|
38
|
+
color: point.color,
|
|
39
|
+
labelSide: point.label_side,
|
|
40
|
+
hasDecor: point.decor !== false,
|
|
41
|
+
tint: void 0,
|
|
42
|
+
isOccupied: false
|
|
43
|
+
}));
|
|
44
|
+
return { definition, samples, arc, width, checkpointRadius, checkpoints };
|
|
45
|
+
}
|
|
46
|
+
static distanceToRoad(road, groundX, groundZ) {
|
|
47
|
+
let nearest = Infinity;
|
|
48
|
+
for (const sample of road.samples) {
|
|
49
|
+
nearest = Math.min(nearest, Math.hypot(sample[0] - groundX, sample[1] - groundZ));
|
|
50
|
+
}
|
|
51
|
+
return nearest;
|
|
52
|
+
}
|
|
53
|
+
static pointAt(road, fraction) {
|
|
54
|
+
const total = RequireUtil.defined(road.arc.at(-1), PlanePathService.LENGTH);
|
|
55
|
+
const target = total * Math.min(1, Math.max(0, fraction));
|
|
56
|
+
let index = road.arc.findIndex((length) => length >= target);
|
|
57
|
+
if (index <= 0) {
|
|
58
|
+
index = 1;
|
|
59
|
+
}
|
|
60
|
+
const before = RequireUtil.defined(road.samples[index - 1], PlanePathService.SAMPLE);
|
|
61
|
+
const after = RequireUtil.defined(road.samples[index], PlanePathService.SAMPLE);
|
|
62
|
+
const startLength = RequireUtil.defined(road.arc[index - 1], PlanePathService.LENGTH);
|
|
63
|
+
const span = RequireUtil.defined(road.arc[index], PlanePathService.LENGTH) - startLength;
|
|
64
|
+
const progress = (target - startLength) / (span || 1);
|
|
65
|
+
const tangentX = after[0] - before[0];
|
|
66
|
+
const tangentZ = after[1] - before[1];
|
|
67
|
+
const norm = Math.hypot(tangentX, tangentZ) || 1;
|
|
68
|
+
return {
|
|
69
|
+
point: [before[0] + (after[0] - before[0]) * progress, before[1] + (after[1] - before[1]) * progress],
|
|
70
|
+
normal: [-tangentZ / norm, tangentX / norm]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
static arcLengths(samples) {
|
|
74
|
+
const arc = [0];
|
|
75
|
+
for (let index = 1; index < samples.length; index++) {
|
|
76
|
+
const here = RequireUtil.defined(samples[index], PlanePathService.SAMPLE);
|
|
77
|
+
const previous = RequireUtil.defined(samples[index - 1], PlanePathService.SAMPLE);
|
|
78
|
+
const walked = RequireUtil.defined(arc[index - 1], PlanePathService.LENGTH);
|
|
79
|
+
arc.push(walked + Math.hypot(here[0] - previous[0], here[1] - previous[1]));
|
|
80
|
+
}
|
|
81
|
+
return arc;
|
|
82
|
+
}
|
|
83
|
+
static nearestSample(samples, at) {
|
|
84
|
+
let best = 0;
|
|
85
|
+
let bestDistance = 1e9;
|
|
86
|
+
samples.forEach((sample, index) => {
|
|
87
|
+
const distance = Math.hypot(sample[0] - at[0], sample[1] - at[1]);
|
|
88
|
+
if (distance < bestDistance) {
|
|
89
|
+
bestDistance = distance;
|
|
90
|
+
best = index;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return best;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
PlanePathService
|
|
98
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PlaneCamera } from "../Protocols/PlaneProtocol.js";
|
|
2
|
+
import type { Canvas } from "../Protocols/SceneProtocol.js";
|
|
3
|
+
export declare class PlaneProjectionService {
|
|
4
|
+
private static readonly HAZE_STEPS;
|
|
5
|
+
private static readonly BOARD_DEPTH;
|
|
6
|
+
private static readonly BOARD_NEAR_Y;
|
|
7
|
+
private static readonly BOARD_FAR_Y;
|
|
8
|
+
private static readonly BOARD_UNIT;
|
|
9
|
+
private static readonly BOARD_SPREAD_MIN;
|
|
10
|
+
private static readonly BOARD_SPREAD_RANGE;
|
|
11
|
+
private static readonly FRAME_FILL;
|
|
12
|
+
static create(canvas: Canvas, width: number, height: number): PlaneCamera;
|
|
13
|
+
private static roomOf;
|
|
14
|
+
private static roomLens;
|
|
15
|
+
private static boardLens;
|
|
16
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
class PlaneProjectionService {
|
|
2
|
+
static HAZE_STEPS = [
|
|
3
|
+
{ depth: 0.6, strength: 0.1 },
|
|
4
|
+
{ depth: 0.85, strength: 0.2 },
|
|
5
|
+
{ depth: 1.15, strength: 0.34 }
|
|
6
|
+
];
|
|
7
|
+
static BOARD_DEPTH = 0.9;
|
|
8
|
+
static BOARD_NEAR_Y = 0.97;
|
|
9
|
+
static BOARD_FAR_Y = 0.32;
|
|
10
|
+
static BOARD_UNIT = 165e-5;
|
|
11
|
+
static BOARD_SPREAD_MIN = 0.72;
|
|
12
|
+
static BOARD_SPREAD_RANGE = 0.28;
|
|
13
|
+
static FRAME_FILL = 0.98;
|
|
14
|
+
static create(canvas, width, height) {
|
|
15
|
+
const room = PlaneProjectionService.roomOf(canvas.camera);
|
|
16
|
+
const depth = room?.depth ?? canvas.depth ?? PlaneProjectionService.BOARD_DEPTH;
|
|
17
|
+
const shrink = (groundZ) => 1 / (1 + depth * Math.max(groundZ, -0.85 / depth));
|
|
18
|
+
const frame = { width, height, zoom: canvas.scale ?? 1, shrink };
|
|
19
|
+
const lens = room ? PlaneProjectionService.roomLens(room, frame) : PlaneProjectionService.boardLens(canvas, frame, depth);
|
|
20
|
+
const { unit, spread, screenX, screenY } = lens;
|
|
21
|
+
const fill = PlaneProjectionService.FRAME_FILL;
|
|
22
|
+
const pxPerUnit = (groundZ, factor = 1) => unit * shrink(groundZ) * factor;
|
|
23
|
+
const isHazeOff = canvas.haze === false || room && canvas.haze !== true;
|
|
24
|
+
const hazeSteps = isHazeOff ? null : PlaneProjectionService.HAZE_STEPS;
|
|
25
|
+
return {
|
|
26
|
+
width,
|
|
27
|
+
height,
|
|
28
|
+
isRoom: Boolean(room),
|
|
29
|
+
unit,
|
|
30
|
+
eyeX: lens.eyeX,
|
|
31
|
+
hazeSteps,
|
|
32
|
+
shrink,
|
|
33
|
+
screenX,
|
|
34
|
+
screenY,
|
|
35
|
+
spread,
|
|
36
|
+
pxPerUnit,
|
|
37
|
+
worldRadius: (widthUnits, groundZ, factor = 1) => widthUnits * pxPerUnit(groundZ, factor) / 2 / (width * fill * spread(groundZ)),
|
|
38
|
+
project: (groundX, groundZ, heightUnits = 0) => [
|
|
39
|
+
screenX(groundX, groundZ),
|
|
40
|
+
screenY(groundZ) - heightUnits * unit * shrink(groundZ)
|
|
41
|
+
],
|
|
42
|
+
hazeLevel: (groundZ) => hazeSteps?.filter((step) => groundZ >= step.depth).length ?? 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static roomOf(camera) {
|
|
46
|
+
const options = typeof camera === "string" ? { preset: camera } : camera ?? {};
|
|
47
|
+
if (options.preset !== "room" && options.horizon === void 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
horizon: options.horizon ?? 0.48,
|
|
52
|
+
nearY: options.near_y ?? 1,
|
|
53
|
+
depth: options.depth ?? 0.7,
|
|
54
|
+
vanishX: options.vanish_x ?? 0.5,
|
|
55
|
+
centerX: options.cx ?? 0.5,
|
|
56
|
+
xSpan: options.x_span ?? 1.17,
|
|
57
|
+
unit: options.unit ?? 93e-4
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static roomLens(room, frame) {
|
|
61
|
+
const { width, height, zoom, shrink } = frame;
|
|
62
|
+
const horizonY = height * room.horizon;
|
|
63
|
+
const nearY = height * room.nearY;
|
|
64
|
+
return {
|
|
65
|
+
eyeX: room.centerX,
|
|
66
|
+
unit: height * room.unit * zoom,
|
|
67
|
+
spread: (groundZ) => room.xSpan * shrink(groundZ) / PlaneProjectionService.FRAME_FILL,
|
|
68
|
+
screenX: (groundX, groundZ) => width * room.vanishX + (groundX - room.centerX) * width * room.xSpan * shrink(groundZ),
|
|
69
|
+
screenY: (groundZ) => horizonY + (nearY - horizonY) * shrink(groundZ)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
static boardLens(canvas, frame, depth) {
|
|
73
|
+
const { width, height, zoom, shrink } = frame;
|
|
74
|
+
const nearY = height * (canvas.near_y ?? PlaneProjectionService.BOARD_NEAR_Y);
|
|
75
|
+
const farY = height * (canvas.far_y ?? PlaneProjectionService.BOARD_FAR_Y);
|
|
76
|
+
const horizonY = (farY * (1 + depth) - nearY) / depth;
|
|
77
|
+
const farShrink = 1 / (1 + depth);
|
|
78
|
+
const spread = (groundZ) => PlaneProjectionService.BOARD_SPREAD_MIN + PlaneProjectionService.BOARD_SPREAD_RANGE * (shrink(groundZ) - farShrink) / (1 - farShrink);
|
|
79
|
+
return {
|
|
80
|
+
eyeX: 0.5,
|
|
81
|
+
unit: height * PlaneProjectionService.BOARD_UNIT * zoom,
|
|
82
|
+
spread,
|
|
83
|
+
screenX: (groundX, groundZ) => width / 2 + (groundX - 0.5) * width * PlaneProjectionService.FRAME_FILL * spread(groundZ),
|
|
84
|
+
screenY: (groundZ) => horizonY + (nearY - horizonY) * shrink(groundZ)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
PlaneProjectionService
|
|
90
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PlaneWorld } from "../Protocols/PlaneProtocol.js";
|
|
2
|
+
export declare class PlaneRoadService {
|
|
3
|
+
private static readonly DEFAULT_TILE_LENGTH;
|
|
4
|
+
private static readonly ROAD_EDGE;
|
|
5
|
+
private static readonly ROAD_SHADOW_DROP;
|
|
6
|
+
private static readonly CHECKPOINT_DEPTH;
|
|
7
|
+
private static readonly SAMPLE;
|
|
8
|
+
static draw(world: PlaneWorld): string;
|
|
9
|
+
private static edge;
|
|
10
|
+
private static outline;
|
|
11
|
+
private static tiles;
|
|
12
|
+
private static checkpoint;
|
|
13
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { PlanePathService } from "./PlanePathService.js";
|
|
2
|
+
import { ColorUtil } from "../Utils/ColorUtil.js";
|
|
3
|
+
import { FormatUtil } from "../Utils/FormatUtil.js";
|
|
4
|
+
import { RequireUtil } from "../Utils/RequireUtil.js";
|
|
5
|
+
import { ThemeUtil } from "../Utils/ThemeUtil.js";
|
|
6
|
+
const FONT = "Poppins";
|
|
7
|
+
class PlaneRoadService {
|
|
8
|
+
static DEFAULT_TILE_LENGTH = 0.045;
|
|
9
|
+
static ROAD_EDGE = 6e-3;
|
|
10
|
+
static ROAD_SHADOW_DROP = 7;
|
|
11
|
+
static CHECKPOINT_DEPTH = 6;
|
|
12
|
+
static SAMPLE = "road sample";
|
|
13
|
+
static draw(world) {
|
|
14
|
+
const { road, theme } = world;
|
|
15
|
+
if (road.samples.length === 0 || !road.definition) {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
const roadColor = ThemeUtil.resolve(theme, road.definition.color, ColorUtil.sh(theme.paper, -0.04));
|
|
19
|
+
const shadow = PlaneRoadService.outline(world, PlaneRoadService.ROAD_EDGE, PlaneRoadService.ROAD_SHADOW_DROP);
|
|
20
|
+
const border = PlaneRoadService.outline(world, PlaneRoadService.ROAD_EDGE, 0);
|
|
21
|
+
let svg = `<polygon points="${shadow}" fill="${ColorUtil.sh(theme.ground, -0.35)}" opacity="0.55"/>`;
|
|
22
|
+
svg += `<polygon points="${border}" fill="${ColorUtil.sh(roadColor, -0.25)}"/><polygon points="${PlaneRoadService.outline(world, 0, 0)}" fill="${roadColor}"/>`;
|
|
23
|
+
if (road.definition.tiles !== false) {
|
|
24
|
+
svg += PlaneRoadService.tiles(world, road.definition.tile_length ?? PlaneRoadService.DEFAULT_TILE_LENGTH);
|
|
25
|
+
}
|
|
26
|
+
road.checkpoints.forEach((checkpoint, index) => {
|
|
27
|
+
svg += PlaneRoadService.checkpoint(world, checkpoint, index);
|
|
28
|
+
});
|
|
29
|
+
return svg;
|
|
30
|
+
}
|
|
31
|
+
static edge(world, sign, extra) {
|
|
32
|
+
const { samples, width } = world.road;
|
|
33
|
+
return samples.map((point, index) => {
|
|
34
|
+
const before = RequireUtil.defined(samples[Math.max(0, index - 1)], PlaneRoadService.SAMPLE);
|
|
35
|
+
const after = RequireUtil.defined(samples[Math.min(samples.length - 1, index + 1)], PlaneRoadService.SAMPLE);
|
|
36
|
+
const tangentX = after[0] - before[0];
|
|
37
|
+
const tangentZ = after[1] - before[1];
|
|
38
|
+
const norm = Math.hypot(tangentX, tangentZ) || 1;
|
|
39
|
+
const half = width / 2 + extra;
|
|
40
|
+
return [point[0] - tangentZ / norm * half * sign, point[1] + tangentX / norm * half * sign];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static outline(world, extra, drop) {
|
|
44
|
+
const { screenX, screenY, shrink } = world.camera;
|
|
45
|
+
const left = PlaneRoadService.edge(world, 1, extra);
|
|
46
|
+
const right = PlaneRoadService.edge(world, -1, extra).reverse();
|
|
47
|
+
return [...left, ...right].map(([groundX, groundZ]) => {
|
|
48
|
+
const column = FormatUtil.oneDecimal(screenX(groundX, groundZ));
|
|
49
|
+
return `${column},${FormatUtil.oneDecimal(screenY(groundZ) + drop * shrink(groundZ))}`;
|
|
50
|
+
}).join(" ");
|
|
51
|
+
}
|
|
52
|
+
static tiles(world, tileLength) {
|
|
53
|
+
const { road, theme, camera } = world;
|
|
54
|
+
const total = RequireUtil.defined(road.arc.at(-1), "road length");
|
|
55
|
+
const colors = [
|
|
56
|
+
ColorUtil.sh(theme.accent, 0.55),
|
|
57
|
+
ColorUtil.sh(theme.primary, 0.62),
|
|
58
|
+
ColorUtil.sh(theme.secondary, 0.65)
|
|
59
|
+
];
|
|
60
|
+
const half = road.width / 2 * 0.8;
|
|
61
|
+
const clearance = road.checkpointRadius + tileLength * 0.45;
|
|
62
|
+
let svg = "";
|
|
63
|
+
let colorIndex = 0;
|
|
64
|
+
for (let start = tileLength * 0.2; start < total - tileLength * 0.5; start += tileLength) {
|
|
65
|
+
const end = start + tileLength * 0.8;
|
|
66
|
+
if (road.checkpoints.some((checkpoint) => Math.abs(checkpoint.arc - (start + end) / 2) < clearance)) {
|
|
67
|
+
colorIndex++;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const first = PlanePathService.pointAt(road, start / total);
|
|
71
|
+
const second = PlanePathService.pointAt(road, end / total);
|
|
72
|
+
const corners = [[first, 1], [second, 1], [second, -1], [first, -1]];
|
|
73
|
+
const points = corners.map(([position, sign]) => {
|
|
74
|
+
const groundX = position.point[0] + position.normal[0] * half * sign;
|
|
75
|
+
const groundZ = position.point[1] + position.normal[1] * half * sign;
|
|
76
|
+
const column = FormatUtil.oneDecimal(camera.screenX(groundX, groundZ));
|
|
77
|
+
return `${column},${FormatUtil.oneDecimal(camera.screenY(groundZ))}`;
|
|
78
|
+
}).join(" ");
|
|
79
|
+
svg += `<polygon points="${points}" fill="${colors[colorIndex++ % colors.length]}"/>`;
|
|
80
|
+
}
|
|
81
|
+
return svg;
|
|
82
|
+
}
|
|
83
|
+
static checkpoint(world, checkpoint, index) {
|
|
84
|
+
const { camera, theme, road } = world;
|
|
85
|
+
const num = FormatUtil.oneDecimal;
|
|
86
|
+
const [groundX, groundZ] = checkpoint.at;
|
|
87
|
+
const centerX = camera.screenX(groundX, groundZ);
|
|
88
|
+
const centerY = camera.screenY(groundZ);
|
|
89
|
+
const radiusX = road.checkpointRadius * camera.width * 0.98 * camera.spread(groundZ);
|
|
90
|
+
const nearEdge = camera.screenY(groundZ - road.checkpointRadius);
|
|
91
|
+
const radiusY = (nearEdge - camera.screenY(groundZ + road.checkpointRadius)) / 2;
|
|
92
|
+
const color = checkpoint.isFinish ? theme.accent : ThemeUtil.resolve(theme, checkpoint.color, theme.primary);
|
|
93
|
+
const shrink = camera.shrink(groundZ);
|
|
94
|
+
const base = `cx="${num(centerX)}" cy="${num(centerY)}" rx="${num(radiusX)}" ry="${num(radiusY)}"`;
|
|
95
|
+
const lowered = `cx="${num(centerX)}" cy="${num(centerY + PlaneRoadService.CHECKPOINT_DEPTH * shrink)}"`;
|
|
96
|
+
let svg = `<ellipse ${lowered} rx="${num(radiusX)}" ry="${num(radiusY)}" fill="${ColorUtil.sh(color, -0.3)}"/><ellipse ${base} fill="${color}"/><ellipse cx="${num(centerX)}" cy="${num(centerY)}" rx="${num(radiusX * 0.78)}" ry="${num(radiusY * 0.78)}" fill="none" stroke="${theme.paper}" stroke-width="${num(2.5 * shrink)}" opacity="0.8"/>`;
|
|
97
|
+
if (!checkpoint.isOccupied) {
|
|
98
|
+
svg += `<text x="${num(centerX)}" y="${num(centerY + radiusY * 0.35)}" font-family="${FONT}" font-weight="700" font-size="${num(radiusY * 1.1)}" fill="${theme.paper}" text-anchor="middle">${checkpoint.isFinish ? "\u2605" : index + 1}</text>`;
|
|
99
|
+
}
|
|
100
|
+
return svg;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
PlaneRoadService
|
|
105
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PlaneWorld } from "../Protocols/PlaneProtocol.js";
|
|
2
|
+
export declare class PlaneScatterService {
|
|
3
|
+
private static readonly DEFAULT_SEED;
|
|
4
|
+
private static readonly DEFAULT_ASSETS;
|
|
5
|
+
private static readonly DEFAULT_AREA;
|
|
6
|
+
private static readonly DEFAULT_COUNT;
|
|
7
|
+
private static readonly DEFAULT_SIZE;
|
|
8
|
+
private static readonly MAX_TRIES;
|
|
9
|
+
static place(world: PlaneWorld): void;
|
|
10
|
+
private static scatter;
|
|
11
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { PlaneSpaceService } from "./PlaneSpaceService.js";
|
|
2
|
+
import { PlaneSpriteService } from "./PlaneSpriteService.js";
|
|
3
|
+
import { SeedUtil } from "../Utils/SeedUtil.js";
|
|
4
|
+
class PlaneScatterService {
|
|
5
|
+
static DEFAULT_SEED = 7;
|
|
6
|
+
static DEFAULT_ASSETS = ["tree", "bush"];
|
|
7
|
+
static DEFAULT_AREA = [0.02, 0, 0.98, 1.05];
|
|
8
|
+
static DEFAULT_COUNT = 15;
|
|
9
|
+
static DEFAULT_SIZE = 0.8;
|
|
10
|
+
static MAX_TRIES = 3e3;
|
|
11
|
+
static place(world) {
|
|
12
|
+
(world.scene.scatter ?? []).forEach((options, index) => {
|
|
13
|
+
PlaneScatterService.scatter(world, options, index);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static scatter(world, options, index) {
|
|
17
|
+
const random = SeedUtil.sequence(options.seed ?? PlaneScatterService.DEFAULT_SEED + index);
|
|
18
|
+
const names = options.assets ?? PlaneScatterService.DEFAULT_ASSETS;
|
|
19
|
+
const [areaX0, areaZ0, areaX1, areaZ1] = options.area ?? PlaneScatterService.DEFAULT_AREA;
|
|
20
|
+
const wanted = options.count ?? PlaneScatterService.DEFAULT_COUNT;
|
|
21
|
+
let placed = 0;
|
|
22
|
+
let tries = 0;
|
|
23
|
+
while (placed < wanted && tries++ < PlaneScatterService.MAX_TRIES) {
|
|
24
|
+
const groundX = areaX0 + random() * (areaX1 - areaX0);
|
|
25
|
+
const groundZ = areaZ0 + random() * (areaZ1 - areaZ0);
|
|
26
|
+
const name = names[Math.floor(random() * names.length)];
|
|
27
|
+
const found = name === void 0 ? void 0 : PlaneSpriteService.find(world, name);
|
|
28
|
+
if (name === void 0 || !found) {
|
|
29
|
+
if (name !== void 0) {
|
|
30
|
+
world.warnings.push(`scatter: asset '${name}' does not exist`);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const factor = (options.size ?? PlaneScatterService.DEFAULT_SIZE) * (0.8 + random() * 0.4);
|
|
35
|
+
const radius = world.camera.worldRadius(found.asset.width, groundZ, factor) * 0.9;
|
|
36
|
+
const candidate = { asset: found.asset, params: {} };
|
|
37
|
+
if (!PlaneSpaceService.isFree(world, groundX, groundZ, radius) || PlaneSpaceService.occludes(world, [groundX, groundZ], candidate, factor)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const object = { asset: name, size: factor, facing: random() < 0.5 ? "left" : "right" };
|
|
41
|
+
PlaneSpriteService.add(world, { id: `scatter${index}_${placed}`, object, groundX, groundZ, isDecor: true });
|
|
42
|
+
placed++;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
PlaneScatterService
|
|
48
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AssetParams, LibraryAsset } from "../Protocols/AssetProtocol.js";
|
|
2
|
+
import type { GroundPoint, PlaneWorld } from "../Protocols/PlaneProtocol.js";
|
|
3
|
+
interface Candidate {
|
|
4
|
+
asset: LibraryAsset;
|
|
5
|
+
params: AssetParams;
|
|
6
|
+
}
|
|
7
|
+
interface SpotSearch {
|
|
8
|
+
anchor: GroundPoint;
|
|
9
|
+
widthUnits: number;
|
|
10
|
+
factor: number;
|
|
11
|
+
distances?: readonly number[];
|
|
12
|
+
candidate?: Candidate;
|
|
13
|
+
}
|
|
14
|
+
export declare class PlaneSpaceService {
|
|
15
|
+
static readonly CLOSE_DISTANCES: number[];
|
|
16
|
+
private static readonly ANGLES;
|
|
17
|
+
private static readonly DISTANCES;
|
|
18
|
+
private static readonly DEPTH_SQUASH;
|
|
19
|
+
private static readonly OCCLUDER_MIN_OVERLAP;
|
|
20
|
+
private static readonly DEPTH_WEIGHT;
|
|
21
|
+
static isFree(world: PlaneWorld, groundX: number, groundZ: number, radius: number): boolean;
|
|
22
|
+
static occludes(world: PlaneWorld, at: GroundPoint, candidate: Candidate, factor: number): boolean;
|
|
23
|
+
static findSpot(world: PlaneWorld, search: SpotSearch): GroundPoint | null;
|
|
24
|
+
private static coversCheckpoint;
|
|
25
|
+
private static coversProtected;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { PlanePathService } from "./PlanePathService.js";
|
|
2
|
+
import { BoxUtil } from "../Utils/BoxUtil.js";
|
|
3
|
+
import { PlaneSpriteService } from "./PlaneSpriteService.js";
|
|
4
|
+
class PlaneSpaceService {
|
|
5
|
+
static CLOSE_DISTANCES = [0.1, 0.14, 0.18, 0.22, 0.27];
|
|
6
|
+
static ANGLES = [90, 60, 120, 30, 150, 0, 180, 20, 160, -30, 210, -90];
|
|
7
|
+
static DISTANCES = [0.12, 0.16, 0.2, 0.25, 0.09];
|
|
8
|
+
static DEPTH_SQUASH = 0.9;
|
|
9
|
+
static OCCLUDER_MIN_OVERLAP = 0.12;
|
|
10
|
+
static DEPTH_WEIGHT = 1.6;
|
|
11
|
+
static isFree(world, groundX, groundZ, radius) {
|
|
12
|
+
const { road } = world;
|
|
13
|
+
if (groundX - radius < 0.02 || groundX + radius > 0.98 || groundZ < -0.04 || groundZ > 1.08) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const roadClearance = road.width / 2 + radius * 0.9;
|
|
17
|
+
if (road.samples.length > 0 && PlanePathService.distanceToRoad(road, groundX, groundZ) < roadClearance) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
for (const checkpoint of road.checkpoints) {
|
|
21
|
+
if (Math.hypot(checkpoint.at[0] - groundX, checkpoint.at[1] - groundZ) < road.checkpointRadius + radius) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return !world.footprints.some((footprint) => {
|
|
26
|
+
const apart = Math.hypot(footprint.x - groundX, (footprint.z - groundZ) * PlaneSpaceService.DEPTH_WEIGHT);
|
|
27
|
+
return apart < (footprint.radius + radius) * 0.85;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
static occludes(world, at, candidate, factor) {
|
|
31
|
+
const { camera, road } = world;
|
|
32
|
+
const [groundX, groundZ] = at;
|
|
33
|
+
const dimensions = PlaneSpriteService.dimensions(candidate.asset, candidate.params);
|
|
34
|
+
const scale = camera.pxPerUnit(groundZ, factor);
|
|
35
|
+
const screenX = camera.screenX(groundX, groundZ);
|
|
36
|
+
const screenY = camera.screenY(groundZ);
|
|
37
|
+
const width = dimensions.w * scale;
|
|
38
|
+
const height = dimensions.h * scale;
|
|
39
|
+
const box = {
|
|
40
|
+
x0: screenX - width * 0.42,
|
|
41
|
+
x1: screenX + width * 0.42,
|
|
42
|
+
y0: screenY - height * 0.95,
|
|
43
|
+
y1: screenY - height * 0.04
|
|
44
|
+
};
|
|
45
|
+
for (let index = 0; index < road.samples.length; index += 2) {
|
|
46
|
+
const sample = road.samples[index];
|
|
47
|
+
if (sample !== void 0 && sample[1] > groundZ + 5e-3) {
|
|
48
|
+
const px = camera.screenX(sample[0], sample[1]);
|
|
49
|
+
const py = camera.screenY(sample[1]);
|
|
50
|
+
if (px > box.x0 && px < box.x1 && py > box.y0 && py < box.y1) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return PlaneSpaceService.coversCheckpoint(world, groundZ, box) || PlaneSpaceService.coversProtected(world, groundZ, box);
|
|
56
|
+
}
|
|
57
|
+
static findSpot(world, search) {
|
|
58
|
+
const [anchorX, anchorZ] = search.anchor;
|
|
59
|
+
for (const distance of search.distances ?? PlaneSpaceService.DISTANCES) {
|
|
60
|
+
for (const angle of PlaneSpaceService.ANGLES) {
|
|
61
|
+
const groundX = anchorX + Math.cos(angle * Math.PI / 180) * distance;
|
|
62
|
+
const groundZ = anchorZ + Math.sin(angle * Math.PI / 180) * distance * PlaneSpaceService.DEPTH_SQUASH;
|
|
63
|
+
const radius = world.camera.worldRadius(search.widthUnits, groundZ, search.factor);
|
|
64
|
+
const { candidate, factor } = search;
|
|
65
|
+
const isBlocked = !PlaneSpaceService.isFree(world, groundX, groundZ, radius) || candidate !== void 0 && PlaneSpaceService.occludes(world, [groundX, groundZ], candidate, factor);
|
|
66
|
+
if (!isBlocked) {
|
|
67
|
+
return [groundX, groundZ];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
static coversCheckpoint(world, groundZ, box) {
|
|
74
|
+
const { camera, road } = world;
|
|
75
|
+
return road.checkpoints.some((checkpoint) => {
|
|
76
|
+
if (checkpoint.at[1] <= groundZ) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const px = camera.screenX(checkpoint.at[0], checkpoint.at[1]);
|
|
80
|
+
const py = camera.screenY(checkpoint.at[1]);
|
|
81
|
+
return px > box.x0 - 10 && px < box.x1 + 10 && py > box.y0 && py < box.y1 + 10;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static coversProtected(world, groundZ, box) {
|
|
85
|
+
return world.protectedSprites.some((other) => {
|
|
86
|
+
if (other.z <= groundZ) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const overlap = BoxUtil.overlapArea(box, other.bounds);
|
|
90
|
+
return overlap > PlaneSpaceService.OCCLUDER_MIN_OVERLAP * other.width * other.height;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
PlaneSpaceService
|
|
96
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AssetParams, AssetSize, LibraryAsset } from "../Protocols/AssetProtocol.js";
|
|
2
|
+
import type { GroundSprite, PlaneWorld, SkySprite } from "../Protocols/PlaneProtocol.js";
|
|
3
|
+
import type { SceneObject } from "../Protocols/SceneProtocol.js";
|
|
4
|
+
interface SpriteRequest {
|
|
5
|
+
id: string;
|
|
6
|
+
object: SceneObject;
|
|
7
|
+
groundX: number;
|
|
8
|
+
groundZ: number;
|
|
9
|
+
lift?: number;
|
|
10
|
+
isDecor?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface FoundAsset {
|
|
13
|
+
id: string;
|
|
14
|
+
asset: LibraryAsset;
|
|
15
|
+
}
|
|
16
|
+
export declare class PlaneSpriteService {
|
|
17
|
+
private static readonly FOOT_SHARE;
|
|
18
|
+
private static readonly PERSON_FOOTPRINT;
|
|
19
|
+
private static readonly SHADOW_ELLIPSE;
|
|
20
|
+
static draw(world: PlaneWorld, sprite: GroundSprite): string;
|
|
21
|
+
static drawSky(world: PlaneWorld, sprite: SkySprite): string;
|
|
22
|
+
static sizeFactor(size: SceneObject["size"]): number;
|
|
23
|
+
static assetName(id: string, object: SceneObject): string;
|
|
24
|
+
static dimensions(asset: LibraryAsset, params: AssetParams): AssetSize;
|
|
25
|
+
static find(world: PlaneWorld, name: string): FoundAsset | undefined;
|
|
26
|
+
static add(world: PlaneWorld, request: SpriteRequest): GroundSprite | null;
|
|
27
|
+
private static wrap;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AssetService } from "./AssetService.js";
|
|
2
|
+
import { PlacementService } from "./PlacementService.js";
|
|
3
|
+
import { FormatUtil } from "../Utils/FormatUtil.js";
|
|
4
|
+
import { IdUtil } from "../Utils/IdUtil.js";
|
|
5
|
+
import { RequireUtil } from "../Utils/RequireUtil.js";
|
|
6
|
+
class PlaneSpriteService {
|
|
7
|
+
static FOOT_SHARE = 0.55;
|
|
8
|
+
static PERSON_FOOTPRINT = 0.6;
|
|
9
|
+
static SHADOW_ELLIPSE = /<ellipse cx="([-\d.]+)" cy="0" rx="([\d.]+)" ry="([\d.]+)" fill="[^"]*"( stroke="none")?\s*\/>/;
|
|
10
|
+
static draw(world, sprite) {
|
|
11
|
+
return PlaneSpriteService.wrap(world, sprite, world.camera.hazeLevel(sprite.z));
|
|
12
|
+
}
|
|
13
|
+
static drawSky(world, sprite) {
|
|
14
|
+
return PlaneSpriteService.wrap(world, sprite, 0);
|
|
15
|
+
}
|
|
16
|
+
static sizeFactor(size) {
|
|
17
|
+
if (typeof size === "number") {
|
|
18
|
+
return size;
|
|
19
|
+
}
|
|
20
|
+
return IdUtil.lookup(PlacementService.SIZE_NAME_TO_FACTOR, size ?? "medium") ?? 1;
|
|
21
|
+
}
|
|
22
|
+
static assetName(id, object) {
|
|
23
|
+
return object.asset === void 0 || object.asset === "" ? id : object.asset;
|
|
24
|
+
}
|
|
25
|
+
static dimensions(asset, params) {
|
|
26
|
+
return asset.size ? asset.size(params) : { w: asset.width, h: asset.height };
|
|
27
|
+
}
|
|
28
|
+
static find(world, name) {
|
|
29
|
+
const resolution = AssetService.resolveAsset(name, world.library);
|
|
30
|
+
const asset = resolution.id === null ? void 0 : world.library[resolution.id];
|
|
31
|
+
return resolution.id === null || asset === void 0 ? void 0 : { id: resolution.id, asset };
|
|
32
|
+
}
|
|
33
|
+
static add(world, request) {
|
|
34
|
+
const { camera, theme, warnings } = world;
|
|
35
|
+
const { id, object, groundX, groundZ } = request;
|
|
36
|
+
const name = PlaneSpriteService.assetName(id, object);
|
|
37
|
+
const resolution = AssetService.resolveAsset(name, world.library);
|
|
38
|
+
if (resolution.id === null) {
|
|
39
|
+
const suggestions = (resolution.suggest ?? []).join(", ");
|
|
40
|
+
warnings.push(`asset '${name}' (in '${id}') does not exist; did you mean: ${suggestions}?`);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const asset = RequireUtil.defined(world.library[resolution.id], `asset '${resolution.id}'`);
|
|
44
|
+
const factor = PlaneSpriteService.sizeFactor(object.size);
|
|
45
|
+
const scale = camera.pxPerUnit(groundZ, factor);
|
|
46
|
+
const drawn = asset.draw({ ...object }, theme);
|
|
47
|
+
const dimensions = PlaneSpriteService.dimensions(asset, object);
|
|
48
|
+
const lift = request.lift ?? object.lift ?? 0;
|
|
49
|
+
const screenX = camera.screenX(groundX, groundZ);
|
|
50
|
+
const screenY = camera.screenY(groundZ) - lift * camera.unit * camera.shrink(groundZ);
|
|
51
|
+
const width = dimensions.w * scale;
|
|
52
|
+
const height = dimensions.h * scale;
|
|
53
|
+
const isPerson = resolution.id === "person";
|
|
54
|
+
const sprite = {
|
|
55
|
+
id,
|
|
56
|
+
asset: resolution.id,
|
|
57
|
+
kind: asset.kind,
|
|
58
|
+
x: groundX,
|
|
59
|
+
z: groundZ,
|
|
60
|
+
lift,
|
|
61
|
+
screenX,
|
|
62
|
+
screenY,
|
|
63
|
+
scale,
|
|
64
|
+
svg: typeof drawn === "string" ? drawn : drawn.svg,
|
|
65
|
+
width,
|
|
66
|
+
height,
|
|
67
|
+
heightUnits: dimensions.h * factor,
|
|
68
|
+
halfFootWidth: width / 2 / (camera.width * 0.98 * camera.spread(groundZ)) * PlaneSpriteService.FOOT_SHARE,
|
|
69
|
+
bounds: { x0: screenX - width / 2, x1: screenX + width / 2, y0: screenY - height, y1: screenY },
|
|
70
|
+
isDecor: request.isDecor === true,
|
|
71
|
+
isPerson
|
|
72
|
+
};
|
|
73
|
+
world.ground.push(sprite);
|
|
74
|
+
const footprintScale = isPerson ? PlaneSpriteService.PERSON_FOOTPRINT : 1;
|
|
75
|
+
const radius = camera.worldRadius(dimensions.w, groundZ, factor) * footprintScale;
|
|
76
|
+
world.footprints.push({ id, x: groundX, z: groundZ, radius });
|
|
77
|
+
world.pointIdToPosition.set(id, [groundX, groundZ]);
|
|
78
|
+
return sprite;
|
|
79
|
+
}
|
|
80
|
+
static wrap(world, sprite, hazeLevel) {
|
|
81
|
+
const swap = (match, cx, rx, ry) => {
|
|
82
|
+
const radiusX = (Number(rx) * 1.25).toFixed(1);
|
|
83
|
+
const radiusY = (Number(ry) * 1.6).toFixed(1);
|
|
84
|
+
return match.includes(world.theme.shadow) ? `<ellipse cx="${cx}" cy="0" rx="${radiusX}" ry="${radiusY}" fill="url(#cshadow)"/>` : match;
|
|
85
|
+
};
|
|
86
|
+
const art = sprite.svg.replace(PlaneSpriteService.SHADOW_ELLIPSE, swap);
|
|
87
|
+
const num = FormatUtil.oneDecimal;
|
|
88
|
+
const filter = hazeLevel > 0 ? ` filter="url(#haze${hazeLevel})"` : "";
|
|
89
|
+
const move = `translate(${num(sprite.screenX)} ${num(sprite.screenY)}) scale(${sprite.scale.toFixed(3)})`;
|
|
90
|
+
return `<g id="${sprite.id}" transform="${move}"${filter}>${art}</g>`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
PlaneSpriteService
|
|
95
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PlaneLabel, PlaneWorld } from "../Protocols/PlaneProtocol.js";
|
|
2
|
+
export declare class PlaneTitleService {
|
|
3
|
+
private static readonly MIN_CONTRAST;
|
|
4
|
+
private static readonly CHAR_WIDTH;
|
|
5
|
+
private static readonly MARGIN_SHARE;
|
|
6
|
+
private static readonly TITLE_SHARE;
|
|
7
|
+
private static readonly ROLE_TO_FONT_SHARE;
|
|
8
|
+
private static readonly ROLE_TO_WEIGHT;
|
|
9
|
+
private static readonly ROLE_TO_IS_TITLE;
|
|
10
|
+
private static readonly ROLE_TO_STACKS_UNDER_TITLE;
|
|
11
|
+
private static readonly ALIGN_TO_PLACEMENT;
|
|
12
|
+
private static readonly EDGE_TO_BASELINE;
|
|
13
|
+
static draw(world: PlaneWorld, labels: readonly PlaneLabel[]): string;
|
|
14
|
+
private static layout;
|
|
15
|
+
private static drawOne;
|
|
16
|
+
private static warnCovered;
|
|
17
|
+
}
|