@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
package/dist/pipeline/compile.js
DELETED
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
import { ASSETS, resolveAsset } from "../drawing/assets.js";
|
|
2
|
-
import { THEMES } from "../drawing/themes.js";
|
|
3
|
-
import { bodyScale } from "../drawing/person.js";
|
|
4
|
-
import { KITS, outlineFilter, dropFilter, innerStroke, hatchDefs, sceneFilter, texture } from "../drawing/kits.js";
|
|
5
|
-
import { compilePlane } from "../modes/plane.js";
|
|
6
|
-
import { compileMap } from "../modes/map.js";
|
|
7
|
-
import { sh, luminance, contrast } from "../utils/color.js";
|
|
8
|
-
import { flattenOpacity } from "../utils/svg.js";
|
|
9
|
-
import { loadCustomAssets } from "./custom.js";
|
|
10
|
-
import { expandGroups } from "./groups.js";
|
|
11
|
-
const SLOTS = { "far-left": 0.08, left: 0.2, "center-left": 0.35, center: 0.5, "center-right": 0.65, right: 0.8, "far-right": 0.92 };
|
|
12
|
-
const SIZES = { tiny: 0.5, small: 0.75, medium: 1, large: 1.3, huge: 1.7 };
|
|
13
|
-
const DEPTHS = ["far", "mid", "near"];
|
|
14
|
-
const GRIP = { cup: 6, suitcase: 44, books: 8, ball: 12 }; // altura do ponto de pegada (unidades)
|
|
15
|
-
const FONT = "Poppins";
|
|
16
|
-
function layoutLines(setting, _H) {
|
|
17
|
-
const L = structuredClone({
|
|
18
|
-
outdoor: { horizon: 0.64, base: { near: 0.92, mid: 0.8, far: 0.69 } },
|
|
19
|
-
indoor: { horizon: 0.68, base: { near: 0.93, mid: 0.84, far: 0.74 } },
|
|
20
|
-
beach: { horizon: 0.50, sea: 0.62, base: { near: 0.93, mid: 0.82, far: 0.71 } },
|
|
21
|
-
city: { horizon: 0.70, base: { near: 0.94, mid: 0.84, far: 0.74 } },
|
|
22
|
-
}[setting] || null);
|
|
23
|
-
return L;
|
|
24
|
-
}
|
|
25
|
-
const slotX = (at, def) => (typeof at === "number" ? at : SLOTS[at] ?? def);
|
|
26
|
-
const DEPTH_SCALE = { near: 1, mid: 0.8, far: 0.6 };
|
|
27
|
-
export function compileInternal(scene, opts = {}) {
|
|
28
|
-
const warnings = [];
|
|
29
|
-
const c = scene.canvas || {};
|
|
30
|
-
const W = c.width || 1200, H = c.height || ((c.mode === "2.5d" || c.mode === "board") ? 900 : 630);
|
|
31
|
-
const baseTheme = THEMES[c.theme || "flat-cool"] || (warnings.push(`tema '${c.theme}' não existe; usando 'flat-cool'. Disponíveis: ${Object.keys(THEMES).join(", ")}`), THEMES["flat-cool"]);
|
|
32
|
-
// `canvas.colors` sobrescreve cores do tema (ex.: wall, floor, wood) para casar com uma referência
|
|
33
|
-
// kit de estilo: muda a linguagem visual (contorno, hachura, risografia...), não só a paleta
|
|
34
|
-
const KIT = KITS[c.kit || "flat"] || (warnings.push(`kit '${c.kit}' não existe; disponíveis: ${Object.keys(KITS).join(", ")}`), KITS.flat);
|
|
35
|
-
const theme = { ...baseTheme, ...(KIT.colors || {}), ...(c.colors || {}) };
|
|
36
|
-
const setting = c.setting || ((c.mode === "2.5d" || c.mode === "board") ? "outdoor" : "outdoor");
|
|
37
|
-
const lines = layoutLines(setting, H) || (warnings.push(`setting '${setting}' inválido; use outdoor, indoor, beach ou city`), layoutLines("outdoor"));
|
|
38
|
-
const U = H * 0.0034 * (c.scale ?? 1); // px por unidade (pessoa = 100 un.)
|
|
39
|
-
if (c.horizon != null)
|
|
40
|
-
lines.horizon = c.horizon;
|
|
41
|
-
if (c.base != null) {
|
|
42
|
-
const d = c.base - lines.base.near;
|
|
43
|
-
lines.base = { near: c.base, mid: lines.base.mid + d * 0.6, far: lines.base.far + d * 0.3 };
|
|
44
|
-
}
|
|
45
|
-
const BASE = ASSETS;
|
|
46
|
-
const FAILED = new Set();
|
|
47
|
-
const CUSTOM = loadCustomAssets(scene.assets, opts, warnings, FAILED);
|
|
48
|
-
for (const id of Object.keys(CUSTOM))
|
|
49
|
-
if (BASE[id])
|
|
50
|
-
warnings.push(`asset custom '${id}' substitui o asset da biblioteca com o mesmo nome`);
|
|
51
|
-
const LIB = Object.keys(CUSTOM).length ? { ...BASE, ...CUSTOM } : BASE;
|
|
52
|
-
const wholeKit = (r) => {
|
|
53
|
-
if (KIT.outline || KIT.light?.mode === "hatch")
|
|
54
|
-
r.warnings?.push?.(`no modo ${c.mode}, o kit '${c.kit}' aplica só filtro e textura; contorno e hachura por objeto existem no modo clássico`);
|
|
55
|
-
if (!KIT.scene && !KIT.texture)
|
|
56
|
-
return r;
|
|
57
|
-
const HH = c.height || 900;
|
|
58
|
-
// texto fica fora do filtro (nítido) e por cima da textura
|
|
59
|
-
const svg = r.svg.replace(/(<svg[^>]*>)([\s\S]*)(<\/svg>\s*)$/, (m, a, body, z) => {
|
|
60
|
-
const texts = [];
|
|
61
|
-
const art = body.replace(/<text\b[\s\S]*?<\/text>/g, (tx) => (texts.push(tx), ""));
|
|
62
|
-
return `${a}<defs>${KIT.scene ? sceneFilter(KIT.scene, theme) : ""}</defs><g${KIT.scene ? " filter=\"url(#kitScene)\"" : ""}>${art}</g>${texture(KIT.texture, W, HH)}${texts.join("")}${z}`;
|
|
63
|
-
});
|
|
64
|
-
return { ...r, svg: flattenOpacity(svg) };
|
|
65
|
-
};
|
|
66
|
-
if (c.mode === "map")
|
|
67
|
-
return wholeKit(compileMap(scene, { theme, warnings, W, H: c.height || 900, contrast }));
|
|
68
|
-
if (c.mode === "2.5d" || c.mode === "board")
|
|
69
|
-
return wholeKit(compilePlane(scene, { LIB, theme, warnings, W, H: c.height || 900, resolveAsset, contrast }));
|
|
70
|
-
const objs = expandGroups(scene.objects || {}, warnings);
|
|
71
|
-
const placed = {};
|
|
72
|
-
// ---- ordem de resolução (dependências) ----
|
|
73
|
-
const deps = (o) => ["left_of", "right_of", "behind", "in_front_of", "on", "under", "above"].map((k) => o[k]).filter(Boolean);
|
|
74
|
-
const order = [], seen = new Set(), visiting = new Set();
|
|
75
|
-
const visit = (id) => {
|
|
76
|
-
if (seen.has(id))
|
|
77
|
-
return;
|
|
78
|
-
if (visiting.has(id)) {
|
|
79
|
-
warnings.push(`dependência circular envolvendo '${id}'`);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
visiting.add(id);
|
|
83
|
-
const o = objs[id];
|
|
84
|
-
if (!o)
|
|
85
|
-
return;
|
|
86
|
-
for (const d of deps(o)) {
|
|
87
|
-
if (!objs[d])
|
|
88
|
-
warnings.push(`'${id}' referencia '${d}', que não existe na cena`);
|
|
89
|
-
else
|
|
90
|
-
visit(d);
|
|
91
|
-
}
|
|
92
|
-
visiting.delete(id);
|
|
93
|
-
seen.add(id);
|
|
94
|
-
order.push(id);
|
|
95
|
-
};
|
|
96
|
-
Object.keys(objs).forEach(visit);
|
|
97
|
-
// quem segura (holds) vem antes do objeto segurado
|
|
98
|
-
const heldBy = {};
|
|
99
|
-
for (const [id, o] of Object.entries(objs))
|
|
100
|
-
if (o.holds) {
|
|
101
|
-
if (!objs[o.holds])
|
|
102
|
-
warnings.push(`'${id}' segura '${o.holds}', que não existe`);
|
|
103
|
-
else
|
|
104
|
-
heldBy[o.holds] = id;
|
|
105
|
-
}
|
|
106
|
-
const final = order.filter((id) => !heldBy[id]);
|
|
107
|
-
for (const id of order)
|
|
108
|
-
if (heldBy[id])
|
|
109
|
-
final.splice(final.indexOf(heldBy[id]) + 1, 0, id);
|
|
110
|
-
// ---- posicionamento ----
|
|
111
|
-
for (const id of final) {
|
|
112
|
-
const o = objs[id];
|
|
113
|
-
const res = resolveAsset(o.asset || id, LIB);
|
|
114
|
-
if (!res.id) {
|
|
115
|
-
if (FAILED.has(o.asset || id))
|
|
116
|
-
warnings.push(`'${id}' foi ignorado porque o asset custom '${o.asset || id}' não carregou`);
|
|
117
|
-
else
|
|
118
|
-
warnings.push(`asset '${o.asset || id}' (em '${id}') não existe; você quis dizer: ${res.suggest.join(", ")}?`);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
const A = LIB[res.id];
|
|
122
|
-
const dims = A.size ? A.size(o) : { w: A.w, h: A.h };
|
|
123
|
-
const sizeK = typeof o.size === "number" ? o.size : (SIZES[o.size || "medium"] ?? (warnings.push(`size '${o.size}' inválido em '${id}' (use ${Object.keys(SIZES).join(", ")})`), 1));
|
|
124
|
-
let depth = o.depth || null, x = null, y = null, scale = null, z = 0;
|
|
125
|
-
const ref = (k) => placed[o[k]];
|
|
126
|
-
if (A.kind === "sky") {
|
|
127
|
-
scale = U * sizeK * 0.9;
|
|
128
|
-
const slot = o.at || "top-right";
|
|
129
|
-
const hx = String(slot).replace("top-", "").replace("sky-", "");
|
|
130
|
-
x = (SLOTS[hx] ?? (typeof o.at === "number" ? o.at : 0.5)) * W;
|
|
131
|
-
y = H * (o.altitude ?? 0.14) + (dims.h * scale) / 2;
|
|
132
|
-
if (res.id === "stars") {
|
|
133
|
-
x = W / 2;
|
|
134
|
-
y = H * 0.38;
|
|
135
|
-
scale = W / 620;
|
|
136
|
-
}
|
|
137
|
-
z = -900;
|
|
138
|
-
}
|
|
139
|
-
else if (A.kind === "wall") {
|
|
140
|
-
if (setting !== "indoor")
|
|
141
|
-
warnings.push(`'${id}' é de parede, mas o setting é '${setting}'`);
|
|
142
|
-
scale = U * sizeK * 0.85;
|
|
143
|
-
x = (SLOTS[o.at] ?? (typeof o.at === "number" ? o.at : 0.5)) * W;
|
|
144
|
-
if (ref("left_of"))
|
|
145
|
-
x = ref("left_of").bx0 - 0.03 * W - (dims.w * scale) / 2;
|
|
146
|
-
if (ref("right_of"))
|
|
147
|
-
x = ref("right_of").bx1 + 0.03 * W + (dims.w * scale) / 2;
|
|
148
|
-
if (ref("above"))
|
|
149
|
-
x = ref("above").x + (o.offset ?? 0) * ref("above").w;
|
|
150
|
-
y = H * lines.horizon - (o.elevation ?? A.elevation) * U * 0.85;
|
|
151
|
-
z = -800;
|
|
152
|
-
}
|
|
153
|
-
else if (A.kind === "ceiling") {
|
|
154
|
-
scale = U * sizeK;
|
|
155
|
-
x = slotX(o.at, 0.5) * W;
|
|
156
|
-
if (o.above && placed[o.above])
|
|
157
|
-
x = placed[o.above].x;
|
|
158
|
-
y = (o.hang ?? 95) * U;
|
|
159
|
-
z = 500;
|
|
160
|
-
}
|
|
161
|
-
else if (A.kind === "water") {
|
|
162
|
-
scale = U * sizeK * 0.55;
|
|
163
|
-
x = slotX(o.at, 0.7) * W;
|
|
164
|
-
y = H * ((lines.sea ?? lines.horizon) - 0.035);
|
|
165
|
-
z = -700;
|
|
166
|
-
if (!lines.sea)
|
|
167
|
-
warnings.push(`'${id}' é um objeto de água, mas a cena não tem mar (use setting: beach)`);
|
|
168
|
-
}
|
|
169
|
-
else if (o.on) {
|
|
170
|
-
const p = ref("on");
|
|
171
|
-
if (!p) {
|
|
172
|
-
warnings.push(`'${id}' está 'on: ${o.on}', mas '${o.on}' não foi posicionado`);
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
const PA = LIB[p.asset];
|
|
176
|
-
scale = p.scale * sizeK;
|
|
177
|
-
const SEATED = ["sitting", "typing", "reading", "drinking", "sitting_floor", "hugging_knees"];
|
|
178
|
-
if (PA.seat && SEATED.includes(o.pose)) {
|
|
179
|
-
const off = typeof o.align === "number" ? o.align : { left: -0.28, right: 0.28, center: 0 }[o.align || "center"] ?? 0;
|
|
180
|
-
const fx = o.facing === "left" ? 1 : -1; // quadril um pouco para trás do centro do assento
|
|
181
|
-
x = p.x + off * p.w + (A.peep ? 0 : fx * 4 * p.scale);
|
|
182
|
-
y = p.y - PA.seat * p.scale + 45 * (res.id === "person" ? bodyScale(o).by : 1) * p.scale * sizeK;
|
|
183
|
-
z = p.z + 0.5;
|
|
184
|
-
}
|
|
185
|
-
else if (!(p.top ?? PA.top)) {
|
|
186
|
-
warnings.push(`'${o.on}' não tem superfície de apoio; '${id}' não pode ficar em cima dele`);
|
|
187
|
-
x = p.x;
|
|
188
|
-
y = p.y - p.h;
|
|
189
|
-
z = p.z + 0.5;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
const off = typeof o.align === "number" ? o.align : { left: -0.3, right: 0.3, center: 0, "far-left": -0.42, "far-right": 0.42 }[o.align || "center"] ?? 0;
|
|
193
|
-
x = p.x + off * p.w;
|
|
194
|
-
y = p.y - (p.top ?? PA.top) * p.scale;
|
|
195
|
-
z = p.z + 0.5 + (o.layer === "back" ? -0.2 : o.layer === "front" ? 0.2 : 0);
|
|
196
|
-
}
|
|
197
|
-
depth = p.depth;
|
|
198
|
-
}
|
|
199
|
-
else if (heldBy[id]) {
|
|
200
|
-
const h = placed[heldBy[id]];
|
|
201
|
-
scale = h.scale * sizeK;
|
|
202
|
-
const hs = Math.sign(h.hand[0]) || 1;
|
|
203
|
-
x = h.x + h.hand[0] * h.scale + (A.kind === "any" ? hs * dims.w * 0.42 * scale : 0);
|
|
204
|
-
y = h.y + h.hand[1] * h.scale + (GRIP[res.id] ?? dims.h / 2) * scale;
|
|
205
|
-
z = h.z + 0.5;
|
|
206
|
-
depth = h.depth;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
// objetos de chão
|
|
210
|
-
if (A.kind === "surface")
|
|
211
|
-
warnings.push(`'${id}' (${res.id}) costuma ficar sobre uma superfície; adicione 'on: <mesa>'`);
|
|
212
|
-
const pref = ref("left_of") || ref("right_of") || ref("behind") || ref("in_front_of") || ref("under");
|
|
213
|
-
if (!depth) {
|
|
214
|
-
if (o.behind && pref)
|
|
215
|
-
depth = DEPTHS[Math.max(0, DEPTHS.indexOf(pref.depth) - 1)];
|
|
216
|
-
else if (o.in_front_of && pref)
|
|
217
|
-
depth = DEPTHS[Math.min(2, DEPTHS.indexOf(pref.depth) + 1)];
|
|
218
|
-
else
|
|
219
|
-
depth = (pref?.depth) || "near";
|
|
220
|
-
}
|
|
221
|
-
if (!DEPTHS.includes(depth)) {
|
|
222
|
-
warnings.push(`depth '${depth}' inválido em '${id}' (use near, mid, far)`);
|
|
223
|
-
depth = "near";
|
|
224
|
-
}
|
|
225
|
-
scale = U * sizeK * DEPTH_SCALE[depth];
|
|
226
|
-
const w = dims.w * scale;
|
|
227
|
-
const gap = (o.gap ?? 0.015) * W;
|
|
228
|
-
x = (SLOTS[o.at] ?? (typeof o.at === "number" ? o.at : 0.5)) * W;
|
|
229
|
-
if (o.left_of && pref)
|
|
230
|
-
x = pref.bx0 - gap - w / 2;
|
|
231
|
-
if (o.right_of && pref)
|
|
232
|
-
x = pref.bx1 + gap + w / 2;
|
|
233
|
-
if (o.behind && pref)
|
|
234
|
-
x = pref.x + (o.offset ?? 0.35) * pref.w;
|
|
235
|
-
if (o.in_front_of && pref)
|
|
236
|
-
x = pref.x + (o.offset ?? 0) * pref.w;
|
|
237
|
-
if (o.under && pref)
|
|
238
|
-
x = pref.x;
|
|
239
|
-
y = H * lines.base[depth];
|
|
240
|
-
z = DEPTHS.indexOf(depth) * 1000 + y;
|
|
241
|
-
if (A.kind === "floor")
|
|
242
|
-
z -= 400;
|
|
243
|
-
if (o.layer === "back")
|
|
244
|
-
z -= 300;
|
|
245
|
-
if (o.layer === "front")
|
|
246
|
-
z += 300;
|
|
247
|
-
}
|
|
248
|
-
const drawn = A.draw({ ...o }, theme);
|
|
249
|
-
if (drawn.box) {
|
|
250
|
-
dims.w = drawn.box.w;
|
|
251
|
-
dims.h = drawn.box.h;
|
|
252
|
-
}
|
|
253
|
-
const w = dims.w * scale, h = dims.h * scale;
|
|
254
|
-
let svg = typeof drawn === "string" ? drawn : drawn.svg;
|
|
255
|
-
if (A.outline)
|
|
256
|
-
svg = `<g stroke="${theme.ink}" stroke-width="${(1.6 / scale).toFixed(2)}" stroke-linejoin="round">${svg.replaceAll(`fill="${theme.shadow}"`, `fill="${theme.shadow}" stroke="none"`)}</g>`;
|
|
257
|
-
placed[id] = { id, asset: res.id, kind: A.kind, x, y, scale, w, h, z, depth, svg, top: A.topOf ? A.topOf(o) : A.top, noHaze: o.haze === false,
|
|
258
|
-
hand: drawn.hand, bx0: x - w / 2, bx1: x + w / 2, by0: y - h, by1: y, related: deps(o).concat(o.holds || [], heldBy[id] || []) };
|
|
259
|
-
}
|
|
260
|
-
// ---- olhar: `look: <id>` faz o personagem olhar para outro objeto da cena ----
|
|
261
|
-
for (const p of Object.values(placed)) {
|
|
262
|
-
const o = objs[p.id];
|
|
263
|
-
if (p.asset !== "person" || typeof o.look !== "string")
|
|
264
|
-
continue;
|
|
265
|
-
const tg = placed[o.look];
|
|
266
|
-
if (!tg) {
|
|
267
|
-
if (!["left", "right", "up", "down", "up-left", "up-right", "down-left", "down-right", "camera", "forward"].includes(o.look))
|
|
268
|
-
warnings.push(`'${p.id}' olha para '${o.look}', que não existe na cena`);
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
const dx = tg.x - p.x, dy = (tg.y - tg.h / 2) - (p.y - p.h * 0.85), len = Math.hypot(dx, dy) || 1;
|
|
272
|
-
const drawn = LIB.person.draw({ ...o, gaze: [dx / len, dy / len] }, theme);
|
|
273
|
-
p.svg = drawn.svg;
|
|
274
|
-
}
|
|
275
|
-
// ---- enquadramento (câmera) ----
|
|
276
|
-
// canvas.shot: wide (padrão) | full | medium | close; canvas.focus: id(s) ou grupo(s); canvas.frame: left | center | right | 0..1
|
|
277
|
-
const shot = c.shot || "wide";
|
|
278
|
-
const cam = { k: 1, tx: 0, ty: 0 };
|
|
279
|
-
if (shot !== "wide") {
|
|
280
|
-
const SHOT = { full: { fill: 0.55 }, medium: { show: 0.62, top: 0.12 }, close: { show: 0.3, top: 0.08 } }[shot];
|
|
281
|
-
if (!SHOT)
|
|
282
|
-
warnings.push(`shot '${shot}' inválido; use wide, full, medium ou close`);
|
|
283
|
-
else {
|
|
284
|
-
let ids = [];
|
|
285
|
-
for (const f of [].concat(c.focus || [])) {
|
|
286
|
-
const m = placed[f] ? [f] : Object.keys(placed).filter((k) => k.startsWith(f + "_"));
|
|
287
|
-
if (!m.length)
|
|
288
|
-
warnings.push(`focus '${f}' não existe na cena`);
|
|
289
|
-
ids.push(...m);
|
|
290
|
-
}
|
|
291
|
-
if (!ids.length)
|
|
292
|
-
ids = Object.keys(placed).filter((k) => placed[k].asset === "person");
|
|
293
|
-
if (!ids.length)
|
|
294
|
-
ids = Object.keys(placed).filter((k) => ["ground", "any"].includes(placed[k].kind));
|
|
295
|
-
let F = ids.map((i) => placed[i]);
|
|
296
|
-
// medium e close enquadram pessoas (cabeça e tronco); a mesa do grupo não deve ditar o zoom
|
|
297
|
-
if (SHOT.top != null && F.some((p) => p.asset === "person"))
|
|
298
|
-
F = F.filter((p) => p.asset === "person");
|
|
299
|
-
if (F.length) {
|
|
300
|
-
// braços abertos/erguidos passam da caixa do personagem: dá folga lateral às pessoas
|
|
301
|
-
const padX = (p) => (p.asset === "person" ? p.w * 0.5 : 0);
|
|
302
|
-
const fx0 = Math.min(...F.map((p) => p.bx0 - padX(p))), fx1 = Math.max(...F.map((p) => p.bx1 + padX(p)));
|
|
303
|
-
const fy0 = Math.min(...F.map((p) => p.by0)), fy1 = Math.max(...F.map((p) => p.by1));
|
|
304
|
-
// zoom pela altura do foco, limitado para o foco caber na largura (formatos verticais)
|
|
305
|
-
const top = c.headroom ?? SHOT.top, fh = Math.max(1, fy1 - fy0);
|
|
306
|
-
// full: o foco inteiro ocupa ~62% da altura; medium/close: no espaço abaixo do headroom cabe só
|
|
307
|
-
// a fração `show` do corpo (até o quadril / cabeça e ombros). Limitado para caber na largura.
|
|
308
|
-
const kh = SHOT.fill ? (SHOT.fill * H) / fh : ((1 - top) * H) / (SHOT.show * fh);
|
|
309
|
-
const k = Math.max(1, Math.min(6, kh, (0.8 * W) / Math.max(1, fx1 - fx0)));
|
|
310
|
-
const target = typeof c.frame === "number" ? c.frame : { left: 1 / 3, center: 0.5, right: 2 / 3 }[c.frame || "center"] ?? 0.5;
|
|
311
|
-
let tx = target * W - ((fx0 + fx1) / 2) * k;
|
|
312
|
-
let ty = top == null ? 0.55 * H - ((fy0 + fy1) / 2) * k : top * H - fy0 * k;
|
|
313
|
-
tx = Math.min(0, Math.max(W - W * k, tx));
|
|
314
|
-
ty = Math.min(0, Math.max(H - H * k, ty));
|
|
315
|
-
Object.assign(cam, { k, tx, ty });
|
|
316
|
-
for (const p of Object.values(placed)) {
|
|
317
|
-
p.x = p.x * k + tx;
|
|
318
|
-
p.y = p.y * k + ty;
|
|
319
|
-
p.scale *= k;
|
|
320
|
-
p.w *= k;
|
|
321
|
-
p.h *= k;
|
|
322
|
-
p.bx0 = p.bx0 * k + tx;
|
|
323
|
-
p.bx1 = p.bx1 * k + tx;
|
|
324
|
-
p.by0 = p.by0 * k + ty;
|
|
325
|
-
p.by1 = p.by1 * k + ty;
|
|
326
|
-
p.offView = p.bx1 < -0.02 * W || p.bx0 > 1.02 * W || p.by1 < -0.02 * H || p.by0 > 1.02 * H;
|
|
327
|
-
}
|
|
328
|
-
for (const p of F)
|
|
329
|
-
p.focus = true;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
// ---- verificações (feedback em texto) ----
|
|
334
|
-
const list = Object.values(placed);
|
|
335
|
-
for (const p of list) {
|
|
336
|
-
if (LIB[p.asset].backdrop)
|
|
337
|
-
continue;
|
|
338
|
-
const ox = Math.max(0, -p.bx0, p.bx1 - W) / p.w, oy = Math.max(0, -p.by0) / p.h;
|
|
339
|
-
if (cam.k > 1) {
|
|
340
|
-
if (p.focus && p.offView)
|
|
341
|
-
warnings.push(`'${p.id}' é foco mas ficou fora do enquadramento (shot: ${shot}); mude frame ou focus`);
|
|
342
|
-
// lasca: objeto cortado pela borda mostrando tão pouco que vira ruído visual
|
|
343
|
-
const vis = (Math.max(0, Math.min(W, p.bx1) - Math.max(0, p.bx0)) * Math.max(0, Math.min(H, p.by1) - Math.max(0, p.by0))) / Math.max(1, p.w * p.h);
|
|
344
|
-
if (!p.offView && vis > 0 && vis < 0.18 && !objs[p.id].allow_crop)
|
|
345
|
-
warnings.push(`'${p.id}' aparece só uma lasca (${Math.round(vis * 100)}%) na borda do enquadramento; remova-o, mova-o ou mostre mais dele`);
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
if ((ox > 0.05 || oy > 0.05) && !objs[p.id].allow_crop)
|
|
349
|
-
warnings.push(`'${p.id}' está ${Math.round(Math.max(ox, oy) * 100)}% fora do quadro`);
|
|
350
|
-
}
|
|
351
|
-
const blocking = list.filter((p) => ["ground", "any"].includes(p.kind) && !objs[p.id].on && !heldBy[p.id]);
|
|
352
|
-
for (let i = 0; i < list.length; i++)
|
|
353
|
-
for (let j = i + 1; j < list.length; j++) {
|
|
354
|
-
const a = list[i], b = list[j];
|
|
355
|
-
if (!blocking.includes(a) || !blocking.includes(b) || a.depth !== b.depth)
|
|
356
|
-
continue;
|
|
357
|
-
if (a.related.includes(b.id) || b.related.includes(a.id))
|
|
358
|
-
continue;
|
|
359
|
-
if (LIB[a.asset].hollow || LIB[b.asset].hollow)
|
|
360
|
-
continue; // tampos/prateleiras: o espaço embaixo é livre
|
|
361
|
-
if ((objs[a.id].layer || "") !== (objs[b.id].layer || ""))
|
|
362
|
-
continue; // camadas diferentes de propósito
|
|
363
|
-
const ix = Math.max(0, Math.min(a.bx1, b.bx1) - Math.max(a.bx0, b.bx0));
|
|
364
|
-
const iy = Math.max(0, Math.min(a.by1, b.by1) - Math.max(a.by0, b.by0));
|
|
365
|
-
const frac = (ix * iy) / Math.min(a.w * a.h, b.w * b.h);
|
|
366
|
-
if (frac > 0.2)
|
|
367
|
-
warnings.push(`'${a.id}' sobrepõe '${b.id}' em ${Math.round(frac * 100)}%; use left_of/right_of ou depth diferente`);
|
|
368
|
-
}
|
|
369
|
-
// ---- fundo ----
|
|
370
|
-
const t = theme;
|
|
371
|
-
const hz = H * lines.horizon;
|
|
372
|
-
// perspectiva atmosférica: o que está longe se mistura à cor do ar e perde contraste
|
|
373
|
-
const air = setting === "indoor" ? t.wall : t.skyBottom;
|
|
374
|
-
const [ar, ag, ab] = [1, 3, 5].map((i) => parseInt(air.slice(i, i + 2), 16) / 255);
|
|
375
|
-
const HAZE = setting === "indoor" ? { far: 0.08, mid: 0.04 } : { far: 0.32, mid: 0.13 };
|
|
376
|
-
if (c.haze === false) {
|
|
377
|
-
HAZE.far = 0;
|
|
378
|
-
HAZE.mid = 0;
|
|
379
|
-
}
|
|
380
|
-
const hazeFilter = (id, k) => `<filter id="${id}" color-interpolation-filters="sRGB"><feColorMatrix type="matrix" values="${1 - k} 0 0 0 ${(ar * k).toFixed(3)} 0 ${1 - k} 0 0 ${(ag * k).toFixed(3)} 0 0 ${1 - k} 0 ${(ab * k).toFixed(3)} 0 0 0 1 0"/></filter>`;
|
|
381
|
-
const sm = (t.shadow.match(/[\d.]+/g) || [0, 0, 0, 0.15]).map(Number);
|
|
382
|
-
let bg = `<defs><linearGradient id="sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${t.skyTop}"/><stop offset="1" stop-color="${t.skyBottom}"/></linearGradient>` +
|
|
383
|
-
`<radialGradient id="cshadow"><stop offset="0" stop-color="rgb(${sm[0]},${sm[1]},${sm[2]})" stop-opacity="${sm[3] * 1.5}"/><stop offset="0.55" stop-color="rgb(${sm[0]},${sm[1]},${sm[2]})" stop-opacity="${sm[3] * 1.1}"/><stop offset="1" stop-color="rgb(${sm[0]},${sm[1]},${sm[2]})" stop-opacity="0"/></radialGradient>` +
|
|
384
|
-
hazeFilter("hazeFar", HAZE.far) + hazeFilter("hazeMid", HAZE.mid) + `</defs>`;
|
|
385
|
-
let bgAtText = t.skyTop;
|
|
386
|
-
if (setting === "indoor") {
|
|
387
|
-
bgAtText = t.wall;
|
|
388
|
-
bg += `<rect width="${W}" height="${hz}" fill="${t.wall}"/><rect y="${hz}" width="${W}" height="${H - hz}" fill="${t.floor}"/>` +
|
|
389
|
-
`<rect y="${hz - 8}" width="${W}" height="10" fill="${t.woodDark}" opacity="0.35"/>`;
|
|
390
|
-
if (c.floor === "planks") {
|
|
391
|
-
// tábuas em perspectiva, convergindo para um ponto de fuga acima da parede
|
|
392
|
-
const vx = W * (c.vanish ?? 0.5), vy = hz - H * 0.9, n = 16;
|
|
393
|
-
const atY = (x0, y) => vx + (x0 - vx) * (y - vy) / (H - vy);
|
|
394
|
-
for (let i = -6; i < n + 6; i++) {
|
|
395
|
-
const x0 = (i / n) * W * 1.6 - W * 0.3, x1 = ((i + 1) / n) * W * 1.6 - W * 0.3;
|
|
396
|
-
bg += `<path d="M${atY(x0, hz).toFixed(1)} ${hz} L${atY(x1, hz).toFixed(1)} ${hz} L${x1.toFixed(1)} ${H} L${x0.toFixed(1)} ${H} Z" fill="${sh(t.floor, (i % 3) * 0.03 - 0.03)}"/>` +
|
|
397
|
-
`<path d="M${atY(x0, hz).toFixed(1)} ${hz} L${x0.toFixed(1)} ${H}" stroke="${sh(t.floor, -0.3)}" stroke-width="1.2" opacity="0.6"/>`;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
else
|
|
401
|
-
for (let i = 1; i < 8; i++)
|
|
402
|
-
bg += `<rect x="0" y="${(hz + (H - hz) * (i / 8) ** 1.4 - 0.75).toFixed(1)}" width="${W}" height="1.5" fill="${t.woodDark}" opacity="0.15"/>`;
|
|
403
|
-
}
|
|
404
|
-
else if (setting === "beach") {
|
|
405
|
-
const sea = H * lines.sea;
|
|
406
|
-
bg += `<rect width="${W}" height="${H}" fill="url(#sky)"/><rect y="${hz}" width="${W}" height="${sea - hz}" fill="${t.sea}"/>` +
|
|
407
|
-
`<path d="M0 ${sea} Q${W * 0.25} ${sea - 14} ${W * 0.5} ${sea} T${W} ${sea} L${W} ${H} L0 ${H} Z" fill="${t.ground}"/>`;
|
|
408
|
-
for (let i = 0; i < 6; i++)
|
|
409
|
-
bg += `<path d="M${W * (0.08 + i * 0.17)} ${hz + 18 + (i % 3) * 22} q14 -6 28 0" stroke="${t.seaLight}" stroke-width="3" fill="none" stroke-linecap="round"/>`;
|
|
410
|
-
bg += `<path d="M0 ${sea - 4} Q${W * 0.25} ${sea - 18} ${W * 0.5} ${sea - 4} T${W} ${sea - 4}" stroke="${t.paper}" stroke-width="4" fill="none" opacity="0.7"/>`;
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
bg += `<rect width="${W}" height="${H}" fill="url(#sky)"/>`;
|
|
414
|
-
if (setting === "outdoor")
|
|
415
|
-
bg += `<path d="M0 ${hz} Q${W * 0.2} ${hz - 50} ${W * 0.45} ${hz - 10} T${W} ${hz - 30} L${W} ${H} L0 ${H} Z" fill="${t.groundDark}" opacity="0.55"/>`;
|
|
416
|
-
bg += `<path d="M0 ${hz + 12} Q${W * 0.3} ${hz - 6} ${W * 0.6} ${hz + 10} T${W} ${hz + 4} L${W} ${H} L0 ${H} Z" fill="${t.ground}"/>`;
|
|
417
|
-
if (setting === "city")
|
|
418
|
-
bg += `<rect y="${H * 0.86}" width="${W}" height="${H * 0.14}" fill="${t.groundDark}"/>` +
|
|
419
|
-
Array.from({ length: 10 }, (_, i) => `<rect x="${i * W / 10 + 20}" y="${H * 0.925}" width="${W / 20}" height="5" fill="${t.primary}" opacity="0.5"/>`).join("");
|
|
420
|
-
}
|
|
421
|
-
// ---- texto ----
|
|
422
|
-
// Campos: content (\n quebra linha), at (top|bottom-left|center|right), role (title|subtitle|label|body),
|
|
423
|
-
// opcionais: y (fração da altura, linha de base), size (fração da altura), weight, color, box (cor de fundo), pad.
|
|
424
|
-
let textSvg = "";
|
|
425
|
-
const textRects = [];
|
|
426
|
-
for (const tx of scene.text || []) {
|
|
427
|
-
const role = tx.role || "title";
|
|
428
|
-
const fs = tx.size ? tx.size * H : ({ title: H * 0.075, subtitle: H * 0.036, label: H * 0.028, body: H * 0.032 }[role] || H * 0.04);
|
|
429
|
-
const [vy, hx] = (tx.at || "top-left").split("-");
|
|
430
|
-
const m = W * 0.06;
|
|
431
|
-
const anchor = hx === "center" ? "middle" : hx === "right" ? "end" : "start";
|
|
432
|
-
const xx = tx.x != null ? tx.x * W : hx === "center" ? W / 2 : hx === "right" ? W - m : m;
|
|
433
|
-
const lines = String(tx.content).split("\n");
|
|
434
|
-
const lh = fs * 1.2;
|
|
435
|
-
let yy = vy === "bottom" ? H - m * 0.7 - (lines.length - 1) * lh : m + fs * 0.9;
|
|
436
|
-
if (tx.y == null && role === "subtitle" && (scene.text || []).some((o) => (o.role || "title") === "title" && o.at === tx.at && o.y == null))
|
|
437
|
-
yy += H * 0.075 * 0.9 + fs * 0.8;
|
|
438
|
-
if (tx.y != null)
|
|
439
|
-
yy = tx.y * H;
|
|
440
|
-
const color = tx.color ? (t[tx.color] || tx.color) : t.text;
|
|
441
|
-
let ratio = contrast(color, bgAtText);
|
|
442
|
-
const estW = Math.max(...lines.map((l) => l.length)) * fs * (tx.weight >= 700 || role === "title" ? 0.6 : 0.565);
|
|
443
|
-
const x0 = anchor === "start" ? xx : anchor === "end" ? xx - estW : xx - estW / 2;
|
|
444
|
-
const blockH = fs + (lines.length - 1) * lh;
|
|
445
|
-
textRects.push({ x0, y0: yy - fs, x1: x0 + estW, y1: yy + blockH - fs * 0.75, box: !!tx.box });
|
|
446
|
-
if (tx.box) {
|
|
447
|
-
const bfill = t[tx.box] || tx.box, pad = (tx.pad ?? 0.45) * fs;
|
|
448
|
-
ratio = contrast(color, bfill);
|
|
449
|
-
textSvg += `<rect x="${(x0 - pad).toFixed(1)}" y="${(yy - fs * 1.05 - pad * 0.3).toFixed(1)}" width="${(estW + pad * 2).toFixed(1)}" height="${(blockH + fs * 0.45 + pad * 0.6).toFixed(1)}" rx="${(tx.radius ?? 0.35) * fs}" fill="${bfill}"/>`;
|
|
450
|
-
}
|
|
451
|
-
if (ratio < 4.5)
|
|
452
|
-
warnings.push(`texto "${lines[0]}" com contraste ${ratio.toFixed(1)}:1 (mín. 4.5); troque 'color' ou use 'box'`);
|
|
453
|
-
for (const p of list) {
|
|
454
|
-
if (LIB[p.asset].backdrop)
|
|
455
|
-
continue;
|
|
456
|
-
const ix = Math.max(0, Math.min(p.bx1, x0 + estW) - Math.max(p.bx0, x0)), iy = Math.max(0, Math.min(p.by1, yy + blockH - fs + fs * 0.25) - Math.max(p.by0, yy - fs));
|
|
457
|
-
if (ix * iy > 0.06 * estW * blockH || ix * iy > 0.12 * p.w * p.h)
|
|
458
|
-
warnings.push(`texto "${lines[0]}" cobre '${p.id}'`);
|
|
459
|
-
}
|
|
460
|
-
const weight = tx.weight || (role === "title" ? 700 : role === "body" ? 400 : 500);
|
|
461
|
-
const esc = (v) => v.replace(/&/g, "&").replace(/</g, "<");
|
|
462
|
-
textSvg += `<text x="${xx.toFixed(1)}" y="${yy.toFixed(1)}" font-family="${FONT}" font-size="${fs.toFixed(1)}" font-weight="${weight}" fill="${color}" text-anchor="${anchor}">` +
|
|
463
|
-
lines.map((l, i) => i === 0 ? `<tspan x="${xx.toFixed(1)}">${esc(l)}</tspan>` : `<tspan x="${xx.toFixed(1)}" dy="${lh.toFixed(1)}">${esc(l)}</tspan>`).join("") + `</text>`;
|
|
464
|
-
}
|
|
465
|
-
// ---- luz global ----
|
|
466
|
-
// canvas.light: false | { from: left|right|front|0..1, strength: 0..1 }. Sem valor: segue o sol/lua/janela da cena.
|
|
467
|
-
const KL = KIT.light || {};
|
|
468
|
-
const lc = c.light === false || (KL.mode === "none" && c.light == null) ? null : typeof c.light === "object" ? c.light : {};
|
|
469
|
-
const hatch = KL.mode === "hatch";
|
|
470
|
-
const night = luminance(setting === "indoor" ? t.wall : t.skyTop) < 0.12;
|
|
471
|
-
let light = null;
|
|
472
|
-
if (lc) {
|
|
473
|
-
let lx = typeof lc.from === "number" ? lc.from : { left: 0.05, right: 0.95, front: 0.5, top: 0.5 }[lc.from];
|
|
474
|
-
if (lx == null) {
|
|
475
|
-
const src = list.find((p) => ["sun", "moon"].includes(p.asset)) || (setting === "indoor" && list.find((p) => p.asset === "window"));
|
|
476
|
-
lx = src ? src.x / W : 0.15;
|
|
477
|
-
}
|
|
478
|
-
const s = lc.strength ?? KL.strength ?? 0.6, dir = lx < 0.4 ? 1 : lx > 0.6 ? -1 : 0;
|
|
479
|
-
const lcol = night ? "#C9D8FF" : "#FFF4DE", scol = `rgb(${sm[0]},${sm[1]},${sm[2]})`;
|
|
480
|
-
const [x1, x2] = dir >= 0 ? [0, 1] : [1, 0];
|
|
481
|
-
light = { lx, s, dir, lcol, scol };
|
|
482
|
-
bg = bg.replace("</defs>",
|
|
483
|
-
// sombreamento de volume: lado iluminado clareia, lado oposto escurece; base escurece (oclusão)
|
|
484
|
-
`<linearGradient id="lgShade" x1="${dir ? x1 : 0.5}" y1="0" x2="${dir ? x2 : 0.5}" y2="${dir ? 0.35 : 1}"><stop offset="0" stop-color="${lcol}" stop-opacity="${(0.26 * s).toFixed(3)}"/><stop offset="0.42" stop-color="${lcol}" stop-opacity="0"/><stop offset="0.6" stop-color="${scol}" stop-opacity="0"/><stop offset="1" stop-color="${scol}" stop-opacity="${(0.5 * s).toFixed(3)}"/></linearGradient>` +
|
|
485
|
-
`<linearGradient id="lgAO" x1="0" y1="0" x2="0" y2="1"><stop offset="0.72" stop-color="${scol}" stop-opacity="0"/><stop offset="1" stop-color="${scol}" stop-opacity="${(0.32 * s).toFixed(3)}"/></linearGradient>` +
|
|
486
|
-
`<filter id="toWhite" color-interpolation-filters="sRGB"><feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/></filter>` +
|
|
487
|
-
`<filter id="castF" x="-30%" y="-30%" width="160%" height="160%" color-interpolation-filters="sRGB"><feColorMatrix values="0 0 0 0 ${(sm[0] / 255).toFixed(3)} 0 0 0 0 ${(sm[1] / 255).toFixed(3)} 0 0 0 0 ${(sm[2] / 255).toFixed(3)} 0 0 0 1 0"/><feGaussianBlur stdDeviation="${(H * (setting === "indoor" ? 0.006 : 0.003)).toFixed(1)}"/></filter>` +
|
|
488
|
-
`<clipPath id="groundClip"><rect y="${(hz * cam.k + cam.ty).toFixed(1)}" width="${W}" height="${H}"/></clipPath>` +
|
|
489
|
-
`<radialGradient id="glow" cx="${lx}" cy="${setting === "indoor" ? 0.25 : 0.15}" r="0.75"><stop offset="0" stop-color="${lcol}" stop-opacity="${(0.55 * s).toFixed(3)}"/><stop offset="1" stop-color="${lcol}" stop-opacity="0"/></radialGradient>` +
|
|
490
|
-
`<linearGradient id="falloff" x1="${x1}" y1="0" x2="${x2}" y2="0"><stop offset="0.35" stop-color="${scol}" stop-opacity="0"/><stop offset="1" stop-color="${scol}" stop-opacity="${dir ? (0.13 * s).toFixed(3) : 0}"/></linearGradient>` +
|
|
491
|
-
(hatch ? hatchDefs(t.ink) : "") +
|
|
492
|
-
`<radialGradient id="vignette" cx="0.5" cy="0.5" r="0.75"><stop offset="0.6" stop-color="${scol}" stop-opacity="0"/><stop offset="1" stop-color="${scol}" stop-opacity="${(0.17 * s).toFixed(3)}"/></radialGradient></defs>`);
|
|
493
|
-
if (hatch) { /* gravura: sem brilhos e degradês de ambiente */ }
|
|
494
|
-
else if (setting === "indoor")
|
|
495
|
-
bg += `<rect width="${W}" height="${hz}" fill="url(#glow)"/><rect width="${W}" height="${H}" fill="url(#falloff)"/>`;
|
|
496
|
-
else
|
|
497
|
-
bg += `<rect width="${W}" height="${H * 0.75}" fill="url(#glow)"/>`;
|
|
498
|
-
}
|
|
499
|
-
// ---- montagem ----
|
|
500
|
-
if (cam.k !== 1)
|
|
501
|
-
bg = `<g transform="translate(${cam.tx.toFixed(1)} ${cam.ty.toFixed(1)}) scale(${cam.k.toFixed(4)})">${bg}</g>`;
|
|
502
|
-
const SHADOW_RE = /<ellipse cx="([-\d.]+)" cy="0" rx="([\d.]+)" ry="([\d.]+)" fill="[^"]*"( stroke="none")?\s*\/>/;
|
|
503
|
-
const casts = [];
|
|
504
|
-
const pieces = list.sort((a, b) => a.z - b.z).filter((p) => !p.offView).map((p) => {
|
|
505
|
-
const cord = p.kind === "ceiling" ? `<path d="M${p.x.toFixed(1)} 0 L${p.x.toFixed(1)} ${(p.y - p.h).toFixed(1)}" stroke="${t.ink}" stroke-width="2"/>` : "";
|
|
506
|
-
const hz = p.noHaze ? "" : p.depth === "far" && HAZE.far ? " filter=\"url(#hazeFar)\"" : p.depth === "mid" && HAZE.mid ? " filter=\"url(#hazeMid)\"" : "";
|
|
507
|
-
let shadow = "";
|
|
508
|
-
const art = p.svg.replace(SHADOW_RE, (m, cx, rx, ry) => {
|
|
509
|
-
if (!m.includes(t.shadow))
|
|
510
|
-
return m;
|
|
511
|
-
shadow = `<ellipse cx="${cx}" cy="0" rx="${(rx * 1.25).toFixed(1)}" ry="${(ry * 1.4).toFixed(1)}" fill="url(#cshadow)"/>`;
|
|
512
|
-
return "";
|
|
513
|
-
});
|
|
514
|
-
const T = `translate(${p.x.toFixed(1)} ${p.y.toFixed(1)}) scale(${p.scale.toFixed(3)})`;
|
|
515
|
-
const o = objs[p.id] || {};
|
|
516
|
-
const A = LIB[p.asset] || {};
|
|
517
|
-
let shade = "";
|
|
518
|
-
const lit = light && !A.backdrop && !["sky", "floor"].includes(p.kind) && o.light !== false;
|
|
519
|
-
if (lit) {
|
|
520
|
-
const k = { near: 1, mid: 0.6, far: 0.3 }[p.depth] ?? 1;
|
|
521
|
-
const pad = 0.2;
|
|
522
|
-
const [rx, ry, rw, rh] = [p.bx0 - p.w * pad, p.by0 - p.h * pad, p.w * (1 + 2 * pad), p.h * (1 + pad)].map((v) => v.toFixed(1));
|
|
523
|
-
const mk = `<mask id="mk_${p.id}" maskUnits="userSpaceOnUse" x="${rx}" y="${ry}" width="${rw}" height="${rh}"><use href="#b_${p.id}" transform="${T}" filter="url(#toWhite)"/></mask>`;
|
|
524
|
-
if (hatch) {
|
|
525
|
-
// gravura: hachura só no lado da sombra (metade oposta à luz; de frente, a parte de baixo)
|
|
526
|
-
const d = light.dir, hx0 = d > 0 ? p.x + p.w * 0.08 : +rx, hx1 = d < 0 ? p.x - p.w * 0.08 : +rx + +rw;
|
|
527
|
-
const [hy0, hy1] = d ? [+ry, +ry + +rh] : [p.by0 + p.h * 0.6, +ry + +rh];
|
|
528
|
-
shade = mk + `<g mask="url(#mk_${p.id})" opacity="${k}"><rect x="${hx0.toFixed(1)}" y="${hy0.toFixed(1)}" width="${Math.max(0, hx1 - hx0).toFixed(1)}" height="${Math.max(0, hy1 - hy0).toFixed(1)}" fill="url(#hatchP)"/></g>`;
|
|
529
|
-
}
|
|
530
|
-
else
|
|
531
|
-
shade = mk + `<g mask="url(#mk_${p.id})" opacity="${k}"><rect x="${rx}" y="${ry}" width="${rw}" height="${rh}" fill="url(#lgShade)"/>` +
|
|
532
|
-
(["ground", "any"].includes(p.kind) && !o.on ? `<rect x="${p.bx0.toFixed(1)}" y="${p.by0.toFixed(1)}" width="${p.w.toFixed(1)}" height="${p.h.toFixed(1)}" fill="url(#lgAO)"/>` : "") + `</g>`;
|
|
533
|
-
// sombra projetada no chão: silhueta achatada e inclinada para longe da luz
|
|
534
|
-
if (KL.casts !== false && ["ground", "any"].includes(p.kind) && !o.on && !heldBy[p.id] && !(o.elevation > 0) && !["mountain", "cloud"].includes(p.asset)) {
|
|
535
|
-
const indoor = setting === "indoor";
|
|
536
|
-
const kk = indoor ? 0.13 : 0.24, sx = (indoor ? 0.35 : 0.75) * light.dir;
|
|
537
|
-
casts.push(`<use href="#b_${p.id}" transform="translate(${p.x.toFixed(1)} ${p.y.toFixed(1)}) matrix(1 0 ${(-sx).toFixed(3)} ${kk} 0 0) scale(${p.scale.toFixed(3)})"/>`);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
p.bodySvg = `<g transform="${T}">${art}</g>`;
|
|
541
|
-
// contorno (outline/hatch) e sombra de recorte (paper), por objeto, com espessura constante em px
|
|
542
|
-
const deco = !A.backdrop && !["sky", "floor"].includes(p.kind) && o.kit !== false;
|
|
543
|
-
let art2 = art, fx = "", defs = "";
|
|
544
|
-
if (deco && KIT.outline) {
|
|
545
|
-
if (KIT.outline.inner)
|
|
546
|
-
art2 = innerStroke(art, KIT.outline.inner / p.scale, t.ink);
|
|
547
|
-
defs += outlineFilter(`ol_${p.id}`, KIT.outline.w / p.scale, t.ink);
|
|
548
|
-
fx = `ol_${p.id}`;
|
|
549
|
-
}
|
|
550
|
-
if (deco && KIT.drop) {
|
|
551
|
-
defs += dropFilter(`dr_${p.id}`, p.scale);
|
|
552
|
-
fx = `dr_${p.id}`;
|
|
553
|
-
}
|
|
554
|
-
// sombra de contato fica fora do contorno (senão vira um anel em volta da elipse)
|
|
555
|
-
const contact = shadow ? `<g transform="${T}"${hz}>${shadow}</g>` : "";
|
|
556
|
-
const inner = `<g id="${p.id}" transform="${T}"${hz}><g id="b_${p.id}">${art2}</g></g>`;
|
|
557
|
-
return cord + contact + (fx ? `${defs}<g filter="url(#${fx})">${inner}</g>` : inner) + shade;
|
|
558
|
-
});
|
|
559
|
-
const castLayer = !casts.length
|
|
560
|
-
? ""
|
|
561
|
-
: hatch
|
|
562
|
-
? `<mask id="castM" maskUnits="userSpaceOnUse" x="0" y="0" width="${W}" height="${H}"><g filter="url(#toWhite)">${casts.join("")}</g></mask><g clip-path="url(#groundClip)"><rect width="${W}" height="${H}" fill="url(#hatchC)" mask="url(#castM)"/></g>`
|
|
563
|
-
: `<g clip-path="url(#groundClip)" opacity="${((night ? 0.5 : setting === "indoor" ? 0.75 : 1) * 0.42 * light.s).toFixed(3)}"><g filter="url(#castF)">${casts.join("")}</g></g>`;
|
|
564
|
-
const body = pieces.join("\n");
|
|
565
|
-
const vignette = light && !hatch ? `<rect width="${W}" height="${H}" fill="url(#vignette)"/>` : "";
|
|
566
|
-
const grain = c.grain ? `<filter id="grain"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0"/></filter><rect width="${W}" height="${H}" filter="url(#grain)" opacity="0.10"/>` : "";
|
|
567
|
-
const head = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}">`;
|
|
568
|
-
// filtro de cena (riso/sketch) envolve fundo + objetos; textura vai por cima, abaixo do texto
|
|
569
|
-
const sceneArt = KIT.scene ? `<defs>${sceneFilter(KIT.scene, t)}</defs><g filter="url(#kitScene)">${bg}\n${castLayer}\n${body}\n${vignette}</g>` : `${bg}\n${castLayer}\n${body}\n${vignette}`;
|
|
570
|
-
const svg = flattenOpacity(`${head}\n${sceneArt}\n${texture(KIT.texture, W, H)}\n${grain}\n${textSvg}\n</svg>`);
|
|
571
|
-
// ---- entrada do diretor de arte (a crítica em si roda em scenec/render, que usa o resvg) ----
|
|
572
|
-
const critiqueInput = c.critique === false
|
|
573
|
-
? null
|
|
574
|
-
: { W, H, head, bg: flattenOpacity(bg), scene: flattenOpacity(sceneArt), theme: t, scale: c.scale ?? 1, textRects, skip: KIT.scene === "sketch" ? ["silhouette"] : [],
|
|
575
|
-
objects: list.filter((p) => !p.offView).map((p) => ({ id: p.id, asset: p.asset, kind: p.kind, z: p.z, body: flattenOpacity(p.bodySvg), related: p.related, ignore: !!(LIB[p.asset].backdrop || objs[p.id].critique === false) })) };
|
|
576
|
-
const description = list.map((p) => `${p.id} (${p.asset}): x=${Math.round((p.x / W) * 100)}%, base=${Math.round((p.y / H) * 100)}%, ` +
|
|
577
|
-
`${Math.round((p.w / W) * 100)}%×${Math.round((p.h / H) * 100)}% do quadro${p.depth ? ", " + p.depth : ""}`).join("\n");
|
|
578
|
-
const pct = (v, d) => +((v / d) * 100).toFixed(1);
|
|
579
|
-
const layout = list.map((p) => ({ id: p.id, asset: p.asset, x: pct(p.x, W), base: pct(p.y, H), w: pct(p.w, W), h: pct(p.h, H) }));
|
|
580
|
-
return { svg, warnings: [...new Set(warnings)], description, layout, critiqueInput };
|
|
581
|
-
}
|