From 823b57bc2a58827c2e27809f4894e0755133b1b2 Mon Sep 17 00:00:00 2001 From: Max Van den Eynde Date: Tue, 21 Jul 2026 09:12:55 +0200 Subject: [PATCH] Solved some issue with adding lights to the editor --- include/atlas/runtime/context.h | 2 +- include/atlas/window.h | 10 +- runtime/lib/context.cpp | 61 +- tests/ddgi/Red.amat | 33 + tests/ddgi/lib/atlas.d.ts | 2535 +++++++++++++++++++++++++++++++ tests/ddgi/main.ascene | 201 +++ tests/ddgi/package-lock.json | 512 +++++++ tests/ddgi/package.json | 13 + tests/ddgi/project.atlas | 23 + tests/ddgi/tsconfig.json | 49 + 10 files changed, 3412 insertions(+), 27 deletions(-) create mode 100644 tests/ddgi/Red.amat create mode 100644 tests/ddgi/lib/atlas.d.ts create mode 100644 tests/ddgi/main.ascene create mode 100644 tests/ddgi/package-lock.json create mode 100644 tests/ddgi/package.json create mode 100644 tests/ddgi/project.atlas create mode 100644 tests/ddgi/tsconfig.json diff --git a/include/atlas/runtime/context.h b/include/atlas/runtime/context.h index 0b1023a9..6b7513e8 100644 --- a/include/atlas/runtime/context.h +++ b/include/atlas/runtime/context.h @@ -149,7 +149,7 @@ class Context { bool setObjectParent(int childId, int parentId); bool deleteObject(int id); int createObject(const std::string &type, const std::string &name); - std::string objectDefinitionJson(int id) const; + std::string objectDefinitionJson(int id); int pasteObjectDefinition(const std::string &definition); int pasteObjectDefinition( const std::string &definition, diff --git a/include/atlas/window.h b/include/atlas/window.h index 9c0958f2..474b9893 100644 --- a/include/atlas/window.h +++ b/include/atlas/window.h @@ -7,8 +7,8 @@ Copyright (c) 2025 maxvdec */ -#ifndef WINDOW_H -#define WINDOW_H +#ifndef ATLAS_WINDOW_H +#define ATLAS_WINDOW_H #include "atlas/camera.h" #include "atlas/core/windowing.h" @@ -902,8 +902,8 @@ class Window { void updateBackbufferTarget(int backbufferWidth, int backbufferHeight); void renderEditorControls( const std::shared_ptr &commandBuffer); - void renderEditorGrid( - const std::shared_ptr &commandBuffer); + void + renderEditorGrid(const std::shared_ptr &commandBuffer); void renderEditorOverlays( const std::shared_ptr &commandBuffer); void updateEditorControlGeometry(); @@ -1062,4 +1062,4 @@ class Window { friend struct Fluid; }; -#endif // WINDOW_H +#endif // ATLAS_WINDOW_H diff --git a/runtime/lib/context.cpp b/runtime/lib/context.cpp index 8469b1b9..eba91b01 100644 --- a/runtime/lib/context.cpp +++ b/runtime/lib/context.cpp @@ -5455,42 +5455,44 @@ int Context::createObject(const std::string &type, const std::string &name) { auto light = std::make_unique(position, Color::white(), 50.0f, Color::white(), 1.0f); light->createDebugObject(); - int id = registerEditorLightObject(*this, light->debugObject, - json::object(), "pointLight"); + auto debugObject = light->debugObject; + int id = registerEditorLightObject(*this, debugObject, json::object(), + "pointLight"); if (id < 0) { return -1; } const std::string displayName = uniqueEditorObjectName(*this, name.empty() ? "Point Light" : name); - light->debugObject->name = displayName; + debugObject->name = displayName; objectNames[id] = displayName; objectSceneReferences[id] = std::to_string(id); - registerObjectReference(*this, displayName, light->debugObject.get()); + registerObjectReference(*this, displayName, debugObject.get()); editorPointLights[id] = light.get(); scene->addLight(light.get()); pointLights.push_back(std::move(light)); - window->selectEditorObject(light->debugObject.get(), true); + window->selectEditorObject(debugObject.get(), true); return id; } else if (solidType == "spotlight" || solidType == "spot") { auto light = std::make_unique(position, Position3d::down(), Color::white(), 35.0f, 40.0f, Color::white(), 1.0f, 50.0f); light->createDebugObject(); - int id = registerEditorLightObject(*this, light->debugObject, - json::object(), "spotLight"); + auto debugObject = light->debugObject; + int id = registerEditorLightObject(*this, debugObject, json::object(), + "spotLight"); if (id < 0) { return -1; } const std::string displayName = uniqueEditorObjectName(*this, name.empty() ? "Spot Light" : name); - light->debugObject->name = displayName; + debugObject->name = displayName; objectNames[id] = displayName; objectSceneReferences[id] = std::to_string(id); - registerObjectReference(*this, displayName, light->debugObject.get()); + registerObjectReference(*this, displayName, debugObject.get()); editorSpotlights[id] = light.get(); scene->addSpotlight(light.get()); spotlights.push_back(std::move(light)); - window->selectEditorObject(light->debugObject.get(), true); + window->selectEditorObject(debugObject.get(), true); return id; } else if (solidType == "directionallight" || solidType == "directional" || solidType == "sun") { @@ -5519,21 +5521,22 @@ int Context::createObject(const std::string &type, const std::string &name) { auto light = std::make_unique(); light->position = position; light->createDebugObject(); - int id = registerEditorLightObject(*this, light->debugObject, - json::object(), "areaLight"); + auto debugObject = light->debugObject; + int id = registerEditorLightObject(*this, debugObject, json::object(), + "areaLight"); if (id < 0) { return -1; } const std::string displayName = uniqueEditorObjectName(*this, name.empty() ? "Area Light" : name); - light->debugObject->name = displayName; + debugObject->name = displayName; objectNames[id] = displayName; objectSceneReferences[id] = std::to_string(id); - registerObjectReference(*this, displayName, light->debugObject.get()); + registerObjectReference(*this, displayName, debugObject.get()); editorAreaLights[id] = light.get(); scene->addAreaLight(light.get()); areaLights.push_back(std::move(light)); - window->selectEditorObject(light->debugObject.get(), true); + window->selectEditorObject(debugObject.get(), true); return id; } else if (solidType == "ambientlight" || solidType == "ambient") { scene->setAmbientColor(Color::white()); @@ -5591,10 +5594,15 @@ int Context::createObject(const std::string &type, const std::string &name) { return id; } -std::string Context::objectDefinitionJson(int id) const { +std::string Context::objectDefinitionJson(int id) { GameObject *object = findContextObject(*this, id); - return object != nullptr ? serializeNewObject(*this, *object).dump() - : std::string(); + if (object == nullptr) { + return {}; + } + if (isEditorLightObject(*this, *object)) { + return serializeEditorLightObject(*this, *object).dump(); + } + return serializeNewObject(*this, *object).dump(); } int Context::pasteObjectDefinition(const std::string &definition) { @@ -5623,9 +5631,20 @@ int Context::pasteObjectDefinition(const std::string &definition) { json sceneData = loadJsonFile(currentSceneFile); if (!sceneData.is_object()) return -1; - if (!sceneData.contains("objects") || !sceneData["objects"].is_array()) - sceneData["objects"] = json::array(); - sceneData["objects"].push_back(objectData); + const std::string type = + normalizeToken(objectData.value("type", std::string())); + const bool isLight = + type == "point" || type == "pointlight" || type == "spot" || + type == "spotlight" || type == "directional" || + type == "directionallight" || type == "sun" || type == "area" || + type == "arealight" || type == "ambient" || + type == "ambientlight"; + const char *collection = isLight ? "lights" : "objects"; + if (!sceneData.contains(collection) || + !sceneData[collection].is_array()) { + sceneData[collection] = json::array(); + } + sceneData[collection].push_back(objectData); std::ofstream output(currentSceneFile, std::ios::trunc); if (!output.is_open()) return -1; diff --git a/tests/ddgi/Red.amat b/tests/ddgi/Red.amat new file mode 100644 index 00000000..c3793c6d --- /dev/null +++ b/tests/ddgi/Red.amat @@ -0,0 +1,33 @@ +{ + "material": { + "albedo": [ + 0.8374150991439819, + 0, + 0, + 1 + ], + "ao": 1, + "emissiveColor": [ + 0, + 0, + 0, + 1 + ], + "emissiveIntensity": 0, + "ior": 1.45, + "metallic": 1, + "normalMapStrength": 1, + "reflectivity": 1, + "roughness": 0.5, + "textureOffset": [ + 0, + 0 + ], + "textureScale": [ + 1, + 1 + ], + "transmittance": 0, + "useNormalMap": true + } +} diff --git a/tests/ddgi/lib/atlas.d.ts b/tests/ddgi/lib/atlas.d.ts new file mode 100644 index 00000000..ab2b119e --- /dev/null +++ b/tests/ddgi/lib/atlas.d.ts @@ -0,0 +1,2535 @@ +// +// atlas.d.ts +// As part of the Atlas project +// Created by Max Van den Eynde in 2026 +// -------------------------------------------------- +// Description: Declarations for the Atlas Library for scripting +// Copyright (c) 2026 Max Van den Eynde +// + +declare module "atlas/log" { + export const Debug: { + print(message: string): void; + warning(message: string): void; + error(message: string): void; + }; +} + +declare module "atlas" { + import { + Position3d, + Color, + Position2d, + Size2d, + Quaternion, + Size3d, + Point3d, + Normal3d, + Rotation3d, + Scale3d, + } from "atlas/units"; + import { + Skybox, + Light, + SpotLight, + DirectionalLight, + AreaLight, + RenderTarget, + Texture, + Cubemap, + } from "atlas/graphics"; + import { + AxisTrigger, + Trigger, + Key, + MouseButton, + InputAction, + AxisPacket, + } from "atlas/input"; + import { QueryResult } from "bezel"; + import { AudioEngine } from "finewave"; + import { Atmosphere } from "hydra"; + + export type Fog = { + color: Color; + intensity: number; + }; + + export type VolumetricLighting = { + enabled: boolean; + density: number; + weight: number; + decay: number; + exposure: number; + }; + + export type LightBloomConfiguration = { + radius: number; + maxSamples: number; + }; + + export type RimLightingConfiguration = { + color: Color; + intensity: number; + }; + + export type Environment = { + fog: Fog; + volumetricLighting: VolumetricLighting; + lightBloom: LightBloomConfiguration; + rimLighting: RimLightingConfiguration; + lookupTexture: Texture; + }; + + export class Scene { + name: string; + + setAmbientIntensity(intensity: number): void; + setAutomaticAmbient(enabled: boolean): void; + + setSkybox(skybox: Skybox): void; + useAtmosphereSkybox(enabled: boolean): void; + + setEnvironment(environment: Environment): void; + + setAmbientColor(color: Color): void; + setAmbientIntensity(intensity: number): void; + addDirectionalLight(light: DirectionalLight): void; + addLight(light: Light): void; + addSpotLight(light: SpotLight): void; + addAreaLight(light: AreaLight): void; + + getCamera(): Camera; + getWindow(): Window; + + atmosphere: Atmosphere; + } + + export abstract class Component { + parentId: number; + + abstract init(): void; + abstract update(deltaTime: number): void; + beforePhysics(): void; + atAttach(): void; + + onCollisionEnter(other: GameObject): void; + onCollisionStay(other: GameObject): void; + onCollisionExit(other: GameObject): void; + onSignalReceive(signal: string, sender: GameObject): void; + onSignalEnd(signal: string, sender: GameObject): void; + onQueryReceive(query: QueryResult, sender: GameObject): void; + + getParent(): GameObject; + getParent( + type: new (...args: any[]) => T, + ): T | null; + getObject(identifier: number | string): CoreObject; + getScene(): Scene; + getWindow(): Window; + } + + export class Material { + constructor(); + + albedo: Color; + metallic: number; + roughness: number; + ao: number; + reflectivity: number; + emissiveColor: Color; + emissiveIntensity: number; + normalMapStrength: number; + useNormalMap: boolean; + transmittance: number; + ior: number; + } + + export class CoreVertex { + constructor( + position?: Position3d, + color?: Color, + textureCoord?: Position2d, + normal?: Normal3d, + tangent?: Normal3d, + bitangent?: Normal3d, + ); + + position: Position3d; + color: Color; + textureCoord: Position2d; + normal: Normal3d; + tangent: Normal3d; + bitangent: Normal3d; + } + + export class Instance { + position: Position3d; + rotation: Rotation3d; + scale: Scale3d; + + move(position: Position3d): void; + setPosition(position: Position3d): void; + setRotation(rotation: Rotation3d): void; + rotate(rotation: Rotation3d): void; + setScale(scale: Scale3d): void; + scaleBy(scale: Scale3d): void; + + equals(other: Instance): boolean; + } + + export abstract class GameObject { + id: number; + components: Component[]; + position: Position3d; + rotation: Rotation3d; + scale: Scale3d; + name: string; + + constructor(); + + attachTexture(texture: Texture): void; + setPosition(position: Position3d): void; + move(position: Position3d): void; + lookAt(target: Position3d, up?: Normal3d): void; + setRotation(rotation: Rotation3d): void; + rotate(rotation: Rotation3d): void; + setScale(scale: Scale3d): void; + scaleBy(scale: Scale3d): void; + show(): void; + hide(): void; + + as(type: new (...args: any[]) => T): T | null; + + addComponent(component: T): void; + } + + export abstract class UIObject extends GameObject { + getSize(): Size2d; + getScreenPosition(): Position2d; + abstract setScreenPosition(position: Position2d): void; + } + + export class CoreObject extends GameObject { + vertices: CoreVertex[]; + indices: number[]; + textures: Texture[]; + material: Material; + instances: Instance[]; + position: Position3d; + rotation: Rotation3d; + scale: Scale3d; + castsShadows: boolean; + name: string; + + constructor(); + + makeEmissive(color: Color, intensity: number): void; + attachVertices(vertices: CoreVertex[]): void; + attachIndices(indices: number[]): void; + attachTexture(texture: Texture): void; + + setPosition(position: Position3d): void; + move(position: Position3d): void; + setRotation(rotation: Rotation3d): void; + setRotationQuaternion(rotation: Quaternion): void; + rotate(rotation: Rotation3d): void; + lookAt(target: Position3d, up?: Normal3d): void; + setScale(scale: Scale3d): void; + scaleBy(scale: Scale3d): void; + + clone(): CoreObject; + + show(): void; + hide(): void; + + addComponent(component: T): void; + + enableDeferredRendering(): void; + disableDeferredRendering(): void; + + createInstance(): Instance; + + getComponent( + type: new (...args: any[]) => T, + ): T | null; + + static box(size: Size3d): CoreObject; + static plane(size: Size2d): CoreObject; + static pyramid(size: Size3d): CoreObject; + static sphere( + radius: number, + sectorCount: number, + stackCount: number, + ): CoreObject; + } + + export class Model extends GameObject { + static fromResource(path: string): Model; + + getObjects(): CoreObject[]; + + override move(position: Position3d): void; + override setPosition(position: Position3d): void; + override setRotation(rotation: Rotation3d): void; + override lookAt(target: Position3d, up?: Normal3d): void; + override rotate(rotation: Rotation3d): void; + override setScale(scale: Scale3d): void; + override scaleBy(scale: Scale3d): void; + + override show(): void; + override hide(): void; + override attachTexture(texture: Texture): void; + } + + export enum ResourceType { + File, + Texture, + SpecularMap, + Audio, + Font, + Model, + } + + export class Resource { + type: ResourceType; + path: string; + name: string; + + constructor(type: ResourceType, path: string, name: string); + + static fromAssetPath( + path: string, + type: ResourceType, + name?: string, + ): Resource; + + static fromName(name: string, type: ResourceType): Resource | null; + } + + export class ResourceGroup { + resources: Resource[]; + name: string; + + constructor(resources: Resource[], name: string); + + addResource(resource: Resource): void; + getResourceByName(name: string): Resource | null; + } + + export class Camera { + position: Position3d; + target: Point3d; + fov: number; + nearClip: number; + farClip: number; + orthographicSize: number; + movementSpeed: number; + mouseSensitivity: number; + controllerLookSensitivity: number; + lookSmoothness: number; + useOrthographic: boolean; + focusDepth: number; + focusRange: number; + + constructor(); + + move(offset: Position3d): void; + setPosition(position: Position3d): void; + setPositionKeepingOrientation(position: Position3d): void; + lookAt(target: Point3d, up?: Normal3d): void; + moveTo(target: Point3d, speed: number): void; + getDirection(): Normal3d; + } + + export type ViewInformation = { + position: Position3d; + target: Point3d; + time: number; + deltaTime: number; + }; + + export type WindowConfiguration = { + title: string; + width: number; + height: number; + renderScale: number; + mouseCaptured: boolean; + posX: number; + posY: number; + multisampling: boolean; + editorControls: boolean; + decorations: boolean; + resizable: boolean; + transparent: boolean; + alwaysOnTop: boolean; + opacity: number; + aspectRatioX: number; + aspectRatioY: number; + ssaoScale: number; + }; + + export type VideoMode = { + width: number; + height: number; + refreshRate: number; + }; + + export class Monitor { + monitorId: number; + primary: boolean; + + queryVideoModes(): VideoMode[]; + getCurrentVideoMode(): VideoMode; + getPhysicalSize(): Size2d; + getPosition(): Position2d; + getContentScale(): number; + getName(): string; + } + + export enum ControllerAxis { + LeftStick, + LeftStickX, + LeftStickY, + RightStick, + RightStickX, + RightStickY, + Trigger, + TriggerLeft, + TriggerRight, + } + + export enum ControllerButton { + A = 0, + B, + X, + Y, + LeftBumper, + RightBumper, + Back, + Start, + Guide, + LeftThumb, + RightThumb, + DPadUp, + DPadRight, + DPadDown, + DPadLeft, + ButtonCount, + } + + export enum NintendoControllerButton { + B = 0, + A, + Y, + X, + L, + R, + ZL, + ZR, + Minus, + Plus, + LeftStick, + RightStick, + DPadUp, + DPadRight, + DPadDown, + DPadLeft, + ButtonCount, + } + + export enum SonyControllerButton { + Cross = 0, + Circle, + Square, + Triangle, + L1, + R1, + L2, + R2, + Share, + Options, + LeftStick, + RightStick, + DPadUp, + DPadRight, + DPadDown, + DPadLeft, + ButtonCount, + } + + export const CONTROLLER_UNDEFINED = -2; + + export class Gamepad { + controllerId: number; + name: string; + connected: boolean; + + getAxisTrigger(axis: ControllerAxis): AxisTrigger; + static getGlobalAxisTrigger(axis: ControllerAxis): AxisTrigger; + getButtonTrigger(button: ControllerButton): Trigger; + static getGlobalButtonTrigger(button: ControllerButton): Trigger; + + runble(strength: number, duration: number): void; + } + + export type Controller = Gamepad; + + export class Joystick { + joystickId: number; + name: string; + connected: boolean; + + getSingleAxisTrigger(axisIndex: number): AxisTrigger; + getDualAxisTrigger(axisIndexX: number, axisIndexY: number): AxisTrigger; + getButtonTrigger(buttonIndex: number): Trigger; + + getAxisCount(): number; + getButtonCount(): number; + } + + export type ControllerID = { + id: number; + name: string; + isJoystick: boolean; + }; + + export class Window { + title: string; + width: number; + height: number; + currentFrame: number; + + audioEngine: AudioEngine; + + setClearColor(color: Color): void; + close(): void; + setFullscreen(enabled: boolean): void; + setFullscreen(monitor: Monitor): void; + setWindowed(config: WindowConfiguration): void; + + enumerateMonitors(): Monitor[]; + getControllers(): ControllerID[]; + getController(id: ControllerID): Controller | null; + getJoystick(id: ControllerID): Joystick | null; + + instantiate(object: GameObject): void; + destroy(object: GameObject): void; + + addUIObject(object: UIObject): void; + setCamera(camera: Camera): void; + setScene(scene: Scene): void; + getTime(): number; + isKeyActive(key: Key): boolean; + + isMouseButtonActive(button: MouseButton): boolean; + isMouseButtonPressed(button: MouseButton): boolean; + getTextInput(): string; + startTextInput(): void; + stopTextInput(): void; + isTextInputActive(): boolean; + + isControllerButtonPressed( + controllerID: number, + buttonIndex: number, + ): boolean; + getControllerAxisValue(controllerID: number, axisIndex: number): number; + getControllerAxisPairValue( + controllerID: number, + axisIndexX: number, + axisIndexY: number, + ): Position2d; + + releaseMouse(): void; + captureMouse(): void; + getCursorPosition(): Position2d; + + main: Window; + + getCurrentScene(): Scene; + getCamera(): Camera; + addRenderTarget(): RenderTarget; + getSize(): Size2d; + activateDebug(): void; + desactivateDebug(): void; + + getDeltaTime(): number; + getFramesPerSecond(): number; + gravity: number; + + useAtlasTracer(enabled: boolean): void; + setLogOutput( + showLogs: boolean, + showWarnings: boolean, + showErrors: boolean, + ): void; + + usesDeferred: boolean; + + getRenderScale(): number; + useMetalUpscaling(ratio: number): void; + isMetalUpscalingEnabled(): boolean; + getMetalUpscalingRatio(): number; + + getSSAORenderScale(): number; + + addInputAction(action: InputAction): void; + resetInputActions(): void; + getInputAction(name: string): InputAction | null; + + isActionTriggered(name: string): boolean; + isActionCurrentlyActive(name: string): boolean; + getActionAxisValue(name: string): AxisPacket; + } +} + +declare module "atlas/graphics" { + import { Resource, ResourceGroup } from "atlas"; + import { + Color, + Magnitude2d, + Position3d, + Magnitude3d, + Rotation3d, + Size2d, + } from "atlas/units"; + + export enum TextureType { + Color, + Specular, + Cubemap, + Depth, + DepthCube, + Normal, + Parallax, + SSAONoise, + SSAO, + Metallic, + Roughness, + AO, + Opacity, + HDR, + } + + export class Texture { + type: TextureType; + resource: Resource; + width: number; + height: number; + channels: number; + id: number; + borderColor: Color; + + static fromResource( + resource: Resource | string, + type: TextureType, + ): Texture; + + static createEmpty( + width: number, + height: number, + type: TextureType, + borderColor?: Color, + ): Texture; + + static createColor( + color: Color, + type: TextureType, + width: number, + height: number, + ): Texture; + + createCheckerboard( + width: number, + height: number, + checkSize: number, + color1: Color, + color2: Color, + ): void; + + createDoubleCheckerboard( + width: number, + height: number, + checkSizeBig: number, + checkSizeSmall: number, + color1: Color, + color2: Color, + color3: Color, + ): void; + + displayToWindow(): void; + } + + export class Cubemap { + resources: Resource[]; + id: number; + + constructor(resources: Resource[]); + + getAverageColor(): Color; + static fromResourceGroup(resourceGroup: ResourceGroup): Cubemap | null; + updateWithColors(colors: Color[]): void; + } + + export enum RenderTargetType { + Scene, + Multisampled, + Shadow, + CubeShadow, + GBuffer, + SSAO, + SSAOBlur, + } + + export enum RenderPassType { + Deferred, + Forward, + PathTracing, + } + + export const Effects: { + Inversion: { type: "Inversion" }; + Grayscale: { type: "Grayscale" }; + Sharpen: { type: "Sharpen" }; + Blur: { type: "Blur"; magnitude: number }; + EdgeDetection: { type: "EdgeDetection" }; + ColorCorrection: { + type: "ColorCorrection"; + exposure: number; + contrast: number; + saturation: number; + gamma: number; + temperature: number; + tint: number; + }; + MotionBlur: { type: "MotionBlur"; size: number; separation: number }; + ChromaticAberration: { + type: "ChromaticAberration"; + red: number; + green: number; + blue: number; + direction: Magnitude2d; + }; + Posterization: { type: "Posterization"; levels: number }; + Pixelation: { type: "Pixelation"; pixelSize: number }; + Dialation: { type: "Dilation"; size: number; separation: number }; + Dilation: { type: "Dilation"; size: number; separation: number }; + FilmGrain: { type: "FilmGrain"; amount: number }; + }; + + export type Effect = + | keyof typeof Effects + | (typeof Effects)[keyof typeof Effects]; + + export class RenderTarget { + type: RenderTargetType; + resolution: number; + outTextures: Texture[]; + depthTexture: Texture | null; + + constructor(type: RenderTargetType, resolution: number); + + addEffect(effect: Effect): void; + + addToPassQueue(type: RenderPassType): void; + display(): void; + } + + export class Skybox { + cubemap: Cubemap; + + constructor(cubemap: Cubemap); + } + + export class AmbientLight { + color: Color; + intensity: number; + + constructor(color?: Color, intensity?: number); + } + + export class Light { + position: Position3d; + color: Color; + shineColor: Color; + intensity: number; + distance: number; + + constructor( + position?: Position3d, + color?: Color, + distance?: number, + shineColor?: Color, + intensity?: number, + ); + + setColor(color: Color): void; + // Also calls addDebugObject(Window&); + createDebugObject(): void; + castShadows(resolution: number): void; + } + + export class DirectionalLight { + direction: Magnitude3d; + color: Color; + shineColor: Color; + intensity: number; + + constructor( + direction?: Magnitude3d, + color?: Color, + shineColor?: Color, + intensity?: number, + ); + + setColor(color: Color): void; + castShadows(resolution: number): void; + } + + export class SpotLight { + position: Position3d; + direction: Magnitude3d; + color: Color; + shineColor: Color; + range: number; + cutOff: number; + outerCutOff: number; + intensity: number; + + constructor( + position?: Position3d, + direction?: Magnitude3d, + color?: Color, + cutOff?: number, + outerCutOff?: number, + shineColor?: Color, + intensity?: number, + range?: number, + ); + + setColor(color: Color): void; + // Also calls addDebugObject(Window&); + createDebugObject(): void; + lookAt(target: Position3d): void; + castShadows(resolution: number): void; + } + + export class AreaLight { + position: Position3d; + right: Magnitude3d; + up: Magnitude3d; + size: Size2d; + color: Color; + shineColor: Color; + intensity: number; + range: number; + angle: number; + castsBothSides: boolean; + rotation: Rotation3d; + + constructor( + position?: Position3d, + right?: Magnitude3d, + up?: Magnitude3d, + size?: Size2d, + color?: Color, + shineColor?: Color, + intensity?: number, + range?: number, + angle?: number, + castsBothSides?: boolean, + rotation?: Rotation3d, + ); + + getNormal(): Magnitude3d; + setColor(color: Color): void; + setRotation(rotation: Rotation3d): void; + rotate(delta: Rotation3d): void; + // Also calls addDebugObject(Window&); + createDebugObject(): void; + castShadows(resolution: number): void; + } +} + +declare module "atlas/units" { + export class Position3d { + x: number; + y: number; + z: number; + + constructor(x: number, y: number, z: number); + + static zero(): Position3d; + static down(): Position3d; + static up(): Position3d; + static forward(): Position3d; + static back(): Position3d; + static right(): Position3d; + static left(): Position3d; + static invalid(): Position3d; + + add(other: Position3d | number): Position3d; + subtract(other: Position3d | number): Position3d; + multiply(other: Position3d | number): Position3d; + divide(other: Position3d | number): Position3d; + is(other: Position3d): boolean; + + normalized(): Position3d; + toString(): string; + } + + export type Scale3d = Position3d; + export type Size3d = Position3d; + export type Point3d = Position3d; + export type Normal3d = Position3d; + export type Magnitude3d = Position3d; + export type Impulse3d = Position3d; + export type Force3d = Position3d; + export type Vector3d = Position3d; + export type Velocity3d = Position3d; + export type Rotation3d = Position3d; + + export class BoundingBox { + min: Position3d; + max: Position3d; + + constructor(min: Position3d, max: Position3d); + + toString(): string; + contains(point: Position3d): boolean; + intersects(other: BoundingBox): boolean; + } + + export class Quaternion { + x: number; + y: number; + z: number; + w: number; + + constructor(x: number, y: number, z: number, w: number); + constructor(rotation: Rotation3d); + + toEuler(): Rotation3d; + static fromEuler(rotation: Rotation3d): Quaternion; + } + + export class Color { + r: number; + g: number; + b: number; + a: number; + + constructor(r: number, g: number, b: number, a?: number); + + add(other: Color | number): Color; + subtract(other: Color | number): Color; + multiply(other: Color | number): Color; + divide(other: Color | number): Color; + is(other: Color): boolean; + + static white(): Color; + static black(): Color; + static red(): Color; + static green(): Color; + static blue(): Color; + static transparent(): Color; + static yellow(): Color; + static cyan(): Color; + static magenta(): Color; + static gray(): Color; + static orange(): Color; + static purple(): Color; + static brown(): Color; + static pink(): Color; + static lime(): Color; + static navy(): Color; + static teal(): Color; + static olive(): Color; + static maroon(): Color; + + static fromHex(hex: string): Color; + static mix(color1: Color, color2: Color, t: number): Color; + } + + export enum Direction3d { + Up, + Down, + Left, + Right, + Forward, + Backward, + } + + export class Position2d { + x: number; + y: number; + + constructor(x: number, y: number); + + static zero(): Position2d; + static up(): Position2d; + static down(): Position2d; + static left(): Position2d; + static right(): Position2d; + static invalid(): Position2d; + + add(other: Position2d | number): Position2d; + subtract(other: Position2d | number): Position2d; + multiply(other: Position2d | number): Position2d; + divide(other: Position2d | number): Position2d; + + is(other: Position2d): boolean; + } + + export type Scale2d = Position2d; + export type Point2d = Position2d; + export type Movement2d = Position2d; + export type Magnitude2d = Position2d; + + export class Radians { + value: number; + + constructor(value: number); + + add(other: Radians): Radians; + subtract(other: Radians): Radians; + multiply(other: Radians | number): Radians; + divide(other: Radians | number): Radians; + + toNumber(): number; + static fromDegrees(degrees: number): Radians; + toDegrees(): number; + } + + export class Size2d { + width: number; + height: number; + + constructor(width: number, height: number); + + static zero(): Size2d; + + toString(): string; + + add(other: Size2d | number): Size2d; + subtract(other: Size2d | number): Size2d; + multiply(other: Size2d | number): Size2d; + divide(other: Size2d | number): Size2d; + + is(other: Size2d): boolean; + } +} + +declare module "atlas/audio" { + import { Component, Resource } from "atlas"; + import { Color, Position3d } from "atlas/units"; + import { AudioSource } from "finewave"; + + export class AudioPlayer extends Component { + constructor(); + + override init(): void; + play(): void; + pause(): void; + stop(): void; + setVolume(volume: number): void; + setLoop(loop: boolean): void; + + setSource(resource: Resource): void; + + override update(dt: number): void; + + setPosition(position: Position3d): void; + useSpatialAudio(enabled: boolean): void; + + source: AudioSource; + } +} + +declare module "atlas/input" { + import { Position2d } from "atlas/units"; + + export enum Key { + Unknown, + Space, + Apostrophe, + Comma, + Minus, + Period, + Slash, + Key0, + Key1, + Key2, + Key3, + Key4, + Key5, + Key6, + Key7, + Key8, + Key9, + Semicolon, + Equal, + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, + L, + M, + N, + O, + P, + Q, + R, + S, + T, + U, + V, + W, + X, + Y, + Z, + LeftBracket, + Backslash, + RightBracket, + GraveAccent, + Escape, + Enter, + Tab, + Backspace, + Insert, + Delete, + Right, + Left, + Down, + Up, + PageUp, + PageDown, + Home, + End, + CapsLock, + ScrollLock, + NumLock, + PrintScreen, + Pause, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + F16, + F17, + F18, + F19, + F20, + F21, + F22, + F23, + F24, + F25, + KP0, + KP1, + KP2, + KP3, + KP4, + KP5, + KP6, + KP7, + KP8, + KP9, + KPDecimal, + KPDivide, + KPMultiply, + KPSubtract, + KPAdd, + KPEnter, + KPEqual, + LeftShift, + LeftControl, + LeftAlt, + LeftSuper, + RightShift, + RightControl, + RightAlt, + RightSuper, + Menu, + } + + export enum MouseButton { + Left, + Right, + Middle, + X1, + X2, + Button6, + Button7, + Button8, + Last, + } + + export enum TriggerType { + MouseButton, + Key, + ControllerButton, + } + + export type ControllerButtonTrigger = { + controllerID: number; + buttonIndex: number; + }; + + export class Trigger { + type: TriggerType; + mouseButton?: MouseButton; + key?: Key; + controllerButton?: ControllerButtonTrigger; + + static fromKey(key: Key): Trigger; + static fromMouseButton(mouseButton: MouseButton): Trigger; + static fromControllerButton( + controllerID: number, + buttonIndex: number, + ): Trigger; + } + + export enum AxisTriggerType { + MouseAxis, + KeyCustom, + ControllerAxis, + } + + export class AxisTrigger { + type: AxisTriggerType; + + positiveX: Trigger; + negativeX: Trigger; + positiveY: Trigger; + negativeY: Trigger; + + controllerId?: number; + controllerAxisSingle: boolean; + axisIndex?: number; + axisIndexY: number; + + isJoystick: boolean; + + static fromMouse(): AxisTrigger; + static fromKeys( + positiveX: Key, + negativeX: Key, + positiveY: Key, + negativeY: Key, + ): AxisTrigger; + static fromControllerAxis( + controllerId: number, + axisIndex: number, + single: boolean, + axisIndexY?: number, + ): AxisTrigger; + } + + export type AxisPacket = { + deltaX: number; + deltaY: number; + x: number; + y: number; + valueX: number; + valueY: number; + inputDeltaX: number; + inputDeltaY: number; + hasValueInput: boolean; + hasDeltaInput: boolean; + }; + + export type MousePacket = { + xpos: number; + ypos: number; + xoffset: number; + yoffset: number; + constrainPitch: boolean; + firstMouse: boolean; + }; + + export type MouseScrollPacket = { + xoffset: number; + yoffset: number; + }; + + export class InputAction { + triggers: Trigger[]; + axisTriggers: AxisTrigger[]; + name: string; + isAxis: boolean; + isAxisSingle: boolean; + normalized: boolean; + invertY: boolean; + + static createButtonAction( + name: string, + triggers: Trigger[], + ): InputAction; + static createAxisAction( + name: string, + axisTriggers: AxisTrigger[], + ): InputAction; + static createSingleAxisAction( + name: string, + positiveTrigger: Trigger, + negativeTrigger: Trigger, + ): InputAction; + } + + export const Input: { + addAction(action: InputAction): InputAction; + resetActions(): void; + + isKeyActive(key: Key): boolean; + isKeyPressed(key: Key): boolean; + isMouseButtonActive(button: MouseButton): boolean; + isMouseButtonPressed(button: MouseButton): boolean; + + getTextInput(): string; + startTextInput(): void; + stopTextInput(): void; + isTextInputActive(): boolean; + + isControllerButtonPressed( + controllerID: number, + buttonIndex: number, + ): boolean; + getControllerAxisValue(controllerID: number, axisIndex: number): number; + getControllerAxisPairValue( + controllerID: number, + axisIndexX: number, + axisIndexY: number, + ): Position2d; + + captureMouse(): void; + releaseMouse(): void; + getMousePosition(): Position2d; + + isActionTriggered(name: string): boolean; + isActionCurrentlyActive(name: string): boolean; + getAxisActionValue(name: string): AxisPacket; + }; + + export abstract class Interactive { + abstract onKeyPress(key: Key, dt: number): void; + abstract onKeyRelease(key: Key, dt: number): void; + abstract onMouseMove(packet: MousePacket, dt: number): void; + abstract onMouseButtonPress(button: MouseButton, dt: number): void; + abstract onMouseScroll(packet: MouseScrollPacket, dt: number): void; + abstract onEachFrame(dt: number): void; + } +} + +declare module "atlas/particle" { + import { + Position3d, + Color, + Magnitude3d, + Rotation3d, + Scale3d, + Normal3d, + } from "atlas/units"; + import { GameObject } from "atlas"; + import { Texture } from "atlas/graphics"; + + export enum ParticleEmissionType { + Fountain, + Ambient, + } + + export type ParticleSettings = { + minLifetime: number; + maxLifetime: number; + minSize: number; + maxSize: number; + fadeSpeed: number; + gravity: number; + spread: number; + speedVariation: number; + }; + + export type Particle = { + position: Position3d; + velocity: Magnitude3d; + color: Color; + lifetime: number; + maxLifetime: number; + size: number; + active: boolean; + }; + + export class ParticleEmitter extends GameObject { + settings: ParticleSettings; + constructor(maxParticles: number); + + override attachTexture(texture: Texture): void; + setColor(color: Color): void; + enableTexture(): void; + disableTexture(): void; + override setPosition(position: Position3d): void; + override move(position: Position3d): void; + getPosition(): Position3d; + + setEmissionType(type: ParticleEmissionType): void; + setDirection(direction: Magnitude3d): void; + setSpawnRadius(radius: number): void; + setSpawnRate(rate: number): void; + setParticleSettings(settings: ParticleSettings): void; + + emitOnce(): void; + emitContinuous(): void; + startEmission(): void; + stopEmission(): void; + emitBurst(count: number): void; + + // Disabled + override setRotation(rotation: Rotation3d): void; + override setScale(scale: Scale3d): void; + override lookAt(target: Position3d, up?: Normal3d): void; + override rotate(rotation: Rotation3d): void; + override scaleBy(scale: Scale3d): void; + override show(): void; + override hide(): void; + } +} + +declare module "bezel" { + import { + Position3d, + Normal3d, + Point3d, + Size3d, + Force3d, + Impulse3d, + Velocity3d, + } from "atlas/units"; + import { GameObject, Component } from "atlas"; + + export type RaycastHit = { + position: Position3d; + normal: Normal3d; + distance: number; + object: GameObject; + didHit: boolean; + }; + + export type RaycastResult = { + hits: RaycastHit[]; + hit: RaycastHit | null; + closestDistance: number; + }; + + export type OverlapHit = { + contactPoint: Position3d; + penerationAxis: Point3d; + penetrationDepth: number; + object: GameObject; + }; + + export type OverlapResult = { + hits: OverlapHit[]; + hitAny: boolean; + }; + + export type SweepHit = { + position: Position3d; + normal: Normal3d; + distance: number; + percentage: number; + object: GameObject; + }; + + export type SweepResult = { + hits: SweepHit[]; + closest: SweepHit | null; + hitAny: boolean; + endPosition: Position3d; + }; + + export enum QueryOperation { + RaycastAll, + Raycast, + RasycastWorld, + RaycastWorldAll, + RaycastTagged, + RaycastTaggedAll, + Movement, + Overlap, + MovementAll, + } + + export type QueryResult = { + operation: QueryOperation; + raycastResult?: RaycastResult; + overlapResult?: OverlapResult; + sweepResult?: SweepResult; + }; + + export type WorldBody = {}; + + export type JointMember = GameObject | WorldBody; + + export enum SpringMode { + FrequencyAndDamping, + StiffnessAndDamping, + } + + export enum Space { + Local, + Global, + } + + export type Spring = { + enabled: boolean; + mode: SpringMode; + frequency: number; + dampingRatio: number; + stiffness: number; + damping: number; + }; + + export type AngleLimits = { + enabled: boolean; + minAngle: number; + maxAngle: number; + }; + + export type Motor = { + enabled: boolean; + maxForce: number; + maxTorque: number; + }; + + export abstract class Joint extends Component { + parent: JointMember; + child: JointMember; + space: Space; + anchor: Position3d; + breakForce: number; + breakTorque: number; + + override init(): void; + override update(deltaTime: number): void; + + abstract override beforePhysics(): void; + abstract breakJoint(): void; + } + + export class FixedJoint extends Joint { + override beforePhysics(): void; + override breakJoint(): void; + } + + export class HingeJoint extends Joint { + axis1: Normal3d; + axis2: Normal3d; + angleLimits: AngleLimits; + motor: Motor; + + override beforePhysics(): void; + override breakJoint(): void; + } + + export class SpringJoint extends Joint { + anchorB: Position3d; + restLength: number; + useLimits: boolean; + minLength: number; + maxLength: number; + + spring: Spring; + + override beforePhysics(): void; + override breakJoint(): void; + } + + export type VehicleWheelSettings = { + position: Position3d; + enableSuspensionForcePoint: boolean; + suspensionForcePoint: Position3d; + + suspensionDirection: Normal3d; + steeringAxis: Normal3d; + wheelUp: Normal3d; + wheelForward: Normal3d; + + suspensionMinLength: number; + suspensionMaxLength: number; + suspensionPreloadLength: number; + suspensionFrequencyHz: number; + suspensionDampingRatio: number; + + radius: number; + width: number; + + inertia: number; + angularDamping: number; + maxSteerAngleDegrees: number; + maxBrakeTorque: number; + maxHandBrakeTorque: number; + }; + + export type VehicleDifferential = { + leftWheel: number; + rightWheel: number; + differentialRatio: number; + leftRightSplit: number; + limitedSlipRatio: number; + engineTorqueRatio: number; + }; + + export type VehicleEngine = { + maxTorque: number; + minRPM: number; + maxRPM: number; + inertia: number; + angularDamping: number; + }; + + export enum VehicleTransmissionMode { + Auto, + Manual, + } + + export type VehicleTransmission = { + mode: VehicleTransmissionMode; + gearRatios: number[]; + reverseGearRatios: number[]; + switchTime: number; + clutchReleaseTime: number; + switchLatency: number; + shiftUpRPM: number; + shiftDownRPM: number; + clutchStrength: number; + }; + + export type VehicleControllerSettings = { + engine: VehicleEngine; + transmission: VehicleTransmission; + differentials: VehicleDifferential[]; + differentialLimitedSlipRatio: number; + }; + + export type VehicleSettings = { + up: Normal3d; + forward: Normal3d; + + maxPitchRollAngleDeg: number; + + wheels: VehicleWheelSettings[]; + controller: VehicleControllerSettings; + + maxSlopAngleDeg: number; + }; + + export class Vehicle extends Component { + settings: VehicleSettings; + forward: number; + right: number; + brake: number; + handBrake: number; + + override atAttach(): void; + override beforePhysics(): void; + + requestRecreate(): void; + + override init(): void; + override update(deltaTime: number): void; + } + + export type CapsuleCollider = { + radius: number; + height: number; + }; + + export type BoxCollider = { + size: Size3d; + }; + + export type SphereCollider = { + radius: number; + }; + + export type MeshCollider = {}; + + export type Collider = + | CapsuleCollider + | BoxCollider + | SphereCollider + | MeshCollider; + + export class Rigidbody extends Component { + sendSignal: string; + isSensor: boolean; + + override atAttach(): void; + override init(): void; + override beforePhysics(): void; + override update(deltaTime: number): void; + + clone(): Rigidbody; + + addCollider(collider: Collider): void; + + setFriction(friction: number): void; + applyForce(force: Force3d): void; + applyForceAtPoint(force: Force3d, point: Position3d): void; + applyImpulse(impulse: Impulse3d): void; + + setLinearVelocity(velocity: Velocity3d): void; + addLinearVelocity(velocity: Velocity3d): void; + setAngularVelocity(velocity: Velocity3d): void; + addAngularVelocity(velocity: Velocity3d): void; + + setMaxLinearVelocity(velocity: number): void; + setMaxAngularVelocity(velocity: number): void; + + getLinearVelocity(): Velocity3d; + getAngularVelocity(): Velocity3d; + getVelocity(): Velocity3d; + + raycast(direction: Normal3d, maxDistance: number): RaycastResult; + raycastAll(direction: Normal3d, maxDistance: number): RaycastResult; + raycastWorld( + origin: Position3d, + direction: Normal3d, + maxDistance: number, + ): RaycastResult; + raycastWorldAll( + origin: Position3d, + direction: Normal3d, + maxDistance: number, + ): RaycastResult; + raycastTagged( + tags: string[], + direction: Normal3d, + maxDistance: number, + ): RaycastResult; + raycastTaggedAll( + tags: string[], + direction: Normal3d, + maxDistance: number, + ): RaycastResult; + + overlap(): OverlapResult; + overlapWithCollider(collider: Collider): OverlapResult; + overlapWithColliderWorld( + collider: Collider, + position: Position3d, + ): OverlapResult; + + predictMovementWithCollider( + endPosition: Position3d, + collider: Collider, + ): SweepResult; + predictMovement(endPosition: Position3d): SweepResult; + predictMovementWithColliderWorld( + startPosition: Position3d, + endPosition: Position3d, + collider: Collider, + ): SweepResult; + predictMovementWorld( + startPosition: Position3d, + endPosition: Position3d, + ): SweepResult; + predictMovementWithColliderAll( + endPosition: Position3d, + collider: Collider, + ): SweepResult; + predictMovementAll(endPosition: Position3d): SweepResult; + predictMovementWithColliderAllWorld( + startPosition: Position3d, + endPosition: Position3d, + collider: Collider, + ): SweepResult; + predictMovementAllWorld( + startPosition: Position3d, + endPosition: Position3d, + ): SweepResult; + + hasTag(tag: string): boolean; + addTag(tag: string): void; + removeTag(tag: string): void; + + setDamping(linearDamping: number, angularDamping: number): void; + setMass(mass: number): void; + setRestituition(restitution: number): void; + setMotionType(motionType: "Static" | "Dynamic" | "Kinematic"): void; + } + + export class Sensor extends Rigidbody { + constructor(); // sets isSensor to true + + setSignal(signal: string): void; + } +} + +declare module "aurora" { + import { GameObject, Resource } from "atlas"; + import { Texture } from "atlas/graphics"; + import { + Color, + Position3d, + Rotation3d, + Normal3d, + Scale3d, + } from "atlas/units"; + + export class PerlinNoise { + constructor(seed?: number); + noise(x: number, y: number): number; + } + + export class SimplexNoise { + static noise(xin: number, yin: number): number; + } + + export class WorleyNoise { + constructor(numPoints: number, seed?: number); + noise(x: number, y: number): number; + } + + export class FractalNoise { + constructor(o: number, p: number); + noise(x: number, y: number): number; + } + + export class Noise { + static perlin(x: number, y: number): number; + static simplex(x: number, y: number): number; + static worley(x: number, y: number): number; + static fractal( + x: number, + y: number, + octaves: number, + persistence: number, + ): number; + static seed: number; + static initializedSeed: boolean; + } + + export class Biome { + name: string; + texture: Texture; + color: Color; + useTexture: boolean; + + attachTexture(texture: Texture): void; + + minHeight: number; + maxHeight: number; + minMoisture: number; + maxMoisture: number; + minTemperature: number; + maxTemperature: number; + + constructor( + name: string, + texture: Texture, + color: Color, + useTexture: boolean, + ); + + condition: BiomeFunction; + } + + export type BiomeFunction = (biome: Biome) => void; + + export class Terrain extends GameObject { + attachTexture(texture: Texture): void; + setPosition(position: Position3d): void; + move(position: Position3d): void; + setRotation(rotation: Rotation3d): void; + lookAt(target: Position3d, up?: Normal3d): void; + rotate(rotation: Rotation3d): void; + setScale(scale: Scale3d): void; + scaleBy(scale: Scale3d): void; + show(): void; + hide(): void; + + heightmap: Resource; + moistureTexture: Texture; + temperatureTexture: Texture; + generator: TerrainGenerator; + + createdWithMap: boolean; + width: number; + length: number; + height: number; + + addBiome(biome: Biome): void; + + static fromGenerator(generator: T): Terrain; + static fromHeightmap(heightmap: Resource): Terrain; + + maxPeak: number; + seaLevel: number; + } + + export abstract class TerrainGenerator { + abstract generateHeight(x: number, y: number): number; + applyTo(terrain: Terrain): void; + } + + export class HillGenerator extends TerrainGenerator { + constructor(scale: number, amplitude: number); + + override generateHeight(x: number, y: number): number; + } + + export class MountainGenerator extends TerrainGenerator { + constructor( + scale: number, + amplitude: number, + octaves: number, + persistance: number, + ); + + override generateHeight(x: number, y: number): number; + } + + export class PlainGenerator extends TerrainGenerator { + constructor(scale: number, amplitude: number); + + override generateHeight(x: number, y: number): number; + } + + export class IslandGenerator extends TerrainGenerator { + constructor(numFeatures: number, scale: number); + + override generateHeight(x: number, y: number): number; + } + + export class CompoundGenerator extends TerrainGenerator { + addGenerator(generator: T): void; + override generateHeight(x: number, y: number): number; + } +} + +declare module "finewave" { + import { Position3d } from "atlas/units"; + import { Resource } from "atlas"; + + export class AudioEngine { + setListenerPosition(position: Position3d): void; + setListenerOrientation(forward: Position3d, up: Position3d): void; + setListenerVelocity(velocity: Position3d): void; + setMasterVolume(volume: number): void; + deviceName: string; + } + + export class AudioData { + static fromResource(resource: Resource): AudioData; + isMono: boolean; + resource: Resource; + } + + export class AudioSource { + setData(data: AudioData): void; + fromFile(resource: Resource): void; + play(): void; + pause(): void; + stop(): void; + setLoop(loop: boolean): void; + setVolume(volume: number): void; + setPitch(pitch: number): void; + setPosition(position: Position3d): void; + setVelocity(velocity: Position3d): void; + + isPlaying(): boolean; + playFrom(position: number): void; + disableSpatialization(): void; + applyEffect(effect: AudioEffect): void; + getPosition(): Position3d; + getListenerPosition(): Position3d; + useSpatialization(): void; + } + + export abstract class AudioEffect {} + + export class Reverb extends AudioEffect { + setRoomSize(size: number): void; + setDamping(damping: number): void; + setWetLevel(level: number): void; + setDryLevel(level: number): void; + setWidth(width: number): void; + } + + export class Echo extends AudioEffect { + setDelay(delay: number): void; + setDecay(decay: number): void; + setWetLevel(level: number): void; + setDryLevel(level: number): void; + } + + export class Distortion extends AudioEffect { + setEdge(edge: number): void; + setGain(gain: number): void; + setLowpassCutoff(cutoff: number): void; + } +} + +declare module "graphite" { + import { UIObject, Resource } from "atlas"; + import { Texture } from "atlas/graphics"; + import { Position2d, Position3d, Color, Size2d, Size3d } from "atlas/units"; + + export class Image extends UIObject { + texture: Texture; + position: Position3d; + size: Size2d; + tint: Color; + + constructor(); + constructor( + texture: Texture, + size: Size2d, + position: Position2d, + tint: Color, + ); + + override getSize(): Size2d; + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + style(): UIStyle; + setStyle(style: UIStyle): Image; + + setTexture(texture: Texture): void; + setSize(size: Size2d): void; + } + + export type TextFieldChangeEvent = { + text: string; + cursorPosition: number; + focused: boolean; + }; + + export type ButtonClickEvent = { + label: string; + }; + + export type CheckboxToggleEvent = { + label: string; + checked: boolean; + }; + + export namespace TextField { + export type ChangeCallback = (event: TextFieldChangeEvent) => void; + } + + export class TextField extends UIObject { + text: string; + placeholder: string; + font: Font; + position: Position3d; + fontSize: number; + padding: Size2d; + maximumWidth: number; + textColor: Color; + placeholderColor: Color; + backgroundColor: Color; + borderColor: Color; + focusedBorderColor: Color; + cursorColor: Color; + + constructor(); + + constructor( + font: Font, + maximumWidth: number, + position: Position2d, + text: string, + placeholder: string, + ); + + override getSize(): Size2d; + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + getText(): string; + isFocused(): boolean; + getCursorIndex(): number; + style(): UIStyle; + + setText(text: string): TextField; + setPlaceholder(placeholder: string): TextField; + setPadding(padding: Size2d): TextField; + setMaximumWidth(width: number): TextField; + setFontSize(size: number): TextField; + setStyle(style: UIStyle): TextField; + setOnChange(callback: TextField.ChangeCallback): TextField; + + focus(): void; + blur(): void; + } + + export namespace Button { + export type ClickCallback = (event: ButtonClickEvent) => void; + } + + export class Button extends UIObject { + label: string; + font: Font; + position: Position3d; + fontSize: number; + padding: Size2d; + minimumSize: Size2d; + textColor: Color; + backgroundColor: Color; + hoverBackgroundColor: Color; + pressedBackgroundColor: Color; + borderColor: Color; + hoverBorderColor: Color; + enabled: boolean; + + constructor(); + + constructor(font: Font, label: string, position: Position2d); + + override getSize(): Size2d; + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + getLabel(): string; + isHovered(): boolean; + isEnabled(): boolean; + + style(): UIStyle; + + setLabel(label: string): Button; + setPadding(padding: Size2d): Button; + setMinimumSize(size: Size2d): Button; + setFontSize(size: number): Button; + setStyle(style: UIStyle): Button; + setOnClick(callback: Button.ClickCallback): Button; + setEnabled(enabled: boolean): void; + } + + export namespace Checkbox { + export type ToggleCallback = (event: CheckboxToggleEvent) => void; + } + + export class Checkbox extends UIObject { + label: string; + font: Font; + position: Position3d; + fontSize: number; + padding: Size2d; + boxSize: number; + spacing: number; + checked: boolean; + enabled: boolean; + textColor: Color; + boxBackgroundColor: Color; + hoverBoxBackgroundColor: Color; + borderColor: Color; + activeBorderColor: Color; + checkColor: Color; + + constructor(); + + constructor(font: Font, label: string, position: Position2d); + + override getSize(): Size2d; + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + getLabel(): string; + isChecked(): boolean; + isHovered(): boolean; + isEnabled(): boolean; + + style(): UIStyle; + + setLabel(label: string): Checkbox; + setPadding(padding: Size2d): Checkbox; + setFontSize(size: number): Checkbox; + setBoxSize(size: number): Checkbox; + setSpacing(spacing: number): Checkbox; + setStyle(style: UIStyle): Checkbox; + setOnToggle(callback: Checkbox.ToggleCallback): Checkbox; + setChecked(checked: boolean): void; + setEnabled(enabled: boolean): void; + toggle(): void; + } + + export enum ElementAlignment { + Top, + Center, + Bottom, + } + + export enum LayoutAnchor { + TopLeft, + TopCenter, + TopRight, + CenterLeft, + Center, + CenterRight, + BottomLeft, + BottomCenter, + BottomRight, + } + + export class Column extends UIObject { + constructor(position: Position2d); + constructor( + children: UIObject[], + spacing: number, + padding: Size2d, + position: Position2d, + ); + + spacing: number; + maxSize: Size2d; + padding: Size2d; + children: UIObject[]; + position: Position3d; + alignment: ElementAlignment; + anchor: LayoutAnchor; + + addChild(child: UIObject): void; + setChildren(children: UIObject[]): void; + + override getSize(): Size2d; + + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + style: UIStyle; + setStyle(style: UIStyle): Column; + } + + export class Row extends UIObject { + constructor(position: Position2d); + constructor( + children: UIObject[], + spacing: number, + padding: Size2d, + position: Position2d, + ); + + spacing: number; + maxSize: Size2d; + padding: Size2d; + children: UIObject[]; + position: Position3d; + alignment: ElementAlignment; + anchor: LayoutAnchor; + + addChild(child: UIObject): void; + setChildren(children: UIObject[]): void; + + override getSize(): Size2d; + + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + style: UIStyle; + setStyle(style: UIStyle): Column; + } + + export class Stack extends UIObject { + constructor(position: Position2d); + constructor( + children: UIObject[], + padding: Size2d, + position: Position2d, + ); + + maxSize: Size2d; + padding: Size2d; + children: UIObject[]; + position: Position3d; + horizontalAlignment: ElementAlignment; + verticalAlignment: ElementAlignment; + anchor: LayoutAnchor; + + addChild(child: UIObject): void; + setChildren(children: UIObject[]): void; + + override getSize(): Size2d; + + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + style: UIStyle; + setStyle(style: UIStyle): Column; + } + + export enum UIStyleState { + Normal, + Hovered, + Pressed, + Disabled, + Focused, + Checked, + } + + export type UIStyleStateSnapshot = { + hovered: boolean; + pressed: boolean; + disabled: boolean; + focused: boolean; + checked: boolean; + }; + + export class UIStyleVariant { + paddingValue?: number; + cornerRadiusValue?: number; + borderWidthValue?: number; + backgroundColorValue?: Color; + borderColorValue?: Color; + foregroundColorValue?: Color; + tintColorValue?: Color; + fontValue?: Font; + fontSizeValue?: number; + + padding(value: Size2d): UIStyleVariant; + cornerRadius(value: number): UIStyleVariant; + borderWidth(value: number): UIStyleVariant; + backgroundColor(value: Color): UIStyleVariant; + borderColor(value: Color): UIStyleVariant; + foregroundColor(value: Color): UIStyleVariant; + tintColor(value: Color): UIStyleVariant; + font(value: Font): UIStyleVariant; + fontSize(value: number): UIStyleVariant; + } + + export type UIResolvedStyle = { + padding: Size2d; + cornerRadius: number; + borderWidth: number; + backgroundColor: Color; + borderColor: Color; + foregroundColor: Color; + tintColor: Color; + font: Font; + fontSize: number; + }; + + export class UIStyle { + normal(): UIStyleVariant; + hovered(): UIStyleVariant; + pressed(): UIStyleVariant; + disabled(): UIStyleVariant; + focused(): UIStyleVariant; + checked(): UIStyleVariant; + variant(state: UIStyleState): UIStyleVariant; + } + + export class Theme { + text: UIStyle; + image: UIStyle; + textField: UIStyle; + button: UIStyle; + checkbox: UIStyle; + row: UIStyle; + column: UIStyle; + stack: UIStyle; + + static current(): Theme; + static set(theme: Theme): void; + static reset(): void; + } + + export type Character = { + size: Size2d; + bearing: Position2d; + advance: number; + uvMin: Position2d; + uvMax: Position2d; + }; + + export type FontAtlas = Map; + + export class Font { + name: string; + atlas: Texture; + size: number; + resource: Resource; + texture: Texture; + + static fromResource(resource: Resource): Font; + static getFont(name: string): Font; + + changeSize(size: number): Font; + } + + export class Text extends UIObject { + content: string; + font: Font; + position: Position3d; + fontSize: number; + color: Color; + + constructor(); + constructor( + text: string, + font: Font, + color: Color, + position: Position2d, + ); + + override getSize(): Size2d; + override getScreenPosition(): Position2d; + override setScreenPosition(position: Position2d): void; + + style(): UIStyle; + setStyle(style: UIStyle): Text; + setFontSize(size: number): Text; + } +} + +declare module "hydra" { + import { + Position3d, + Size3d, + Force3d, + Magnitude3d, + Color, + Scale3d, + Rotation3d, + Size2d, + } from "atlas/units"; + import { Cubemap } from "atlas/graphics"; + import { ViewInformation, GameObject } from "atlas"; + import { Texture } from "atlas/graphics"; + + export class WorleyNoise3D { + constructor(frequency: number, numDivisions: number); + + getValue(x: number, y: number, z: number): number; + + get3dTexture(size: number): number; + getDetailTexture(size: number): number; + get3dTextureAtAllChannels(size: number): number; + } + + export class Clouds { + constructor(frequency: number, numDivisions: number); + + getCloudTexture(size: number): number; + + position: Position3d; + size: Size3d; + scale: number; + offset: Position3d; + density: number; + densityMultiplier: number; + absorption: number; + scattering: number; + phase: number; + clusterStrength: number; + primaryStepCount: number; + lightStepCount: number; + lightStepMultiplier: number; + minStepLength: number; + wind: Force3d; + } + + export enum WeatherCondition { + Clear, + Rain, + Snow, + Storm, + } + + export type WeatherState = { + condition: WeatherCondition; + intensity: number; + wind: Force3d; + }; + + export type WeatherDelegate = ( + information: ViewInformation, + ) => WeatherState; + + export class Atmosphere { + timeOfDay: number; + secondsPerHour: number; + wind: Magnitude3d; + weatherDelegate: WeatherDelegate; + + enable(): void; + disable(): void; + isEnabled(): boolean; + enableWeather(): void; + disableWeather(): void; + + getNormalizedTime(): number; + getSunAngle(): Magnitude3d; + getMoonAngle(): Magnitude3d; + getLightIntensity(): number; + getLightColor(): Color; + + clouds?: Clouds; + + getSkyboxColors(): Color[]; + createSkyCubemap(size: number): Cubemap; + updateSkyCubemap(cubemap: Cubemap): void; + + castShadowsFromSunlight(resolution: number): void; + useGlobalLight(): void; + + sunColor: Color; + moonColor: Color; + + sunSize: number; + moonSize: number; + sunTintStrength: number; + moonTintStrength: number; + starIntensity: number; + + isDaytime(): boolean; + setTime(hours: number, minutes: number, seconds: number): void; + + addClouds(frequency: number, numDivisions: number): void; + + cycle: boolean; + resetRuntimeState(): void; + } + + export class Fluid extends GameObject { + waveVelocity: number; + + constructor(); + create(extent: Size2d, color: Color): void; + + override move(position: Position3d): void; + override setPosition(position: Position3d): void; + override setRotation(rotation: Rotation3d): void; + override rotate(rotation: Rotation3d): void; + override setScale(scale: Scale3d): void; + + setExtent(extent: Size2d): void; + setWaveVelocity(velocity: number): void; + setWaterColor(color: Color): void; + getPosition(): Position3d; + getScale(): Scale3d; + + normalTexture: Texture; + movementTexture: Texture; + } +} diff --git a/tests/ddgi/main.ascene b/tests/ddgi/main.ascene new file mode 100644 index 00000000..524c388a --- /dev/null +++ b/tests/ddgi/main.ascene @@ -0,0 +1,201 @@ +{ + "camera": { + "actions": [], + "automaticMoving": false, + "controllerLookSensitivity": 180.0, + "farClip": 1000.0, + "focusDepth": 20.0, + "focusRange": 10.0, + "fov": 60.0, + "lookSmoothness": 0.15000000596046448, + "mouseSensitivity": 0.10000000149011612, + "movementSpeed": 2.0, + "nearClip": 0.5, + "orthoSize": 5.0, + "orthographic": false, + "position": [ + 0.04393434524536133, + 1.856296420097351, + -1.224806308746338 + ], + "target": [ + 1.236834168434143, + 0.3583019971847534, + 1.0845232009887695 + ] + }, + "environment": { + "atmosphere": { + "enabled": false, + "globalLight": { + "castsShadows": false, + "enabled": false, + "shadowResolution": 4096 + } + }, + "atmosphereSky": false, + "automaticAmbient": true + }, + "id": "main_scene", + "lights": [ + { + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "id": "ambientLight_0", + "intensity": 0.25, + "name": "ambientLight_0", + "position": [ + 0.0, + 0.0, + 0.0 + ], + "type": "ambientLight" + }, + { + "angle": 90.0, + "castsBothSides": false, + "castsShadows": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "id": "792417628", + "intensity": 1.0, + "name": "Area Light", + "position": [ + -0.9037287831306458, + 1.741339921951294, + -0.8576900362968445 + ], + "range": 50.0, + "right": [ + 0.14835353195667267, + -0.10242944955825806, + -0.983615517616272 + ], + "shadowResolution": 2048, + "shineColor": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "size": [ + 1.0, + 1.0 + ], + "type": "areaLight", + "up": [ + 0.568171501159668, + 0.8229101896286011, + 6.357552706504066e-09 + ] + } + ], + "name": "Main Scene", + "objects": [ + { + "components": [], + "id": 1991996539, + "name": "Cube", + "position": [ + 0.0, + 0.0, + 0.0 + ], + "rotation": [ + 0.0, + 0.0, + 0.0 + ], + "scale": [ + 3.5489842891693115, + 0.06517583131790161, + 3.5489842891693115 + ], + "solid_type": "cube", + "type": "solid" + }, + { + "components": [], + "name": "Cube 2", + "position": [ + 1.6440476179122925, + 0.0, + -0.0001589655876159668 + ], + "rotation": [ + 0.0, + 0.0, + 90.35289764404297 + ], + "scale": [ + 3.5489842891693115, + 0.06517583131790161, + 3.5489842891693115 + ], + "solid_type": "cube", + "type": "solid" + }, + { + "components": [], + "name": "Cube 2 2", + "position": [ + 0.22580254077911377, + 0.0, + 1.727804183959961 + ], + "rotation": [ + 95.30328369140625, + -89.0549545288086, + 88.7397689819336 + ], + "scale": [ + 3.5489842891693115, + 0.06517583131790161, + 3.5489842891693115 + ], + "solid_type": "cube", + "type": "solid" + }, + { + "components": [], + "id": 167521360, + "material": "Red.amat", + "name": "Cube 3", + "parent": "Area Light", + "position": [ + 1.236834168434143, + 0.3583019971847534, + 1.0845232009887695 + ], + "rotation": [ + 0.0, + 0.0, + 0.0 + ], + "scale": [ + 0.28361332416534424, + 0.28361332416534424, + 0.28361332416534424 + ], + "solid_type": "cube", + "type": "solid" + } + ], + "property_syncs": [], + "targets": [ + { + "display": true, + "name": "Main Target", + "render": true, + "type": "multisampled" + } + ] +} diff --git a/tests/ddgi/package-lock.json b/tests/ddgi/package-lock.json new file mode 100644 index 00000000..ef3a4469 --- /dev/null +++ b/tests/ddgi/package-lock.json @@ -0,0 +1,512 @@ +{ + "name": "ddgi", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ddgi", + "devDependencies": { + "esbuild": "^0.25.5", + "typescript": "^5.9.2" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/tests/ddgi/package.json b/tests/ddgi/package.json new file mode 100644 index 00000000..d30c3a2d --- /dev/null +++ b/tests/ddgi/package.json @@ -0,0 +1,13 @@ +{ + "devDependencies": { + "esbuild": "^0.25.5", + "typescript": "^5.9.2" + }, + "name": "ddgi", + "private": true, + "scripts": { + "atlas:compile": "atlas script compile", + "typecheck": "tsc --noEmit" + }, + "type": "module" +} diff --git a/tests/ddgi/project.atlas b/tests/ddgi/project.atlas new file mode 100644 index 00000000..5bdaa05b --- /dev/null +++ b/tests/ddgi/project.atlas @@ -0,0 +1,23 @@ +app_name = "ddgi" +atlas_version = "alpha9" +backend = "AUTO" +name = "ddgi" +platform = "DESKTOP" + +[game] +assets = ["assets/"] +main_scene = "main.ascene" + +[pack] +icon = "none" +supported_platforms = "all" + +[renderer] +default = "deferred" +global_illumination = true + +[window] +dimensions = [1280, 720] +mouse_capture = false +multisampling = true +ssaoScale = 0.5 diff --git a/tests/ddgi/tsconfig.json b/tests/ddgi/tsconfig.json new file mode 100644 index 00000000..186f01e9 --- /dev/null +++ b/tests/ddgi/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "module": "ESNext", + "moduleResolution": "Bundler", + "noEmit": true, + "paths": { + "atlas": [ + "lib/atlas.d.ts" + ], + "atlas/*": [ + "lib/*" + ] + }, + "skipLibCheck": true, + "strict": true, + "target": "ES2022", + "verbatimModuleSyntax": true + }, + "exclude": [ + ".git", + "node_modules", + "dist", + "build", + "target", + "extern", + "atlas", + "aurora", + "bezel", + "finewave", + "graphite", + "hydra", + "include", + "opal", + "photon", + "cli", + "docs", + "tests", + "runtime/lib", + "runtime/docs", + "runtime/executable" + ], + "include": [ + "**/*.ts", + "**/*.mts", + "**/*.cts" + ] +}