diff --git a/README.md b/README.md index 0c807e865..e3ac51132 100644 --- a/README.md +++ b/README.md @@ -87,20 +87,26 @@ More editor related documentation is available in [the editor docs](https://kool ## Platform Support -| Platform | Backend | Implementation Status | -|-------------|-------------|--------------------------------------------------------| -| Desktop JVM | OpenGL | :white_check_mark: Fully working | -| Desktop JVM | Vulkan | :white_check_mark: Fully working | -| Desktop JVM | WebGPU | :sparkles: Mostly working (using the `wgpu4k` backend) | -| Browser | WebGL 2 | :white_check_mark: Fully working | -| Browser | WebGPU | :white_check_mark: Fully working | -| Android | OpenGL ES 3 | :white_check_mark: Fully working | - -**Supported desktop platforms are:** +| Platform | Backend | Implementation Status | +|---------------------|-------------|--------------------------------------------------------| +| Desktop (JVM) | Vulkan | :white_check_mark: Fully working | +| Desktop (JVM) | OpenGL | :white_check_mark: Fully working | +| Desktop (JVM) | WebGPU | :sparkles: Mostly working (using the `wgpu4k` backend) | +| Browser (JS + WASM) | WebGPU | :white_check_mark: Fully working | +| Browser (JS + WASM) | WebGL 2 | :white_check_mark: Fully working | +| Android | OpenGL ES 3 | :white_check_mark: Fully working | + +### Supported desktop platforms - Windows (x64): Vulkan, WebGPU and OpenGL - Linux (x64): Vulkan, WebGPU and OpenGL - macOS (ARM + x64): Vulkan and WebGPU (no OpenGL) +### JS vs. WASM Performance + +Kool supports plain JavaScript as well as WebAssembly (WASM) as browser targets. However, the WASM backend seems to be +suffering from the many required JS-interop upcalls to various Web APIs. Therefore, in most cases, the WASM backend is +actually slower than the JS backend, and plain JS stays the recommended target for now. + ### Java Version On Desktop, Kool currently uses Java 17 as the minimum language level except the `kool-backend-wgpu4k` module, which diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 2dab28d64..65aa8baa6 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { implementation(libs.plugindep.kotlin) implementation(libs.plugindep.kotlin.serialization) implementation(libs.plugindep.kotlin.atomicfu) + implementation(libs.plugindep.kotlin.jsplainobjs) implementation(libs.plugindep.dokka) implementation(libs.plugindep.android.library) implementation(libs.plugindep.maven.publish) diff --git a/buildSrc/src/main/kotlin/kool.lib-conventions.gradle.kts b/buildSrc/src/main/kotlin/kool.lib-conventions.gradle.kts index c6a2f58e0..da1a3e0b2 100644 --- a/buildSrc/src/main/kotlin/kool.lib-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kool.lib-conventions.gradle.kts @@ -1,12 +1,14 @@ -@file:OptIn(ExperimentalKotlinGradlePluginApi::class) +@file:OptIn(ExperimentalKotlinGradlePluginApi::class, ExperimentalWasmDsl::class) import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl plugins { id("org.jetbrains.kotlin.multiplatform") id("org.jetbrains.kotlin.plugin.serialization") id("org.jetbrains.kotlin.plugin.atomicfu") id("org.jetbrains.dokka") + id("org.jetbrains.kotlin.plugin.js-plain-objects") } kotlin { @@ -19,10 +21,15 @@ kotlin { target.set("es2015") } } + wasmJs { + binaries.library() + browser() + } compilerOptions { freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") freeCompilerArgs.add("-Xcontext-parameters") + freeCompilerArgs.add("-Xexpect-actual-classes") } sourceSets.all { @@ -33,9 +40,22 @@ kotlin { optIn("kotlin.ExperimentalStdlibApi") } } - - compilerOptions { - freeCompilerArgs.add("-Xexpect-actual-classes") + sourceSets { + jsMain { + languageSettings { + optIn("kotlin.js.ExperimentalWasmJsInterop") + } + } + webMain { + languageSettings { + optIn("kotlin.js.ExperimentalWasmJsInterop") + } + } + wasmJsMain { + languageSettings { + optIn("kotlin.js.ExperimentalWasmJsInterop") + } + } } } diff --git a/gradle.properties b/gradle.properties index 9123731a6..b25bc2613 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,7 @@ org.gradle.configuration-cache.parallel=true kotlin.daemon.jvmargs=-Xmx4g kotlin.incremental.js=true kotlin.incremental.js.ir=true +kotlin.incremental.wasm=true kotlin.mpp.stability.nowarn=true kotlinx.atomicfu.enableJvmIrTransformation=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8adf7311f..740c3dedc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,6 +6,7 @@ kotlin-serialization = "1.9.0" kotlin-datetime = "0.7.1-0.6.x-compat" kotlin-atomicfu = "0.29.0" kotlin-dokka = "2.1.0" +kotlinx-browser = "0.5.0" lwjgl = "3.3.6" jsvg = "2.0.0" androidsvg = "1.4" @@ -29,6 +30,7 @@ kotlin-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", kotlin-atomicfu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version.ref = "kotlin-atomicfu" } kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } +kotlinx-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version.ref = "kotlinx-browser" } jsvg = { group = "com.github.weisj", name = "jsvg", version.ref = "jsvg" } jspecify-annotations = { module = "org.jspecify:jspecify", version = "1.0.0" } androidsvg = { group = "com.caverock", name = "androidsvg-aar", version.ref = "androidsvg" } @@ -62,6 +64,7 @@ jna-platform = { module = "net.java.dev.jna:jna-platform", version.ref = "jna" } plugindep-kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } plugindep-kotlin-serialization = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "kotlin" } plugindep-kotlin-atomicfu = { group = "org.jetbrains.kotlin", name = "atomicfu", version.ref = "kotlin" } +plugindep-kotlin-jsplainobjs = { module = "org.jetbrains.kotlin.plugin.js-plain-objects:org.jetbrains.kotlin.plugin.js-plain-objects.gradle.plugin", version.ref = "kotlin" } plugindep-dokka = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "kotlin-dokka" } plugindep-android-library = { group = "com.android.library", name = "com.android.library.gradle.plugin", version.ref = "agp" } plugindep-maven-publish = { group = "com.vanniktech", name = "gradle-maven-publish-plugin", version = "0.35.0" } diff --git a/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/ArrayBuffer.wasmJs.kt b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/ArrayBuffer.wasmJs.kt new file mode 100644 index 000000000..aabc3549b --- /dev/null +++ b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/ArrayBuffer.wasmJs.kt @@ -0,0 +1,36 @@ +package de.fabmax.kool.pipeline.backend.wgpu + +import de.fabmax.kool.util.* +import io.ygdrasil.webgpu.ArrayBuffer +import org.khronos.webgl.* + +actual fun ArrayBuffer.writeInto(target: Buffer): Unit = when (target) { + is Float32BufferImpl -> target.buffer.set(Float32Array(this)) + is Int32BufferImpl -> target.buffer.set(Int32Array(this)) + is MixedBufferImpl -> Uint8Array(target.buffer.buffer).set(Uint8Array(this)) + is Uint16BufferImpl -> target.buffer.set(Uint16Array(this)) + is Uint8BufferImpl -> target.buffer.set(Uint8Array(this)) + else -> error("Unsupported buffer type ${target::class.simpleName}") +} + +private fun Buffer.asArrayBuffer(): ArrayBuffer = when (this) { + is Float32BufferImpl -> this.buffer.buffer + is Int32BufferImpl -> this.buffer.buffer + is MixedBufferImpl -> this.buffer.buffer + is Uint16BufferImpl -> this.buffer.buffer + is Uint8BufferImpl -> this.buffer.buffer + else -> error("Unsupported buffer type ${this::class.simpleName}") +} + +@OptIn(ExperimentalUnsignedTypes::class) +actual fun ArrayBuffer.asUIntArray(): UIntArray = Int32Array(this).let { + val ktArray = UIntArray(it.length) + for (i in 0 until it.length) { + ktArray[i] = it[i].toUInt() + } + ktArray +} + +actual fun Buffer.asArrayBuffer(block: (ArrayBuffer) -> Unit) { + block(asArrayBuffer()) +} \ No newline at end of file diff --git a/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/RenderBackendWgpu4k.wasmJs.kt b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/RenderBackendWgpu4k.wasmJs.kt new file mode 100644 index 000000000..753000312 --- /dev/null +++ b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/RenderBackendWgpu4k.wasmJs.kt @@ -0,0 +1,65 @@ +package de.fabmax.kool.pipeline.backend.wgpu + +import de.fabmax.kool.FrameData +import de.fabmax.kool.KoolContext +import de.fabmax.kool.KoolSystem +import de.fabmax.kool.configWasm +import de.fabmax.kool.platform.WasmContext +import de.fabmax.kool.util.ApplicationScope +import io.ygdrasil.webgpu.* +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.launch +import org.w3c.dom.HTMLCanvasElement + +internal actual fun isRenderBackendWgpu4kSupported(): Boolean = true //!(js("!navigator.gpu") as Boolean) + +internal actual suspend fun createRenderBackendWgpu4k(ctx: KoolContext): RenderBackendWgpu4k { + ctx as WasmContext + val backend = WasmRenderBackendWgpu4kWebGpu(ctx, ctx.window.canvas) + backend.initContext() + with(backend) { + surface.configure( + SurfaceConfiguration( + device, + surface.format, + viewFormats = setOf(surface.format) + ) + ) + } + return backend +} + +private fun getSurface(canvas: HTMLCanvasElement): WgpuSurface { + val canvasSurface = canvas.unsafeCast().getCanvasSurface() + return WgpuSurface(canvasSurface) +} + +private suspend fun getAdapter(): Adapter { + val adapterDescriptor = createJsObject().apply { + powerPreference = KoolSystem.configWasm.powerPreference.value + } + val selectedAdapter: WGPUAdapter? = navigator.gpu?.requestAdapter(adapterDescriptor)?.wait() + ?: navigator.gpu?.requestAdapter()?.wait() + checkNotNull(selectedAdapter) { "No appropriate GPUAdapter found." } + + val adapter = Adapter(selectedAdapter) + return adapter +} + +@OptIn(DelicateCoroutinesApi::class) +internal class WasmRenderBackendWgpu4kWebGpu(ctx: KoolContext, canvas: HTMLCanvasElement) : + RenderBackendWgpu4k( + ctx, + getSurface(canvas), + KoolSystem.configWasm.numSamples, + { getAdapter() } + ) +{ + override val isAsyncRendering: Boolean = false + + override fun renderFrame(frameData: FrameData, ctx: KoolContext) { + ApplicationScope.launch { + renderFrameSuspending(frameData, ctx) + } + } +} \ No newline at end of file diff --git a/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/Surface.wasmJs.kt b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/Surface.wasmJs.kt new file mode 100644 index 000000000..27647d36d --- /dev/null +++ b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/Surface.wasmJs.kt @@ -0,0 +1,45 @@ +package de.fabmax.kool.pipeline.backend.wgpu + +import io.ygdrasil.webgpu.* + +actual class WgpuSurface(private val handler: WGPUCanvasContext) : AutoCloseable { + actual val width: UInt + get() = handler.canvas.castAs().width.asUInt() + actual val height: UInt + get() = handler.canvas.castAs().height.asUInt() + + actual val supportedAlphaMode: Set = + setOf(CompositeAlphaMode.Opaque, CompositeAlphaMode.Premultiplied) + + actual val format: GPUTextureFormat + get() = navigator.gpu?.getPreferredCanvasFormat() + ?.let { GPUTextureFormat.of(it) ?: error("Unsupported surface format: $it") } + ?: error("WebGPU not supported") + + actual fun getCurrentTextureView(): GPUTextureView { + return handler.getCurrentTexture() + .let { Texture(it, canBeDestroy = false)} + .createView() + } + + actual fun present() { /* does not exists on Web */ } + + actual fun configure(surfaceConfiguration: SurfaceConfiguration) { + handler.configure(map(surfaceConfiguration)) + } + + actual override fun close() { /* does not exists on Web */ } +} + +private fun map(input: SurfaceConfiguration) = createJsObject().apply { + device = (input.device as Device).handler + format = input.format.value + usage = input.usage.toFlagInt().asJsNumber() + viewFormats = input.viewFormats.mapJsArray { it.value.asJsString().castAs() } + colorSpace = input.colorSpace.value.asJsString().castAs() + toneMapping = createJsObject().apply { + // GPUCanvasToneMappingMode.Standard is the default value on specification, should we allow to use extends for HDR ? + mode = GPUCanvasToneMappingMode.Standard.value.asJsString().castAs() + } + alphaMode = input.alphaMode.value.asJsString().castAs() +} \ No newline at end of file diff --git a/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/WgpuTextureLoader.wasmJs.kt b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/WgpuTextureLoader.wasmJs.kt new file mode 100644 index 000000000..2300b0141 --- /dev/null +++ b/kool-backend-wgpu4k/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/wgpu/WgpuTextureLoader.wasmJs.kt @@ -0,0 +1,89 @@ +package de.fabmax.kool.pipeline.backend.wgpu + +import de.fabmax.kool.math.float32ToFloat16 +import de.fabmax.kool.pipeline.BufferedImageData +import de.fabmax.kool.pipeline.ImageData +import de.fabmax.kool.pipeline.isF16 +import de.fabmax.kool.platform.ImageTextureData +import de.fabmax.kool.util.Float32BufferImpl +import de.fabmax.kool.util.Uint16BufferImpl +import de.fabmax.kool.util.Uint8BufferImpl +import io.ygdrasil.webgpu.* +import org.khronos.webgl.* +import org.khronos.webgl.ArrayBuffer + +internal actual fun copyNativeTextureData( + src: ImageData, + dst: GPUTexture, + size: Extent3D, + dstOrigin: GPUOrigin3D, + device: GPUDevice +): Unit = when (src) { + is BufferedImageData -> { + device.queue.writeTexture( + data = src.arrayBufferView.unsafeCast(), + destination = TexelCopyTextureInfo(dst, origin = dstOrigin), + dataLayout = src.gpuImageDataLayout, + size = size + ) + } + is ImageTextureData -> copyTextureData(src, dst, size, dstOrigin, device) + else -> error("Not implemented: ${src::class.simpleName}") +} + +internal fun copyTextureData( + src: ImageTextureData, + dst: GPUTexture, + size: Extent3D, + dstOrigin: GPUOrigin3D, + device: GPUDevice +) { + val queue = (device.queue as Queue).handler + queue.copyExternalImageToTexture( + source = createJsObject().apply { + source = src.data + }, + destination = createJsObject().apply { + texture = (dst as Texture).handler + mipLevel = 0.toJsNumber() + origin = createJsObject().apply { + x = dstOrigin.x.toJsNumber() + y = dstOrigin.y.toJsNumber() + z = dstOrigin.z.toJsNumber() + } + }, + copySize = createJsObject().apply { + width = size.width.toJsNumber() + height = size.height.toJsNumber() + depthOrArrayLayers = size.depthOrArrayLayers.toJsNumber() + } + ) +} + +private val ImageData.arrayBufferView: ArrayBufferView get() { + check(this is BufferedImageData) + + val bufData = data + return when { + format.isF16 && bufData is Float32BufferImpl -> { + val f32Array = bufData.buffer + val f16Buffer = Uint8Array(f32Array.length * 2) + for (i in 0 until f32Array.length) { + f16Buffer.putF16(i, f32Array[i]) + } + f16Buffer + } + bufData is Uint8BufferImpl -> bufData.buffer + bufData is Uint16BufferImpl -> bufData.buffer + bufData is Float32BufferImpl -> bufData.buffer + else -> throw IllegalArgumentException("Unsupported buffer type") + } +} + +private fun Uint8Array.putF16(index: Int, f32: Float) { + float32ToFloat16(f32) { high, low -> + val byteI = index * 2 + set(byteI, low) + set(byteI+1, high) + } +} \ No newline at end of file diff --git a/kool-core/build.gradle.kts b/kool-core/build.gradle.kts index bd22e9dd7..ee49d6907 100644 --- a/kool-core/build.gradle.kts +++ b/kool-core/build.gradle.kts @@ -36,7 +36,8 @@ kotlin { implementation(libs.kotlin.test.junit) } - jsMain.dependencies { + webMain.dependencies { + implementation(libs.kotlinx.browser) implementation(npm("pako", "2.0.4")) implementation(npm("jszip", "3.10.1")) } diff --git a/kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/backend/wgsl/WgslGenerator.kt b/kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/backend/wgsl/WgslGenerator.kt index a2ad71577..56f45b4dc 100644 --- a/kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/backend/wgsl/WgslGenerator.kt +++ b/kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/backend/wgsl/WgslGenerator.kt @@ -840,6 +840,7 @@ class WgslGenerator private constructor( KslStateType.VertexOutput -> "vertexOutput." KslStateType.FragmentInput -> "fragmentInput." KslStateType.FragmentOutput -> "fragmentOutput." + KslStateType.ComputeInput if state.stateName == KslComputeStage.NAME_IN_WORK_GROUP_SIZE -> "" KslStateType.ComputeInput -> "computeInput." KslStateType.Other -> "" } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/Assets.js.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/Assets.js.kt index 4809ae6d6..5c8b8f6d0 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/Assets.js.kt +++ b/kool-core/src/jsMain/kotlin/de/fabmax/kool/Assets.js.kt @@ -14,6 +14,7 @@ import de.fabmax.kool.util.Uint8BufferImpl import kotlinx.browser.document import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.await +import kotlinx.js.JsPlainObject import org.khronos.webgl.ArrayBuffer import org.khronos.webgl.Uint8Array import org.w3c.dom.Image @@ -142,17 +143,20 @@ external fun createImageBitmap(image: Image, options: ImageBitmapOptions = defin external fun fetch(resource: String): Promise -external interface ImageBitmapOptions - -fun ImageBitmapOptions(resize: Vec2i? = null, resizeQuality: String = "high"): ImageBitmapOptions { - val o = js("({})") - o["premultiplyAlpha"] = "none" - if (resize != null) { - o["resizeWidth"] = resize.x - o["resizeHeight"] = resize.y - o["resizeQuality"] = resizeQuality +fun ImageBitmapOptions(resize: Vec2i? = null): ImageBitmapOptions { + return if (resize != null) { + ImageBitmapOptions(premultiplyAlpha = "none", resizeWidth = resize.x, resizeHeight = resize.y, resizeQuality = "high") + } else { + ImageBitmapOptions(premultiplyAlpha = "none") } - return o +} + +@JsPlainObject +external interface ImageBitmapOptions { + val premultiplyAlpha: String + val resizeWidth: Int? + val resizeHeight: Int? + val resizeQuality: String? } external interface Response { diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/Clipboard.js.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/Clipboard.js.kt deleted file mode 100644 index 687fe45bd..000000000 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/Clipboard.js.kt +++ /dev/null @@ -1,15 +0,0 @@ -package de.fabmax.kool - -import kotlin.js.Promise - -@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") -actual object Clipboard { - actual fun copyToClipboard(string: String) { - js("navigator.clipboard.writeText(string)") - } - - actual fun getStringFromClipboard(receiver: (String?) -> Unit) { - val promise = js("navigator.clipboard.readText()") as Promise - promise.then { receiver(it) } - } -} \ No newline at end of file diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/ControllerJs.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/ControllerJs.kt index 415cebd47..40cbecdbf 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/ControllerJs.kt +++ b/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/ControllerJs.kt @@ -1,105 +1,5 @@ package de.fabmax.kool.input import de.fabmax.kool.platform.navigator -import de.fabmax.kool.util.logI -import kotlin.math.min -class ControllerJs(private var gamepad: Gamepad) : Controller(gamepad.index) { - override val name: String = gamepad.id - - override val isConnected: Boolean get() = gamepad.connected - override val isGamepad: Boolean = gamepad.mapping == "standard" - override val buttonStates: BooleanArray - override val axisStates: FloatArray - - init { - if (isGamepad) { - buttonStates = BooleanArray(STANDARD_LAYOUT_NUM_BUTTONS) - axisStates = FloatArray(STANDARD_LAYOUT_NUM_AXES) - } else { - buttonStates = BooleanArray(gamepad.buttons.size) - axisStates = FloatArray(gamepad.axes.size) - } - logI { "Controller connected: $name (${gamepad.axes.size} axes, ${gamepad.buttons.size} buttons, isGamepad: $isGamepad)" } - } - - override fun updateState() { - gamepad = navigator.getGamepads()?.get(gamepad.index) ?: return - if (!isConnected) { - return - } - - if (isGamepad) { - // use standardized mapping - setButtonState(ControllerButton.A, gamepad.getButtonState(STD_BTN_A)) - setButtonState(ControllerButton.B, gamepad.getButtonState(STD_BTN_B)) - setButtonState(ControllerButton.X, gamepad.getButtonState(STD_BTN_X)) - setButtonState(ControllerButton.Y, gamepad.getButtonState(STD_BTN_Y)) - - setButtonState(ControllerButton.DPAD_LEFT, gamepad.getButtonState(STD_BTN_DPAD_LEFT)) - setButtonState(ControllerButton.DPAD_RIGHT, gamepad.getButtonState(STD_BTN_DPAD_RIGHT)) - setButtonState(ControllerButton.DPAD_UP, gamepad.getButtonState(STD_BTN_DPAD_UP)) - setButtonState(ControllerButton.DPAD_DOWN, gamepad.getButtonState(STD_BTN_DPAD_DOWN)) - - setButtonState(ControllerButton.SHOULDER_LEFT, gamepad.getButtonState(STD_BTN_SHOULDER_LEFT)) - setButtonState(ControllerButton.SHOULDER_RIGHT, gamepad.getButtonState(STD_BTN_SHOULDER_RIGHT)) - setButtonState(ControllerButton.THUMB_LEFT, gamepad.getButtonState(STD_BTN_THUMB_LEFT)) - setButtonState(ControllerButton.THUMB_RIGHT, gamepad.getButtonState(STD_BTN_THUMB_RIGHT)) - - setButtonState(ControllerButton.START, gamepad.getButtonState(STD_BTN_START)) - setButtonState(ControllerButton.BACK, gamepad.getButtonState(STD_BTN_BACK)) - setButtonState(ControllerButton.GUIDE, gamepad.getButtonState(STD_BTN_GUIDE)) - - setAxisState(ControllerAxis.LEFT_X, gamepad.axes[STD_AX_LEFT_X].toFloat()) - setAxisState(ControllerAxis.LEFT_Y, gamepad.axes[STD_AX_LEFT_Y].toFloat()) - setAxisState(ControllerAxis.RIGHT_X, gamepad.axes[STD_AX_RIGHT_X].toFloat()) - setAxisState(ControllerAxis.RIGHT_Y, gamepad.axes[STD_AX_RIGHT_Y].toFloat()) - setAxisState(ControllerAxis.TRIGGER_LEFT, gamepad.buttons[STD_BTN_TRIGGER_LEFT].value.toFloat()) - setAxisState(ControllerAxis.TRIGGER_RIGHT, gamepad.buttons[STD_BTN_TRIGGER_RIGHT].value.toFloat()) - - } else { - for (i in 0 until min(buttonStates.size, gamepad.buttons.size)) { - buttonStates[i] = gamepad.buttons[i].pressed - } - for (i in 0 until min(axisStates.size, gamepad.axes.size)) { - axisStates[i] = gamepad.axes[i].toFloat() - } - } - } - - private fun Gamepad.getButtonState(index: Int): Boolean { - return buttons.getOrNull(index)?.pressed == true - } - - companion object { - // standard input mapping - // https://w3c.github.io/gamepad/#dfn-standard-gamepad - - private const val STD_BTN_A = 0 - private const val STD_BTN_B = 1 - private const val STD_BTN_X = 2 - private const val STD_BTN_Y = 3 - - private const val STD_BTN_SHOULDER_LEFT = 4 - private const val STD_BTN_SHOULDER_RIGHT = 5 - private const val STD_BTN_TRIGGER_LEFT = 6 - private const val STD_BTN_TRIGGER_RIGHT = 7 - - private const val STD_BTN_BACK = 8 - private const val STD_BTN_START = 9 - private const val STD_BTN_GUIDE = 16 - - private const val STD_BTN_THUMB_LEFT = 10 - private const val STD_BTN_THUMB_RIGHT = 11 - - private const val STD_BTN_DPAD_UP = 12 - private const val STD_BTN_DPAD_DOWN = 13 - private const val STD_BTN_DPAD_LEFT = 14 - private const val STD_BTN_DPAD_RIGHT = 15 - - private const val STD_AX_LEFT_X = 0 - private const val STD_AX_LEFT_Y = 1 - private const val STD_AX_RIGHT_X = 2 - private const val STD_AX_RIGHT_Y = 3 - } -} \ No newline at end of file +actual fun getGamepadState(index: Int): de.fabmax.kool.Gamepad? = navigator.getGamepads()?.get(index) \ No newline at end of file diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/PlatformInput.js.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/PlatformInput.js.kt index ac91486e7..24dfe474f 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/PlatformInput.js.kt +++ b/kool-core/src/jsMain/kotlin/de/fabmax/kool/input/PlatformInput.js.kt @@ -1,5 +1,6 @@ package de.fabmax.kool.input +import de.fabmax.kool.Gamepad import de.fabmax.kool.JsImpl import de.fabmax.kool.KoolSystem import de.fabmax.kool.configJs @@ -73,7 +74,7 @@ internal object PlatformInputJs : PlatformInput { navigator.getGamepads()?.forEach { if (it != null) { - ControllerInput.addController(ControllerJs(it)) + ControllerInput.addController(ControllerWeb(it)) } } @@ -176,7 +177,7 @@ internal object PlatformInputJs : PlatformInput { private fun installGamepadHandlers() { window.addEventListener("gamepadconnected", { ev -> val gamepad = (ev as GamepadEvent).gamepad - ControllerInput.addController(ControllerJs(gamepad)) + ControllerInput.addController(ControllerWeb(gamepad)) }) window.addEventListener("gamepaddisconnected", { ev -> val gamepad = (ev as GamepadEvent).gamepad @@ -353,22 +354,6 @@ internal object PlatformInputJs : PlatformInput { } } -external class GamepadEvent : Event { +external class GamepadEvent : Event, JsAny { val gamepad: Gamepad } - -external interface Gamepad { - val axes: DoubleArray - val buttons: Array - val connected: Boolean - val id: String - val index: Int - val mapping: String - val timestamp: Double -} - -external interface GamepadButton { - val pressed: Boolean - val touched: Boolean - val value: Double -} diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.js.kt similarity index 76% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.kt rename to kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.js.kt index 9218d53dd..f04b48b39 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.kt +++ b/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.js.kt @@ -24,51 +24,51 @@ import org.w3c.dom.HTMLCanvasElement import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds -class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { - override val name: String = "WebGPU" - override val apiName: String = "WebGPU" - override val deviceName: String = "WebGPU" - override val deviceCoordinates: DeviceCoordinates = DeviceCoordinates.WEB_GPU - override lateinit var features: BackendFeatures; private set +actual class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { + override actual val name: String = "WebGPU" + override actual val apiName: String = "WebGPU" + override actual val deviceName: String = "WebGPU" + override actual val deviceCoordinates: DeviceCoordinates = DeviceCoordinates.WEB_GPU + private lateinit var _features: BackendFeatures + override actual val features: BackendFeatures get() = _features + + actual val numSamples: Int = KoolSystem.configJs.numSamples + actual val framebufferSize: Vec2i get() = ctx.window.framebufferSize private val canvas: HTMLCanvasElement get() = ctx.window.canvas - lateinit var adapter: GPUAdapter - private set - lateinit var device: GPUDevice - private set - lateinit var canvasContext: GPUCanvasContext - private set + private var _adapter: GPUAdapter? = null + private var _device: GPUDevice? = null + private var _canvasContext: GPUCanvasContext? = null private var _canvasFormat: GPUTextureFormat? = null - val canvasFormat: GPUTextureFormat - get() = _canvasFormat!! + actual val adapter: GPUAdapter get() = requireNotNull(_adapter) + actual val device: GPUDevice get() = requireNotNull(_device) + actual val canvasContext: GPUCanvasContext get() = requireNotNull(_canvasContext) + actual val canvasFormat: GPUTextureFormat get() = _canvasFormat!! + + private var _textureLoader: WgpuTextureLoader? = null + internal actual val textureLoader: WgpuTextureLoader get() = requireNotNull(_textureLoader) - internal lateinit var textureLoader: WgpuTextureLoader - private set + private var _isTimestampQuerySupported = false + actual val isTimestampQuerySupported: Boolean get() = _isTimestampQuerySupported - var isTimestampQuerySupported = false - private set - internal val timestampQuery: WgpuTimestamps by lazy { WgpuTimestamps(128, this) } + internal actual val timestampQuery: WgpuTimestamps by lazy { WgpuTimestamps(128, this) } - val pipelineManager = WgpuPipelineManager(this) + actual val pipelineManager = WgpuPipelineManager(this) private val screenPass = WgpuScreenPass(this) private var renderSize = Vec2i(canvas.width, canvas.height) private val gpuReadbacks = mutableListOf() - override val frameGpuTime: Duration = 0.0.seconds + override actual val frameGpuTime: Duration = 0.0.seconds - override val isAsyncRendering: Boolean = false + override actual val isAsyncRendering: Boolean = false - val clearHelper: ClearHelper by lazy { ClearHelper(this) } + actual val clearHelper: ClearHelper by lazy { ClearHelper(this) } private val passEncoderState = RenderPassEncoderState(this) init { - check(isSupported()) { - val txt = "WebGPU not supported on this browser." - js("alert(txt)") - txt - } + check(isSupported()) { "WebGPU not supported on this browser." } } internal suspend fun createWebGpuContext(): Boolean { @@ -76,24 +76,24 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { PowerPreference.HighPerformance -> GPUPowerPreference.highPerformance PowerPreference.LowPower -> GPUPowerPreference.lowPower } - val selectedAdapter = navigator.gpu.requestAdapter(GPURequestAdapterOptions(powerPref)).await() - ?: navigator.gpu.requestAdapter().await() + val selectedAdapter = navigator.gpu.requestAdapter(GPURequestAdapterOptions(powerPref)).await() + ?: navigator.gpu.requestAdapter().await() if (selectedAdapter == null) { logE { "No appropriate GPUAdapter found." } return false } - adapter = selectedAdapter + _adapter = selectedAdapter - val availableFeatures = mutableSetOf() - adapter.features.forEach { s: String -> availableFeatures.add(s) } + val availableFeatures = mutableListOf() + adapter.features.forEach { availableFeatures.add(it) } logD { "Available GPUAdapter features:" } - availableFeatures.forEach { logD { it } } + availableFeatures.forEach { logD { "- $it" } } val requiredFeatures = mutableListOf() if ("timestamp-query" in availableFeatures) { logI { "Enabling WebGPU timestamp-query feature" } requiredFeatures.add("timestamp-query") - isTimestampQuerySupported = true + _isTimestampQuerySupported = true } if ("rg11b10ufloat-renderable" in availableFeatures) { logI { "Enabling rg11b10ufloat-renderable feature" } @@ -101,14 +101,14 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { } try { - val deviceDesc = GPUDeviceDescriptor(requiredFeatures.toTypedArray()) - device = adapter.requestDevice(deviceDesc).await() + val deviceDesc = GPUDeviceDescriptor(requiredFeatures) + _device = adapter.requestDevice(deviceDesc).await() } catch (e: Exception) { logE { "requestDevice() failed: $e" } return false } - features = BackendFeatures( + _features = BackendFeatures( computeShaders = true, cubeMapArrays = true, reversedDepth = true, @@ -128,17 +128,17 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { maxComputeInvocationsPerWorkgroup = device.limits.maxComputeInvocationsPerWorkgroup, ) - canvasContext = canvas.getContext("webgpu") as GPUCanvasContext - _canvasFormat = navigator.gpu.getPreferredCanvasFormat() + _canvasContext = canvas.getContext("webgpu") as GPUCanvasContext + _canvasFormat = GPUTextureFormat.forValue(navigator.gpu.getPreferredCanvasFormat()) canvasContext.configure( GPUCanvasConfiguration(device, canvasFormat) ) - textureLoader = WgpuTextureLoader(this) + _textureLoader = WgpuTextureLoader(this) logI { "WebGPU context created" } return true } - override fun renderFrame(frameData: FrameData, ctx: KoolContext) { + actual override fun renderFrame(frameData: FrameData, ctx: KoolContext) { BackendStats.resetPerFrameCounts() if (ctx.window.framebufferSize != renderSize) { @@ -206,11 +206,11 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { (impl as WgpuComputePass).dispatch(passEncoderState.encoder) } - override fun cleanup(ctx: KoolContext) { + actual override fun cleanup(ctx: KoolContext) { // do nothing for now } - override fun generateKslShader(shader: KslShader, pipeline: DrawPipeline): ShaderCode { + actual override fun generateKslShader(shader: KslShader, pipeline: DrawPipeline): ShaderCode { val output = WgslGenerator.generateProgram(shader.program, pipeline) return WebGpuShaderCode( vertexSrc = output.vertexSrc, @@ -220,7 +220,7 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { ) } - override fun generateKslComputeShader(shader: KslComputeShader, pipeline: ComputePipeline): ComputeShaderCode { + actual override fun generateKslComputeShader(shader: KslComputeShader, pipeline: ComputePipeline): ComputeShaderCode { val output = WgslGenerator.generateComputeProgram(shader.program, pipeline) return WebGpuComputeShaderCode( computeSrc = output.computeSrc, @@ -228,25 +228,25 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { ) } - override fun createOffscreenPass2d(parentPass: OffscreenPass2d): OffscreenPass2dImpl { + actual override fun createOffscreenPass2d(parentPass: OffscreenPass2d): OffscreenPass2dImpl { return WgpuOffscreenPass2d(parentPass, this) } - override fun createOffscreenPassCube(parentPass: OffscreenPassCube): OffscreenPassCubeImpl { + actual override fun createOffscreenPassCube(parentPass: OffscreenPassCube): OffscreenPassCubeImpl { return WgpuOffscreenPassCube(parentPass, this) } - override fun createComputePass(parentPass: ComputePass): ComputePassImpl { + actual override fun createComputePass(parentPass: ComputePass): ComputePassImpl { return WgpuComputePass(parentPass, this) } - override fun uploadTextureData(tex: Texture) = textureLoader.loadTexture(tex) + actual override fun uploadTextureData(tex: Texture) = textureLoader.loadTexture(tex) - override fun downloadBuffer(buffer: GpuBuffer, deferred: CompletableDeferred, resultBuffer: Buffer) { + actual override fun downloadBuffer(buffer: GpuBuffer, deferred: CompletableDeferred, resultBuffer: Buffer) { gpuReadbacks += ReadbackStorageBuffer(buffer, deferred, resultBuffer) } - override fun downloadTextureData(texture: Texture<*>, deferred: CompletableDeferred) { + actual override fun downloadTextureData(texture: Texture<*>, deferred: CompletableDeferred) { gpuReadbacks += ReadbackTexture(texture, deferred) } @@ -260,11 +260,11 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { val mapBuffer = device.createBuffer( GPUBufferDescriptor( label = "storage-buffer-readback", - size = size, + size = size.toJsNumber(), usage = GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST ) ) - encoder.copyBufferToBuffer(gpuBuf.buffer, 0L, mapBuffer, 0L, size) + encoder.copyBufferToBuffer(gpuBuf.buffer, 0.toJsNumber(), mapBuffer, 0.toJsNumber(), size.toJsNumber()) readback.mapBuffer = mapBuffer } } @@ -279,7 +279,7 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { val mapBuffer = device.createBuffer( GPUBufferDescriptor( label = "texture-readback", - size = size, + size = size.toJsNumber(), usage = GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST ) ) @@ -290,7 +290,7 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { bytesPerRow = format.pxSize * gpuTex.width, rowsPerImage = gpuTex.height ), - copySize = intArrayOf(gpuTex.width, gpuTex.height, gpuTex.depth) + copySize = intArrayOf(gpuTex.width, gpuTex.height, gpuTex.depth).toJsArray() ) readback.mapBuffer = mapBuffer } @@ -305,6 +305,7 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { mapBuffer.unmap() mapBuffer.destroy() readback.deferred.complete(Unit) + it } } @@ -323,6 +324,7 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { is Texture3d -> readback.deferred.complete(BufferedImageData3d(dst, gpuTex.width, gpuTex.height, gpuTex.depth, format)) else -> readback.deferred.completeExceptionally(IllegalArgumentException("Unsupported texture type")) } + it } } @@ -340,11 +342,11 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { } } - fun createBuffer(descriptor: GPUBufferDescriptor, info: String?): GpuBufferWgpu { - return GpuBufferWgpu(device.createBuffer(descriptor), descriptor.size, info) + actual fun createBuffer(descriptor: GPUBufferDescriptor, info: String?): GpuBufferWgpu { + return GpuBufferWgpu(device.createBuffer(descriptor), descriptor.size.toLong(), info) } - fun createTexture(descriptor: GPUTextureDescriptor): WgpuTextureResource { + actual fun createTexture(descriptor: GPUTextureDescriptor): WgpuTextureResource { return WgpuTextureResource(descriptor, device.createTexture(descriptor)) } @@ -358,23 +360,6 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { var mapBuffer: GPUBuffer? = null } - data class WebGpuShaderCode( - val vertexSrc: String, - val vertexEntryPoint: String, - val fragmentSrc: String, - val fragmentEntryPoint: String - ): ShaderCode { - override val hash = LongHash { - this += vertexSrc.hashCode().toLong() shl 32 or fragmentSrc.hashCode().toLong() - } - } - - data class WebGpuComputeShaderCode(val computeSrc: String, val computeEntryPoint: String): ComputeShaderCode { - override val hash = LongHash { - this += computeSrc - } - } - companion object : BackendProvider { override val displayName: String = "WebGPU" @@ -392,7 +377,9 @@ class RenderBackendWebGpu(val ctx: JsContext) : RenderBackend { } fun isSupported(): Boolean { - return !js("!navigator.gpu") as Boolean + return !isNoWgpuSupport() } } -} \ No newline at end of file +} + +private fun isNoWgpuSupport(): Boolean = js("!navigator.gpu") diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDictionaries.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDictionaries.kt deleted file mode 100644 index 5b0a4da89..000000000 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDictionaries.kt +++ /dev/null @@ -1,557 +0,0 @@ -package de.fabmax.kool.pipeline.backend.webgpu - -import de.fabmax.kool.util.Color -import org.w3c.dom.ImageBitmap - -class GPUBindGroupLayoutDescriptor( - @JsName("entries") - val entries: Array, - @JsName("label") - val label: String = "" -) - -sealed interface GPUBindGroupLayoutEntry - -data class GPUBindGroupLayoutEntryBuffer( - @JsName("binding") - val binding: Int, - @JsName("visibility") - val visibility: Int, - @JsName("buffer") - val buffer: GPUBufferBindingLayout, -) : GPUBindGroupLayoutEntry - -data class GPUBindGroupLayoutEntrySampler( - @JsName("binding") - val binding: Int, - @JsName("visibility") - val visibility: Int, - @JsName("sampler") - val sampler: GPUSamplerBindingLayout, -) : GPUBindGroupLayoutEntry - -data class GPUBindGroupLayoutEntryTexture( - @JsName("binding") - val binding: Int, - @JsName("visibility") - val visibility: Int, - @JsName("texture") - val texture: GPUTextureBindingLayout, -) : GPUBindGroupLayoutEntry - -data class GPUBindGroupLayoutEntryStorageTexture( - @JsName("binding") - val binding: Int, - @JsName("visibility") - val visibility: Int, - @JsName("storageTexture") - val storageTexture: GPUStorageTextureBindingLayout, -) : GPUBindGroupLayoutEntry - -data class GPUBindGroupLayoutEntryExternaleTexture( - @JsName("binding") - val binding: Int, - @JsName("visibility") - val visibility: Int, - @JsName("externalTexture") - val externalTexture: GPUExternalTextureBindingLayout, -) : GPUBindGroupLayoutEntry - -data class GPUBufferBindingLayout( - @JsName("type") - val type: GPUBufferBindingType = GPUBufferBindingType.uniform, - @JsName("hasDynamicOffset") - val hasDynamicOffset: Boolean = false, - @JsName("minBindingSize") - val minBindingSize: Long = 0 -) - -class GPUSamplerBindingLayout( - @JsName("type") - val type: GPUSamplerBindingType = GPUSamplerBindingType.filtering -) - -class GPUTextureBindingLayout( - @JsName("sampleType") - val sampleType: GPUTextureSampleType = GPUTextureSampleType.float, - @JsName("viewDimension") - val viewDimension: GPUTextureViewDimension = GPUTextureViewDimension.view2d, - @JsName("multisampled") - val multisampled: Boolean = false -) - -class GPUStorageTextureBindingLayout( - @JsName("access") - val access: GPUStorageTextureAccess, - @JsName("format") - val format: GPUTextureFormat, - @JsName("viewDimension") - val viewDimension: GPUTextureViewDimension, -) - -class GPUExternalTextureBindingLayout - -class GPUBindGroupDescriptor( - @JsName("layout") - val layout: GPUBindGroupLayout, - @JsName("entries") - val entries: Array, - @JsName("label") - val label: String = "" -) - -class GPUBindGroupEntry( - @JsName("binding") - val binding: Int, - @JsName("resource") - val resource: GPUBindingResource, -) - -class GPUBlendState( - @JsName("color") - val color: GPUBlendComponent, - @JsName("alpha") - val alpha: GPUBlendComponent, -) - -class GPUBlendComponent( - @JsName("operation") - val operation: GPUBlendOperation = GPUBlendOperation.add, - @JsName("srcFactor") - val srcFactor: GPUBlendFactor = GPUBlendFactor.one, - @JsName("dstFactor") - val dstFactor: GPUBlendFactor = GPUBlendFactor.zero -) - -class GPUBufferBinding( - @JsName("buffer") - val buffer: GPUBuffer, - @JsName("offset") - val offset: Long = 0, -// @JsName("size") -// val size: Long = 0 -) : GPUBindingResource - -data class GPUBufferDescriptor( - @JsName("size") - val size: Long, - @JsName("usage") - val usage: Int, - @JsName("mappedAtCreation") - val mappedAtCreation: Boolean = false, - @JsName("label") - val label: String = "" -) - -interface GPUCanvasConfiguration - -fun GPUCanvasConfiguration( - device: GPUDevice, - format: GPUTextureFormat, - usage: Int? = null, - colorSpace: GPUPredefinedColorSpace? = null, - alphaMode: GPUCanvasAlphaMode? = null -): GPUCanvasConfiguration { - val o = js("({})") - o["device"] = device - o["format"] = format - usage?.let { o["usage"] = it } - colorSpace?.let { o["colorSpace"] = it } - alphaMode?.let { o["alphaMode"] = it } - return o -} - -data class GPUColorDict( - @JsName("r") - val r: Float, - @JsName("g") - val g: Float, - @JsName("b") - val b: Float, - @JsName("a") - val a: Float, -) - -fun GPUColorDict(color: Color): GPUColorDict = GPUColorDict(color.r, color.g, color.b, color.a) - -interface GPUColorTargetState - -fun GPUColorTargetState( - format: GPUTextureFormat, - blend: GPUBlendState? = null -) : GPUColorTargetState { - val o = js("({})") - o["format"] = format - blend?.let { o["blend"] = it } - return o -} - -interface GPUComputePassDescriptor - -fun GPUComputePassDescriptor( - label: String = "", - timestampWrites: GPUComputePassTimestampWrites? = null -): GPUComputePassDescriptor { - val o = js("({})") - timestampWrites?.let { o["timestampWrites"] = it } - o["label"] = label - return o -} - -interface GPUComputePipelineDescriptor - -fun GPUComputePipelineDescriptor( - layout: GPUPipelineLayout, - compute: GPUProgrammableStage, - label: String = "", -): GPUComputePipelineDescriptor { - val o = js("({})") - o["layout"] = layout - o["compute"] = compute - o["label"] = label - return o -} - -class GPUFragmentState( - @JsName("module") - val module: GPUShaderModule, - @JsName("entryPoint") - val entryPoint: String, - @JsName("targets") - val targets: Array, -) - -class GPUImageCopyExternalImage( - @JsName("source") - val source: ImageBitmap -) - -class GPUImageCopyBuffer( - @JsName("buffer") - val buffer: GPUBuffer, - @JsName("bytesPerRow") - val bytesPerRow: Int, - @JsName("rowsPerImage") - val rowsPerImage: Int, - @JsName("offset") - val offset: Long = 0 -) - -class GPUImageCopyTexture( - @JsName("texture") - val texture: GPUTexture, - @JsName("mipLevel") - val mipLevel: Int = 0, - @JsName("origin") - val origin: IntArray = intArrayOf(0, 0, 0), - //aspect: GPUTextureAspect = 'all' -) - -class GPUImageCopyTextureTagged( - @JsName("texture") - val texture: GPUTexture, - @JsName("mipLevel") - val mipLevel: Int = 0, - @JsName("origin") - val origin: IntArray = intArrayOf(0, 0, 0), - //aspect: GPUTextureAspect = 'all' - //colorSpace: PredefinedColorSpace = 'srgb' - //premultipliedAlpha: boolean = 'false' -) - -class GPUImageDataLayout( - @JsName("bytesPerRow") - val bytesPerRow: Int, - @JsName("rowsPerImage") - val rowsPerImage: Int, - @JsName("offset") - val offset: Long = 0 -) - -data class GPUMultisampleState( - @JsName("count") - val count: Int = 1, -// @JsName("mask") -// val mask: UInt = 0xffffffffu, - @JsName("alphaToCoverageEnabled") - val alphaToCoverageEnabled: Boolean = false -) - -class GPUPipelineLayoutDescriptor( - @JsName("bindGroupLayouts") - val bindGroupLayouts: Array, - @JsName("label") - val label: String = "" -) - -interface GPUPrimitiveState - -fun GPUPrimitiveState( - topology: GPUPrimitiveTopology, - stripIndexFormat: GPUIndexFormat = GPUIndexFormat.uint32, - frontFace: GPUFrontFace = GPUFrontFace.ccw, - cullMode: GPUCullMode = GPUCullMode.none, - unclippedDepth: Boolean = false -): GPUPrimitiveState { - val o = js("({})") - o["frontFace"] = frontFace - o["cullMode"] = cullMode - o["unclippedDepth"] = unclippedDepth - o["topology"] = topology - if (topology == GPUPrimitiveTopology.triangleStrip || topology == GPUPrimitiveTopology.lineStrip) { - o["stripIndexFormat"] = stripIndexFormat - } - return o -} - -interface GPURenderPassColorAttachment - -fun GPURenderPassColorAttachment( - view: GPUTextureView, - clearValue: GPUColorDict? = null, - resolveTarget: GPUTextureView? = null, - loadOp: GPULoadOp = if (clearValue != null) GPULoadOp.clear else GPULoadOp.load, - storeOp: GPUStoreOp = GPUStoreOp.store, - label: String = "" -) : GPURenderPassColorAttachment { - val o = js("({})") - o["label"] = label - clearValue?.let { o["clearValue"] = it } - o["loadOp"] = loadOp - o["view"] = view - o["storeOp"] = storeOp - resolveTarget?.let { o["resolveTarget"] = it } - return o -} - -data class GPURenderPassDepthStencilAttachment( - @JsName("view") - val view: GPUTextureView, - @JsName("depthLoadOp") - val depthLoadOp: GPULoadOp, - @JsName("depthStoreOp") - val depthStoreOp: GPUStoreOp, - @JsName("depthClearValue") - val depthClearValue: Float = 1f, -) - -interface GPURenderPassDescriptor - -fun GPURenderPassDescriptor( - colorAttachments: Array, - depthStencilAttachment: GPURenderPassDepthStencilAttachment? = null, - timestampWrites: GPURenderPassTimestampWrites? = null, - label: String = "" -): GPURenderPassDescriptor { - val o = js("({})") - o["colorAttachments"] = colorAttachments - depthStencilAttachment?.let { o["depthStencilAttachment"] = it } - timestampWrites?.let { o["timestampWrites"] = it } - o["label"] = label - return o -} - -data class GPUComputePassTimestampWrites( - @JsName("querySet") - val querySet: GPUQuerySet, - @JsName("beginningOfPassWriteIndex") - val beginningOfPassWriteIndex: Int, - @JsName("endOfPassWriteIndex") - val endOfPassWriteIndex: Int -) - -data class GPURenderPassTimestampWrites( - @JsName("querySet") - val querySet: GPUQuerySet, - @JsName("beginningOfPassWriteIndex") - val beginningOfPassWriteIndex: Int, - @JsName("endOfPassWriteIndex") - val endOfPassWriteIndex: Int -) - -interface GPURenderPipelineDescriptor - -fun GPURenderPipelineDescriptor( - layout: GPUPipelineLayout, - vertex: GPUVertexState, - fragment: GPUFragmentState? = null, - depthStencil: GPUDepthStencilState? = null, - primitive: GPUPrimitiveState? = null, - multisample: GPUMultisampleState? = null, - label: String = "", -): GPURenderPipelineDescriptor { - val o = js("({})") - o["layout"] = layout - o["vertex"] = vertex - fragment?.let { o["fragment"] = it } - depthStencil?.let { o["depthStencil"] = it } - primitive?.let { o["primitive"] = it } - multisample?.let { o["multisample"] = it } - o["label"] = label - return o -} - -data class GPUDepthStencilState( - @JsName("format") - val format: GPUTextureFormat, - @JsName("depthWriteEnabled") - val depthWriteEnabled: Boolean, - @JsName("depthCompare") - val depthCompare: GPUCompareFunction, - @JsName("depthBias") - val depthBias: Int = 0, - @JsName("depthBiasSlopeScale") - val depthBiasSlopeScale: Float = 0f, - @JsName("depthBiasClamp") - val depthBiasClamp: Float = 0f -) - -interface GPUDeviceDescriptor - -fun GPUDeviceDescriptor( - requiredFeatures: Array = emptyArray(), - label: String = "", -): GPUDeviceDescriptor { - val o = js("({})") - o["requiredFeatures"] = requiredFeatures - o["label"] = label - return o -} - -interface GPUProgrammableStage - -fun GPUProgrammableStage( - module: GPUShaderModule, - entryPoint: String, - // constants: Map -): GPUProgrammableStage { - val o = js("({})") - o["module"] = module - o["entryPoint"] = entryPoint - return o -} - -interface GPUQuerySetDescriptor - -fun GPUQuerySetDescriptor( - type: GPUQueryType, - count: Int, - label: String = "", -): GPUQuerySetDescriptor { - val o = js("({})") - o["type"] = type - o["count"] = count - o["label"] = label - return o -} - -data class GPUShaderModuleDescriptor( - @JsName("code") - val code: String, - @JsName("label") - val label: String = "" -) - -interface GPUSamplerDescriptor -fun GPUSamplerDescriptor( - label: String = "", - addressModeU: GPUAddressMode = GPUAddressMode.clampToEdge, - addressModeV: GPUAddressMode = GPUAddressMode.clampToEdge, - addressModeW: GPUAddressMode = GPUAddressMode.clampToEdge, - magFilter: GPUFilterMode = GPUFilterMode.nearest, - minFilter: GPUFilterMode = GPUFilterMode.nearest, - mipmapFilter: GPUMipmapFilterMode = GPUMipmapFilterMode.nearest, - lodMinClamp: Float = 0f, - lodMaxClamp: Float = 32f, - maxAnisotropy: Int = 1, - compare: GPUCompareFunction? = null, -): GPUSamplerDescriptor { - val o = js("({})") - o["label"] = label - o["addressModeU"] = addressModeU - o["addressModeV"] = addressModeV - o["addressModeW"] = addressModeW - o["magFilter"] = magFilter - o["minFilter"] = minFilter - o["mipmapFilter"] = mipmapFilter - o["lodMinClamp"] = lodMinClamp - o["lodMaxClamp"] = lodMaxClamp - o["maxAnisotropy"] = maxAnisotropy - compare?.let { o["compare"] = it } - return o -} - -class GPUTextureDescriptor( - @JsName("size") - val size: IntArray, - @JsName("format") - val format: GPUTextureFormat, - @JsName("usage") - val usage: Int, - @JsName("label") - val label: String = "", - @JsName("mipLevelCount") - val mipLevelCount: Int = 1, - @JsName("sampleCount") - val sampleCount: Int = 1, - @JsName("dimension") - val dimension: GPUTextureDimension = GPUTextureDimension.texture2d, - @JsName("viewFormats") - val viewFormats: Array = emptyArray(), -) - -interface GPUTextureViewDescriptor -fun GPUTextureViewDescriptor( - label: String = "", - format: GPUTextureFormat? = null, - dimension: GPUTextureViewDimension? = null, - //val aspect: GPUTextureAspect = 'all' - baseMipLevel: Int = 0, - mipLevelCount: Int? = null, - baseArrayLayer: Int = 0, - arrayLayerCount: Int? = null -): GPUTextureViewDescriptor { - val o = js("({})") - o["label"] = label - format?.let { o["format"] = it } - dimension?.let { o["dimension"] = it } - o["baseMipLevel"] = baseMipLevel - mipLevelCount?.let { o["mipLevelCount"] = it } - o["baseArrayLayer"] = baseArrayLayer - arrayLayerCount?.let { o["arrayLayerCount"] = it } - return o -} - -class GPUVertexAttribute( - @JsName("format") - val format: GPUVertexFormat, - @JsName("offset") - val offset: Long, - @JsName("shaderLocation") - val shaderLocation: Int -) - -class GPUVertexBufferLayout( - @JsName("arrayStride") - val arrayStride: Long, - @JsName("attributes") - val attributes: Array, - @JsName("stepMode") - val stepMode: GPUVertexStepMode = GPUVertexStepMode.vertex -) - -class GPUVertexState( - @JsName("module") - val module: GPUShaderModule, - @JsName("entryPoint") - val entryPoint: String, - @JsName("buffers") - val buffers: Array = emptyArray(), -) - -data class GPURequestAdapterOptions( - @JsName("powerPreference") - val powerPreference: GPUPowerPreference, - @JsName("forceFallbackAdapter") - val forceFallbackAdapter: Boolean = false -) diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuEnums.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuEnums.kt deleted file mode 100644 index e2e54cd0e..000000000 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuEnums.kt +++ /dev/null @@ -1,313 +0,0 @@ -package de.fabmax.kool.pipeline.backend.webgpu - -value class GPUAddressMode private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val clampToEdge = GPUAddressMode("clamp-to-edge") - val repeat = GPUAddressMode("repeat") - val mirrorRepeat = GPUAddressMode("mirror-repeat") - } -} - -value class GPUAutoLayoutMode private constructor(val enumValue: String) : GPUPipelineLayout { - override fun toString() = enumValue - companion object { - val auto = GPUAutoLayoutMode("auto") - } -} - -value class GPUBlendFactor private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val zero = GPUBlendFactor("zero") - val one = GPUBlendFactor("one") - val src = GPUBlendFactor("src") - val oneMinusSrc = GPUBlendFactor("one-minus-src") - val srcAlpha = GPUBlendFactor("src-alpha") - val oneMinusSrcAlpha = GPUBlendFactor("one-minus-src-alpha") - val dst = GPUBlendFactor("dst") - val oneMinusDst = GPUBlendFactor("one-minus-dst") - val dstAlpha = GPUBlendFactor("dst-alpha") - val oneMinusDstAlpha = GPUBlendFactor("one-minus-dst-alpha") - val srcAlphaSaturated = GPUBlendFactor("src-alpha-saturated") - val constant = GPUBlendFactor("constant") - val oneMinusConstant = GPUBlendFactor("one-minus-constant") - } -} - -value class GPUBlendOperation private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val add = GPUBlendOperation("add") - val subtract = GPUBlendOperation("subtract") - val reverseSubtract = GPUBlendOperation("reverse-subtract") - val min = GPUBlendOperation("min") - val max = GPUBlendOperation("max") - } -} - -value class GPUBufferBindingType private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val uniform = GPUBufferBindingType("uniform") - val storage = GPUBufferBindingType("storage") - val readOnlyStorage = GPUBufferBindingType("read-only-storage") - } -} - -value class GPUCanvasAlphaMode private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val opaque = GPUCanvasAlphaMode("opaque") - val premultiplied = GPUCanvasAlphaMode("premultiplied") - } -} - -value class GPUCompareFunction private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val never = GPUCompareFunction("never") - val less = GPUCompareFunction("less") - val equal = GPUCompareFunction("equal") - val lessEqual = GPUCompareFunction("less-equal") - val greater = GPUCompareFunction("greater") - val notEqual = GPUCompareFunction("not-equal") - val greaterEqual = GPUCompareFunction("greater-equal") - val always = GPUCompareFunction("always") - } -} - -value class GPUCullMode private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val none = GPUCullMode("none") - val front = GPUCullMode("front") - val back = GPUCullMode("back") - } -} - -value class GPUFilterMode private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val nearest = GPUFilterMode("nearest") - val linear = GPUFilterMode("linear") - } -} - -value class GPUFrontFace private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val ccw = GPUFrontFace("ccw") - val cw = GPUFrontFace("cw") - } -} - -value class GPUMipmapFilterMode private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val nearest = GPUMipmapFilterMode("nearest") - val linear = GPUMipmapFilterMode("linear") - } -} - -value class GPUIndexFormat private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val uint16 = GPUIndexFormat("uint16") - val uint32 = GPUIndexFormat("uint32") - } -} - -value class GPULoadOp private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val load = GPULoadOp("load") - val clear = GPULoadOp("clear") - } -} - -value class GPUPredefinedColorSpace private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val srgb = GPUPredefinedColorSpace("srgb") - } -} - -value class GPUPrimitiveTopology private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val pointList = GPUPrimitiveTopology("point-list") - val lineList = GPUPrimitiveTopology("line-list") - val lineStrip = GPUPrimitiveTopology("line-strip") - val triangleList = GPUPrimitiveTopology("triangle-list") - val triangleStrip = GPUPrimitiveTopology("triangle-strip") - } -} - -value class GPUPowerPreference private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val lowPower = GPUPowerPreference("low-power") - val highPerformance = GPUPowerPreference("high-performance") - } -} - -value class GPUQueryType private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val timestamp = GPUQueryType("timestamp") - val occlusion = GPUQueryType("occlusion") - } -} - -value class GPUSamplerBindingType private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val filtering = GPUSamplerBindingType("filtering") - val nonFiltering = GPUSamplerBindingType("non-filtering") - val comparison = GPUSamplerBindingType("comparison") - } -} - -value class GPUStoreOp private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val store = GPUStoreOp("store") - val discard = GPUStoreOp("discard") - } -} - -value class GPUTextureDimension private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val texture1d = GPUTextureDimension("1d") - val texture2d = GPUTextureDimension("2d") - val texture3d = GPUTextureDimension("3d") - } -} - -value class GPUTextureFormat private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val r8unorm = GPUTextureFormat("r8unorm") - val r8snorm = GPUTextureFormat("r8snorm") - val r8uint = GPUTextureFormat("r8uint") - val r8sint = GPUTextureFormat("r8sint") - val r16uint = GPUTextureFormat("r16uint") - val r16sint = GPUTextureFormat("r16sint") - val r16float = GPUTextureFormat("r16float") - val rg8unorm = GPUTextureFormat("rg8unorm") - val rg8snorm = GPUTextureFormat("rg8snorm") - val rg8uint = GPUTextureFormat("rg8uint") - val rg8sint = GPUTextureFormat("rg8sint") - val r32uint = GPUTextureFormat("r32uint") - val r32sint = GPUTextureFormat("r32sint") - val r32float = GPUTextureFormat("r32float") - val rg16uint = GPUTextureFormat("rg16uint") - val rg16sint = GPUTextureFormat("rg16sint") - val rg16float = GPUTextureFormat("rg16float") - val rgba8unorm = GPUTextureFormat("rgba8unorm") - val rgba8unormSrgb = GPUTextureFormat("rgba8unorm-srgb") - val rgba8snorm = GPUTextureFormat("rgba8snorm") - val rgba8uint = GPUTextureFormat("rgba8uint") - val rgba8sint = GPUTextureFormat("rgba8sint") - val bgra8unorm = GPUTextureFormat("bgra8unorm") - val bgra8unormSrgb = GPUTextureFormat("bgra8unorm-srgb") - val rgb9e5ufloat = GPUTextureFormat("rgb9e5ufloat") - val rgb10a2uint = GPUTextureFormat("rgb10a2uint") - val rgb10a2unorm = GPUTextureFormat("rgb10a2unorm") - val rg11b10ufloat = GPUTextureFormat("rg11b10ufloat") - val rg32uint = GPUTextureFormat("rg32uint") - val rg32sint = GPUTextureFormat("rg32sint") - val rg32float = GPUTextureFormat("rg32float") - val rgba16uint = GPUTextureFormat("rgba16uint") - val rgba16sint = GPUTextureFormat("rgba16sint") - val rgba16float = GPUTextureFormat("rgba16float") - val rgba32uint = GPUTextureFormat("rgba32uint") - val rgba32sint = GPUTextureFormat("rgba32sint") - val rgba32float = GPUTextureFormat("rgba32float") - val stencil8 = GPUTextureFormat("stencil8") - val depth16unorm = GPUTextureFormat("depth16unorm") - val depth24plus = GPUTextureFormat("depth24plus") - val depth24plusStencil8 = GPUTextureFormat("depth24plus-stencil8") - val depth32float = GPUTextureFormat("depth32float") - val depth32floatStencil8 = GPUTextureFormat("depth32float-stencil8") - // todo: many more compressed formats... - } -} - -value class GPUTextureSampleType private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val float = GPUTextureSampleType("float") - val unfilterableFloat = GPUTextureSampleType("unfilterable-float") - val depth = GPUTextureSampleType("depth") - val sint = GPUTextureSampleType("sint") - val uint = GPUTextureSampleType("uint") - } -} - -value class GPUStorageTextureAccess private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val writeOnly = GPUStorageTextureAccess("write-only") - val readOnly = GPUStorageTextureAccess("read-only") - val readWrite = GPUStorageTextureAccess("read-write") - } -} - -value class GPUTextureViewDimension private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val view1d = GPUTextureViewDimension("1d") - val view2d = GPUTextureViewDimension("2d") - val view2dArray = GPUTextureViewDimension("2d-array") - val viewCube = GPUTextureViewDimension("cube") - val viewCubeArray = GPUTextureViewDimension("cube-array") - val view3d = GPUTextureViewDimension("3d") - } -} - -value class GPUVertexFormat private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val uint8x2 = GPUVertexFormat("uint8x2") - val uint8x4 = GPUVertexFormat("uint8x4") - val sint8x2 = GPUVertexFormat("sint8x2") - val sint8x4 = GPUVertexFormat("sint8x4") - val unorm8x2 = GPUVertexFormat("unorm8x2") - val unorm8x4 = GPUVertexFormat("unorm8x4") - val snorm8x2 = GPUVertexFormat("snorm8x2") - val snorm8x4 = GPUVertexFormat("snorm8x4") - val uint16x2 = GPUVertexFormat("uint16x2") - val uint16x4 = GPUVertexFormat("uint16x4") - val sint16x2 = GPUVertexFormat("sint16x2") - val sint16x4 = GPUVertexFormat("sint16x4") - val unorm16x2 = GPUVertexFormat("unorm16x2") - val unorm16x4 = GPUVertexFormat("unorm16x4") - val snorm16x2 = GPUVertexFormat("snorm16x2") - val snorm16x4 = GPUVertexFormat("snorm16x4") - val float16x2 = GPUVertexFormat("float16x2") - val float16x4 = GPUVertexFormat("float16x4") - val float32 = GPUVertexFormat("float32") - val float32x2 = GPUVertexFormat("float32x2") - val float32x3 = GPUVertexFormat("float32x3") - val float32x4 = GPUVertexFormat("float32x4") - val uint32 = GPUVertexFormat("uint32") - val uint32x2 = GPUVertexFormat("uint32x2") - val uint32x3 = GPUVertexFormat("uint32x3") - val uint32x4 = GPUVertexFormat("uint32x4") - val sint32 = GPUVertexFormat("sint32") - val sint32x2 = GPUVertexFormat("sint32x2") - val sint32x3 = GPUVertexFormat("sint32x3") - val sint32x4 = GPUVertexFormat("sint32x4") - } -} - -value class GPUVertexStepMode private constructor(val enumValue: String) { - override fun toString() = enumValue - companion object { - val vertex = GPUVertexStepMode("vertex") - val instance = GPUVertexStepMode("instance") - } -} diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt index 5f9dde57b..9f204bdcb 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt +++ b/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt @@ -16,10 +16,6 @@ import kotlin.math.ceil import kotlin.math.pow import kotlin.math.roundToInt -/** - * @author fabmax - */ - class FontMapGenerator(val maxWidth: Int, val maxHeight: Int) { private val canvas = document.createElement("canvas") as HTMLCanvasElement @@ -191,6 +187,5 @@ class FontMapGenerator(val maxWidth: Int, val maxHeight: Int) { external class FontFace(family: String, source: String) { val family: String - fun load(): Promise } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/Time.js.kt b/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/Time.js.kt deleted file mode 100644 index 9b1cbc3d3..000000000 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/Time.js.kt +++ /dev/null @@ -1,7 +0,0 @@ -package de.fabmax.kool.util - -internal actual fun SystemClock(): SystemClock = SystemClockImpl - -private object SystemClockImpl : SystemClock { - override fun now(): Double = js("performance.now()") as Double / 1e3 -} \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/Assets.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/Assets.wasmJs.kt new file mode 100644 index 000000000..c56423129 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/Assets.wasmJs.kt @@ -0,0 +1,153 @@ +package de.fabmax.kool + +import de.fabmax.kool.math.Vec2i +import de.fabmax.kool.modules.filesystem.FileSystemAssetLoader +import de.fabmax.kool.modules.filesystem.FileSystemAssetLoaderWasm +import de.fabmax.kool.modules.filesystem.FileSystemDirectory +import de.fabmax.kool.pipeline.BufferedImageData2d +import de.fabmax.kool.pipeline.ImageData +import de.fabmax.kool.pipeline.TexFormat +import de.fabmax.kool.platform.FontMapGenerator +import de.fabmax.kool.platform.ImageTextureData +import de.fabmax.kool.util.* +import kotlinx.browser.document +import kotlinx.browser.window +import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.await +import org.khronos.webgl.ArrayBuffer +import org.khronos.webgl.Uint8Array +import org.w3c.dom.HTMLInputElement +import org.w3c.dom.Image +import org.w3c.dom.ImageBitmap +import org.w3c.dom.ImageBitmapOptions +import org.w3c.fetch.Response +import org.w3c.files.Blob +import org.w3c.files.BlobPropertyBag +import org.w3c.files.FileList +import org.w3c.files.get + +internal actual fun PlatformAssets(): PlatformAssets = PlatformAssetsImpl + +actual fun fileSystemAssetLoader(baseDir: FileSystemDirectory): FileSystemAssetLoader = FileSystemAssetLoaderWasm(baseDir) + +object PlatformAssetsImpl : PlatformAssets { + + private const val MAX_GENERATED_TEX_WIDTH = 2048 + private const val MAX_GENERATED_TEX_HEIGHT = 2048 + + private val fontGenerator = FontMapGenerator(MAX_GENERATED_TEX_WIDTH, MAX_GENERATED_TEX_HEIGHT) + + override suspend fun waitForFonts() { + if (fontGenerator.loadingFonts.isNotEmpty()) { + fontGenerator.loadingFonts.forEach { it.await() } + fontGenerator.loadingFonts.clear() + } + } + + override fun createFontMapData(font: AtlasFont, fontScale: Float, outMetrics: MutableMap): BufferedImageData2d { + return fontGenerator.createFontMapData(font, fontScale, outMetrics) + } + + override suspend fun loadFileByUser(filterList: List, multiSelect: Boolean): List { + document.body?.let { body -> + val accept = filterList.joinToString { item -> + item.fileExtensions.joinToString(", ") { ".${it.trim().removePrefix(".")}" } + } + + val deferred = CompletableDeferred() + val chooser = document.createElement("input") as HTMLInputElement + chooser.setAttribute("type", "file") + chooser.setAttribute("accept", accept) + if (multiSelect) { + chooser.setAttribute("multiple", "true") + } + chooser.addEventListener("change", callback = { deferred.complete(chooser.files) }) + chooser.style.display = "none" + body.appendChild(chooser) + chooser.click() + + val selectedFiles = mutableListOf() + deferred.await()?.let { fileList -> + for (i in 0 until fileList.length) { + fileList[i]?.let { selectedFiles += LoadableFileImpl(it) } + } + } + + body.removeChild(chooser) + return selectedFiles + } + return emptyList() + } + + override suspend fun saveFileByUser( + data: Uint8Buffer, + defaultFileName: String?, + filterList: List, + mimeType: MimeType + ): String? { + logE { "saveFileByUser() not implemented for WASM" } + return null + } + + override suspend fun loadImageFromBuffer( + texData: Uint8Buffer, + mimeType: MimeType, + format: TexFormat, + resolveSize: Vec2i? + ): ImageTextureData { + val imgBitmap = if (mimeType == MimeType.IMAGE_SVG) { + val svgData = texData.toArray().decodeToString() + val dataUrl = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgData) + loadSvgImageFromUrl(dataUrl, resolveSize).getOrThrow() + } else { + val array = (texData as Uint8BufferImpl).buffer + val parts = JsArray() + parts[0] = array + val imgBlob = Blob(parts, BlobPropertyBag(mimeType.value)) + window.createImageBitmap(imgBlob, ImageBitmapOptions(resolveSize)).await() + } + return ImageTextureData(imgBitmap, ImageData.idForImageData("ImageTextureData", texData)) + } + + suspend fun loadSvgImageFromUrl( + url: String, + resolveSize: Vec2i? + ): Result { + val deferredBitmap = CompletableDeferred() + val img = resolveSize?.let { Image(it.x, it.y) } ?: Image() + img.onload = { + window.createImageBitmap(img, ImageBitmapOptions(resolveSize)).then { bmp -> + deferredBitmap.complete(bmp) + bmp + } + } + img.onerror = { r, _, _, _, _ -> + deferredBitmap.completeExceptionally(IllegalStateException("Failed decoding SVG image from buffer")) + r + } + img.crossOrigin = "" + img.src = url + return try { + Result.success(deferredBitmap.await()) + } catch (t: Throwable) { + Result.failure(t) + } + } +} + +fun ImageBitmapOptions(size: Vec2i?) = ImageBitmapOptions(size?.x, size?.y) +private fun ImageBitmapOptions(width: Int?, height: Int?): ImageBitmapOptions = + js("""({ + premultiplyAlpha: 'none', + resizeWidth: (width != null ? width : undefined), + resizeHeight: (height != null ? height : undefined), + resizeQuality: (width != null ? 'high' : undefined) + })""") + +external fun encodeURIComponent(string: String): String + +actual suspend fun decodeDataUri(dataUri: String): Uint8Buffer { + val response: Response = window.fetch(dataUri).await() + val arrayBuffer: ArrayBuffer = response.arrayBuffer().await() + return Uint8BufferImpl(Uint8Array(arrayBuffer)) +} diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/KoolConfigWasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/KoolConfigWasmJs.kt new file mode 100644 index 000000000..f023069c0 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/KoolConfigWasmJs.kt @@ -0,0 +1,48 @@ +package de.fabmax.kool + +import de.fabmax.kool.pipeline.backend.BackendProvider +import de.fabmax.kool.pipeline.backend.gl.RenderBackendGl +import de.fabmax.kool.util.MsdfFontInfo +import de.fabmax.kool.util.MsdfMeta +import kotlinx.serialization.json.Json + +data class KoolConfigWasm( + /** + * Default asset loader used by [Assets] to load textures, models, etc. + */ + override val defaultAssetLoader: AssetLoader = NativeAssetLoader("./assets"), + + /** + * Default font used by UI elements. + */ + override val defaultFont: MsdfFontInfo = DEFAULT_MSDF_FONT_INFO, + + override val numSamples: Int = 4, + + val canvasName: String = "glCanvas", + val renderBackend: BackendProvider = RenderBackendGl, + val useWebGlFallback: Boolean = true, + val isGlobalKeyEventGrabbing: Boolean = true, + val isJsCanvasToWindowFitting: Boolean = true, + val powerPreference: PowerPreference = PowerPreference.HighPerformance, + val deviceScaleLimit: Double = 3.0, + val forceFloatDepthBuffer: Boolean = true, + + val customTtfFonts: Map = emptyMap(), +) : KoolConfig { + companion object { + private val DEFAULT_META_JSON = """ + {"atlas":{"type":"mtsdf","distanceRange":8.0,"size":36.0,"width":1024,"height":721,"yOrigin":"bottom"},"name":"Fira Sans","metrics":{"emSize":1.0,"lineHeight":1.2,"ascender":0.93500006,"descender":-0.26500002,"underlineY":0.0,"underlineThickness":0.0},"compactGlyphs":[{"cd":32,"adv":0.26500002,"pB":[0,0,0,0],"aB":[0,0,0,0]},{"cd":33,"adv":0.24100001,"pB":[-601,-1231,3011,8001],"aB":[75,248,88,281]},{"cd":34,"adv":0.39900002,"pB":[-511,3159,4501,8001],"aB":[448,12,466,29]},{"cd":35,"adv":0.518,"pB":[-961,-1111,6141,7801],"aB":[721,218,747,250]},{"cd":36,"adv":0.531,"pB":[-861,-2661,6021,9351],"aB":[639,677,664,720]},{"cd":37,"adv":0.82600003,"pB":[-661,-1421,8921,8221],"aB":[918,319,953,354]},{"cd":38,"adv":0.72900003,"pB":[-301,-1231,8001,8121],"aB":[311,286,341,320]},{"cd":39,"adv":0.21900001,"pB":[-511,3159,2701,8001],"aB":[1012,40,1023,57]},{"cd":40,"adv":0.324,"pB":[-711,-2561,3951,9561],"aB":[207,676,224,720]},{"cd":41,"adv":0.324,"pB":[-711,-2561,3951,9561],"aB":[225,676,242,720]},{"cd":42,"adv":0.439,"pB":[-911,2479,5301,8501],"aB":[722,9,745,31]},{"cd":43,"adv":0.499,"pB":[-491,329,5481,6301],"aB":[663,9,684,30]},{"cd":44,"adv":0.24000001,"pB":[-731,-2771,3001,2381],"aB":[557,12,570,30]},{"cd":45,"adv":0.40300003,"pB":[-511,1629,4541,4631],"aB":[46,13,64,24]},{"cd":46,"adv":0.24000001,"pB":[-611,-1231,3001,2381],"aB":[213,12,226,25]},{"cd":47,"adv":0.52000004,"pB":[-61,-2151,5261,9181],"aB":[103,633,122,674]},{"cd":48,"adv":0.558,"pB":[-561,-1231,6141,7901],"aB":[49,248,74,281]},{"cd":49,"adv":0.43300003,"pB":[-761,-1111,4341,7801],"aB":[748,217,766,249]},{"cd":50,"adv":0.49500003,"pB":[-861,-1111,5561,7901],"aB":[767,216,791,248]},{"cd":51,"adv":0.499,"pB":[-961,-1231,5551,7901],"aB":[25,248,48,281]},{"cd":52,"adv":0.532,"pB":[-711,-1111,6131,7901],"aB":[792,216,817,248]},{"cd":53,"adv":0.50100005,"pB":[-851,-1231,5671,7801],"aB":[0,248,24,281]},{"cd":54,"adv":0.53300005,"pB":[-561,-1231,6041,7901],"aB":[0,214,24,247]},{"cd":55,"adv":0.44400004,"pB":[-861,-1211,5251,7801],"aB":[25,214,47,247]},{"cd":56,"adv":0.551,"pB":[-661,-1231,6171,7901],"aB":[48,214,73,247]},{"cd":57,"adv":0.52500004,"pB":[-661,-1331,5861,7901],"aB":[74,213,98,246]},{"cd":58,"adv":0.24000001,"pB":[-611,-1231,3001,6061],"aB":[1008,60,1021,86]},{"cd":59,"adv":0.24000001,"pB":[-731,-2771,3001,6061],"aB":[383,86,396,117]},{"cd":60,"adv":0.5,"pB":[-611,39,5611,6621],"aB":[864,7,887,30]},{"cd":61,"adv":0.5,"pB":[-491,849,5491,5771],"aB":[426,12,447,29]},{"cd":62,"adv":0.5,"pB":[-611,39,5611,6621],"aB":[840,7,863,30]},{"cd":63,"adv":0.45900002,"pB":[-811,-1231,5401,8121],"aB":[342,286,364,320]},{"cd":64,"adv":1.0200001,"pB":[-411,-3241,10611,8121],"aB":[62,633,102,674]},{"cd":65,"adv":0.573,"pB":[-1051,-1111,6781,8001],"aB":[818,216,846,248]},{"cd":66,"adv":0.60800004,"pB":[-111,-1111,6741,8001],"aB":[847,216,872,248]},{"cd":67,"adv":0.56,"pB":[-561,-1231,6511,8121],"aB":[365,286,391,320]},{"cd":68,"adv":0.64400005,"pB":[-111,-1111,7001,8001],"aB":[873,216,899,248]},{"cd":69,"adv":0.535,"pB":[-111,-1111,5921,8001],"aB":[900,216,922,248]},{"cd":70,"adv":0.49100003,"pB":[-111,-1111,5771,8001],"aB":[923,215,944,247]},{"cd":71,"adv":0.63100004,"pB":[-561,-1231,6801,8121],"aB":[392,286,419,320]},{"cd":72,"adv":0.68,"pB":[-111,-1111,6911,8001],"aB":[945,215,970,247]},{"cd":73,"adv":0.29500002,"pB":[-111,-1111,3061,8001],"aB":[971,215,983,247]},{"cd":74,"adv":0.305,"pB":[-1061,-2481,3211,8001],"aB":[1003,471,1018,508]},{"cd":75,"adv":0.58900005,"pB":[-111,-1111,7001,8001],"aB":[984,215,1010,247]},{"cd":76,"adv":0.49800003,"pB":[-111,-1111,5891,8001],"aB":[997,182,1019,214]},{"cd":77,"adv":0.77800006,"pB":[-491,-1111,8271,8001],"aB":[965,182,996,214]},{"cd":78,"adv":0.683,"pB":[-111,-1111,6941,8001],"aB":[939,182,964,214]},{"cd":79,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[420,286,449,320]},{"cd":80,"adv":0.58100003,"pB":[-111,-1111,6601,8001],"aB":[914,182,938,214]},{"cd":81,"adv":0.69100004,"pB":[-561,-2141,7771,8121],"aB":[271,432,301,469]},{"cd":82,"adv":0.605,"pB":[-111,-1111,6911,8001],"aB":[888,183,913,215]},{"cd":83,"adv":0.545,"pB":[-861,-1231,6161,8121],"aB":[450,286,476,320]},{"cd":84,"adv":0.517,"pB":[-961,-1111,6181,8001],"aB":[861,183,887,215]},{"cd":85,"adv":0.66200006,"pB":[-211,-1231,6831,8001],"aB":[99,213,124,246]},{"cd":86,"adv":0.55600005,"pB":[-1051,-1111,6611,8001],"aB":[833,183,860,215]},{"cd":87,"adv":0.82600003,"pB":[-861,-1111,9121,8001],"aB":[796,183,832,215]},{"cd":88,"adv":0.54,"pB":[-1061,-1111,6461,8001],"aB":[768,183,795,215]},{"cd":89,"adv":0.55,"pB":[-1061,-1111,6561,8001],"aB":[740,183,767,215]},{"cd":90,"adv":0.522,"pB":[-811,-1111,5881,8001],"aB":[715,184,739,216]},{"cd":91,"adv":0.32200003,"pB":[-461,-2271,3831,9271],"aB":[862,634,877,676]},{"cd":92,"adv":0.52000004,"pB":[-61,-2151,5261,9181],"aB":[42,632,61,673]},{"cd":93,"adv":0.32200003,"pB":[-611,-2271,3681,9271],"aB":[845,634,861,676]},{"cd":94,"adv":0.54,"pB":[-711,4159,6111,9511],"aB":[616,10,640,30]},{"cd":95,"adv":0.52000004,"pB":[-941,-2531,6141,481],"aB":[19,13,45,24]},{"cd":96,"adv":0.3,"pB":[-811,5269,3811,9121],"aB":[244,11,260,25]},{"cd":97,"adv":0.544,"pB":[-661,-1231,6051,6501],"aB":[659,89,683,117]},{"cd":98,"adv":0.59400004,"pB":[-161,-1231,6431,8611],"aB":[893,319,917,354]},{"cd":99,"adv":0.47800002,"pB":[-541,-1231,5591,6501],"aB":[684,89,706,117]},{"cd":100,"adv":0.59800005,"pB":[-491,-1231,6141,8611],"aB":[868,319,892,354]},{"cd":101,"adv":0.545,"pB":[-541,-1231,6041,6501],"aB":[707,88,730,116]},{"cd":102,"adv":0.335,"pB":[-1011,-1111,5061,8611],"aB":[477,286,499,320]},{"cd":103,"adv":0.52000004,"pB":[-861,-3241,6311,6971],"aB":[302,432,328,469]},{"cd":104,"adv":0.586,"pB":[-161,-1111,6071,8591],"aB":[500,286,522,320]},{"cd":105,"adv":0.282,"pB":[-351,-1111,3161,8911],"aB":[203,393,216,429]},{"cd":106,"adv":0.28,"pB":[-1201,-3231,3151,8911],"aB":[243,676,259,720]},{"cd":107,"adv":0.512,"pB":[-161,-1111,6231,8611],"aB":[523,286,546,320]},{"cd":108,"adv":0.293,"pB":[-211,-1231,3841,8611],"aB":[1006,357,1020,392]},{"cd":109,"adv":0.85700005,"pB":[-161,-1111,8781,6501],"aB":[344,54,376,81]},{"cd":110,"adv":0.586,"pB":[-161,-1111,6071,6501],"aB":[321,54,343,81]},{"cd":111,"adv":0.58400005,"pB":[-541,-1231,6381,6501],"aB":[731,88,755,116]},{"cd":112,"adv":0.59400004,"pB":[-161,-3241,6431,6501],"aB":[843,319,867,354]},{"cd":113,"adv":0.59800005,"pB":[-491,-3241,6141,6501],"aB":[818,319,842,354]},{"cd":114,"adv":0.386,"pB":[-161,-1111,4871,6501],"aB":[302,54,320,81]},{"cd":115,"adv":0.467,"pB":[-861,-1231,5431,6501],"aB":[756,88,779,116]},{"cd":116,"adv":0.36100003,"pB":[-1021,-1231,4721,7681],"aB":[694,184,714,216]},{"cd":117,"adv":0.582,"pB":[-211,-1231,5981,6381],"aB":[279,54,301,81]},{"cd":118,"adv":0.492,"pB":[-1011,-1111,5931,6381],"aB":[114,26,139,52]},{"cd":119,"adv":0.717,"pB":[-911,-1111,8081,6381],"aB":[140,26,173,52]},{"cd":120,"adv":0.485,"pB":[-1061,-1111,5911,6381],"aB":[174,26,199,52]},{"cd":121,"adv":0.492,"pB":[-1011,-3241,5931,6381],"aB":[547,286,572,320]},{"cd":122,"adv":0.437,"pB":[-861,-1111,5181,6381],"aB":[200,26,222,52]},{"cd":123,"adv":0.32200003,"pB":[-861,-2471,3881,9471],"aB":[665,677,682,720]},{"cd":124,"adv":0.40300003,"pB":[489,-2131,3541,9181],"aB":[1012,679,1023,720]},{"cd":125,"adv":0.32200003,"pB":[-661,-2471,4081,9471],"aB":[683,677,700,720]},{"cd":126,"adv":0.48800004,"pB":[-761,1389,5641,4951],"aB":[85,12,108,24]},{"cd":160,"adv":0.26500002,"pB":[0,0,0,0],"aB":[0,0,0,0]},{"cd":161,"adv":0.24100001,"pB":[-601,-3131,3011,6061],"aB":[1009,249,1022,282]},{"cd":162,"adv":0.47800002,"pB":[-541,-2651,5591,7951],"aB":[737,471,759,509]},{"cd":163,"adv":0.52000004,"pB":[-711,-1111,6011,7901],"aB":[669,184,693,216]},{"cd":164,"adv":0.56,"pB":[-821,-231,6421,7061],"aB":[223,26,249,52]},{"cd":165,"adv":0.536,"pB":[-1061,-1111,6421,7801],"aB":[641,184,668,216]},{"cd":166,"adv":0.40300003,"pB":[489,-2131,3541,9181],"aB":[30,632,41,673]},{"cd":167,"adv":0.53300005,"pB":[-411,-1821,5741,7881],"aB":[795,319,817,354]},{"cd":168,"adv":0.38500002,"pB":[-811,5429,4661,8791],"aB":[65,12,84,24]},{"cd":169,"adv":0.81000006,"pB":[-191,99,8291,8591],"aB":[458,87,488,117]},{"cd":170,"adv":0.5,"pB":[-461,-1111,5581,8001],"aB":[618,184,640,216]},{"cd":171,"adv":0.57500005,"pB":[-561,-721,6311,6461],"aB":[250,27,275,53]},{"cd":172,"adv":0.5,"pB":[-491,299,5491,4721],"aB":[294,11,315,26]},{"cd":173,"adv":0.40300003,"pB":[-511,1629,4541,4631],"aB":[0,13,18,24]},{"cd":174,"adv":0.64100003,"pB":[-441,1269,6851,8611],"aB":[276,27,302,53]},{"cd":175,"adv":0.333,"pB":[-811,5559,4141,8471],"aB":[1004,20,1021,30]},{"cd":176,"adv":0.523,"pB":[-561,2699,4941,8121],"aB":[595,10,615,30]},{"cd":177,"adv":0.5,"pB":[-491,-1111,5491,6531],"aB":[257,54,278,81]},{"cd":178,"adv":0.4,"pB":[-561,2109,4551,8571],"aB":[820,8,839,31]},{"cd":179,"adv":0.4,"pB":[-591,2019,4591,8571],"aB":[800,8,819,31]},{"cd":180,"adv":0.3,"pB":[-811,5269,3811,9121],"aB":[227,11,243,25]},{"cd":181,"adv":0.588,"pB":[-161,-3241,6241,6381],"aB":[573,286,596,320]},{"cd":182,"adv":0.734,"pB":[-211,-3261,7051,8001],"aB":[820,551,846,591]},{"cd":183,"adv":0.24000001,"pB":[-611,1299,3001,4911],"aB":[199,12,212,25]},{"cd":184,"adv":0.275,"pB":[-811,-3521,3561,1271],"aB":[410,11,425,28]},{"cd":185,"adv":0.4,"pB":[-461,2109,3851,8501],"aB":[784,8,799,31]},{"cd":186,"adv":0.5,"pB":[-551,-1111,5551,8001],"aB":[596,184,617,216]},{"cd":187,"adv":0.56600004,"pB":[-561,-721,6221,6461],"aB":[303,27,328,53]},{"cd":188,"adv":0.93200004,"pB":[-461,-1891,10001,8611],"aB":[329,432,367,469]},{"cd":189,"adv":0.93200004,"pB":[-461,-1891,9871,8611],"aB":[368,432,405,469]},{"cd":190,"adv":0.93200004,"pB":[-591,-1891,10001,8611],"aB":[406,432,445,469]},{"cd":191,"adv":0.45900002,"pB":[-811,-3261,5401,6061],"aB":[125,213,147,246]},{"cd":192,"adv":0.573,"pB":[-1051,-1111,6781,10221],"aB":[791,551,819,591]},{"cd":193,"adv":0.573,"pB":[-1051,-1111,6781,10221],"aB":[762,551,790,591]},{"cd":194,"adv":0.573,"pB":[-1051,-1111,6781,10251],"aB":[733,551,761,591]},{"cd":195,"adv":0.573,"pB":[-1051,-1111,6781,10111],"aB":[704,551,732,591]},{"cd":196,"adv":0.573,"pB":[-1051,-1111,6781,10051],"aB":[675,551,703,591]},{"cd":197,"adv":0.573,"pB":[-1051,-1111,6781,10731],"aB":[816,634,844,676]},{"cd":198,"adv":0.81600004,"pB":[-1231,-1111,8731,8001],"aB":[559,184,595,216]},{"cd":199,"adv":0.56,"pB":[-561,-3521,6511,8121],"aB":[789,634,815,676]},{"cd":200,"adv":0.535,"pB":[-111,-1111,5921,10221],"aB":[652,550,674,590]},{"cd":201,"adv":0.535,"pB":[-111,-1111,5921,10221],"aB":[629,550,651,590]},{"cd":202,"adv":0.535,"pB":[-111,-1111,5921,10251],"aB":[606,550,628,590]},{"cd":203,"adv":0.535,"pB":[-111,-1111,5921,10051],"aB":[583,550,605,590]},{"cd":204,"adv":0.29500002,"pB":[-941,-1111,3681,10221],"aB":[565,550,582,590]},{"cd":205,"adv":0.29500002,"pB":[-841,-1111,3781,10221],"aB":[547,550,564,590]},{"cd":206,"adv":0.29500002,"pB":[-1311,-1111,4231,10251],"aB":[526,550,546,590]},{"cd":207,"adv":0.29500002,"pB":[-1271,-1111,4201,10051],"aB":[505,550,525,590]},{"cd":208,"adv":0.656,"pB":[-911,-1111,7121,8001],"aB":[529,184,558,216]},{"cd":209,"adv":0.683,"pB":[-111,-1111,6941,10111],"aB":[479,550,504,590]},{"cd":210,"adv":0.69200003,"pB":[-561,-1231,7481,10221],"aB":[0,630,29,671]},{"cd":211,"adv":0.69200003,"pB":[-561,-1231,7481,10221],"aB":[0,588,29,629]},{"cd":212,"adv":0.69200003,"pB":[-561,-1231,7481,10251],"aB":[30,590,59,631]},{"cd":213,"adv":0.69200003,"pB":[-561,-1231,7481,10111],"aB":[60,590,89,631]},{"cd":214,"adv":0.69200003,"pB":[-561,-1231,7481,10051],"aB":[90,591,119,632]},{"cd":215,"adv":0.5,"pB":[-391,179,5391,5971],"aB":[641,9,662,30]},{"cd":216,"adv":0.69200003,"pB":[-561,-2381,7481,9301],"aB":[759,634,788,676]},{"cd":217,"adv":0.66200006,"pB":[-211,-1231,6831,10221],"aB":[120,590,145,631]},{"cd":218,"adv":0.66200006,"pB":[-211,-1231,6831,10221],"aB":[146,590,171,631]},{"cd":219,"adv":0.66200006,"pB":[-211,-1231,6831,10251],"aB":[172,590,197,631]},{"cd":220,"adv":0.66200006,"pB":[-211,-1231,6831,10051],"aB":[198,590,223,631]},{"cd":221,"adv":0.55,"pB":[-1061,-1111,6561,10221],"aB":[451,550,478,590]},{"cd":222,"adv":0.58100003,"pB":[-111,-1111,6601,8001],"aB":[504,184,528,216]},{"cd":223,"adv":0.59300005,"pB":[-161,-1231,6641,8611],"aB":[770,320,794,355]},{"cd":224,"adv":0.544,"pB":[-661,-1231,6051,9121],"aB":[446,432,470,469]},{"cd":225,"adv":0.544,"pB":[-661,-1231,6051,9121],"aB":[471,432,495,469]},{"cd":226,"adv":0.544,"pB":[-661,-1231,6051,9031],"aB":[496,432,520,469]},{"cd":227,"adv":0.544,"pB":[-661,-1231,6051,8851],"aB":[178,393,202,429]},{"cd":228,"adv":0.544,"pB":[-661,-1231,6051,8791],"aB":[153,393,177,429]},{"cd":229,"adv":0.544,"pB":[-661,-1231,6051,9471],"aB":[925,509,949,548]},{"cd":230,"adv":0.84900004,"pB":[-661,-1231,9081,6501],"aB":[780,88,815,116]},{"cd":231,"adv":0.47800002,"pB":[-541,-3521,5591,6501],"aB":[130,393,152,429]},{"cd":232,"adv":0.545,"pB":[-541,-1231,6041,9121],"aB":[521,432,544,469]},{"cd":233,"adv":0.545,"pB":[-541,-1231,6041,9121],"aB":[545,432,568,469]},{"cd":234,"adv":0.545,"pB":[-541,-1231,6041,9031],"aB":[569,432,592,469]},{"cd":235,"adv":0.545,"pB":[-541,-1231,6041,8791],"aB":[106,393,129,429]},{"cd":236,"adv":0.282,"pB":[-801,-1111,3821,9121],"aB":[89,393,105,429]},{"cd":237,"adv":0.282,"pB":[-901,-1111,3721,9121],"aB":[71,391,88,427]},{"cd":238,"adv":0.282,"pB":[-1361,-1111,4181,9031],"aB":[50,391,70,427]},{"cd":239,"adv":0.282,"pB":[-1331,-1111,4141,8791],"aB":[750,321,769,356]},{"cd":240,"adv":0.57000005,"pB":[-541,-1231,6191,8871],"aB":[25,391,49,427]},{"cd":241,"adv":0.586,"pB":[-161,-1111,6071,8851],"aB":[727,321,749,356]},{"cd":242,"adv":0.58400005,"pB":[-541,-1231,6381,9121],"aB":[593,432,617,469]},{"cd":243,"adv":0.58400005,"pB":[-541,-1231,6381,9121],"aB":[618,432,642,469]},{"cd":244,"adv":0.58400005,"pB":[-541,-1231,6381,9031],"aB":[643,432,667,469]},{"cd":245,"adv":0.58400005,"pB":[-541,-1231,6381,8851],"aB":[0,391,24,427]},{"cd":246,"adv":0.58400005,"pB":[-541,-1231,6381,8791],"aB":[0,354,24,390]},{"cd":247,"adv":0.5,"pB":[-491,-761,5491,7421],"aB":[637,88,658,117]},{"cd":248,"adv":0.58400005,"pB":[-541,-2411,6381,7671],"aB":[25,354,49,390]},{"cd":249,"adv":0.582,"pB":[-211,-1231,5981,9121],"aB":[668,432,690,469]},{"cd":250,"adv":0.582,"pB":[-211,-1231,5981,9121],"aB":[691,433,713,470]},{"cd":251,"adv":0.582,"pB":[-211,-1231,5981,9031],"aB":[714,433,736,470]},{"cd":252,"adv":0.582,"pB":[-211,-1231,5981,8791],"aB":[50,354,72,390]},{"cd":253,"adv":0.492,"pB":[-1011,-3241,5931,9121],"aB":[260,676,285,720]},{"cd":254,"adv":0.59400004,"pB":[-161,-3241,6431,8611],"aB":[734,634,758,676]},{"cd":255,"adv":0.492,"pB":[-1011,-3241,5931,8791],"aB":[701,677,726,720]},{"cd":256,"adv":0.573,"pB":[-1051,-1111,6781,9731],"aB":[950,509,978,548]},{"cd":257,"adv":0.544,"pB":[-661,-1231,6051,8471],"aB":[702,321,726,356]},{"cd":258,"adv":0.573,"pB":[-1051,-1111,6781,10051],"aB":[422,550,450,590]},{"cd":259,"adv":0.544,"pB":[-661,-1231,6051,9001],"aB":[737,432,761,469]},{"cd":260,"adv":0.573,"pB":[-1051,-3431,6781,8001],"aB":[224,591,252,632]},{"cd":261,"adv":0.544,"pB":[-661,-3551,6051,6501],"aB":[73,354,97,390]},{"cd":262,"adv":0.56,"pB":[-561,-1231,6511,10221],"aB":[253,591,279,632]},{"cd":263,"adv":0.47800002,"pB":[-541,-1231,5591,9121],"aB":[762,432,784,469]},{"cd":264,"adv":0.56,"pB":[-561,-1231,6511,10251],"aB":[280,591,306,632]},{"cd":265,"adv":0.47800002,"pB":[-541,-1231,5661,9031],"aB":[785,432,807,469]},{"cd":266,"adv":0.56,"pB":[-561,-1231,6511,10171],"aB":[307,591,333,632]},{"cd":267,"adv":0.47800002,"pB":[-541,-1231,5591,8911],"aB":[808,431,830,468]},{"cd":268,"adv":0.56,"pB":[-561,-1231,6511,10201],"aB":[334,591,360,632]},{"cd":269,"adv":0.47800002,"pB":[-541,-1231,5661,8961],"aB":[831,430,853,467]},{"cd":270,"adv":0.64400005,"pB":[-111,-1111,7001,10201],"aB":[395,550,421,590]},{"cd":272,"adv":0.656,"pB":[-911,-1111,7121,8001],"aB":[474,184,503,216]},{"cd":273,"adv":0.60400003,"pB":[-491,-1231,6931,8611],"aB":[675,321,701,356]},{"cd":274,"adv":0.535,"pB":[-111,-1111,5921,9731],"aB":[979,509,1001,548]},{"cd":275,"adv":0.545,"pB":[-541,-1231,6041,8471],"aB":[651,321,674,356]},{"cd":276,"adv":0.535,"pB":[-111,-1111,5921,10051],"aB":[372,550,394,590]},{"cd":277,"adv":0.545,"pB":[-541,-1231,6041,9001],"aB":[854,430,877,467]},{"cd":278,"adv":0.535,"pB":[-111,-1111,5921,10171],"aB":[349,550,371,590]},{"cd":279,"adv":0.545,"pB":[-541,-1231,6041,8911],"aB":[878,430,901,467]},{"cd":280,"adv":0.535,"pB":[-111,-3431,5921,8001],"aB":[361,591,383,632]},{"cd":281,"adv":0.545,"pB":[-541,-3371,6041,6501],"aB":[98,356,121,392]},{"cd":282,"adv":0.535,"pB":[-111,-1111,5921,10201],"aB":[326,550,348,590]},{"cd":283,"adv":0.545,"pB":[-541,-1231,6041,8961],"aB":[902,430,925,467]},{"cd":284,"adv":0.63100004,"pB":[-561,-1231,6801,10251],"aB":[384,591,411,632]},{"cd":285,"adv":0.52000004,"pB":[-861,-3241,6311,9031],"aB":[286,676,312,720]},{"cd":286,"adv":0.63100004,"pB":[-561,-1231,6801,10051],"aB":[412,591,439,632]},{"cd":287,"adv":0.52000004,"pB":[-861,-3241,6311,9001],"aB":[313,676,339,720]},{"cd":288,"adv":0.63100004,"pB":[-561,-1231,6801,10171],"aB":[440,591,467,632]},{"cd":289,"adv":0.52000004,"pB":[-861,-3241,6311,8911],"aB":[340,676,366,720]},{"cd":290,"adv":0.63100004,"pB":[-561,-4071,6801,8121],"aB":[367,676,394,720]},{"cd":291,"adv":0.52000004,"pB":[-861,-3241,6311,9131],"aB":[395,676,421,720]},{"cd":292,"adv":0.68,"pB":[-111,-1111,6911,10251],"aB":[300,550,325,590]},{"cd":293,"adv":0.586,"pB":[-161,-1111,6071,10751],"aB":[711,634,733,676]},{"cd":294,"adv":0.688,"pB":[-761,-1111,7641,8001],"aB":[443,184,473,216]},{"cd":295,"adv":0.592,"pB":[-891,-1111,6131,8591],"aB":[597,286,623,320]},{"cd":296,"adv":0.29500002,"pB":[-1311,-1111,4251,10111],"aB":[279,550,299,590]},{"cd":297,"adv":0.282,"pB":[-1371,-1111,4191,8851],"aB":[630,321,650,356]},{"cd":298,"adv":0.29500002,"pB":[-1011,-1111,3941,9731],"aB":[1002,509,1020,548]},{"cd":299,"adv":0.282,"pB":[-1071,-1111,3881,8471],"aB":[624,286,641,320]},{"cd":300,"adv":0.29500002,"pB":[-1161,-1111,4091,10051],"aB":[259,550,278,590]},{"cd":301,"adv":0.282,"pB":[-1221,-1111,4031,9001],"aB":[122,356,141,392]},{"cd":302,"adv":0.29500002,"pB":[-1191,-3431,3061,8001],"aB":[468,591,484,632]},{"cd":303,"adv":0.282,"pB":[-1271,-3431,3161,8911],"aB":[49,675,65,720]},{"cd":304,"adv":0.29500002,"pB":[-291,-1111,3221,10171],"aB":[1009,592,1022,632]},{"cd":305,"adv":0.282,"pB":[-161,-1111,2981,6381],"aB":[329,27,340,53]},{"cd":306,"adv":0.6,"pB":[-111,-2481,6161,8001],"aB":[926,430,949,467]},{"cd":307,"adv":0.56200004,"pB":[-351,-3231,5971,8911],"aB":[422,676,445,720]},{"cd":308,"adv":0.305,"pB":[-1151,-2481,4391,10251],"aB":[66,675,86,720]},{"cd":309,"adv":0.28,"pB":[-1371,-3231,4171,9031],"aB":[446,676,466,720]},{"cd":310,"adv":0.58900005,"pB":[-111,-4071,7001,8001],"aB":[727,677,753,720]},{"cd":311,"adv":0.512,"pB":[-161,-4071,6231,8611],"aB":[87,675,110,720]},{"cd":312,"adv":0.509,"pB":[-161,-1111,6201,6381],"aB":[341,27,364,53]},{"cd":313,"adv":0.49800003,"pB":[-831,-1111,5891,10221],"aB":[234,550,258,590]},{"cd":314,"adv":0.293,"pB":[-951,-1231,3841,10721],"aB":[754,677,771,720]},{"cd":315,"adv":0.49800003,"pB":[-111,-4071,5891,8001],"aB":[772,677,794,720]},{"cd":316,"adv":0.293,"pB":[-211,-4071,3841,8611],"aB":[111,675,125,720]},{"cd":319,"adv":0.49800003,"pB":[-111,-1111,5891,8001],"aB":[420,184,442,216]},{"cd":320,"adv":0.33200002,"pB":[-211,-1231,4731,8611],"aB":[611,321,629,356]},{"cd":321,"adv":0.514,"pB":[-891,-1111,6051,8001],"aB":[394,184,419,216]},{"cd":322,"adv":0.312,"pB":[-1011,-1231,4231,8611],"aB":[591,321,610,356]},{"cd":323,"adv":0.683,"pB":[-111,-1111,6941,10221],"aB":[208,549,233,589]},{"cd":324,"adv":0.586,"pB":[-161,-1111,6071,9121],"aB":[142,356,164,392]},{"cd":325,"adv":0.683,"pB":[-111,-4071,6941,8001],"aB":[795,677,820,720]},{"cd":326,"adv":0.586,"pB":[-161,-4071,6071,6501],"aB":[714,471,736,509]},{"cd":327,"adv":0.683,"pB":[-111,-1111,6941,10201],"aB":[182,549,207,589]},{"cd":328,"adv":0.586,"pB":[-161,-1111,6071,8961],"aB":[165,356,187,392]},{"cd":329,"adv":0.69500005,"pB":[-711,-1111,7161,8641],"aB":[562,321,590,356]},{"cd":330,"adv":0.683,"pB":[-111,-3241,6941,8001],"aB":[156,549,181,589]},{"cd":331,"adv":0.586,"pB":[-161,-3241,6071,6501],"aB":[539,321,561,356]},{"cd":332,"adv":0.69200003,"pB":[-561,-1231,7481,9731],"aB":[126,549,155,589]},{"cd":333,"adv":0.58400005,"pB":[-541,-1231,6381,8471],"aB":[514,321,538,356]},{"cd":334,"adv":0.69200003,"pB":[-561,-1231,7481,10051],"aB":[485,591,514,632]},{"cd":335,"adv":0.58400005,"pB":[-541,-1231,6381,9001],"aB":[950,431,974,468]},{"cd":336,"adv":0.69200003,"pB":[-561,-1231,7481,10691],"aB":[821,677,850,720]},{"cd":337,"adv":0.58400005,"pB":[-541,-1231,6381,9431],"aB":[689,471,713,509]},{"cd":338,"adv":0.897,"pB":[-561,-1231,9541,8121],"aB":[642,286,679,320]},{"cd":339,"adv":0.91600007,"pB":[-541,-1231,9751,6501],"aB":[816,88,853,116]},{"cd":340,"adv":0.605,"pB":[-111,-1111,6911,10221],"aB":[100,549,125,589]},{"cd":341,"adv":0.386,"pB":[-161,-1111,4871,9121],"aB":[188,356,206,392]},{"cd":342,"adv":0.605,"pB":[-111,-4071,6911,8001],"aB":[851,677,876,720]},{"cd":343,"adv":0.386,"pB":[-301,-4071,4871,6501],"aB":[669,470,688,508]},{"cd":344,"adv":0.605,"pB":[-111,-1111,6911,10201],"aB":[74,549,99,589]},{"cd":345,"adv":0.386,"pB":[-391,-1111,5151,8961],"aB":[207,355,227,391]},{"cd":346,"adv":0.545,"pB":[-861,-1231,6161,10221],"aB":[515,591,541,632]},{"cd":347,"adv":0.467,"pB":[-861,-1231,5431,9121],"aB":[975,431,998,468]},{"cd":348,"adv":0.545,"pB":[-861,-1231,6161,10251],"aB":[542,591,568,632]},{"cd":349,"adv":0.467,"pB":[-861,-1231,5431,9031],"aB":[999,431,1022,468]},{"cd":350,"adv":0.545,"pB":[-861,-3521,6161,8121],"aB":[684,634,710,676]},{"cd":351,"adv":0.467,"pB":[-861,-3521,5431,6501],"aB":[228,355,251,391]},{"cd":352,"adv":0.545,"pB":[-861,-1231,6161,10201],"aB":[569,591,595,632]},{"cd":353,"adv":0.467,"pB":[-861,-1231,5431,8961],"aB":[994,393,1017,430]},{"cd":354,"adv":0.517,"pB":[-961,-3521,6181,8001],"aB":[596,591,622,632]},{"cd":355,"adv":0.36100003,"pB":[-1021,-3521,4721,7681],"aB":[53,549,73,589]},{"cd":356,"adv":0.517,"pB":[-961,-1111,6181,10201],"aB":[26,547,52,587]},{"cd":357,"adv":0.36100003,"pB":[-1021,-1231,4721,8691],"aB":[252,355,272,391]},{"cd":358,"adv":0.517,"pB":[-961,-1131,6181,7981],"aB":[148,215,174,248]},{"cd":359,"adv":0.36100003,"pB":[-1021,-1231,4721,7681],"aB":[373,184,393,216]},{"cd":360,"adv":0.66200006,"pB":[-211,-1231,6831,10111],"aB":[623,591,648,632]},{"cd":361,"adv":0.582,"pB":[-211,-1231,5981,8851],"aB":[273,355,295,391]},{"cd":362,"adv":0.66200006,"pB":[-211,-1231,6831,9731],"aB":[0,547,25,587]},{"cd":363,"adv":0.582,"pB":[-211,-1231,5981,8471],"aB":[491,321,513,356]},{"cd":364,"adv":0.66200006,"pB":[-211,-1231,6831,10051],"aB":[649,591,674,632]},{"cd":365,"adv":0.582,"pB":[-211,-1231,5981,9001],"aB":[971,393,993,430]},{"cd":366,"adv":0.66200006,"pB":[-211,-1231,6831,10731],"aB":[877,677,902,720]},{"cd":367,"adv":0.582,"pB":[-211,-1231,5981,9471],"aB":[980,469,1002,508]},{"cd":368,"adv":0.66200006,"pB":[-211,-1231,6831,10691],"aB":[903,677,928,720]},{"cd":369,"adv":0.582,"pB":[-211,-1231,6011,9431],"aB":[646,470,668,508]},{"cd":370,"adv":0.66200006,"pB":[-211,-3431,6831,8001],"aB":[675,592,700,633]},{"cd":371,"adv":0.582,"pB":[-211,-3431,5981,6381],"aB":[468,321,490,356]},{"cd":372,"adv":0.82600003,"pB":[-861,-1111,9121,10251],"aB":[0,506,36,546]},{"cd":373,"adv":0.717,"pB":[-911,-1111,8081,9031],"aB":[296,357,329,393]},{"cd":374,"adv":0.55,"pB":[-1061,-1111,6561,10251],"aB":[37,506,64,546]},{"cd":375,"adv":0.492,"pB":[-1011,-3241,5931,9031],"aB":[467,676,492,720]},{"cd":376,"adv":0.55,"pB":[-1061,-1111,6561,10051],"aB":[65,508,92,548]},{"cd":377,"adv":0.522,"pB":[-811,-1111,5881,10221],"aB":[93,508,117,548]},{"cd":378,"adv":0.437,"pB":[-861,-1111,5181,9121],"aB":[330,357,352,393]},{"cd":379,"adv":0.522,"pB":[-811,-1111,5881,10171],"aB":[118,508,142,548]},{"cd":380,"adv":0.437,"pB":[-861,-1111,5181,8911],"aB":[353,357,375,393]},{"cd":381,"adv":0.522,"pB":[-811,-1111,5881,10201],"aB":[143,508,167,548]},{"cd":382,"adv":0.437,"pB":[-861,-1111,5181,8961],"aB":[376,357,398,393]},{"cd":383,"adv":0.335,"pB":[-1011,-1111,5061,8611],"aB":[680,286,702,320]},{"cd":512,"adv":0.573,"pB":[-1051,-1111,6781,10691],"aB":[655,634,683,676]},{"cd":513,"adv":0.544,"pB":[-661,-1231,6051,9431],"aB":[621,470,645,508]},{"cd":514,"adv":0.573,"pB":[-1051,-1111,6781,10331],"aB":[701,592,729,633]},{"cd":515,"adv":0.544,"pB":[-661,-1231,6051,8711],"aB":[399,357,423,393]},{"cd":516,"adv":0.535,"pB":[-211,-1111,5921,10691],"aB":[632,633,654,675]},{"cd":517,"adv":0.545,"pB":[-541,-1231,6041,9431],"aB":[597,470,620,508]},{"cd":518,"adv":0.535,"pB":[-111,-1111,5921,10331],"aB":[730,592,752,633]},{"cd":519,"adv":0.545,"pB":[-541,-1231,6041,8711],"aB":[424,357,447,393]},{"cd":520,"adv":0.29500002,"pB":[-1641,-1111,3641,10691],"aB":[612,633,631,675]},{"cd":521,"adv":0.282,"pB":[-1631,-1111,3651,9431],"aB":[951,393,970,430]},{"cd":522,"adv":0.29500002,"pB":[-1161,-1111,4091,10331],"aB":[753,592,772,633]},{"cd":523,"adv":0.282,"pB":[-1221,-1111,4031,8711],"aB":[448,321,467,356]},{"cd":524,"adv":0.69200003,"pB":[-561,-1231,7481,10691],"aB":[929,677,958,720]},{"cd":525,"adv":0.58400005,"pB":[-541,-1231,6381,9431],"aB":[572,470,596,508]},{"cd":526,"adv":0.69200003,"pB":[-561,-1231,7481,10331],"aB":[582,633,611,675]},{"cd":527,"adv":0.58400005,"pB":[-541,-1231,6381,8711],"aB":[448,357,472,393]},{"cd":528,"adv":0.605,"pB":[-121,-1111,6911,10691],"aB":[556,633,581,675]},{"cd":529,"adv":0.386,"pB":[-661,-1111,4871,9431],"aB":[930,392,950,429]},{"cd":530,"adv":0.605,"pB":[-111,-1111,6911,10331],"aB":[773,592,798,633]},{"cd":531,"adv":0.386,"pB":[-251,-1111,5001,8711],"aB":[428,321,447,356]},{"cd":532,"adv":0.66200006,"pB":[-211,-1231,6831,10691],"aB":[959,677,984,720]},{"cd":533,"adv":0.582,"pB":[-211,-1231,5981,9431],"aB":[549,470,571,508]},{"cd":534,"adv":0.66200006,"pB":[-211,-1231,6831,10331],"aB":[530,633,555,675]},{"cd":535,"adv":0.582,"pB":[-211,-1231,5981,8711],"aB":[473,357,495,393]},{"cd":536,"adv":0.545,"pB":[-861,-4071,6161,8121],"aB":[493,676,519,720]},{"cd":537,"adv":0.467,"pB":[-861,-4071,5431,6501],"aB":[525,470,548,508]},{"cd":538,"adv":0.517,"pB":[-961,-4071,6181,8001],"aB":[985,677,1011,720]},{"cd":539,"adv":0.36100003,"pB":[-1021,-4071,4721,7681],"aB":[509,633,529,675]},{"cd":554,"adv":0.69200003,"pB":[-561,-1231,7481,10831],"aB":[984,633,1013,676]},{"cd":555,"adv":0.58400005,"pB":[-541,-1231,6381,9711],"aB":[955,469,979,508]},{"cd":556,"adv":0.69200003,"pB":[-561,-1231,7481,10911],"aB":[520,676,549,720]},{"cd":557,"adv":0.58400005,"pB":[-541,-1231,6381,9291],"aB":[500,470,524,508]},{"cd":558,"adv":0.69200003,"pB":[-561,-1231,7481,10171],"aB":[799,592,828,633]},{"cd":559,"adv":0.58400005,"pB":[-541,-1231,6381,8911],"aB":[905,392,929,429]},{"cd":560,"adv":0.69200003,"pB":[-561,-1231,7481,10841],"aB":[550,676,579,720]},{"cd":561,"adv":0.58400005,"pB":[-541,-1231,6381,9481],"aB":[930,469,954,508]},{"cd":562,"adv":0.55,"pB":[-1061,-1111,6561,9731],"aB":[902,468,929,507]},{"cd":563,"adv":0.492,"pB":[-1011,-3241,5931,8471],"aB":[483,633,508,675]},{"cd":880,"adv":0.521,"pB":[-111,-1111,6071,8001],"aB":[350,184,372,216]},{"cd":881,"adv":0.47700003,"pB":[-361,-1111,5631,6501],"aB":[234,54,256,81]},{"cd":882,"adv":0.583,"pB":[-961,-1111,6791,8001],"aB":[321,184,349,216]},{"cd":883,"adv":0.47800002,"pB":[-1161,-3241,5851,6381],"aB":[703,286,729,320]},{"cd":884,"adv":0.30400002,"pB":[-511,3159,3551,8001],"aB":[395,11,409,28]},{"cd":885,"adv":0.30400002,"pB":[-511,-2441,3551,2401],"aB":[380,9,394,26]},{"cd":886,"adv":0.683,"pB":[-111,-1111,6941,8001],"aB":[295,181,320,213]},{"cd":887,"adv":0.6,"pB":[-161,-1231,6561,6381],"aB":[209,53,233,80]},{"cd":890,"adv":0.29500002,"pB":[-811,-3011,3521,721],"aB":[183,12,198,25]},{"cd":891,"adv":0.51100004,"pB":[-811,-1231,5651,6501],"aB":[854,88,877,116]},{"cd":892,"adv":0.51100004,"pB":[-541,-1231,5921,6501],"aB":[878,87,901,115]},{"cd":893,"adv":0.51100004,"pB":[-811,-1231,5651,6501],"aB":[902,87,925,115]},{"cd":894,"adv":0.24000001,"pB":[-731,-2771,3001,6061],"aB":[397,86,410,117]},{"cd":895,"adv":0.305,"pB":[-1061,-2481,3211,8001],"aB":[889,392,904,429]},{"cd":900,"adv":0.16100001,"pB":[-811,4849,2421,9181],"aB":[333,10,344,26]},{"cd":901,"adv":0.38500002,"pB":[-811,5129,4661,10241],"aB":[537,12,556,30]},{"cd":902,"adv":0.597,"pB":[-811,-1111,7021,8081],"aB":[175,214,203,247]},{"cd":903,"adv":0.24000001,"pB":[-611,1299,3001,4911],"aB":[169,12,182,25]},{"cd":904,"adv":0.62700003,"pB":[-571,-1111,6841,8081],"aB":[204,214,231,247]},{"cd":905,"adv":0.772,"pB":[-571,-1111,7831,8081],"aB":[232,214,263,247]},{"cd":906,"adv":0.38700002,"pB":[-571,-1111,3981,8081],"aB":[264,214,281,247]},{"cd":908,"adv":0.76100004,"pB":[-671,-1231,8171,8121],"aB":[730,286,762,320]},{"cd":910,"adv":0.72700006,"pB":[-571,-1111,8331,8081],"aB":[282,214,314,247]},{"cd":911,"adv":0.763,"pB":[-671,-1111,8191,8121],"aB":[315,217,347,250]},{"cd":912,"adv":0.28300002,"pB":[-1381,-1231,4091,10241],"aB":[829,592,848,633]},{"cd":913,"adv":0.573,"pB":[-1051,-1111,6781,8001],"aB":[266,181,294,213]},{"cd":914,"adv":0.60800004,"pB":[-111,-1111,6741,8001],"aB":[240,181,265,213]},{"cd":915,"adv":0.508,"pB":[-111,-1111,6091,8001],"aB":[217,181,239,213]},{"cd":916,"adv":0.583,"pB":[-1051,-1111,6881,8001],"aB":[188,181,216,213]},{"cd":917,"adv":0.535,"pB":[-111,-1111,5921,8001],"aB":[165,181,187,213]},{"cd":918,"adv":0.522,"pB":[-811,-1111,5881,8001],"aB":[140,180,164,212]},{"cd":919,"adv":0.68,"pB":[-111,-1111,6911,8001],"aB":[114,180,139,212]},{"cd":920,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[763,285,792,319]},{"cd":921,"adv":0.29500002,"pB":[-111,-1111,3061,8001],"aB":[1011,215,1023,247]},{"cd":922,"adv":0.58900005,"pB":[-111,-1111,7001,8001],"aB":[87,180,113,212]},{"cd":923,"adv":0.573,"pB":[-1051,-1111,6781,8001],"aB":[58,180,86,212]},{"cd":924,"adv":0.77800006,"pB":[-491,-1111,8271,8001],"aB":[26,181,57,213]},{"cd":925,"adv":0.683,"pB":[-111,-1111,6941,8001],"aB":[0,181,25,213]},{"cd":926,"adv":0.51100004,"pB":[-661,-1111,5771,8001],"aB":[0,148,23,180]},{"cd":927,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[793,284,822,318]},{"cd":928,"adv":0.675,"pB":[-111,-1111,6861,8001],"aB":[24,148,49,180]},{"cd":929,"adv":0.58100003,"pB":[-111,-1111,6601,8001],"aB":[50,147,74,179]},{"cd":931,"adv":0.503,"pB":[-711,-1111,5741,8001],"aB":[75,147,98,179]},{"cd":932,"adv":0.517,"pB":[-961,-1111,6181,8001],"aB":[99,147,125,179]},{"cd":933,"adv":0.55,"pB":[-1061,-1111,6561,8001],"aB":[126,147,153,179]},{"cd":934,"adv":0.81000006,"pB":[-761,-1111,8861,8001],"aB":[154,147,188,179]},{"cd":935,"adv":0.54,"pB":[-1061,-1111,6461,8001],"aB":[189,148,216,180]},{"cd":936,"adv":0.694,"pB":[-761,-1111,7701,8001],"aB":[217,148,247,180]},{"cd":937,"adv":0.69200003,"pB":[-561,-1111,7481,8121],"aB":[348,217,377,250]},{"cd":938,"adv":0.29500002,"pB":[-1271,-1111,4201,10051],"aB":[168,508,188,548]},{"cd":939,"adv":0.55,"pB":[-1061,-1111,6561,10051],"aB":[189,508,216,548]},{"cd":940,"adv":0.59300005,"pB":[-541,-1241,6591,9181],"aB":[474,470,499,508]},{"cd":941,"adv":0.46800002,"pB":[-541,-1231,5641,9181],"aB":[451,470,473,508]},{"cd":942,"adv":0.592,"pB":[-361,-3241,6131,9181],"aB":[126,675,150,720]},{"cd":943,"adv":0.28300002,"pB":[-211,-1231,3391,9181],"aB":[1006,552,1019,590]},{"cd":944,"adv":0.57100004,"pB":[-211,-1231,6121,10241],"aB":[849,592,872,633]},{"cd":945,"adv":0.59300005,"pB":[-541,-1241,6591,6501],"aB":[926,87,951,115]},{"cd":946,"adv":0.60300004,"pB":[-161,-3251,6681,8611],"aB":[457,633,482,675]},{"cd":947,"adv":0.48200002,"pB":[-1161,-3271,5831,6491],"aB":[402,321,427,356]},{"cd":948,"adv":0.57900006,"pB":[-541,-1231,6331,8611],"aB":[377,321,401,356]},{"cd":949,"adv":0.46800002,"pB":[-541,-1231,5641,6501],"aB":[952,87,974,115]},{"cd":950,"adv":0.388,"pB":[-731,-3261,5331,8501],"aB":[434,633,456,675]},{"cd":951,"adv":0.592,"pB":[-361,-3241,6131,6501],"aB":[352,321,376,356]},{"cd":952,"adv":0.574,"pB":[-541,-1231,6281,8611],"aB":[327,321,351,356]},{"cd":953,"adv":0.28300002,"pB":[-211,-1231,3391,6381],"aB":[195,53,208,80]},{"cd":954,"adv":0.52500004,"pB":[-361,-1231,6361,6501],"aB":[975,87,999,115]},{"cd":955,"adv":0.49,"pB":[-911,-1231,6161,8631],"aB":[496,357,522,393]},{"cd":956,"adv":0.588,"pB":[-161,-3241,6241,6381],"aB":[823,284,846,318]},{"cd":957,"adv":0.48200002,"pB":[-1161,-1111,5831,6491],"aB":[169,53,194,80]},{"cd":958,"adv":0.437,"pB":[-611,-3261,5581,8611],"aB":[410,633,433,675]},{"cd":959,"adv":0.58400005,"pB":[-541,-1231,6381,6501],"aB":[983,58,1007,86]},{"cd":960,"adv":0.595,"pB":[-961,-1231,6761,6381],"aB":[140,53,168,80]},{"cd":961,"adv":0.58400005,"pB":[-261,-3241,6331,6501],"aB":[303,321,326,356]},{"cd":962,"adv":0.46800002,"pB":[-541,-3261,5591,6501],"aB":[280,319,302,354]},{"cd":963,"adv":0.587,"pB":[-541,-1231,6711,6441],"aB":[956,58,982,86]},{"cd":964,"adv":0.45900002,"pB":[-1161,-1231,5661,6381],"aB":[114,53,139,80]},{"cd":965,"adv":0.57100004,"pB":[-211,-1231,6121,6381],"aB":[90,53,113,80]},{"cd":966,"adv":0.734,"pB":[-461,-3241,7831,6501],"aB":[249,319,279,354]},{"cd":967,"adv":0.46600002,"pB":[-1161,-3221,5701,6491],"aB":[223,319,248,354]},{"cd":968,"adv":0.754,"pB":[-311,-3241,7951,6381],"aB":[847,284,877,318]},{"cd":969,"adv":0.77800006,"pB":[-461,-1231,8241,6381],"aB":[58,53,89,80]},{"cd":970,"adv":0.28300002,"pB":[-1381,-1231,4091,8791],"aB":[523,357,542,393]},{"cd":971,"adv":0.57100004,"pB":[-211,-1231,6121,8791],"aB":[543,357,566,393]},{"cd":972,"adv":0.58400005,"pB":[-541,-1231,6381,9181],"aB":[426,470,450,508]},{"cd":973,"adv":0.57100004,"pB":[-211,-1231,6121,9181],"aB":[402,470,425,508]},{"cd":974,"adv":0.77800006,"pB":[-461,-1231,8241,9181],"aB":[370,470,401,508]},{"cd":975,"adv":0.609,"pB":[-111,-3241,7101,8001],"aB":[217,508,243,548]},{"cd":976,"adv":0.568,"pB":[-511,-1231,6291,8611],"aB":[198,319,222,354]},{"cd":977,"adv":0.53800005,"pB":[-711,-1231,6341,8611],"aB":[172,320,197,355]},{"cd":978,"adv":0.586,"pB":[-1061,-1111,7521,8121],"aB":[378,217,409,250]},{"cd":979,"adv":0.772,"pB":[-571,-1111,9381,8181],"aB":[410,217,446,250]},{"cd":980,"adv":0.586,"pB":[-1061,-1111,7521,10051],"aB":[244,509,275,549]},{"cd":981,"adv":0.628,"pB":[-651,-3241,6931,8591],"aB":[382,633,409,675]},{"cd":982,"adv":0.72800004,"pB":[-911,-1231,8091,6381],"aB":[24,53,57,80]},{"cd":983,"adv":0.6,"pB":[-561,-3241,6561,6501],"aB":[145,320,171,355]},{"cd":984,"adv":0.69200003,"pB":[-561,-3131,7481,8121],"aB":[873,591,902,632]},{"cd":985,"adv":0.58400005,"pB":[-541,-3241,6381,6501],"aB":[120,320,144,355]},{"cd":986,"adv":0.54200006,"pB":[-561,-3261,6331,8001],"aB":[276,509,301,549]},{"cd":987,"adv":0.48100004,"pB":[-541,-3261,5721,6891],"aB":[567,357,589,393]},{"cd":988,"adv":0.523,"pB":[-111,-1111,6091,8001],"aB":[248,148,270,180]},{"cd":989,"adv":0.441,"pB":[-211,-3251,5471,6381],"aB":[878,284,898,318]},{"cd":990,"adv":0.46500003,"pB":[-911,-1111,5561,8001],"aB":[271,148,295,180]},{"cd":991,"adv":0.45200002,"pB":[-1011,-1231,5531,8641],"aB":[590,357,613,393]},{"cd":992,"adv":0.586,"pB":[-1051,-1111,6911,8001],"aB":[296,148,324,180]},{"cd":993,"adv":0.64000005,"pB":[-1061,-3231,6941,8611],"aB":[353,633,381,675]},{"cd":1008,"adv":0.6,"pB":[-561,-1231,6561,6501],"aB":[929,58,955,86]},{"cd":1009,"adv":0.58400005,"pB":[-261,-3271,6331,6501],"aB":[96,318,119,353]},{"cd":1010,"adv":0.51100004,"pB":[-541,-1231,5921,6501],"aB":[1000,87,1023,115]},{"cd":1011,"adv":0.28,"pB":[-1201,-3231,3151,8911],"aB":[580,676,596,720]},{"cd":1012,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[899,284,928,318]},{"cd":1013,"adv":0.48200002,"pB":[-541,-1231,5631,6501],"aB":[906,58,928,86]},{"cd":1014,"adv":0.48400003,"pB":[-811,-1231,5381,6501],"aB":[883,58,905,86]},{"cd":1015,"adv":0.58100003,"pB":[-111,-1111,6601,8001],"aB":[325,151,349,183]},{"cd":1016,"adv":0.59400004,"pB":[-161,-3241,6431,8611],"aB":[328,633,352,675]},{"cd":1017,"adv":0.59000003,"pB":[-561,-1231,6811,8121],"aB":[929,283,956,317]},{"cd":1018,"adv":0.77800006,"pB":[-491,-1111,8271,8001],"aB":[350,151,381,183]},{"cd":1019,"adv":0.671,"pB":[-681,-3241,7221,6381],"aB":[957,283,985,317]},{"cd":1020,"adv":0.58400005,"pB":[-1001,-3241,6331,6501],"aB":[69,318,95,353]},{"cd":1021,"adv":0.59000003,"pB":[-911,-1231,6461,8121],"aB":[986,284,1013,318]},{"cd":1022,"adv":0.59000003,"pB":[-561,-1231,6811,8121],"aB":[981,248,1008,282]},{"cd":1023,"adv":0.59000003,"pB":[-911,-1231,6461,8121],"aB":[953,248,980,282]},{"cd":1024,"adv":0.535,"pB":[-111,-1111,5921,10221],"aB":[302,509,324,549]},{"cd":1025,"adv":0.535,"pB":[-111,-1111,5921,10051],"aB":[325,509,347,549]},{"cd":1026,"adv":0.717,"pB":[-961,-2481,7931,8001],"aB":[856,392,888,429]},{"cd":1027,"adv":0.508,"pB":[-111,-1111,6091,10221],"aB":[348,509,370,549]},{"cd":1028,"adv":0.56,"pB":[-561,-1231,6511,8121],"aB":[926,248,952,282]},{"cd":1029,"adv":0.545,"pB":[-861,-1231,6161,8121],"aB":[899,249,925,283]},{"cd":1030,"adv":0.29500002,"pB":[-111,-1111,3061,8001],"aB":[382,151,394,183]},{"cd":1031,"adv":0.29500002,"pB":[-1271,-1111,4201,10051],"aB":[371,509,391,549]},{"cd":1032,"adv":0.305,"pB":[-1061,-2481,3211,8001],"aB":[840,392,855,429]},{"cd":1033,"adv":0.89900005,"pB":[-971,-1231,9851,8001],"aB":[447,217,486,250]},{"cd":1034,"adv":0.94400007,"pB":[-111,-1111,10301,8001],"aB":[395,151,433,183]},{"cd":1035,"adv":0.717,"pB":[-961,-1111,7931,8001],"aB":[434,151,466,183]},{"cd":1036,"adv":0.58900005,"pB":[-111,-1111,6901,10221],"aB":[392,509,417,549]},{"cd":1037,"adv":0.683,"pB":[-111,-1111,6941,10221],"aB":[418,509,443,549]},{"cd":1038,"adv":0.54,"pB":[-1111,-1231,6561,9991],"aB":[444,509,471,549]},{"cd":1039,"adv":0.665,"pB":[-111,-2611,6761,8001],"aB":[344,470,369,508]},{"cd":1040,"adv":0.573,"pB":[-1051,-1111,6781,8001],"aB":[467,151,495,183]},{"cd":1041,"adv":0.57900006,"pB":[-111,-1111,6601,8001],"aB":[496,151,520,183]},{"cd":1042,"adv":0.60800004,"pB":[-111,-1111,6741,8001],"aB":[521,151,546,183]},{"cd":1043,"adv":0.508,"pB":[-111,-1111,6091,8001],"aB":[547,151,569,183]},{"cd":1044,"adv":0.611,"pB":[-1211,-2611,6781,8001],"aB":[314,470,343,508]},{"cd":1045,"adv":0.535,"pB":[-111,-1111,5921,8001],"aB":[570,151,592,183]},{"cd":1046,"adv":0.82100004,"pB":[-1061,-1111,9271,8001],"aB":[593,151,630,183]},{"cd":1047,"adv":0.521,"pB":[-1011,-1231,5871,8121],"aB":[873,249,898,283]},{"cd":1048,"adv":0.683,"pB":[-111,-1111,6941,8001],"aB":[631,151,656,183]},{"cd":1049,"adv":0.683,"pB":[-111,-1111,6941,9991],"aB":[876,468,901,507]},{"cd":1050,"adv":0.58900005,"pB":[-111,-1111,6901,8001],"aB":[657,151,682,183]},{"cd":1051,"adv":0.65900004,"pB":[-971,-1231,6701,8001],"aB":[487,217,515,250]},{"cd":1052,"adv":0.77800006,"pB":[-491,-1111,8271,8001],"aB":[683,151,714,183]},{"cd":1053,"adv":0.68,"pB":[-111,-1111,6911,8001],"aB":[715,150,740,182]},{"cd":1054,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[843,249,872,283]},{"cd":1055,"adv":0.675,"pB":[-111,-1111,6861,8001],"aB":[741,150,766,182]},{"cd":1056,"adv":0.58100003,"pB":[-111,-1111,6601,8001],"aB":[767,150,791,182]},{"cd":1057,"adv":0.56,"pB":[-561,-1231,6511,8121],"aB":[816,249,842,283]},{"cd":1058,"adv":0.517,"pB":[-961,-1111,6181,8001],"aB":[792,150,818,182]},{"cd":1059,"adv":0.54,"pB":[-1111,-1231,6561,8001],"aB":[516,217,543,250]},{"cd":1060,"adv":0.82000005,"pB":[-711,-1441,8911,8341],"aB":[614,357,649,393]},{"cd":1061,"adv":0.54,"pB":[-1061,-1111,6461,8001],"aB":[819,150,846,182]},{"cd":1062,"adv":0.665,"pB":[-111,-2611,7561,8001],"aB":[285,470,313,508]},{"cd":1063,"adv":0.61200005,"pB":[-711,-1111,6231,8001],"aB":[847,150,872,182]},{"cd":1064,"adv":0.9250001,"pB":[-111,-1111,9361,8001],"aB":[873,150,907,182]},{"cd":1065,"adv":0.9250001,"pB":[-111,-2611,10161,8001],"aB":[247,470,284,508]},{"cd":1066,"adv":0.68500006,"pB":[-961,-1111,7711,8001],"aB":[908,149,939,181]},{"cd":1067,"adv":0.81900007,"pB":[-111,-1111,8301,8001],"aB":[940,149,970,181]},{"cd":1068,"adv":0.574,"pB":[-111,-1111,6601,8001],"aB":[971,149,995,181]},{"cd":1069,"adv":0.537,"pB":[-911,-1231,5931,8121],"aB":[790,249,815,283]},{"cd":1070,"adv":0.89900005,"pB":[-111,-1231,9551,8121],"aB":[754,250,789,284]},{"cd":1071,"adv":0.606,"pB":[-811,-1111,6171,8001],"aB":[996,149,1021,181]},{"cd":1072,"adv":0.544,"pB":[-661,-1231,6051,6501],"aB":[858,58,882,86]},{"cd":1073,"adv":0.57900006,"pB":[-541,-1231,6331,8621],"aB":[650,357,674,393]},{"cd":1074,"adv":0.564,"pB":[-161,-1111,6181,6501],"aB":[0,53,23,80]},{"cd":1075,"adv":0.42900002,"pB":[-161,-1111,5351,6381],"aB":[365,27,385,53]},{"cd":1076,"adv":0.558,"pB":[-1111,-2611,6291,6381],"aB":[996,116,1022,148]},{"cd":1077,"adv":0.545,"pB":[-541,-1231,6041,6501],"aB":[834,59,857,87]},{"cd":1078,"adv":0.71900004,"pB":[-911,-1111,8101,6381],"aB":[386,29,419,55]},{"cd":1079,"adv":0.5,"pB":[-961,-1231,5541,6501],"aB":[810,59,833,87]},{"cd":1080,"adv":0.6,"pB":[-161,-1111,6161,6381],"aB":[420,30,443,56]},{"cd":1081,"adv":0.6,"pB":[-161,-1111,6161,8841],"aB":[45,318,68,353]},{"cd":1082,"adv":0.51900005,"pB":[-161,-1111,6201,6381],"aB":[444,30,467,56]},{"cd":1083,"adv":0.57600003,"pB":[-741,-1231,5921,6381],"aB":[0,25,24,52]},{"cd":1084,"adv":0.671,"pB":[-511,-1111,7221,6381],"aB":[468,31,495,57]},{"cd":1085,"adv":0.59300005,"pB":[-161,-1111,6091,6381],"aB":[496,31,518,57]},{"cd":1086,"adv":0.58400005,"pB":[-541,-1231,6381,6501],"aB":[785,59,809,87]},{"cd":1087,"adv":0.59000003,"pB":[-161,-1111,6061,6381],"aB":[519,31,541,57]},{"cd":1088,"adv":0.59400004,"pB":[-161,-3241,6431,6501],"aB":[20,318,44,353]},{"cd":1089,"adv":0.47800002,"pB":[-541,-1231,5591,6501],"aB":[762,59,784,87]},{"cd":1090,"adv":0.45100003,"pB":[-1061,-1111,5621,6381],"aB":[542,31,566,57]},{"cd":1091,"adv":0.492,"pB":[-1011,-3241,5931,6381],"aB":[728,251,753,285]},{"cd":1092,"adv":0.81600004,"pB":[-491,-3241,8651,8611],"aB":[294,633,327,675]},{"cd":1093,"adv":0.485,"pB":[-1061,-1111,5911,6381],"aB":[567,31,592,57]},{"cd":1094,"adv":0.58500004,"pB":[-161,-2611,6811,6381],"aB":[970,116,995,148]},{"cd":1095,"adv":0.55200005,"pB":[-561,-1111,5681,6381],"aB":[593,31,616,57]},{"cd":1096,"adv":0.79600006,"pB":[-161,-1111,8121,6381],"aB":[617,31,647,57]},{"cd":1097,"adv":0.79600006,"pB":[-161,-2611,8921,6381],"aB":[936,116,969,148]},{"cd":1098,"adv":0.6,"pB":[-1061,-1111,6761,6381],"aB":[648,31,676,57]},{"cd":1099,"adv":0.734,"pB":[-161,-1111,7501,6381],"aB":[677,33,705,59]},{"cd":1100,"adv":0.51600003,"pB":[-161,-1111,5921,6381],"aB":[706,32,728,58]},{"cd":1101,"adv":0.48400003,"pB":[-811,-1231,5381,6501],"aB":[739,59,761,87]},{"cd":1102,"adv":0.785,"pB":[-161,-1231,8391,6501],"aB":[707,59,738,87]},{"cd":1103,"adv":0.551,"pB":[-761,-1111,5671,6381],"aB":[729,32,752,58]},{"cd":1104,"adv":0.545,"pB":[-541,-1231,6041,9121],"aB":[816,392,839,429]},{"cd":1105,"adv":0.545,"pB":[-541,-1231,6041,8791],"aB":[675,357,698,393]},{"cd":1106,"adv":0.58900005,"pB":[-891,-3231,6101,8591],"aB":[268,633,293,675]},{"cd":1107,"adv":0.42900002,"pB":[-161,-1111,5351,9121],"aB":[699,357,719,393]},{"cd":1108,"adv":0.48200002,"pB":[-541,-1231,5631,6501],"aB":[684,60,706,88]},{"cd":1109,"adv":0.467,"pB":[-861,-1231,5431,6501],"aB":[660,60,683,88]},{"cd":1110,"adv":0.282,"pB":[-351,-1111,3161,8911],"aB":[720,357,733,393]},{"cd":1111,"adv":0.282,"pB":[-1331,-1111,4141,8791],"aB":[0,318,19,353]},{"cd":1112,"adv":0.28,"pB":[-1201,-3231,3151,8911],"aB":[597,676,613,720]},{"cd":1113,"adv":0.79600006,"pB":[-741,-1231,8721,6381],"aB":[25,25,59,52]},{"cd":1114,"adv":0.814,"pB":[-161,-1111,8901,6381],"aB":[753,32,786,58]},{"cd":1115,"adv":0.592,"pB":[-891,-1111,6131,8591],"aB":[701,251,727,285]},{"cd":1116,"adv":0.51900005,"pB":[-161,-1111,6201,9121],"aB":[734,357,757,393]},{"cd":1117,"adv":0.6,"pB":[-161,-1111,6161,9121],"aB":[758,357,781,393]},{"cd":1118,"adv":0.492,"pB":[-1011,-3241,5931,8841],"aB":[958,633,983,676]},{"cd":1119,"adv":0.58500004,"pB":[-161,-2611,6011,6381],"aB":[913,116,935,148]},{"cd":1120,"adv":0.83800006,"pB":[-511,-1231,8891,8001],"aB":[544,217,578,250]},{"cd":1121,"adv":0.77800006,"pB":[-461,-1231,8241,6381],"aB":[60,25,91,52]},{"cd":1122,"adv":0.63100004,"pB":[-1111,-1111,7171,8001],"aB":[883,116,912,148]},{"cd":1123,"adv":0.52500004,"pB":[-891,-1111,6011,7681],"aB":[411,86,436,117]},{"cd":1124,"adv":0.78700006,"pB":[-111,-1231,8781,8121],"aB":[668,251,700,285]},{"cd":1125,"adv":0.70500004,"pB":[-161,-1231,7861,6501],"aB":[630,58,659,86]},{"cd":1126,"adv":0.583,"pB":[-1051,-1111,6881,8001],"aB":[854,117,882,149]},{"cd":1127,"adv":0.513,"pB":[-1011,-1111,6141,6381],"aB":[787,32,813,58]},{"cd":1128,"adv":0.82500005,"pB":[-111,-1111,9301,8001],"aB":[819,117,853,149]},{"cd":1129,"adv":0.70900005,"pB":[-161,-1111,8101,6381],"aB":[814,32,844,58]},{"cd":1130,"adv":0.76100004,"pB":[-1061,-1111,8671,8001],"aB":[783,117,818,149]},{"cd":1131,"adv":0.65900004,"pB":[-911,-1111,7501,6381],"aB":[845,31,876,57]},{"cd":1132,"adv":0.88100004,"pB":[-111,-1111,9871,8001],"aB":[746,117,782,149]},{"cd":1133,"adv":0.744,"pB":[-161,-1111,8351,6381],"aB":[877,31,908,57]},{"cd":1134,"adv":0.505,"pB":[-811,-3261,5711,10201],"aB":[0,672,23,720]},{"cd":1135,"adv":0.47000003,"pB":[-861,-3261,5561,8961],"aB":[614,676,638,720]},{"cd":1136,"adv":0.694,"pB":[-761,-1111,7701,8001],"aB":[715,117,745,149]},{"cd":1137,"adv":0.754,"pB":[-311,-3241,7951,6381],"aB":[637,251,667,285]},{"cd":1138,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[607,251,636,285]},{"cd":1139,"adv":0.58400005,"pB":[-541,-1231,6381,6501],"aB":[605,58,629,86]},{"cd":1140,"adv":0.60800004,"pB":[-1051,-1111,7741,8121],"aB":[579,217,610,250]},{"cd":1141,"adv":0.507,"pB":[-1011,-1111,6631,6851],"aB":[577,58,604,86]},{"cd":1142,"adv":0.60800004,"pB":[-1051,-1111,7741,10691],"aB":[236,633,267,675]},{"cd":1143,"adv":0.507,"pB":[-1011,-1111,6631,9431],"aB":[788,393,815,430]},{"cd":1144,"adv":1.184,"pB":[-561,-3241,12851,8121],"aB":[903,591,952,632]},{"cd":1145,"adv":1.072,"pB":[-541,-3241,11731,6501],"aB":[0,282,44,317]},{"cd":1162,"adv":0.693,"pB":[-111,-2611,8041,9991],"aB":[151,675,180,720]},{"cd":1163,"adv":0.6,"pB":[-161,-2611,7161,8841],"aB":[953,591,979,632]},{"cd":1164,"adv":0.58500004,"pB":[-911,-1111,6711,8001],"aB":[686,118,714,150]},{"cd":1165,"adv":0.528,"pB":[-861,-1111,6041,6381],"aB":[909,31,934,57]},{"cd":1166,"adv":0.58100003,"pB":[-111,-1111,6601,8001],"aB":[661,118,685,150]},{"cd":1167,"adv":0.59400004,"pB":[-161,-3241,6431,6501],"aB":[45,282,69,317]},{"cd":1168,"adv":0.508,"pB":[-111,-1111,6091,9271],"aB":[765,394,787,431]},{"cd":1169,"adv":0.42900002,"pB":[-161,-1111,5351,7731],"aB":[437,86,457,117]},{"cd":1170,"adv":0.51600003,"pB":[-1011,-1111,6171,8001],"aB":[634,118,660,150]},{"cd":1171,"adv":0.441,"pB":[-861,-1111,5471,6381],"aB":[935,31,958,57]},{"cd":1172,"adv":0.606,"pB":[-111,-3241,6821,8001],"aB":[472,509,497,549]},{"cd":1173,"adv":0.546,"pB":[-161,-3241,6071,6381],"aB":[584,251,606,285]},{"cd":1174,"adv":0.83400005,"pB":[-1061,-2611,9541,8001],"aB":[208,469,246,507]},{"cd":1175,"adv":0.71800005,"pB":[-911,-2611,8361,6381],"aB":[599,118,633,150]},{"cd":1176,"adv":0.521,"pB":[-1011,-3521,5871,8121],"aB":[210,633,235,675]},{"cd":1177,"adv":0.5,"pB":[-961,-3521,5541,6501],"aB":[782,356,805,392]},{"cd":1178,"adv":0.58900005,"pB":[-111,-2611,7091,8001],"aB":[181,469,207,507]},{"cd":1179,"adv":0.51900005,"pB":[-161,-2611,6371,6381],"aB":[575,118,598,150]},{"cd":1180,"adv":0.59400004,"pB":[-111,-1111,6901,8001],"aB":[549,118,574,150]},{"cd":1181,"adv":0.532,"pB":[-161,-1111,6231,6381],"aB":[959,31,982,57]},{"cd":1182,"adv":0.59300005,"pB":[-911,-1111,6941,8001],"aB":[520,118,548,150]},{"cd":1183,"adv":0.52400005,"pB":[-891,-1111,6251,8591],"aB":[557,251,583,285]},{"cd":1184,"adv":0.70000005,"pB":[-961,-1111,8011,8001],"aB":[487,118,519,150]},{"cd":1185,"adv":0.577,"pB":[-1061,-1111,6781,6381],"aB":[983,31,1011,57]},{"cd":1186,"adv":0.68,"pB":[-111,-2611,7711,8001],"aB":[152,469,180,507]},{"cd":1187,"adv":0.59300005,"pB":[-161,-2611,6891,6381],"aB":[461,118,486,150]},{"cd":1188,"adv":0.791,"pB":[-111,-1111,8921,8001],"aB":[427,118,460,150]},{"cd":1189,"adv":0.67700005,"pB":[-161,-1111,7881,6381],"aB":[974,4,1003,30]},{"cd":1190,"adv":0.98300004,"pB":[-111,-3241,10591,8001],"aB":[498,509,537,549]},{"cd":1191,"adv":0.85400003,"pB":[-161,-3241,9151,6381],"aB":[523,251,556,285]},{"cd":1192,"adv":0.72300005,"pB":[-561,-2331,7771,8121],"aB":[121,469,151,507]},{"cd":1193,"adv":0.60700005,"pB":[-541,-2331,6611,6501],"aB":[401,118,426,150]},{"cd":1194,"adv":0.56,"pB":[-561,-3521,6511,8121],"aB":[183,632,209,674]},{"cd":1195,"adv":0.47800002,"pB":[-541,-3521,5591,6501],"aB":[806,355,828,391]},{"cd":1196,"adv":0.517,"pB":[-961,-2611,6181,8001],"aB":[94,469,120,507]},{"cd":1197,"adv":0.45100003,"pB":[-1061,-2611,5621,6381],"aB":[376,118,400,150]},{"cd":1198,"adv":0.55,"pB":[-1061,-1111,6561,8001],"aB":[348,118,375,150]},{"cd":1199,"adv":0.492,"pB":[-1011,-3241,5931,6381],"aB":[497,251,522,285]},{"cd":1200,"adv":0.55,"pB":[-1061,-1111,6561,8001],"aB":[320,115,347,147]},{"cd":1201,"adv":0.492,"pB":[-1011,-3241,5931,6381],"aB":[471,251,496,285]},{"cd":1202,"adv":0.54700005,"pB":[-1061,-2611,6671,8001],"aB":[65,469,93,507]},{"cd":1203,"adv":0.499,"pB":[-1061,-2611,6171,6381],"aB":[293,115,319,147]},{"cd":1204,"adv":0.776,"pB":[-961,-2611,8671,8001],"aB":[29,467,64,505]},{"cd":1205,"adv":0.669,"pB":[-1061,-2611,7651,6381],"aB":[261,115,292,147]},{"cd":1206,"adv":0.61200005,"pB":[-711,-2611,7031,8001],"aB":[0,467,28,505]},{"cd":1207,"adv":0.55200005,"pB":[-561,-2611,6481,6381],"aB":[234,115,260,147]},{"cd":1208,"adv":0.61200005,"pB":[-711,-1111,6231,8001],"aB":[208,115,233,147]},{"cd":1209,"adv":0.55200005,"pB":[-561,-1111,5681,6381],"aB":[950,4,973,30]},{"cd":1210,"adv":0.606,"pB":[-111,-1111,6821,8001],"aB":[182,114,207,146]},{"cd":1211,"adv":0.58100003,"pB":[-161,-1111,6071,8591],"aB":[448,251,470,285]},{"cd":1212,"adv":0.75100005,"pB":[-1111,-1231,8171,8121],"aB":[414,251,447,285]},{"cd":1213,"adv":0.633,"pB":[-1061,-1231,6921,6501],"aB":[548,58,576,86]},{"cd":1214,"adv":0.75100005,"pB":[-1111,-3431,8171,8121],"aB":[149,632,182,674]},{"cd":1215,"adv":0.633,"pB":[-1061,-3371,6921,6501],"aB":[829,355,857,391]},{"cd":1216,"adv":0.29500002,"pB":[-111,-1111,3061,8001],"aB":[169,114,181,146]},{"cd":1217,"adv":0.82100004,"pB":[-1061,-1111,9271,9991],"aB":[838,468,875,507]},{"cd":1218,"adv":0.71900004,"pB":[-911,-1111,8101,8841],"aB":[70,282,103,317]},{"cd":1219,"adv":0.595,"pB":[-111,-3241,6711,8001],"aB":[538,509,563,549]},{"cd":1220,"adv":0.54,"pB":[-161,-3241,6011,6381],"aB":[391,251,413,285]},{"cd":1221,"adv":0.669,"pB":[-971,-2611,7801,8001],"aB":[0,428,32,466]},{"cd":1222,"adv":0.591,"pB":[-741,-2611,6921,6381],"aB":[141,114,168,146]},{"cd":1223,"adv":0.68,"pB":[-111,-3241,6911,8001],"aB":[564,509,589,549]},{"cd":1224,"adv":0.59300005,"pB":[-161,-3241,6091,6381],"aB":[368,251,390,285]},{"cd":1225,"adv":0.69000006,"pB":[-111,-2611,8011,8001],"aB":[33,428,62,466]},{"cd":1226,"adv":0.60800004,"pB":[-161,-2611,7091,6381],"aB":[114,114,140,146]},{"cd":1227,"adv":0.61200005,"pB":[-711,-2611,6231,8001],"aB":[63,428,88,466]},{"cd":1228,"adv":0.55200005,"pB":[-561,-2611,5681,6381],"aB":[90,114,113,146]},{"cd":1229,"adv":0.77800006,"pB":[-491,-2611,9371,8001],"aB":[89,430,124,468]},{"cd":1230,"adv":0.721,"pB":[-511,-2611,8221,6381],"aB":[58,114,89,146]},{"cd":1231,"adv":0.293,"pB":[-211,-1231,3841,8611],"aB":[1002,320,1016,355]},{"cd":1232,"adv":0.573,"pB":[-1051,-1111,6781,9991],"aB":[809,469,837,508]},{"cd":1233,"adv":0.544,"pB":[-661,-1231,6051,8841],"aB":[858,355,882,391]},{"cd":1234,"adv":0.573,"pB":[-1051,-1111,6781,10051],"aB":[590,509,618,549]},{"cd":1235,"adv":0.544,"pB":[-661,-1231,6051,8791],"aB":[883,355,907,391]},{"cd":1236,"adv":0.81600004,"pB":[-1231,-1111,8731,8001],"aB":[21,114,57,146]},{"cd":1237,"adv":0.84900004,"pB":[-661,-1231,9081,6501],"aB":[512,58,547,86]},{"cd":1238,"adv":0.535,"pB":[-111,-1111,5921,9991],"aB":[786,470,808,509]},{"cd":1239,"adv":0.545,"pB":[-541,-1231,6041,8841],"aB":[908,355,931,391]},{"cd":1240,"adv":0.64900005,"pB":[-661,-1231,7051,8121],"aB":[339,251,367,285]},{"cd":1241,"adv":0.554,"pB":[-591,-1231,6081,6501],"aB":[487,58,511,86]},{"cd":1242,"adv":0.64900005,"pB":[-661,-1231,7051,10051],"aB":[980,591,1008,632]},{"cd":1243,"adv":0.554,"pB":[-591,-1231,6081,8791],"aB":[932,355,956,391]},{"cd":1244,"adv":0.82100004,"pB":[-1061,-1111,9271,10051],"aB":[619,509,656,549]},{"cd":1245,"adv":0.71900004,"pB":[-911,-1111,8101,8791],"aB":[104,282,137,317]},{"cd":1246,"adv":0.521,"pB":[-1011,-1231,5871,10051],"aB":[980,549,1005,590]},{"cd":1247,"adv":0.5,"pB":[-961,-1231,5541,8791],"aB":[957,356,980,392]},{"cd":1248,"adv":0.51600003,"pB":[-1011,-1231,5821,8001],"aB":[611,217,635,250]},{"cd":1249,"adv":0.48100004,"pB":[-1111,-3241,5621,6381],"aB":[314,251,338,285]},{"cd":1250,"adv":0.683,"pB":[-111,-1111,6941,9731],"aB":[760,470,785,509]},{"cd":1251,"adv":0.6,"pB":[-161,-1111,6161,8471],"aB":[290,248,313,282]},{"cd":1252,"adv":0.683,"pB":[-111,-1111,6941,10051],"aB":[657,509,682,549]},{"cd":1253,"adv":0.6,"pB":[-161,-1111,6161,8791],"aB":[138,284,161,319]},{"cd":1254,"adv":0.69200003,"pB":[-561,-1231,7481,10051],"aB":[950,549,979,590]},{"cd":1255,"adv":0.58400005,"pB":[-541,-1231,6381,8791],"aB":[981,356,1005,392]},{"cd":1256,"adv":0.69200003,"pB":[-561,-1231,7481,8121],"aB":[260,248,289,282]},{"cd":1257,"adv":0.58400005,"pB":[-541,-1231,6381,6501],"aB":[462,58,486,86]},{"cd":1258,"adv":0.69200003,"pB":[-561,-1231,7481,10051],"aB":[920,549,949,590]},{"cd":1259,"adv":0.58400005,"pB":[-541,-1231,6381,8791],"aB":[977,319,1001,355]},{"cd":1260,"adv":0.537,"pB":[-911,-1231,5931,10051],"aB":[894,549,919,590]},{"cd":1261,"adv":0.48400003,"pB":[-811,-1231,5381,8791],"aB":[954,318,976,354]},{"cd":1262,"adv":0.54,"pB":[-1111,-1231,6561,9731],"aB":[683,510,710,550]},{"cd":1263,"adv":0.492,"pB":[-1011,-3241,5931,8471],"aB":[123,632,148,674]},{"cd":1264,"adv":0.54,"pB":[-1111,-1231,6561,10051],"aB":[866,549,893,590]},{"cd":1265,"adv":0.492,"pB":[-1011,-3241,5931,8791],"aB":[932,633,957,676]},{"cd":1266,"adv":0.54,"pB":[-1111,-1231,6561,10691],"aB":[904,633,931,676]},{"cd":1267,"adv":0.492,"pB":[-1011,-3241,5931,9431],"aB":[181,675,206,720]},{"cd":1268,"adv":0.61200005,"pB":[-711,-1111,6231,10051],"aB":[711,510,736,550]},{"cd":1269,"adv":0.55200005,"pB":[-561,-1111,5681,8791],"aB":[162,284,185,319]},{"cd":1270,"adv":0.508,"pB":[-111,-2611,6091,8001],"aB":[125,430,147,468]},{"cd":1271,"adv":0.42900002,"pB":[-161,-2611,5351,6381],"aB":[0,115,20,147]},{"cd":1272,"adv":0.81900007,"pB":[-111,-1111,8301,10051],"aB":[737,510,767,550]},{"cd":1273,"adv":0.734,"pB":[-161,-1111,7501,8791],"aB":[186,283,214,318]},{"cd":1274,"adv":0.51600003,"pB":[-1011,-3241,6171,8001],"aB":[768,510,794,550]},{"cd":1275,"adv":0.441,"pB":[-861,-3241,5471,6381],"aB":[236,248,259,282]},{"cd":1276,"adv":0.56,"pB":[-1061,-3241,6661,8001],"aB":[795,510,822,550]},{"cd":1277,"adv":0.48800004,"pB":[-1061,-3241,6061,6381],"aB":[210,248,235,282]},{"cd":1278,"adv":0.54,"pB":[-1061,-1111,6461,8001],"aB":[0,81,27,113]},{"cd":1279,"adv":0.485,"pB":[-1061,-1111,5911,6381],"aB":[924,4,949,30]},{"cd":8211,"adv":0.52000004,"pB":[-791,1629,5991,4631],"aB":[0,1,24,12]},{"cd":8212,"adv":0.79,"pB":[-791,1629,8691,4631],"aB":[25,1,59,12]},{"cd":8213,"adv":0.52000004,"pB":[-791,1629,5991,4631],"aB":[60,0,84,11]},{"cd":8214,"adv":0.577,"pB":[489,-2131,5281,9181],"aB":[847,550,865,591]},{"cd":8216,"adv":0.22800002,"pB":[-671,3789,2991,8641],"aB":[523,12,536,30]},{"cd":8217,"adv":0.22800002,"pB":[-711,3789,2951,8641],"aB":[509,12,522,30]},{"cd":8218,"adv":0.22800002,"pB":[-711,-2671,2951,2181],"aB":[366,9,379,26]},{"cd":8220,"adv":0.40600002,"pB":[-671,3789,4771,8641],"aB":[488,12,508,30]},{"cd":8221,"adv":0.40600002,"pB":[-711,3789,4731,8641],"aB":[467,11,487,29]},{"cd":8222,"adv":0.40600002,"pB":[-711,-2671,4731,2181],"aB":[345,9,365,26]},{"cd":8224,"adv":0.51000005,"pB":[-691,-1111,5791,7801],"aB":[28,81,51,113]},{"cd":8225,"adv":0.51000005,"pB":[-691,-1111,5791,7801],"aB":[52,81,75,113]},{"cd":8226,"adv":0.324,"pB":[-611,1179,3851,5651],"aB":[316,10,332,26]},{"cd":8230,"adv":0.73800004,"pB":[-611,-1231,7981,2381],"aB":[137,12,168,25]},{"cd":8240,"adv":1.1880001,"pB":[-661,-1421,12541,8221],"aB":[215,283,263,318]},{"cd":8249,"adv":0.34,"pB":[-561,-721,3961,6461],"aB":[906,4,923,30]},{"cd":8250,"adv":0.34,"pB":[-561,-721,3961,6461],"aB":[888,4,905,30]},{"cd":8255,"adv":0.67,"pB":[-1111,-3231,7811,841],"aB":[261,11,293,26]},{"cd":8260,"adv":0.132,"pB":[-2781,-1891,4101,8611],"aB":[739,394,764,431]},{"cd":8266,"adv":0.52900004,"pB":[-611,-3231,5701,6381],"aB":[186,248,209,282]},{"cd":8353,"adv":0.546,"pB":[-561,-2661,6371,9351],"aB":[878,633,903,676]},{"cd":8358,"adv":0.66300005,"pB":[-861,-1111,7491,7801],"aB":[76,81,106,113]},{"cd":8361,"adv":0.813,"pB":[-811,-1111,8941,7801],"aB":[107,81,142,113]},{"cd":8362,"adv":0.90800005,"pB":[-541,-1111,9621,6751],"aB":[425,57,461,85]},{"cd":8363,"adv":0.60400003,"pB":[-491,-2841,6931,8231],"aB":[823,509,849,549]},{"cd":8364,"adv":0.57600003,"pB":[-861,-1231,6621,7901],"aB":[636,217,663,250]},{"cd":8367,"adv":1.1810001,"pB":[-1011,-3241,12301,7801],"aB":[850,508,898,548]},{"cd":8372,"adv":0.53400004,"pB":[-861,-1231,6201,7901],"aB":[664,217,690,250]},{"cd":8377,"adv":0.531,"pB":[-511,-1111,6121,7801],"aB":[143,81,167,113]},{"cd":8378,"adv":0.545,"pB":[-711,-1111,6511,7801],"aB":[168,81,194,113]},{"cd":8381,"adv":0.56,"pB":[-711,-1111,6391,7801],"aB":[195,81,221,113]},{"cd":8458,"adv":0.59800005,"pB":[-491,-3241,6141,6501],"aB":[264,283,288,318]},{"cd":8467,"adv":0.402,"pB":[-911,-1231,4931,8611],"aB":[289,283,310,318]},{"cd":8470,"adv":1.1220001,"pB":[-111,-1111,11771,8001],"aB":[222,82,265,114]},{"cd":8482,"adv":0.882,"pB":[-761,1869,9231,8001],"aB":[685,9,721,31]},{"cd":8486,"adv":0.69200003,"pB":[-561,-1111,7481,8121],"aB":[691,217,720,250]},{"cd":8494,"adv":0.94600004,"pB":[-401,-1271,9861,8271],"aB":[148,249,185,283]},{"cd":8531,"adv":0.93200004,"pB":[-461,-1891,9911,8611],"aB":[701,394,738,431]},{"cd":8532,"adv":0.93200004,"pB":[-561,-1891,9911,8611],"aB":[662,394,700,431]},{"cd":8533,"adv":0.93200004,"pB":[-461,-1891,9911,8611],"aB":[624,394,661,431]},{"cd":8534,"adv":0.93200004,"pB":[-561,-1891,9911,8611],"aB":[585,394,623,431]},{"cd":8535,"adv":0.93200004,"pB":[-591,-1891,9911,8611],"aB":[546,394,584,431]},{"cd":8536,"adv":0.93200004,"pB":[-691,-1891,9911,8611],"aB":[507,394,545,431]},{"cd":8537,"adv":0.93200004,"pB":[-461,-1891,9941,8611],"aB":[469,394,506,431]},{"cd":8538,"adv":0.93200004,"pB":[-591,-1891,9941,8611],"aB":[430,394,468,431]},{"cd":8539,"adv":0.93200004,"pB":[-461,-1891,10011,8611],"aB":[391,394,429,431]},{"cd":8540,"adv":0.93200004,"pB":[-591,-1891,10011,8611],"aB":[351,394,390,431]},{"cd":8541,"adv":0.93200004,"pB":[-591,-1891,10011,8611],"aB":[311,394,350,431]},{"cd":8542,"adv":0.87200004,"pB":[-441,-1891,9411,8611],"aB":[275,394,310,431]},{"cd":8543,"adv":0.532,"pB":[-461,-1891,8101,8611],"aB":[243,392,274,429]},{"cd":8592,"adv":0.90000004,"pB":[9,-901,8891,7481],"aB":[489,87,521,117]},{"cd":8593,"adv":0.90000004,"pB":[259,-1111,8741,7811],"aB":[266,82,297,114]},{"cd":8594,"adv":0.90000004,"pB":[109,-901,8991,7481],"aB":[522,87,554,117]},{"cd":8595,"adv":0.90000004,"pB":[259,-1461,8741,7461],"aB":[298,82,329,114]},{"cd":8678,"adv":0.96000004,"pB":[-711,-981,10311,7241],"aB":[555,87,595,117]},{"cd":8679,"adv":0.72,"pB":[-511,-1231,7711,9431],"aB":[148,430,177,468]},{"cd":8680,"adv":0.96000004,"pB":[-711,-981,10311,7241],"aB":[596,87,636,117]},{"cd":8681,"adv":0.72,"pB":[-511,-2051,7711,8611],"aB":[178,430,207,468]},{"cd":8682,"adv":0.72,"pB":[-511,-1231,7711,9431],"aB":[208,430,237,468]},{"cd":8706,"adv":0.51000005,"pB":[-811,-1231,5711,8121],"aB":[124,247,147,281]},{"cd":8709,"adv":0.90000004,"pB":[-271,-1271,9271,8271],"aB":[89,247,123,281]},{"cd":8710,"adv":0.583,"pB":[-1051,-1111,6881,8001],"aB":[330,82,358,114]},{"cd":8719,"adv":0.59800005,"pB":[-541,-3241,6521,7801],"aB":[899,508,924,548]},{"cd":8721,"adv":0.503,"pB":[-611,-1111,5641,7801],"aB":[359,85,382,117]},{"cd":8722,"adv":0.5,"pB":[-491,1829,5491,4821],"aB":[85,0,106,11]},{"cd":8725,"adv":0.132,"pB":[-2781,-1891,4101,8611],"aB":[217,392,242,429]},{"cd":8729,"adv":0.24000001,"pB":[-611,1299,3001,4911],"aB":[123,12,136,25]},{"cd":8730,"adv":0.56,"pB":[-691,-1111,8281,9631],"aB":[238,430,270,468]},{"cd":8734,"adv":0.89500004,"pB":[-561,-31,9511,6341],"aB":[746,8,783,31]},{"cd":8747,"adv":0.374,"pB":[-1511,-3241,5241,9631],"aB":[24,674,48,720]},{"cd":8776,"adv":0.48800004,"pB":[-761,499,5641,5951],"aB":[571,10,594,30]},{"cd":8800,"adv":0.5,"pB":[-491,-501,5491,7071],"aB":[92,25,113,52]},{"cd":8804,"adv":0.5,"pB":[-611,-1111,5611,6921],"aB":[401,57,424,85]},{"cd":8805,"adv":0.5,"pB":[-611,-1111,5611,6921],"aB":[377,56,400,84]},{"cd":8901,"adv":0.24000001,"pB":[-611,1299,3001,4911],"aB":[109,11,122,24]}]} + """ + + val DEFAULT_MSDF_FONT_INFO: MsdfFontInfo by lazy { + val meta = Json.decodeFromString(DEFAULT_META_JSON) + MsdfFontInfo(meta, "fonts/fira-sans-regular.png") + } + } +} + +enum class PowerPreference(val value: String) { + HighPerformance("high-performance"), + LowPower("low-power") +} \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/KoolSystem.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/KoolSystem.wasmJs.kt new file mode 100644 index 000000000..ca397c90d --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/KoolSystem.wasmJs.kt @@ -0,0 +1,9 @@ +package de.fabmax.kool + +import de.fabmax.kool.platform.navigator + +internal actual fun PlatformProperties(): KoolSystem.PlatformProperties { + return KoolSystem.PlatformProperties(Platform.Javascript, navigator.language) +} + +actual val currentThreadName: String = "kool-main" \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/LoadableFile.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/LoadableFile.kt new file mode 100644 index 000000000..044603369 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/LoadableFile.kt @@ -0,0 +1,30 @@ +package de.fabmax.kool + +import de.fabmax.kool.util.Uint8Buffer +import de.fabmax.kool.util.Uint8BufferImpl +import kotlinx.coroutines.await +import org.khronos.webgl.ArrayBuffer +import org.khronos.webgl.Uint8Array +import org.w3c.files.Blob +import org.w3c.files.File +import kotlin.js.Promise + +class LoadableFileImpl(val file: File) : LoadableFile { + override val name: String + get() = file.name + override val size: Long + get() = file.size.toDouble().toLong() + override val mimeType: MimeType + get() = MimeType(file.type) + + override suspend fun read(): Uint8Buffer { + val data = getBlobArrayBuffer(file) + return Uint8BufferImpl(Uint8Array(data.await())) + } + + override fun toString(): String { + return "$name [${(size / (1024.0 * 1024.0)).toString(1)} mb / ${mimeType.value}]" + } +} + +private fun getBlobArrayBuffer(blob: Blob): Promise = js("blob.arrayBuffer()") diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/NativeAssetLoader.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/NativeAssetLoader.kt new file mode 100644 index 000000000..e5a6a72d9 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/NativeAssetLoader.kt @@ -0,0 +1,94 @@ +package de.fabmax.kool + +import de.fabmax.kool.math.Vec2i +import de.fabmax.kool.modules.audio.AudioClipImpl +import de.fabmax.kool.pipeline.BufferedImageData2d +import de.fabmax.kool.platform.ImageAtlasTextureData +import de.fabmax.kool.platform.ImageTextureData +import de.fabmax.kool.util.Uint8BufferImpl +import de.fabmax.kool.util.logE +import kotlinx.browser.window +import kotlinx.coroutines.await +import org.khronos.webgl.ArrayBuffer +import org.khronos.webgl.Uint8Array +import org.w3c.dom.ImageBitmap +import org.w3c.fetch.Response +import org.w3c.files.Blob + +class NativeAssetLoader(val basePath: String) : AssetLoader() { + override suspend fun loadBlob(ref: AssetRef.Blob): LoadedAsset.Blob { + val url = ref.path + val prefixedUrl = if (Assets.isHttpAsset(url)) url else "${basePath}/$url" + val result = fetchData(prefixedUrl).map { + val arrayBuffer: ArrayBuffer = it.arrayBuffer().await() + Uint8BufferImpl(Uint8Array(arrayBuffer)) + } + return LoadedAsset.Blob(ref, result) + } + + override suspend fun loadImage2d(ref: AssetRef.Image2d): LoadedAsset.Image2d { + val resolveSz = ref.resolveSize + val result = loadImageBitmap(ref.path, ref.isHttp, resolveSz).map { + ImageTextureData(it, trimAssetPath(ref.path), ref.format) + } + return LoadedAsset.Image2d(ref, result) + } + + override suspend fun loadImageAtlas(ref: AssetRef.ImageAtlas): LoadedAsset.ImageAtlas { + val resolveSz = ref.resolveSize + val result = loadImageBitmap(ref.path, ref.isHttp, resolveSz).map { + ImageAtlasTextureData(it, ref.tilesX, ref.tilesY, trimAssetPath(ref.path), ref.format) + } + return LoadedAsset.ImageAtlas(ref, result) + } + + override suspend fun loadBufferedImage2d(ref: AssetRef.BufferedImage2d): LoadedAsset.BufferedImage2d { + val texRef = AssetRef.Image2d(ref.path, ref.format, ref.resolveSize) + val result = loadImage2d(texRef).result.mapCatching { + val texData = it as ImageTextureData + BufferedImageData2d( + ImageTextureData.imageBitmapToBuffer(texData.data, ref.format, ref.resolveSize), + texData.width, + texData.height, + ref.format, + trimAssetPath(ref.path) + ) + } + return LoadedAsset.BufferedImage2d(ref, result) + } + + override suspend fun loadAudio(ref: AssetRef.Audio): LoadedAsset.Audio { + val assetPath = ref.path + val clip = if (Assets.isHttpAsset(assetPath)) { + AudioClipImpl(assetPath) + } else { + AudioClipImpl("${basePath}/$assetPath") + } + return LoadedAsset.Audio(ref, Result.success(clip)) + } + + private suspend fun loadImageBitmap(path: String, isHttp: Boolean, resize: Vec2i?): Result { + val mime = MimeType.forFileName(path) + val prefixedUrl = if (isHttp) path else "${basePath}/${path}" + + return if (mime != MimeType.IMAGE_SVG) { + // raster image type -> fetch blob and create ImageBitmap directly + fetchData(prefixedUrl).mapCatching { + val imgBlob: Blob = it.blob().await() + window.createImageBitmap(imgBlob, ImageBitmapOptions(resize)).await() + } + } else { + PlatformAssetsImpl.loadSvgImageFromUrl(prefixedUrl, resize) + } + } + + private suspend fun fetchData(path: String): Result { + val response: Response = window.fetch(path).await() + return if (!response.ok) { + logE { "Failed loading resource $path: ${response.status} ${response.statusText}" } + Result.failure(IllegalStateException("Failed loading resource $path: ${response.status} ${response.statusText}")) + } else { + Result.success(response) + } + } +} diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/Platform.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/Platform.wasmJs.kt new file mode 100644 index 000000000..9ea496718 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/Platform.wasmJs.kt @@ -0,0 +1,86 @@ +package de.fabmax.kool + +import de.fabmax.kool.platform.WasmContext +import de.fabmax.kool.util.ApplicationScope +import de.fabmax.kool.util.FrontendScope +import de.fabmax.kool.util.Log +import de.fabmax.kool.util.LogPrinter +import kotlinx.coroutines.launch +import org.w3c.dom.HTMLCanvasElement + +actual fun Double.toString(precision: Int): String { + return when { + this.isNaN() -> "NaN" + this.isInfinite() -> "Infinity" + else -> { + val s = toString() + val p = s.indexOf('.') + if (p < 0) { + "$s.${"0".repeat(precision)}" + } else { + val r = s.length - (p + 1) + if (r < precision) { + s + "0".repeat(precision - r) + } else { + s.substring(0, (p + precision + 1).coerceAtMost(s.length)) + } + } + } + } +} + +val KoolSystem.configWasm: KoolConfigWasm get() = config as KoolConfigWasm + +/** + * Creates a new [KoolContext] with the given [KoolConfigWasm]. Notice that there can only be one [KoolContext], calling + * this method multiple times is an error. + */ +suspend fun createContext(config: KoolConfigWasm = KoolConfigWasm()): WasmContext { + KoolSystem.initialize(config) + return WasmImpl.createContext() +} + +fun KoolApplication(config: KoolConfigWasm = KoolConfigWasm(), appBlock: suspend KoolApplication.() -> Unit) { + ApplicationScope.launch { + val ctx = createContext(config) + KoolApplication(ctx, appBlock) + } +} + +fun KoolApplication(ctx: WasmContext, appBlock: suspend KoolApplication.() -> Unit) { + val koolApp = KoolApplication(ctx) + FrontendScope.launch { + koolApp.appBlock() + } + ctx.run() +} + +internal object WasmImpl { + private var ctx: WasmContext? = null + val canvas: HTMLCanvasElement + get() = checkNotNull(ctx?.window?.canvas) { "Platform.createContext() not called" } + + init { + if (Log.printer == Log.DEFAULT_PRINTER) { + Log.printer = JsLogPrinter + } + } + + suspend fun createContext(): WasmContext { + check(ctx == null) { "Context was already created (multi-context is not yet supported)" } + ctx = WasmContext() + return ctx!! + } +} + +private object JsLogPrinter : LogPrinter { + override fun print(lvl: Log.Level, tag: String?, message: String) { + + when (lvl) { + Log.Level.ERROR -> println("${lvl.indicator}/$tag: $message") + Log.Level.WARN -> println("${lvl.indicator}/$tag: $message") + Log.Level.INFO -> println("${lvl.indicator}/$tag: $message") + else -> println("${lvl.indicator}/$tag: $message") + } + } +} \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/input/ControllerWasm.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/input/ControllerWasm.wasmJs.kt new file mode 100644 index 000000000..65402c1da --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/input/ControllerWasm.wasmJs.kt @@ -0,0 +1,6 @@ +package de.fabmax.kool.input + +import de.fabmax.kool.Gamepad +import de.fabmax.kool.platform.navigator + +actual fun getGamepadState(index: Int): Gamepad? = navigator.getGamepads()?.get(index) \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/input/PlatformInput.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/input/PlatformInput.wasmJs.kt new file mode 100644 index 000000000..dde2ca36c --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/input/PlatformInput.wasmJs.kt @@ -0,0 +1,362 @@ +package de.fabmax.kool.input + +import de.fabmax.kool.Gamepad +import de.fabmax.kool.KoolSystem +import de.fabmax.kool.WasmImpl +import de.fabmax.kool.configWasm +import de.fabmax.kool.math.MutableVec2d +import de.fabmax.kool.platform.WasmContext +import de.fabmax.kool.platform.navigator +import de.fabmax.kool.util.logD +import de.fabmax.kool.util.logT +import kotlinx.browser.document +import kotlinx.browser.window +import org.w3c.dom.HTMLCanvasElement +import org.w3c.dom.Touch +import org.w3c.dom.TouchEvent +import org.w3c.dom.events.Event +import org.w3c.dom.events.KeyboardEvent +import org.w3c.dom.events.MouseEvent + +internal actual fun PlatformInput(): PlatformInput = PlatformInputWasm + +internal object PlatformInputWasm : PlatformInput { + + val excludedKeyCodes = mutableSetOf("F5", "F11", "F12", "MetaLeft", "MetaRight") + + private val pixelRatio: Float + get() = (KoolSystem.getContextOrNull() as WasmContext?)?.window?.renderScale ?: 1f + + private val virtualPointerPos = MutableVec2d() + private var currentCursorShape = CursorShape.DEFAULT + private var mouseButtonState = 0 + + override fun setCursorMode(cursorMode: CursorMode) { + PointerLockState.cursorMode = cursorMode + } + + override fun applyCursorShape(cursorShape: CursorShape) { + if (cursorShape != currentCursorShape) { + WasmImpl.canvas.style.cursor = when (cursorShape) { + CursorShape.DEFAULT -> "default" + CursorShape.TEXT -> "text" + CursorShape.CROSSHAIR -> "crosshair" + CursorShape.HAND -> "pointer" + CursorShape.NOT_ALLOWED -> "not-allowed" + CursorShape.RESIZE_E -> "ew-resize" + CursorShape.RESIZE_W -> "ew-resize" + CursorShape.RESIZE_N -> "ns-resize" + CursorShape.RESIZE_S -> "ns-resize" + CursorShape.RESIZE_NW -> "nwse-resize" + CursorShape.RESIZE_SE -> "nwse-resize" + CursorShape.RESIZE_NE -> "nesw-resize" + CursorShape.RESIZE_SW -> "nesw-resize" + CursorShape.MOVE -> "move" + } + currentCursorShape = cursorShape + } + } + + fun onContextCreated(ctx: WasmContext) { + installInputHandlers(ctx.window.canvas) + } + + private fun installInputHandlers(canvas: HTMLCanvasElement) { + installMouseHandlers(canvas) + installTouchHandlers(canvas) + installGamepadHandlers() + + navigator.getGamepads()?.let { gamepads -> + for (i in 0 until gamepads.length) { + gamepads[i]?.let { ControllerInput.addController(ControllerWeb(it)) } + } + } + + if (KoolSystem.configWasm.isGlobalKeyEventGrabbing) { + document.onkeydown = { ev -> handleKeyDown(ev) } + document.onkeyup = { ev -> handleKeyUp(ev) } + } else { + canvas.onkeydown = { ev -> handleKeyDown(ev) } + canvas.onkeyup = { ev -> handleKeyUp(ev) } + } + } + + private fun installMouseHandlers(canvas: HTMLCanvasElement) { + // install mouse handlers + canvas.onmousemove = { ev -> + val bounds = canvas.getBoundingClientRect() + if (PointerLockState.hasPointerLock) { + // on active pointer lock, mouse event position is constant and only deltas are reported + // -> use deltas to compute a virtual unbounded pointer position + virtualPointerPos.x += getMovementX(ev).toDouble() * pixelRatio + virtualPointerPos.y += getMovementY(ev).toDouble() * pixelRatio + } else { + virtualPointerPos.x = (ev.clientX * pixelRatio - bounds.left) + virtualPointerPos.y = (ev.clientY * pixelRatio - bounds.top) + } + PointerInput.handleMouseMove(virtualPointerPos.x.toFloat(), virtualPointerPos.y.toFloat()) + } + canvas.onmousedown = { ev -> + PointerLockState.checkLockState() + val changeMask = ev.buttons.toInt() and mouseButtonState.inv() + mouseButtonState = ev.buttons.toInt() + for (btn in 0..7) { + if (changeMask and (1 shl btn) != 0) { + PointerInput.handleMouseButtonEvent(btn, true) + } + } + } + canvas.onmouseup = { ev -> + val changeMask = ev.buttons.toInt().inv() and mouseButtonState + mouseButtonState = ev.buttons.toInt() + for (btn in 0..7) { + if (changeMask and (1 shl btn) != 0) { + PointerInput.handleMouseButtonEvent(btn, false) + } + } + } + canvas.onmouseleave = { PointerInput.handleMouseExit() } + canvas.onwheel = { ev -> + // scroll amount is browser dependent, try to norm it to roughly 1.0 ticks per mouse scroll wheel tick + var yTicks = -ev.deltaY.toFloat() / 3f + var xTicks = -ev.deltaX.toFloat() / 3f + if (ev.deltaMode == 0) { + // scroll delta is specified in pixels... + yTicks /= 30f + xTicks /= 30f + } + PointerInput.handleMouseScroll(xTicks, yTicks) + ev.preventDefault() + } + + document.addEventListener("pointerlockchange", { PointerLockState.onPointerLockChange(canvas) }, false) + } + + private fun installTouchHandlers(canvas: HTMLCanvasElement) { + // install touch handlers + canvas.addEventListener("touchstart", { ev -> + ev.preventDefault() + val changedTouches = (ev as TouchEvent).changedTouches + for (i in 0 until changedTouches.length) { + changedTouches.item(i)?.let { touch -> + PointerInput.handleTouchStart(touch.identifier, touch.elementX, touch.elementY) + } + } + }, false) + canvas.addEventListener("touchend", { ev -> + ev.preventDefault() + val changedTouches = (ev as TouchEvent).changedTouches + for (i in 0 until changedTouches.length) { + changedTouches.item(i)?.let { touch -> + PointerInput.handleTouchEnd(touch.identifier) + } + } + }, false) + canvas.addEventListener("touchcancel", { ev -> + ev.preventDefault() + val changedTouches = (ev as TouchEvent).changedTouches + for (i in 0 until changedTouches.length) { + changedTouches.item(i)?.let { touch -> + PointerInput.handleTouchCancel(touch.identifier) + } + } + }, false) + canvas.addEventListener("touchmove", { ev -> + ev.preventDefault() + val changedTouches = (ev as TouchEvent).changedTouches + for (i in 0 until changedTouches.length) { + changedTouches.item(i)?.let { touch -> + PointerInput.handleTouchMove(touch.identifier, touch.elementX, touch.elementY) + } + } + }, false) + } + + private fun installGamepadHandlers() { + window.addEventListener("gamepadconnected", { ev -> + val gamepad = (ev as GamepadEvent).gamepad + ControllerInput.addController(ControllerWeb(gamepad)) + }) + window.addEventListener("gamepaddisconnected", { ev -> + val gamepad = (ev as GamepadEvent).gamepad + ControllerInput.removeController(gamepad.index) + }) + logD { "installed gamepad listeners" } + } + + private fun handleKeyDown(ev: KeyboardEvent) { + if (ev.metaKey && "MetaLeft" in excludedKeyCodes) return + + val keyCode = ev.toKeyCode() + val localKeyCode = ev.toLocalKeyCode() + var mods = 0 + if (keyCode.code != 0 || localKeyCode.code != 0) { + if (ev.altKey) mods = mods or KeyboardInput.KEY_MOD_ALT + if (ev.ctrlKey) mods = mods or KeyboardInput.KEY_MOD_CTRL + if (ev.shiftKey) mods = mods or KeyboardInput.KEY_MOD_SHIFT + if (ev.metaKey) mods = mods or KeyboardInput.KEY_MOD_SUPER + + var event = KeyboardInput.KEY_EV_DOWN + if (ev.repeat) { + event = event or KeyboardInput.KEY_EV_REPEATED + } + KeyboardInput.handleKeyEvent(KeyEvent(keyCode, localKeyCode, event, mods)) + } + // do not issue an charType() if a modifier key is down (e.g. Ctrl+C), Shift is fine however (it's just + // a capital letter then...) + if (ev.key.length == 1 && (mods and KeyboardInput.KEY_MOD_SHIFT.inv()) == 0) { + KeyboardInput.handleCharTyped(ev.key[0]) + } + + if (ev.code !in excludedKeyCodes) { + ev.preventDefault() + } + } + + private fun handleKeyUp(ev: KeyboardEvent) { + if (ev.metaKey && "MetaLeft" in excludedKeyCodes) return + + val keyCode = ev.toKeyCode() + val localKeyCode = ev.toLocalKeyCode() + if (keyCode.code != 0 || localKeyCode.code != 0) { + var mods = 0 + if (ev.altKey) mods = mods or KeyboardInput.KEY_MOD_ALT + if (ev.ctrlKey) mods = mods or KeyboardInput.KEY_MOD_CTRL + if (ev.shiftKey) mods = mods or KeyboardInput.KEY_MOD_SHIFT + if (ev.metaKey) mods = mods or KeyboardInput.KEY_MOD_SUPER + KeyboardInput.handleKeyEvent(KeyEvent(keyCode, localKeyCode, KeyboardInput.KEY_EV_UP, mods)) + } + + if (ev.code !in excludedKeyCodes) { + ev.preventDefault() + } + } + + private fun KeyboardEvent.toLocalKeyCode(): LocalKeyCode { + val specialKey = KEY_CODE_MAP[code] + return if (specialKey != null) { + LocalKeyCode(specialKey.code, specialKey.name) + } else { + when (key.length) { + 1 -> LocalKeyCode(key[0].uppercaseChar().code) + else -> LocalKeyCode(0) + } + } + } + + private fun KeyboardEvent.toKeyCode(): UniversalKeyCode { + return KEY_CODE_MAP[code] ?: when (key.length) { + 1 -> UniversalKeyCode(key[0].uppercaseChar().code) + else -> UniversalKeyCode(0) + } + } + + private val Touch.elementX: Float + get() = (clientX * pixelRatio - ((target as? HTMLCanvasElement)?.clientLeft?.toDouble() ?: 0.0)).toFloat() + + private val Touch.elementY: Float + get() = (clientY * pixelRatio - ((target as? HTMLCanvasElement)?.clientTop?.toDouble() ?: 0.0)).toFloat() + + val KEY_CODE_MAP: Map = mutableMapOf( + "ControlLeft" to KeyboardInput.KEY_CTRL_LEFT, + "ControlRight" to KeyboardInput.KEY_CTRL_RIGHT, + "ShiftLeft" to KeyboardInput.KEY_SHIFT_LEFT, + "ShiftRight" to KeyboardInput.KEY_SHIFT_RIGHT, + "AltLeft" to KeyboardInput.KEY_ALT_LEFT, + "AltRight" to KeyboardInput.KEY_ALT_RIGHT, + "MetaLeft" to KeyboardInput.KEY_SUPER_LEFT, + "MetaRight" to KeyboardInput.KEY_SUPER_RIGHT, + "Escape" to KeyboardInput.KEY_ESC, + "ContextMenu" to KeyboardInput.KEY_MENU, + "Enter" to KeyboardInput.KEY_ENTER, + "NumpadEnter" to KeyboardInput.KEY_NP_ENTER, + "NumpadDivide" to KeyboardInput.KEY_NP_DIV, + "NumpadMultiply" to KeyboardInput.KEY_NP_MUL, + "NumpadAdd" to KeyboardInput.KEY_NP_PLUS, + "NumpadSubtract" to KeyboardInput.KEY_NP_MINUS, + "NumpadDecimal" to KeyboardInput.KEY_NP_DECIMAL, + "Backspace" to KeyboardInput.KEY_BACKSPACE, + "Tab" to KeyboardInput.KEY_TAB, + "Delete" to KeyboardInput.KEY_DEL, + "Insert" to KeyboardInput.KEY_INSERT, + "Home" to KeyboardInput.KEY_HOME, + "End" to KeyboardInput.KEY_END, + "PageUp" to KeyboardInput.KEY_PAGE_UP, + "PageDown" to KeyboardInput.KEY_PAGE_DOWN, + "ArrowLeft" to KeyboardInput.KEY_CURSOR_LEFT, + "ArrowRight" to KeyboardInput.KEY_CURSOR_RIGHT, + "ArrowUp" to KeyboardInput.KEY_CURSOR_UP, + "ArrowDown" to KeyboardInput.KEY_CURSOR_DOWN, + "F1" to KeyboardInput.KEY_F1, + "F2" to KeyboardInput.KEY_F2, + "F3" to KeyboardInput.KEY_F3, + "F4" to KeyboardInput.KEY_F4, + "F5" to KeyboardInput.KEY_F5, + "F6" to KeyboardInput.KEY_F6, + "F7" to KeyboardInput.KEY_F7, + "F8" to KeyboardInput.KEY_F8, + "F9" to KeyboardInput.KEY_F9, + "F10" to KeyboardInput.KEY_F10, + "F11" to KeyboardInput.KEY_F11, + "F12" to KeyboardInput.KEY_F12, + "Space" to UniversalKeyCode(' ') + ) + + private object PointerLockState { + var hasPointerLock = false + var isApiExitRequest = false + + var cursorMode = CursorMode.NORMAL + set(value) { + field = value + when (value) { + CursorMode.NORMAL -> exitPointerLock() + CursorMode.LOCKED -> requestPointerLock(WasmImpl.canvas) + } + } + + @Suppress("UNUSED_PARAMETER") + fun requestPointerLock(canvas: HTMLCanvasElement) { + if (!hasPointerLock) { + requestCanvasPointerLock(canvas) + } + } + + fun exitPointerLock() { + if (hasPointerLock) { + isApiExitRequest = true + exitCanvasPointerLock() + } + } + + @Suppress("UNUSED_PARAMETER") + fun onPointerLockChange(canvas: HTMLCanvasElement) { + hasPointerLock = hasCanvasPointerLock(canvas).toBoolean() + if (!hasPointerLock && !isApiExitRequest) { + // we lost pointer lock without requesting it via api -> user requested it by hitting the esc key + // report an esc key-event, so the application can react on it + logT { "pointer lock exited by user" } + KeyboardInput.handleKeyEvent(KeyEvent(KeyboardInput.KEY_ESC, KeyboardInput.KEY_ESC, KeyboardInput.KEY_EV_DOWN, 0)) + KeyboardInput.handleKeyEvent(KeyEvent(KeyboardInput.KEY_ESC, KeyboardInput.KEY_ESC, KeyboardInput.KEY_EV_UP, 0)) + } + isApiExitRequest = false + } + + fun checkLockState() { + if (cursorMode == CursorMode.LOCKED && !hasPointerLock) { + // previous attempt to requestPointerLock() has failed, re-request it on user interaction + requestPointerLock(WasmImpl.canvas) + } + } + } +} + +external class GamepadEvent : Event, JsAny { + val gamepad: Gamepad +} + +private fun getMovementX(ev: MouseEvent): JsNumber = js("ev.movementX") +private fun getMovementY(ev: MouseEvent): JsNumber = js("ev.movementY") +private fun requestCanvasPointerLock(canvas: HTMLCanvasElement): JsAny = js("canvas.requestPointerLock()") +private fun exitCanvasPointerLock(): JsAny = js("document.exitPointerLock()") +private fun hasCanvasPointerLock(canvas: HTMLCanvasElement): JsBoolean = js("document.pointerLockElement === canvas") \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/FileSystem.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/FileSystem.wasmJs.kt new file mode 100644 index 000000000..aa1b36f49 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/FileSystem.wasmJs.kt @@ -0,0 +1,95 @@ +package de.fabmax.kool.modules.filesystem + +import de.fabmax.kool.platform.JsZip +import de.fabmax.kool.platform.ZipObject +import de.fabmax.kool.platform.asyncU8 +import de.fabmax.kool.util.Uint8Buffer +import de.fabmax.kool.util.Uint8BufferImpl +import kotlinx.browser.window +import kotlinx.coroutines.await +import org.khronos.webgl.Uint8Array +import org.w3c.fetch.Response +import org.w3c.files.Blob + +actual suspend fun zipFileSystem(path: String): FileSystem { + val zipFetch: Response = window.fetch(path).await() + check(zipFetch.ok) + val zipBlob: Blob = zipFetch.blob().await() + val zip: JsZip = JsZip().loadAsync(zipBlob).await() + return ZipFileSytem(zip) +} + +actual suspend fun zipFileSystem(zipData: Uint8Buffer): FileSystem { + val zip: JsZip = JsZip().loadAsync((zipData as Uint8BufferImpl).buffer).await() + return ZipFileSytem(zip) +} + +class ZipFileSytem(zip: JsZip) : FileSystem { + + override val root: FileSystemDirectory = Directory("/") + private val fsItems = mutableMapOf("/" to root) + + init { + zip.forEach { relativePath, zipObj -> + if (!zipObj.dir) { + val path = FileSystem.sanitizePath(relativePath) + makeParentDirs(path) + val file = File(path, zipObj) + fsItems[file.path] = file + } + fsItems.values.filter { it != root }.forEach { (it.parent as Directory).items[it.name] = it } + } + } + + private fun makeParentDirs(path: String) { + path.substringBeforeLast("/").split("/") + .filter { it.isNotEmpty() } + .fold(root as Directory) { parent, name -> + parent.items.getOrPut(name) { + val newDir = Directory(FileSystem.sanitizePath("${parent.path}/${name}")) + fsItems[newDir.path] = newDir + newDir + } as Directory + } + } + + override fun listAll(): List = fsItems.values.toList().sortedBy { it.path } + + override fun get(path: String): FileSystemItem { + val sanitized = FileSystem.sanitizePath(path) + return checkNotNull(fsItems[sanitized]) { "File not found: $sanitized" } + } + + override fun contains(path: String): Boolean = FileSystem.sanitizePath(path) in fsItems + + override fun addFileSystemWatcher(listener: FileSystemWatcher) { + // zip file system will never change, no need to keep any listeners around + } + + override fun removeFileSystemWatcher(listener: FileSystemWatcher) { } + + private inner class Directory(override val path: String): FileSystemDirectory { + override val parent: FileSystemDirectory? + get() = this@ZipFileSytem.getDirectoryOrNull(FileSystem.parentPath(path)) + + val items = mutableMapOf() + + override fun list(): List = items.values.toList().sortedBy { it.path } + + override fun getChildOrNull(name: String): FileSystemItem? = items[name] + override fun contains(name: String): Boolean = name in items + } + + private inner class File(override val path: String, val zipEntry: ZipObject): FileSystemFile { + override val parent: FileSystemDirectory? + get() = this@ZipFileSytem.getDirectoryOrNull(FileSystem.parentPath(path)) + + override val size: Long + get() = -1L + + override suspend fun read(): Uint8Buffer { + val data: Uint8Array = zipEntry.asyncU8().await() + return Uint8BufferImpl(data) + } + } +} diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/FileSystemAssetLoaderWasm.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/FileSystemAssetLoaderWasm.kt new file mode 100644 index 000000000..0de9f0539 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/FileSystemAssetLoaderWasm.kt @@ -0,0 +1,60 @@ +package de.fabmax.kool.modules.filesystem + +import de.fabmax.kool.* +import de.fabmax.kool.modules.audio.AudioClipImpl +import de.fabmax.kool.pipeline.BufferedImageData2d +import de.fabmax.kool.platform.ImageAtlasTextureData +import de.fabmax.kool.platform.ImageTextureData +import de.fabmax.kool.util.Uint8BufferImpl +import kotlinx.browser.window +import kotlinx.coroutines.await +import org.w3c.dom.ImageBitmap +import org.w3c.dom.url.URL +import org.w3c.files.Blob + +class FileSystemAssetLoaderWasm(baseDir: FileSystemDirectory) : FileSystemAssetLoader(baseDir) { + override suspend fun loadImageAtlas(ref: AssetRef.ImageAtlas): LoadedAsset.ImageAtlas { + val result = loadData(ref.path).mapCatching { texData -> + val bytes = (texData as Uint8BufferImpl).buffer + val parts = JsArray() + parts[0] = bytes + val imgBlob = Blob(parts) + val bmp: ImageBitmap = window.createImageBitmap(imgBlob, ImageBitmapOptions(ref.resolveSize)).await() + ImageAtlasTextureData( + image = bmp, + tilesX = ref.tilesX, + tilesY = ref.tilesY, + id = trimAssetPath(ref.path), + format = ref.format + ) + } + return LoadedAsset.ImageAtlas(ref, result) + } + + override suspend fun loadBufferedImage2d(ref: AssetRef.BufferedImage2d): LoadedAsset.BufferedImage2d { + val imageBuffer = loadData(ref.path).mapCatching { data -> + val mime = MimeType.forFileName(ref.path) + val texData = PlatformAssetsImpl.loadImageFromBuffer(data, mime, ref.format, ref.resolveSize) + BufferedImageData2d( + ImageTextureData.imageBitmapToBuffer(texData.data, ref.format, ref.resolveSize), + texData.width, + texData.height, + ref.format, + trimAssetPath(ref.path) + ) + } + return LoadedAsset.BufferedImage2d(ref, imageBuffer) + } + + override suspend fun loadAudio(ref: AssetRef.Audio): LoadedAsset.Audio { + val clip = loadData(ref.path).mapCatching { audioData -> + val bytes = (audioData as Uint8BufferImpl).buffer + val parts = JsArray() + parts[0] = bytes + val audioBlob = Blob(parts) + val url = URL.createObjectURL(audioBlob) + AudioClipImpl(url) + } + return LoadedAsset.Audio(ref, clip) + } +} diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/InMemoryFileSystem.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/InMemoryFileSystem.wasmJs.kt new file mode 100644 index 000000000..37b4f207b --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/modules/filesystem/InMemoryFileSystem.wasmJs.kt @@ -0,0 +1,15 @@ +package de.fabmax.kool.modules.filesystem + +import de.fabmax.kool.platform.JsZip +import de.fabmax.kool.platform.generate +import de.fabmax.kool.util.Uint8Buffer +import de.fabmax.kool.util.Uint8BufferImpl + +actual suspend fun InMemoryFileSystem.toZip(): Uint8Buffer { + val zip = JsZip() + listAll().filterIsInstance().forEach { file -> + val data = (file.read() as Uint8BufferImpl).buffer + zip.file(file.path.removePrefix("/"), data) + } + return zip.generate() +} \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/GlImpl.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/GlImpl.kt new file mode 100644 index 000000000..3ca8f1237 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/GlImpl.kt @@ -0,0 +1,527 @@ +package de.fabmax.kool.pipeline.backend.gl + +import de.fabmax.kool.pipeline.* +import de.fabmax.kool.platform.ImageAtlasTextureData +import de.fabmax.kool.platform.ImageTextureData +import de.fabmax.kool.toIntArray +import de.fabmax.kool.toJsArray +import de.fabmax.kool.toUint32Array +import de.fabmax.kool.util.* +import org.khronos.webgl.* + +object GlImpl : GlApi { + lateinit var gl: WebGL2RenderingContext + private set + + private var clipControlExt: EXT_clip_control? = null + + override val ARRAY_BUFFER = WebGLRenderingContext.ARRAY_BUFFER + override val BACK = WebGLRenderingContext.BACK + override val BLEND = WebGLRenderingContext.BLEND + override val CLAMP_TO_EDGE = WebGLRenderingContext.CLAMP_TO_EDGE + override val COLOR = WebGL2RenderingContext.COLOR + override val COLOR_ATTACHMENT0 = WebGLRenderingContext.COLOR_ATTACHMENT0 + override val COLOR_BUFFER_BIT = WebGLRenderingContext.COLOR_BUFFER_BIT + override val COMPARE_REF_TO_TEXTURE = WebGL2RenderingContext.COMPARE_REF_TO_TEXTURE + override val COMPILE_STATUS = WebGLRenderingContext.COMPILE_STATUS + override val COMPUTE_SHADER: Int get() = notSupported("COMPUTE_SHADER") + override val CULL_FACE = WebGLRenderingContext.CULL_FACE + override val DEPTH_ATTACHMENT = WebGLRenderingContext.DEPTH_ATTACHMENT + override val DEPTH_BUFFER_BIT = WebGLRenderingContext.DEPTH_BUFFER_BIT + override val DEPTH_COMPONENT24 = WebGL2RenderingContext.DEPTH_COMPONENT24 + override val DEPTH_COMPONENT32F = WebGL2RenderingContext.DEPTH_COMPONENT32F + override val DEPTH_COMPONENT = WebGL2RenderingContext.DEPTH_COMPONENT + override val DEPTH_TEST = WebGLRenderingContext.DEPTH_TEST + override val DRAW_FRAMEBUFFER = WebGL2RenderingContext.DRAW_FRAMEBUFFER + override val DYNAMIC_DRAW = WebGLRenderingContext.DYNAMIC_DRAW + override val ELEMENT_ARRAY_BUFFER = WebGLRenderingContext.ELEMENT_ARRAY_BUFFER + override val FRAGMENT_SHADER = WebGLRenderingContext.FRAGMENT_SHADER + override val FRAMEBUFFER = WebGLRenderingContext.FRAMEBUFFER + override val FRAMEBUFFER_COMPLETE = WebGLRenderingContext.FRAMEBUFFER_COMPLETE + override val FRONT = WebGLRenderingContext.FRONT + override val INVALID_INDEX = WebGL2RenderingContext.INVALID_INDEX + override val LINEAR = WebGLRenderingContext.LINEAR + override val LINEAR_MIPMAP_LINEAR = WebGLRenderingContext.LINEAR_MIPMAP_LINEAR + override val LINES = WebGLRenderingContext.LINES + override val LINK_STATUS = WebGLRenderingContext.LINK_STATUS + override val MIRRORED_REPEAT = WebGLRenderingContext.MIRRORED_REPEAT + override val NEAREST = WebGLRenderingContext.NEAREST + override val NEAREST_MIPMAP_NEAREST = WebGLRenderingContext.NEAREST_MIPMAP_NEAREST + override val NONE = WebGLRenderingContext.NONE + override val ONE = WebGLRenderingContext.ONE + override val ONE_MINUS_SRC_ALPHA = WebGLRenderingContext.ONE_MINUS_SRC_ALPHA + override val POINTS = WebGLRenderingContext.POINTS + override val QUERY_RESULT: Int = WebGL2RenderingContext.QUERY_RESULT + override val QUERY_RESULT_AVAILABLE: Int = WebGL2RenderingContext.QUERY_RESULT_AVAILABLE + override val READ_FRAMEBUFFER = WebGL2RenderingContext.READ_FRAMEBUFFER + override val READ_ONLY: Int get() = notSupported("READ_ONLY") + override val READ_WRITE: Int get() = notSupported("READ_WRITE") + override val RENDERBUFFER = WebGLRenderingContext.RENDERBUFFER + override val REPEAT = WebGLRenderingContext.REPEAT + override val SAMPLES = WebGLRenderingContext.SAMPLES + override val SCISSOR_TEST = WebGLRenderingContext.SCISSOR_TEST + override val SHADER_STORAGE_BUFFER: Int get() = notSupported("SHADER_STORAGE_BUFFER") + override val SRC_ALPHA = WebGLRenderingContext.SRC_ALPHA + override val STATIC_DRAW = WebGLRenderingContext.STATIC_DRAW + override val TEXTURE_1D: Int get() = notSupported("TEXTURE_1D") + override val TEXTURE_2D = WebGLRenderingContext.TEXTURE_2D + override val TEXTURE_2D_ARRAY: Int = WebGL2RenderingContext.TEXTURE_2D_ARRAY + override val TEXTURE_3D = WebGL2RenderingContext.TEXTURE_3D + override val TEXTURE_BASE_LEVEL = WebGL2RenderingContext.TEXTURE_BASE_LEVEL + override val TEXTURE_COMPARE_MODE = WebGL2RenderingContext.TEXTURE_COMPARE_MODE + override val TEXTURE_COMPARE_FUNC = WebGL2RenderingContext.TEXTURE_COMPARE_FUNC + override val TEXTURE_CUBE_MAP = WebGLRenderingContext.TEXTURE_CUBE_MAP + override val TEXTURE_CUBE_MAP_ARRAY: Int get() = notSupported("TEXTURE_CUBE_MAP_ARRAY") + override val TEXTURE_CUBE_MAP_POSITIVE_X = WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_X + override val TEXTURE_CUBE_MAP_NEGATIVE_X = WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_X + override val TEXTURE_CUBE_MAP_POSITIVE_Y = WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_Y + override val TEXTURE_CUBE_MAP_NEGATIVE_Y = WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_Y + override val TEXTURE_CUBE_MAP_POSITIVE_Z = WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_Z + override val TEXTURE_CUBE_MAP_NEGATIVE_Z = WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_Z + override val TEXTURE_MAG_FILTER = WebGLRenderingContext.TEXTURE_MAG_FILTER + override val TEXTURE_MAX_LOD = WebGL2RenderingContext.TEXTURE_MAX_LOD + override val TEXTURE_MAX_LEVEL = WebGL2RenderingContext.TEXTURE_MAX_LEVEL + override val TEXTURE_MIN_FILTER = WebGLRenderingContext.TEXTURE_MIN_FILTER + override val TEXTURE_MIN_LOD = WebGL2RenderingContext.TEXTURE_MIN_LOD + override val TEXTURE_WRAP_R = WebGL2RenderingContext.TEXTURE_WRAP_R + override val TEXTURE_WRAP_S = WebGLRenderingContext.TEXTURE_WRAP_S + override val TEXTURE_WRAP_T = WebGLRenderingContext.TEXTURE_WRAP_T + override val TEXTURE0 = WebGLRenderingContext.TEXTURE0 + override val TIME_ELAPSED: Int get() = notSupported("TIME_ELAPSED") + override val TIMESTAMP: Int get() = notSupported("TIMESTAMP") + override val TRIANGLES = WebGLRenderingContext.TRIANGLES + override val TRIANGLE_STRIP = WebGLRenderingContext.TRIANGLE_STRIP + override val TRUE = true.toJsBoolean() + override val UNIFORM_BLOCK_DATA_SIZE = WebGL2RenderingContext.UNIFORM_BLOCK_DATA_SIZE + override val UNIFORM_BUFFER = WebGL2RenderingContext.UNIFORM_BUFFER + override val UNIFORM_OFFSET = WebGL2RenderingContext.UNIFORM_OFFSET + override val VERTEX_SHADER = WebGLRenderingContext.VERTEX_SHADER + override val WRITE_ONLY: Int get() = notSupported("WRITE_ONLY") + + override val INT = WebGLRenderingContext.INT + override val FLOAT = WebGLRenderingContext.FLOAT + override val UNSIGNED_BYTE = WebGLRenderingContext.UNSIGNED_BYTE + override val UNSIGNED_INT = WebGLRenderingContext.UNSIGNED_INT + + override val RED = WebGL2RenderingContext.RED + override val RG = WebGL2RenderingContext.RG + override val RGB = WebGLRenderingContext.RGB + override val RGBA = WebGLRenderingContext.RGBA + override val RED_INTEGER = WebGL2RenderingContext.RED_INTEGER + override val RG_INTEGER = WebGL2RenderingContext.RG_INTEGER + override val RGB_INTEGER = WebGL2RenderingContext.RGB_INTEGER + override val RGBA_INTEGER = WebGL2RenderingContext.RGBA_INTEGER + + override val R8 = WebGL2RenderingContext.R8 + override val RG8 = WebGL2RenderingContext.RG8 + override val RGB8 = WebGL2RenderingContext.RGB8 + override val RGBA8 = WebGL2RenderingContext.RGBA8 + override val R16F = WebGL2RenderingContext.R16F + override val RG16F = WebGL2RenderingContext.RG16F + override val RGB16F = WebGL2RenderingContext.RGB16F + override val RGBA16F = WebGL2RenderingContext.RGBA16F + override val R32F = WebGL2RenderingContext.R32F + override val RG32F = WebGL2RenderingContext.RG32F + override val RGB32F = WebGL2RenderingContext.RGB32F + override val RGBA32F = WebGL2RenderingContext.RGBA32F + override val R32I = WebGL2RenderingContext.R32I + override val RG32I = WebGL2RenderingContext.RG32I + override val RGB32I = WebGL2RenderingContext.RGB32I + override val RGBA32I = WebGL2RenderingContext.RGBA32I + override val R32UI = WebGL2RenderingContext.R32UI + override val RG32UI = WebGL2RenderingContext.RG32UI + override val RGB32UI = WebGL2RenderingContext.RGB32UI + override val RGBA32UI = WebGL2RenderingContext.RGBA32UI + override val R11F_G11F_B10F = WebGL2RenderingContext.R11F_G11F_B10F + + override val ALWAYS = WebGLRenderingContext.ALWAYS + override val NEVER = WebGLRenderingContext.NEVER + override val LESS = WebGLRenderingContext.LESS + override val LEQUAL = WebGLRenderingContext.LEQUAL + override val GREATER = WebGLRenderingContext.GREATER + override val GEQUAL = WebGLRenderingContext.GEQUAL + override val EQUAL = WebGLRenderingContext.EQUAL + override val NOTEQUAL = WebGLRenderingContext.NOTEQUAL + + override val VERTEX_ATTRIB_ARRAY_BARRIER_BIT: Int get() = notSupported("VERTEX_ATTRIB_ARRAY_BARRIER_BIT") + override val ELEMENT_ARRAY_BARRIER_BIT: Int get() = notSupported("ELEMENT_ARRAY_BARRIER_BIT") + override val UNIFORM_BARRIER_BIT: Int get() = notSupported("UNIFORM_BARRIER_BIT") + override val TEXTURE_FETCH_BARRIER_BIT: Int get() = notSupported("TEXTURE_FETCH_BARRIER_BIT") + override val SHADER_IMAGE_ACCESS_BARRIER_BIT: Int get() = notSupported("SHADER_IMAGE_ACCESS_BARRIER_BIT") + override val COMMAND_BARRIER_BIT: Int get() = notSupported("COMMAND_BARRIER_BIT") + override val PIXEL_BUFFER_BARRIER_BIT: Int get() = notSupported("PIXEL_BUFFER_BARRIER_BIT") + override val TEXTURE_UPDATE_BARRIER_BIT: Int get() = notSupported("TEXTURE_UPDATE_BARRIER_BIT") + override val BUFFER_UPDATE_BARRIER_BIT: Int get() = notSupported("BUFFER_UPDATE_BARRIER_BIT") + override val CLIENT_MAPPED_BUFFER_BARRIER_BIT: Int get() = notSupported("CLIENT_MAPPED_BUFFER_BARRIER_BIT") + override val FRAMEBUFFER_BARRIER_BIT: Int get() = notSupported("FRAMEBUFFER_BARRIER_BIT") + override val TRANSFORM_FEEDBACK_BARRIER_BIT: Int get() = notSupported("TRANSFORM_FEEDBACK_BARRIER_BIT") + override val ATOMIC_COUNTER_BARRIER_BIT: Int get() = notSupported("ATOMIC_COUNTER_BARRIER_BIT") + override val SHADER_STORAGE_BARRIER_BIT: Int get() = notSupported("SHADER_STORAGE_BARRIER_BIT") + override val QUERY_BUFFER_BARRIER_BIT: Int get() = notSupported("QUERY_BUFFER_BARRIER_BIT") + + override val DEFAULT_FRAMEBUFFER: GlFramebuffer = GlFramebuffer(-1) + override val NULL_BUFFER: GlBuffer = GlBuffer(-1) + override val NULL_TEXTURE: GlTexture = GlTexture(-1) + override val NULL_VAO: GlVertexArrayObject = GlVertexArrayObject(-1) + + override var TEXTURE_MAX_ANISOTROPY_EXT = 0 + private set + + override var LOWER_LEFT = 0 + private set + override var NEGATIVE_ONE_TO_ONE = 0 + private set + override var UPPER_LEFT = 0 + private set + override var ZERO_TO_ONE = 0 + private set + + override val version = GlApiVersion(2, 0, GlFlavor.WebGL, "WebGL") + + override lateinit var capabilities: GlCapabilities + private set + + private val buffers = WebGlObjList( + factory = { gl.createBuffer() }, + deleter = { gl.deleteBuffer(it) } + ) + private val framebuffers = WebGlObjList( + factory = { gl.createFramebuffer() }, + deleter = { gl.deleteFramebuffer(it) } + ) + private val queries = WebGlObjList( + factory = { gl.createQuery() }, + deleter = { gl.deleteQuery(it) } + ) + private val programs = WebGlObjList( + factory = { ProgramInfo(gl.createProgram()) }, + deleter = { gl.deleteProgram(it?.webGl) } + ) + private val renderbuffers = WebGlObjList( + factory = { gl.createRenderbuffer() }, + deleter = { gl.deleteRenderbuffer(it) } + ) + private val shaders = WebGlObjList( + factory = { gl.createShader(it) }, + deleter = { gl.deleteShader(it) } + ) + private val textures = WebGlObjList( + factory = { gl.createTexture() }, + deleter = { gl.deleteTexture(it) } + ) + private val vaos = WebGlObjList( + factory = { gl.createVertexArray() }, + deleter = { gl.deleteVertexArray(it) } + ) + + private var activeProgram: ProgramInfo? = null + + private val GlBuffer.webGl: WebGLBuffer? get() = buffers[handle] + private val GlFramebuffer.webGl: WebGLFramebuffer? get() = framebuffers[handle] + private val GlProgram.webGl: WebGLProgram? get() = programs[handle]?.webGl + private val GlQuery.webGl: WebGLQuery? get() = queries[handle] + private val GlRenderbuffer.webGl: WebGLRenderbuffer? get() = renderbuffers[handle] + private val GlShader.webGl: WebGLShader? get() = shaders[handle] + private val GlTexture.webGl: WebGLTexture? get() = textures[handle] + private val GlVertexArrayObject.webGl: WebGLVertexArrayObject? get() = vaos[handle] + private val Int.webGlUniformLoc: WebGLUniformLocation? get() = activeProgram?.uniformLocations?.getOrNull(this) + + override fun activeTexture(texture: Int) = gl.activeTexture(texture) + override fun attachShader(program: GlProgram, shader: GlShader) = gl.attachShader(program.webGl, shader.webGl) + override fun beginQuery(target: Int, query: GlQuery) = gl.beginQuery(target, query.webGl) + override fun bindBuffer(target: Int, buffer: GlBuffer) = gl.bindBuffer(target, buffer.webGl) + override fun bindBufferBase(target: Int, index: Int, buffer: GlBuffer) = gl.bindBufferBase(target, index, buffer.webGl) + override fun bindFramebuffer(target: Int, framebuffer: GlFramebuffer) = gl.bindFramebuffer(target, framebuffer.webGl) + override fun bindImageTexture(unit: Int, texture: GlTexture, level: Int, layered: Boolean, layer: Int, access: Int, format: Int) = notSupported("bindImageTexture") + override fun bindRenderbuffer(target: Int, renderbuffer: GlRenderbuffer) = gl.bindRenderbuffer(target, renderbuffer.webGl) + override fun bindTexture(target: Int, texture: GlTexture) = gl.bindTexture(target, texture.webGl) + override fun bindVertexArray(vao: GlVertexArrayObject) = gl.bindVertexArray(vao.webGl) + override fun blendFunc(sFactor: Int, dFactor: Int) = gl.blendFunc(sFactor, dFactor) + override fun blitFramebuffer(srcX0: Int, srcY0: Int, srcX1: Int, srcY1: Int, dstX0: Int, dstY0: Int, dstX1: Int, dstY1: Int, mask: Int, filter: Int) = gl.blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) + override fun bufferData(target: Int, size: Int, usage: Int) = gl.bufferData(target, size, usage) + override fun bufferData(target: Int, buffer: Uint8Buffer, usage: Int) = gl.bufferData(target, (buffer as Uint8BufferImpl).buffer, usage, 0, buffer.limit) + override fun bufferData(target: Int, buffer: Uint16Buffer, usage: Int) = gl.bufferData(target, (buffer as Uint16BufferImpl).buffer, usage, 0, buffer.limit) + override fun bufferData(target: Int, buffer: Int32Buffer, usage: Int) = gl.bufferData(target, (buffer as Int32BufferImpl).buffer, usage, 0, buffer.limit) + override fun bufferData(target: Int, buffer: Float32Buffer, usage: Int) = gl.bufferData(target, (buffer as Float32BufferImpl).buffer, usage, 0, buffer.limit) + override fun bufferData(target: Int, buffer: MixedBuffer, usage: Int) = gl.bufferData(target, (buffer as MixedBufferImpl).buffer, usage, 0, buffer.limit) + override fun checkFramebufferStatus(target: Int): Int = gl.checkFramebufferStatus(target) + override fun clear(mask: Int) = gl.clear(mask) + override fun clearBufferfv(buffer: Int, drawBuffer: Int, values: Float32Buffer) = gl.clearBufferfv(buffer, drawBuffer, (values as Float32BufferImpl).buffer) + override fun clearColor(r: Float, g: Float, b: Float, a: Float) = gl.clearColor(r, g, b, a) + override fun clearDepth(depth: Float) = gl.clearDepth(depth) + override fun compileShader(shader: GlShader) = gl.compileShader(shader.webGl) + override fun copyTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, x: Int, y: Int, width: Int, height: Int) = gl.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) + override fun createBuffer(): GlBuffer = GlBuffer(buffers.create(Unit)) + override fun createFramebuffer(): GlFramebuffer = GlFramebuffer(framebuffers.create(Unit)) + override fun createProgram(): GlProgram = GlProgram(programs.create(Unit)) + override fun createQuery(): GlQuery = GlQuery(queries.create(Unit)) + override fun createRenderbuffer(): GlRenderbuffer = GlRenderbuffer(renderbuffers.create(Unit)) + override fun createShader(type: Int): GlShader = GlShader(shaders.create(type)) + override fun createTexture(): GlTexture = GlTexture(textures.create(Unit)) + override fun createVertexArray(): GlVertexArrayObject = GlVertexArrayObject(vaos.create(Unit)) + override fun cullFace(mode: Int) = gl.cullFace(mode) + override fun deleteBuffer(buffer: GlBuffer) = buffers.delete(buffer.handle) + override fun deleteFramebuffer(framebuffer: GlFramebuffer) = framebuffers.delete(framebuffer.handle) + override fun deleteProgram(program: GlProgram) = programs.delete(program.handle) + override fun deleteQuery(query: GlQuery) = queries.delete(query.handle) + override fun deleteRenderbuffer(renderbuffer: GlRenderbuffer) = renderbuffers.delete(renderbuffer.handle) + override fun deleteShader(shader: GlShader) = shaders.delete(shader.handle) + override fun deleteTexture(texture: GlTexture) = textures.delete(texture.handle) + override fun deleteVertexArray(vao: GlVertexArrayObject) = vaos.delete(vao.handle) + override fun depthFunc(func: Int) = gl.depthFunc(func) + override fun depthMask(flag: Boolean) = gl.depthMask(flag) + override fun disable(cap: Int) = gl.disable(cap) + override fun disableVertexAttribArray(index: Int) = gl.disableVertexAttribArray(index) + override fun dispatchCompute(numGroupsX: Int, numGroupsY: Int, numGroupsZ: Int) = notSupported("dispatchCompute") + override fun drawBuffers(buffers: IntArray) = gl.drawBuffers(buffers.toUint32Array()) + override fun drawElements(mode: Int, count: Int, type: Int) = gl.drawElements(mode, count, type, 0) + override fun drawElementsInstanced(mode: Int, count: Int, type: Int, instanceCount: Int) = gl.drawElementsInstanced(mode, count, type, 0, instanceCount) + override fun enable(cap: Int) = gl.enable(cap) + override fun enableVertexAttribArray(index: Int) = gl.enableVertexAttribArray(index) + override fun endQuery(target: Int) = gl.endQuery(target) + override fun framebufferRenderbuffer(target: Int, attachment: Int, renderbuffertarget: Int, renderbuffer: GlRenderbuffer) = gl.framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer.webGl) + override fun framebufferTexture2D(target: Int, attachment: Int, textarget: Int, texture: GlTexture, level: Int) = gl.framebufferTexture2D(target, attachment, textarget, texture.webGl, level) + override fun generateMipmap(target: Int) = gl.generateMipmap(target) + override fun getActiveUniformBlockParameter(program: GlProgram, uniformBlockIndex: Int, pName: Int): Int = gl.getActiveUniformBlockParameter(program.webGl, uniformBlockIndex, pName) + override fun getActiveUniforms(program: GlProgram, uniformIndices: IntArray, pName: Int): IntArray = gl.getActiveUniforms(program.webGl, uniformIndices.toUint32Array(), pName).toIntArray() + override fun getError(): Int = gl.getError() + override fun getInteger(pName: Int): Int = (gl.getParameter(pName) as JsNumber).toInt() + override fun getProgramInfoLog(program: GlProgram): String = gl.getProgramInfoLog(program.webGl) ?: "" + override fun getProgramParameter(program: GlProgram, param: Int): Any = gl.getProgramParameter(program.webGl, param) ?: 0 + override fun getQueryParameter(query: GlQuery, param: Int): Any = gl.getQueryParameter(query.webGl, param) + override fun getQueryParameterU64(query: GlQuery, param: Int): Long = 0L + override fun getShaderInfoLog(shader: GlShader): String = gl.getShaderInfoLog(shader.webGl) ?: "" + override fun getShaderParameter(shader: GlShader, param: Int): Any = gl.getShaderParameter(shader.webGl, param) ?: 0 + override fun getUniformBlockIndex(program: GlProgram, uniformBlockName: String): Int = gl.getUniformBlockIndex(program.webGl, uniformBlockName) + override fun getUniformIndices(program: GlProgram, names: Array): IntArray = gl.getUniformIndices(program.webGl, names.toJsArray()).toIntArray() + override fun getUniformLocation(program: GlProgram, uniformName: String): Int = programs[program.handle]?.getUniformLocation(uniformName) ?: -1 + override fun lineWidth(width: Float) = gl.lineWidth(width) + override fun linkProgram(program: GlProgram) = gl.linkProgram(program.webGl) + override fun memoryBarrier(barriers: Int) = notSupported("memoryBarrier") + override fun queryCounter(query: GlQuery, target: Int) = notSupported("queryCounter") + override fun readBuffer(src: Int) = gl.readBuffer(src) + override fun renderbufferStorage(target: Int, internalformat: Int, width: Int, height: Int) = gl.renderbufferStorage(target, internalformat, width, height) + override fun renderbufferStorageMultisample(target: Int, samples: Int, internalformat: Int, width: Int, height: Int) = gl.renderbufferStorageMultisample(target, samples, internalformat, width, height) + override fun scissor(x: Int, y: Int, width: Int, height: Int) = gl.scissor(x, y, width, height) + override fun shaderSource(shader: GlShader, source: String) = gl.shaderSource(shader.webGl, source) + override fun texImage1d(data: ImageData1d) = texImage2dImpl(TEXTURE_2D, data) + override fun texImage2d(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, format: Int, type: Int, pixels: Buffer?) = texImage2dImpl(target, level, internalformat, width, height, border, format, type, pixels) + override fun texImage2d(target: Int, data: ImageData2d) = texImage2dImpl(target, data) + override fun texImage3d(target: Int, data: ImageData3d) = textImage3dImpl(target, data) + override fun texSubImage3d(target: Int, level: Int, xoffset: Int, yoffset: Int, zoffset: Int, width: Int, height: Int, depth: Int, format: Int, type: Int, pixels: ImageData) = texSubImage3dImpl(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) + override fun texParameteri(target: Int, pName: Int, param: Int) = gl.texParameteri(target, pName, param) + override fun texStorage2d(target: Int, levels: Int, internalformat: Int, width: Int, height: Int) = gl.texStorage2D(target, levels, internalformat, width, height) + override fun texStorage3d(target: Int, levels: Int, internalformat: Int, width: Int, height: Int, depth: Int) = gl.texStorage3D(target, levels, internalformat, width, height, depth) + override fun uniformBlockBinding(program: GlProgram, uniformBlockIndex: Int, uniformBlockBinding: Int) = gl.uniformBlockBinding(program.webGl, uniformBlockIndex, uniformBlockBinding) + override fun useProgram(program: GlProgram) = programs[program.handle].let { gl.useProgram(it?.webGl); activeProgram = it } + override fun uniform1f(location: Int, x: Float) = gl.uniform1f(location.webGlUniformLoc, x) + override fun uniform2f(location: Int, x: Float, y: Float) = gl.uniform2f(location.webGlUniformLoc, x, y) + override fun uniform3f(location: Int, x: Float, y: Float, z: Float) = gl.uniform3f(location.webGlUniformLoc, x, y, z) + override fun uniform4f(location: Int, x: Float, y: Float, z: Float, w: Float) = gl.uniform4f(location.webGlUniformLoc, x, y, z, w) + override fun uniform1fv(location: Int, values: Float32Buffer) = gl.uniform1fv(location.webGlUniformLoc, (values as Float32BufferImpl).buffer) + override fun uniform2fv(location: Int, values: Float32Buffer) = gl.uniform2fv(location.webGlUniformLoc, (values as Float32BufferImpl).buffer) + override fun uniform3fv(location: Int, values: Float32Buffer) = gl.uniform3fv(location.webGlUniformLoc, (values as Float32BufferImpl).buffer) + override fun uniform4fv(location: Int, values: Float32Buffer) = gl.uniform4fv(location.webGlUniformLoc, (values as Float32BufferImpl).buffer) + override fun uniform1i(location: Int, x: Int) = gl.uniform1i(location.webGlUniformLoc, x) + override fun uniform2i(location: Int, x: Int, y: Int) = gl.uniform2i(location.webGlUniformLoc, x, y) + override fun uniform3i(location: Int, x: Int, y: Int, z: Int) = gl.uniform3i(location.webGlUniformLoc, x, y, z) + override fun uniform4i(location: Int, x: Int, y: Int, z: Int, w: Int) = gl.uniform4i(location.webGlUniformLoc, x, y, z, w) + override fun uniform1iv(location: Int, values: Int32Buffer) = gl.uniform1iv(location.webGlUniformLoc, (values as Int32BufferImpl).buffer) + override fun uniform2iv(location: Int, values: Int32Buffer) = gl.uniform2iv(location.webGlUniformLoc, (values as Int32BufferImpl).buffer) + override fun uniform3iv(location: Int, values: Int32Buffer) = gl.uniform3iv(location.webGlUniformLoc, (values as Int32BufferImpl).buffer) + override fun uniform4iv(location: Int, values: Int32Buffer) = gl.uniform4iv(location.webGlUniformLoc, (values as Int32BufferImpl).buffer) + override fun uniformMatrix2fv(location: Int, values: Float32Buffer) = gl.uniformMatrix2fv(location.webGlUniformLoc, false, (values as Float32BufferImpl).buffer) + override fun uniformMatrix3fv(location: Int, values: Float32Buffer) = gl.uniformMatrix3fv(location.webGlUniformLoc, false, (values as Float32BufferImpl).buffer) + override fun uniformMatrix4fv(location: Int, values: Float32Buffer) = gl.uniformMatrix4fv(location.webGlUniformLoc, false, (values as Float32BufferImpl).buffer) + override fun vertexAttribDivisor(index: Int, divisor: Int) = gl.vertexAttribDivisor(index, divisor) + override fun vertexAttribIPointer(index: Int, size: Int, type: Int, stride: Int, offset: Int) = gl.vertexAttribIPointer(index, size, type, stride, offset) + override fun vertexAttribPointer(index: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int) = gl.vertexAttribPointer(index, size, type, normalized, stride, offset) + override fun viewport(x: Int, y: Int, width: Int, height: Int) = gl.viewport(x, y, width, height) + + override fun clipControl(origin: Int, depth: Int) { + check(clipControlExt != null) { + "Missing required EXT_clip_control extension" + } + clipControlExt!!.clipControlEXT(origin, depth) + } + + @Suppress("UnsafeCastFromDynamic") + fun initWebGl(glCtx: WebGL2RenderingContext) { + gl = glCtx + + logD { "Supported WebGL extensions:" } + gl.getSupportedExtensions()?.let { + for (i in 0 until it.length) { + logD { "- ${it[i]}" } + } + } + + // by getting the extension, it is automatically enabled, i.e. float formats become usable as texture formats + if (gl.getExtension("EXT_color_buffer_float") == null) { + logE { "WebGL 2 implementation lacks support for float textures (EXT_color_buffer_float)" } + } + + // check for anisotropic filtering support + var maxAnisotropy = 1 + val extAnisotropic: EXT_texture_filter_anisotropic? = + gl.getExtension("EXT_texture_filter_anisotropic")?.unsafeCast() ?: + gl.getExtension("MOZ_EXT_texture_filter_anisotropic")?.unsafeCast() ?: + gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")?.unsafeCast() + if (extAnisotropic != null) { + TEXTURE_MAX_ANISOTROPY_EXT = extAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT + maxAnisotropy = (gl.getParameter(extAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT) as JsNumber).toInt() + } + + clipControlExt = gl.getExtension("EXT_clip_control")?.unsafeCast() + clipControlExt?.let { + LOWER_LEFT = it.LOWER_LEFT_EXT + UPPER_LEFT = it.UPPER_LEFT_EXT + NEGATIVE_ONE_TO_ONE = it.NEGATIVE_ONE_TO_ONE_EXT + ZERO_TO_ONE = it.ZERO_TO_ONE_EXT + } + + val maxTexUnits = (gl.getParameter(WebGLRenderingContext.MAX_TEXTURE_IMAGE_UNITS) as JsNumber).toInt() + val canFastCopyTextures = false + val hasClipControl = clipControlExt != null + + capabilities = GlCapabilities( + maxTexUnits = maxTexUnits, + maxAnisotropy = maxAnisotropy, + canFastCopyTextures = canFastCopyTextures, + hasClipControl = hasClipControl, + hasTimestampQuery = false + ) + } + + override fun readBuffer(gpuBuffer: GpuBufferGl, dstBuffer: Buffer): Boolean = false + + override fun readTexturePixels(src: LoadedTextureGl, dst: BufferedImageData): Boolean { + if (src.target != TEXTURE_2D) { + return false + } + + val fb = createFramebuffer() + bindFramebuffer(FRAMEBUFFER, fb) + framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, src.glTexture, 0) + + if (checkFramebufferStatus(FRAMEBUFFER) == FRAMEBUFFER_COMPLETE) { + val format = gl.getParameter(WebGLRenderingContext.IMPLEMENTATION_COLOR_READ_FORMAT) as JsNumber + val type = gl.getParameter(WebGLRenderingContext.IMPLEMENTATION_COLOR_READ_TYPE) as JsNumber + gl.readPixels(0, 0, src.width, src.height, format.toInt(), type.toInt(), dst.arrayBufferView) + } else { + logE { "Failed reading pixels from framebuffer" } + } + deleteFramebuffer(fb) + return true + } + + private class WebGlObjList( + val factory: (P) -> T?, + val deleter: (T?) -> Unit + ) { + val objs = mutableListOf() + private val freeSlots = mutableListOf() + + operator fun get(index: Int) = objs.getOrNull(index) + + fun create(p: P): Int { + val insertIdx = if (freeSlots.isEmpty()) -1 else freeSlots.removeLast() + return if (insertIdx >= 0) { + objs[insertIdx] = factory(p) + insertIdx + } else { + objs += factory(p) + objs.lastIndex + } + } + + fun delete(index: Int) { + checkNotNull(objs[index]) + deleter(objs[index]) + objs[index] = null + freeSlots += index + } + } + + private class ProgramInfo(val webGl: WebGLProgram?) { + val uniformLocations = mutableListOf() + val uniformLocationIds = mutableMapOf() + + fun getUniformLocation(uniformName: String): Int { + val locId = uniformLocationIds[uniformName] + return if (locId != null) { + locId + } else { + uniformLocations += gl.getUniformLocation(webGl, uniformName) + uniformLocationIds[uniformName] = uniformLocations.lastIndex + uniformLocations.lastIndex + } + } + } + + private fun texImage2dImpl(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, format: Int, type: Int, pixels: Buffer?) { + when (pixels) { + is Uint8BufferImpl -> gl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.buffer) + is Uint16BufferImpl -> gl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.buffer) + is Int32BufferImpl -> gl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.buffer) + is Float32BufferImpl -> gl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.buffer) + else -> { + val nullPixels: ArrayBufferView? = null + gl.texImage2D(target, level, internalformat, width, height, border, format, type, nullPixels) + } + } + } + + private fun texImage2dImpl(target: Int, image: ImageData) { + gl.pixelStorei(WebGLRenderingContext.UNPACK_COLORSPACE_CONVERSION_WEBGL, WebGLRenderingContext.NONE) + when (image) { + is BufferedImageData1d -> { + gl.texImage2D(target, 0, image.format.glInternalFormat(this), image.width, 1, 0, image.format.glFormat(this), image.format.glType(this), image.arrayBufferView) + } + is BufferedImageData2d -> { + gl.texImage2D(target, 0, image.format.glInternalFormat(this), image.width, image.height, 0, image.format.glFormat(this), image.format.glType(this), image.arrayBufferView) + } + is ImageTextureData -> { + gl.texImage2D(target, 0, WebGLRenderingContext.RGBA, WebGLRenderingContext.RGBA, WebGLRenderingContext.UNSIGNED_BYTE, image.data) + } + else -> error("Invalid ImageData type for texImage2d: $image") + } + } + + private fun textImage3dImpl(target: Int, image: ImageData) { + when (image) { + is BufferedImageData3d -> { + gl.texImage3D(target, 0, image.format.glInternalFormat(this), image.width, image.height, image.depth, 0, image.format.glFormat(this), image.format.glType(this), image.arrayBufferView) + } + is ImageAtlasTextureData -> { + gl.texStorage3D(target, 1, image.format.glInternalFormat(this), image.width, image.height, image.depth) + for (z in 0 until image.depth) { + gl.texSubImage3D(target, 0, 0, 0, z, image.width, image.height, 1, image.format.glFormat(this), image.format.glType(this), image.data[z]) + } + } + else -> error("ImageData must be either BufferedImageData3d or ImageAtlasTextureData") + } + } + + private fun texSubImage3dImpl(target: Int, level: Int, xoffset: Int, yoffset: Int, zoffset: Int, width: Int, height: Int, depth: Int, format: Int, type: Int, pixels: ImageData) { + when (pixels) { + is BufferedImageData -> { + val arrayBufferView = (pixels.data as GenericBuffer<*>).buffer + gl.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, arrayBufferView) + } + is ImageTextureData -> { + gl.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels.data) + } + else -> error("Invalid ImageData type for texSubImage3D: $pixels") + } + } + + private fun notSupported(name: String): Nothing = error("$name is not supported in WebGL") + + private val BufferedImageData.arrayBufferView: ArrayBufferView get() = when (val bufData = data) { + is Uint8BufferImpl -> bufData.buffer + is Uint16BufferImpl -> bufData.buffer + is Float32BufferImpl -> bufData.buffer + else -> throw IllegalArgumentException("Unsupported buffer type") + } +} \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/RenderBackendGlImpl.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/RenderBackendGlImpl.kt new file mode 100644 index 000000000..8891c576e --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/RenderBackendGlImpl.kt @@ -0,0 +1,64 @@ +package de.fabmax.kool.pipeline.backend.gl + +import de.fabmax.kool.FrameData +import de.fabmax.kool.KoolContext +import de.fabmax.kool.KoolSystem +import de.fabmax.kool.configWasm +import de.fabmax.kool.pipeline.backend.BackendFeatures +import de.fabmax.kool.platform.WasmContext +import de.fabmax.kool.util.Color +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds + +actual fun createRenderBackendGl(ctx: KoolContext): RenderBackendGl = RenderBackendGlImpl(ctx as WasmContext) + +class RenderBackendGlImpl(ctx: WasmContext) : + RenderBackendGl(KoolSystem.configWasm.numSamples, GlImpl, ctx) +{ + override val name = "WebGL" + override val deviceName = "WebGL" + override val features: BackendFeatures + + override val glslGeneratorHints: GlslGenerator.Hints = GlslGenerator.Hints( + glslVersionStr = "#version 300 es", + ) + + override var frameGpuTime: Duration = 0.0.seconds + + override val isAsyncRendering: Boolean = false + + init { + val options = WebGlContextOptions(KoolSystem.configWasm.powerPreference.value, numSamples > 1) + val canvas = ctx.window.canvas + val webGlCtx = (canvas.getContext("webgl2", options) ?: canvas.getContext("experimental-webgl2", options)) as WebGL2RenderingContext? + check(webGlCtx != null) { "Unable to initialize WebGL2 context. Your browser may not support it." } + GlImpl.initWebGl(webGlCtx) + setupGl() + + features = BackendFeatures( + computeShaders = false, + cubeMapArrays = false, + reversedDepth = GlImpl.capabilities.hasClipControl, + maxSamples = 4, + readWriteStorageTextures = false, + depthOnlyShaderColorOutput = Color.BLACK, + maxComputeWorkGroupsPerDimension = GlImpl.capabilities.maxWorkGroupCount, + maxComputeWorkGroupSize = GlImpl.capabilities.maxWorkGroupSize, + maxComputeInvocationsPerWorkgroup = GlImpl.capabilities.maxWorkGroupInvocations + ) + + sceneRenderer.resolveDirect = false + useFloatDepthBuffer = KoolSystem.configWasm.forceFloatDepthBuffer + } + + override fun cleanup(ctx: KoolContext) { + // for now, we leave the cleanup to the system... + } + + override fun renderFrame(frameData: FrameData, ctx: KoolContext) { + super.renderFrame(frameData, ctx) + GlImpl.gl.finish() + } +} + +private fun WebGlContextOptions(powerPreference: String, antialias: Boolean): JsAny = js("({ powerPreference: powerPreference, antialias: antialias, stencil: false })") diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/WebGL2RenderingContext.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/WebGL2RenderingContext.kt new file mode 100644 index 000000000..ca2a7d280 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/gl/WebGL2RenderingContext.kt @@ -0,0 +1,123 @@ +package de.fabmax.kool.pipeline.backend.gl + +import org.khronos.webgl.* +import org.w3c.dom.HTMLImageElement + +abstract external class WebGL2RenderingContext : WebGLRenderingContext, JsAny { + + fun beginQuery(target: Int, query: WebGLQuery?) + fun bindBufferBase(target: Int, index: Int, buffer: WebGLBuffer?) + fun bindVertexArray(vertexArray: WebGLVertexArrayObject?) + fun blitFramebuffer(srcX0: Int, srcY0: Int, srcX1: Int, srcY1: Int, dstX0: Int, dstY0: Int, dstX1: Int, dstY1: Int, mask: Int, filter: Int) + fun bufferData(target: Int, srcData: ArrayBufferView, usage: Int, srcOffset: Int, length: Int) + fun clearBufferfv(buffer: Int, drawBuffer: Int, values: Float32Array) + fun createVertexArray(): WebGLVertexArrayObject + fun createQuery(): WebGLQuery + fun deleteQuery(query: WebGLQuery?) + fun deleteVertexArray(vertexArray: WebGLVertexArrayObject?) + fun drawBuffers(buffers: Uint32Array) + fun drawElementsInstanced(mode: Int, count: Int, type: Int, offset: Int, instanceCount: Int) + fun endQuery(target: Int) + fun getActiveUniformBlockParameter(program: WebGLProgram?, uniformBlockIndex: Int, pname: Int): Int + fun getActiveUniforms(program: WebGLProgram?, uniformIndices: Uint32Array, pname: Int): Uint32Array + fun getQueryParameter(query: WebGLQuery?, param: Int): JsAny + fun getUniformBlockIndex(program: WebGLProgram?, uniformBlockName: String): Int + fun getUniformIndices(program: WebGLProgram?, uniformNames: JsArray): Uint32Array + fun readBuffer(src: Int) + fun renderbufferStorageMultisample(target: Int, samples: Int, internalformat: Int, width: Int, height: Int) + fun texImage3D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, depth: Int, border: Int, format: Int, type: Int, srcData: ArrayBufferView?) + fun texImage3D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, depth: Int, border: Int, format: Int, type: Int, source: HTMLImageElement?) + fun texSubImage3D(target: Int, level: Int, xoffset: Int, yoffset: Int, zoffset: Int, width: Int, height: Int, depth: Int, format: Int, type: Int, pixels: JsAny?) + fun texStorage2D(target: Int, levels: Int, internalformat: Int, width: Int, height: Int) + fun texStorage3D(target: Int, levels: Int, internalformat: Int, width: Int, height: Int, depth: Int) + fun uniformBlockBinding(program: WebGLProgram?, uniformBlockIndex: Int, uniformBlockBinding: Int) + fun vertexAttribDivisor(index: Int, divisor: Int) + fun vertexAttribIPointer(index: Int, size: Int, type: Int, stride: Int, offset: Int) + + companion object { + val COLOR: Int + val DEPTH: Int + val STENCIL: Int + val DEPTH_STENCIL: Int + val DEPTH_COMPONENT: Int + val DRAW_FRAMEBUFFER: Int + val READ_FRAMEBUFFER: Int + val QUERY_RESULT: Int + val QUERY_RESULT_AVAILABLE: Int + + val DEPTH_COMPONENT24: Int + val DEPTH_COMPONENT32F: Int + val TEXTURE_2D_ARRAY: Int + val TEXTURE_3D: Int + val TEXTURE_BASE_LEVEL: Int + val TEXTURE_MAX_LEVEL: Int + val TEXTURE_MAX_LOD: Int + val TEXTURE_MIN_LOD: Int + val TEXTURE_WRAP_R: Int + val TEXTURE_COMPARE_MODE: Int + val COMPARE_REF_TO_TEXTURE: Int + val TEXTURE_COMPARE_FUNC: Int + + val UNIFORM_BLOCK_DATA_SIZE: Int + val UNIFORM_BUFFER: Int + val UNIFORM_OFFSET: Int + + val INVALID_INDEX: Int + + val RED: Int + val RG: Int + val RED_INTEGER: Int + val RG_INTEGER: Int + val RGB_INTEGER: Int + val RGBA_INTEGER: Int + + val R8: Int + val RG8: Int + val RGB8: Int + val RGBA8: Int + + val R16F: Int + val RG16F: Int + val RGB16F: Int + val RGBA16F: Int + + val R32F: Int + val RG32F: Int + val RGB32F: Int + val RGBA32F: Int + + val R32I: Int + val RG32I: Int + val RGB32I: Int + val RGBA32I: Int + + val R32UI: Int + val RG32UI: Int + val RGB32UI: Int + val RGBA32UI: Int + + val R11F_G11F_B10F: Int + } +} + +external interface WebGLQuery + +external interface WebGLVertexArrayObject + +external interface EXT_clip_control : JsAny { + fun clipControlEXT(origin: Int, depth: Int) + + val LOWER_LEFT_EXT: Int + val UPPER_LEFT_EXT: Int + + val NEGATIVE_ONE_TO_ONE_EXT: Int + val ZERO_TO_ONE_EXT: Int + + val CLIP_ORIGIN_EXT: Int + val CLIP_DEPTH_MODE_EXT: Int +} + +external interface EXT_texture_filter_anisotropic : JsAny { + val TEXTURE_MAX_ANISOTROPY_EXT: Int + val MAX_TEXTURE_MAX_ANISOTROPY_EXT: Int +} \ No newline at end of file diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.wasmJs.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.wasmJs.kt new file mode 100644 index 000000000..fad3338a4 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.wasmJs.kt @@ -0,0 +1,385 @@ +package de.fabmax.kool.pipeline.backend.webgpu + +import de.fabmax.kool.* +import de.fabmax.kool.math.Vec2i +import de.fabmax.kool.math.Vec3i +import de.fabmax.kool.modules.ksl.KslComputeShader +import de.fabmax.kool.modules.ksl.KslShader +import de.fabmax.kool.pipeline.* +import de.fabmax.kool.pipeline.backend.BackendFeatures +import de.fabmax.kool.pipeline.backend.BackendProvider +import de.fabmax.kool.pipeline.backend.DeviceCoordinates +import de.fabmax.kool.pipeline.backend.RenderBackend +import de.fabmax.kool.pipeline.backend.gl.pxSize +import de.fabmax.kool.pipeline.backend.stats.BackendStats +import de.fabmax.kool.pipeline.backend.wgsl.WgslGenerator +import de.fabmax.kool.platform.WasmContext +import de.fabmax.kool.platform.navigator +import de.fabmax.kool.scene.Scene +import de.fabmax.kool.util.* +import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.await +import org.khronos.webgl.* +import org.w3c.dom.HTMLCanvasElement +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds + +actual class RenderBackendWebGpu(val ctx: WasmContext) : RenderBackend { + override actual val name: String = "WebGPU" + override actual val apiName: String = "WebGPU" + override actual val deviceName: String = "WebGPU" + override actual val deviceCoordinates: DeviceCoordinates = DeviceCoordinates.WEB_GPU + private lateinit var _features: BackendFeatures + override actual val features: BackendFeatures get() = _features + + actual val numSamples: Int = KoolSystem.configWasm.numSamples + actual val framebufferSize: Vec2i get() = ctx.window.framebufferSize + + private val canvas: HTMLCanvasElement get() = ctx.window.canvas + private var _adapter: GPUAdapter? = null + private var _device: GPUDevice? = null + private var _canvasContext: GPUCanvasContext? = null + private var _canvasFormat: GPUTextureFormat? = null + actual val adapter: GPUAdapter get() = requireNotNull(_adapter) + actual val device: GPUDevice get() = requireNotNull(_device) + actual val canvasContext: GPUCanvasContext get() = requireNotNull(_canvasContext) + actual val canvasFormat: GPUTextureFormat get() = _canvasFormat!! + + private var _textureLoader: WgpuTextureLoader? = null + internal actual val textureLoader: WgpuTextureLoader get() = requireNotNull(_textureLoader) + + private var _isTimestampQuerySupported = false + actual val isTimestampQuerySupported: Boolean get() = _isTimestampQuerySupported + + internal actual val timestampQuery: WgpuTimestamps by lazy { WgpuTimestamps(128, this) } + + actual val pipelineManager = WgpuPipelineManager(this) + private val screenPass = WgpuScreenPass(this) + + private var renderSize = Vec2i(canvas.width, canvas.height) + + private val gpuReadbacks = mutableListOf() + + override actual val frameGpuTime: Duration = 0.0.seconds + + override actual val isAsyncRendering: Boolean = false + + actual val clearHelper: ClearHelper by lazy { ClearHelper(this) } + private val passEncoderState = RenderPassEncoderState(this) + + init { + check(isSupported()) { "WebGPU not supported on this browser." } + } + + internal suspend fun createWebGpuContext(): Boolean { + val powerPref = when (KoolSystem.configWasm.powerPreference) { + PowerPreference.HighPerformance -> GPUPowerPreference.highPerformance + PowerPreference.LowPower -> GPUPowerPreference.lowPower + } + val selectedAdapter = navigator.gpu.requestAdapter(GPURequestAdapterOptions(powerPref)).await() + ?: navigator.gpu.requestAdapter().await() + if (selectedAdapter == null) { + logE { "No appropriate GPUAdapter found." } + return false + } + _adapter = selectedAdapter + + val availableFeatures = mutableListOf() + adapter.features.forEach { availableFeatures.add(it.toString()) } + logD { "Available GPUAdapter features:" } + availableFeatures.forEach { logD { "- $it" } } + + val requiredFeatures = mutableListOf() + if ("timestamp-query" in availableFeatures) { + logI { "Enabling WebGPU timestamp-query feature" } + requiredFeatures.add("timestamp-query") + _isTimestampQuerySupported = true + } + if ("rg11b10ufloat-renderable" in availableFeatures) { + logI { "Enabling rg11b10ufloat-renderable feature" } + requiredFeatures.add("rg11b10ufloat-renderable") + } + + try { + val deviceDesc = GPUDeviceDescriptor(requiredFeatures) + _device = adapter.requestDevice(deviceDesc).await() + } catch (e: Exception) { + logE { "requestDevice() failed: $e" } + return false + } + + _features = BackendFeatures( + computeShaders = true, + cubeMapArrays = true, + reversedDepth = true, + maxSamples = 4, + readWriteStorageTextures = false, + depthOnlyShaderColorOutput = Color.BLACK, + maxComputeWorkGroupsPerDimension = Vec3i( + device.limits.maxComputeWorkgroupsPerDimension, + device.limits.maxComputeWorkgroupsPerDimension, + device.limits.maxComputeWorkgroupsPerDimension, + ), + maxComputeWorkGroupSize = Vec3i( + device.limits.maxComputeWorkgroupSizeX, + device.limits.maxComputeWorkgroupSizeY, + device.limits.maxComputeWorkgroupSizeZ, + ), + maxComputeInvocationsPerWorkgroup = device.limits.maxComputeInvocationsPerWorkgroup, + ) + + _canvasContext = canvas.getContext("webgpu") as GPUCanvasContext + _canvasFormat = GPUTextureFormat.forValue(navigator.gpu.getPreferredCanvasFormat()) + canvasContext.configure( + GPUCanvasConfiguration(device, canvasFormat) + ) + _textureLoader = WgpuTextureLoader(this) + logI { "WebGPU context created" } + return true + } + + actual override fun renderFrame(frameData: FrameData, ctx: KoolContext) { + BackendStats.resetPerFrameCounts() + + if (ctx.window.framebufferSize != renderSize) { + renderSize = ctx.window.framebufferSize + screenPass.applySize(renderSize.x, renderSize.y) + } + + passEncoderState.beginFrame() + + frameData.preparePipelines() + frameData.executePasses() + + passEncoderState.ensureRenderPassInactive() + if (gpuReadbacks.isNotEmpty()) { + // copy all buffers requested for readback to temporary buffers using the current command encoder + copyReadbacks(passEncoderState.encoder) + } + timestampQuery.resolve(passEncoderState.encoder) + passEncoderState.endFrame() + + timestampQuery.readTimestamps() + if (gpuReadbacks.isNotEmpty()) { + // after encoder is finished and submitted, temp buffers can be mapped for readback + mapReadbacks() + } + } + + private fun FrameData.preparePipelines() { + forEachPass { passData -> + val t = Time.precisionTime + passData.forEachView { viewData -> + viewData.drawQueue.forEach { cmd -> pipelineManager.prepareDrawPipeline(cmd) } + } + passData.gpuPass.tRecord = (Time.precisionTime - t).seconds + } + } + + private fun FrameData.executePasses() { + forEachPass { passData -> passData.executePass(passEncoderState) } + } + + private fun PassData.executePass(passEncoderState: RenderPassEncoderState) { + val pass = gpuPass + val t = Time.precisionTime + when (pass) { + is Scene.ScreenPass -> screenPass.renderScene(this, passEncoderState) + is OffscreenPass2d -> pass.draw(this, passEncoderState) + is OffscreenPassCube -> pass.draw(this, passEncoderState) + is ComputePass -> pass.dispatch(passEncoderState) + else -> throw IllegalArgumentException("Offscreen pass type not implemented: $this") + } + pass.tRecord = (Time.precisionTime - t).seconds + } + + private fun OffscreenPass2d.draw(passData: PassData, passEncoderState: RenderPassEncoderState) { + (impl as WgpuOffscreenPass2d).draw(passData, passEncoderState) + } + + private fun OffscreenPassCube.draw(passData: PassData, passEncoderState: RenderPassEncoderState) { + (impl as WgpuOffscreenPassCube).draw(passData, passEncoderState) + } + + private fun ComputePass.dispatch(passEncoderState: RenderPassEncoderState) { + passEncoderState.ensureRenderPassInactive() + (impl as WgpuComputePass).dispatch(passEncoderState.encoder) + } + + actual override fun cleanup(ctx: KoolContext) { + // do nothing for now + } + + actual override fun generateKslShader(shader: KslShader, pipeline: DrawPipeline): ShaderCode { + val output = WgslGenerator.generateProgram(shader.program, pipeline) + return WebGpuShaderCode( + vertexSrc = output.vertexSrc, + vertexEntryPoint = output.vertexEntryPoint, + fragmentSrc = output.fragmentSrc, + fragmentEntryPoint = output.fragmentEntryPoint + ) + } + + actual override fun generateKslComputeShader(shader: KslComputeShader, pipeline: ComputePipeline): ComputeShaderCode { + val output = WgslGenerator.generateComputeProgram(shader.program, pipeline) + return WebGpuComputeShaderCode( + computeSrc = output.computeSrc, + computeEntryPoint = output.computeEntryPoint + ) + } + + actual override fun createOffscreenPass2d(parentPass: OffscreenPass2d): OffscreenPass2dImpl { + return WgpuOffscreenPass2d(parentPass, this) + } + + actual override fun createOffscreenPassCube(parentPass: OffscreenPassCube): OffscreenPassCubeImpl { + return WgpuOffscreenPassCube(parentPass, this) + } + + actual override fun createComputePass(parentPass: ComputePass): ComputePassImpl { + return WgpuComputePass(parentPass, this) + } + + actual override fun uploadTextureData(tex: Texture) = textureLoader.loadTexture(tex) + + actual override fun downloadBuffer(buffer: GpuBuffer, deferred: CompletableDeferred, resultBuffer: Buffer) { + gpuReadbacks += ReadbackStorageBuffer(buffer, deferred, resultBuffer) + } + + actual override fun downloadTextureData(texture: Texture<*>, deferred: CompletableDeferred) { + gpuReadbacks += ReadbackTexture(texture, deferred) + } + + private fun copyReadbacks(encoder: GPUCommandEncoder) { + gpuReadbacks.filterIsInstance().forEach { readback -> + val gpuBuf = readback.storage.gpuBuffer as GpuBufferWgpu? + if (gpuBuf == null) { + readback.deferred.completeExceptionally(IllegalStateException("Failed reading buffer")) + } else { + val size = readback.resultBuffer.limit.toLong() * 4 + val mapBuffer = device.createBuffer( + GPUBufferDescriptor( + label = "storage-buffer-readback", + size = size.toJsNumber(), + usage = GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST + ) + ) + encoder.copyBufferToBuffer(gpuBuf.buffer, 0.toJsNumber(), mapBuffer, 0.toJsNumber(), size.toJsNumber()) + readback.mapBuffer = mapBuffer + } + } + + gpuReadbacks.filterIsInstance().forEach { readback -> + val gpuTex = readback.texture.gpuTexture as WgpuTextureResource? + if (gpuTex == null || readback.texture.format.isF16) { + readback.deferred.completeExceptionally(IllegalStateException("Failed reading texture")) + } else { + val format = readback.texture.format + val size = format.pxSize.toLong() * gpuTex.width * gpuTex.height * gpuTex.depth + val mapBuffer = device.createBuffer( + GPUBufferDescriptor( + label = "texture-readback", + size = size.toJsNumber(), + usage = GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST + ) + ) + encoder.copyTextureToBuffer( + source = GPUImageCopyTexture(gpuTex.gpuTexture), + destination = GPUImageCopyBuffer( + buffer = mapBuffer, + bytesPerRow = format.pxSize * gpuTex.width, + rowsPerImage = gpuTex.height + ), + copySize = intArrayOf(gpuTex.width, gpuTex.height, gpuTex.depth).toJsArray() + ) + readback.mapBuffer = mapBuffer + } + } + } + + private fun mapReadbacks() { + gpuReadbacks.filterIsInstance().filter { it.mapBuffer != null }.forEach { readback -> + val mapBuffer = readback.mapBuffer!! + mapBuffer.mapAsync(GPUMapMode.READ).then { + readback.resultBuffer.copyFrom(mapBuffer.getMappedRange()) + mapBuffer.unmap() + mapBuffer.destroy() + readback.deferred.complete(Unit) + it + } + } + + gpuReadbacks.filterIsInstance().filter { it.mapBuffer != null }.forEach { readback -> + val mapBuffer = readback.mapBuffer!! + mapBuffer.mapAsync(GPUMapMode.READ).then { + val gpuTex = readback.texture.gpuTexture as WgpuTextureResource + val format = readback.texture.format + val dst = ImageData.createBuffer(format, gpuTex.width, gpuTex.height, gpuTex.depth) + dst.copyFrom(mapBuffer.getMappedRange()) + mapBuffer.unmap() + mapBuffer.destroy() + when (readback.texture) { + is Texture1d -> readback.deferred.complete(BufferedImageData1d(dst, gpuTex.width, format)) + is Texture2d -> readback.deferred.complete(BufferedImageData2d(dst, gpuTex.width, gpuTex.height, format)) + is Texture3d -> readback.deferred.complete(BufferedImageData3d(dst, gpuTex.width, gpuTex.height, gpuTex.depth, format)) + else -> readback.deferred.completeExceptionally(IllegalArgumentException("Unsupported texture type")) + } + it + } + } + + gpuReadbacks.clear() + } + + private fun Buffer.copyFrom(src: ArrayBuffer) { + when (this) { + is Uint8BufferImpl -> this.buffer.set(Uint8Array(src)) + is Uint16BufferImpl -> this.buffer.set(Uint16Array(src)) + is Int32BufferImpl -> this.buffer.set(Int32Array(src)) + is Float32BufferImpl -> this.buffer.set(Float32Array(src)) + is MixedBufferImpl -> Uint8Array(this.buffer.buffer).set(Uint8Array(src)) + else -> logE { "Unexpected buffer type: ${this::class.simpleName}" } + } + } + + actual fun createBuffer(descriptor: GPUBufferDescriptor, info: String?): GpuBufferWgpu { + return GpuBufferWgpu(device.createBuffer(descriptor), descriptor.size.toLong(), info) + } + + actual fun createTexture(descriptor: GPUTextureDescriptor): WgpuTextureResource { + return WgpuTextureResource(descriptor, device.createTexture(descriptor)) + } + + private interface GpuReadback + + private class ReadbackStorageBuffer(val storage: GpuBuffer, val deferred: CompletableDeferred, val resultBuffer: Buffer) : GpuReadback { + var mapBuffer: GPUBuffer? = null + } + + private class ReadbackTexture(val texture: Texture<*>, val deferred: CompletableDeferred) : GpuReadback { + var mapBuffer: GPUBuffer? = null + } + + companion object : BackendProvider { + override val displayName: String = "WebGPU" + + override suspend fun createBackend(ctx: KoolContext): Result { + return if (isSupported()) { + val backend = RenderBackendWebGpu(ctx as WasmContext) + if (backend.createWebGpuContext()) { + Result.success(backend) + } else { + Result.failure(IllegalStateException("Failed to create WebGPU context")) + } + } else { + Result.failure(IllegalStateException("WebGPU is not supported by this browser")) + } + } + + fun isSupported(): Boolean { + return !isNoWgpuSupport() + } + } +} + +private fun isNoWgpuSupport(): Boolean = js("!navigator.gpu") diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt new file mode 100644 index 000000000..2e94a2486 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/FontMapGenerator.kt @@ -0,0 +1,195 @@ +package de.fabmax.kool.platform + +import de.fabmax.kool.KoolSystem +import de.fabmax.kool.configWasm +import de.fabmax.kool.math.clamp +import de.fabmax.kool.math.smoothStep +import de.fabmax.kool.pipeline.BufferedImageData2d +import de.fabmax.kool.pipeline.TexFormat +import de.fabmax.kool.util.* +import kotlinx.browser.document +import org.khronos.webgl.get +import org.w3c.dom.CanvasRenderingContext2D +import org.w3c.dom.HTMLCanvasElement +import kotlin.js.Promise +import kotlin.math.ceil +import kotlin.math.pow +import kotlin.math.roundToInt + +class FontMapGenerator(val maxWidth: Int, val maxHeight: Int) { + + private val canvas = document.createElement("canvas") as HTMLCanvasElement + private val canvasCtx: CanvasRenderingContext2D + + val loadingFonts = mutableListOf>() + + init { + val pixelRatio = (KoolSystem.getContextOrNull() as WasmContext?)?.window?.parentScreenScale ?: 1f + canvas.style.width = "${(maxWidth / pixelRatio).roundToInt()}" + canvas.style.height = "${(maxHeight / pixelRatio).roundToInt()}" + canvas.width = maxWidth + canvas.height = maxHeight + canvasCtx = canvas.getContext("2d") as CanvasRenderingContext2D + + KoolSystem.configWasm.customTtfFonts.forEach { (family, url) -> + loadFont(family, url) + } + } + + private fun loadFont(family: String, url: String) { + val font = FontFace(family, "url($url)") + val promise = font.load() + loadingFonts += promise + promise.then { f -> + logD { "Loaded custom font: ${f.family}" } + addFont(f) + f + } + } + + fun createFontMapData(font: AtlasFont, fontScale: Float, outMetrics: MutableMap): BufferedImageData2d { + val fontSize = (font.sizePts * fontScale).roundToInt() + + // clear canvas + canvasCtx.fillStyle = "#000000".toJsString() + canvasCtx.fillRect(0.0, 0.0, maxWidth.toDouble(), maxHeight.toDouble()) + // draw font chars + val texHeight = makeMap(font, fontSize, outMetrics) + // copy image data + val data = canvasCtx.getImageData(0.0, 0.0, maxWidth.toDouble(), texHeight.toDouble()) + + // alpha correction lut: + // boost font contrast by increasing contrast / reducing anti-aliasing (otherwise small fonts appear quite + // blurry, especially in Chrome) + val alphaLut = ByteArray(256) { i -> + val a = i / 255f + // corrected value: boosted contrast + val ac = a.pow(1.5f) * 1.3f - 0.15f + // mix original value and corrected one based on font size: + // max correction for sizes <= 12, no correction for sizes >= 40 + val cw = smoothStep(12f, 40f, fontSize.toFloat()) + val c = a * cw + ac * (1f - cw) + (c.clamp(0f, 1f) * 255f).toInt().toByte() + } + + // alpha texture + val buffer = Uint8Buffer(maxWidth * texHeight) + for (i in 0 until buffer.capacity) { + val a = data.data[i*4].toInt() and 0xff + buffer.put(alphaLut[a]) + } + logD { "Generated font map for (${font}, scale=${fontScale})" } + return BufferedImageData2d(buffer, maxWidth, texHeight, TexFormat.R) + } + + private fun makeMap(font: AtlasFont, size: Int, outMetrics: MutableMap): Int { + var style = "" + if (font.style and AtlasFont.BOLD != 0) { + style = "bold " + } + if (font.style and AtlasFont.ITALIC != 0) { + style += "italic " + } + + val fontStr = "$style ${size}px ${font.family}" + canvasCtx.font = fontStr + canvasCtx.fillStyle = "#ffffff".toJsString() + canvasCtx.strokeStyle = "#ffffff".toJsString() + + logD { "generate font: $fontStr" } + + val fm = canvasCtx.measureText("A") + + val padLeft = ceil(size / 10f).toInt() + val padRight = ceil(size / 10f).toInt() + val padTop = 0 + val padBottom = ceil(size / 10f).toInt() + + var fontAscent = ceil(size * 1.05).toInt() + var fontDescent = ceil(size * 0.35).toInt() + + try { + fontAscent = ceil(fm.fontBoundingBoxAscent).toInt() + fontDescent = ceil(fm.fontBoundingBoxAscent).toInt() + } catch (e: Exception) { + // silently ignored: firefox currently does not have font ascent / descent measures + // use defualts instead + } + + val ascent = if (font.ascentEm == 0f) fontAscent else ceil(font.ascentEm * size).toInt() + val descent = if (font.descentEm == 0f) fontDescent else ceil(font.descentEm * size).toInt() + val height = if (font.heightEm == 0f) ascent + descent else ceil(font.heightEm * size).toInt() + + // first pixel is opaque + canvasCtx.beginPath() + canvasCtx.moveTo(0.5, 0.0) + canvasCtx.lineTo(0.5, 1.0) + canvasCtx.stroke() + + var x = 1 + var y = ascent + for (c in font.chars) { + val txt = "$c" + val txtMetrics = canvasCtx.measureText(txt) + val charW = ceil(txtMetrics.actualBoundingBoxRight + txtMetrics.actualBoundingBoxLeft).toInt() + val paddedWidth = charW + padLeft + padRight + if (x + paddedWidth > maxWidth) { + x = 0 + y += (height + padBottom + padTop) + if (y + descent > maxHeight) { + logE { "Unable to render full font map: Maximum texture size exceeded" } + break + } + } + + val xOff = txtMetrics.actualBoundingBoxLeft + padLeft + val metrics = CharMetrics() + metrics.width = paddedWidth.toFloat() + metrics.height = (height + padBottom + padTop).toFloat() + metrics.xOffset = xOff.toFloat() + metrics.yBaseline = ascent.toFloat() + metrics.advance = txtMetrics.width.toFloat() + + metrics.uvMin.set( + x.toFloat(), + (y - ascent - padTop).toFloat() + ) + metrics.uvMax.set( + (x + paddedWidth).toFloat(), + (y - ascent + padBottom + height).toFloat() + ) + outMetrics[c] = metrics + + canvasCtx.fillText(txt, x + xOff, y.toDouble()) + x += paddedWidth + } + + val texW = maxWidth + val texH = nextPow2(y + descent) + + for (cm in outMetrics.values) { + cm.uvMin.x /= texW + cm.uvMin.y /= texH + cm.uvMax.x /= texW + cm.uvMax.y /= texH + } + + return texH + } + + private fun nextPow2(value: Int): Int { + var pow2 = 16 + while (pow2 < value && pow2 < maxHeight) { + pow2 = pow2 shl 1 + } + return pow2 + } +} + +external class FontFace(family: String, source: String) : JsAny { + val family: String + + fun load(): Promise +} + +private fun addFont(f: FontFace): JsAny = js("document.fonts.add(f)") diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/JsZip.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/JsZip.kt new file mode 100644 index 000000000..67d2825f4 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/JsZip.kt @@ -0,0 +1,51 @@ +package de.fabmax.kool.platform + +import de.fabmax.kool.util.Uint8Buffer +import de.fabmax.kool.util.Uint8BufferImpl +import kotlinx.coroutines.await +import org.khronos.webgl.Uint8Array +import org.w3c.files.Blob +import kotlin.js.Promise + +@JsModule("jszip") +external class JsZip : JsAny { + fun file(name: String, data: Uint8Array): JsZip + fun folder(name: String): JsZip + fun forEach(callback: (relativePath: String, file: ZipObject) -> Unit) + fun loadAsync(data: Blob): Promise + fun loadAsync(data: Uint8Array): Promise + fun generateAsync(options: JsAny): Promise +} + +suspend fun JsZip.generate(): Uint8Buffer { + val o = JsZipGenOptions("uint8array", "DEFLATE") + val data = generateAsync(o).await() + return Uint8BufferImpl(data) +} + +private fun JsZipGenOptions(type: String, compression: String): JsAny = js("({ type: type, compression: compression })") + +@JsModule("jszip") +external interface ZipObject { + val name: String + val dir: Boolean + + fun async(type: String): Promise +} + +fun ZipObject.asyncU8(): Promise { + return async("uint8array").unsafeCast() +} + +fun ZipObject.asyncText(): Promise { + return async("text").unsafeCast() +} + + +external interface User { + val name: String + val age: Int + // You can use nullable types to declare a property as optional + val email: String? +} + diff --git a/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/WasmContext.kt b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/WasmContext.kt new file mode 100644 index 000000000..e122fb486 --- /dev/null +++ b/kool-core/src/wasmJsMain/kotlin/de/fabmax/kool/platform/WasmContext.kt @@ -0,0 +1,270 @@ +package de.fabmax.kool.platform + +import de.fabmax.kool.* +import de.fabmax.kool.input.PlatformInputWasm +import de.fabmax.kool.math.Vec2i +import de.fabmax.kool.modules.ui2.UiScale +import de.fabmax.kool.pipeline.backend.RenderBackend +import de.fabmax.kool.pipeline.backend.gl.RenderBackendGl +import de.fabmax.kool.util.* +import kotlinx.browser.document +import kotlinx.browser.window +import kotlinx.coroutines.launch +import org.w3c.dom.HTMLCanvasElement +import org.w3c.dom.Window +import org.w3c.dom.events.Event +import kotlin.math.min +import kotlin.math.roundToInt + +suspend fun WasmContext(): WasmContext { + val config = KoolSystem.configWasm + val canvas: HTMLCanvasElement = document.getElementById(config.canvasName) as HTMLCanvasElement? ?: + throw IllegalStateException("canvas element not found! Add a canvas with id \"${config.canvasName}\" to your html.") + + val ctx = WasmContext(canvas, config) + ctx.createBackend() + return ctx +} + +private val browserWindow: Window get() = window + +class WasmContext internal constructor(canvas: HTMLCanvasElement, val config: KoolConfigWasm) : KoolContext() { + override lateinit var backend: RenderBackend + private set + + override val window: WasmWindow = WasmWindow(canvas, config) + + private val sysInfo = mutableListOf() + + internal suspend fun createBackend() { + val backendProvider = config.renderBackend + val backendResult = backendProvider.createBackend(this@WasmContext) + backend = when { + backendResult.isSuccess -> backendResult.getOrThrow() + config.useWebGlFallback && backendProvider != RenderBackendGl -> { + logE { "Failed creating render backend ${backendProvider.displayName}: ${backendResult.exceptionOrNull()}\nFalling back to WebGL2" } + RenderBackendGl.createBackend(this@WasmContext).getOrThrow() + } + else -> error("Failed creating render backend ${backendProvider.displayName}: ${backendResult.exceptionOrNull()}") + } + + PlatformInputWasm.onContextCreated(this) + KoolSystem.onContextCreated(this) + } + + private suspend fun renderFrame(time: Double) { + // update viewport size according to window scale + window.updateCanvasSize() + + // render frame + val frameData = render() + frameData.syncData() + incrementFrameTime(time / 1000.0) + KoolDispatchers.Backend.executeDispatchedTasks() + backend.renderFrame(frameData, this) + requestAnimationFrame() + } + + override fun openUrl(url: String, sameWindow: Boolean) { + if (sameWindow) { + browserWindow.open(url, "_self") + } else { + browserWindow.open(url) + } + } + + override fun run() { + requestAnimationFrame() + } + + private fun requestAnimationFrame() { + browserWindow.requestAnimationFrame { t -> + ApplicationScope.launch { + renderFrame(t) + } + } + } + + override fun getSysInfos(): List { + return sysInfo + } +} + +class WasmWindow(val canvas: HTMLCanvasElement, val config: KoolConfigWasm) : KoolWindow { + + override val parentScreenScale: Float + get() = min(config.deviceScaleLimit, browserWindow.devicePixelRatio).toFloat() + + override var positionInScreen: Vec2i = Vec2i.ZERO + set(value) { + logE { "WasmWindow position cannot be set" } + } + + override var sizeOnScreen: Vec2i + get() = Vec2i((framebufferSize.x / parentScreenScale).roundToInt(), (framebufferSize.y / parentScreenScale).roundToInt()) + set(value) { + logE { "WasmWindow size cannot be set" } + } + + override var renderResolutionFactor: Float = 1f + set(value) { + if (value != field) { + field = value + updateUiScales() + } + } + + override var framebufferSize: Vec2i = Vec2i(canvas.width, canvas.height); private set + + override var size: Vec2i = Vec2i(canvas.width, canvas.height); private set + + override val renderScale: Float + get() = parentScreenScale * renderResolutionFactor + + override var title: String + get() = document.title + set(value) { + document.title = value + } + + private var _flags = WindowFlags() + set(value) { + if (value != field) { + val oldFlags = field + field = value + flagListeners.updated().forEach { it.onFlagsChanged(oldFlags, value) } + } + } + override var flags: WindowFlags + get() = _flags + set(value) { + if (value != _flags) { + applyFlags(_flags, value) + _flags = value + } + } + + override val capabilities: WindowCapabilities = WindowCapabilities( + canSetSize = false, + canSetPosition = false, + canSetFullscreen = true, + canMaximize = false, + canMinimize = false, + canSetVisibility = false, + canSetTitle = true, + canHideTitleBar = false + ) + + override val resizeListeners: BufferedList = BufferedList() + override val scaleChangeListeners: BufferedList = BufferedList() + override val flagListeners: BufferedList = BufferedList() + override val closeListeners: BufferedList = BufferedList() + override val dragAndDropListeners: BufferedList = BufferedList() + + override var windowTitleHoverHandler: WindowTitleHoverHandler = WindowTitleHoverHandler() + + private var canvasFixedWidth = -1 + private var canvasFixedHeight = -1 + + init { + // set canvas style to desired size so that render resolution can be set according to window scale + if (config.isJsCanvasToWindowFitting) { + canvas.style.width = "100%" + canvas.style.height = "100%" + canvas.width = (browserWindow.innerWidth * parentScreenScale).toInt() + canvas.height = (browserWindow.innerHeight * parentScreenScale).toInt() + } else { + canvasFixedWidth = canvas.width + canvasFixedHeight = canvas.height + canvas.style.width = "${canvasFixedWidth}px" + canvas.style.height = "${canvasFixedHeight}px" + canvas.width = (canvasFixedWidth * parentScreenScale).roundToInt() + canvas.height = (canvasFixedHeight * parentScreenScale).roundToInt() + } + updateFramebufferSize() + updateUiScales() + + canvas.oncontextmenu = Event::preventDefault + document.onfullscreenchange = { + _flags = _flags.copy(isFullscreen = document.fullscreenElement != null) + } +// browserWindow.onfocus = { +// _flags = _flags.copy(isFocused = true) +// } +// browserWindow.onblur = { +// _flags = _flags.copy(isFocused = true) +// } +// browserWindow.onbeforeunload = { e -> +// if (closeListeners.updated().any { !it.onCloseRequest() }) { +// logD { "Window close request was suppressed by application callback" } +// e.preventDefault() +// e.returnValue = "Are you sure you want to exit?" +// } else { +// // proceed with closing page, delete return value to prevent unwanted popups +// js("delete e['returnValue'];") +// } +// null +// } + + browserWindow.ondragenter = { + it.preventDefault() + } + browserWindow.ondragover = { + it.preventDefault() + } + browserWindow.ondrop = { e -> + e.dataTransfer?.files?.let { fileList -> + val dropFiles = mutableListOf() + for (i in 0 until fileList.length) { + TODO("browserWindow.ondrop") +// fileList[i]?.let { dropFiles += LoadableFileImpl(it) } + } + if (dropFiles.isNotEmpty()) { + dragAndDropListeners.forEach { it.onFileDrop(dropFiles) } + } + } + e.preventDefault() + } + } + + private fun applyFlags(oldFlags: WindowFlags, newFlags: WindowFlags) { + if (oldFlags.isFullscreen != newFlags.isFullscreen) { + if (newFlags.isFullscreen) canvas.requestFullscreen() else document.exitFullscreen() + } + } + + private fun updateFramebufferSize() { + val x: Int + val y: Int + if (config.isJsCanvasToWindowFitting) { + x = (browserWindow.innerWidth * parentScreenScale * renderResolutionFactor).toInt() + y = (browserWindow.innerHeight * parentScreenScale * renderResolutionFactor).toInt() + } else { + x = (canvasFixedWidth * parentScreenScale * renderResolutionFactor).toInt() + y = (canvasFixedHeight * parentScreenScale * renderResolutionFactor).toInt() + } + if (framebufferSize.x != x || framebufferSize.y != y) { + framebufferSize = Vec2i(x, y) + size = framebufferSize + resizeListeners.updated().forEach { it.onResize(size) } + } + } + + private fun updateUiScales() { + UiScale.updateUiScaleFromWindowScale(renderScale) + scaleChangeListeners.updated().forEach { it.onScaleChanged(renderScale) } + } + + internal fun updateCanvasSize() { + updateFramebufferSize() + if (framebufferSize.x != canvas.width || framebufferSize.y != canvas.height) { + // resize canvas to viewport, this only affects the render resolution, actual canvas size is determined + // by canvas.style.width / canvas.style.height set on init + canvas.width = framebufferSize.x + canvas.height = framebufferSize.y + updateUiScales() + } + } + + override fun close() { } +} diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/Clipboard.web.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/Clipboard.web.kt new file mode 100644 index 000000000..2bcda41f0 --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/Clipboard.web.kt @@ -0,0 +1,18 @@ +@file:Suppress("REDUNDANT_CALL_OF_CONVERSION_METHOD") + +package de.fabmax.kool + +import kotlinx.browser.window + +actual object Clipboard { + actual fun copyToClipboard(string: String) { + window.navigator.clipboard.writeText(string) + } + + actual fun getStringFromClipboard(receiver: (String?) -> Unit) { + window.navigator.clipboard.readText().then { + receiver(it.toString()) + it + } + } +} diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/JsTypes.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/JsTypes.kt new file mode 100644 index 000000000..1461f408e --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/JsTypes.kt @@ -0,0 +1,126 @@ +@file:Suppress("REDUNDANT_CALL_OF_CONVERSION_METHOD", "EXTENSION_SHADOWED_BY_MEMBER") + +package de.fabmax.kool + +import de.fabmax.kool.pipeline.backend.webgpu.JsValueEnum +import org.khronos.webgl.Float32Array +import org.khronos.webgl.Uint32Array +import org.khronos.webgl.get +import org.khronos.webgl.set +import kotlin.js.* + +fun IntArray.toUint32Array(): Uint32Array = Uint32Array(size).also { + for (i in indices) { + it[i] = this[i] + } +} + +fun Uint32Array.toIntArray(): IntArray = IntArray(length).also { + for (i in 0 until length) { + it[i] = this[i] + } +} + +fun Array.toJsArray(): JsArray { + val js = JsArray() + for (i in indices) { + js[i] = this[i].toJsString() + } + return js +} + +external interface Gamepad : JsAny { + val axes: JsArray + val buttons: JsArray + val connected: Boolean + val id: String + val index: Int + val mapping: String + val timestamp: Double +} + +external interface GamepadButton : JsAny { + val pressed: Boolean + val touched: Boolean + val value: Double +} + +external class AudioContext : JsAny { + val sampleRate: Float + val destination: AudioDestinationNode + + fun createBuffer(numberOfChannels: Int, length: Int, sampleRate: Float): AudioBuffer + fun createBufferSource(): AudioBufferSourceNode + fun createScriptProcessor(bufferSize: Int, numberOfInputChannels: Int, numberOfOutputChannels: Int): ScriptProcessorNode +} + +external interface ScriptProcessorNode : AudioNode, JsAny { + val bufferSize: Int + var onaudioprocess: ((AudioProcessingEvent) -> Unit) +} + +external interface AudioProcessingEvent : JsAny { + val outputBuffer: AudioBuffer +} + +external interface AudioBuffer : JsAny { + val length: Int + fun getChannelData(channel: Int): Float32Array +} + +external interface AudioBufferSourceNode : AudioNode, JsAny { + var buffer: AudioBuffer? + var loop: Boolean + + fun start() + fun stop() +} + +external interface AudioNode : JsAny { + fun connect(node: AudioNode) + fun disconnect() +} + +external interface AudioDestinationNode : AudioNode, JsAny + +fun JsNumber?.toFloat(default: Float = 0f) = this?.toDouble()?.toFloat() ?: default + +fun Long.toJsNumber() = toDouble().toJsNumber() + +fun JsNumber.toLong() = toDouble().toLong() + +fun DoubleArray.toJsArray(): JsArray { + val array = JsArray() + forEachIndexed { index, number -> array[index] = number.toJsNumber() } + return array +} + +fun FloatArray.toJsArray(): JsArray { + val array = JsArray() + forEachIndexed { index, number -> array[index] = number.toDouble().toJsNumber() } + return array +} + +fun IntArray.toJsArray(): JsArray { + val array = JsArray() + forEachIndexed { index, number -> array[index] = number.toJsNumber() } + return array +} + +fun List.toJsArray(): JsArray { + val array = JsArray() + forEachIndexed { index, string -> array[index] = string.toJsString() } + return array +} + +fun List.toJsArray(): JsArray { + val array = JsArray() + forEachIndexed { index, enum -> array[index] = enum.value.toJsString() } + return array +} + +fun jsArrayOf(vararg elements: T): JsArray { + val array = JsArray() + for (i in elements.indices) { array[i] = elements[i] } + return array +} diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/KeyValueStore.js.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/KeyValueStore.web.kt similarity index 95% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/KeyValueStore.js.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/KeyValueStore.web.kt index cca5fdad2..bc331a7c6 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/KeyValueStore.js.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/KeyValueStore.web.kt @@ -8,9 +8,9 @@ import kotlinx.browser.localStorage import org.w3c.dom.get import org.w3c.dom.set -internal actual fun PlatformKeyValueStore(): PlatformKeyValueStore = JsKeyValueStore +internal actual fun PlatformKeyValueStore(): PlatformKeyValueStore = KeyValueStoreWeb -object JsKeyValueStore : PlatformKeyValueStore { +object KeyValueStoreWeb : PlatformKeyValueStore { override fun storageKeys(): Set { val keys = mutableSetOf() for (i in 0 until localStorage.length) { diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/input/ControllerWeb.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/input/ControllerWeb.kt new file mode 100644 index 000000000..5a33fba1f --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/input/ControllerWeb.kt @@ -0,0 +1,114 @@ +@file:Suppress("UNNECESSARY_SAFE_CALL") + +package de.fabmax.kool.input + +import de.fabmax.kool.Gamepad +import de.fabmax.kool.toFloat +import de.fabmax.kool.util.logI +import kotlin.js.get +import kotlin.js.length +import kotlin.math.min + +expect fun getGamepadState(index: Int): Gamepad? + +class ControllerWeb(private var gamepad: Gamepad) : Controller(gamepad.index) { + override val name: String = gamepad.id + + override val isConnected: Boolean get() = gamepad.connected + override val isGamepad: Boolean = gamepad.mapping == "standard" + override val buttonStates: BooleanArray + override val axisStates: FloatArray + + init { + if (isGamepad) { + buttonStates = BooleanArray(STANDARD_LAYOUT_NUM_BUTTONS) + axisStates = FloatArray(STANDARD_LAYOUT_NUM_AXES) + } else { + buttonStates = BooleanArray(gamepad.buttons.length) + axisStates = FloatArray(gamepad.axes.length) + } + logI { "Controller connected: $name (${gamepad.axes.length} axes, ${gamepad.buttons.length} buttons, isGamepad: $isGamepad)" } + } + + override fun updateState() { + gamepad = getGamepadState(gamepad.index) ?: return + if (!isConnected) { + return + } + + if (isGamepad) { + // use standardized mapping + setButtonState(ControllerButton.A, gamepad.getButtonState(STD_BTN_A)) + setButtonState(ControllerButton.B, gamepad.getButtonState(STD_BTN_B)) + setButtonState(ControllerButton.X, gamepad.getButtonState(STD_BTN_X)) + setButtonState(ControllerButton.Y, gamepad.getButtonState(STD_BTN_Y)) + + setButtonState(ControllerButton.DPAD_LEFT, gamepad.getButtonState(STD_BTN_DPAD_LEFT)) + setButtonState(ControllerButton.DPAD_RIGHT, gamepad.getButtonState(STD_BTN_DPAD_RIGHT)) + setButtonState(ControllerButton.DPAD_UP, gamepad.getButtonState(STD_BTN_DPAD_UP)) + setButtonState(ControllerButton.DPAD_DOWN, gamepad.getButtonState(STD_BTN_DPAD_DOWN)) + + setButtonState(ControllerButton.SHOULDER_LEFT, gamepad.getButtonState(STD_BTN_SHOULDER_LEFT)) + setButtonState(ControllerButton.SHOULDER_RIGHT, gamepad.getButtonState(STD_BTN_SHOULDER_RIGHT)) + setButtonState(ControllerButton.THUMB_LEFT, gamepad.getButtonState(STD_BTN_THUMB_LEFT)) + setButtonState(ControllerButton.THUMB_RIGHT, gamepad.getButtonState(STD_BTN_THUMB_RIGHT)) + + setButtonState(ControllerButton.START, gamepad.getButtonState(STD_BTN_START)) + setButtonState(ControllerButton.BACK, gamepad.getButtonState(STD_BTN_BACK)) + setButtonState(ControllerButton.GUIDE, gamepad.getButtonState(STD_BTN_GUIDE)) + + setAxisState(ControllerAxis.LEFT_X, gamepad.axes[STD_AX_LEFT_X].toFloat()) + setAxisState(ControllerAxis.LEFT_Y, gamepad.axes[STD_AX_LEFT_Y].toFloat()) + setAxisState(ControllerAxis.RIGHT_X, gamepad.axes[STD_AX_RIGHT_X].toFloat()) + setAxisState(ControllerAxis.RIGHT_Y, gamepad.axes[STD_AX_RIGHT_Y].toFloat()) + setAxisState(ControllerAxis.TRIGGER_LEFT, gamepad.buttons[STD_BTN_TRIGGER_LEFT]?.value?.toFloat() ?: 0f) + setAxisState(ControllerAxis.TRIGGER_RIGHT, gamepad.buttons[STD_BTN_TRIGGER_RIGHT]?.value?.toFloat() ?: 0f) + } else { + for (i in 0 until min(buttonStates.size, gamepad.buttons.length)) { + buttonStates[i] = gamepad.buttons[i]?.pressed ?: false + } + for (i in 0 until min(axisStates.size, gamepad.axes.length)) { + axisStates[i] = gamepad.axes[i].toFloat() + } + } + } + + private fun Gamepad.getButtonState(index: Int): Boolean { + if (index >= buttons.length) { + return false + } + return buttons[index]?.pressed == true + } + + companion object { + // standard input mapping + // https://w3c.github.io/gamepad/#dfn-standard-gamepad + + private const val STD_BTN_A = 0 + private const val STD_BTN_B = 1 + private const val STD_BTN_X = 2 + private const val STD_BTN_Y = 3 + + private const val STD_BTN_SHOULDER_LEFT = 4 + private const val STD_BTN_SHOULDER_RIGHT = 5 + private const val STD_BTN_TRIGGER_LEFT = 6 + private const val STD_BTN_TRIGGER_RIGHT = 7 + + private const val STD_BTN_BACK = 8 + private const val STD_BTN_START = 9 + private const val STD_BTN_GUIDE = 16 + + private const val STD_BTN_THUMB_LEFT = 10 + private const val STD_BTN_THUMB_RIGHT = 11 + + private const val STD_BTN_DPAD_UP = 12 + private const val STD_BTN_DPAD_DOWN = 13 + private const val STD_BTN_DPAD_LEFT = 14 + private const val STD_BTN_DPAD_RIGHT = 15 + + private const val STD_AX_LEFT_X = 0 + private const val STD_AX_LEFT_Y = 1 + private const val STD_AX_RIGHT_X = 2 + private const val STD_AX_RIGHT_Y = 3 + } +} \ No newline at end of file diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/modules/audio/AudioClipImpl.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/modules/audio/AudioClipImpl.kt similarity index 99% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/modules/audio/AudioClipImpl.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/modules/audio/AudioClipImpl.kt index d450e0c07..434ff8626 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/modules/audio/AudioClipImpl.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/modules/audio/AudioClipImpl.kt @@ -112,7 +112,6 @@ class AudioClipImpl(val assetPath: String) : AudioClip { volume = this@AudioClipImpl.volume * this@AudioClipImpl.masterVolume audioElement.onended = { clipState = ClipState.STOPPED - true.asDynamic() } } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/modules/audio/AudioOutput.js.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/modules/audio/AudioOutput.web.kt similarity index 80% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/modules/audio/AudioOutput.js.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/modules/audio/AudioOutput.web.kt index 2c0fac501..0927ddd49 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/modules/audio/AudioOutput.js.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/modules/audio/AudioOutput.web.kt @@ -1,15 +1,18 @@ package de.fabmax.kool.modules.audio +import de.fabmax.kool.AudioBufferSourceNode +import de.fabmax.kool.AudioContext +import de.fabmax.kool.ScriptProcessorNode import de.fabmax.kool.util.Float32Buffer import de.fabmax.kool.util.Float32BufferImpl +import org.khronos.webgl.set actual fun AudioOutput(bufSize: Int): AudioOutput = AudioOutputImpl(bufSize) -@Suppress("UnsafeCastFromDynamic") class AudioOutputImpl(override val bufSize: Int) : AudioOutput { - private val audioCtx = js("new AudioContext();") + private val audioCtx = AudioContext() - override val sampleRate: Float = audioCtx.sampleRate + override val sampleRate: Float get() = audioCtx.sampleRate override var isPaused: Boolean = false set(value) { @@ -27,9 +30,8 @@ class AudioOutputImpl(override val bufSize: Int) : AudioOutput { override var onBufferUpdate: (Double) -> Unit = { } - private val source: dynamic - private val scriptNode: dynamic - private var analyserNode: dynamic + private val source: AudioBufferSourceNode + private val scriptNode: ScriptProcessorNode private var powerSpectrum: Float32BufferImpl = Float32Buffer(1) as Float32BufferImpl private val dt = 1f / sampleRate @@ -39,7 +41,7 @@ class AudioOutputImpl(override val bufSize: Int) : AudioOutput { scriptNode = audioCtx.createScriptProcessor(bufSize, 1, 1) val buffer = audioCtx.createBuffer(1, scriptNode.bufferSize, sampleRate) - scriptNode.onaudioprocess = { ev: dynamic -> + scriptNode.onaudioprocess = { ev -> val outputBuffer = ev.outputBuffer val data = outputBuffer.getChannelData(0) val bufSamples: Int = outputBuffer.length @@ -52,8 +54,6 @@ class AudioOutputImpl(override val bufSize: Int) : AudioOutput { } } - analyserNode = null - source = audioCtx.createBufferSource() source.buffer = buffer source.loop = true diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/ClearHelper.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/ClearHelper.kt similarity index 95% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/ClearHelper.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/ClearHelper.kt index 69deb6057..c726f7910 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/ClearHelper.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/ClearHelper.kt @@ -5,6 +5,7 @@ import de.fabmax.kool.pipeline.ClearDepthFill import de.fabmax.kool.util.Color import de.fabmax.kool.util.Float32Buffer import de.fabmax.kool.util.Float32BufferImpl +import kotlin.js.toJsNumber class ClearHelper(val backend: RenderBackendWebGpu) { private val clearPipelines = mutableMapOf() @@ -25,19 +26,19 @@ class ClearHelper(val backend: RenderBackendWebGpu) { val clearValuesBuffer: GpuBufferWgpu = backend.createBuffer( GPUBufferDescriptor( label = "clearHelper-clearValues", - size = 32, + size = 32.toJsNumber(), usage = GPUBufferUsage.UNIFORM or GPUBufferUsage.COPY_DST ), "clearHelper-clearValues" ) - val bindGroupLayout = backend.device.createBindGroupLayout(arrayOf( + val bindGroupLayout = backend.device.createBindGroupLayout(listOf( GPUBindGroupLayoutEntryBuffer( binding = 0, visibility = GPUShaderStage.VERTEX or GPUShaderStage.FRAGMENT, buffer = GPUBufferBindingLayout() ) )) - val bindGroup: GPUBindGroup = backend.device.createBindGroup(bindGroupLayout, arrayOf( + val bindGroup: GPUBindGroup = backend.device.createBindGroup(bindGroupLayout, listOf( GPUBindGroupEntry(0, GPUBufferBinding(clearValuesBuffer.buffer)) )) @@ -60,7 +61,7 @@ class ClearHelper(val backend: RenderBackendWebGpu) { clearValues.clear() clearColor?.putTo(clearValues) clearValues[4] = clearDepth - backend.device.queue.writeBuffer(clearValuesBuffer.buffer, 0, clearValues.buffer, 0) + backend.device.queue.writeBuffer(clearValuesBuffer.buffer, 0.toJsNumber(), clearValues.buffer, 0.toJsNumber()) } val clearPipeline = when { @@ -89,7 +90,7 @@ class ClearHelper(val backend: RenderBackendWebGpu) { fragment = GPUFragmentState( module = shaderModule, entryPoint = "fragmentMain", - targets = arrayOf( + targets = listOf( GPUColorTargetState(colorFormat, GPUBlendState( color = GPUBlendComponent(srcFactor = colorSrcFactor, dstFactor = colorDstFactor), alpha = GPUBlendComponent(srcFactor = colorSrcFactor, dstFactor = colorDstFactor), @@ -106,7 +107,7 @@ class ClearHelper(val backend: RenderBackendWebGpu) { primitive = GPUPrimitiveState(topology = GPUPrimitiveTopology.triangleStrip), layout = backend.device.createPipelineLayout(GPUPipelineLayoutDescriptor( label = "clear-pipeline-layout", - bindGroupLayouts = arrayOf(bindGroupLayout) + bindGroupLayouts = listOf(bindGroupLayout) )), multisample = GPUMultisampleState(gpuRenderPass.numSamples) ) diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/GpuBufferWgpu.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/GpuBufferWgpu.kt similarity index 80% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/GpuBufferWgpu.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/GpuBufferWgpu.kt index 2285d0716..16e059458 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/GpuBufferWgpu.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/GpuBufferWgpu.kt @@ -2,7 +2,9 @@ package de.fabmax.kool.pipeline.backend.webgpu import de.fabmax.kool.pipeline.GpuBufferImpl import de.fabmax.kool.pipeline.backend.stats.BufferInfo +import de.fabmax.kool.toJsNumber import de.fabmax.kool.util.* +import kotlin.js.toJsNumber class GpuBufferWgpu(val buffer: GPUBuffer, size: Long, info: String?) : BaseReleasable(), GpuBufferImpl @@ -35,10 +37,10 @@ internal class WgpuGrowingBuffer( checkSize(data.limit * 4L) device.queue.writeBuffer( buffer = buffer.buffer, - bufferOffset = 0L, + bufferOffset = 0.toJsNumber(), data = (data as Float32BufferImpl).buffer, - dataOffset = 0L, - size = data.limit.toLong() + dataOffset = 0.toJsNumber(), + size = data.limit.toJsNumber() ) } @@ -46,10 +48,10 @@ internal class WgpuGrowingBuffer( checkSize(data.limit * 4L) device.queue.writeBuffer( buffer = buffer.buffer, - bufferOffset = 0L, + bufferOffset = 0.toJsNumber(), data = (data as Int32BufferImpl).buffer, - dataOffset = 0L, - size = data.limit.toLong() + dataOffset = 0.toJsNumber(), + size = data.limit.toJsNumber() ) } @@ -57,10 +59,10 @@ internal class WgpuGrowingBuffer( checkSize(data.limit * 4L) device.queue.writeBuffer( buffer = buffer.buffer, - bufferOffset = 0L, + bufferOffset = 0.toJsNumber(), data = (data as MixedBufferImpl).buffer, - dataOffset = 0L, - size = data.limit.toLong() + dataOffset = 0.toJsNumber(), + size = data.limit.toJsNumber() ) } @@ -76,7 +78,7 @@ internal class WgpuGrowingBuffer( private fun makeBuffer(size: Long) = backend.createBuffer( GPUBufferDescriptor( label = label, - size = size, + size = size.toJsNumber(), usage = usage ), label diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/PassEncoderState.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/PassEncoderState.kt similarity index 98% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/PassEncoderState.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/PassEncoderState.kt index 8d38b1b04..2193ac608 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/PassEncoderState.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/PassEncoderState.kt @@ -1,5 +1,6 @@ package de.fabmax.kool.pipeline.backend.webgpu +import de.fabmax.kool.jsArrayOf import de.fabmax.kool.pipeline.* interface PassEncoderState { @@ -85,7 +86,7 @@ class RenderPassEncoderState(val backend: RenderBackendWebGpu): PassEncoderState } val cmdBuffer = encoder.finish() _encoder = null - backend.device.queue.submit(arrayOf(cmdBuffer)) + backend.device.queue.submit(jsArrayOf(cmdBuffer)) } fun beginRenderPass( diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.kt new file mode 100644 index 000000000..5d3c3b583 --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/RenderBackendWebGpu.kt @@ -0,0 +1,458 @@ +package de.fabmax.kool.pipeline.backend.webgpu + +import de.fabmax.kool.FrameData +import de.fabmax.kool.KoolContext +import de.fabmax.kool.math.Vec2i +import de.fabmax.kool.modules.ksl.KslComputeShader +import de.fabmax.kool.modules.ksl.KslShader +import de.fabmax.kool.pipeline.* +import de.fabmax.kool.pipeline.backend.BackendFeatures +import de.fabmax.kool.pipeline.backend.DeviceCoordinates +import de.fabmax.kool.pipeline.backend.RenderBackend +import de.fabmax.kool.util.Buffer +import de.fabmax.kool.util.LongHash +import kotlinx.coroutines.CompletableDeferred +import kotlin.js.js +import kotlin.time.Duration + +expect class RenderBackendWebGpu : RenderBackend { + override val name: String + override val apiName: String + override val deviceName: String + override val features: BackendFeatures + override val deviceCoordinates: DeviceCoordinates + override val frameGpuTime: Duration + override val isAsyncRendering: Boolean + + val adapter: GPUAdapter + val device: GPUDevice + val canvasContext: GPUCanvasContext + val canvasFormat: GPUTextureFormat + val numSamples: Int + val framebufferSize: Vec2i + + internal val timestampQuery: WgpuTimestamps + val isTimestampQuerySupported: Boolean + val pipelineManager: WgpuPipelineManager + internal val textureLoader: WgpuTextureLoader + val clearHelper: ClearHelper + + fun createBuffer(descriptor: GPUBufferDescriptor, info: String?): GpuBufferWgpu + fun createTexture(descriptor: GPUTextureDescriptor): WgpuTextureResource + + override fun renderFrame(frameData: FrameData, ctx: KoolContext) + override fun cleanup(ctx: KoolContext) + override fun generateKslShader( + shader: KslShader, + pipeline: DrawPipeline + ): ShaderCode + + override fun generateKslComputeShader( + shader: KslComputeShader, + pipeline: ComputePipeline + ): ComputeShaderCode + + override fun createOffscreenPass2d(parentPass: OffscreenPass2d): OffscreenPass2dImpl + override fun createOffscreenPassCube(parentPass: OffscreenPassCube): OffscreenPassCubeImpl + override fun createComputePass(parentPass: ComputePass): ComputePassImpl + override fun uploadTextureData(tex: Texture) + override fun downloadTextureData( + texture: Texture<*>, + deferred: CompletableDeferred + ) + + override fun downloadBuffer( + buffer: GpuBuffer, + deferred: CompletableDeferred, + resultBuffer: Buffer + ) +} + +//class RenderBackendWebGpu(val ctx: WasmContext) : RenderBackend { +// override val name: String = "WebGPU" +// override val apiName: String = "WebGPU" +// override val deviceName: String = "WebGPU" +// override val deviceCoordinates: DeviceCoordinates = DeviceCoordinates.WEB_GPU +// override lateinit var features: BackendFeatures; private set +// +// private val canvas: HTMLCanvasElement get() = ctx.window.canvas +// lateinit var adapter: GPUAdapter +// private set +// lateinit var device: GPUDevice +// private set +// lateinit var canvasContext: GPUCanvasContext +// private set +// private var _canvasFormat: GPUTextureFormat? = null +// val canvasFormat: GPUTextureFormat +// get() = _canvasFormat!! +// +// internal lateinit var textureLoader: WgpuTextureLoader +// private set +// +// var isTimestampQuerySupported = false +// private set +// internal val timestampQuery: WgpuTimestamps by lazy { WgpuTimestamps(128, this) } +// +// val pipelineManager = WgpuPipelineManager(this) +// private val screenPass = WgpuScreenPass(this) +// +// private var renderSize = Vec2i(canvas.width, canvas.height) +// +// private val gpuReadbacks = mutableListOf() +// +// override val frameGpuTime: Duration = 0.0.seconds +// +// override val isAsyncRendering: Boolean = false +// +// val clearHelper: ClearHelper by lazy { ClearHelper(this) } +// private val passEncoderState = RenderPassEncoderState(this) +// +// init { +// check(isSupported()) { "WebGPU not supported on this browser." } +// } +// +// internal suspend fun createWebGpuContext(): Boolean { +// val powerPref = when (KoolSystem.configWasm.powerPreference) { +// PowerPreference.HighPerformance -> GPUPowerPreference.highPerformance +// PowerPreference.LowPower -> GPUPowerPreference.lowPower +// } +// val selectedAdapter = navigator.gpu.requestAdapter(GPURequestAdapterOptions(powerPref)).await() +// ?: navigator.gpu.requestAdapter().await() +// if (selectedAdapter == null) { +// logE { "No appropriate GPUAdapter found." } +// return false +// } +// adapter = selectedAdapter +// +//// val availableFeatures = adapter.features.toList() +//// logD { "Available GPUAdapter features:" } +//// availableFeatures.forEach { logD { it } } +// +// val requiredFeatures = mutableListOf() +//// if ("timestamp-query" in availableFeatures) { +// logI { "Enabling WebGPU timestamp-query feature" } +// requiredFeatures.add("timestamp-query") +// isTimestampQuerySupported = true +//// } +//// if ("rg11b10ufloat-renderable" in availableFeatures) { +// logI { "Enabling rg11b10ufloat-renderable feature" } +// requiredFeatures.add("rg11b10ufloat-renderable") +//// } +// +// try { +// val deviceDesc = GPUDeviceDescriptor(requiredFeatures) +// device = adapter.requestDevice(deviceDesc).await() +// } catch (e: Exception) { +// logE { "requestDevice() failed: $e" } +// return false +// } +// +// features = BackendFeatures( +// computeShaders = true, +// cubeMapArrays = true, +// reversedDepth = true, +// maxSamples = 4, +// readWriteStorageTextures = false, +// depthOnlyShaderColorOutput = Color.BLACK, +// maxComputeWorkGroupsPerDimension = Vec3i( +// device.limits.maxComputeWorkgroupsPerDimension, +// device.limits.maxComputeWorkgroupsPerDimension, +// device.limits.maxComputeWorkgroupsPerDimension, +// ), +// maxComputeWorkGroupSize = Vec3i( +// device.limits.maxComputeWorkgroupSizeX, +// device.limits.maxComputeWorkgroupSizeY, +// device.limits.maxComputeWorkgroupSizeZ, +// ), +// maxComputeInvocationsPerWorkgroup = device.limits.maxComputeInvocationsPerWorkgroup, +// ) +// +// canvasContext = canvas.getContext("webgpu") as GPUCanvasContext +// _canvasFormat = GPUTextureFormat.forValue(navigator.gpu.getPreferredCanvasFormat()) +// canvasContext.configure( +// GPUCanvasConfiguration(device, canvasFormat) +// ) +// textureLoader = WgpuTextureLoader(this) +// logI { "WebGPU context created" } +// return true +// } +// +// override fun renderFrame(frameData: FrameData, ctx: KoolContext) { +// BackendStats.resetPerFrameCounts() +// +// if (ctx.window.framebufferSize != renderSize) { +// renderSize = ctx.window.framebufferSize +// screenPass.applySize(renderSize.x, renderSize.y) +// } +// +// passEncoderState.beginFrame() +// +// frameData.preparePipelines() +// frameData.executePasses() +// +// passEncoderState.ensureRenderPassInactive() +// if (gpuReadbacks.isNotEmpty()) { +// // copy all buffers requested for readback to temporary buffers using the current command encoder +// copyReadbacks(passEncoderState.encoder) +// } +// timestampQuery.resolve(passEncoderState.encoder) +// passEncoderState.endFrame() +// +// timestampQuery.readTimestamps() +// if (gpuReadbacks.isNotEmpty()) { +// // after encoder is finished and submitted, temp buffers can be mapped for readback +// mapReadbacks() +// } +// } +// +// private fun FrameData.preparePipelines() { +// forEachPass { passData -> +// val t = Time.precisionTime +// passData.forEachView { viewData -> +// viewData.drawQueue.forEach { cmd -> pipelineManager.prepareDrawPipeline(cmd) } +// } +// passData.gpuPass.tRecord = (Time.precisionTime - t).seconds +// } +// } +// +// private fun FrameData.executePasses() { +// forEachPass { passData -> passData.executePass(passEncoderState) } +// } +// +// private fun PassData.executePass(passEncoderState: RenderPassEncoderState) { +// val pass = gpuPass +// val t = Time.precisionTime +// when (pass) { +// is Scene.ScreenPass -> screenPass.renderScene(this, passEncoderState) +// is OffscreenPass2d -> pass.draw(this, passEncoderState) +// is OffscreenPassCube -> pass.draw(this, passEncoderState) +// is ComputePass -> pass.dispatch(passEncoderState) +// else -> throw IllegalArgumentException("Offscreen pass type not implemented: $this") +// } +// pass.tRecord = (Time.precisionTime - t).seconds +// } +// +// private fun OffscreenPass2d.draw(passData: PassData, passEncoderState: RenderPassEncoderState) { +// (impl as WgpuOffscreenPass2d).draw(passData, passEncoderState) +// } +// +// private fun OffscreenPassCube.draw(passData: PassData, passEncoderState: RenderPassEncoderState) { +// (impl as WgpuOffscreenPassCube).draw(passData, passEncoderState) +// } +// +// private fun ComputePass.dispatch(passEncoderState: RenderPassEncoderState) { +// passEncoderState.ensureRenderPassInactive() +// (impl as WgpuComputePass).dispatch(passEncoderState.encoder) +// } +// +// override fun cleanup(ctx: KoolContext) { +// // do nothing for now +// } +// +// override fun generateKslShader(shader: KslShader, pipeline: DrawPipeline): ShaderCode { +// val output = WgslGenerator.generateProgram(shader.program, pipeline) +// return WebGpuShaderCode( +// vertexSrc = output.vertexSrc, +// vertexEntryPoint = output.vertexEntryPoint, +// fragmentSrc = output.fragmentSrc, +// fragmentEntryPoint = output.fragmentEntryPoint +// ) +// } +// +// override fun generateKslComputeShader(shader: KslComputeShader, pipeline: ComputePipeline): ComputeShaderCode { +// val output = WgslGenerator.generateComputeProgram(shader.program, pipeline) +// return WebGpuComputeShaderCode( +// computeSrc = output.computeSrc, +// computeEntryPoint = output.computeEntryPoint +// ) +// } +// +// override fun createOffscreenPass2d(parentPass: OffscreenPass2d): OffscreenPass2dImpl { +// return WgpuOffscreenPass2d(parentPass, this) +// } +// +// override fun createOffscreenPassCube(parentPass: OffscreenPassCube): OffscreenPassCubeImpl { +// return WgpuOffscreenPassCube(parentPass, this) +// } +// +// override fun createComputePass(parentPass: ComputePass): ComputePassImpl { +// return WgpuComputePass(parentPass, this) +// } +// +// override fun uploadTextureData(tex: Texture) = textureLoader.loadTexture(tex) +// +// override fun downloadBuffer(buffer: GpuBuffer, deferred: CompletableDeferred, resultBuffer: Buffer) { +// gpuReadbacks += ReadbackStorageBuffer(buffer, deferred, resultBuffer) +// } +// +// override fun downloadTextureData(texture: Texture<*>, deferred: CompletableDeferred) { +// gpuReadbacks += ReadbackTexture(texture, deferred) +// } +// +// private fun copyReadbacks(encoder: GPUCommandEncoder) { +// gpuReadbacks.filterIsInstance().forEach { readback -> +// val gpuBuf = readback.storage.gpuBuffer as GpuBufferWgpu? +// if (gpuBuf == null) { +// readback.deferred.completeExceptionally(IllegalStateException("Failed reading buffer")) +// } else { +// val size = readback.resultBuffer.limit.toLong() * 4 +// val mapBuffer = device.createBuffer( +// GPUBufferDescriptor( +// label = "storage-buffer-readback", +// size = size.toJsNumber(), +// usage = GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST +// ) +// ) +// encoder.copyBufferToBuffer(gpuBuf.buffer, 0.toJsNumber(), mapBuffer, 0.toJsNumber(), size.toJsNumber()) +// readback.mapBuffer = mapBuffer +// } +// } +// +// gpuReadbacks.filterIsInstance().forEach { readback -> +// val gpuTex = readback.texture.gpuTexture as WgpuTextureResource? +// if (gpuTex == null || readback.texture.format.isF16) { +// readback.deferred.completeExceptionally(IllegalStateException("Failed reading texture")) +// } else { +// val format = readback.texture.format +// val size = format.pxSize.toLong() * gpuTex.width * gpuTex.height * gpuTex.depth +// val mapBuffer = device.createBuffer( +// GPUBufferDescriptor( +// label = "texture-readback", +// size = size.toJsNumber(), +// usage = GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST +// ) +// ) +// encoder.copyTextureToBuffer( +// source = GPUImageCopyTexture(gpuTex.gpuTexture), +// destination = GPUImageCopyBuffer( +// buffer = mapBuffer, +// bytesPerRow = format.pxSize * gpuTex.width, +// rowsPerImage = gpuTex.height +// ), +// copySize = intArrayOf(gpuTex.width, gpuTex.height, gpuTex.depth).toJsArray() +// ) +// readback.mapBuffer = mapBuffer +// } +// } +// } +// +// private fun mapReadbacks() { +// gpuReadbacks.filterIsInstance().filter { it.mapBuffer != null }.forEach { readback -> +// val mapBuffer = readback.mapBuffer!! +// mapBuffer.mapAsync(GPUMapMode.READ).then { +// readback.resultBuffer.copyFrom(mapBuffer.getMappedRange()) +// mapBuffer.unmap() +// mapBuffer.destroy() +// readback.deferred.complete(Unit) +// it +// } +// } +// +// gpuReadbacks.filterIsInstance().filter { it.mapBuffer != null }.forEach { readback -> +// val mapBuffer = readback.mapBuffer!! +// mapBuffer.mapAsync(GPUMapMode.READ).then { +// val gpuTex = readback.texture.gpuTexture as WgpuTextureResource +// val format = readback.texture.format +// val dst = ImageData.createBuffer(format, gpuTex.width, gpuTex.height, gpuTex.depth) +// dst.copyFrom(mapBuffer.getMappedRange()) +// mapBuffer.unmap() +// mapBuffer.destroy() +// when (readback.texture) { +// is Texture1d -> readback.deferred.complete(BufferedImageData1d(dst, gpuTex.width, format)) +// is Texture2d -> readback.deferred.complete(BufferedImageData2d(dst, gpuTex.width, gpuTex.height, format)) +// is Texture3d -> readback.deferred.complete(BufferedImageData3d(dst, gpuTex.width, gpuTex.height, gpuTex.depth, format)) +// else -> readback.deferred.completeExceptionally(IllegalArgumentException("Unsupported texture type")) +// } +// it +// } +// } +// +// gpuReadbacks.clear() +// } +// +// private fun Buffer.copyFrom(src: ArrayBuffer) { +// when (this) { +// is Uint8BufferImpl -> this.buffer.set(Uint8Array(src)) +// is Uint16BufferImpl -> this.buffer.set(Uint16Array(src)) +// is Int32BufferImpl -> this.buffer.set(Int32Array(src)) +// is Float32BufferImpl -> this.buffer.set(Float32Array(src)) +// is MixedBufferImpl -> Uint8Array(this.buffer.buffer).set(Uint8Array(src)) +// else -> logE { "Unexpected buffer type: ${this::class.simpleName}" } +// } +// } +// +// fun createBuffer(descriptor: GPUBufferDescriptor, info: String?): GpuBufferWgpu { +// return GpuBufferWgpu(device.createBuffer(descriptor), descriptor.size.toLong(), info) +// } +// +// fun createTexture(descriptor: GPUTextureDescriptor): WgpuTextureResource { +// return WgpuTextureResource(descriptor, device.createTexture(descriptor)) +// } +// +// private interface GpuReadback +// +// private class ReadbackStorageBuffer(val storage: GpuBuffer, val deferred: CompletableDeferred, val resultBuffer: Buffer) : GpuReadback { +// var mapBuffer: GPUBuffer? = null +// } +// +// private class ReadbackTexture(val texture: Texture<*>, val deferred: CompletableDeferred) : GpuReadback { +// var mapBuffer: GPUBuffer? = null +// } +// +// data class WebGpuShaderCode( +// val vertexSrc: String, +// val vertexEntryPoint: String, +// val fragmentSrc: String, +// val fragmentEntryPoint: String +// ): ShaderCode { +// override val hash = LongHash { +// this += vertexSrc.hashCode().toLong() shl 32 or fragmentSrc.hashCode().toLong() +// } +// } +// +// data class WebGpuComputeShaderCode(val computeSrc: String, val computeEntryPoint: String): ComputeShaderCode { +// override val hash = LongHash { +// this += computeSrc +// } +// } +// +// companion object : BackendProvider { +// override val displayName: String = "WebGPU" +// +// override suspend fun createBackend(ctx: KoolContext): Result { +// return if (isSupported()) { +// val backend = RenderBackendWebGpu(ctx as WasmContext) +// if (backend.createWebGpuContext()) { +// Result.success(backend) +// } else { +// Result.failure(IllegalStateException("Failed to create WebGPU context")) +// } +// } else { +// Result.failure(IllegalStateException("WebGPU is not supported by this browser")) +// } +// } +// +// fun isSupported(): Boolean { +// return !isNoWgpuSupport() +// } +// } +//} + +data class WebGpuShaderCode( + val vertexSrc: String, + val vertexEntryPoint: String, + val fragmentSrc: String, + val fragmentEntryPoint: String +): ShaderCode { + override val hash = LongHash { + this += vertexSrc.hashCode().toLong() shl 32 or fragmentSrc.hashCode().toLong() + } +} + +data class WebGpuComputeShaderCode(val computeSrc: String, val computeEntryPoint: String): ComputeShaderCode { + override val hash = LongHash { + this += computeSrc + } +} + +private fun isNoWgpuSupport(): Boolean = js("!navigator.gpu") diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuBindGroupData.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuBindGroupData.kt similarity index 98% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuBindGroupData.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuBindGroupData.kt index 4c3740bd0..f9d60fddb 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuBindGroupData.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuBindGroupData.kt @@ -3,7 +3,9 @@ package de.fabmax.kool.pipeline.backend.webgpu import de.fabmax.kool.pipeline.* import de.fabmax.kool.pipeline.backend.GpuBindGroupData import de.fabmax.kool.pipeline.backend.wgsl.WgslLocations +import de.fabmax.kool.toJsNumber import de.fabmax.kool.util.* +import kotlin.js.toJsNumber class WgpuBindGroupData( private val data: BindGroupData, @@ -51,7 +53,7 @@ class WgpuBindGroupData( if (ubo.modCount != ubo.binding.modCount.count || recreatedBindGroup) { device.queue.writeBuffer( buffer = ubo.gpuBuffer.buffer, - bufferOffset = 0L, + bufferOffset = 0L.toJsNumber(), data = (ubo.binding.buffer.buffer as MixedBufferImpl).buffer ) } @@ -71,7 +73,7 @@ class WgpuBindGroupData( } device.queue.writeBuffer( buffer = storage.gpuBuffer.buffer, - bufferOffset = 0L, + bufferOffset = 0.toJsNumber(), data = hostBuffer ) } @@ -115,7 +117,7 @@ class WgpuBindGroupData( bindGroup = backend.device.createBindGroup( label = "bindGroup[${data.layout.scope}]", layout = gpuLayout, - entries = bindGroupEntries.toTypedArray() + entries = bindGroupEntries ) } @@ -125,7 +127,7 @@ class WgpuBindGroupData( val gpuBuffer = backend.createBuffer( GPUBufferDescriptor( label = "bindGroup[${data.layout.scope}]-ubo-${name}", - size = struct.structSize.toLong(), + size = struct.structSize.toJsNumber(), usage = GPUBufferUsage.UNIFORM or GPUBufferUsage.COPY_DST ), "scene: ${pass.parentScene?.name}, render-pass: ${pass.name}" @@ -142,7 +144,7 @@ class WgpuBindGroupData( gpuBuffer = backend.createBuffer( GPUBufferDescriptor( label = "bindGroup[${data.layout.scope}]-storage-${name}", - size = storage.size * storage.type.byteSize.toLong(), + size = (storage.size * storage.type.byteSize).toJsNumber(), usage = GPUBufferUsage.STORAGE or GPUBufferUsage.COPY_SRC or GPUBufferUsage.COPY_DST ), "scene: ${pass.parentScene?.name}, render-pass: ${pass.name}" diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePass.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePass.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePass.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePass.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePipeline.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePipeline.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePipeline.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuComputePipeline.kt diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDictionaries.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDictionaries.kt new file mode 100644 index 000000000..e237f5725 --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDictionaries.kt @@ -0,0 +1,826 @@ +@file:Suppress("unused") + +package de.fabmax.kool.pipeline.backend.webgpu + +import de.fabmax.kool.toJsArray +import de.fabmax.kool.toJsNumber +import de.fabmax.kool.util.Color +import org.w3c.dom.ImageBitmap +import kotlin.js.* + +external interface GPUBindGroupLayoutDescriptor : JsAny + +fun GPUBindGroupLayoutDescriptor( + entries: List, + label: String = "" +) = GPUBindGroupLayoutDescriptor(entries.toJsArray(), label) + +private fun GPUBindGroupLayoutDescriptor( + entries: JsArray, + label: String +): GPUBindGroupLayoutDescriptor = js("""({ + entries: entries, + label: label +})""") + +sealed external interface GPUBindGroupLayoutEntry : JsAny +external interface GPUBindGroupLayoutEntryBuffer : GPUBindGroupLayoutEntry +external interface GPUBindGroupLayoutEntrySampler : GPUBindGroupLayoutEntry +external interface GPUBindGroupLayoutEntryTexture : GPUBindGroupLayoutEntry +external interface GPUBindGroupLayoutEntryStorageTexture : GPUBindGroupLayoutEntry +external interface GPUBindGroupLayoutEntryExternalTexture : GPUBindGroupLayoutEntry + +fun GPUBindGroupLayoutEntryBuffer( + binding: Int, + visibility: Int, + buffer: GPUBufferBindingLayout, +): GPUBindGroupLayoutEntryBuffer = js("""({ + binding: binding, + visibility: visibility, + buffer: buffer +})""") + +fun GPUBindGroupLayoutEntrySampler( + binding: Int, + visibility: Int, + sampler: GPUSamplerBindingLayout, +): GPUBindGroupLayoutEntrySampler = js("""({ + binding: binding, + visibility: visibility, + sampler: sampler +})""") + +fun GPUBindGroupLayoutEntryTexture( + binding: Int, + visibility: Int, + texture: GPUTextureBindingLayout, +): GPUBindGroupLayoutEntryTexture = js("""({ + binding: binding, + visibility: visibility, + texture: texture +})""") + +fun GPUBindGroupLayoutEntryStorageTexture( + binding: Int, + visibility: Int, + storageTexture: GPUStorageTextureBindingLayout, +): GPUBindGroupLayoutEntryStorageTexture = js("""({ + binding: binding, + visibility: visibility, + storageTexture: storageTexture +})""") + +fun GPUBindGroupLayoutEntryExternalTexture( + binding: Int, + visibility: Int, + externalTexture: GPUExternalTextureBindingLayout, +): GPUBindGroupLayoutEntryExternalTexture = js("""({ + binding: binding, + visibility: visibility, + externalTexture: externalTexture +})""") + +external interface GPUBufferBindingLayout : JsAny + +fun GPUBufferBindingLayout( + type: GPUBufferBindingType = GPUBufferBindingType.uniform, + hasDynamicOffset: Boolean = false, + minBindingSize: Long = 0 +): GPUBufferBindingLayout = GPUBufferBindingLayout(type.value, hasDynamicOffset, minBindingSize.toJsNumber()) + +private fun GPUBufferBindingLayout( + type: String, + hasDynamicOffset: Boolean, + minBindingSize: JsNumber +): GPUBufferBindingLayout = js("""({ + type: type, + hasDynamicOffset: hasDynamicOffset, + minBindingSize: minBindingSize +})""") + +external interface GPUSamplerBindingLayout : JsAny + +fun GPUSamplerBindingLayout( + type: GPUSamplerBindingType = GPUSamplerBindingType.filtering +): GPUSamplerBindingLayout = GPUSamplerBindingLayout(type.value) + +private fun GPUSamplerBindingLayout( + type: String +): GPUSamplerBindingLayout = js("""({ + type: type +})""") + +external interface GPUTextureBindingLayout : JsAny + +fun GPUTextureBindingLayout( + sampleType: GPUTextureSampleType = GPUTextureSampleType.float, + viewDimension: GPUTextureViewDimension = GPUTextureViewDimension.view2d, + multisampled: Boolean = false +): GPUTextureBindingLayout = GPUTextureBindingLayout(sampleType.value, viewDimension.value, multisampled) + +private fun GPUTextureBindingLayout( + sampleType: String, + viewDimension: String, + multisampled: Boolean +): GPUTextureBindingLayout = js("""({ + sampleType: sampleType, + viewDimension: viewDimension, + multisampled: multisampled +})""") + +external interface GPUStorageTextureBindingLayout : JsAny + +fun GPUStorageTextureBindingLayout( + access: GPUStorageTextureAccess, + format: GPUTextureFormat, + viewDimension: GPUTextureViewDimension +): GPUStorageTextureBindingLayout = GPUStorageTextureBindingLayout(access.value, format.value, viewDimension.value) + +private fun GPUStorageTextureBindingLayout( + access: String, + format: String, + viewDimension: String +): GPUStorageTextureBindingLayout = js("""({ + access: access, + format: format, + viewDimension: viewDimension +})""") + +external interface GPUExternalTextureBindingLayout : JsAny + +external interface GPUBindGroupDescriptor : JsAny + +fun GPUBindGroupDescriptor( + layout: GPUBindGroupLayout, + entries: List, + label: String = "" +) = GPUBindGroupDescriptor(layout, entries.toJsArray(), label) + +private fun GPUBindGroupDescriptor( + layout: GPUBindGroupLayout, + entries: JsArray, + label: String +): GPUBindGroupDescriptor = js("""({ + layout: layout, + entries: entries, + label: label +})""") + +external interface GPUBindGroupEntry : JsAny + +fun GPUBindGroupEntry( + binding: Int, + resource: GPUBindingResource +): GPUBindGroupEntry = js("""({ + binding: binding, + resource: resource +})""") + +external interface GPUBlendState : JsAny + +fun GPUBlendState( + color: GPUBlendComponent, + alpha: GPUBlendComponent, +): GPUBlendState = js("""({ + color: color, + alpha: alpha +})""") + +external interface GPUBlendComponent : JsAny + +fun GPUBlendComponent( + operation: GPUBlendOperation = GPUBlendOperation.add, + srcFactor: GPUBlendFactor = GPUBlendFactor.one, + dstFactor: GPUBlendFactor = GPUBlendFactor.zero, +) = GPUBlendComponent(operation.value, srcFactor.value, dstFactor.value) + +private fun GPUBlendComponent( + operation: String, + srcFactor: String, + dstFactor: String, +): GPUBlendComponent = js("""({ + operation: operation, + srcFactor: srcFactor, + dstFactor: dstFactor +})""") + +external interface GPUBufferBinding : GPUBindingResource + +fun GPUBufferBinding( + buffer: GPUBuffer, + offset: JsNumber = 0.toJsNumber(), +) : GPUBindingResource = js("""({ + buffer: buffer, + offset: offset +})""") + +external interface GPUBufferDescriptor { + val size: JsNumber +} + +fun GPUBufferDescriptor( + size: JsNumber, + usage: Int, + mappedAtCreation: Boolean = false, + label: String = "", +): GPUBufferDescriptor = js("""({ + size: size, + usage: usage, + mappedAtCreation: mappedAtCreation, + label: label +})""") + +external interface GPUCanvasConfiguration : JsAny + +fun GPUCanvasConfiguration( + device: GPUDevice, + format: GPUTextureFormat, + usage: Int? = null, + colorSpace: GPUPredefinedColorSpace? = null, + alphaMode: GPUCanvasAlphaMode? = null +): GPUCanvasConfiguration = GPUCanvasConfiguration(device, format.value, usage, colorSpace?.value, alphaMode?.value) + +private fun GPUCanvasConfiguration( + device: GPUDevice, + format: String, + usage: Int?, + colorSpace: String?, + alphaMode: String?, +): GPUCanvasConfiguration = js("""({ + device: device, + format: format, + usage: (usage != null ? usage : undefined), + colorSpace: (colorSpace != null ? colorSpace : undefined), + alphaMode: (alphaMode != null ? alphaMode : undefined) +})""") + +external interface GPUColorDict + +fun GPUColorDict( + r: Float, + g: Float, + b: Float, + a: Float, +): GPUColorDict = js("({r: r, g: g, b: b, a: a})") + +fun GPUColorDict(color: Color): GPUColorDict = GPUColorDict(color.r, color.g, color.b, color.a) + +external interface GPUColorTargetState : JsAny + +fun GPUColorTargetState( + format: GPUTextureFormat, + blend: GPUBlendState? = null +) : GPUColorTargetState = GPUColorTargetState(format.value, blend) + +fun GPUColorTargetState( + format: String, + blend: GPUBlendState? = null, +) : GPUColorTargetState = js("""({ + format: format, + blend: (blend != null ? blend : undefined) +})""") + +external interface GPUComputePassDescriptor : JsAny + +fun GPUComputePassDescriptor( + label: String = "", + timestampWrites: GPUComputePassTimestampWrites? = null +): GPUComputePassDescriptor = js("""({ + label: label, + timestampWrites: (timestampWrites != null ? timestampWrites : undefined) +})""") + +external interface GPUComputePipelineDescriptor : JsAny + +fun GPUComputePipelineDescriptor( + layout: GPUPipelineLayout, + compute: GPUProgrammableStage, + label: String = "", +): GPUComputePipelineDescriptor = js("""({ + layout: layout, + compute: compute, + label: label +})""") + +external interface GPUFragmentState : JsAny + +fun GPUFragmentState( + module: GPUShaderModule, + entryPoint: String, + targets: List, +) = GPUFragmentState(module, entryPoint, targets.toJsArray()) + +private fun GPUFragmentState( + module: GPUShaderModule, + entryPoint: String, + targets: JsArray, +): GPUFragmentState = js("""({ + module: module, + entryPoint: entryPoint, + targets: targets +})""") + +external interface GPUImageCopyExternalImage : JsAny + +fun GPUImageCopyExternalImage( + source: ImageBitmap +): GPUImageCopyExternalImage = js("({source: source})") + +external interface GPUImageCopyBuffer : JsAny + +fun GPUImageCopyBuffer( + buffer: GPUBuffer, + bytesPerRow: Int, + rowsPerImage: Int, + offset: JsNumber = 0.toJsNumber() +) : GPUImageCopyBuffer = js("""({ + buffer: buffer, + bytesPerRow: bytesPerRow, + rowsPerImage: rowsPerImage, + offset: offset +})""") + +external interface GPUImageCopyTexture : JsAny + +fun GPUImageCopyTexture( + texture: GPUTexture, + mipLevel: Int = 0, + origin: IntArray = intArrayOf(0, 0, 0), +): GPUImageCopyTexture = GPUImageCopyTexture(texture, mipLevel, origin.toJsArray()) + +private fun GPUImageCopyTexture( + texture: GPUTexture, + mipLevel: Int, + origin: JsArray, +): GPUImageCopyTexture = js("""({ + texture: texture, + mipLevel: mipLevel, + origin: origin +})""") + +external interface GPUImageCopyTextureTagged : JsAny + +fun GPUImageCopyTextureTagged( + texture: GPUTexture, + mipLevel: Int = 0, + origin: IntArray = intArrayOf(0, 0, 0), + //aspect: GPUTextureAspect = 'all' + //colorSpace: PredefinedColorSpace = 'srgb' + //premultipliedAlpha: boolean = 'false' +): GPUImageCopyTextureTagged = GPUImageCopyTextureTagged(texture, mipLevel, origin.toJsArray()) + +private fun GPUImageCopyTextureTagged( + texture: GPUTexture, + mipLevel: Int, + origin: JsArray, +): GPUImageCopyTextureTagged = js("""({ + texture: texture, + mipLevel: mipLevel, + origin: origin +})""") + +external interface GPUImageDataLayout : JsAny + +fun GPUImageDataLayout( + bytesPerRow: Int, + rowsPerImage: Int, + offset: JsNumber = 0.toJsNumber() +): GPUImageDataLayout = js("""({ + bytesPerRow: bytesPerRow, + rowsPerImage: rowsPerImage, + offset: offset +})""") + +external interface GPUMultisampleState : JsAny + +fun GPUMultisampleState( + count: Int = 1, + alphaToCoverageEnabled: Boolean = false +) : GPUMultisampleState = js("""({ + count: count, + alphaToCoverageEnabled: alphaToCoverageEnabled +})""") + +external interface GPUPipelineLayoutDescriptor : JsAny + +fun GPUPipelineLayoutDescriptor( + bindGroupLayouts: List, + label: String = "" +): GPUPipelineLayoutDescriptor = GPUPipelineLayoutDescriptor(bindGroupLayouts.toJsArray(), label) + +fun GPUPipelineLayoutDescriptor( + bindGroupLayouts: JsArray, + label: String +): GPUPipelineLayoutDescriptor = js("""({ + bindGroupLayouts: bindGroupLayouts, + label: label +})""") + +external interface GPUPrimitiveState : JsAny + +fun GPUPrimitiveState( + topology: GPUPrimitiveTopology, + stripIndexFormat: GPUIndexFormat = GPUIndexFormat.uint32, + frontFace: GPUFrontFace = GPUFrontFace.ccw, + cullMode: GPUCullMode = GPUCullMode.none, + unclippedDepth: Boolean = false +): GPUPrimitiveState { + val stripFmt = if (topology == GPUPrimitiveTopology.triangleStrip || topology == GPUPrimitiveTopology.lineStrip) stripIndexFormat.value else null + return GPUPrimitiveState(topology.value, stripFmt, frontFace.value, cullMode.value, unclippedDepth) +} + +private fun GPUPrimitiveState( + topology: String, + stripIndexFormat: String?, + frontFace: String, + cullMode: String, + unclippedDepth: Boolean +): GPUPrimitiveState = js("""({ + topology: topology, + stripIndexFormat: (stripIndexFormat != null ? stripIndexFormat : undefined), + frontFace: frontFace, + cullMode: cullMode, + unclippedDepth: unclippedDepth +})""") + +external interface GPURenderPassColorAttachment : JsAny + +fun GPURenderPassColorAttachment( + view: GPUTextureView, + clearValue: GPUColorDict? = null, + resolveTarget: GPUTextureView? = null, + loadOp: GPULoadOp = if (clearValue != null) GPULoadOp.clear else GPULoadOp.load, + storeOp: GPUStoreOp = GPUStoreOp.store, + label: String = "" +) : GPURenderPassColorAttachment = GPURenderPassColorAttachment(view, clearValue, resolveTarget, loadOp.value, storeOp.value, label) + +private fun GPURenderPassColorAttachment( + view: GPUTextureView, + clearValue: GPUColorDict? = null, + resolveTarget: GPUTextureView? = null, + loadOp: String, + storeOp: String, + label: String = "" +) : GPURenderPassColorAttachment= js("""({ + view: view, + loadOp: loadOp, + storeOp: storeOp, + label: label, + clearValue: (clearValue != null ? clearValue : undefined), + resolveTarget: (resolveTarget != null ? resolveTarget : undefined) +})""") + +external interface GPURenderPassDepthStencilAttachment : JsAny + +fun GPURenderPassDepthStencilAttachment( + view: GPUTextureView, + depthLoadOp: GPULoadOp, + depthStoreOp: GPUStoreOp, + depthClearValue: Float = 1f, +): GPURenderPassDepthStencilAttachment = GPURenderPassDepthStencilAttachment(view, depthLoadOp.value, depthStoreOp.value, depthClearValue) + +private fun GPURenderPassDepthStencilAttachment( + view: GPUTextureView, + depthLoadOp: String, + depthStoreOp: String, + depthClearValue: Float, +): GPURenderPassDepthStencilAttachment = js("""({ + view: view, + depthLoadOp: depthLoadOp, + depthStoreOp: depthStoreOp, + depthClearValue: depthClearValue +})""") + +external interface GPURenderPassDescriptor : JsAny + +fun GPURenderPassDescriptor( + colorAttachments: List, + depthStencilAttachment: GPURenderPassDepthStencilAttachment? = null, + timestampWrites: GPURenderPassTimestampWrites? = null, + label: String = "" +): GPURenderPassDescriptor = GPURenderPassDescriptor(colorAttachments.toJsArray(), depthStencilAttachment, timestampWrites, label) + +private fun GPURenderPassDescriptor( + colorAttachments: JsArray, + depthStencilAttachment: GPURenderPassDepthStencilAttachment?, + timestampWrites: GPURenderPassTimestampWrites?, + label: String +): GPURenderPassDescriptor = js("""({ + colorAttachments: colorAttachments, + depthStencilAttachment: (depthStencilAttachment != null ? depthStencilAttachment : undefined), + timestampWrites: (timestampWrites != null ? timestampWrites : undefined), + label: label +})""") + +external interface GPUComputePassTimestampWrites : JsAny + +fun GPUComputePassTimestampWrites( + querySet: GPUQuerySet, + beginningOfPassWriteIndex: Int, + endOfPassWriteIndex: Int +): GPUComputePassTimestampWrites = js("""({ + querySet: querySet, + beginningOfPassWriteIndex: beginningOfPassWriteIndex, + endOfPassWriteIndex: endOfPassWriteIndex +})""") + +external interface GPURenderPassTimestampWrites : JsAny + +fun GPURenderPassTimestampWrites( + querySet: GPUQuerySet, + beginningOfPassWriteIndex: Int, + endOfPassWriteIndex: Int +): GPURenderPassTimestampWrites = js("""({ + querySet: querySet, + beginningOfPassWriteIndex: beginningOfPassWriteIndex, + endOfPassWriteIndex: endOfPassWriteIndex +})""") + +external interface GPURenderPipelineDescriptor : JsAny + +fun GPURenderPipelineDescriptor( + layout: JsAny, //GPUPipelineLayout + vertex: GPUVertexState, + fragment: GPUFragmentState? = null, + depthStencil: GPUDepthStencilState? = null, + primitive: GPUPrimitiveState? = null, + multisample: GPUMultisampleState? = null, + label: String = "", +): GPURenderPipelineDescriptor = js("""({ + layout: layout, + vertex: vertex, + fragment: (fragment != null ? fragment : undefined), + depthStencil: (depthStencil != null ? depthStencil : undefined), + primitive: (primitive != null ? primitive : undefined), + multisample: (multisample != null ? multisample : undefined), + label: label +})""") + +external interface GPUDepthStencilState : JsAny + +fun GPUDepthStencilState( + format: GPUTextureFormat, + depthWriteEnabled: Boolean, + depthCompare: GPUCompareFunction, + depthBias: Int = 0, + depthBiasSlopeScale: Float = 0f, + depthBiasClamp: Float = 0f +): GPUDepthStencilState = GPUDepthStencilState(format.value, depthWriteEnabled, depthCompare.value, depthBias, depthBiasSlopeScale, depthBiasClamp) + +private fun GPUDepthStencilState( + format: String, + depthWriteEnabled: Boolean, + depthCompare: String, + depthBias: Int, + depthBiasSlopeScale: Float, + depthBiasClamp: Float +): GPUDepthStencilState = js("""({ + format: format, + depthWriteEnabled: depthWriteEnabled, + depthCompare: depthCompare, + depthBias: depthBias, + depthBiasSlopeScale: depthBiasSlopeScale, + depthBiasClamp: depthBiasClamp +})""") + +external interface GPUDeviceDescriptor : JsAny + +fun GPUDeviceDescriptor( + requiredFeatures: List, + label: String = "", +): GPUDeviceDescriptor = GPUDeviceDescriptor(requiredFeatures.toJsArray(), label) + +private fun GPUDeviceDescriptor( + requiredFeatures: JsArray, + label: String, +): GPUDeviceDescriptor = js("""({ + requiredFeatures: requiredFeatures, + label: label +})""") + +external interface GPUProgrammableStage : JsAny + +fun GPUProgrammableStage( + module: GPUShaderModule, + entryPoint: String, + // constants: Map +): GPUProgrammableStage = js("""({ + module: module, + entryPoint: entryPoint +})""") + +external interface GPUQuerySetDescriptor : JsAny + +fun GPUQuerySetDescriptor( + type: GPUQueryType, + count: Int, + label: String = "", +): GPUQuerySetDescriptor = GPUQuerySetDescriptor(type.value, count, label) + +fun GPUQuerySetDescriptor( + type: String, + count: Int, + label: String = "", +): GPUQuerySetDescriptor = js("""({ + type: type, + count: count, + label: label +})""") + +external interface GPUShaderModuleDescriptor : JsAny + +fun GPUShaderModuleDescriptor( + code: String, + label: String = "" +): GPUShaderModuleDescriptor = js("""({ + code: code, + label: label +})""") + +external interface GPUSamplerDescriptor : JsAny + +fun GPUSamplerDescriptor( + label: String = "", + addressModeU: GPUAddressMode = GPUAddressMode.clampToEdge, + addressModeV: GPUAddressMode = GPUAddressMode.clampToEdge, + addressModeW: GPUAddressMode = GPUAddressMode.clampToEdge, + magFilter: GPUFilterMode = GPUFilterMode.nearest, + minFilter: GPUFilterMode = GPUFilterMode.nearest, + mipmapFilter: GPUMipmapFilterMode = GPUMipmapFilterMode.nearest, + lodMinClamp: Float = 0f, + lodMaxClamp: Float = 32f, + maxAnisotropy: Int = 1, + compare: GPUCompareFunction? = null, +): GPUSamplerDescriptor = GPUSamplerDescriptor(label, addressModeU.value, addressModeV.value, addressModeW.value, magFilter.value, minFilter.value, mipmapFilter.value, lodMinClamp, lodMaxClamp, maxAnisotropy, compare?.value) + +fun GPUSamplerDescriptor( + label: String, + addressModeU: String, + addressModeV: String, + addressModeW: String, + magFilter: String, + minFilter: String, + mipmapFilter: String, + lodMinClamp: Float = 0f, + lodMaxClamp: Float = 32f, + maxAnisotropy: Int = 1, + compare: String?, +): GPUSamplerDescriptor = js("""({ + label: label, + addressModeU: addressModeU, + addressModeV: addressModeV, + addressModeW: addressModeW, + magFilter: magFilter, + minFilter: minFilter, + mipmapFilter: mipmapFilter, + lodMinClamp: lodMinClamp, + lodMaxClamp: lodMaxClamp, + maxAnisotropy: maxAnisotropy, + compare: (compare != null ? compare : undefined) +})""") + +external interface GPUTextureDescriptor : JsAny { + val size: JsArray + val format: String + val usage: Int + val label: String + val mipLevelCount: Int + val sampleCount: Int + val dimension: String + val viewFormats: JsArray +} + +fun GPUTextureDescriptor( + size: IntArray, + format: GPUTextureFormat, + usage: Int, + label: String = "", + mipLevelCount: Int = 1, + sampleCount: Int = 1, + dimension: GPUTextureDimension = GPUTextureDimension.texture2d, + viewFormats: List = emptyList(), +): GPUTextureDescriptor { + val jsSize: JsArray = size.toJsArray() + val jsFormats: JsArray = viewFormats.map { it.value }.toJsArray() + return GPUTextureDescriptor(jsSize, format.value, usage, label, mipLevelCount, sampleCount, dimension.value, jsFormats) +} + +private fun GPUTextureDescriptor( + size: JsArray, + format: String, + usage: Int, + label: String, + mipLevelCount: Int, + sampleCount: Int, + dimension: String, + viewFormats: JsArray, +): GPUTextureDescriptor = js("""({ + size: size, + format: format, + usage: usage, + label: label, + mipLevelCount: mipLevelCount, + sampleCount: sampleCount, + dimension: dimension, + viewFormats: viewFormats +})""") + +external interface GPUTextureViewDescriptor : JsAny + +fun GPUTextureViewDescriptor( + label: String = "", + format: GPUTextureFormat? = null, + dimension: GPUTextureViewDimension? = null, + //val aspect: GPUTextureAspect = 'all' + baseMipLevel: Int = 0, + mipLevelCount: Int? = null, + baseArrayLayer: Int = 0, + arrayLayerCount: Int? = null +): GPUTextureViewDescriptor = GPUTextureViewDescriptor(label, format?.value, dimension?.value, baseMipLevel, mipLevelCount, baseArrayLayer, arrayLayerCount) + +private fun GPUTextureViewDescriptor( + label: String, + format: String?, + dimension: String?, + baseMipLevel: Int, + mipLevelCount: Int?, + baseArrayLayer: Int, + arrayLayerCount: Int? +): GPUTextureViewDescriptor = js("""({ + label: label, + format: (format != null ? format : undefined), + dimension: (dimension != null ? dimension : undefined), + baseMipLevel: baseMipLevel, + mipLevelCount: (mipLevelCount != null ? mipLevelCount : undefined), + baseArrayLayer: baseArrayLayer, + arrayLayerCount: (arrayLayerCount != null ? arrayLayerCount : undefined) +})""") + +external interface GPUVertexAttribute : JsAny + +fun GPUVertexAttribute( + format: GPUVertexFormat, + offset: Long, + shaderLocation: Int +) = GPUVertexAttribute(format.value, offset.toJsNumber(), shaderLocation) + +private fun GPUVertexAttribute( + format: String, + offset: JsNumber, + shaderLocation: Int +): GPUVertexAttribute = js("""({ + format: format, + offset: offset, + shaderLocation: shaderLocation +})""") + +external interface GPUVertexBufferLayout : JsAny + +fun GPUVertexBufferLayout( + arrayStride: Long, + attributes: Array, + stepMode: GPUVertexStepMode = GPUVertexStepMode.vertex +) = GPUVertexBufferLayout(arrayStride.toJsNumber(), attributes.toJsArray(), stepMode.value) + +private fun GPUVertexBufferLayout( + arrayStride: JsNumber, + attributes: JsArray, + stepMode: String +): GPUVertexBufferLayout = js("""({ + arrayStride: arrayStride, + attributes: attributes, + stepMode: stepMode +})""") + +external interface GPUVertexState : JsAny + +fun GPUVertexState( + module: GPUShaderModule, + entryPoint: String, + buffers: List = emptyList(), +) = GPUVertexState(module, entryPoint, buffers.toJsArray()) + +private fun GPUVertexState( + module: GPUShaderModule, + entryPoint: String, + buffers: JsArray, +): GPUVertexState = js("""({ + module: module, + entryPoint: entryPoint, + buffers: buffers +})""") + +external interface GPURequestAdapterOptions : JsAny + +fun GPURequestAdapterOptions( + powerPreference: GPUPowerPreference, + forceFallbackAdapter: Boolean = false, +): GPURequestAdapterOptions = GPURequestAdapterOptions(powerPreference.value, forceFallbackAdapter) + +private fun GPURequestAdapterOptions( + powerPreference: String, + forceFallbackAdapter: Boolean, +): GPURequestAdapterOptions = js("""({ + powerPreference: powerPreference, + forceFallbackAdapter: forceFallbackAdapter +})""") \ No newline at end of file diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDrawPipeline.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDrawPipeline.kt similarity index 96% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDrawPipeline.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDrawPipeline.kt index 53323ca41..dac4a9016 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDrawPipeline.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuDrawPipeline.kt @@ -71,11 +71,11 @@ class WgpuDrawPipeline( val renderPass = passEncoderState.renderPass val gpuRenderPass = passEncoderState.gpuRenderPass - val shaderCode = drawPipeline.shaderCode as RenderBackendWebGpu.WebGpuShaderCode + val shaderCode = drawPipeline.shaderCode as WebGpuShaderCode val vertexState = GPUVertexState( module = vertexShaderModule, entryPoint = shaderCode.vertexEntryPoint, - buffers = createVertexBufferLayout().toTypedArray() + buffers = createVertexBufferLayout() ) val blendMode = when (drawPipeline.pipelineConfig.blendMode) { @@ -105,7 +105,7 @@ class WgpuDrawPipeline( val fragmentState = GPUFragmentState( module = fragmentShaderModule, entryPoint = shaderCode.fragmentEntryPoint, - targets = gpuRenderPass.colorTargetFormats.map { GPUColorTargetState(it, blendMode) }.toTypedArray() + targets = gpuRenderPass.colorTargetFormats.map { GPUColorTargetState(it, blendMode) } ) val depthOp = when { @@ -183,13 +183,13 @@ class WgpuDrawPipeline( } private fun bindVertexBuffers(passEncoder: GPURenderPassEncoder, cmd: DrawCommand): Boolean { - val gpuGeom = cmd.vertexData.gpuGeometry as WgpuGeometry? ?: return false + val gpuGeom = cmd.vertexData.gpuGeometry as? WgpuGeometry? ?: return false val gpuInsts = cmd.instanceData?.gpuInstances as WgpuInstances? var slot = 0 gpuInsts?.instanceBuffer?.let { passEncoder.setVertexBuffer(slot++, it) } gpuGeom.vertexBuffer?.let { passEncoder.setVertexBuffer(slot, it) } - passEncoder.setIndexBuffer(gpuGeom.indexBuffer, GPUIndexFormat.uint32) + passEncoder.setIndexBuffer(gpuGeom.indexBuffer, GPUIndexFormat.uint32.value) return true } } \ No newline at end of file diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuEnums.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuEnums.kt new file mode 100644 index 000000000..d4468c041 --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuEnums.kt @@ -0,0 +1,243 @@ +package de.fabmax.kool.pipeline.backend.webgpu + +interface JsValueEnum { + val value: String +} + +enum class GPUAddressMode(override val value: String) : JsValueEnum { + clampToEdge("clamp-to-edge"), + repeat("repeat"), + mirrorRepeat("mirror-repeat"), +} + +enum class GPUAutoLayoutMode(override val value: String) : JsValueEnum { + auto("auto"), +} + +enum class GPUBlendFactor(override val value: String) : JsValueEnum { + zero("zero"), + one("one"), + src("src"), + oneMinusSrc("one-minus-src"), + srcAlpha("src-alpha"), + oneMinusSrcAlpha("one-minus-src-alpha"), + dst("dst"), + oneMinusDst("one-minus-dst"), + dstAlpha("dst-alpha"), + oneMinusDstAlpha("one-minus-dst-alpha"), + srcAlphaSaturated("src-alpha-saturated"), + constant("constant"), + oneMinusConstant("one-minus-constant"), +} + +enum class GPUBlendOperation(override val value: String) : JsValueEnum { + add("add"), + subtract("subtract"), + reverseSubtract("reverse-subtract"), + min("min"), + max("max"), +} + +enum class GPUBufferBindingType(override val value: String) : JsValueEnum { + uniform("uniform"), + storage("storage"), + readOnlyStorage("read-only-storage"), +} + +enum class GPUCanvasAlphaMode(override val value: String) : JsValueEnum { + opaque("opaque"), + premultiplied("premultiplied"), +} + +enum class GPUCompareFunction(override val value: String) : JsValueEnum { + never("never"), + less("less"), + equal("equal"), + lessEqual("less-equal"), + greater("greater"), + notEqual("not-equal"), + greaterEqual("greater-equal"), + always("always"), +} + +enum class GPUCullMode(override val value: String) : JsValueEnum { + none("none"), + front("front"), + back("back"), +} + +enum class GPUFilterMode(override val value: String) : JsValueEnum { + nearest("nearest"), + linear("linear"), +} + +enum class GPUFrontFace(override val value: String) : JsValueEnum { + ccw("ccw"), + cw("cw"), +} + +enum class GPUMipmapFilterMode(override val value: String) : JsValueEnum { + nearest("nearest"), + linear("linear"), +} + +enum class GPUIndexFormat(override val value: String) : JsValueEnum { + uint16("uint16"), + uint32("uint32"), +} + +enum class GPULoadOp(override val value: String) : JsValueEnum { + load("load"), + clear("clear"), +} + +enum class GPUPredefinedColorSpace(override val value: String) : JsValueEnum { + srgb("srgb"), +} + +enum class GPUPrimitiveTopology(override val value: String) : JsValueEnum { + pointList("point-list"), + lineList("line-list"), + lineStrip("line-strip"), + triangleList("triangle-list"), + triangleStrip("triangle-strip"), +} + +enum class GPUPowerPreference(override val value: String) : JsValueEnum { + lowPower("low-power"), + highPerformance("high-performance"), +} + +enum class GPUQueryType(override val value: String) : JsValueEnum { + timestamp("timestamp"), + occlusion("occlusion"), +} + +enum class GPUSamplerBindingType(override val value: String) : JsValueEnum { + filtering("filtering"), + nonFiltering("non-filtering"), + comparison("comparison"), +} + +enum class GPUStoreOp(override val value: String) : JsValueEnum { + store("store"), + discard("discard"), +} + +enum class GPUTextureDimension(override val value: String) : JsValueEnum { + texture1d("1d"), + texture2d("2d"), + texture3d("3d"), +} + +enum class GPUTextureFormat(override val value: String) : JsValueEnum { + r8unorm("r8unorm"), + r8snorm("r8snorm"), + r8uint("r8uint"), + r8sint("r8sint"), + r16uint("r16uint"), + r16sint("r16sint"), + r16float("r16float"), + rg8unorm("rg8unorm"), + rg8snorm("rg8snorm"), + rg8uint("rg8uint"), + rg8sint("rg8sint"), + r32uint("r32uint"), + r32sint("r32sint"), + r32float("r32float"), + rg16uint("rg16uint"), + rg16sint("rg16sint"), + rg16float("rg16float"), + rgba8unorm("rgba8unorm"), + rgba8unormSrgb("rgba8unorm-srgb"), + rgba8snorm("rgba8snorm"), + rgba8uint("rgba8uint"), + rgba8sint("rgba8sint"), + bgra8unorm("bgra8unorm"), + bgra8unormSrgb("bgra8unorm-srgb"), + rgb9e5ufloat("rgb9e5ufloat"), + rgb10a2uint("rgb10a2uint"), + rgb10a2unorm("rgb10a2unorm"), + rg11b10ufloat("rg11b10ufloat"), + rg32uint("rg32uint"), + rg32sint("rg32sint"), + rg32float("rg32float"), + rgba16uint("rgba16uint"), + rgba16sint("rgba16sint"), + rgba16float("rgba16float"), + rgba32uint("rgba32uint"), + rgba32sint("rgba32sint"), + rgba32float("rgba32float"), + stencil8("stencil8"), + depth16unorm("depth16unorm"), + depth24plus("depth24plus"), + depth24plusStencil8("depth24plus-stencil8"), + depth32float("depth32float"), + depth32floatStencil8("depth32float-stencil8"); + // todo: many more compressed formats... + + companion object { + fun forValue(value: String) = entries.first { it.value == value } + } +} + +enum class GPUTextureSampleType(override val value: String) : JsValueEnum { + float("float"), + unfilterableFloat("unfilterable-float"), + depth("depth"), + sint("sint"), + uint("uint"), +} + +enum class GPUStorageTextureAccess(override val value: String) : JsValueEnum { + writeOnly("write-only"), + readOnly("read-only"), + readWrite("read-write"), +} + +enum class GPUTextureViewDimension(override val value: String) : JsValueEnum { + view1d("1d"), + view2d("2d"), + view2dArray("2d-array"), + viewCube("cube"), + viewCubeArray("cube-array"), + view3d("3d"), +} + +enum class GPUVertexFormat(override val value: String) : JsValueEnum { + uint8x2("uint8x2"), + uint8x4("uint8x4"), + sint8x2("sint8x2"), + sint8x4("sint8x4"), + unorm8x2("unorm8x2"), + unorm8x4("unorm8x4"), + snorm8x2("snorm8x2"), + snorm8x4("snorm8x4"), + uint16x2("uint16x2"), + uint16x4("uint16x4"), + sint16x2("sint16x2"), + sint16x4("sint16x4"), + unorm16x2("unorm16x2"), + unorm16x4("unorm16x4"), + snorm16x2("snorm16x2"), + snorm16x4("snorm16x4"), + float16x2("float16x2"), + float16x4("float16x4"), + float32("float32"), + float32x2("float32x2"), + float32x3("float32x3"), + float32x4("float32x4"), + uint32("uint32"), + uint32x2("uint32x2"), + uint32x3("uint32x3"), + uint32x4("uint32x4"), + sint32("sint32"), + sint32x2("sint32x2"), + sint32x3("sint32x3"), + sint32x4("sint32x4"), +} + +enum class GPUVertexStepMode(override val value: String) : JsValueEnum { + vertex("vertex"), + instance("instance"), +} diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuExtensions.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuExtensions.kt similarity index 97% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuExtensions.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuExtensions.kt index d9dc313bc..83f749570 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuExtensions.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuExtensions.kt @@ -4,7 +4,7 @@ import de.fabmax.kool.pipeline.* import de.fabmax.kool.scene.geometry.PrimitiveType fun GPUCommandEncoder.beginRenderPass( - colorAttachments: Array, + colorAttachments: List, depthStencilAttachment: GPURenderPassDepthStencilAttachment? = null, timestampWrites: GPURenderPassTimestampWrites? = null, label: String = "" @@ -12,12 +12,12 @@ fun GPUCommandEncoder.beginRenderPass( fun GPUDevice.createBindGroup( layout: GPUBindGroupLayout, - entries: Array, + entries: List, label: String = "" ) = createBindGroup(GPUBindGroupDescriptor(layout, entries, label)) fun GPUDevice.createBindGroupLayout( - entries: Array, + entries: List, label: String = "" ) = createBindGroupLayout(GPUBindGroupLayoutDescriptor( entries = entries, diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuGeometry.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuGeometry.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuGeometry.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuGeometry.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInstances.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInstances.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInstances.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInstances.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInterfaces.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInterfaces.kt similarity index 66% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInterfaces.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInterfaces.kt index c835406a5..cf7f517d2 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInterfaces.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuInterfaces.kt @@ -5,40 +5,44 @@ package de.fabmax.kool.pipeline.backend.webgpu import org.khronos.webgl.ArrayBuffer import org.khronos.webgl.ArrayBufferView import org.w3c.dom.RenderingContext -import kotlin.js.Promise +import kotlin.js.* -external class GPU { - fun getPreferredCanvasFormat(): GPUTextureFormat +external class GPU : JsAny { + fun getPreferredCanvasFormat(): String //GPUTextureFormat fun requestAdapter(options: GPURequestAdapterOptions = definedExternally): Promise } -external class GPUAdapter { - val features: dynamic +external class GPUAdapter : JsAny { + val features: GPUSupportedFeatures val limits: GPUSupportedLimits fun requestDevice(descriptor: GPUDeviceDescriptor = definedExternally): Promise } -external class GPUBindGroupLayout +external interface GPUSupportedFeatures : JsAny { + fun forEach(block: (JsString) -> Unit) +} + +external class GPUBindGroupLayout : JsAny -external class GPUBindGroup +external class GPUBindGroup : JsAny -external interface GPUBindingResource +external interface GPUBindingResource : JsAny -external class GPUBuffer { +external class GPUBuffer : JsAny { val label: String - val size: dynamic - fun getMappedRange(offset: Long = definedExternally, size: Long = definedExternally): ArrayBuffer - fun mapAsync(mode: Int, offset: Long = definedExternally, size: Long = definedExternally): Promise + val size: JsNumber + fun getMappedRange(offset: JsNumber = definedExternally, size: JsNumber = definedExternally): ArrayBuffer + fun mapAsync(mode: Int, offset: JsNumber = definedExternally, size: JsNumber = definedExternally): Promise<*> fun unmap() fun destroy() } -external object GPUMapMode { +external object GPUMapMode : JsAny { val READ: Int val WRITE: Int } -external object GPUBufferUsage { +external object GPUBufferUsage : JsAny { val MAP_READ: Int val MAP_WRITE: Int val COPY_SRC: Int @@ -51,35 +55,35 @@ external object GPUBufferUsage { val QUERY_RESOLVE: Int } -external class GPUCanvasContext : RenderingContext { +external class GPUCanvasContext : RenderingContext, JsAny { fun configure(configuration: GPUCanvasConfiguration) fun unconfigure() fun getCurrentTexture(): GPUTexture } -external class GPUCommandBuffer +external class GPUCommandBuffer : JsAny -external class GPUCommandEncoder { +external class GPUCommandEncoder : JsAny { fun beginComputePass(descriptor: GPUComputePassDescriptor = definedExternally): GPUComputePassEncoder fun beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder - fun copyBufferToBuffer(source: GPUBuffer, sourceOffset: Long, destination: GPUBuffer, destinationOffset: Long, size: Long) - fun copyTextureToBuffer(source: GPUImageCopyTexture, destination: GPUImageCopyBuffer, copySize: IntArray) - fun copyTextureToTexture(source: GPUImageCopyTexture, destination: GPUImageCopyTexture, copySize: IntArray) + fun copyBufferToBuffer(source: GPUBuffer, sourceOffset: JsNumber, destination: GPUBuffer, destinationOffset: JsNumber, size: JsNumber) + fun copyTextureToBuffer(source: GPUImageCopyTexture, destination: GPUImageCopyBuffer, copySize: JsArray) + fun copyTextureToTexture(source: GPUImageCopyTexture, destination: GPUImageCopyTexture, copySize: JsArray) //fun writeTimestamp(querySet: GPUQuerySet, queryIndex: Int) - fun resolveQuerySet(querySet: GPUQuerySet, firstQuery: Int, queryCount: Int, destination: GPUBuffer, destinationOffset: Long) + fun resolveQuerySet(querySet: GPUQuerySet, firstQuery: Int, queryCount: Int, destination: GPUBuffer, destinationOffset: JsNumber) fun finish(): GPUCommandBuffer } -external class GPUCompilationInfo { - val messages: Array +external class GPUCompilationInfo : JsAny { + val messages: JsArray } -external class GPUCompilationMessage { +external class GPUCompilationMessage : JsAny { val type: String val message: String } -external class GPUDevice { +external interface GPUDevice : JsAny { val limits: GPUSupportedLimits val queue: GPUQueue @@ -98,57 +102,57 @@ external class GPUDevice { external class GPUExternalTexture : GPUBindingResource -external interface GPUPipelineLayout +external interface GPUPipelineLayout : JsAny -external class GPUQueue { - fun submit(commandBuffers: Array) - fun writeBuffer(buffer: GPUBuffer, bufferOffset: Long, data: ArrayBufferView, dataOffset: Long = definedExternally, size: Long = definedExternally) - fun writeTexture(destination: GPUImageCopyTexture, data: ArrayBufferView, dataLayout: GPUImageDataLayout, size: IntArray) - fun copyExternalImageToTexture(source: GPUImageCopyExternalImage, destination: GPUImageCopyTextureTagged, copySize: IntArray) +external class GPUQueue : JsAny { + fun submit(commandBuffers: JsArray) + fun writeBuffer(buffer: GPUBuffer, bufferOffset: JsNumber, data: ArrayBufferView, dataOffset: JsNumber = definedExternally, size: JsNumber = definedExternally) + fun writeTexture(destination: GPUImageCopyTexture, data: ArrayBufferView, dataLayout: GPUImageDataLayout, size: JsArray) + fun copyExternalImageToTexture(source: GPUImageCopyExternalImage, destination: GPUImageCopyTextureTagged, copySize: JsArray) } -external class GPUComputePassEncoder { +external class GPUComputePassEncoder : JsAny { fun setPipeline(pipeline: GPUComputePipeline) - fun setBindGroup(index: Int, bindGroup: GPUBindGroup, dynamicOffsets: Array = definedExternally) + fun setBindGroup(index: Int, bindGroup: GPUBindGroup) fun dispatchWorkgroups(workgroupCountX: Int, workgroupCountY: Int, workgroupCountZ: Int) fun end() } -external class GPURenderPassEncoder { +external class GPURenderPassEncoder : JsAny { fun setPipeline(pipeline: GPURenderPipeline) - fun setIndexBuffer(buffer: GPUBuffer, indexFormat: GPUIndexFormat, offset: Long = definedExternally, size: Long = definedExternally) - fun setVertexBuffer(slot: Int, buffer: GPUBuffer, offset: Long = definedExternally, size: Long = definedExternally) + fun setIndexBuffer(buffer: GPUBuffer, indexFormat: String /*GPUIndexFormat*/, offset: JsNumber = definedExternally, size: JsNumber = definedExternally) + fun setVertexBuffer(slot: Int, buffer: GPUBuffer, offset: JsNumber = definedExternally, size: JsNumber = definedExternally) fun draw(vertexCount: Int, instanceCount: Int = definedExternally, firstVertex: Int = definedExternally, firstInstance: Int = definedExternally) fun drawIndexed(indexCount: Int, instanceCount: Int = definedExternally, firstIndex: Int = definedExternally, baseVertex: Int = definedExternally, firstInstance: Int = definedExternally) - fun setBindGroup(index: Int, bindGroup: GPUBindGroup, dynamicOffsets: Array = definedExternally) + fun setBindGroup(index: Int, bindGroup: GPUBindGroup) fun setViewport(x: Float, y: Float, width: Float, height: Float, minDepth: Float, maxDepth: Float) fun setScissorRect(x: Int, y: Int, width: Int, height: Int) fun end() } -external class GPUComputePipeline { +external class GPUComputePipeline : JsAny { fun getBindGroupLayout(index: Int): GPUBindGroupLayout } -external class GPUQuerySet +external class GPUQuerySet : JsAny -external class GPURenderPipeline { +external class GPURenderPipeline : JsAny { fun getBindGroupLayout(index: Int): GPUBindGroupLayout } external class GPUSampler : GPUBindingResource -external class GPUShaderModule { +external class GPUShaderModule : JsAny { fun getCompilationInfo(): Promise } -external object GPUShaderStage { +external object GPUShaderStage : JsAny { val COMPUTE: Int val FRAGMENT: Int val VERTEX: Int } -external class GPUSupportedLimits { +external interface GPUSupportedLimits : JsAny { val maxTextureDimension1D: Int val maxTextureDimension2D: Int val maxTextureDimension3D: Int @@ -183,20 +187,20 @@ external class GPUSupportedLimits { val maxComputeWorkgroupsPerDimension: Int } -external class GPUTexture { +external class GPUTexture : JsAny { val label: String val width: Int val height: Int val depthOrArrayLayers: Int val mipLevelCount: Int val sampleCount: Int - val format: GPUTextureFormat + val format: String //GPUTextureFormat fun createView(): GPUTextureView fun createView(descriptor: GPUTextureViewDescriptor): GPUTextureView fun destroy() } -external object GPUTextureUsage { +external object GPUTextureUsage : JsAny { val COPY_SRC: Int val COPY_DST: Int val TEXTURE_BINDING: Int diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPass2d.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPass2d.kt similarity index 98% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPass2d.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPass2d.kt index cf429a27e..79d3c3e79 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPass2d.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPass2d.kt @@ -4,7 +4,6 @@ import de.fabmax.kool.PassData import de.fabmax.kool.math.Vec2i import de.fabmax.kool.pipeline.* import de.fabmax.kool.util.logD -import de.fabmax.kool.util.logT import de.fabmax.kool.util.releaseDelayed class WgpuOffscreenPass2d( @@ -47,7 +46,7 @@ class WgpuOffscreenPass2d( } private fun doResize(newSize: Vec2i) { - logT { "Resize offscreen 2d pass ${parentPass.name} to ${newSize.x} x ${newSize.y}" } + logD { "Resize offscreen 2d pass ${parentPass.name} to ${newSize.x} x ${newSize.y}" } val wasCopySource = attachments?.isCopySrc == true attachments?.releaseDelayed(1) attachments = createAttachments(wasCopySource, newSize) @@ -98,8 +97,7 @@ class WgpuOffscreenPass2d( clearValue = clearColor, resolveTarget = if (isMultiSampled) attachments.getResolveColorView(i, mipLevel) else null, ) - }.toTypedArray() - + } val depthLoadOp = when { forceLoad -> GPULoadOp.load renderPass.depthAttachment?.clearDepth == ClearDepthLoad -> GPULoadOp.load diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPassCube.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPassCube.kt similarity index 99% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPassCube.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPassCube.kt index 690d8425e..7f61c5dee 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPassCube.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuOffscreenPassCube.kt @@ -99,8 +99,7 @@ class WgpuOffscreenPassCube( clearValue = clearColor, resolveTarget = if (isMultiSampled) attachments.getResolveColorView(i, mipLevel, layer) else null, ) - }.toTypedArray() - + } val depthLoadOp = when { forceLoad -> GPULoadOp.load renderPass.depthAttachment?.clearDepth == ClearDepthLoad -> GPULoadOp.load diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipeline.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipeline.kt similarity index 98% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipeline.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipeline.kt index ce2017985..efd2f35ea 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipeline.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipeline.kt @@ -60,7 +60,7 @@ sealed class WgpuPipeline( device.createBindGroupLayout( label = "${pipeline.name}-bindGroupLayout[${group.scope}]", - entries = layoutEntries.toTypedArray() + entries = layoutEntries ) } } @@ -68,7 +68,7 @@ sealed class WgpuPipeline( private fun createPipelineLayout(): GPUPipelineLayout { return device.createPipelineLayout(GPUPipelineLayoutDescriptor( label = "${pipeline.name}-bindGroupLayout", - bindGroupLayouts = bindGroupLayouts.toTypedArray() + bindGroupLayouts = bindGroupLayouts )) } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipelineManager.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipelineManager.kt similarity index 92% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipelineManager.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipelineManager.kt index 37d53af7e..f5208310a 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipelineManager.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuPipelineManager.kt @@ -3,6 +3,7 @@ package de.fabmax.kool.pipeline.backend.webgpu import de.fabmax.kool.pipeline.* import de.fabmax.kool.util.logE import de.fabmax.kool.util.logW +import kotlin.js.toList class WgpuPipelineManager(val backend: RenderBackendWebGpu) { @@ -38,7 +39,7 @@ class WgpuPipelineManager(val backend: RenderBackendWebGpu) { } private fun getOrCreateVertexShaderModule(pipeline: DrawPipeline): GPUShaderModule { - val shaderCode = pipeline.shaderCode as RenderBackendWebGpu.WebGpuShaderCode + val shaderCode = pipeline.shaderCode as WebGpuShaderCode val usedModule = vertexShaderModules.getOrPut(shaderCode.vertexSrc) { val desc = GPUShaderModuleDescriptor( label = "${pipeline.name} vertex shader", @@ -53,7 +54,7 @@ class WgpuPipelineManager(val backend: RenderBackendWebGpu) { } private fun getOrCreateFragmentShaderModule(pipeline: DrawPipeline): GPUShaderModule { - val shaderCode = pipeline.shaderCode as RenderBackendWebGpu.WebGpuShaderCode + val shaderCode = pipeline.shaderCode as WebGpuShaderCode val usedModule = fragmentShaderModules.getOrPut(shaderCode.fragmentSrc) { val desc = GPUShaderModuleDescriptor( label = "${pipeline.name} fragment shader", @@ -68,7 +69,7 @@ class WgpuPipelineManager(val backend: RenderBackendWebGpu) { } private fun getOrCreateComputeShaderModule(pipeline: ComputePipeline): GPUShaderModule { - val shaderCode = pipeline.shaderCode as RenderBackendWebGpu.WebGpuComputeShaderCode + val shaderCode = pipeline.shaderCode as WebGpuComputeShaderCode val usedModule = fragmentShaderModules.getOrPut(shaderCode.computeSrc) { val desc = GPUShaderModuleDescriptor( label = "${pipeline.name} compute shader", @@ -84,7 +85,7 @@ class WgpuPipelineManager(val backend: RenderBackendWebGpu) { private fun GPUShaderModule.checkErrors(stage: String, code: String, pipeline: PipelineBase) { getCompilationInfo().then { info -> - val messages = info.messages + val messages = info.messages.toList() if (messages.any { it.type == "error" }) { logE { "Errors occurred on compilation of shader ${pipeline.name}:$stage:" } messages.filter { it.type == "error" }.forEach { @@ -98,12 +99,13 @@ class WgpuPipelineManager(val backend: RenderBackendWebGpu) { logW { it.message } } } + info } } internal fun removeDrawPipeline(pipeline: WgpuDrawPipeline) { pipeline.drawPipeline.pipelineBackend = null - val shaderCode = pipeline.drawPipeline.shaderCode as RenderBackendWebGpu.WebGpuShaderCode + val shaderCode = pipeline.drawPipeline.shaderCode as WebGpuShaderCode vertexShaderModules[shaderCode.vertexSrc]?.let { usedModule -> usedModule.users -= pipeline.drawPipeline @@ -121,7 +123,7 @@ class WgpuPipelineManager(val backend: RenderBackendWebGpu) { internal fun removeComputePipeline(pipeline: WgpuComputePipeline) { pipeline.computePipeline.pipelineBackend = null - val shaderCode = pipeline.computePipeline.shaderCode as RenderBackendWebGpu.WebGpuComputeShaderCode + val shaderCode = pipeline.computePipeline.shaderCode as WebGpuComputeShaderCode computeShaderModules[shaderCode.computeSrc]?.let { usedModule -> usedModule.users -= pipeline.computePipeline diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuRenderPass.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuRenderPass.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuRenderPass.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuRenderPass.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuScreenPass.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuScreenPass.kt similarity index 94% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuScreenPass.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuScreenPass.kt index 4d66215f9..d058b16cd 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuScreenPass.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuScreenPass.kt @@ -1,8 +1,6 @@ package de.fabmax.kool.pipeline.backend.webgpu -import de.fabmax.kool.KoolSystem import de.fabmax.kool.PassData -import de.fabmax.kool.configJs import de.fabmax.kool.pipeline.ClearColorFill import de.fabmax.kool.pipeline.ClearColorLoad import de.fabmax.kool.pipeline.ClearDepthLoad @@ -10,7 +8,7 @@ import de.fabmax.kool.pipeline.FrameCopy import de.fabmax.kool.util.releaseDelayed class WgpuScreenPass(backend: RenderBackendWebGpu) : - WgpuRenderPass(GPUTextureFormat.depth32float, KoolSystem.configJs.numSamples, backend) + WgpuRenderPass(GPUTextureFormat.depth32float, backend.numSamples, backend) { private val canvasContext: GPUCanvasContext get() = backend.canvasContext @@ -30,7 +28,7 @@ class WgpuScreenPass(backend: RenderBackendWebGpu) : fun renderScene(passData: PassData, passEncoderState: RenderPassEncoderState) { if (depthAttachment == null || colorTexture == null) { - updateRenderTextures(backend.ctx.window.framebufferSize.x, backend.ctx.window.framebufferSize.y) + updateRenderTextures(backend.framebufferSize.x, backend.framebufferSize.y) } render(passData, passEncoderState) } @@ -87,7 +85,7 @@ class WgpuScreenPass(backend: RenderBackendWebGpu) : if (numSamples > 1 && colorDstWgpu != null) { // run an empty render pass, which resolves the multi-sampled color texture into the target capture texture val passEncoder = encoder.beginRenderPass( - colorAttachments = arrayOf(GPURenderPassColorAttachment( + colorAttachments = listOf(GPURenderPassColorAttachment( view = colorTextureView!!, resolveTarget = colorDstWgpu.gpuTexture.createView(), )), @@ -125,7 +123,7 @@ class WgpuScreenPass(backend: RenderBackendWebGpu) : else -> GPULoadOp.clear } - val colors = arrayOf( + val colors = listOf( GPURenderPassColorAttachment( view = colorTextureView!!, loadOp = colorLoadOp, diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureLoader.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureLoader.kt similarity index 93% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureLoader.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureLoader.kt index 44a7a9427..ce418e221 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureLoader.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureLoader.kt @@ -1,10 +1,12 @@ package de.fabmax.kool.pipeline.backend.webgpu +import de.fabmax.kool.jsArrayOf import de.fabmax.kool.math.float32ToFloat16 import de.fabmax.kool.math.numMipLevels import de.fabmax.kool.pipeline.* import de.fabmax.kool.pipeline.backend.gl.pxSize import de.fabmax.kool.platform.ImageTextureData +import de.fabmax.kool.toJsArray import de.fabmax.kool.util.Float32BufferImpl import de.fabmax.kool.util.Uint16BufferImpl import de.fabmax.kool.util.Uint8BufferImpl @@ -13,6 +15,7 @@ import org.khronos.webgl.ArrayBufferView import org.khronos.webgl.Uint8Array import org.khronos.webgl.get import org.khronos.webgl.set +import kotlin.js.* internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { private val loadedTextures = mutableMapOf() @@ -166,7 +169,7 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { encoder.copyTextureToTexture( source = GPUImageCopyTexture(src, mipLevel = mipLevel), destination = GPUImageCopyTexture(dst, mipLevel = mipLevel), - copySize = intArrayOf(width shr mipLevel, height shr mipLevel, arrayLayers) + copySize = intArrayOf(width shr mipLevel, height shr mipLevel, arrayLayers).toJsArray() ) } } @@ -222,14 +225,14 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { data = src.arrayBufferView, destination = GPUImageCopyTexture(dst, origin = dstOrigin), dataLayout = src.gpuImageDataLayout, - size = size + size = size.toJsArray() ) } is ImageTextureData -> { device.queue.copyExternalImageToTexture( source = GPUImageCopyExternalImage(src.data), destination = GPUImageCopyTextureTagged(dst, origin = dstOrigin), - copySize = size + copySize = size.toJsArray() ) } else -> error("Invalid src data type: $src") @@ -354,9 +357,9 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { """.trimIndent()) private val sampler = device.createSampler(minFilter = GPUFilterMode.linear) - private val pipelines = mutableMapOf() + private val pipelines = mutableMapOf() - private fun getRenderPipeline(format: GPUTextureFormat): GPURenderPipeline = pipelines.getOrPut(format) { + private fun getRenderPipeline(format: String): GPURenderPipeline = pipelines.getOrPut(format) { device.createRenderPipeline( GPURenderPipelineDescriptor( vertex = GPUVertexState( @@ -366,10 +369,10 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { fragment = GPUFragmentState( module = shaderModule, entryPoint = "fragmentMain", - targets = arrayOf(GPUColorTargetState(format)) + targets = listOf(GPUColorTargetState(format)) ), primitive = GPUPrimitiveState(topology = GPUPrimitiveTopology.triangleStrip), - layout = GPUAutoLayoutMode.auto + layout = GPUAutoLayoutMode.auto.value.toJsString() ) ) } @@ -377,26 +380,27 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { fun generateMipLevels(texDesc: GPUTextureDescriptor, texture: GPUTexture) { val cmdEncoder = device.createCommandEncoder() generateMipLevels(texDesc, texture, cmdEncoder) - device.queue.submit(arrayOf(cmdEncoder.finish())) + device.queue.submit(jsArrayOf(cmdEncoder.finish())) } fun generateMipLevels(texDesc: GPUTextureDescriptor, texture: GPUTexture, cmdEncoder: GPUCommandEncoder) { val pipeline = getRenderPipeline(texDesc.format) - val layers = if (texDesc.size.size == 3) texDesc.size[2] else 1 + @Suppress("UNNECESSARY_NOT_NULL_ASSERTION") + val layers = if (texDesc.size.length == 3) texDesc.size.unsafeCast>()[2]!!.unsafeCast().toInt() else 1 for (layer in 0 until layers) { var srcView = texture.createView(baseMipLevel = 0, mipLevelCount = 1, baseArrayLayer = layer, arrayLayerCount = 1, dimension = GPUTextureViewDimension.view2d) for (i in 1 until texDesc.mipLevelCount) { val dstView = texture.createView(baseMipLevel = i, mipLevelCount = 1, baseArrayLayer = layer, arrayLayerCount = 1, dimension = GPUTextureViewDimension.view2d) val passEncoder = cmdEncoder.beginRenderPass( - colorAttachments = arrayOf(GPURenderPassColorAttachment( + colorAttachments = listOf(GPURenderPassColorAttachment( view = dstView, storeOp = GPUStoreOp.store )) ) val bindGroup = device.createBindGroup( layout = pipeline.getBindGroupLayout(0), - entries = arrayOf( + entries = listOf( GPUBindGroupEntry( binding = 0, resource = sampler @@ -446,9 +450,9 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { } """.trimIndent()) - private val pipelines = mutableMapOf() + private val pipelines = mutableMapOf() - private fun getRenderPipeline(format: GPUTextureFormat): GPURenderPipeline = pipelines.getOrPut(format) { + private fun getRenderPipeline(format: String): GPURenderPipeline = pipelines.getOrPut(format) { device.createRenderPipeline( GPURenderPipelineDescriptor( vertex = GPUVertexState( @@ -458,15 +462,15 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { fragment = GPUFragmentState( module = shaderModule, entryPoint = "fragmentMain", - targets = arrayOf() + targets = listOf() ), depthStencil = GPUDepthStencilState( - format = format, + format = GPUTextureFormat.forValue(format), depthWriteEnabled = true, depthCompare = GPUCompareFunction.always ), primitive = GPUPrimitiveState(topology = GPUPrimitiveTopology.triangleStrip), - layout = GPUAutoLayoutMode.auto + layout = GPUAutoLayoutMode.auto.value.toJsString() ) ) } @@ -477,7 +481,7 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { val srcView = src.createView(baseMipLevel = mipLevel, mipLevelCount = 1, baseArrayLayer = layer, arrayLayerCount = 1) val dstView = dst.createView(baseMipLevel = mipLevel, mipLevelCount = 1, baseArrayLayer = layer, arrayLayerCount = 1) val passEncoder = cmdEncoder.beginRenderPass( - colorAttachments = emptyArray(), + colorAttachments = emptyList(), depthStencilAttachment = GPURenderPassDepthStencilAttachment( view = dstView, depthLoadOp = GPULoadOp.clear, @@ -486,7 +490,7 @@ internal class WgpuTextureLoader(val backend: RenderBackendWebGpu) { ) val bindGroup = device.createBindGroup( layout = pipeline.getBindGroupLayout(0), - entries = arrayOf( + entries = listOf( GPUBindGroupEntry( binding = 0, resource = srcView diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureResource.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureResource.kt similarity index 79% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureResource.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureResource.kt index 7a4739336..15ea4eb8d 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureResource.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTextureResource.kt @@ -19,15 +19,15 @@ class WgpuTextureResource( private val GPUTextureDescriptor.bytesPerPx: Int get() { val channels = when { - "rgba" in format.enumValue -> 4 - "rg" in format.enumValue -> 2 - "r" in format.enumValue -> 1 + "rgba" in format -> 4 + "rg" in format -> 2 + "r" in format -> 1 else -> 1 } return when { - "8" in format.enumValue -> 1 * channels - "16" in format.enumValue -> 2 * channels - "32" in format.enumValue -> 4 * channels + "8" in format -> 1 * channels + "16" in format -> 2 * channels + "32" in format -> 4 * channels else -> 4 } } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTimestamps.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTimestamps.kt similarity index 86% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTimestamps.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTimestamps.kt index 0426c9df7..ce32977cc 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTimestamps.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/pipeline/backend/webgpu/WgpuTimestamps.kt @@ -1,15 +1,17 @@ package de.fabmax.kool.pipeline.backend.webgpu +import de.fabmax.kool.toJsNumber import de.fabmax.kool.util.Releasable import org.khronos.webgl.Uint32Array import org.khronos.webgl.get +import kotlin.js.toJsNumber import kotlin.math.max class WgpuTimestamps(val size: Int, val backend: RenderBackendWebGpu) { private var querySet: GPUQuerySet? = null - private val resolveBuffer = backend.device.createBuffer(GPUBufferDescriptor(size * 8L, GPUBufferUsage.QUERY_RESOLVE or GPUBufferUsage.COPY_SRC)) - private val readBuffer = backend.device.createBuffer(GPUBufferDescriptor(size * 8L, GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST)) + private val resolveBuffer = backend.device.createBuffer(GPUBufferDescriptor((size * 8L).toJsNumber(), GPUBufferUsage.QUERY_RESOLVE or GPUBufferUsage.COPY_SRC)) + private val readBuffer = backend.device.createBuffer(GPUBufferDescriptor((size * 8L).toJsNumber(), GPUBufferUsage.MAP_READ or GPUBufferUsage.COPY_DST)) private var isInFlight = false private var isMapping = false @@ -52,8 +54,8 @@ class WgpuTimestamps(val size: Int, val backend: RenderBackendWebGpu) { val querySet = getQuerySet() ?: return if (!isInFlight && activeQueries > 0) { isInFlight = true - encoder.resolveQuerySet(querySet, 0, lastActive + 1, resolveBuffer, 0L) - encoder.copyBufferToBuffer(resolveBuffer, 0L, readBuffer, 0L, size * 8L) + encoder.resolveQuerySet(querySet, 0, lastActive + 1, resolveBuffer, 0.toJsNumber()) + encoder.copyBufferToBuffer(resolveBuffer, 0.toJsNumber(), readBuffer, 0.toJsNumber(), (size * 8L).toJsNumber()) } } @@ -73,6 +75,7 @@ class WgpuTimestamps(val size: Int, val backend: RenderBackendWebGpu) { readBuffer.unmap() isInFlight = false isMapping = false + it } } } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/ImageAtlasTextureData.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/ImageAtlasTextureData.kt similarity index 94% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/ImageAtlasTextureData.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/platform/ImageAtlasTextureData.kt index aa6511228..b31b6a6d0 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/ImageAtlasTextureData.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/ImageAtlasTextureData.kt @@ -16,7 +16,7 @@ class ImageAtlasTextureData( override val format: TexFormat = TexFormat.RGBA, ) : ImageData3d { - val data: Array + val data: List override val width = image.width / tilesX override val height = image.height / tilesY @@ -31,7 +31,7 @@ class ImageAtlasTextureData( canvas.height = height val canvasCtx = canvas.getContext("2d") as CanvasRenderingContext2D - data = Array(depth) { i -> + data = List(depth) { i -> val x = (i % tilesX).toDouble() val y = (i / tilesX).toDouble() diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/ImageTextureData.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/ImageTextureData.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/ImageTextureData.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/platform/ImageTextureData.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/Navigator.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/Navigator.kt similarity index 66% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/Navigator.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/platform/Navigator.kt index ed79532e9..ec8fbe320 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/Navigator.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/Navigator.kt @@ -1,12 +1,13 @@ package de.fabmax.kool.platform -import de.fabmax.kool.input.Gamepad +import de.fabmax.kool.Gamepad import de.fabmax.kool.pipeline.backend.webgpu.GPU +import kotlin.js.JsArray external val navigator: Navigator external class Navigator { val language: String val gpu: GPU - fun getGamepads(): Array? + fun getGamepads(): JsArray? } diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/Pako.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/Pako.kt similarity index 88% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/Pako.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/platform/Pako.kt index bad5cf140..e9b772c73 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/platform/Pako.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/platform/Pako.kt @@ -1,6 +1,7 @@ package de.fabmax.kool.platform import org.khronos.webgl.Uint8Array +import kotlin.js.JsModule @JsModule("pako") external object Pako { diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/Buffer.js.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/util/Buffer.web.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/util/Buffer.js.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/util/Buffer.web.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/BufferUtil.js.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/util/BufferUtil.web.kt similarity index 100% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/util/BufferUtil.js.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/util/BufferUtil.web.kt diff --git a/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/ScopedMemory.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/util/ScopedMemory.kt similarity index 94% rename from kool-core/src/jsMain/kotlin/de/fabmax/kool/util/ScopedMemory.kt rename to kool-core/src/webMain/kotlin/de/fabmax/kool/util/ScopedMemory.kt index 483dd34ea..ddbb1f2b9 100644 --- a/kool-core/src/jsMain/kotlin/de/fabmax/kool/util/ScopedMemory.kt +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/util/ScopedMemory.kt @@ -10,7 +10,7 @@ inline fun scopedMem(block: ScopedMemory.() -> R): R { return ScopedMemory().use(block) } -class ScopedMemory() : AutoCloseable { +class ScopedMemory : AutoCloseable { val autoDeletables = mutableListOf>() fun autoDelete(obj: T, delete: T.() -> Unit): T { diff --git a/kool-core/src/webMain/kotlin/de/fabmax/kool/util/Time.web.kt b/kool-core/src/webMain/kotlin/de/fabmax/kool/util/Time.web.kt new file mode 100644 index 000000000..c6e609053 --- /dev/null +++ b/kool-core/src/webMain/kotlin/de/fabmax/kool/util/Time.web.kt @@ -0,0 +1,14 @@ +package de.fabmax.kool.util + +import kotlin.time.Clock +import kotlin.time.ExperimentalTime + +internal actual fun SystemClock(): SystemClock = SystemClockImpl + +private object SystemClockImpl : SystemClock { + @OptIn(ExperimentalTime::class) + override fun now(): Double { + val now = Clock.System.now() + return now.toEpochMilliseconds() / 1000 + now.nanosecondsOfSecond / 1e9 + } +} \ No newline at end of file diff --git a/kool-demo/build.gradle.kts b/kool-demo/build.gradle.kts index bc7ed6cb4..797048e85 100644 --- a/kool-demo/build.gradle.kts +++ b/kool-demo/build.gradle.kts @@ -1,5 +1,8 @@ +@file:OptIn(ExperimentalWasmDsl::class) + import org.gradle.internal.os.OperatingSystem import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig @@ -27,6 +30,17 @@ kotlin { } jvmToolchain(25) + wasmJs { + outputModuleName = "kool-demo-wasm" + binaries.executable() + browser { + @OptIn(ExperimentalDistributionDsl::class) + distribution { + outputDirectory.set(File("${rootDir}/dist/kool-demo-wasm")) + } + } + } + js { binaries.executable() browser { diff --git a/kool-demo/src/wasmJsMain/kotlin/Main.kt b/kool-demo/src/wasmJsMain/kotlin/Main.kt new file mode 100644 index 000000000..598180623 --- /dev/null +++ b/kool-demo/src/wasmJsMain/kotlin/Main.kt @@ -0,0 +1,18 @@ +import de.fabmax.kool.KoolApplication +import de.fabmax.kool.KoolConfigWasm +import de.fabmax.kool.demo.demo +import de.fabmax.kool.physics.Physics +import de.fabmax.kool.physics2d.Physics2d +import de.fabmax.kool.pipeline.backend.webgpu.RenderBackendWebGpu + +fun main() = KoolApplication( + KoolConfigWasm( + renderBackend = RenderBackendWebGpu, + isGlobalKeyEventGrabbing = true, + deviceScaleLimit = 1.5, + ) +) { + Physics.loadPhysics() + Physics2d.loadPhysics2d() + demo(null, ctx) +} \ No newline at end of file diff --git a/kool-editor-model/src/jsMain/kotlin/de/fabmax/kool/editor/api/BehaviorLoader.js.kt b/kool-editor-model/src/webMain/kotlin/de/fabmax/kool/editor/api/BehaviorLoader.web.kt similarity index 94% rename from kool-editor-model/src/jsMain/kotlin/de/fabmax/kool/editor/api/BehaviorLoader.js.kt rename to kool-editor-model/src/webMain/kotlin/de/fabmax/kool/editor/api/BehaviorLoader.web.kt index f57e13af1..62103d9e7 100644 --- a/kool-editor-model/src/jsMain/kotlin/de/fabmax/kool/editor/api/BehaviorLoader.js.kt +++ b/kool-editor-model/src/webMain/kotlin/de/fabmax/kool/editor/api/BehaviorLoader.web.kt @@ -1,8 +1,6 @@ package de.fabmax.kool.editor.api -@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") actual object BehaviorLoader { - var appBehaviorLoader: AppBehaviorLoader? = null private val loader: AppBehaviorLoader diff --git a/kool-editor/src/jsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.js.kt b/kool-editor/src/jsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.js.kt index 7906eac76..48b1bdb42 100644 --- a/kool-editor/src/jsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.js.kt +++ b/kool-editor/src/jsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.js.kt @@ -7,7 +7,6 @@ import de.fabmax.kool.util.ApplicationScope import de.fabmax.kool.util.logE import kotlinx.coroutines.launch -@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") actual object PlatformFunctions { actual val windowButtonStyle: WindowButtonStyle = WindowButtonStyle.NONE diff --git a/kool-editor/src/wasmJsMain/kotlin/de/fabmax/kool/editor/AppLoader.wasmJs.kt b/kool-editor/src/wasmJsMain/kotlin/de/fabmax/kool/editor/AppLoader.wasmJs.kt new file mode 100644 index 000000000..787ee75d7 --- /dev/null +++ b/kool-editor/src/wasmJsMain/kotlin/de/fabmax/kool/editor/AppLoader.wasmJs.kt @@ -0,0 +1,17 @@ +package de.fabmax.kool.editor + +import de.fabmax.kool.util.logE + +actual fun AppLoadService(projectFiles: ProjectFiles): AppLoadService = AppLoadServiceImpl() + +class AppLoadServiceImpl : AppLoadService { + override suspend fun buildApp() { + logE { "App building not supported in browser" } + } + + override suspend fun loadApp(): LoadedApp { + return PlatformFunctions.loadedApp ?: throw IllegalStateException("PlatformFunctions.initPlatform() not called") + } + + override fun addChangeListener(listener: AppSourcesChangeListener) { } +} diff --git a/kool-editor/src/wasmJsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.wasmJs.kt b/kool-editor/src/wasmJsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.wasmJs.kt new file mode 100644 index 000000000..48b1bdb42 --- /dev/null +++ b/kool-editor/src/wasmJsMain/kotlin/de/fabmax/kool/editor/PlatformFunctions.wasmJs.kt @@ -0,0 +1,44 @@ +package de.fabmax.kool.editor + +import de.fabmax.kool.Assets +import de.fabmax.kool.KoolContext +import de.fabmax.kool.NativeAssetLoader +import de.fabmax.kool.util.ApplicationScope +import de.fabmax.kool.util.logE +import kotlinx.coroutines.launch + +actual object PlatformFunctions { + + actual val windowButtonStyle: WindowButtonStyle = WindowButtonStyle.NONE + actual val isWindowMaximized: Boolean = false + + var loadedApp: LoadedApp? = null + + fun initPlatform(loadedApp: LoadedApp) { + Assets.defaultLoader = NativeAssetLoader(".") + this.loadedApp = loadedApp + } + + actual fun onEditorStarted(ctx: KoolContext) { } + + actual fun onExit(ctx: KoolContext) { } + + actual fun editBehavior(behaviorClassName: String) { + logE { "Source editing is not available on JS. Download project and use the JVM variant." } + } + + actual suspend fun chooseFilePath(): String? { + logE { "chooseFilePath() not available on JS" } + return null + } + + actual fun saveProjectBlocking() { + ApplicationScope.launch { + KoolEditor.instance.saveProject() + } + } + + actual fun toggleMaximizeWindow() { } + actual fun minimizeWindow() { } + actual fun closeWindow() { } +} \ No newline at end of file diff --git a/kool-physics-2d/build.gradle.kts b/kool-physics-2d/build.gradle.kts index 374deca77..6cd761cf3 100644 --- a/kool-physics-2d/build.gradle.kts +++ b/kool-physics-2d/build.gradle.kts @@ -22,7 +22,7 @@ kotlin { ).forEach { platform -> runtimeOnly("${libs.box2d.jni.get()}:$platform") } } - jsMain.dependencies { + webMain.dependencies { implementation(npm(libs.box2d.wasm.get().name, libs.versions.box2d.wasm.get())) //implementation(npm(File("$projectDir/npm/kool-box2d-wasm"))) } @@ -38,7 +38,7 @@ webidl { modelName = "Box2dWasm" generateKotlinJsInterfaces { - outputDirectory = file("${projectDir}/src/jsMain/kotlin/box2d") + outputDirectory = file("${projectDir}/src/webMain/kotlin/box2d") packagePrefix = "box2d" moduleName = "kool-box2d-wasm" modulePromiseName = "Box2D" diff --git a/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasmLoader.js.kt b/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasmLoader.js.kt new file mode 100644 index 000000000..ed95fcd89 --- /dev/null +++ b/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasmLoader.js.kt @@ -0,0 +1,39 @@ +/* + * Generated from WebIDL by webidl-util + */ + +package box2d + +import kotlinx.coroutines.await +import kotlin.js.Promise + +@JsModule("kool-box2d-wasm") +private external val Box2D: () -> Promise + +actual object Box2dWasmLoader { + private var box2dWasmModule: JsAny? = null + private val box2dWasmPromise = Box2D() + private var _isLoaded = false + actual val isLoaded: Boolean get() = _isLoaded + + internal actual val box2dWasm: JsAny get() = requireNotNull(box2dWasmModule) { + "Module 'kool-box2d-wasm' is not loaded. Call loadModule() first" + } + + actual suspend fun loadModule() { + if (!isLoaded) { + box2dWasmPromise.then { box2dWasmModule = it; it } + } + box2dWasmPromise.await() + _isLoaded = true + } + + fun checkIsLoaded() { + if (!isLoaded) { + throw IllegalStateException("Module 'kool-box2d-wasm' is not loaded. Call loadModule() first.") + } + } +} + +private fun destroyNative(module: JsAny, obj: DestroyableNative): Unit = js("module.destroy(obj)") +actual fun DestroyableNative.destroy() = destroyNative(Box2dWasmLoader.box2dWasm, this) \ No newline at end of file diff --git a/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasmLoader.kt b/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasmLoader.kt deleted file mode 100644 index 47f3fd156..000000000 --- a/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasmLoader.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Generated from WebIDL by webidl-util - */ - -package box2d - -import kotlinx.coroutines.asDeferred -import kotlin.js.Promise - -@JsModule("kool-box2d-wasm") -private external val Box2D: () -> Promise - -object Box2dWasmLoader { - @JsName("box2dWasm") - internal var box2dWasm: dynamic = null - private val box2dWasmPromise = Box2D() - internal var box2dWasmDeferred = box2dWasmPromise.asDeferred() - - val isLoaded: Boolean get() = box2dWasmDeferred.isCompleted - - suspend fun loadModule() { - if (!isLoaded) { - box2dWasmPromise.then { module: dynamic -> box2dWasm = module } - } - box2dWasmDeferred.await() - } - - fun checkIsLoaded() { - if (!isLoaded) { - throw IllegalStateException("Module 'kool-box2d-wasm' is not loaded. Call loadModule() first and wait for loading to be finished.") - } - } - - fun destroy(nativeObject: Any) { - box2dWasm.destroy(nativeObject) - } -} \ No newline at end of file diff --git a/kool-physics-2d/src/jsMain/kotlin/box2d/prototypes/Prototypes.kt b/kool-physics-2d/src/jsMain/kotlin/box2d/prototypes/Prototypes.kt deleted file mode 100644 index f80bffa24..000000000 --- a/kool-physics-2d/src/jsMain/kotlin/box2d/prototypes/Prototypes.kt +++ /dev/null @@ -1,29 +0,0 @@ -@file:Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE", "unused") - -package box2d.prototypes - -import box2d.* - -val B2_AABB: B2_AABB get() = Box2dWasmLoader.box2dWasm.B2_AABB.prototype as B2_AABB -val B2_Base: B2_Base get() = Box2dWasmLoader.box2dWasm.B2_Base.prototype as B2_Base -val B2_Body: B2_Body get() = Box2dWasmLoader.box2dWasm.B2_Body.prototype as B2_Body -val B2_Chain: B2_Chain get() = Box2dWasmLoader.box2dWasm.B2_Chain.prototype as B2_Chain -val B2_CharacterMover: B2_CharacterMover get() = Box2dWasmLoader.box2dWasm.B2_CharacterMover.prototype as B2_CharacterMover -val B2_DistanceJoint: B2_DistanceJoint get() = Box2dWasmLoader.box2dWasm.B2_DistanceJoint.prototype as B2_DistanceJoint -val B2_FilterJoint: B2_FilterJoint get() = Box2dWasmLoader.box2dWasm.B2_FilterJoint.prototype as B2_FilterJoint -val B2_Geometry: B2_Geometry get() = Box2dWasmLoader.box2dWasm.B2_Geometry.prototype as B2_Geometry -val B2_Joint: B2_Joint get() = Box2dWasmLoader.box2dWasm.B2_Joint.prototype as B2_Joint -val B2_Mat22: B2_Mat22 get() = Box2dWasmLoader.box2dWasm.B2_Mat22.prototype as B2_Mat22 -val B2_Math: B2_Math get() = Box2dWasmLoader.box2dWasm.B2_Math.prototype as B2_Math -val B2_MotorJoint: B2_MotorJoint get() = Box2dWasmLoader.box2dWasm.B2_MotorJoint.prototype as B2_MotorJoint -val B2_MouseJoint: B2_MouseJoint get() = Box2dWasmLoader.box2dWasm.B2_MouseJoint.prototype as B2_MouseJoint -val B2_Plane: B2_Plane get() = Box2dWasmLoader.box2dWasm.B2_Plane.prototype as B2_Plane -val B2_PrismaticJoint: B2_PrismaticJoint get() = Box2dWasmLoader.box2dWasm.B2_PrismaticJoint.prototype as B2_PrismaticJoint -val B2_RevoluteJoint: B2_RevoluteJoint get() = Box2dWasmLoader.box2dWasm.B2_RevoluteJoint.prototype as B2_RevoluteJoint -val B2_Rot: B2_Rot get() = Box2dWasmLoader.box2dWasm.B2_Rot.prototype as B2_Rot -val B2_Shape: B2_Shape get() = Box2dWasmLoader.box2dWasm.B2_Shape.prototype as B2_Shape -val B2_Transform: B2_Transform get() = Box2dWasmLoader.box2dWasm.B2_Transform.prototype as B2_Transform -val B2_Vec2: B2_Vec2 get() = Box2dWasmLoader.box2dWasm.B2_Vec2.prototype as B2_Vec2 -val B2_WeldJoint: B2_WeldJoint get() = Box2dWasmLoader.box2dWasm.B2_WeldJoint.prototype as B2_WeldJoint -val B2_WheelJoint: B2_WheelJoint get() = Box2dWasmLoader.box2dWasm.B2_WheelJoint.prototype as B2_WheelJoint -val B2_World: B2_World get() = Box2dWasmLoader.box2dWasm.B2_World.prototype as B2_World diff --git a/kool-physics-2d/src/wasmJsMain/kotlin/box2d/Box2dWasmLoader.wasmJs.kt b/kool-physics-2d/src/wasmJsMain/kotlin/box2d/Box2dWasmLoader.wasmJs.kt new file mode 100644 index 000000000..ed95fcd89 --- /dev/null +++ b/kool-physics-2d/src/wasmJsMain/kotlin/box2d/Box2dWasmLoader.wasmJs.kt @@ -0,0 +1,39 @@ +/* + * Generated from WebIDL by webidl-util + */ + +package box2d + +import kotlinx.coroutines.await +import kotlin.js.Promise + +@JsModule("kool-box2d-wasm") +private external val Box2D: () -> Promise + +actual object Box2dWasmLoader { + private var box2dWasmModule: JsAny? = null + private val box2dWasmPromise = Box2D() + private var _isLoaded = false + actual val isLoaded: Boolean get() = _isLoaded + + internal actual val box2dWasm: JsAny get() = requireNotNull(box2dWasmModule) { + "Module 'kool-box2d-wasm' is not loaded. Call loadModule() first" + } + + actual suspend fun loadModule() { + if (!isLoaded) { + box2dWasmPromise.then { box2dWasmModule = it; it } + } + box2dWasmPromise.await() + _isLoaded = true + } + + fun checkIsLoaded() { + if (!isLoaded) { + throw IllegalStateException("Module 'kool-box2d-wasm' is not loaded. Call loadModule() first.") + } + } +} + +private fun destroyNative(module: JsAny, obj: DestroyableNative): Unit = js("module.destroy(obj)") +actual fun DestroyableNative.destroy() = destroyNative(Box2dWasmLoader.box2dWasm, this) \ No newline at end of file diff --git a/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasm.kt b/kool-physics-2d/src/webMain/kotlin/box2d/Box2dWasm.kt similarity index 69% rename from kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasm.kt rename to kool-physics-2d/src/webMain/kotlin/box2d/Box2dWasm.kt index 621958c38..5479a64cd 100644 --- a/kool-physics-2d/src/jsMain/kotlin/box2d/Box2dWasm.kt +++ b/kool-physics-2d/src/webMain/kotlin/box2d/Box2dWasm.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package box2d -external interface B2_Shape { +import kotlin.js.JsAny +import kotlin.js.js + +external interface B2_Shape : JsAny { /** * Native object address. */ @@ -64,7 +67,7 @@ external interface B2_Shape { * @param shapeId WebIDL type: unsigned long long * @return WebIDL type: [b2ShapeType] (enum) */ - fun getType(shapeId: Long): b2ShapeType + fun getType(shapeId: Long): Int /** * @param shapeId WebIDL type: unsigned long long @@ -88,13 +91,13 @@ external interface B2_Shape { * @param shapeId WebIDL type: unsigned long long * @param userData WebIDL type: VoidPtr */ - fun setUserData(shapeId: Long, userData: Any) + fun setUserData(shapeId: Long, userData: JsAny) /** * @param shapeId WebIDL type: unsigned long long * @return WebIDL type: VoidPtr */ - fun getUserData(shapeId: Long): Any + fun getUserData(shapeId: Long): JsAny /** * @param shapeId WebIDL type: unsigned long long @@ -338,9 +341,9 @@ external interface B2_Shape { } -fun B2_ShapeFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Shape = js("_module.wrapPointer(ptr, _module.B2_Shape)") +fun B2_ShapeFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Shape = js("_module.wrapPointer(ptr, _module.B2_Shape)") -external interface B2_Chain { +external interface B2_Chain : JsAny { /** * Native object address. */ @@ -426,9 +429,9 @@ external interface B2_Chain { } -fun B2_ChainFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Chain = js("_module.wrapPointer(ptr, _module.B2_Chain)") +fun B2_ChainFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Chain = js("_module.wrapPointer(ptr, _module.B2_Chain)") -external interface b2ShapeDef { +external interface b2ShapeDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -437,7 +440,7 @@ external interface b2ShapeDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * WebIDL type: [b2SurfaceMaterial] (Value) */ @@ -480,15 +483,11 @@ external interface b2ShapeDef { var updateBodyMass: Boolean } -fun b2ShapeDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeDef = js("new _module.b2ShapeDef()") - -fun b2ShapeDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeDef = js("_module.wrapPointer(ptr, _module.b2ShapeDef)") +fun b2ShapeDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeDef = js("new _module.b2ShapeDef()") -fun b2ShapeDef.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ShapeDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeDef = js("_module.wrapPointer(ptr, _module.b2ShapeDef)") -external interface b2ChainDef { +external interface b2ChainDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -497,7 +496,7 @@ external interface b2ChainDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * WebIDL type: [b2Vec2] (Const) */ @@ -532,15 +531,11 @@ external interface b2ChainDef { var internalValue: Int } -fun b2ChainDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ChainDef = js("new _module.b2ChainDef()") +fun b2ChainDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ChainDef = js("new _module.b2ChainDef()") -fun b2ChainDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ChainDef = js("_module.wrapPointer(ptr, _module.b2ChainDef)") +fun b2ChainDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ChainDef = js("_module.wrapPointer(ptr, _module.b2ChainDef)") -fun b2ChainDef.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2Filter { +external interface b2Filter : JsAny, DestroyableNative { /** * Native object address. */ @@ -560,15 +555,11 @@ external interface b2Filter { var maskBits: Long } -fun b2Filter(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Filter = js("new _module.b2Filter()") - -fun b2FilterFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Filter = js("_module.wrapPointer(ptr, _module.b2Filter)") +fun b2Filter(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Filter = js("new _module.b2Filter()") -fun b2Filter.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2FilterFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Filter = js("_module.wrapPointer(ptr, _module.b2Filter)") -external interface b2QueryFilter { +external interface b2QueryFilter : JsAny, DestroyableNative { /** * Native object address. */ @@ -584,15 +575,11 @@ external interface b2QueryFilter { var maskBits: Long } -fun b2QueryFilter(_module: dynamic = Box2dWasmLoader.box2dWasm): b2QueryFilter = js("new _module.b2QueryFilter()") +fun b2QueryFilter(_module: JsAny = Box2dWasmLoader.box2dWasm): b2QueryFilter = js("new _module.b2QueryFilter()") -fun b2QueryFilterFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2QueryFilter = js("_module.wrapPointer(ptr, _module.b2QueryFilter)") +fun b2QueryFilterFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2QueryFilter = js("_module.wrapPointer(ptr, _module.b2QueryFilter)") -fun b2QueryFilter.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2SurfaceMaterial { +external interface b2SurfaceMaterial : JsAny, DestroyableNative { /** * Native object address. */ @@ -624,15 +611,11 @@ external interface b2SurfaceMaterial { var userMaterialId: Int } -fun b2SurfaceMaterial(_module: dynamic = Box2dWasmLoader.box2dWasm): b2SurfaceMaterial = js("new _module.b2SurfaceMaterial()") +fun b2SurfaceMaterial(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SurfaceMaterial = js("new _module.b2SurfaceMaterial()") -fun b2SurfaceMaterialFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2SurfaceMaterial = js("_module.wrapPointer(ptr, _module.b2SurfaceMaterial)") - -fun b2SurfaceMaterial.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2SurfaceMaterialFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SurfaceMaterial = js("_module.wrapPointer(ptr, _module.b2SurfaceMaterial)") -external interface b2ContactData { +external interface b2ContactData : JsAny, DestroyableNative { /** * Native object address. */ @@ -652,15 +635,11 @@ external interface b2ContactData { var shapeIdB: b2ShapeId } -fun b2ContactData(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactData = js("new _module.b2ContactData()") +fun b2ContactData(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactData = js("new _module.b2ContactData()") -fun b2ContactDataFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactData = js("_module.wrapPointer(ptr, _module.b2ContactData)") +fun b2ContactDataFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactData = js("_module.wrapPointer(ptr, _module.b2ContactData)") -fun b2ContactData.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface B2_Vec2 { +external interface B2_Vec2 : JsAny { /** * Native object address. */ @@ -838,9 +817,9 @@ external interface B2_Vec2 { } -fun B2_Vec2FromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Vec2 = js("_module.wrapPointer(ptr, _module.B2_Vec2)") +fun B2_Vec2FromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Vec2 = js("_module.wrapPointer(ptr, _module.B2_Vec2)") -external interface B2_Rot { +external interface B2_Rot : JsAny { /** * Native object address. */ @@ -961,9 +940,9 @@ external interface B2_Rot { } -fun B2_RotFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Rot = js("_module.wrapPointer(ptr, _module.B2_Rot)") +fun B2_RotFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Rot = js("_module.wrapPointer(ptr, _module.B2_Rot)") -external interface B2_Transform { +external interface B2_Transform : JsAny { /** * Native object address. */ @@ -999,9 +978,9 @@ external interface B2_Transform { } -fun B2_TransformFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Transform = js("_module.wrapPointer(ptr, _module.B2_Transform)") +fun B2_TransformFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Transform = js("_module.wrapPointer(ptr, _module.B2_Transform)") -external interface B2_Mat22 { +external interface B2_Mat22 : JsAny { /** * Native object address. */ @@ -1029,9 +1008,9 @@ external interface B2_Mat22 { } -fun B2_Mat22FromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Mat22 = js("_module.wrapPointer(ptr, _module.B2_Mat22)") +fun B2_Mat22FromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Mat22 = js("_module.wrapPointer(ptr, _module.B2_Mat22)") -external interface B2_AABB { +external interface B2_AABB : JsAny { /** * Native object address. */ @@ -1078,9 +1057,9 @@ external interface B2_AABB { } -fun B2_AABBFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_AABB = js("_module.wrapPointer(ptr, _module.B2_AABB)") +fun B2_AABBFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_AABB = js("_module.wrapPointer(ptr, _module.B2_AABB)") -external interface B2_Plane { +external interface B2_Plane : JsAny { /** * Native object address. */ @@ -1101,9 +1080,9 @@ external interface B2_Plane { } -fun B2_PlaneFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Plane = js("_module.wrapPointer(ptr, _module.B2_Plane)") +fun B2_PlaneFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Plane = js("_module.wrapPointer(ptr, _module.B2_Plane)") -external interface B2_Math { +external interface B2_Math : JsAny { /** * Native object address. */ @@ -1135,15 +1114,45 @@ external interface B2_Math { */ fun getLengthUnitsPerMeter(): Float + /** + * @param a WebIDL type: float + * @return WebIDL type: boolean + */ + fun isValidFloat(a: Float): Boolean + + /** + * @param v WebIDL type: [b2Vec2] (Ref) + * @return WebIDL type: boolean + */ + fun isValidVec2(v: b2Vec2): Boolean + + /** + * @param q WebIDL type: [b2Rot] (Ref) + * @return WebIDL type: boolean + */ + fun isValidRotation(q: b2Rot): Boolean + + /** + * @param aabb WebIDL type: [b2AABB] (Ref) + * @return WebIDL type: boolean + */ + fun isValidAABB(aabb: b2AABB): Boolean + + /** + * @param a WebIDL type: [b2Plane] (Ref) + * @return WebIDL type: boolean + */ + fun isValidPlane(a: b2Plane): Boolean + } -fun B2_MathFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Math = js("_module.wrapPointer(ptr, _module.B2_Math)") +fun B2_MathFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Math = js("_module.wrapPointer(ptr, _module.B2_Math)") var B2_Math.lengthUnitsPerMeter get() = getLengthUnitsPerMeter() set(value) { setLengthUnitsPerMeter(value) } -external interface b2Vec2 { +external interface b2Vec2 : JsAny, DestroyableNative { /** * Native object address. */ @@ -1159,15 +1168,11 @@ external interface b2Vec2 { var y: Float } -fun b2Vec2(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Vec2 = js("new _module.b2Vec2()") - -fun b2Vec2FromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Vec2 = js("_module.wrapPointer(ptr, _module.b2Vec2)") +fun b2Vec2(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Vec2 = js("new _module.b2Vec2()") -fun b2Vec2.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2Vec2FromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Vec2 = js("_module.wrapPointer(ptr, _module.b2Vec2)") -external interface b2CosSin { +external interface b2CosSin : JsAny, DestroyableNative { /** * Native object address. */ @@ -1183,15 +1188,11 @@ external interface b2CosSin { var sine: Float } -fun b2CosSin(_module: dynamic = Box2dWasmLoader.box2dWasm): b2CosSin = js("new _module.b2CosSin()") - -fun b2CosSinFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CosSin = js("_module.wrapPointer(ptr, _module.b2CosSin)") +fun b2CosSin(_module: JsAny = Box2dWasmLoader.box2dWasm): b2CosSin = js("new _module.b2CosSin()") -fun b2CosSin.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2CosSinFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CosSin = js("_module.wrapPointer(ptr, _module.b2CosSin)") -external interface b2Rot { +external interface b2Rot : JsAny, DestroyableNative { /** * Native object address. */ @@ -1207,15 +1208,11 @@ external interface b2Rot { var s: Float } -fun b2Rot(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Rot = js("new _module.b2Rot()") +fun b2Rot(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Rot = js("new _module.b2Rot()") -fun b2RotFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Rot = js("_module.wrapPointer(ptr, _module.b2Rot)") +fun b2RotFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Rot = js("_module.wrapPointer(ptr, _module.b2Rot)") -fun b2Rot.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2Transform { +external interface b2Transform : JsAny, DestroyableNative { /** * Native object address. */ @@ -1231,15 +1228,11 @@ external interface b2Transform { var q: b2Rot } -fun b2Transform(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Transform = js("new _module.b2Transform()") +fun b2Transform(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Transform = js("new _module.b2Transform()") -fun b2TransformFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Transform = js("_module.wrapPointer(ptr, _module.b2Transform)") - -fun b2Transform.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2TransformFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Transform = js("_module.wrapPointer(ptr, _module.b2Transform)") -external interface b2Mat22 { +external interface b2Mat22 : JsAny, DestroyableNative { /** * Native object address. */ @@ -1255,15 +1248,11 @@ external interface b2Mat22 { var cy: b2Vec2 } -fun b2Mat22(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Mat22 = js("new _module.b2Mat22()") +fun b2Mat22(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Mat22 = js("new _module.b2Mat22()") -fun b2Mat22FromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Mat22 = js("_module.wrapPointer(ptr, _module.b2Mat22)") +fun b2Mat22FromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Mat22 = js("_module.wrapPointer(ptr, _module.b2Mat22)") -fun b2Mat22.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2AABB { +external interface b2AABB : JsAny, DestroyableNative { /** * Native object address. */ @@ -1279,20 +1268,202 @@ external interface b2AABB { var upperBound: b2Vec2 } -fun b2AABB(_module: dynamic = Box2dWasmLoader.box2dWasm): b2AABB = js("new _module.b2AABB()") +fun b2AABB(_module: JsAny = Box2dWasmLoader.box2dWasm): b2AABB = js("new _module.b2AABB()") -fun b2AABBFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2AABB = js("_module.wrapPointer(ptr, _module.b2AABB)") +fun b2AABBFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2AABB = js("_module.wrapPointer(ptr, _module.b2AABB)") + +external interface b2Plane : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2Vec2] (Value) + */ + var normal: b2Vec2 + /** + * WebIDL type: float + */ + var offset: Float +} + +fun b2Plane(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Plane = js("new _module.b2Plane()") + +fun b2PlaneFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Plane = js("_module.wrapPointer(ptr, _module.b2Plane)") + +external interface B2_Distance : JsAny { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param p1 WebIDL type: [b2Vec2] (Ref) + * @param q1 WebIDL type: [b2Vec2] (Ref) + * @param p2 WebIDL type: [b2Vec2] (Ref) + * @param q2 WebIDL type: [b2Vec2] (Ref) + * @return WebIDL type: [b2SegmentDistanceResult] (Value) + */ + fun segmentDistance(p1: b2Vec2, q1: b2Vec2, p2: b2Vec2, q2: b2Vec2): b2SegmentDistanceResult + + /** + * @param input WebIDL type: [b2DistanceInput] (Const) + * @param cache WebIDL type: [b2SimplexCache] + * @param simplexes WebIDL type: [b2Simplex] + * @param simplexCapacity WebIDL type: long + * @return WebIDL type: [b2DistanceOutput] (Value) + */ + fun shapeDistance(input: b2DistanceInput, cache: b2SimplexCache, simplexes: b2Simplex, simplexCapacity: Int): b2DistanceOutput + + /** + * @param input WebIDL type: [b2ShapeCastPairInput] (Const) + * @return WebIDL type: [b2CastOutput] (Value) + */ + fun shapeCast(input: b2ShapeCastPairInput): b2CastOutput + + /** + * @param points WebIDL type: [b2Vec2Array] + * @param radius WebIDL type: float + * @return WebIDL type: [b2ShapeProxy] (Value) + */ + fun makeProxy(points: b2Vec2Array, radius: Float): b2ShapeProxy + + /** + * @param points WebIDL type: [b2Vec2Array] + * @param radius WebIDL type: float + * @param position WebIDL type: [b2Vec2] (Ref) + * @param rotation WebIDL type: [b2Rot] (Ref) + * @return WebIDL type: [b2ShapeProxy] (Value) + */ + fun makeOffsetProxy(points: b2Vec2Array, radius: Float, position: b2Vec2, rotation: b2Rot): b2ShapeProxy + + /** + * @param sweep WebIDL type: [b2Sweep] (Const) + * @param time WebIDL type: float + * @param result WebIDL type: [b2Transform] (Ref) + */ + fun getSweepTransform(sweep: b2Sweep, time: Float, result: b2Transform) + + /** + * @param input WebIDL type: [b2TOIInput] (Const) + * @return WebIDL type: [b2TOIOutput] (Value) + */ + fun timeOfImpact(input: b2TOIInput): b2TOIOutput -fun b2AABB.destroy() { - Box2dWasmLoader.destroy(this) } -external interface b2Plane { +fun B2_DistanceFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Distance = js("_module.wrapPointer(ptr, _module.B2_Distance)") + +external interface b2SegmentDistanceResult : JsAny, DestroyableNative { /** * Native object address. */ val ptr: Int + /** + * WebIDL type: [b2Vec2] (Value) + */ + var closest1: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var closest2: b2Vec2 + /** + * WebIDL type: float + */ + var fraction1: Float + /** + * WebIDL type: float + */ + var fraction2: Float + /** + * WebIDL type: float + */ + var distanceSquared: Float +} + +fun b2SegmentDistanceResult(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SegmentDistanceResult = js("new _module.b2SegmentDistanceResult()") + +fun b2SegmentDistanceResultFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SegmentDistanceResult = js("_module.wrapPointer(ptr, _module.b2SegmentDistanceResult)") + +external interface b2SimplexCache : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: unsigned short + */ + var count: Short + /** + * WebIDL type: octet + */ + fun get_indexA(index: Int): Byte + fun set_indexA(index: Int, value: Byte) + /** + * WebIDL type: octet + */ + fun get_indexB(index: Int): Byte + fun set_indexB(index: Int, value: Byte) +} + +fun b2SimplexCache(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SimplexCache = js("new _module.b2SimplexCache()") + +fun b2SimplexCacheFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SimplexCache = js("_module.wrapPointer(ptr, _module.b2SimplexCache)") + +inline fun b2SimplexCache.getIndexA(index: Int) = get_indexA(index) +inline fun b2SimplexCache.setIndexA(index: Int, value: Byte) = set_indexA(index, value) +inline fun b2SimplexCache.getIndexB(index: Int) = get_indexB(index) +inline fun b2SimplexCache.setIndexB(index: Int, value: Byte) = set_indexB(index, value) + +external interface b2DistanceInput : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2ShapeProxy] (Value) + */ + var proxyA: b2ShapeProxy + /** + * WebIDL type: [b2ShapeProxy] (Value) + */ + var proxyB: b2ShapeProxy + /** + * WebIDL type: [b2Transform] (Value) + */ + var transformA: b2Transform + /** + * WebIDL type: [b2Transform] (Value) + */ + var transformB: b2Transform + /** + * WebIDL type: boolean + */ + var useRadii: Boolean +} + +fun b2DistanceInput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2DistanceInput = js("new _module.b2DistanceInput()") + +fun b2DistanceInputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2DistanceInput = js("_module.wrapPointer(ptr, _module.b2DistanceInput)") + +external interface b2DistanceOutput : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2Vec2] (Value) + */ + var pointA: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var pointB: b2Vec2 /** * WebIDL type: [b2Vec2] (Value) */ @@ -1300,18 +1471,214 @@ external interface b2Plane { /** * WebIDL type: float */ - var offset: Float + var distance: Float + /** + * WebIDL type: long + */ + var iterations: Int + /** + * WebIDL type: long + */ + var simplexCount: Int } -fun b2Plane(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Plane = js("new _module.b2Plane()") +fun b2DistanceOutput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2DistanceOutput = js("new _module.b2DistanceOutput()") -fun b2PlaneFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Plane = js("_module.wrapPointer(ptr, _module.b2Plane)") +fun b2DistanceOutputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2DistanceOutput = js("_module.wrapPointer(ptr, _module.b2DistanceOutput)") -fun b2Plane.destroy() { - Box2dWasmLoader.destroy(this) +external interface b2SimplexVertex : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2Vec2] (Value) + */ + var wA: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var wB: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var w: b2Vec2 + /** + * WebIDL type: float + */ + var a: Float + /** + * WebIDL type: long + */ + var indexA: Int + /** + * WebIDL type: long + */ + var indexB: Int } -external interface B2_World { +fun b2SimplexVertex(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SimplexVertex = js("new _module.b2SimplexVertex()") + +fun b2SimplexVertexFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SimplexVertex = js("_module.wrapPointer(ptr, _module.b2SimplexVertex)") + +external interface b2Simplex : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2SimplexVertex] (Value) + */ + var v1: b2SimplexVertex + /** + * WebIDL type: [b2SimplexVertex] (Value) + */ + var v2: b2SimplexVertex + /** + * WebIDL type: [b2SimplexVertex] (Value) + */ + var v3: b2SimplexVertex + /** + * WebIDL type: long + */ + var count: Int +} + +fun b2Simplex(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Simplex = js("new _module.b2Simplex()") + +fun b2SimplexFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Simplex = js("_module.wrapPointer(ptr, _module.b2Simplex)") + +external interface b2ShapeCastPairInput : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2ShapeProxy] (Value) + */ + var proxyA: b2ShapeProxy + /** + * WebIDL type: [b2ShapeProxy] (Value) + */ + var proxyB: b2ShapeProxy + /** + * WebIDL type: [b2Transform] (Value) + */ + var transformA: b2Transform + /** + * WebIDL type: [b2Transform] (Value) + */ + var transformB: b2Transform + /** + * WebIDL type: [b2Vec2] (Value) + */ + var translationB: b2Vec2 + /** + * WebIDL type: float + */ + var maxFraction: Float + /** + * WebIDL type: boolean + */ + var canEncroach: Boolean +} + +fun b2ShapeCastPairInput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeCastPairInput = js("new _module.b2ShapeCastPairInput()") + +fun b2ShapeCastPairInputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeCastPairInput = js("_module.wrapPointer(ptr, _module.b2ShapeCastPairInput)") + +external interface b2Sweep : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2Vec2] (Value) + */ + var localCenter: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var c1: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var c2: b2Vec2 + /** + * WebIDL type: [b2Rot] (Value) + */ + var q1: b2Rot + /** + * WebIDL type: [b2Rot] (Value) + */ + var q2: b2Rot +} + +fun b2Sweep(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Sweep = js("new _module.b2Sweep()") + +fun b2SweepFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Sweep = js("_module.wrapPointer(ptr, _module.b2Sweep)") + +external interface b2TOIInput : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2ShapeProxy] (Value) + */ + var proxyA: b2ShapeProxy + /** + * WebIDL type: [b2ShapeProxy] (Value) + */ + var proxyB: b2ShapeProxy + /** + * WebIDL type: [b2Sweep] (Value) + */ + var sweepA: b2Sweep + /** + * WebIDL type: [b2Sweep] (Value) + */ + var sweepB: b2Sweep + /** + * WebIDL type: float + */ + var maxFraction: Float +} + +fun b2TOIInput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2TOIInput = js("new _module.b2TOIInput()") + +fun b2TOIInputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2TOIInput = js("_module.wrapPointer(ptr, _module.b2TOIInput)") + +external interface b2TOIOutput : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2TOIState] (enum) + */ + var state: Int + /** + * WebIDL type: float + */ + var fraction: Float +} + +fun b2TOIOutput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2TOIOutput = js("new _module.b2TOIOutput()") + +fun b2TOIOutputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2TOIOutput = js("_module.wrapPointer(ptr, _module.b2TOIOutput)") + +var b2TOIOutput.stateEnum: b2TOIState + get() = b2TOIState.forValue(state) + set(value) { state = value.value } + +external interface B2_World : JsAny { /** * Native object address. */ @@ -1584,13 +1951,13 @@ external interface B2_World { * @param worldId WebIDL type: unsigned long long * @param userData WebIDL type: VoidPtr */ - fun setUserData(worldId: Long, userData: Any) + fun setUserData(worldId: Long, userData: JsAny) /** * @param worldId WebIDL type: unsigned long long * @return WebIDL type: VoidPtr */ - fun getUserData(worldId: Long): Any + fun getUserData(worldId: Long): JsAny /** * @param worldId WebIDL type: unsigned long long @@ -1605,9 +1972,9 @@ external interface B2_World { } -fun B2_WorldFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_World = js("_module.wrapPointer(ptr, _module.B2_World)") +fun B2_WorldFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_World = js("_module.wrapPointer(ptr, _module.B2_World)") -external interface TaskManager { +external interface TaskManager : JsAny, DestroyableNative { /** * Native object address. */ @@ -1630,11 +1997,7 @@ external interface TaskManager { } -fun TaskManagerFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): TaskManager = js("_module.wrapPointer(ptr, _module.TaskManager)") - -fun TaskManager.destroy() { - Box2dWasmLoader.destroy(this) -} +fun TaskManagerFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): TaskManager = js("_module.wrapPointer(ptr, _module.TaskManager)") external interface TaskManagerImpl : TaskManager { /** @@ -1653,9 +2016,9 @@ external interface TaskManagerImpl : TaskManager { } -fun TaskManagerImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): TaskManagerImpl = js("new _module.TaskManagerImpl()") +fun TaskManagerImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): TaskManagerImpl = js("new _module.TaskManagerImpl()") -external interface b2BodyEvents { +external interface b2BodyEvents : JsAny, DestroyableNative { /** * Native object address. */ @@ -1671,15 +2034,11 @@ external interface b2BodyEvents { var moveEvents: b2BodyMoveEvent } -fun b2BodyEvents(_module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyEvents = js("new _module.b2BodyEvents()") +fun b2BodyEvents(_module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyEvents = js("new _module.b2BodyEvents()") -fun b2BodyEventsFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyEvents = js("_module.wrapPointer(ptr, _module.b2BodyEvents)") +fun b2BodyEventsFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyEvents = js("_module.wrapPointer(ptr, _module.b2BodyEvents)") -fun b2BodyEvents.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2BodyMoveEvent { +external interface b2BodyMoveEvent : JsAny, DestroyableNative { /** * Native object address. */ @@ -1700,18 +2059,14 @@ external interface b2BodyMoveEvent { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2BodyMoveEvent(_module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyMoveEvent = js("new _module.b2BodyMoveEvent()") +fun b2BodyMoveEvent(_module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyMoveEvent = js("new _module.b2BodyMoveEvent()") -fun b2BodyMoveEventFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyMoveEvent = js("_module.wrapPointer(ptr, _module.b2BodyMoveEvent)") +fun b2BodyMoveEventFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyMoveEvent = js("_module.wrapPointer(ptr, _module.b2BodyMoveEvent)") -fun b2BodyMoveEvent.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2SensorEvents { +external interface b2SensorEvents : JsAny, DestroyableNative { /** * Native object address. */ @@ -1735,15 +2090,11 @@ external interface b2SensorEvents { var endEvents: b2SensorEndTouchEvent } -fun b2SensorEvents(_module: dynamic = Box2dWasmLoader.box2dWasm): b2SensorEvents = js("new _module.b2SensorEvents()") - -fun b2SensorEventsFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2SensorEvents = js("_module.wrapPointer(ptr, _module.b2SensorEvents)") +fun b2SensorEvents(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SensorEvents = js("new _module.b2SensorEvents()") -fun b2SensorEvents.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2SensorEventsFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SensorEvents = js("_module.wrapPointer(ptr, _module.b2SensorEvents)") -external interface b2SensorBeginTouchEvent { +external interface b2SensorBeginTouchEvent : JsAny, DestroyableNative { /** * Native object address. */ @@ -1759,15 +2110,11 @@ external interface b2SensorBeginTouchEvent { var visitorShapeId: b2ShapeId } -fun b2SensorBeginTouchEvent(_module: dynamic = Box2dWasmLoader.box2dWasm): b2SensorBeginTouchEvent = js("new _module.b2SensorBeginTouchEvent()") +fun b2SensorBeginTouchEvent(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SensorBeginTouchEvent = js("new _module.b2SensorBeginTouchEvent()") -fun b2SensorBeginTouchEventFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2SensorBeginTouchEvent = js("_module.wrapPointer(ptr, _module.b2SensorBeginTouchEvent)") +fun b2SensorBeginTouchEventFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SensorBeginTouchEvent = js("_module.wrapPointer(ptr, _module.b2SensorBeginTouchEvent)") -fun b2SensorBeginTouchEvent.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2SensorEndTouchEvent { +external interface b2SensorEndTouchEvent : JsAny, DestroyableNative { /** * Native object address. */ @@ -1783,15 +2130,11 @@ external interface b2SensorEndTouchEvent { var visitorShapeId: b2ShapeId } -fun b2SensorEndTouchEvent(_module: dynamic = Box2dWasmLoader.box2dWasm): b2SensorEndTouchEvent = js("new _module.b2SensorEndTouchEvent()") - -fun b2SensorEndTouchEventFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2SensorEndTouchEvent = js("_module.wrapPointer(ptr, _module.b2SensorEndTouchEvent)") +fun b2SensorEndTouchEvent(_module: JsAny = Box2dWasmLoader.box2dWasm): b2SensorEndTouchEvent = js("new _module.b2SensorEndTouchEvent()") -fun b2SensorEndTouchEvent.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2SensorEndTouchEventFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2SensorEndTouchEvent = js("_module.wrapPointer(ptr, _module.b2SensorEndTouchEvent)") -external interface b2ContactEvents { +external interface b2ContactEvents : JsAny, DestroyableNative { /** * Native object address. */ @@ -1823,15 +2166,11 @@ external interface b2ContactEvents { var hitEvents: b2ContactHitEvent } -fun b2ContactEvents(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactEvents = js("new _module.b2ContactEvents()") - -fun b2ContactEventsFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactEvents = js("_module.wrapPointer(ptr, _module.b2ContactEvents)") +fun b2ContactEvents(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactEvents = js("new _module.b2ContactEvents()") -fun b2ContactEvents.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ContactEventsFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactEvents = js("_module.wrapPointer(ptr, _module.b2ContactEvents)") -external interface b2ContactBeginTouchEvent { +external interface b2ContactBeginTouchEvent : JsAny, DestroyableNative { /** * Native object address. */ @@ -1851,167 +2190,63 @@ external interface b2ContactBeginTouchEvent { var shapeIdB: b2ShapeId } -fun b2ContactBeginTouchEvent(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactBeginTouchEvent = js("new _module.b2ContactBeginTouchEvent()") - -fun b2ContactBeginTouchEventFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactBeginTouchEvent = js("_module.wrapPointer(ptr, _module.b2ContactBeginTouchEvent)") - -fun b2ContactBeginTouchEvent.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2ContactEndTouchEvent { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: [b2ShapeId] (Value) - */ - var shapeIdA: b2ShapeId - /** - * WebIDL type: [b2ShapeId] (Value) - */ - var shapeIdB: b2ShapeId -} - -fun b2ContactEndTouchEvent(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactEndTouchEvent = js("new _module.b2ContactEndTouchEvent()") - -fun b2ContactEndTouchEventFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactEndTouchEvent = js("_module.wrapPointer(ptr, _module.b2ContactEndTouchEvent)") +fun b2ContactBeginTouchEvent(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactBeginTouchEvent = js("new _module.b2ContactBeginTouchEvent()") -fun b2ContactEndTouchEvent.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ContactBeginTouchEventFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactBeginTouchEvent = js("_module.wrapPointer(ptr, _module.b2ContactBeginTouchEvent)") -external interface b2ContactHitEvent { +external interface b2ContactEndTouchEvent : JsAny, DestroyableNative { /** * Native object address. */ val ptr: Int - /** - * WebIDL type: float - */ - var approachSpeed: Float - /** - * WebIDL type: [b2Vec2] (Value) - */ - var normal: b2Vec2 - /** - * WebIDL type: [b2Vec2] (Value) - */ - var point: b2Vec2 - /** - * WebIDL type: [b2ShapeId] (Value) - */ - var shapeIdA: b2ShapeId /** * WebIDL type: [b2ShapeId] (Value) */ - var shapeIdB: b2ShapeId -} - -fun b2ContactHitEvent(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactHitEvent = js("new _module.b2ContactHitEvent()") - -fun b2ContactHitEventFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactHitEvent = js("_module.wrapPointer(ptr, _module.b2ContactHitEvent)") - -fun b2ContactHitEvent.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2Manifold { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: [b2Vec2] (Value) - */ - var normal: b2Vec2 - /** - * WebIDL type: long - */ - var pointCount: Int - /** - * WebIDL type: [b2ManifoldPoint] (Value) - */ - fun get_points(index: Int): b2ManifoldPoint - fun set_points(index: Int, value: b2ManifoldPoint) - /** - * WebIDL type: float - */ - var rollingImpulse: Float -} - -fun b2Manifold(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Manifold = js("new _module.b2Manifold()") - -fun b2ManifoldFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Manifold = js("_module.wrapPointer(ptr, _module.b2Manifold)") - -fun b2Manifold.destroy() { - Box2dWasmLoader.destroy(this) -} - -inline fun b2Manifold.getPoints(index: Int) = get_points(index) -inline fun b2Manifold.setPoints(index: Int, value: b2ManifoldPoint) = set_points(index, value) - -external interface b2ManifoldPoint { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: [b2Vec2] (Value) - */ - var anchorA: b2Vec2 - /** - * WebIDL type: [b2Vec2] (Value) - */ - var anchorB: b2Vec2 + var shapeIdA: b2ShapeId /** - * WebIDL type: unsigned short + * WebIDL type: [b2ShapeId] (Value) */ - var id: Short + var shapeIdB: b2ShapeId +} + +fun b2ContactEndTouchEvent(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactEndTouchEvent = js("new _module.b2ContactEndTouchEvent()") + +fun b2ContactEndTouchEventFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactEndTouchEvent = js("_module.wrapPointer(ptr, _module.b2ContactEndTouchEvent)") + +external interface b2ContactHitEvent : JsAny, DestroyableNative { /** - * WebIDL type: float + * Native object address. */ - var normalImpulse: Float + val ptr: Int + /** * WebIDL type: float */ - var normalVelocity: Float + var approachSpeed: Float /** - * WebIDL type: boolean + * WebIDL type: [b2Vec2] (Value) */ - var persisted: Boolean + var normal: b2Vec2 /** * WebIDL type: [b2Vec2] (Value) */ var point: b2Vec2 /** - * WebIDL type: float - */ - var separation: Float - /** - * WebIDL type: float + * WebIDL type: [b2ShapeId] (Value) */ - var tangentImpulse: Float + var shapeIdA: b2ShapeId /** - * WebIDL type: float + * WebIDL type: [b2ShapeId] (Value) */ - var totalNormalImpulse: Float + var shapeIdB: b2ShapeId } -fun b2ManifoldPoint(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ManifoldPoint = js("new _module.b2ManifoldPoint()") +fun b2ContactHitEvent(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactHitEvent = js("new _module.b2ContactHitEvent()") -fun b2ManifoldPointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ManifoldPoint = js("_module.wrapPointer(ptr, _module.b2ManifoldPoint)") +fun b2ContactHitEventFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactHitEvent = js("_module.wrapPointer(ptr, _module.b2ContactHitEvent)") -fun b2ManifoldPoint.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2RayResult { +external interface b2RayResult : JsAny, DestroyableNative { /** * Native object address. */ @@ -2047,15 +2282,11 @@ external interface b2RayResult { var shapeId: b2ShapeId } -fun b2RayResult(_module: dynamic = Box2dWasmLoader.box2dWasm): b2RayResult = js("new _module.b2RayResult()") +fun b2RayResult(_module: JsAny = Box2dWasmLoader.box2dWasm): b2RayResult = js("new _module.b2RayResult()") -fun b2RayResultFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2RayResult = js("_module.wrapPointer(ptr, _module.b2RayResult)") - -fun b2RayResult.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2RayResultFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2RayResult = js("_module.wrapPointer(ptr, _module.b2RayResult)") -external interface b2TreeStats { +external interface b2TreeStats : JsAny, DestroyableNative { /** * Native object address. */ @@ -2071,15 +2302,11 @@ external interface b2TreeStats { var nodeVisits: Int } -fun b2TreeStats(_module: dynamic = Box2dWasmLoader.box2dWasm): b2TreeStats = js("new _module.b2TreeStats()") +fun b2TreeStats(_module: JsAny = Box2dWasmLoader.box2dWasm): b2TreeStats = js("new _module.b2TreeStats()") -fun b2TreeStatsFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2TreeStats = js("_module.wrapPointer(ptr, _module.b2TreeStats)") +fun b2TreeStatsFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2TreeStats = js("_module.wrapPointer(ptr, _module.b2TreeStats)") -fun b2TreeStats.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2ExplosionDef { +external interface b2ExplosionDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -2107,15 +2334,11 @@ external interface b2ExplosionDef { var radius: Float } -fun b2ExplosionDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ExplosionDef = js("new _module.b2ExplosionDef()") +fun b2ExplosionDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ExplosionDef = js("new _module.b2ExplosionDef()") -fun b2ExplosionDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ExplosionDef = js("_module.wrapPointer(ptr, _module.b2ExplosionDef)") - -fun b2ExplosionDef.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ExplosionDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ExplosionDef = js("_module.wrapPointer(ptr, _module.b2ExplosionDef)") -external interface b2WorldDef { +external interface b2WorldDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -2160,18 +2383,14 @@ external interface b2WorldDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2WorldDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2WorldDef = js("new _module.b2WorldDef()") +fun b2WorldDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2WorldDef = js("new _module.b2WorldDef()") -fun b2WorldDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2WorldDef = js("_module.wrapPointer(ptr, _module.b2WorldDef)") +fun b2WorldDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2WorldDef = js("_module.wrapPointer(ptr, _module.b2WorldDef)") -fun b2WorldDef.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2DebugDraw { +external interface b2DebugDraw : JsAny, DestroyableNative { /** * Native object address. */ @@ -2239,77 +2458,41 @@ external interface b2DebugDraw { var drawIslands: Boolean } -fun b2DebugDraw(_module: dynamic = Box2dWasmLoader.box2dWasm): b2DebugDraw = js("new _module.b2DebugDraw()") - -fun b2DebugDrawFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2DebugDraw = js("_module.wrapPointer(ptr, _module.b2DebugDraw)") - -fun b2DebugDraw.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2DebugDrawCallbacks - -fun b2DebugDrawCallbacksFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2DebugDrawCallbacks = js("_module.wrapPointer(ptr, _module.b2DebugDrawCallbacks)") - -fun b2DebugDrawCallbacks.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2CustomFilterFcnI - -fun b2CustomFilterFcnIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CustomFilterFcnI = js("_module.wrapPointer(ptr, _module.b2CustomFilterFcnI)") - -fun b2CustomFilterFcnI.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2PreSolveFcnI +fun b2DebugDraw(_module: JsAny = Box2dWasmLoader.box2dWasm): b2DebugDraw = js("new _module.b2DebugDraw()") -fun b2PreSolveFcnIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2PreSolveFcnI = js("_module.wrapPointer(ptr, _module.b2PreSolveFcnI)") +fun b2DebugDrawFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2DebugDraw = js("_module.wrapPointer(ptr, _module.b2DebugDraw)") -fun b2PreSolveFcnI.destroy() { - Box2dWasmLoader.destroy(this) -} +external interface b2DebugDrawCallbacks : JsAny, DestroyableNative -external interface b2FrictionCallbackI +fun b2DebugDrawCallbacksFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2DebugDrawCallbacks = js("_module.wrapPointer(ptr, _module.b2DebugDrawCallbacks)") -fun b2FrictionCallbackIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2FrictionCallbackI = js("_module.wrapPointer(ptr, _module.b2FrictionCallbackI)") +external interface b2CustomFilterFcnI : JsAny, DestroyableNative -fun b2FrictionCallbackI.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2CustomFilterFcnIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CustomFilterFcnI = js("_module.wrapPointer(ptr, _module.b2CustomFilterFcnI)") -external interface b2RestitutionCallbackI +external interface b2PreSolveFcnI : JsAny, DestroyableNative -fun b2RestitutionCallbackIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2RestitutionCallbackI = js("_module.wrapPointer(ptr, _module.b2RestitutionCallbackI)") +fun b2PreSolveFcnIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2PreSolveFcnI = js("_module.wrapPointer(ptr, _module.b2PreSolveFcnI)") -fun b2RestitutionCallbackI.destroy() { - Box2dWasmLoader.destroy(this) -} +external interface b2FrictionCallbackI : JsAny, DestroyableNative -external interface b2OverlapResultFcnI +fun b2FrictionCallbackIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2FrictionCallbackI = js("_module.wrapPointer(ptr, _module.b2FrictionCallbackI)") -fun b2OverlapResultFcnIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2OverlapResultFcnI = js("_module.wrapPointer(ptr, _module.b2OverlapResultFcnI)") +external interface b2RestitutionCallbackI : JsAny, DestroyableNative -fun b2OverlapResultFcnI.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2RestitutionCallbackIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2RestitutionCallbackI = js("_module.wrapPointer(ptr, _module.b2RestitutionCallbackI)") -external interface b2CastResultFcnI +external interface b2OverlapResultFcnI : JsAny, DestroyableNative -fun b2CastResultFcnIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CastResultFcnI = js("_module.wrapPointer(ptr, _module.b2CastResultFcnI)") +fun b2OverlapResultFcnIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2OverlapResultFcnI = js("_module.wrapPointer(ptr, _module.b2OverlapResultFcnI)") -fun b2CastResultFcnI.destroy() { - Box2dWasmLoader.destroy(this) -} +external interface b2CastResultFcnI : JsAny, DestroyableNative -external interface b2PlaneResultFcnI +fun b2CastResultFcnIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CastResultFcnI = js("_module.wrapPointer(ptr, _module.b2CastResultFcnI)") -fun b2PlaneResultFcnIFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2PlaneResultFcnI = js("_module.wrapPointer(ptr, _module.b2PlaneResultFcnI)") +external interface b2PlaneResultFcnI : JsAny, DestroyableNative -fun b2PlaneResultFcnI.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2PlaneResultFcnIFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2PlaneResultFcnI = js("_module.wrapPointer(ptr, _module.b2PlaneResultFcnI)") external interface b2DebugDrawCallbacksImpl : b2DebugDrawCallbacks { /** @@ -2378,7 +2561,7 @@ external interface b2DebugDrawCallbacksImpl : b2DebugDrawCallbacks { } -fun b2DebugDrawCallbacksImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2DebugDrawCallbacksImpl = js("new _module.b2DebugDrawCallbacksImpl()") +fun b2DebugDrawCallbacksImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2DebugDrawCallbacksImpl = js("new _module.b2DebugDrawCallbacksImpl()") external interface b2CustomFilterFcnImpl : b2CustomFilterFcnI { /** @@ -2390,7 +2573,7 @@ external interface b2CustomFilterFcnImpl : b2CustomFilterFcnI { } -fun b2CustomFilterFcnImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2CustomFilterFcnImpl = js("new _module.b2CustomFilterFcnImpl()") +fun b2CustomFilterFcnImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2CustomFilterFcnImpl = js("new _module.b2CustomFilterFcnImpl()") external interface b2PreSolveFcnImpl : b2PreSolveFcnI { /** @@ -2403,7 +2586,7 @@ external interface b2PreSolveFcnImpl : b2PreSolveFcnI { } -fun b2PreSolveFcnImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2PreSolveFcnImpl = js("new _module.b2PreSolveFcnImpl()") +fun b2PreSolveFcnImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2PreSolveFcnImpl = js("new _module.b2PreSolveFcnImpl()") external interface b2FrictionCallbackImpl : b2FrictionCallbackI { /** @@ -2417,7 +2600,7 @@ external interface b2FrictionCallbackImpl : b2FrictionCallbackI { } -fun b2FrictionCallbackImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2FrictionCallbackImpl = js("new _module.b2FrictionCallbackImpl()") +fun b2FrictionCallbackImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2FrictionCallbackImpl = js("new _module.b2FrictionCallbackImpl()") external interface b2RestitutionCallbackImpl : b2RestitutionCallbackI { /** @@ -2431,7 +2614,7 @@ external interface b2RestitutionCallbackImpl : b2RestitutionCallbackI { } -fun b2RestitutionCallbackImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2RestitutionCallbackImpl = js("new _module.b2RestitutionCallbackImpl()") +fun b2RestitutionCallbackImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2RestitutionCallbackImpl = js("new _module.b2RestitutionCallbackImpl()") external interface b2OverlapResultFcnImpl : b2OverlapResultFcnI { /** @@ -2442,7 +2625,7 @@ external interface b2OverlapResultFcnImpl : b2OverlapResultFcnI { } -fun b2OverlapResultFcnImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2OverlapResultFcnImpl = js("new _module.b2OverlapResultFcnImpl()") +fun b2OverlapResultFcnImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2OverlapResultFcnImpl = js("new _module.b2OverlapResultFcnImpl()") external interface b2CastResultFcnImpl : b2CastResultFcnI { /** @@ -2456,7 +2639,7 @@ external interface b2CastResultFcnImpl : b2CastResultFcnI { } -fun b2CastResultFcnImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2CastResultFcnImpl = js("new _module.b2CastResultFcnImpl()") +fun b2CastResultFcnImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2CastResultFcnImpl = js("new _module.b2CastResultFcnImpl()") external interface b2PlaneResultFcnImpl : b2PlaneResultFcnI { /** @@ -2468,9 +2651,9 @@ external interface b2PlaneResultFcnImpl : b2PlaneResultFcnI { } -fun b2PlaneResultFcnImpl(_module: dynamic = Box2dWasmLoader.box2dWasm): b2PlaneResultFcnImpl = js("new _module.b2PlaneResultFcnImpl()") +fun b2PlaneResultFcnImpl(_module: JsAny = Box2dWasmLoader.box2dWasm): b2PlaneResultFcnImpl = js("new _module.b2PlaneResultFcnImpl()") -external interface b2Counters { +external interface b2Counters : JsAny, DestroyableNative { /** * Native object address. */ @@ -2523,18 +2706,14 @@ external interface b2Counters { fun set_colorCounts(index: Int, value: Int) } -fun b2Counters(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Counters = js("new _module.b2Counters()") +fun b2Counters(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Counters = js("new _module.b2Counters()") -fun b2CountersFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Counters = js("_module.wrapPointer(ptr, _module.b2Counters)") - -fun b2Counters.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2CountersFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Counters = js("_module.wrapPointer(ptr, _module.b2Counters)") inline fun b2Counters.getColorCounts(index: Int) = get_colorCounts(index) inline fun b2Counters.setColorCounts(index: Int, value: Int) = set_colorCounts(index, value) -external interface b2Profile { +external interface b2Profile : JsAny, DestroyableNative { /** * Native object address. */ @@ -2630,15 +2809,11 @@ external interface b2Profile { var sensors: Float } -fun b2Profile(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Profile = js("new _module.b2Profile()") +fun b2Profile(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Profile = js("new _module.b2Profile()") -fun b2ProfileFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Profile = js("_module.wrapPointer(ptr, _module.b2Profile)") - -fun b2Profile.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ProfileFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Profile = js("_module.wrapPointer(ptr, _module.b2Profile)") -external interface B2_Base { +external interface B2_Base : JsAny { /** * Native object address. */ @@ -2716,14 +2891,14 @@ external interface B2_Base { } -fun B2_BaseFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Base = js("_module.wrapPointer(ptr, _module.B2_Base)") +fun B2_BaseFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Base = js("_module.wrapPointer(ptr, _module.B2_Base)") val B2_Base.version get() = getVersion() val B2_Base.byteCount get() = getByteCount() -external interface b2Version { +external interface b2Version : JsAny, DestroyableNative { /** * Native object address. */ @@ -2743,13 +2918,9 @@ external interface b2Version { var revision: Int } -fun b2VersionFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Version = js("_module.wrapPointer(ptr, _module.b2Version)") +fun b2VersionFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Version = js("_module.wrapPointer(ptr, _module.b2Version)") -fun b2Version.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2WorldId { +external interface b2WorldId : JsAny, DestroyableNative { /** * Native object address. */ @@ -2765,15 +2936,11 @@ external interface b2WorldId { var index1: Short } -fun b2WorldId(_module: dynamic = Box2dWasmLoader.box2dWasm): b2WorldId = js("new _module.b2WorldId()") +fun b2WorldId(_module: JsAny = Box2dWasmLoader.box2dWasm): b2WorldId = js("new _module.b2WorldId()") -fun b2WorldIdFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2WorldId = js("_module.wrapPointer(ptr, _module.b2WorldId)") - -fun b2WorldId.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2WorldIdFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2WorldId = js("_module.wrapPointer(ptr, _module.b2WorldId)") -external interface b2BodyId { +external interface b2BodyId : JsAny, DestroyableNative { /** * Native object address. */ @@ -2793,15 +2960,11 @@ external interface b2BodyId { var world0: Short } -fun b2BodyId(_module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyId = js("new _module.b2BodyId()") +fun b2BodyId(_module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyId = js("new _module.b2BodyId()") -fun b2BodyIdFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyId = js("_module.wrapPointer(ptr, _module.b2BodyId)") +fun b2BodyIdFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyId = js("_module.wrapPointer(ptr, _module.b2BodyId)") -fun b2BodyId.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2ShapeId { +external interface b2ShapeId : JsAny, DestroyableNative { /** * Native object address. */ @@ -2821,15 +2984,11 @@ external interface b2ShapeId { var world0: Short } -fun b2ShapeId(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeId = js("new _module.b2ShapeId()") +fun b2ShapeId(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeId = js("new _module.b2ShapeId()") -fun b2ShapeIdFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeId = js("_module.wrapPointer(ptr, _module.b2ShapeId)") - -fun b2ShapeId.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ShapeIdFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeId = js("_module.wrapPointer(ptr, _module.b2ShapeId)") -external interface b2ChainId { +external interface b2ChainId : JsAny, DestroyableNative { /** * Native object address. */ @@ -2849,15 +3008,11 @@ external interface b2ChainId { var world0: Short } -fun b2ChainId(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ChainId = js("new _module.b2ChainId()") +fun b2ChainId(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ChainId = js("new _module.b2ChainId()") -fun b2ChainIdFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ChainId = js("_module.wrapPointer(ptr, _module.b2ChainId)") +fun b2ChainIdFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ChainId = js("_module.wrapPointer(ptr, _module.b2ChainId)") -fun b2ChainId.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2JointId { +external interface b2JointId : JsAny, DestroyableNative { /** * Native object address. */ @@ -2877,15 +3032,11 @@ external interface b2JointId { var world0: Short } -fun b2JointId(_module: dynamic = Box2dWasmLoader.box2dWasm): b2JointId = js("new _module.b2JointId()") +fun b2JointId(_module: JsAny = Box2dWasmLoader.box2dWasm): b2JointId = js("new _module.b2JointId()") -fun b2JointIdFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2JointId = js("_module.wrapPointer(ptr, _module.b2JointId)") - -fun b2JointId.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2JointIdFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2JointId = js("_module.wrapPointer(ptr, _module.b2JointId)") -external interface b2ShapeIdArray { +external interface b2ShapeIdArray : JsAny, DestroyableNative { /** * Native object address. */ @@ -2913,15 +3064,11 @@ external interface b2ShapeIdArray { /** * @param length WebIDL type: unsigned long */ -fun b2ShapeIdArray(length: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeIdArray = js("new _module.b2ShapeIdArray(length)") +fun b2ShapeIdArray(length: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeIdArray = js("new _module.b2ShapeIdArray(length)") -fun b2ShapeIdArrayFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeIdArray = js("_module.wrapPointer(ptr, _module.b2ShapeIdArray)") +fun b2ShapeIdArrayFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeIdArray = js("_module.wrapPointer(ptr, _module.b2ShapeIdArray)") -fun b2ShapeIdArray.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2JointIdArray { +external interface b2JointIdArray : JsAny, DestroyableNative { /** * Native object address. */ @@ -2949,15 +3096,11 @@ external interface b2JointIdArray { /** * @param length WebIDL type: unsigned long */ -fun b2JointIdArray(length: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2JointIdArray = js("new _module.b2JointIdArray(length)") +fun b2JointIdArray(length: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2JointIdArray = js("new _module.b2JointIdArray(length)") -fun b2JointIdArrayFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2JointIdArray = js("_module.wrapPointer(ptr, _module.b2JointIdArray)") - -fun b2JointIdArray.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2JointIdArrayFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2JointIdArray = js("_module.wrapPointer(ptr, _module.b2JointIdArray)") -external interface b2ContactDataArray { +external interface b2ContactDataArray : JsAny, DestroyableNative { /** * Native object address. */ @@ -2985,15 +3128,11 @@ external interface b2ContactDataArray { /** * @param length WebIDL type: unsigned long */ -fun b2ContactDataArray(length: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactDataArray = js("new _module.b2ContactDataArray(length)") +fun b2ContactDataArray(length: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactDataArray = js("new _module.b2ContactDataArray(length)") -fun b2ContactDataArrayFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ContactDataArray = js("_module.wrapPointer(ptr, _module.b2ContactDataArray)") +fun b2ContactDataArrayFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ContactDataArray = js("_module.wrapPointer(ptr, _module.b2ContactDataArray)") -fun b2ContactDataArray.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2CollisionPlaneArray { +external interface b2CollisionPlaneArray : JsAny, DestroyableNative { /** * Native object address. */ @@ -3021,15 +3160,11 @@ external interface b2CollisionPlaneArray { /** * @param length WebIDL type: unsigned long */ -fun b2CollisionPlaneArray(length: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CollisionPlaneArray = js("new _module.b2CollisionPlaneArray(length)") +fun b2CollisionPlaneArray(length: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CollisionPlaneArray = js("new _module.b2CollisionPlaneArray(length)") -fun b2CollisionPlaneArrayFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CollisionPlaneArray = js("_module.wrapPointer(ptr, _module.b2CollisionPlaneArray)") - -fun b2CollisionPlaneArray.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2CollisionPlaneArrayFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CollisionPlaneArray = js("_module.wrapPointer(ptr, _module.b2CollisionPlaneArray)") -external interface b2Vec2Array { +external interface b2Vec2Array : JsAny, DestroyableNative { /** * Native object address. */ @@ -3057,15 +3192,11 @@ external interface b2Vec2Array { /** * @param length WebIDL type: unsigned long */ -fun b2Vec2Array(length: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Vec2Array = js("new _module.b2Vec2Array(length)") +fun b2Vec2Array(length: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Vec2Array = js("new _module.b2Vec2Array(length)") -fun b2Vec2ArrayFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Vec2Array = js("_module.wrapPointer(ptr, _module.b2Vec2Array)") +fun b2Vec2ArrayFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Vec2Array = js("_module.wrapPointer(ptr, _module.b2Vec2Array)") -fun b2Vec2Array.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface B2_Body { +external interface B2_Body : JsAny { /** * Native object address. */ @@ -3098,13 +3229,13 @@ external interface B2_Body { * @param bodyId WebIDL type: unsigned long long * @return WebIDL type: [b2BodyType] (enum) */ - fun getType(bodyId: Long): b2BodyType + fun getType(bodyId: Long): Int /** * @param bodyId WebIDL type: unsigned long long * @param type WebIDL type: [b2BodyType] (enum) */ - fun setType(bodyId: Long, type: b2BodyType) + fun setType(bodyId: Long, type: Int) /** * @param bodyId WebIDL type: unsigned long long @@ -3480,19 +3611,21 @@ external interface B2_Body { * @param bodyId WebIDL type: unsigned long long * @param userData WebIDL type: VoidPtr */ - fun setUserData(bodyId: Long, userData: Any) + fun setUserData(bodyId: Long, userData: JsAny) /** * @param bodyId WebIDL type: unsigned long long * @return WebIDL type: VoidPtr */ - fun getUserData(bodyId: Long): Any + fun getUserData(bodyId: Long): JsAny } -fun B2_BodyFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Body = js("_module.wrapPointer(ptr, _module.B2_Body)") +fun B2_BodyFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Body = js("_module.wrapPointer(ptr, _module.B2_Body)") -external interface b2BodyDef { +fun B2_Body.setType(bodyId: Long, type: b2BodyType) = setType(bodyId, type.value) + +external interface b2BodyDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -3501,7 +3634,7 @@ external interface b2BodyDef { /** * WebIDL type: [b2BodyType] (enum) */ - var type: b2BodyType + var type: Int /** * WebIDL type: [b2Vec2] (Value) */ @@ -3541,7 +3674,7 @@ external interface b2BodyDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * WebIDL type: boolean */ @@ -3568,15 +3701,15 @@ external interface b2BodyDef { var allowFastRotation: Boolean } -fun b2BodyDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyDef = js("new _module.b2BodyDef()") +fun b2BodyDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyDef = js("new _module.b2BodyDef()") -fun b2BodyDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2BodyDef = js("_module.wrapPointer(ptr, _module.b2BodyDef)") +fun b2BodyDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2BodyDef = js("_module.wrapPointer(ptr, _module.b2BodyDef)") -fun b2BodyDef.destroy() { - Box2dWasmLoader.destroy(this) -} +var b2BodyDef.typeEnum: b2BodyType + get() = b2BodyType.forValue(type) + set(value) { type = value.value } -external interface B2_CharacterMover { +external interface B2_CharacterMover : JsAny { /** * Native object address. */ @@ -3598,9 +3731,9 @@ external interface B2_CharacterMover { } -fun B2_CharacterMoverFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_CharacterMover = js("_module.wrapPointer(ptr, _module.B2_CharacterMover)") +fun B2_CharacterMoverFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_CharacterMover = js("_module.wrapPointer(ptr, _module.B2_CharacterMover)") -external interface b2PlaneResult { +external interface b2PlaneResult : JsAny, DestroyableNative { /** * Native object address. */ @@ -3616,15 +3749,11 @@ external interface b2PlaneResult { var plane: b2Plane } -fun b2PlaneResult(_module: dynamic = Box2dWasmLoader.box2dWasm): b2PlaneResult = js("new _module.b2PlaneResult()") +fun b2PlaneResult(_module: JsAny = Box2dWasmLoader.box2dWasm): b2PlaneResult = js("new _module.b2PlaneResult()") -fun b2PlaneResultFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2PlaneResult = js("_module.wrapPointer(ptr, _module.b2PlaneResult)") +fun b2PlaneResultFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2PlaneResult = js("_module.wrapPointer(ptr, _module.b2PlaneResult)") -fun b2PlaneResult.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2CollisionPlane { +external interface b2CollisionPlane : JsAny, DestroyableNative { /** * Native object address. */ @@ -3648,15 +3777,11 @@ external interface b2CollisionPlane { var pushLimit: Float } -fun b2CollisionPlane(_module: dynamic = Box2dWasmLoader.box2dWasm): b2CollisionPlane = js("new _module.b2CollisionPlane()") +fun b2CollisionPlane(_module: JsAny = Box2dWasmLoader.box2dWasm): b2CollisionPlane = js("new _module.b2CollisionPlane()") -fun b2CollisionPlaneFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CollisionPlane = js("_module.wrapPointer(ptr, _module.b2CollisionPlane)") - -fun b2CollisionPlane.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2CollisionPlaneFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CollisionPlane = js("_module.wrapPointer(ptr, _module.b2CollisionPlane)") -external interface b2PlaneSolverResult { +external interface b2PlaneSolverResult : JsAny, DestroyableNative { /** * Native object address. */ @@ -3672,15 +3797,11 @@ external interface b2PlaneSolverResult { var translation: b2Vec2 } -fun b2PlaneSolverResult(_module: dynamic = Box2dWasmLoader.box2dWasm): b2PlaneSolverResult = js("new _module.b2PlaneSolverResult()") +fun b2PlaneSolverResult(_module: JsAny = Box2dWasmLoader.box2dWasm): b2PlaneSolverResult = js("new _module.b2PlaneSolverResult()") -fun b2PlaneSolverResultFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2PlaneSolverResult = js("_module.wrapPointer(ptr, _module.b2PlaneSolverResult)") +fun b2PlaneSolverResultFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2PlaneSolverResult = js("_module.wrapPointer(ptr, _module.b2PlaneSolverResult)") -fun b2PlaneSolverResult.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface B2_Joint { +external interface B2_Joint : JsAny { /** * Native object address. */ @@ -3701,7 +3822,7 @@ external interface B2_Joint { * @param jointId WebIDL type: unsigned long long * @return WebIDL type: [b2JointType] (enum) */ - fun getType(jointId: Long): b2JointType + fun getType(jointId: Long): Int /** * @param jointId WebIDL type: unsigned long long @@ -3843,9 +3964,9 @@ external interface B2_Joint { } -fun B2_JointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Joint = js("_module.wrapPointer(ptr, _module.B2_Joint)") +fun B2_JointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Joint = js("_module.wrapPointer(ptr, _module.B2_Joint)") -external interface B2_DistanceJoint { +external interface B2_DistanceJoint : JsAny { /** * Native object address. */ @@ -3992,9 +4113,9 @@ external interface B2_DistanceJoint { } -fun B2_DistanceJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_DistanceJoint = js("_module.wrapPointer(ptr, _module.B2_DistanceJoint)") +fun B2_DistanceJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_DistanceJoint = js("_module.wrapPointer(ptr, _module.B2_DistanceJoint)") -external interface b2DistanceJointDef { +external interface b2DistanceJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4067,18 +4188,14 @@ external interface b2DistanceJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2DistanceJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2DistanceJointDef = js("new _module.b2DistanceJointDef()") +fun b2DistanceJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2DistanceJointDef = js("new _module.b2DistanceJointDef()") -fun b2DistanceJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2DistanceJointDef = js("_module.wrapPointer(ptr, _module.b2DistanceJointDef)") - -fun b2DistanceJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2DistanceJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2DistanceJointDef = js("_module.wrapPointer(ptr, _module.b2DistanceJointDef)") -external interface B2_FilterJoint { +external interface B2_FilterJoint : JsAny { /** * Native object address. */ @@ -4098,9 +4215,9 @@ external interface B2_FilterJoint { } -fun B2_FilterJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_FilterJoint = js("_module.wrapPointer(ptr, _module.B2_FilterJoint)") +fun B2_FilterJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_FilterJoint = js("_module.wrapPointer(ptr, _module.B2_FilterJoint)") -external interface b2FilterJointDef { +external interface b2FilterJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4117,18 +4234,14 @@ external interface b2FilterJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2FilterJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2FilterJointDef = js("new _module.b2FilterJointDef()") +fun b2FilterJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2FilterJointDef = js("new _module.b2FilterJointDef()") -fun b2FilterJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2FilterJointDef = js("_module.wrapPointer(ptr, _module.b2FilterJointDef)") +fun b2FilterJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2FilterJointDef = js("_module.wrapPointer(ptr, _module.b2FilterJointDef)") -fun b2FilterJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface B2_MotorJoint { +external interface B2_MotorJoint : JsAny { /** * Native object address. */ @@ -4208,9 +4321,9 @@ external interface B2_MotorJoint { } -fun B2_MotorJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_MotorJoint = js("_module.wrapPointer(ptr, _module.B2_MotorJoint)") +fun B2_MotorJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_MotorJoint = js("_module.wrapPointer(ptr, _module.B2_MotorJoint)") -external interface b2MotorJointDef { +external interface b2MotorJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4255,18 +4368,14 @@ external interface b2MotorJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2MotorJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2MotorJointDef = js("new _module.b2MotorJointDef()") +fun b2MotorJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2MotorJointDef = js("new _module.b2MotorJointDef()") -fun b2MotorJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2MotorJointDef = js("_module.wrapPointer(ptr, _module.b2MotorJointDef)") - -fun b2MotorJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2MotorJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2MotorJointDef = js("_module.wrapPointer(ptr, _module.b2MotorJointDef)") -external interface B2_MouseJoint { +external interface B2_MouseJoint : JsAny { /** * Native object address. */ @@ -4334,9 +4443,9 @@ external interface B2_MouseJoint { } -fun B2_MouseJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_MouseJoint = js("_module.wrapPointer(ptr, _module.B2_MouseJoint)") +fun B2_MouseJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_MouseJoint = js("_module.wrapPointer(ptr, _module.B2_MouseJoint)") -external interface b2MouseJointDef { +external interface b2MouseJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4377,18 +4486,14 @@ external interface b2MouseJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2MouseJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2MouseJointDef = js("new _module.b2MouseJointDef()") +fun b2MouseJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2MouseJointDef = js("new _module.b2MouseJointDef()") -fun b2MouseJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2MouseJointDef = js("_module.wrapPointer(ptr, _module.b2MouseJointDef)") +fun b2MouseJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2MouseJointDef = js("_module.wrapPointer(ptr, _module.b2MouseJointDef)") -fun b2MouseJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface B2_PrismaticJoint { +external interface B2_PrismaticJoint : JsAny { /** * Native object address. */ @@ -4541,9 +4646,9 @@ external interface B2_PrismaticJoint { } -fun B2_PrismaticJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_PrismaticJoint = js("_module.wrapPointer(ptr, _module.B2_PrismaticJoint)") +fun B2_PrismaticJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_PrismaticJoint = js("_module.wrapPointer(ptr, _module.B2_PrismaticJoint)") -external interface b2PrismaticJointDef { +external interface b2PrismaticJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4620,18 +4725,14 @@ external interface b2PrismaticJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2PrismaticJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2PrismaticJointDef = js("new _module.b2PrismaticJointDef()") +fun b2PrismaticJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2PrismaticJointDef = js("new _module.b2PrismaticJointDef()") -fun b2PrismaticJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2PrismaticJointDef = js("_module.wrapPointer(ptr, _module.b2PrismaticJointDef)") - -fun b2PrismaticJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2PrismaticJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2PrismaticJointDef = js("_module.wrapPointer(ptr, _module.b2PrismaticJointDef)") -external interface B2_RevoluteJoint { +external interface B2_RevoluteJoint : JsAny { /** * Native object address. */ @@ -4778,9 +4879,9 @@ external interface B2_RevoluteJoint { } -fun B2_RevoluteJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_RevoluteJoint = js("_module.wrapPointer(ptr, _module.B2_RevoluteJoint)") +fun B2_RevoluteJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_RevoluteJoint = js("_module.wrapPointer(ptr, _module.B2_RevoluteJoint)") -external interface b2RevoluteJointDef { +external interface b2RevoluteJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4857,18 +4958,14 @@ external interface b2RevoluteJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2RevoluteJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2RevoluteJointDef = js("new _module.b2RevoluteJointDef()") +fun b2RevoluteJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2RevoluteJointDef = js("new _module.b2RevoluteJointDef()") -fun b2RevoluteJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2RevoluteJointDef = js("_module.wrapPointer(ptr, _module.b2RevoluteJointDef)") +fun b2RevoluteJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2RevoluteJointDef = js("_module.wrapPointer(ptr, _module.b2RevoluteJointDef)") -fun b2RevoluteJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface B2_WeldJoint { +external interface B2_WeldJoint : JsAny { /** * Native object address. */ @@ -4936,9 +5033,9 @@ external interface B2_WeldJoint { } -fun B2_WeldJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_WeldJoint = js("_module.wrapPointer(ptr, _module.B2_WeldJoint)") +fun B2_WeldJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_WeldJoint = js("_module.wrapPointer(ptr, _module.B2_WeldJoint)") -external interface b2WeldJointDef { +external interface b2WeldJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -4991,18 +5088,14 @@ external interface b2WeldJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny } -fun b2WeldJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2WeldJointDef = js("new _module.b2WeldJointDef()") +fun b2WeldJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2WeldJointDef = js("new _module.b2WeldJointDef()") -fun b2WeldJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2WeldJointDef = js("_module.wrapPointer(ptr, _module.b2WeldJointDef)") - -fun b2WeldJointDef.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2WeldJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2WeldJointDef = js("_module.wrapPointer(ptr, _module.b2WeldJointDef)") -external interface B2_WheelJoint { +external interface B2_WheelJoint : JsAny { /** * Native object address. */ @@ -5131,9 +5224,9 @@ external interface B2_WheelJoint { } -fun B2_WheelJointFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_WheelJoint = js("_module.wrapPointer(ptr, _module.B2_WheelJoint)") +fun B2_WheelJointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_WheelJoint = js("_module.wrapPointer(ptr, _module.B2_WheelJoint)") -external interface b2WheelJointDef { +external interface b2WheelJointDef : JsAny, DestroyableNative { /** * Native object address. */ @@ -5206,18 +5299,218 @@ external interface b2WheelJointDef { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny +} + +fun b2WheelJointDef(_module: JsAny = Box2dWasmLoader.box2dWasm): b2WheelJointDef = js("new _module.b2WheelJointDef()") + +fun b2WheelJointDefFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2WheelJointDef = js("_module.wrapPointer(ptr, _module.b2WheelJointDef)") + +external interface B2_Collision : JsAny { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param circleA WebIDL type: [b2Circle] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param circleB WebIDL type: [b2Circle] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideCircles(circleA: b2Circle, xfA: b2Transform, circleB: b2Circle, xfB: b2Transform): b2Manifold + + /** + * @param capsuleA WebIDL type: [b2Capsule] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param circleB WebIDL type: [b2Circle] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideCapsuleAndCircle(capsuleA: b2Capsule, xfA: b2Transform, circleB: b2Circle, xfB: b2Transform): b2Manifold + + /** + * @param segmentA WebIDL type: [b2Segment] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param circleB WebIDL type: [b2Circle] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideSegmentAndCircle(segmentA: b2Segment, xfA: b2Transform, circleB: b2Circle, xfB: b2Transform): b2Manifold + + /** + * @param polygonA WebIDL type: [b2Polygon] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param circleB WebIDL type: [b2Circle] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collidePolygonAndCircle(polygonA: b2Polygon, xfA: b2Transform, circleB: b2Circle, xfB: b2Transform): b2Manifold + + /** + * @param capsuleA WebIDL type: [b2Capsule] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param capsuleB WebIDL type: [b2Capsule] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideCapsules(capsuleA: b2Capsule, xfA: b2Transform, capsuleB: b2Capsule, xfB: b2Transform): b2Manifold + + /** + * @param segmentA WebIDL type: [b2Segment] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param capsuleB WebIDL type: [b2Capsule] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideSegmentAndCapsule(segmentA: b2Segment, xfA: b2Transform, capsuleB: b2Capsule, xfB: b2Transform): b2Manifold + + /** + * @param polygonA WebIDL type: [b2Polygon] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param capsuleB WebIDL type: [b2Capsule] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collidePolygonAndCapsule(polygonA: b2Polygon, xfA: b2Transform, capsuleB: b2Capsule, xfB: b2Transform): b2Manifold + + /** + * @param polygonA WebIDL type: [b2Polygon] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param polygonB WebIDL type: [b2Polygon] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collidePolygons(polygonA: b2Polygon, xfA: b2Transform, polygonB: b2Polygon, xfB: b2Transform): b2Manifold + + /** + * @param segmentA WebIDL type: [b2Segment] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param polygonB WebIDL type: [b2Polygon] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideSegmentAndPolygon(segmentA: b2Segment, xfA: b2Transform, polygonB: b2Polygon, xfB: b2Transform): b2Manifold + + /** + * @param segmentA WebIDL type: [b2ChainSegment] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param circleB WebIDL type: [b2Circle] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideChainSegmentAndCircle(segmentA: b2ChainSegment, xfA: b2Transform, circleB: b2Circle, xfB: b2Transform): b2Manifold + + /** + * @param segmentA WebIDL type: [b2ChainSegment] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param capsuleB WebIDL type: [b2Capsule] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @param cache WebIDL type: [b2SimplexCache] + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideChainSegmentAndCapsule(segmentA: b2ChainSegment, xfA: b2Transform, capsuleB: b2Capsule, xfB: b2Transform, cache: b2SimplexCache): b2Manifold + + /** + * @param segmentA WebIDL type: [b2ChainSegment] (Const) + * @param xfA WebIDL type: [b2Transform] (Ref) + * @param polygonB WebIDL type: [b2Polygon] (Const) + * @param xfB WebIDL type: [b2Transform] (Ref) + * @param cache WebIDL type: [b2SimplexCache] + * @return WebIDL type: [b2Manifold] (Value) + */ + fun collideChainSegmentAndPolygon(segmentA: b2ChainSegment, xfA: b2Transform, polygonB: b2Polygon, xfB: b2Transform, cache: b2SimplexCache): b2Manifold + +} + +fun B2_CollisionFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Collision = js("_module.wrapPointer(ptr, _module.B2_Collision)") + +external interface b2ManifoldPoint : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [b2Vec2] (Value) + */ + var anchorA: b2Vec2 + /** + * WebIDL type: [b2Vec2] (Value) + */ + var anchorB: b2Vec2 + /** + * WebIDL type: unsigned short + */ + var id: Short + /** + * WebIDL type: float + */ + var normalImpulse: Float + /** + * WebIDL type: float + */ + var normalVelocity: Float + /** + * WebIDL type: boolean + */ + var persisted: Boolean + /** + * WebIDL type: [b2Vec2] (Value) + */ + var point: b2Vec2 + /** + * WebIDL type: float + */ + var separation: Float + /** + * WebIDL type: float + */ + var tangentImpulse: Float + /** + * WebIDL type: float + */ + var totalNormalImpulse: Float } -fun b2WheelJointDef(_module: dynamic = Box2dWasmLoader.box2dWasm): b2WheelJointDef = js("new _module.b2WheelJointDef()") +fun b2ManifoldPoint(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ManifoldPoint = js("new _module.b2ManifoldPoint()") + +fun b2ManifoldPointFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ManifoldPoint = js("_module.wrapPointer(ptr, _module.b2ManifoldPoint)") -fun b2WheelJointDefFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2WheelJointDef = js("_module.wrapPointer(ptr, _module.b2WheelJointDef)") +external interface b2Manifold : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int -fun b2WheelJointDef.destroy() { - Box2dWasmLoader.destroy(this) + /** + * WebIDL type: [b2Vec2] (Value) + */ + var normal: b2Vec2 + /** + * WebIDL type: long + */ + var pointCount: Int + /** + * WebIDL type: [b2ManifoldPoint] (Value) + */ + fun get_points(index: Int): b2ManifoldPoint + fun set_points(index: Int, value: b2ManifoldPoint) + /** + * WebIDL type: float + */ + var rollingImpulse: Float } -external interface B2_Geometry { +fun b2Manifold(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Manifold = js("new _module.b2Manifold()") + +fun b2ManifoldFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Manifold = js("_module.wrapPointer(ptr, _module.b2Manifold)") + +inline fun b2Manifold.getPoints(index: Int) = get_points(index) +inline fun b2Manifold.setPoints(index: Int, value: b2ManifoldPoint) = set_points(index, value) + +external interface B2_Geometry : JsAny { /** * Native object address. */ @@ -5446,9 +5739,9 @@ external interface B2_Geometry { } -fun B2_GeometryFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): B2_Geometry = js("_module.wrapPointer(ptr, _module.B2_Geometry)") +fun B2_GeometryFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): B2_Geometry = js("_module.wrapPointer(ptr, _module.B2_Geometry)") -external interface b2MassData { +external interface b2MassData : JsAny, DestroyableNative { /** * Native object address. */ @@ -5468,15 +5761,11 @@ external interface b2MassData { var rotationalInertia: Float } -fun b2MassData(_module: dynamic = Box2dWasmLoader.box2dWasm): b2MassData = js("new _module.b2MassData()") +fun b2MassData(_module: JsAny = Box2dWasmLoader.box2dWasm): b2MassData = js("new _module.b2MassData()") -fun b2MassDataFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2MassData = js("_module.wrapPointer(ptr, _module.b2MassData)") +fun b2MassDataFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2MassData = js("_module.wrapPointer(ptr, _module.b2MassData)") -fun b2MassData.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2Circle { +external interface b2Circle : JsAny, DestroyableNative { /** * Native object address. */ @@ -5492,15 +5781,11 @@ external interface b2Circle { var radius: Float } -fun b2Circle(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Circle = js("new _module.b2Circle()") +fun b2Circle(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Circle = js("new _module.b2Circle()") -fun b2CircleFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Circle = js("_module.wrapPointer(ptr, _module.b2Circle)") - -fun b2Circle.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2CircleFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Circle = js("_module.wrapPointer(ptr, _module.b2Circle)") -external interface b2Capsule { +external interface b2Capsule : JsAny, DestroyableNative { /** * Native object address. */ @@ -5520,15 +5805,11 @@ external interface b2Capsule { var radius: Float } -fun b2Capsule(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Capsule = js("new _module.b2Capsule()") +fun b2Capsule(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Capsule = js("new _module.b2Capsule()") -fun b2CapsuleFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Capsule = js("_module.wrapPointer(ptr, _module.b2Capsule)") +fun b2CapsuleFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Capsule = js("_module.wrapPointer(ptr, _module.b2Capsule)") -fun b2Capsule.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2Polygon { +external interface b2Polygon : JsAny, DestroyableNative { /** * Native object address. */ @@ -5558,20 +5839,16 @@ external interface b2Polygon { var count: Int } -fun b2Polygon(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Polygon = js("new _module.b2Polygon()") +fun b2Polygon(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Polygon = js("new _module.b2Polygon()") -fun b2PolygonFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Polygon = js("_module.wrapPointer(ptr, _module.b2Polygon)") - -fun b2Polygon.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2PolygonFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Polygon = js("_module.wrapPointer(ptr, _module.b2Polygon)") inline fun b2Polygon.getVertices(index: Int) = get_vertices(index) inline fun b2Polygon.setVertices(index: Int, value: b2Vec2) = set_vertices(index, value) inline fun b2Polygon.getNormals(index: Int) = get_normals(index) inline fun b2Polygon.setNormals(index: Int, value: b2Vec2) = set_normals(index, value) -external interface b2Segment { +external interface b2Segment : JsAny, DestroyableNative { /** * Native object address. */ @@ -5587,15 +5864,11 @@ external interface b2Segment { var point2: b2Vec2 } -fun b2Segment(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Segment = js("new _module.b2Segment()") +fun b2Segment(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Segment = js("new _module.b2Segment()") -fun b2SegmentFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Segment = js("_module.wrapPointer(ptr, _module.b2Segment)") +fun b2SegmentFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Segment = js("_module.wrapPointer(ptr, _module.b2Segment)") -fun b2Segment.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2ChainSegment { +external interface b2ChainSegment : JsAny, DestroyableNative { /** * Native object address. */ @@ -5619,15 +5892,11 @@ external interface b2ChainSegment { var segment: b2Segment } -fun b2ChainSegment(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ChainSegment = js("new _module.b2ChainSegment()") +fun b2ChainSegment(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ChainSegment = js("new _module.b2ChainSegment()") -fun b2ChainSegmentFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ChainSegment = js("_module.wrapPointer(ptr, _module.b2ChainSegment)") - -fun b2ChainSegment.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ChainSegmentFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ChainSegment = js("_module.wrapPointer(ptr, _module.b2ChainSegment)") -external interface b2Hull { +external interface b2Hull : JsAny, DestroyableNative { /** * Native object address. */ @@ -5644,18 +5913,14 @@ external interface b2Hull { fun set_points(index: Int, value: b2Vec2) } -fun b2Hull(_module: dynamic = Box2dWasmLoader.box2dWasm): b2Hull = js("new _module.b2Hull()") +fun b2Hull(_module: JsAny = Box2dWasmLoader.box2dWasm): b2Hull = js("new _module.b2Hull()") -fun b2HullFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2Hull = js("_module.wrapPointer(ptr, _module.b2Hull)") - -fun b2Hull.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2HullFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2Hull = js("_module.wrapPointer(ptr, _module.b2Hull)") inline fun b2Hull.getPoints(index: Int) = get_points(index) inline fun b2Hull.setPoints(index: Int, value: b2Vec2) = set_points(index, value) -external interface b2ShapeProxy { +external interface b2ShapeProxy : JsAny, DestroyableNative { /** * Native object address. */ @@ -5676,18 +5941,14 @@ external interface b2ShapeProxy { var radius: Float } -fun b2ShapeProxy(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeProxy = js("new _module.b2ShapeProxy()") +fun b2ShapeProxy(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeProxy = js("new _module.b2ShapeProxy()") -fun b2ShapeProxyFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeProxy = js("_module.wrapPointer(ptr, _module.b2ShapeProxy)") - -fun b2ShapeProxy.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ShapeProxyFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeProxy = js("_module.wrapPointer(ptr, _module.b2ShapeProxy)") inline fun b2ShapeProxy.getPoints(index: Int) = get_points(index) inline fun b2ShapeProxy.setPoints(index: Int, value: b2Vec2) = set_points(index, value) -external interface b2RayCastInput { +external interface b2RayCastInput : JsAny, DestroyableNative { /** * Native object address. */ @@ -5707,15 +5968,11 @@ external interface b2RayCastInput { var translation: b2Vec2 } -fun b2RayCastInput(_module: dynamic = Box2dWasmLoader.box2dWasm): b2RayCastInput = js("new _module.b2RayCastInput()") +fun b2RayCastInput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2RayCastInput = js("new _module.b2RayCastInput()") -fun b2RayCastInputFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2RayCastInput = js("_module.wrapPointer(ptr, _module.b2RayCastInput)") +fun b2RayCastInputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2RayCastInput = js("_module.wrapPointer(ptr, _module.b2RayCastInput)") -fun b2RayCastInput.destroy() { - Box2dWasmLoader.destroy(this) -} - -external interface b2ShapeCastInput { +external interface b2ShapeCastInput : JsAny, DestroyableNative { /** * Native object address. */ @@ -5739,15 +5996,11 @@ external interface b2ShapeCastInput { var translation: b2Vec2 } -fun b2ShapeCastInput(_module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeCastInput = js("new _module.b2ShapeCastInput()") +fun b2ShapeCastInput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeCastInput = js("new _module.b2ShapeCastInput()") -fun b2ShapeCastInputFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2ShapeCastInput = js("_module.wrapPointer(ptr, _module.b2ShapeCastInput)") - -fun b2ShapeCastInput.destroy() { - Box2dWasmLoader.destroy(this) -} +fun b2ShapeCastInputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2ShapeCastInput = js("_module.wrapPointer(ptr, _module.b2ShapeCastInput)") -external interface b2CastOutput { +external interface b2CastOutput : JsAny, DestroyableNative { /** * Native object address. */ @@ -5775,42 +6028,106 @@ external interface b2CastOutput { var point: b2Vec2 } -fun b2CastOutput(_module: dynamic = Box2dWasmLoader.box2dWasm): b2CastOutput = js("new _module.b2CastOutput()") +fun b2CastOutput(_module: JsAny = Box2dWasmLoader.box2dWasm): b2CastOutput = js("new _module.b2CastOutput()") -fun b2CastOutputFromPointer(ptr: Int, _module: dynamic = Box2dWasmLoader.box2dWasm): b2CastOutput = js("_module.wrapPointer(ptr, _module.b2CastOutput)") +fun b2CastOutputFromPointer(ptr: Int, _module: JsAny = Box2dWasmLoader.box2dWasm): b2CastOutput = js("_module.wrapPointer(ptr, _module.b2CastOutput)") -fun b2CastOutput.destroy() { - Box2dWasmLoader.destroy(this) +value class b2ShapeType private constructor(val value: Int) { + companion object { + val b2_circleShape: b2ShapeType = b2ShapeType(b2ShapeType_b2_circleShape(Box2dWasmLoader.box2dWasm)) + val b2_capsuleShape: b2ShapeType = b2ShapeType(b2ShapeType_b2_capsuleShape(Box2dWasmLoader.box2dWasm)) + val b2_segmentShape: b2ShapeType = b2ShapeType(b2ShapeType_b2_segmentShape(Box2dWasmLoader.box2dWasm)) + val b2_polygonShape: b2ShapeType = b2ShapeType(b2ShapeType_b2_polygonShape(Box2dWasmLoader.box2dWasm)) + val b2_chainSegmentShape: b2ShapeType = b2ShapeType(b2ShapeType_b2_chainSegmentShape(Box2dWasmLoader.box2dWasm)) + fun forValue(value: Int) = when(value) { + b2_circleShape.value -> b2_circleShape + b2_capsuleShape.value -> b2_capsuleShape + b2_segmentShape.value -> b2_segmentShape + b2_polygonShape.value -> b2_polygonShape + b2_chainSegmentShape.value -> b2_chainSegmentShape + else -> error("Invalid enum value $value for enum b2ShapeType") + } + } } -value class b2ShapeType private constructor(val value: Int) { +private fun b2ShapeType_b2_circleShape(module: JsAny): Int = js("module._emscripten_enum_b2ShapeType_b2_circleShape()") +private fun b2ShapeType_b2_capsuleShape(module: JsAny): Int = js("module._emscripten_enum_b2ShapeType_b2_capsuleShape()") +private fun b2ShapeType_b2_segmentShape(module: JsAny): Int = js("module._emscripten_enum_b2ShapeType_b2_segmentShape()") +private fun b2ShapeType_b2_polygonShape(module: JsAny): Int = js("module._emscripten_enum_b2ShapeType_b2_polygonShape()") +private fun b2ShapeType_b2_chainSegmentShape(module: JsAny): Int = js("module._emscripten_enum_b2ShapeType_b2_chainSegmentShape()") + +value class b2TOIState private constructor(val value: Int) { companion object { - val b2_circleShape: b2ShapeType = b2ShapeType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2ShapeType_b2_circleShape()) - val b2_capsuleShape: b2ShapeType = b2ShapeType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2ShapeType_b2_capsuleShape()) - val b2_segmentShape: b2ShapeType = b2ShapeType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2ShapeType_b2_segmentShape()) - val b2_polygonShape: b2ShapeType = b2ShapeType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2ShapeType_b2_polygonShape()) - val b2_chainSegmentShape: b2ShapeType = b2ShapeType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2ShapeType_b2_chainSegmentShape()) + val b2_toiStateUnknown: b2TOIState = b2TOIState(b2TOIState_b2_toiStateUnknown(Box2dWasmLoader.box2dWasm)) + val b2_toiStateFailed: b2TOIState = b2TOIState(b2TOIState_b2_toiStateFailed(Box2dWasmLoader.box2dWasm)) + val b2_toiStateOverlapped: b2TOIState = b2TOIState(b2TOIState_b2_toiStateOverlapped(Box2dWasmLoader.box2dWasm)) + val b2_toiStateHit: b2TOIState = b2TOIState(b2TOIState_b2_toiStateHit(Box2dWasmLoader.box2dWasm)) + val b2_toiStateSeparated: b2TOIState = b2TOIState(b2TOIState_b2_toiStateSeparated(Box2dWasmLoader.box2dWasm)) + fun forValue(value: Int) = when(value) { + b2_toiStateUnknown.value -> b2_toiStateUnknown + b2_toiStateFailed.value -> b2_toiStateFailed + b2_toiStateOverlapped.value -> b2_toiStateOverlapped + b2_toiStateHit.value -> b2_toiStateHit + b2_toiStateSeparated.value -> b2_toiStateSeparated + else -> error("Invalid enum value $value for enum b2TOIState") + } } } +private fun b2TOIState_b2_toiStateUnknown(module: JsAny): Int = js("module._emscripten_enum_b2TOIState_b2_toiStateUnknown()") +private fun b2TOIState_b2_toiStateFailed(module: JsAny): Int = js("module._emscripten_enum_b2TOIState_b2_toiStateFailed()") +private fun b2TOIState_b2_toiStateOverlapped(module: JsAny): Int = js("module._emscripten_enum_b2TOIState_b2_toiStateOverlapped()") +private fun b2TOIState_b2_toiStateHit(module: JsAny): Int = js("module._emscripten_enum_b2TOIState_b2_toiStateHit()") +private fun b2TOIState_b2_toiStateSeparated(module: JsAny): Int = js("module._emscripten_enum_b2TOIState_b2_toiStateSeparated()") + value class b2BodyType private constructor(val value: Int) { companion object { - val b2_staticBody: b2BodyType = b2BodyType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2BodyType_b2_staticBody()) - val b2_kinematicBody: b2BodyType = b2BodyType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2BodyType_b2_kinematicBody()) - val b2_dynamicBody: b2BodyType = b2BodyType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2BodyType_b2_dynamicBody()) + val b2_staticBody: b2BodyType = b2BodyType(b2BodyType_b2_staticBody(Box2dWasmLoader.box2dWasm)) + val b2_kinematicBody: b2BodyType = b2BodyType(b2BodyType_b2_kinematicBody(Box2dWasmLoader.box2dWasm)) + val b2_dynamicBody: b2BodyType = b2BodyType(b2BodyType_b2_dynamicBody(Box2dWasmLoader.box2dWasm)) + fun forValue(value: Int) = when(value) { + b2_staticBody.value -> b2_staticBody + b2_kinematicBody.value -> b2_kinematicBody + b2_dynamicBody.value -> b2_dynamicBody + else -> error("Invalid enum value $value for enum b2BodyType") + } } } +private fun b2BodyType_b2_staticBody(module: JsAny): Int = js("module._emscripten_enum_b2BodyType_b2_staticBody()") +private fun b2BodyType_b2_kinematicBody(module: JsAny): Int = js("module._emscripten_enum_b2BodyType_b2_kinematicBody()") +private fun b2BodyType_b2_dynamicBody(module: JsAny): Int = js("module._emscripten_enum_b2BodyType_b2_dynamicBody()") + value class b2JointType private constructor(val value: Int) { companion object { - val b2_distanceJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_distanceJoint()) - val b2_filterJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_filterJoint()) - val b2_motorJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_motorJoint()) - val b2_mouseJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_mouseJoint()) - val b2_prismaticJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_prismaticJoint()) - val b2_revoluteJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_revoluteJoint()) - val b2_weldJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_weldJoint()) - val b2_wheelJoint: b2JointType = b2JointType(Box2dWasmLoader.box2dWasm._emscripten_enum_b2JointType_b2_wheelJoint()) + val b2_distanceJoint: b2JointType = b2JointType(b2JointType_b2_distanceJoint(Box2dWasmLoader.box2dWasm)) + val b2_filterJoint: b2JointType = b2JointType(b2JointType_b2_filterJoint(Box2dWasmLoader.box2dWasm)) + val b2_motorJoint: b2JointType = b2JointType(b2JointType_b2_motorJoint(Box2dWasmLoader.box2dWasm)) + val b2_mouseJoint: b2JointType = b2JointType(b2JointType_b2_mouseJoint(Box2dWasmLoader.box2dWasm)) + val b2_prismaticJoint: b2JointType = b2JointType(b2JointType_b2_prismaticJoint(Box2dWasmLoader.box2dWasm)) + val b2_revoluteJoint: b2JointType = b2JointType(b2JointType_b2_revoluteJoint(Box2dWasmLoader.box2dWasm)) + val b2_weldJoint: b2JointType = b2JointType(b2JointType_b2_weldJoint(Box2dWasmLoader.box2dWasm)) + val b2_wheelJoint: b2JointType = b2JointType(b2JointType_b2_wheelJoint(Box2dWasmLoader.box2dWasm)) + fun forValue(value: Int) = when(value) { + b2_distanceJoint.value -> b2_distanceJoint + b2_filterJoint.value -> b2_filterJoint + b2_motorJoint.value -> b2_motorJoint + b2_mouseJoint.value -> b2_mouseJoint + b2_prismaticJoint.value -> b2_prismaticJoint + b2_revoluteJoint.value -> b2_revoluteJoint + b2_weldJoint.value -> b2_weldJoint + b2_wheelJoint.value -> b2_wheelJoint + else -> error("Invalid enum value $value for enum b2JointType") + } } } +private fun b2JointType_b2_distanceJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_distanceJoint()") +private fun b2JointType_b2_filterJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_filterJoint()") +private fun b2JointType_b2_motorJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_motorJoint()") +private fun b2JointType_b2_mouseJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_mouseJoint()") +private fun b2JointType_b2_prismaticJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_prismaticJoint()") +private fun b2JointType_b2_revoluteJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_revoluteJoint()") +private fun b2JointType_b2_weldJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_weldJoint()") +private fun b2JointType_b2_wheelJoint(module: JsAny): Int = js("module._emscripten_enum_b2JointType_b2_wheelJoint()") + diff --git a/kool-physics-2d/src/webMain/kotlin/box2d/Box2dWasmLoader.kt b/kool-physics-2d/src/webMain/kotlin/box2d/Box2dWasmLoader.kt new file mode 100644 index 000000000..6abc32d17 --- /dev/null +++ b/kool-physics-2d/src/webMain/kotlin/box2d/Box2dWasmLoader.kt @@ -0,0 +1,17 @@ +/* + * Generated from WebIDL by webidl-util + */ + +package box2d + +import kotlin.js.JsAny + +internal expect object Box2dWasmLoader { + internal val box2dWasm: JsAny + val isLoaded: Boolean + suspend fun loadModule() +} + +sealed external interface DestroyableNative : JsAny + +expect fun DestroyableNative.destroy() \ No newline at end of file diff --git a/kool-physics-2d/src/webMain/kotlin/box2d/prototypes/Prototypes.kt b/kool-physics-2d/src/webMain/kotlin/box2d/prototypes/Prototypes.kt new file mode 100644 index 000000000..8a61df948 --- /dev/null +++ b/kool-physics-2d/src/webMain/kotlin/box2d/prototypes/Prototypes.kt @@ -0,0 +1,83 @@ +@file:Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE", "unused") + +package box2d.prototypes + +import box2d.* +import kotlin.js.JsAny +import kotlin.js.js + +val B2_AABB: B2_AABB = B2_AABB(Box2dWasmLoader.box2dWasm) +private fun B2_AABB(module: JsAny): B2_AABB = js("module.B2_AABB.prototype") + +val B2_Base: B2_Base = B2_Base(Box2dWasmLoader.box2dWasm) +private fun B2_Base(module: JsAny): B2_Base = js("module.B2_Base.prototype") + +val B2_Body: B2_Body = B2_Body(Box2dWasmLoader.box2dWasm) +private fun B2_Body(module: JsAny): B2_Body = js("module.B2_Body.prototype") + +val B2_Chain: B2_Chain = B2_Chain(Box2dWasmLoader.box2dWasm) +private fun B2_Chain(module: JsAny): B2_Chain = js("module.B2_Chain.prototype") + +val B2_CharacterMover: B2_CharacterMover = B2_CharacterMover(Box2dWasmLoader.box2dWasm) +private fun B2_CharacterMover(module: JsAny): B2_CharacterMover = js("module.B2_CharacterMover.prototype") + +val B2_Collision: B2_Collision = B2_Collision(Box2dWasmLoader.box2dWasm) +private fun B2_Collision(module: JsAny): B2_Collision = js("module.B2_Collision.prototype") + +val B2_Distance: B2_Distance = B2_Distance(Box2dWasmLoader.box2dWasm) +private fun B2_Distance(module: JsAny): B2_Distance = js("module.B2_Distance.prototype") + +val B2_DistanceJoint: B2_DistanceJoint = B2_DistanceJoint(Box2dWasmLoader.box2dWasm) +private fun B2_DistanceJoint(module: JsAny): B2_DistanceJoint = js("module.B2_DistanceJoint.prototype") + +val B2_FilterJoint: B2_FilterJoint = B2_FilterJoint(Box2dWasmLoader.box2dWasm) +private fun B2_FilterJoint(module: JsAny): B2_FilterJoint = js("module.B2_FilterJoint.prototype") + +val B2_Geometry: B2_Geometry = B2_Geometry(Box2dWasmLoader.box2dWasm) +private fun B2_Geometry(module: JsAny): B2_Geometry = js("module.B2_Geometry.prototype") + +val B2_Joint: B2_Joint = B2_Joint(Box2dWasmLoader.box2dWasm) +private fun B2_Joint(module: JsAny): B2_Joint = js("module.B2_Joint.prototype") + +val B2_Mat22: B2_Mat22 = B2_Mat22(Box2dWasmLoader.box2dWasm) +private fun B2_Mat22(module: JsAny): B2_Mat22 = js("module.B2_Mat22.prototype") + +val B2_Math: B2_Math = B2_Math(Box2dWasmLoader.box2dWasm) +private fun B2_Math(module: JsAny): B2_Math = js("module.B2_Math.prototype") + +val B2_MotorJoint: B2_MotorJoint = B2_MotorJoint(Box2dWasmLoader.box2dWasm) +private fun B2_MotorJoint(module: JsAny): B2_MotorJoint = js("module.B2_MotorJoint.prototype") + +val B2_MouseJoint: B2_MouseJoint = B2_MouseJoint(Box2dWasmLoader.box2dWasm) +private fun B2_MouseJoint(module: JsAny): B2_MouseJoint = js("module.B2_MouseJoint.prototype") + +val B2_Plane: B2_Plane = B2_Plane(Box2dWasmLoader.box2dWasm) +private fun B2_Plane(module: JsAny): B2_Plane = js("module.B2_Plane.prototype") + +val B2_PrismaticJoint: B2_PrismaticJoint = B2_PrismaticJoint(Box2dWasmLoader.box2dWasm) +private fun B2_PrismaticJoint(module: JsAny): B2_PrismaticJoint = js("module.B2_PrismaticJoint.prototype") + +val B2_RevoluteJoint: B2_RevoluteJoint = B2_RevoluteJoint(Box2dWasmLoader.box2dWasm) +private fun B2_RevoluteJoint(module: JsAny): B2_RevoluteJoint = js("module.B2_RevoluteJoint.prototype") + +val B2_Rot: B2_Rot = B2_Rot(Box2dWasmLoader.box2dWasm) +private fun B2_Rot(module: JsAny): B2_Rot = js("module.B2_Rot.prototype") + +val B2_Shape: B2_Shape = B2_Shape(Box2dWasmLoader.box2dWasm) +private fun B2_Shape(module: JsAny): B2_Shape = js("module.B2_Shape.prototype") + +val B2_Transform: B2_Transform = B2_Transform(Box2dWasmLoader.box2dWasm) +private fun B2_Transform(module: JsAny): B2_Transform = js("module.B2_Transform.prototype") + +val B2_Vec2: B2_Vec2 = B2_Vec2(Box2dWasmLoader.box2dWasm) +private fun B2_Vec2(module: JsAny): B2_Vec2 = js("module.B2_Vec2.prototype") + +val B2_WeldJoint: B2_WeldJoint = B2_WeldJoint(Box2dWasmLoader.box2dWasm) +private fun B2_WeldJoint(module: JsAny): B2_WeldJoint = js("module.B2_WeldJoint.prototype") + +val B2_WheelJoint: B2_WheelJoint = B2_WheelJoint(Box2dWasmLoader.box2dWasm) +private fun B2_WheelJoint(module: JsAny): B2_WheelJoint = js("module.B2_WheelJoint.prototype") + +val B2_World: B2_World = B2_World(Box2dWasmLoader.box2dWasm) +private fun B2_World(module: JsAny): B2_World = js("module.B2_World.prototype") + diff --git a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Body.js.kt b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Body.web.kt similarity index 97% rename from kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Body.js.kt rename to kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Body.web.kt index ba12e205e..d3f1ece1f 100644 --- a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Body.js.kt +++ b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Body.web.kt @@ -1,9 +1,6 @@ package de.fabmax.kool.physics2d -import box2d.b2BodyDef -import box2d.b2BodyType -import box2d.b2Polygon -import box2d.b2ShapeDef +import box2d.* import box2d.prototypes.B2_Body import box2d.prototypes.B2_Geometry import box2d.prototypes.B2_Shape @@ -16,7 +13,7 @@ internal actual fun createBody(bodyDef: BodyDef, worldId: WorldId): BodyId = sco val b2BodyDef = allocBodyDef() B2_Body.defaultBodyDef(b2BodyDef) - b2BodyDef.type = when (bodyDef.type) { + b2BodyDef.typeEnum = when (bodyDef.type) { BodyType.Static -> b2BodyType.b2_staticBody BodyType.Kinematic -> b2BodyType.b2_kinematicBody BodyType.Dynamic -> b2BodyType.b2_dynamicBody diff --git a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Box2dExtensions.kt b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Box2dExtensions.kt similarity index 100% rename from kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Box2dExtensions.kt rename to kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Box2dExtensions.kt diff --git a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Box2dMath.js.kt b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Box2dMath.web.kt similarity index 100% rename from kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Box2dMath.js.kt rename to kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Box2dMath.web.kt diff --git a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Physics2d.js.kt b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Physics2d.web.kt similarity index 100% rename from kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Physics2d.js.kt rename to kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Physics2d.web.kt index 915711ca9..2b90d3c05 100644 --- a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Physics2d.js.kt +++ b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Physics2d.web.kt @@ -12,10 +12,10 @@ internal actual fun PhysicsSystem(): PhysicsSystem = PhysicsSystemJs internal object PhysicsSystemJs : PhysicsSystem { override var isLoaded = false; private set + override suspend fun loadPhysics2d() { Box2dWasmLoader.loadModule() isLoaded = true - val version = B2_Base.getVersion() logI("Box2D") { "Box2D loaded: ${version.major}.${version.minor}.${version.revision}" } } diff --git a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Physics2dWorld.js.kt b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Physics2dWorld.web.kt similarity index 100% rename from kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Physics2dWorld.js.kt rename to kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Physics2dWorld.web.kt diff --git a/kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Shape.js.kt b/kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Shape.web.kt similarity index 100% rename from kool-physics-2d/src/jsMain/kotlin/de/fabmax/kool/physics2d/Shape.js.kt rename to kool-physics-2d/src/webMain/kotlin/de/fabmax/kool/physics2d/Shape.web.kt diff --git a/kool-physics/build.gradle.kts b/kool-physics/build.gradle.kts index f04b63902..66bfe93f8 100644 --- a/kool-physics/build.gradle.kts +++ b/kool-physics/build.gradle.kts @@ -25,6 +25,10 @@ kotlin { // api(npm(File("$projectDir/npm/physx-js-webidl"))) } + webMain.dependencies { + api(npm(libs.physx.wasm.get().name, libs.versions.physx.wasm.get())) + } + // androidMain.dependencies { // api(libs.physx.android) // } @@ -36,7 +40,7 @@ webidl { modelName = "PhysXJs" generateKotlinJsInterfaces { - outputDirectory = file("${projectDir}/src/jsMain/kotlin/physx") + outputDirectory = file("${projectDir}/src/webMain/kotlin/physx") packagePrefix = "physx" moduleName = "physx-js-webidl" modulePromiseName = "PhysX" @@ -44,19 +48,19 @@ webidl { } tasks.register("transformDesktopToOtherPlatforms") { - dependsOn("transformDesktopToJs", "transformDesktopToAndroid") + dependsOn("transformDesktopToWeb", "transformDesktopToAndroid") group = "generate" } -tasks.register("transformDesktopToJs") { +tasks.register("transformDesktopToWeb") { group = "generate" target = "js" val srcs = collectPhysicsFilesToTransform() val dsts = srcs.map { it.path - .replace("desktopMain", "jsMain") - .replace(".desktop.kt", ".js.kt") + .replace("desktopMain", "webMain") + .replace(".desktop.kt", ".web.kt") } srcFiles = files(srcs) dstFiles = files(dsts) diff --git a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt index 982884ee2..6ff5714e0 100644 --- a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt +++ b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt @@ -7,8 +7,7 @@ import de.fabmax.kool.math.spatial.BoundingBoxF import de.fabmax.kool.scene.TrsTransformF import de.fabmax.kool.util.ScopedMemory import physxandroid.NativeObject -import physxandroid.character.PxCapsuleController -import physxandroid.character.PxExtendedVec3 +import physxandroid.character.* import physxandroid.common.* import physxandroid.cooking.PxConvexFlags import physxandroid.cooking.PxConvexMeshDesc @@ -18,6 +17,7 @@ import physxandroid.geometry.* import physxandroid.physics.* import physxandroid.support.PxArray_PxShapePtr import physxandroid.support.PxArray_PxVec3 +import physxandroid.vehicle2.* val NativeObject.ptr: Long get() = address @@ -175,3 +175,20 @@ fun ScopedMemory.createPxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax autoDelete(PxJointLimitPyramid(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax, spring), PxJointLimitPyramid::destroy) fun ScopedMemory.createPxJointLimitCone(yLimitAngle: AngleF, zLimitAngle: AngleF) = autoDelete(PxJointLimitCone(yLimitAngle.rad, zLimitAngle.rad), PxJointLimitCone::destroy) + +var PxVehicleFrame.lngAxisEnum: PxVehicleAxesEnum by PxVehicleFrame::lngAxis +var PxVehicleFrame.latAxisEnum: PxVehicleAxesEnum by PxVehicleFrame::latAxis +var PxVehicleFrame.vrtAxisEnum: PxVehicleAxesEnum by PxVehicleFrame::vrtAxis + +var PxTriggerPair.statusEnum: PxPairFlagEnum by PxTriggerPair::status + +var PxArticulationDrive.driveTypeEnum: PxArticulationDriveTypeEnum by PxArticulationDrive::driveType + +var PxCapsuleControllerDesc.climbingModeEnum: PxCapsuleClimbingModeEnum by PxCapsuleControllerDesc::climbingMode +var PxCapsuleControllerDesc.nonWalkableModeEnum: PxControllerNonWalkableModeEnum by PxCapsuleControllerDesc::nonWalkableMode + +var PxHeightFieldDesc.formatEnum: PxHeightFieldFormatEnum by PxHeightFieldDesc::format + +var PxVehiclePhysXSimulationContext.physxActorUpdateModeEnum: PxVehiclePhysXActorUpdateModeEnum by PxVehiclePhysXSimulationContext::physxActorUpdateMode +var PxVehicleSuspensionStateCalculationParams.suspensionJounceCalculationTypeEnum: PxVehicleSuspensionJounceCalculationTypeEnum by PxVehicleSuspensionStateCalculationParams::suspensionJounceCalculationType +var PxVehicleClutchParams.accuracyModeEnum: PxVehicleClutchAccuracyModeEnum by PxVehicleClutchParams::accuracyMode diff --git a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.android.kt b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.android.kt index 86376b76a..8f6d90600 100644 --- a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.android.kt +++ b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.android.kt @@ -2,10 +2,7 @@ package de.fabmax.kool.physics.articulations import de.fabmax.kool.math.PoseF import de.fabmax.kool.math.toRad -import de.fabmax.kool.physics.createPxArticulationDrive -import de.fabmax.kool.physics.createPxArticulationLimit -import de.fabmax.kool.physics.createPxTransform -import de.fabmax.kool.physics.toPxTransform +import de.fabmax.kool.physics.* import de.fabmax.kool.util.scopedMem import physxandroid.physics.* @@ -99,7 +96,7 @@ class ArticulationJointImpl(val pxJoint: PxArticulationJointReducedCoordinate) : ) { scopedMem { val drive = createPxArticulationDrive() - drive.driveType = driveType.pxVal + drive.driveTypeEnum = driveType.pxVal drive.stiffness = stiffness drive.damping = damping pxJoint.setDriveParams(axis.pxVal, drive) diff --git a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.android.kt b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.android.kt index 945f321db..3a4013601 100644 --- a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.android.kt +++ b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.android.kt @@ -36,13 +36,13 @@ class CharacterControllerManagerImpl(private val world: PhysicsWorld) : Characte val desc = PxCapsuleControllerDesc() desc.height = charProperties.height desc.radius = charProperties.radius - desc.climbingMode = PxCapsuleClimbingModeEnum.eEASY + desc.climbingModeEnum = PxCapsuleClimbingModeEnum.eEASY desc.slopeLimit = cos(charProperties.slopeLimit.rad) desc.material = Physics.defaultMaterial.pxMaterial desc.contactOffset = charProperties.contactOffset desc.reportCallback = hitCallback.callback desc.behaviorCallback = behaviorCallback.callback - desc.nonWalkableMode = when (charProperties.nonWalkableMode) { + desc.nonWalkableModeEnum = when (charProperties.nonWalkableMode) { NonWalkableMode.PREVENT_CLIMBING -> PxControllerNonWalkableModeEnum.ePREVENT_CLIMBING NonWalkableMode.PREVENT_CLIMBING_AND_FORCE_SLIDING -> PxControllerNonWalkableModeEnum.ePREVENT_CLIMBING_AND_FORCE_SLIDING } diff --git a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.android.kt b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.android.kt index 3bcc87190..c2b94bb3c 100644 --- a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.android.kt +++ b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.android.kt @@ -56,7 +56,7 @@ class HeightFieldImpl( } val desc = createPxHeightFieldDesc() - desc.format = PxHeightFieldFormatEnum.eS16_TM + desc.formatEnum = PxHeightFieldFormatEnum.eS16_TM desc.nbRows = rows desc.nbColumns = cols desc.samples.data = samples.begin() diff --git a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.android.kt b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.android.kt index e98fc8822..83adf763b 100644 --- a/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.android.kt +++ b/kool-physics/src/androidMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.android.kt @@ -89,13 +89,13 @@ class VehicleImpl( init { vehicleSimulationContext = PxVehiclePhysXSimulationContext().apply { setToDefault() - frame.lngAxis = PxVehicleAxesEnum.ePosZ - frame.latAxis = PxVehicleAxesEnum.ePosX - frame.vrtAxis = PxVehicleAxesEnum.ePosY + frame.lngAxisEnum = PxVehicleAxesEnum.ePosZ + frame.latAxisEnum = PxVehicleAxesEnum.ePosX + frame.vrtAxisEnum = PxVehicleAxesEnum.ePosY scale.scale = 1f world.gravity.toPxVec3(gravity) physxScene = (world as PhysicsWorldImpl).pxScene - physxActorUpdateMode = PxVehiclePhysXActorUpdateModeEnum.eAPPLY_VELOCITY + physxActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum.eAPPLY_VELOCITY physxUnitCylinderSweepMesh = PhysicsImpl.unitCylinder } pxVehicle = createVehicle(vehicleProps) @@ -270,9 +270,9 @@ class VehicleImpl( } baseParams.frame.apply { - latAxis = PxVehicleAxesEnum.ePosX - lngAxis = PxVehicleAxesEnum.ePosZ - vrtAxis = PxVehicleAxesEnum.ePosY + latAxisEnum = PxVehicleAxesEnum.ePosX + lngAxisEnum = PxVehicleAxesEnum.ePosZ + vrtAxisEnum = PxVehicleAxesEnum.ePosY } baseParams.scale.scale = 1f @@ -350,7 +350,7 @@ class VehicleImpl( // Set up the suspensions // Compute the mass supported by each suspension spring. - baseParams.suspensionStateCalculationParams.suspensionJounceCalculationType = + baseParams.suspensionStateCalculationParams.suspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum.eSWEEP baseParams.suspensionStateCalculationParams.limitSuspensionExpansionVelocity = false @@ -471,7 +471,7 @@ class VehicleImpl( engineDriveParams.clutchCommandResponseParams.maxResponse = vehicleProps.clutchStrength engineDriveParams.clutchParams.apply { - accuracyMode = PxVehicleClutchAccuracyModeEnum.eBEST_POSSIBLE + accuracyModeEnum = PxVehicleClutchAccuracyModeEnum.eBEST_POSSIBLE estimateIterations = 5 } diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt index bfe571140..cd192d3df 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt @@ -7,8 +7,7 @@ import de.fabmax.kool.math.spatial.BoundingBoxF import de.fabmax.kool.scene.TrsTransformF import org.lwjgl.system.MemoryStack import physx.NativeObject -import physx.character.PxCapsuleController -import physx.character.PxExtendedVec3 +import physx.character.* import physx.common.* import physx.cooking.PxConvexFlags import physx.cooking.PxConvexMeshDesc @@ -19,6 +18,7 @@ import physx.physics.* import physx.support.PxArray_PxShapePtr import physx.support.PxArray_PxU32 import physx.support.PxArray_PxVec3 +import physx.vehicle2.* val NativeObject.ptr: Long get() = address @@ -189,4 +189,21 @@ fun MemoryStack.createPxJointAngularLimitPair(lowerLimit: AngleF, upperLimit: An fun MemoryStack.createPxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax: Float, zLimitAngleMin: Float, zLimitAngleMax: Float, spring: PxSpring) = PxJointLimitPyramid.createAt(this, MemoryStack::nmalloc, yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax, spring) fun MemoryStack.createPxJointLimitCone(yLimitAngle: AngleF, zLimitAngle: AngleF) = - PxJointLimitCone.createAt(this, MemoryStack::nmalloc, yLimitAngle.rad, zLimitAngle.rad) \ No newline at end of file + PxJointLimitCone.createAt(this, MemoryStack::nmalloc, yLimitAngle.rad, zLimitAngle.rad) + +var PxVehicleFrame.lngAxisEnum: PxVehicleAxesEnum by PxVehicleFrame::lngAxis +var PxVehicleFrame.latAxisEnum: PxVehicleAxesEnum by PxVehicleFrame::latAxis +var PxVehicleFrame.vrtAxisEnum: PxVehicleAxesEnum by PxVehicleFrame::vrtAxis + +var PxTriggerPair.statusEnum: PxPairFlagEnum by PxTriggerPair::status + +var PxArticulationDrive.driveTypeEnum: PxArticulationDriveTypeEnum by PxArticulationDrive::driveType + +var PxCapsuleControllerDesc.climbingModeEnum: PxCapsuleClimbingModeEnum by PxCapsuleControllerDesc::climbingMode +var PxCapsuleControllerDesc.nonWalkableModeEnum: PxControllerNonWalkableModeEnum by PxCapsuleControllerDesc::nonWalkableMode + +var PxHeightFieldDesc.formatEnum: PxHeightFieldFormatEnum by PxHeightFieldDesc::format + +var PxVehiclePhysXSimulationContext.physxActorUpdateModeEnum: PxVehiclePhysXActorUpdateModeEnum by PxVehiclePhysXSimulationContext::physxActorUpdateMode +var PxVehicleSuspensionStateCalculationParams.suspensionJounceCalculationTypeEnum: PxVehicleSuspensionJounceCalculationTypeEnum by PxVehicleSuspensionStateCalculationParams::suspensionJounceCalculationType +var PxVehicleClutchParams.accuracyModeEnum: PxVehicleClutchAccuracyModeEnum by PxVehicleClutchParams::accuracyMode \ No newline at end of file diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/Physics.desktop.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/Physics.desktop.kt index 411b20786..14f0feb98 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/Physics.desktop.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/Physics.desktop.kt @@ -82,9 +82,9 @@ object PhysicsImpl : PhysicsSystem { // init vehicle simulation framework PxVehicleTopLevelFunctions.InitVehicleExtension(foundation) vehicleFrame = PxVehicleFrame().apply { - lngAxis = PxVehicleAxesEnum.ePosZ - latAxis = PxVehicleAxesEnum.ePosX - vrtAxis = PxVehicleAxesEnum.ePosY + lngAxisEnum = PxVehicleAxesEnum.ePosZ + latAxisEnum = PxVehicleAxesEnum.ePosX + vrtAxisEnum = PxVehicleAxesEnum.ePosY } // try to choose a sensible number of worker threads: diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.desktop.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.desktop.kt index e5997c92a..f265d27ba 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.desktop.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.desktop.kt @@ -265,7 +265,7 @@ class PhysicsWorldImpl(scene: Scene?, val isContinuousCollisionDetection: Boolea override fun onTrigger(pairs: PxTriggerPair, count: Int) { for (i in 0 until count) { val pair = PxTriggerPair.arrayGet(pairs.address, i) - val isEnter = pair.status == PxPairFlagEnum.eNOTIFY_TOUCH_FOUND + val isEnter = pair.statusEnum == PxPairFlagEnum.eNOTIFY_TOUCH_FOUND val trigger = pxActors[pair.triggerActor.ptr] val actor = pxActors[pair.otherActor.ptr] if (trigger != null && actor != null) { diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.desktop.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.desktop.kt index 18fb96aba..5a2c87fc3 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.desktop.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.desktop.kt @@ -2,10 +2,7 @@ package de.fabmax.kool.physics.articulations import de.fabmax.kool.math.PoseF import de.fabmax.kool.math.toRad -import de.fabmax.kool.physics.createPxArticulationDrive -import de.fabmax.kool.physics.createPxArticulationLimit -import de.fabmax.kool.physics.createPxTransform -import de.fabmax.kool.physics.toPxTransform +import de.fabmax.kool.physics.* import de.fabmax.kool.util.scopedMem import physx.physics.* @@ -96,7 +93,7 @@ class ArticulationJointImpl(val pxJoint: PxArticulationJointReducedCoordinate) : ) { scopedMem { val drive = createPxArticulationDrive() - drive.driveType = driveType.pxVal + drive.driveTypeEnum = driveType.pxVal drive.stiffness = stiffness drive.damping = damping pxJoint.setDriveParams(axis.pxVal, drive) diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.desktop.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.desktop.kt index 953feef0f..6f82921f3 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.desktop.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.desktop.kt @@ -33,13 +33,13 @@ class CharacterControllerManagerImpl(private val world: PhysicsWorld) : Characte val desc = PxCapsuleControllerDesc() desc.height = charProperties.height desc.radius = charProperties.radius - desc.climbingMode = PxCapsuleClimbingModeEnum.eEASY + desc.climbingModeEnum = PxCapsuleClimbingModeEnum.eEASY desc.slopeLimit = cos(charProperties.slopeLimit.rad) desc.material = Physics.defaultMaterial.pxMaterial desc.contactOffset = charProperties.contactOffset desc.reportCallback = hitCallback.callback desc.behaviorCallback = behaviorCallback.callback - desc.nonWalkableMode = when (charProperties.nonWalkableMode) { + desc.nonWalkableModeEnum = when (charProperties.nonWalkableMode) { NonWalkableMode.PREVENT_CLIMBING -> PxControllerNonWalkableModeEnum.ePREVENT_CLIMBING NonWalkableMode.PREVENT_CLIMBING_AND_FORCE_SLIDING -> PxControllerNonWalkableModeEnum.ePREVENT_CLIMBING_AND_FORCE_SLIDING } diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.desktop.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.desktop.kt index 1b4f11085..57d2a0564 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.desktop.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.desktop.kt @@ -53,7 +53,7 @@ class HeightFieldImpl( } val desc = createPxHeightFieldDesc() - desc.format = PxHeightFieldFormatEnum.eS16_TM + desc.formatEnum = PxHeightFieldFormatEnum.eS16_TM desc.nbRows = rows desc.nbColumns = cols desc.samples.data = samples.begin() diff --git a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.desktop.kt b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.desktop.kt index 602251ff2..140030872 100644 --- a/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.desktop.kt +++ b/kool-physics/src/desktopMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.desktop.kt @@ -86,13 +86,13 @@ class VehicleImpl( init { vehicleSimulationContext = PxVehiclePhysXSimulationContext().apply { setToDefault() - frame.lngAxis = PxVehicleAxesEnum.ePosZ - frame.latAxis = PxVehicleAxesEnum.ePosX - frame.vrtAxis = PxVehicleAxesEnum.ePosY + frame.lngAxisEnum = PxVehicleAxesEnum.ePosZ + frame.latAxisEnum = PxVehicleAxesEnum.ePosX + frame.vrtAxisEnum = PxVehicleAxesEnum.ePosY scale.scale = 1f world.gravity.toPxVec3(gravity) physxScene = (world as PhysicsWorldImpl).pxScene - physxActorUpdateMode = PxVehiclePhysXActorUpdateModeEnum.eAPPLY_VELOCITY + physxActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum.eAPPLY_VELOCITY physxUnitCylinderSweepMesh = PhysicsImpl.unitCylinder } pxVehicle = createVehicle(vehicleProps) @@ -267,9 +267,9 @@ class VehicleImpl( } baseParams.frame.apply { - latAxis = PxVehicleAxesEnum.ePosX - lngAxis = PxVehicleAxesEnum.ePosZ - vrtAxis = PxVehicleAxesEnum.ePosY + latAxisEnum = PxVehicleAxesEnum.ePosX + lngAxisEnum = PxVehicleAxesEnum.ePosZ + vrtAxisEnum = PxVehicleAxesEnum.ePosY } baseParams.scale.scale = 1f @@ -347,7 +347,7 @@ class VehicleImpl( // Set up the suspensions // Compute the mass supported by each suspension spring. - baseParams.suspensionStateCalculationParams.suspensionJounceCalculationType = + baseParams.suspensionStateCalculationParams.suspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum.eSWEEP baseParams.suspensionStateCalculationParams.limitSuspensionExpansionVelocity = false @@ -468,7 +468,7 @@ class VehicleImpl( engineDriveParams.clutchCommandResponseParams.maxResponse = vehicleProps.clutchStrength engineDriveParams.clutchParams.apply { - accuracyMode = PxVehicleClutchAccuracyModeEnum.eBEST_POSSIBLE + accuracyModeEnum = PxVehicleClutchAccuracyModeEnum.eBEST_POSSIBLE estimateIterations = 5 } diff --git a/kool-physics/src/jsMain/kotlin/physx/Cooking.kt b/kool-physics/src/jsMain/kotlin/physx/Cooking.kt deleted file mode 100644 index 0b76384d4..000000000 --- a/kool-physics/src/jsMain/kotlin/physx/Cooking.kt +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Generated from WebIDL by webidl-util - */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") - -package physx - -external interface PxBVH33MidphaseDesc { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: float - */ - var meshSizePerformanceTradeOff: Float - /** - * WebIDL type: [PxMeshCookingHintEnum] (enum) - */ - var meshCookingHint: PxMeshCookingHintEnum - - fun setToDefault() - - /** - * @return WebIDL type: boolean - */ - fun isValid(): Boolean - -} - -fun PxBVH33MidphaseDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBVH33MidphaseDesc = js("_module.wrapPointer(ptr, _module.PxBVH33MidphaseDesc)") - -fun PxBVH33MidphaseDesc.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxBVH34MidphaseDesc { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: unsigned long - */ - var numPrimsPerLeaf: Int - - fun setToDefault() - - /** - * @return WebIDL type: boolean - */ - fun isValid(): Boolean - -} - -fun PxBVH34MidphaseDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBVH34MidphaseDesc = js("_module.wrapPointer(ptr, _module.PxBVH34MidphaseDesc)") - -fun PxBVH34MidphaseDesc.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxConvexFlags { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param flag WebIDL type: [PxConvexFlagEnum] (enum) - * @return WebIDL type: boolean - */ - fun isSet(flag: PxConvexFlagEnum): Boolean - - /** - * @param flag WebIDL type: [PxConvexFlagEnum] (enum) - */ - fun raise(flag: PxConvexFlagEnum) - - /** - * @param flag WebIDL type: [PxConvexFlagEnum] (enum) - */ - fun clear(flag: PxConvexFlagEnum) - -} - -/** - * @param flags WebIDL type: unsigned short - */ -fun PxConvexFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxConvexFlags = js("new _module.PxConvexFlags(flags)") - -fun PxConvexFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConvexFlags = js("_module.wrapPointer(ptr, _module.PxConvexFlags)") - -fun PxConvexFlags.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxConvexMeshDesc { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: [PxBoundedData] (Value) - */ - var points: PxBoundedData - /** - * WebIDL type: [PxConvexFlags] (Value) - */ - var flags: PxConvexFlags -} - -fun PxConvexMeshDesc(_module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshDesc = js("new _module.PxConvexMeshDesc()") - -fun PxConvexMeshDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshDesc = js("_module.wrapPointer(ptr, _module.PxConvexMeshDesc)") - -fun PxConvexMeshDesc.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxCookingParams { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: float - */ - var areaTestEpsilon: Float - /** - * WebIDL type: float - */ - var planeTolerance: Float - /** - * WebIDL type: [PxConvexMeshCookingTypeEnum] (enum) - */ - var convexMeshCookingType: PxConvexMeshCookingTypeEnum - /** - * WebIDL type: boolean - */ - var suppressTriangleMeshRemapTable: Boolean - /** - * WebIDL type: boolean - */ - var buildTriangleAdjacencies: Boolean - /** - * WebIDL type: boolean - */ - var buildGPUData: Boolean - /** - * WebIDL type: [PxTolerancesScale] (Value) - */ - var scale: PxTolerancesScale - /** - * WebIDL type: [PxMeshPreprocessingFlags] (Value) - */ - var meshPreprocessParams: PxMeshPreprocessingFlags - /** - * WebIDL type: float - */ - var meshWeldTolerance: Float - /** - * WebIDL type: [PxMidphaseDesc] (Value) - */ - var midphaseDesc: PxMidphaseDesc - /** - * WebIDL type: unsigned long - */ - var gaussMapLimit: Int -} - -/** - * @param sc WebIDL type: [PxTolerancesScale] (Const, Ref) - */ -fun PxCookingParams(sc: PxTolerancesScale, _module: dynamic = PhysXJsLoader.physXJs): PxCookingParams = js("new _module.PxCookingParams(sc)") - -fun PxCookingParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCookingParams = js("_module.wrapPointer(ptr, _module.PxCookingParams)") - -fun PxCookingParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxMeshPreprocessingFlags { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param flag WebIDL type: [PxMeshPreprocessingFlagEnum] (enum) - * @return WebIDL type: boolean - */ - fun isSet(flag: PxMeshPreprocessingFlagEnum): Boolean - - /** - * @param flag WebIDL type: [PxMeshPreprocessingFlagEnum] (enum) - */ - fun raise(flag: PxMeshPreprocessingFlagEnum) - - /** - * @param flag WebIDL type: [PxMeshPreprocessingFlagEnum] (enum) - */ - fun clear(flag: PxMeshPreprocessingFlagEnum) - -} - -/** - * @param flags WebIDL type: unsigned long - */ -fun PxMeshPreprocessingFlags(flags: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMeshPreprocessingFlags = js("new _module.PxMeshPreprocessingFlags(flags)") - -fun PxMeshPreprocessingFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMeshPreprocessingFlags = js("_module.wrapPointer(ptr, _module.PxMeshPreprocessingFlags)") - -fun PxMeshPreprocessingFlags.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxMidphaseDesc { - /** - * Native object address. - */ - val ptr: Int - - /** - * WebIDL type: [PxBVH33MidphaseDesc] (Value) - */ - var mBVH33Desc: PxBVH33MidphaseDesc - /** - * WebIDL type: [PxBVH34MidphaseDesc] (Value) - */ - var mBVH34Desc: PxBVH34MidphaseDesc - - /** - * @return WebIDL type: [PxMeshMidPhaseEnum] (enum) - */ - fun getType(): PxMeshMidPhaseEnum - - /** - * @param type WebIDL type: [PxMeshMidPhaseEnum] (enum) - */ - fun setToDefault(type: PxMeshMidPhaseEnum) - - /** - * @return WebIDL type: boolean - */ - fun isValid(): Boolean - -} - -fun PxMidphaseDesc(_module: dynamic = PhysXJsLoader.physXJs): PxMidphaseDesc = js("new _module.PxMidphaseDesc()") - -fun PxMidphaseDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMidphaseDesc = js("_module.wrapPointer(ptr, _module.PxMidphaseDesc)") - -fun PxMidphaseDesc.destroy() { - PhysXJsLoader.destroy(this) -} - -val PxMidphaseDesc.type - get() = getType() - -external interface PxTriangleMeshDesc : PxSimpleTriangleMesh { - /** - * WebIDL type: [PxTypedBoundedData_PxU16Const] (Const, Value) - */ - var materialIndices: PxTypedBoundedData_PxU16Const -} - -fun PxTriangleMeshDesc(_module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshDesc = js("new _module.PxTriangleMeshDesc()") - -fun PxTriangleMeshDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshDesc = js("_module.wrapPointer(ptr, _module.PxTriangleMeshDesc)") - -fun PxTriangleMeshDesc.destroy() { - PhysXJsLoader.destroy(this) -} - -value class PxConvexFlagEnum private constructor(val value: Int) { - companion object { - val e16_BIT_INDICES: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_e16_BIT_INDICES()) - val eCOMPUTE_CONVEX: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_eCOMPUTE_CONVEX()) - val eCHECK_ZERO_AREA_TRIANGLES: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_eCHECK_ZERO_AREA_TRIANGLES()) - val eQUANTIZE_INPUT: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_eQUANTIZE_INPUT()) - val eDISABLE_MESH_VALIDATION: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_eDISABLE_MESH_VALIDATION()) - val ePLANE_SHIFTING: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_ePLANE_SHIFTING()) - val eFAST_INERTIA_COMPUTATION: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_eFAST_INERTIA_COMPUTATION()) - val eSHIFT_VERTICES: PxConvexFlagEnum = PxConvexFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexFlagEnum_eSHIFT_VERTICES()) - } -} - -value class PxConvexMeshCookingTypeEnum private constructor(val value: Int) { - companion object { - val eQUICKHULL: PxConvexMeshCookingTypeEnum = PxConvexMeshCookingTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexMeshCookingTypeEnum_eQUICKHULL()) - } -} - -value class PxMeshCookingHintEnum private constructor(val value: Int) { - companion object { - val eSIM_PERFORMANCE: PxMeshCookingHintEnum = PxMeshCookingHintEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshCookingHintEnum_eSIM_PERFORMANCE()) - val eCOOKING_PERFORMANCE: PxMeshCookingHintEnum = PxMeshCookingHintEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshCookingHintEnum_eCOOKING_PERFORMANCE()) - } -} - -value class PxMeshPreprocessingFlagEnum private constructor(val value: Int) { - companion object { - val eWELD_VERTICES: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshPreprocessingFlagEnum_eWELD_VERTICES()) - val eDISABLE_CLEAN_MESH: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshPreprocessingFlagEnum_eDISABLE_CLEAN_MESH()) - val eDISABLE_ACTIVE_EDGES_PRECOMPUTE: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshPreprocessingFlagEnum_eDISABLE_ACTIVE_EDGES_PRECOMPUTE()) - val eFORCE_32BIT_INDICES: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshPreprocessingFlagEnum_eFORCE_32BIT_INDICES()) - } -} - -value class PxMeshMidPhaseEnum private constructor(val value: Int) { - companion object { - val eBVH33: PxMeshMidPhaseEnum = PxMeshMidPhaseEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshMidPhaseEnum_eBVH33()) - val eBVH34: PxMeshMidPhaseEnum = PxMeshMidPhaseEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshMidPhaseEnum_eBVH34()) - } -} - diff --git a/kool-physics/src/jsMain/kotlin/physx/PhysXJsLoader.js.kt b/kool-physics/src/jsMain/kotlin/physx/PhysXJsLoader.js.kt new file mode 100644 index 000000000..1d4bef0a7 --- /dev/null +++ b/kool-physics/src/jsMain/kotlin/physx/PhysXJsLoader.js.kt @@ -0,0 +1,39 @@ +/* + * Generated from WebIDL by webidl-util + */ + +package physx + +import kotlinx.coroutines.await +import kotlin.js.Promise + +@JsModule("physx-js-webidl") +private external val PhysX: () -> Promise + +actual object PhysXJsLoader { + private var physXJsModule: JsAny? = null + private val physXJsPromise = PhysX() + private var _isLoaded = false + actual val isLoaded: Boolean get() = _isLoaded + + internal actual val physXJs: JsAny get() = requireNotNull(physXJsModule) { + "Module 'physx-js-webidl' is not loaded. Call loadModule() first" + } + + actual suspend fun loadModule() { + if (!isLoaded) { + physXJsPromise.then { physXJsModule = it; it } + } + physXJsPromise.await() + _isLoaded = true + } + + fun checkIsLoaded() { + if (!isLoaded) { + throw IllegalStateException("Module 'physx-js-webidl' is not loaded. Call loadModule() first.") + } + } +} + +private fun destroyNative(module: JsAny, obj: DestroyableNative): Unit = js("module.destroy(obj)") +actual fun DestroyableNative.destroy() = destroyNative(PhysXJsLoader.physXJs, this) \ No newline at end of file diff --git a/kool-physics/src/jsMain/kotlin/physx/PhysXJsLoader.kt b/kool-physics/src/jsMain/kotlin/physx/PhysXJsLoader.kt deleted file mode 100644 index 99313404f..000000000 --- a/kool-physics/src/jsMain/kotlin/physx/PhysXJsLoader.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Generated from WebIDL by webidl-util - */ - -package physx - -import kotlinx.coroutines.asDeferred -import kotlin.js.Promise - -@JsModule("physx-js-webidl") -private external val PhysX: () -> Promise - -object PhysXJsLoader { - @JsName("physXJs") - internal var physXJs: dynamic = null - private val physXJsPromise = PhysX() - internal var physXJsDeferred = physXJsPromise.asDeferred() - - val isLoaded: Boolean get() = physXJsDeferred.isCompleted - - suspend fun loadModule() { - if (!isLoaded) { - physXJsPromise.then { module: dynamic -> physXJs = module } - } - physXJsDeferred.await() - } - - fun checkIsLoaded() { - if (!isLoaded) { - throw IllegalStateException("Module 'physx-js-webidl' is not loaded. Call loadModule() first and wait for loading to be finished.") - } - } - - fun destroy(nativeObject: Any) { - physXJs.destroy(nativeObject) - } -} \ No newline at end of file diff --git a/kool-physics/src/jsMain/kotlin/physx/Support.kt b/kool-physics/src/jsMain/kotlin/physx/Support.kt deleted file mode 100644 index bf1da8e3b..000000000 --- a/kool-physics/src/jsMain/kotlin/physx/Support.kt +++ /dev/null @@ -1,1859 +0,0 @@ -/* - * Generated from WebIDL by webidl-util - */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") - -package physx - -external interface SupportFunctions { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param actor WebIDL type: [PxRigidActor] (Ref) - * @param index WebIDL type: long - * @return WebIDL type: [PxShape] - */ - fun PxActor_getShape(actor: PxRigidActor, index: Int): PxShape - - /** - * @param scene WebIDL type: [PxScene] - * @return WebIDL type: [PxArray_PxActorPtr] (Ref) - */ - fun PxScene_getActiveActors(scene: PxScene): PxArray_PxActorPtr - - /** - * @param articulation WebIDL type: [PxArticulationReducedCoordinate] - * @return WebIDL type: unsigned long - */ - fun PxArticulationReducedCoordinate_getMinSolverPositionIterations(articulation: PxArticulationReducedCoordinate): Int - - /** - * @param articulation WebIDL type: [PxArticulationReducedCoordinate] - * @return WebIDL type: unsigned long - */ - fun PxArticulationReducedCoordinate_getMinSolverVelocityIterations(articulation: PxArticulationReducedCoordinate): Int - -} - -fun SupportFunctionsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): SupportFunctions = js("_module.wrapPointer(ptr, _module.SupportFunctions)") - -fun SupportFunctions.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxU8Ptr : PxU8ConstPtr - -fun PxU8PtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxU8Ptr = js("_module.wrapPointer(ptr, _module.PxU8Ptr)") - -fun PxU8Ptr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxU8ConstPtr - -fun PxU8ConstPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxU8ConstPtr = js("_module.wrapPointer(ptr, _module.PxU8ConstPtr)") - -fun PxU8ConstPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxU16Ptr : PxU16ConstPtr - -fun PxU16PtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxU16Ptr = js("_module.wrapPointer(ptr, _module.PxU16Ptr)") - -fun PxU16Ptr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxU16ConstPtr - -fun PxU16ConstPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxU16ConstPtr = js("_module.wrapPointer(ptr, _module.PxU16ConstPtr)") - -fun PxU16ConstPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxU32Ptr : PxU32ConstPtr - -fun PxU32PtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxU32Ptr = js("_module.wrapPointer(ptr, _module.PxU32Ptr)") - -fun PxU32Ptr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxU32ConstPtr - -fun PxU32ConstPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxU32ConstPtr = js("_module.wrapPointer(ptr, _module.PxU32ConstPtr)") - -fun PxU32ConstPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxI32Ptr : PxI32ConstPtr - -fun PxI32PtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxI32Ptr = js("_module.wrapPointer(ptr, _module.PxI32Ptr)") - -fun PxI32Ptr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxI32ConstPtr - -fun PxI32ConstPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxI32ConstPtr = js("_module.wrapPointer(ptr, _module.PxI32ConstPtr)") - -fun PxI32ConstPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxRealPtr : PxRealConstPtr - -fun PxRealPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRealPtr = js("_module.wrapPointer(ptr, _module.PxRealPtr)") - -fun PxRealPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxRealConstPtr - -fun PxRealConstPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRealConstPtr = js("_module.wrapPointer(ptr, _module.PxRealConstPtr)") - -fun PxRealConstPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxActorPtr - -fun PxActorPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxActorPtr = js("_module.wrapPointer(ptr, _module.PxActorPtr)") - -fun PxActorPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxMaterialPtr - -fun PxMaterialPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMaterialPtr = js("_module.wrapPointer(ptr, _module.PxMaterialPtr)") - -fun PxMaterialPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxMaterialConstPtr - -fun PxMaterialConstPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMaterialConstPtr = js("_module.wrapPointer(ptr, _module.PxMaterialConstPtr)") - -fun PxMaterialConstPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxShapePtr - -fun PxShapePtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxShapePtr = js("_module.wrapPointer(ptr, _module.PxShapePtr)") - -fun PxShapePtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface NativeArrayHelpers { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param base WebIDL type: [PxU8ConstPtr] (Ref) - * @param index WebIDL type: long - * @return WebIDL type: octet - */ - fun getU8At(base: PxU8ConstPtr, index: Int): Byte - - /** - * @param base WebIDL type: [PxU16ConstPtr] (Ref) - * @param index WebIDL type: long - * @return WebIDL type: unsigned short - */ - fun getU16At(base: PxU16ConstPtr, index: Int): Short - - /** - * @param base WebIDL type: [PxU32ConstPtr] (Ref) - * @param index WebIDL type: long - * @return WebIDL type: unsigned long - */ - fun getU32At(base: PxU32ConstPtr, index: Int): Int - - /** - * @param base WebIDL type: [PxRealPtr] (Ref) - * @param index WebIDL type: long - * @return WebIDL type: float - */ - fun getRealAt(base: PxRealPtr, index: Int): Float - - /** - * @param base WebIDL type: VoidPtr - * @param index WebIDL type: long - * @param value WebIDL type: octet - */ - fun setU8At(base: Any, index: Int, value: Byte) - - /** - * @param base WebIDL type: VoidPtr - * @param index WebIDL type: long - * @param value WebIDL type: unsigned short - */ - fun setU16At(base: Any, index: Int, value: Short) - - /** - * @param base WebIDL type: VoidPtr - * @param index WebIDL type: long - * @param value WebIDL type: unsigned long - */ - fun setU32At(base: Any, index: Int, value: Int) - - /** - * @param base WebIDL type: VoidPtr - * @param index WebIDL type: long - * @param value WebIDL type: float - */ - fun setRealAt(base: Any, index: Int, value: Float) - - /** - * @param voidPtr WebIDL type: VoidPtr - * @return WebIDL type: [PxU8Ptr] (Value) - */ - fun voidToU8Ptr(voidPtr: Any): PxU8Ptr - - /** - * @param voidPtr WebIDL type: VoidPtr - * @return WebIDL type: [PxU16Ptr] (Value) - */ - fun voidToU16Ptr(voidPtr: Any): PxU16Ptr - - /** - * @param voidPtr WebIDL type: VoidPtr - * @return WebIDL type: [PxU32Ptr] (Value) - */ - fun voidToU32Ptr(voidPtr: Any): PxU32Ptr - - /** - * @param voidPtr WebIDL type: VoidPtr - * @return WebIDL type: [PxI32Ptr] (Value) - */ - fun voidToI32Ptr(voidPtr: Any): PxI32Ptr - - /** - * @param voidPtr WebIDL type: VoidPtr - * @return WebIDL type: [PxRealPtr] (Value) - */ - fun voidToRealPtr(voidPtr: Any): PxRealPtr - - /** - * @param base WebIDL type: [PxActor] - * @param index WebIDL type: long - * @return WebIDL type: [PxActor] - */ - fun getActorAt(base: PxActor, index: Int): PxActor - - /** - * @param base WebIDL type: [PxBounds3] - * @param index WebIDL type: long - * @return WebIDL type: [PxBounds3] - */ - fun getBounds3At(base: PxBounds3, index: Int): PxBounds3 - - /** - * @param base WebIDL type: [PxContactPair] - * @param index WebIDL type: long - * @return WebIDL type: [PxContactPair] - */ - fun getContactPairAt(base: PxContactPair, index: Int): PxContactPair - - /** - * @param base WebIDL type: [PxContactPairHeader] - * @param index WebIDL type: long - * @return WebIDL type: [PxContactPairHeader] - */ - fun getContactPairHeaderAt(base: PxContactPairHeader, index: Int): PxContactPairHeader - - /** - * @param base WebIDL type: [PxController] - * @param index WebIDL type: long - * @return WebIDL type: [PxController] - */ - fun getControllerAt(base: PxController, index: Int): PxController - - /** - * @param base WebIDL type: [PxControllerShapeHit] - * @param index WebIDL type: long - * @return WebIDL type: [PxControllerShapeHit] - */ - fun getControllerShapeHitAt(base: PxControllerShapeHit, index: Int): PxControllerShapeHit - - /** - * @param base WebIDL type: [PxControllersHit] - * @param index WebIDL type: long - * @return WebIDL type: [PxControllersHit] - */ - fun getControllersHitAt(base: PxControllersHit, index: Int): PxControllersHit - - /** - * @param base WebIDL type: [PxControllerObstacleHit] - * @param index WebIDL type: long - * @return WebIDL type: [PxControllerObstacleHit] - */ - fun getControllerObstacleHitAt(base: PxControllerObstacleHit, index: Int): PxControllerObstacleHit - - /** - * @param base WebIDL type: [PxDebugPoint] - * @param index WebIDL type: long - * @return WebIDL type: [PxDebugPoint] - */ - fun getDebugPointAt(base: PxDebugPoint, index: Int): PxDebugPoint - - /** - * @param base WebIDL type: [PxDebugLine] - * @param index WebIDL type: long - * @return WebIDL type: [PxDebugLine] - */ - fun getDebugLineAt(base: PxDebugLine, index: Int): PxDebugLine - - /** - * @param base WebIDL type: [PxDebugTriangle] - * @param index WebIDL type: long - * @return WebIDL type: [PxDebugTriangle] - */ - fun getDebugTriangleAt(base: PxDebugTriangle, index: Int): PxDebugTriangle - - /** - * @param base WebIDL type: [PxObstacle] - * @param index WebIDL type: long - * @return WebIDL type: [PxObstacle] - */ - fun getObstacleAt(base: PxObstacle, index: Int): PxObstacle - - /** - * @param base WebIDL type: [PxShape] - * @param index WebIDL type: long - * @return WebIDL type: [PxShape] - */ - fun getShapeAt(base: PxShape, index: Int): PxShape - - /** - * @param base WebIDL type: [PxTriggerPair] - * @param index WebIDL type: long - * @return WebIDL type: [PxTriggerPair] - */ - fun getTriggerPairAt(base: PxTriggerPair, index: Int): PxTriggerPair - - /** - * @param base WebIDL type: [PxVec3] - * @param index WebIDL type: long - * @return WebIDL type: [PxVec3] - */ - fun getVec3At(base: PxVec3, index: Int): PxVec3 - -} - -fun NativeArrayHelpersFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): NativeArrayHelpers = js("_module.wrapPointer(ptr, _module.NativeArrayHelpers)") - -fun NativeArrayHelpers.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxMaterialConst { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxMaterial] (Const) - */ - fun get(index: Int): PxMaterial - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxMaterialConstPtr] (Const, Ref) - */ - fun set(index: Int, value: PxMaterialConstPtr) - - /** - * @return WebIDL type: [PxMaterialConstPtr] - */ - fun begin(): PxMaterialConstPtr - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxMaterial] (Const) - */ - fun pushBack(value: PxMaterial) - - fun clear() - -} - -fun PxArray_PxMaterialConst(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxMaterialConst = js("new _module.PxArray_PxMaterialConst()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxMaterialConst(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxMaterialConst = js("new _module.PxArray_PxMaterialConst(size)") - -fun PxArray_PxMaterialConstFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxMaterialConst = js("_module.wrapPointer(ptr, _module.PxArray_PxMaterialConst)") - -fun PxArray_PxMaterialConst.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxHeightFieldSample { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxHeightFieldSample] (Ref) - */ - fun get(index: Int): PxHeightFieldSample - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxHeightFieldSample] (Const, Ref) - */ - fun set(index: Int, value: PxHeightFieldSample) - - /** - * @return WebIDL type: [PxHeightFieldSample] - */ - fun begin(): PxHeightFieldSample - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxHeightFieldSample] (Ref) - */ - fun pushBack(value: PxHeightFieldSample) - - fun clear() - -} - -fun PxArray_PxHeightFieldSample(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxHeightFieldSample = js("new _module.PxArray_PxHeightFieldSample()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxHeightFieldSample(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxHeightFieldSample = js("new _module.PxArray_PxHeightFieldSample(size)") - -fun PxArray_PxHeightFieldSampleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxHeightFieldSample = js("_module.wrapPointer(ptr, _module.PxArray_PxHeightFieldSample)") - -fun PxArray_PxHeightFieldSample.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxReal { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: float - */ - fun get(index: Int): Float - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: float - */ - fun set(index: Int, value: Float) - - /** - * @return WebIDL type: VoidPtr - */ - fun begin(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: float - */ - fun pushBack(value: Float) - - fun clear() - -} - -fun PxArray_PxReal(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxReal = js("new _module.PxArray_PxReal()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxReal(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxReal = js("new _module.PxArray_PxReal(size)") - -fun PxArray_PxRealFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxReal = js("_module.wrapPointer(ptr, _module.PxArray_PxReal)") - -fun PxArray_PxReal.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxU8 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: octet - */ - fun get(index: Int): Byte - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: octet - */ - fun set(index: Int, value: Byte) - - /** - * @return WebIDL type: VoidPtr - */ - fun begin(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: octet - */ - fun pushBack(value: Byte) - - /** - * @param buffer WebIDL type: VoidPtr - * @param size WebIDL type: unsigned long - */ - fun setFromBuffer(buffer: Any, size: Int) - - fun clear() - -} - -fun PxArray_PxU8(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU8 = js("new _module.PxArray_PxU8()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxU8(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU8 = js("new _module.PxArray_PxU8(size)") - -fun PxArray_PxU8FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU8 = js("_module.wrapPointer(ptr, _module.PxArray_PxU8)") - -fun PxArray_PxU8.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxU16 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: unsigned short - */ - fun get(index: Int): Short - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: unsigned short - */ - fun set(index: Int, value: Short) - - /** - * @return WebIDL type: VoidPtr - */ - fun begin(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: unsigned short - */ - fun pushBack(value: Short) - - fun clear() - -} - -fun PxArray_PxU16(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU16 = js("new _module.PxArray_PxU16()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxU16(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU16 = js("new _module.PxArray_PxU16(size)") - -fun PxArray_PxU16FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU16 = js("_module.wrapPointer(ptr, _module.PxArray_PxU16)") - -fun PxArray_PxU16.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxU32 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: unsigned long - */ - fun get(index: Int): Int - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: unsigned long - */ - fun set(index: Int, value: Int) - - /** - * @return WebIDL type: VoidPtr - */ - fun begin(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: unsigned long - */ - fun pushBack(value: Int) - - fun clear() - -} - -fun PxArray_PxU32(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU32 = js("new _module.PxArray_PxU32()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxU32(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU32 = js("new _module.PxArray_PxU32(size)") - -fun PxArray_PxU32FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxU32 = js("_module.wrapPointer(ptr, _module.PxArray_PxU32)") - -fun PxArray_PxU32.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxVec3 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxVec3] (Ref) - */ - fun get(index: Int): PxVec3 - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxVec3] (Const, Ref) - */ - fun set(index: Int, value: PxVec3) - - /** - * @return WebIDL type: [PxVec3] - */ - fun begin(): PxVec3 - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxVec3] (Ref) - */ - fun pushBack(value: PxVec3) - - fun clear() - -} - -fun PxArray_PxVec3(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxVec3 = js("new _module.PxArray_PxVec3()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxVec3(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxVec3 = js("new _module.PxArray_PxVec3(size)") - -fun PxArray_PxVec3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxVec3 = js("_module.wrapPointer(ptr, _module.PxArray_PxVec3)") - -fun PxArray_PxVec3.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxVec4 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxVec4] (Ref) - */ - fun get(index: Int): PxVec4 - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxVec4] (Const, Ref) - */ - fun set(index: Int, value: PxVec4) - - /** - * @return WebIDL type: [PxVec4] - */ - fun begin(): PxVec4 - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxVec4] (Ref) - */ - fun pushBack(value: PxVec4) - - fun clear() - -} - -fun PxArray_PxVec4(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxVec4 = js("new _module.PxArray_PxVec4()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxVec4(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxVec4 = js("new _module.PxArray_PxVec4(size)") - -fun PxArray_PxVec4FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxVec4 = js("_module.wrapPointer(ptr, _module.PxArray_PxVec4)") - -fun PxArray_PxVec4.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxActorPtr { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxActor] - */ - fun get(index: Int): PxActor - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxActorPtr] (Const, Ref) - */ - fun set(index: Int, value: PxActorPtr) - - /** - * @return WebIDL type: [PxActorPtr] - */ - fun begin(): PxActorPtr - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxActor] - */ - fun pushBack(value: PxActor) - - fun clear() - -} - -fun PxArray_PxActorPtr(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxActorPtr = js("new _module.PxArray_PxActorPtr()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxActorPtr(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxActorPtr = js("new _module.PxArray_PxActorPtr(size)") - -fun PxArray_PxActorPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxActorPtr = js("_module.wrapPointer(ptr, _module.PxArray_PxActorPtr)") - -fun PxArray_PxActorPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxContactPairPoint { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxContactPairPoint] (Ref) - */ - fun get(index: Int): PxContactPairPoint - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxContactPairPoint] (Const, Ref) - */ - fun set(index: Int, value: PxContactPairPoint) - - /** - * @return WebIDL type: [PxContactPairPoint] - */ - fun begin(): PxContactPairPoint - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxContactPairPoint] (Ref) - */ - fun pushBack(value: PxContactPairPoint) - - fun clear() - -} - -fun PxArray_PxContactPairPoint(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxContactPairPoint = js("new _module.PxArray_PxContactPairPoint()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxContactPairPoint(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxContactPairPoint = js("new _module.PxArray_PxContactPairPoint(size)") - -fun PxArray_PxContactPairPointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxContactPairPoint = js("_module.wrapPointer(ptr, _module.PxArray_PxContactPairPoint)") - -fun PxArray_PxContactPairPoint.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxRaycastHit { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxRaycastHit] (Ref) - */ - fun get(index: Int): PxRaycastHit - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxRaycastHit] (Const, Ref) - */ - fun set(index: Int, value: PxRaycastHit) - - /** - * @return WebIDL type: [PxRaycastHit] - */ - fun begin(): PxRaycastHit - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxRaycastHit] (Ref) - */ - fun pushBack(value: PxRaycastHit) - - fun clear() - -} - -fun PxArray_PxRaycastHit(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxRaycastHit = js("new _module.PxArray_PxRaycastHit()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxRaycastHit(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxRaycastHit = js("new _module.PxArray_PxRaycastHit(size)") - -fun PxArray_PxRaycastHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxRaycastHit = js("_module.wrapPointer(ptr, _module.PxArray_PxRaycastHit)") - -fun PxArray_PxRaycastHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxSweepHit { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxSweepHit] (Ref) - */ - fun get(index: Int): PxSweepHit - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxSweepHit] (Const, Ref) - */ - fun set(index: Int, value: PxSweepHit) - - /** - * @return WebIDL type: [PxSweepHit] - */ - fun begin(): PxSweepHit - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxSweepHit] (Ref) - */ - fun pushBack(value: PxSweepHit) - - fun clear() - -} - -fun PxArray_PxSweepHit(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxSweepHit = js("new _module.PxArray_PxSweepHit()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxSweepHit(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxSweepHit = js("new _module.PxArray_PxSweepHit(size)") - -fun PxArray_PxSweepHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxSweepHit = js("_module.wrapPointer(ptr, _module.PxArray_PxSweepHit)") - -fun PxArray_PxSweepHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxMaterialConst { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxMaterial] (Const) - */ - fun at(index: Int): PxMaterial - - /** - * @return WebIDL type: [PxMaterialConstPtr] - */ - fun data(): PxMaterialConstPtr - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxMaterial] (Const) - */ - fun push_back(value: PxMaterial) - - fun clear() - -} - -fun Vector_PxMaterialConst(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxMaterialConst = js("new _module.Vector_PxMaterialConst()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxMaterialConst(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxMaterialConst = js("new _module.Vector_PxMaterialConst(size)") - -fun Vector_PxMaterialConstFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxMaterialConst = js("_module.wrapPointer(ptr, _module.Vector_PxMaterialConst)") - -fun Vector_PxMaterialConst.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxHeightFieldSample { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxHeightFieldSample] (Ref) - */ - fun at(index: Int): PxHeightFieldSample - - /** - * @return WebIDL type: [PxHeightFieldSample] - */ - fun data(): PxHeightFieldSample - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxHeightFieldSample] (Ref) - */ - fun push_back(value: PxHeightFieldSample) - - fun clear() - -} - -fun Vector_PxHeightFieldSample(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxHeightFieldSample = js("new _module.Vector_PxHeightFieldSample()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxHeightFieldSample(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxHeightFieldSample = js("new _module.Vector_PxHeightFieldSample(size)") - -fun Vector_PxHeightFieldSampleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxHeightFieldSample = js("_module.wrapPointer(ptr, _module.Vector_PxHeightFieldSample)") - -fun Vector_PxHeightFieldSample.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArray_PxShapePtr { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxShape] - */ - fun get(index: Int): PxShape - - /** - * @param index WebIDL type: unsigned long - * @param value WebIDL type: [PxShapePtr] (Const, Ref) - */ - fun set(index: Int, value: PxShapePtr) - - /** - * @return WebIDL type: [PxShapePtr] - */ - fun begin(): PxShapePtr - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxShape] - */ - fun pushBack(value: PxShape) - - fun clear() - -} - -fun PxArray_PxShapePtr(_module: dynamic = PhysXJsLoader.physXJs): PxArray_PxShapePtr = js("new _module.PxArray_PxShapePtr()") - -/** - * @param size WebIDL type: unsigned long - */ -fun PxArray_PxShapePtr(size: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxShapePtr = js("new _module.PxArray_PxShapePtr(size)") - -fun PxArray_PxShapePtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArray_PxShapePtr = js("_module.wrapPointer(ptr, _module.PxArray_PxShapePtr)") - -fun PxArray_PxShapePtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxReal { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: float - */ - fun at(index: Int): Float - - /** - * @return WebIDL type: VoidPtr - */ - fun data(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: float - */ - fun push_back(value: Float) - - fun clear() - -} - -fun Vector_PxReal(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxReal = js("new _module.Vector_PxReal()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxReal(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxReal = js("new _module.Vector_PxReal(size)") - -fun Vector_PxRealFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxReal = js("_module.wrapPointer(ptr, _module.Vector_PxReal)") - -fun Vector_PxReal.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxU8 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: octet - */ - fun at(index: Int): Byte - - /** - * @return WebIDL type: VoidPtr - */ - fun data(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: octet - */ - fun push_back(value: Byte) - - fun clear() - -} - -fun Vector_PxU8(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxU8 = js("new _module.Vector_PxU8()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxU8(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxU8 = js("new _module.Vector_PxU8(size)") - -fun Vector_PxU8FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxU8 = js("_module.wrapPointer(ptr, _module.Vector_PxU8)") - -fun Vector_PxU8.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxU16 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: unsigned short - */ - fun at(index: Int): Short - - /** - * @return WebIDL type: VoidPtr - */ - fun data(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: unsigned short - */ - fun push_back(value: Short) - - fun clear() - -} - -fun Vector_PxU16(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxU16 = js("new _module.Vector_PxU16()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxU16(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxU16 = js("new _module.Vector_PxU16(size)") - -fun Vector_PxU16FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxU16 = js("_module.wrapPointer(ptr, _module.Vector_PxU16)") - -fun Vector_PxU16.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxU32 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: unsigned long - */ - fun at(index: Int): Int - - /** - * @return WebIDL type: VoidPtr - */ - fun data(): Any - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: unsigned long - */ - fun push_back(value: Int) - - fun clear() - -} - -fun Vector_PxU32(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxU32 = js("new _module.Vector_PxU32()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxU32(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxU32 = js("new _module.Vector_PxU32(size)") - -fun Vector_PxU32FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxU32 = js("_module.wrapPointer(ptr, _module.Vector_PxU32)") - -fun Vector_PxU32.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxVec3 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxVec3] (Ref) - */ - fun at(index: Int): PxVec3 - - /** - * @return WebIDL type: [PxVec3] - */ - fun data(): PxVec3 - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxVec3] (Ref) - */ - fun push_back(value: PxVec3) - - fun clear() - -} - -fun Vector_PxVec3(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxVec3 = js("new _module.Vector_PxVec3()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxVec3(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxVec3 = js("new _module.Vector_PxVec3(size)") - -fun Vector_PxVec3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxVec3 = js("_module.wrapPointer(ptr, _module.Vector_PxVec3)") - -fun Vector_PxVec3.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxVec4 { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxVec4] (Ref) - */ - fun at(index: Int): PxVec4 - - /** - * @return WebIDL type: [PxVec4] - */ - fun data(): PxVec4 - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxVec4] (Ref) - */ - fun push_back(value: PxVec4) - - fun clear() - -} - -fun Vector_PxVec4(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxVec4 = js("new _module.Vector_PxVec4()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxVec4(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxVec4 = js("new _module.Vector_PxVec4(size)") - -fun Vector_PxVec4FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxVec4 = js("_module.wrapPointer(ptr, _module.Vector_PxVec4)") - -fun Vector_PxVec4.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxActorPtr { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxActor] - */ - fun at(index: Int): PxActor - - /** - * @return WebIDL type: [PxActorPtr] - */ - fun data(): PxActorPtr - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxActor] - */ - fun push_back(value: PxActor) - - fun clear() - -} - -fun Vector_PxActorPtr(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxActorPtr = js("new _module.Vector_PxActorPtr()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxActorPtr(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxActorPtr = js("new _module.Vector_PxActorPtr(size)") - -fun Vector_PxActorPtrFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxActorPtr = js("_module.wrapPointer(ptr, _module.Vector_PxActorPtr)") - -fun Vector_PxActorPtr.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxContactPairPoint { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxContactPairPoint] (Ref) - */ - fun at(index: Int): PxContactPairPoint - - /** - * @return WebIDL type: [PxContactPairPoint] - */ - fun data(): PxContactPairPoint - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxContactPairPoint] (Ref) - */ - fun push_back(value: PxContactPairPoint) - - fun clear() - -} - -fun Vector_PxContactPairPoint(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxContactPairPoint = js("new _module.Vector_PxContactPairPoint()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxContactPairPoint(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxContactPairPoint = js("new _module.Vector_PxContactPairPoint(size)") - -fun Vector_PxContactPairPointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxContactPairPoint = js("_module.wrapPointer(ptr, _module.Vector_PxContactPairPoint)") - -fun Vector_PxContactPairPoint.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxRaycastHit { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxRaycastHit] (Ref) - */ - fun at(index: Int): PxRaycastHit - - /** - * @return WebIDL type: [PxRaycastHit] - */ - fun data(): PxRaycastHit - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxRaycastHit] (Ref) - */ - fun push_back(value: PxRaycastHit) - - fun clear() - -} - -fun Vector_PxRaycastHit(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxRaycastHit = js("new _module.Vector_PxRaycastHit()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxRaycastHit(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxRaycastHit = js("new _module.Vector_PxRaycastHit(size)") - -fun Vector_PxRaycastHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxRaycastHit = js("_module.wrapPointer(ptr, _module.Vector_PxRaycastHit)") - -fun Vector_PxRaycastHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Vector_PxSweepHit { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param index WebIDL type: unsigned long - * @return WebIDL type: [PxSweepHit] (Ref) - */ - fun at(index: Int): PxSweepHit - - /** - * @return WebIDL type: [PxSweepHit] - */ - fun data(): PxSweepHit - - /** - * @return WebIDL type: unsigned long - */ - fun size(): Int - - /** - * @param value WebIDL type: [PxSweepHit] (Ref) - */ - fun push_back(value: PxSweepHit) - - fun clear() - -} - -fun Vector_PxSweepHit(_module: dynamic = PhysXJsLoader.physXJs): Vector_PxSweepHit = js("new _module.Vector_PxSweepHit()") - -/** - * @param size WebIDL type: unsigned long - */ -fun Vector_PxSweepHit(size: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxSweepHit = js("new _module.Vector_PxSweepHit(size)") - -fun Vector_PxSweepHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Vector_PxSweepHit = js("_module.wrapPointer(ptr, _module.Vector_PxSweepHit)") - -fun Vector_PxSweepHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PassThroughFilterShader : PxSimulationFilterShader { - /** - * WebIDL type: unsigned long - */ - var outputPairFlags: Int - - /** - * @param attributes0 WebIDL type: unsigned long - * @param filterData0w0 WebIDL type: unsigned long - * @param filterData0w1 WebIDL type: unsigned long - * @param filterData0w2 WebIDL type: unsigned long - * @param filterData0w3 WebIDL type: unsigned long - * @param attributes1 WebIDL type: unsigned long - * @param filterData1w0 WebIDL type: unsigned long - * @param filterData1w1 WebIDL type: unsigned long - * @param filterData1w2 WebIDL type: unsigned long - * @param filterData1w3 WebIDL type: unsigned long - * @return WebIDL type: unsigned long - */ - fun filterShader(attributes0: Int, filterData0w0: Int, filterData0w1: Int, filterData0w2: Int, filterData0w3: Int, attributes1: Int, filterData1w0: Int, filterData1w1: Int, filterData1w2: Int, filterData1w3: Int): Int - -} - -fun PassThroughFilterShaderFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PassThroughFilterShader = js("_module.wrapPointer(ptr, _module.PassThroughFilterShader)") - -fun PassThroughFilterShader.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PassThroughFilterShaderImpl : PassThroughFilterShader { - /** - * param attributes0 WebIDL type: unsigned long - * param filterData0w0 WebIDL type: unsigned long - * param filterData0w1 WebIDL type: unsigned long - * param filterData0w2 WebIDL type: unsigned long - * param filterData0w3 WebIDL type: unsigned long - * param attributes1 WebIDL type: unsigned long - * param filterData1w0 WebIDL type: unsigned long - * param filterData1w1 WebIDL type: unsigned long - * param filterData1w2 WebIDL type: unsigned long - * param filterData1w3 WebIDL type: unsigned long - * return WebIDL type: unsigned long - */ - var filterShader: (attributes0: Int, filterData0w0: Int, filterData0w1: Int, filterData0w2: Int, filterData0w3: Int, attributes1: Int, filterData1w0: Int, filterData1w1: Int, filterData1w2: Int, filterData1w3: Int) -> Int - -} - -fun PassThroughFilterShaderImpl(_module: dynamic = PhysXJsLoader.physXJs): PassThroughFilterShaderImpl = js("new _module.PassThroughFilterShaderImpl()") - -external interface PxPvd { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param transport WebIDL type: [PxPvdTransport] (Ref) - * @param flags WebIDL type: [PxPvdInstrumentationFlags] (Ref) - * @return WebIDL type: boolean - */ - fun connect(transport: PxPvdTransport, flags: PxPvdInstrumentationFlags): Boolean - - fun release() - -} - -fun PxPvdFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPvd = js("_module.wrapPointer(ptr, _module.PxPvd)") - -external interface PxPvdTransport { - /** - * Native object address. - */ - val ptr: Int - - /** - * @return WebIDL type: boolean - */ - fun connect(): Boolean - - /** - * @return WebIDL type: boolean - */ - fun isConnected(): Boolean - - fun disconnect() - - fun release() - - fun flush() - -} - -fun PxPvdTransportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPvdTransport = js("_module.wrapPointer(ptr, _module.PxPvdTransport)") - -external interface SimplePvdTransport : PxPvdTransport { - /** - * @param inBytes WebIDL type: any - * @param inLength WebIDL type: unsigned long - */ - fun send(inBytes: Int, inLength: Int) - -} - -fun SimplePvdTransportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): SimplePvdTransport = js("_module.wrapPointer(ptr, _module.SimplePvdTransport)") - -fun SimplePvdTransport.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface SimplPvdTransportImpl : SimplePvdTransport { - /** - * return WebIDL type: boolean - */ - var connect: () -> Boolean - - /** - * return WebIDL type: boolean - */ - var isConnected: () -> Boolean - - var disconnect: () -> Unit - - /** - * param inBytes WebIDL type: any - * param inLength WebIDL type: unsigned long - */ - var send: (inBytes: Int, inLength: Int) -> Unit - - var flush: () -> Unit - -} - -fun SimplPvdTransportImpl(_module: dynamic = PhysXJsLoader.physXJs): SimplPvdTransportImpl = js("new _module.SimplPvdTransportImpl()") - -external interface PxPvdInstrumentationFlags { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param flag WebIDL type: [PxPvdInstrumentationFlagEnum] (enum) - * @return WebIDL type: boolean - */ - fun isSet(flag: PxPvdInstrumentationFlagEnum): Boolean - - /** - * @param flag WebIDL type: [PxPvdInstrumentationFlagEnum] (enum) - */ - fun raise(flag: PxPvdInstrumentationFlagEnum) - - /** - * @param flag WebIDL type: [PxPvdInstrumentationFlagEnum] (enum) - */ - fun clear(flag: PxPvdInstrumentationFlagEnum) - -} - -/** - * @param flags WebIDL type: octet - */ -fun PxPvdInstrumentationFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxPvdInstrumentationFlags = js("new _module.PxPvdInstrumentationFlags(flags)") - -fun PxPvdInstrumentationFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPvdInstrumentationFlags = js("_module.wrapPointer(ptr, _module.PxPvdInstrumentationFlags)") - -fun PxPvdInstrumentationFlags.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxPvdSceneClient { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) - * @param value WebIDL type: boolean - */ - fun setScenePvdFlag(flag: PxPvdSceneFlagEnum, value: Boolean) - - /** - * @param flags WebIDL type: [PxPvdSceneFlags] (Ref) - */ - fun setScenePvdFlags(flags: PxPvdSceneFlags) - - /** - * @return WebIDL type: [PxPvdSceneFlags] (Value) - */ - fun getScenePvdFlags(): PxPvdSceneFlags - - /** - * @param name WebIDL type: DOMString - * @param origin WebIDL type: [PxVec3] (Const, Ref) - * @param up WebIDL type: [PxVec3] (Const, Ref) - * @param target WebIDL type: [PxVec3] (Const, Ref) - */ - fun updateCamera(name: String, origin: PxVec3, up: PxVec3, target: PxVec3) - -} - -fun PxPvdSceneClientFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPvdSceneClient = js("_module.wrapPointer(ptr, _module.PxPvdSceneClient)") - -var PxPvdSceneClient.scenePvdFlags - get() = getScenePvdFlags() - set(value) { setScenePvdFlags(value) } - -external interface PxPvdSceneFlags { - /** - * Native object address. - */ - val ptr: Int - - /** - * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) - * @return WebIDL type: boolean - */ - fun isSet(flag: PxPvdSceneFlagEnum): Boolean - - /** - * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) - */ - fun raise(flag: PxPvdSceneFlagEnum) - - /** - * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) - */ - fun clear(flag: PxPvdSceneFlagEnum) - -} - -/** - * @param flags WebIDL type: octet - */ -fun PxPvdSceneFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxPvdSceneFlags = js("new _module.PxPvdSceneFlags(flags)") - -fun PxPvdSceneFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPvdSceneFlags = js("_module.wrapPointer(ptr, _module.PxPvdSceneFlags)") - -fun PxPvdSceneFlags.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxOmniPvd { - /** - * Native object address. - */ - val ptr: Int - - /** - * @return WebIDL type: boolean - */ - fun startSampling(): Boolean - - fun release() - -} - -fun PxOmniPvdFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxOmniPvd = js("_module.wrapPointer(ptr, _module.PxOmniPvd)") - -fun PxOmniPvd.destroy() { - PhysXJsLoader.destroy(this) -} - -value class PxVisualizationParameterEnum private constructor(val value: Int) { - companion object { - val eSCALE: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eSCALE()) - val eWORLD_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eWORLD_AXES()) - val eBODY_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eBODY_AXES()) - val eBODY_MASS_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eBODY_MASS_AXES()) - val eBODY_LIN_VELOCITY: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eBODY_LIN_VELOCITY()) - val eBODY_ANG_VELOCITY: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eBODY_ANG_VELOCITY()) - val eCONTACT_POINT: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_POINT()) - val eCONTACT_NORMAL: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_NORMAL()) - val eCONTACT_ERROR: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_ERROR()) - val eCONTACT_FORCE: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_FORCE()) - val eACTOR_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eACTOR_AXES()) - val eCOLLISION_AABBS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_AABBS()) - val eCOLLISION_SHAPES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_SHAPES()) - val eCOLLISION_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_AXES()) - val eCOLLISION_COMPOUNDS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_COMPOUNDS()) - val eCOLLISION_FNORMALS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_FNORMALS()) - val eCOLLISION_EDGES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_EDGES()) - val eCOLLISION_STATIC: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_STATIC()) - val eCOLLISION_DYNAMIC: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_DYNAMIC()) - val eJOINT_LOCAL_FRAMES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eJOINT_LOCAL_FRAMES()) - val eJOINT_LIMITS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eJOINT_LIMITS()) - val eCULL_BOX: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eCULL_BOX()) - val eMBP_REGIONS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eMBP_REGIONS()) - val eSIMULATION_MESH: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eSIMULATION_MESH()) - val eSDF: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eSDF()) - val eNUM_VALUES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eNUM_VALUES()) - val eFORCE_DWORD: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVisualizationParameterEnum_eFORCE_DWORD()) - } -} - -value class PxPvdInstrumentationFlagEnum private constructor(val value: Int) { - companion object { - val eDEBUG: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdInstrumentationFlagEnum_eDEBUG()) - val ePROFILE: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdInstrumentationFlagEnum_ePROFILE()) - val eMEMORY: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdInstrumentationFlagEnum_eMEMORY()) - val eALL: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdInstrumentationFlagEnum_eALL()) - } -} - -value class PxPvdSceneFlagEnum private constructor(val value: Int) { - companion object { - val eTRANSMIT_CONTACTS: PxPvdSceneFlagEnum = PxPvdSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdSceneFlagEnum_eTRANSMIT_CONTACTS()) - val eTRANSMIT_SCENEQUERIES: PxPvdSceneFlagEnum = PxPvdSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdSceneFlagEnum_eTRANSMIT_SCENEQUERIES()) - val eTRANSMIT_CONSTRAINTS: PxPvdSceneFlagEnum = PxPvdSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPvdSceneFlagEnum_eTRANSMIT_CONSTRAINTS()) - } -} - diff --git a/kool-physics/src/jsMain/kotlin/physx/prototypes/Prototypes.kt b/kool-physics/src/jsMain/kotlin/physx/prototypes/Prototypes.kt deleted file mode 100644 index 523d1b560..000000000 --- a/kool-physics/src/jsMain/kotlin/physx/prototypes/Prototypes.kt +++ /dev/null @@ -1,22 +0,0 @@ -@file:Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE", "unused") - -package physx.prototypes - -import physx.* - -val NativeArrayHelpers: NativeArrayHelpers get() = PhysXJsLoader.physXJs.NativeArrayHelpers.prototype as NativeArrayHelpers -val PxCollectionExt: PxCollectionExt get() = PhysXJsLoader.physXJs.PxCollectionExt.prototype as PxCollectionExt -val PxExtensionTopLevelFunctions: PxExtensionTopLevelFunctions get() = PhysXJsLoader.physXJs.PxExtensionTopLevelFunctions.prototype as PxExtensionTopLevelFunctions -val PxGeometryQuery: PxGeometryQuery get() = PhysXJsLoader.physXJs.PxGeometryQuery.prototype as PxGeometryQuery -val PxGjkQuery: PxGjkQuery get() = PhysXJsLoader.physXJs.PxGjkQuery.prototype as PxGjkQuery -val PxGjkQueryExt: PxGjkQueryExt get() = PhysXJsLoader.physXJs.PxGjkQueryExt.prototype as PxGjkQueryExt -val PxRigidActorExt: PxRigidActorExt get() = PhysXJsLoader.physXJs.PxRigidActorExt.prototype as PxRigidActorExt -val PxRigidBodyExt: PxRigidBodyExt get() = PhysXJsLoader.physXJs.PxRigidBodyExt.prototype as PxRigidBodyExt -val PxSerialization: PxSerialization get() = PhysXJsLoader.physXJs.PxSerialization.prototype as PxSerialization -val PxShapeExt: PxShapeExt get() = PhysXJsLoader.physXJs.PxShapeExt.prototype as PxShapeExt -val PxTetMaker: PxTetMaker get() = PhysXJsLoader.physXJs.PxTetMaker.prototype as PxTetMaker -val PxTetrahedronMeshExt: PxTetrahedronMeshExt get() = PhysXJsLoader.physXJs.PxTetrahedronMeshExt.prototype as PxTetrahedronMeshExt -val PxTopLevelFunctions: PxTopLevelFunctions get() = PhysXJsLoader.physXJs.PxTopLevelFunctions.prototype as PxTopLevelFunctions -val PxVehicleTireForceParamsExt: PxVehicleTireForceParamsExt get() = PhysXJsLoader.physXJs.PxVehicleTireForceParamsExt.prototype as PxVehicleTireForceParamsExt -val PxVehicleTopLevelFunctions: PxVehicleTopLevelFunctions get() = PhysXJsLoader.physXJs.PxVehicleTopLevelFunctions.prototype as PxVehicleTopLevelFunctions -val SupportFunctions: SupportFunctions get() = PhysXJsLoader.physXJs.SupportFunctions.prototype as SupportFunctions diff --git a/kool-physics/src/wasmJsMain/kotlin/physx/PhysXJsLoader.wasmJs.kt b/kool-physics/src/wasmJsMain/kotlin/physx/PhysXJsLoader.wasmJs.kt new file mode 100644 index 000000000..1d4bef0a7 --- /dev/null +++ b/kool-physics/src/wasmJsMain/kotlin/physx/PhysXJsLoader.wasmJs.kt @@ -0,0 +1,39 @@ +/* + * Generated from WebIDL by webidl-util + */ + +package physx + +import kotlinx.coroutines.await +import kotlin.js.Promise + +@JsModule("physx-js-webidl") +private external val PhysX: () -> Promise + +actual object PhysXJsLoader { + private var physXJsModule: JsAny? = null + private val physXJsPromise = PhysX() + private var _isLoaded = false + actual val isLoaded: Boolean get() = _isLoaded + + internal actual val physXJs: JsAny get() = requireNotNull(physXJsModule) { + "Module 'physx-js-webidl' is not loaded. Call loadModule() first" + } + + actual suspend fun loadModule() { + if (!isLoaded) { + physXJsPromise.then { physXJsModule = it; it } + } + physXJsPromise.await() + _isLoaded = true + } + + fun checkIsLoaded() { + if (!isLoaded) { + throw IllegalStateException("Module 'physx-js-webidl' is not loaded. Call loadModule() first.") + } + } +} + +private fun destroyNative(module: JsAny, obj: DestroyableNative): Unit = js("module.destroy(obj)") +actual fun DestroyableNative.destroy() = destroyNative(PhysXJsLoader.physXJs, this) \ No newline at end of file diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Material.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Material.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Material.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Material.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt similarity index 98% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt index 071d7f16c..6485b2955 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/PhysXExtensions.kt @@ -26,11 +26,11 @@ fun BoundingBoxF.toPxBounds3(result: PxBounds3): PxBounds3 { val v = PxVec3() result.minimum = min.toPxVec3(v) result.maximum = max.toPxVec3(v) - PhysXJsLoader.destroy(v) + v.destroy() return result } -fun PxTransform() = PxTransform(PxIDENTITYEnum.PxIdentity) +fun PxTransform() = PxTransform(PxIDENTITYEnum.PxIdentity.value) fun PxTransform.toMat4f(result: MutableMat4f): Mat4f { result.setIdentity().rotate(q.toQuatF()) result[0, 3] = p.x @@ -135,7 +135,7 @@ fun ScopedMemory.createPxVec3(x: Float, y: Float, z: Float) = autoDelete(PxVec3( fun ScopedMemory.createPxQuat() = autoDelete(PxQuat(), PxQuat::destroy) fun ScopedMemory.createPxQuat(x: Float, y: Float, z: Float, w: Float) = autoDelete(PxQuat(x, y, z, w), PxQuat::destroy) -fun ScopedMemory.createPxTransform() = autoDelete(PxTransform(PxIDENTITYEnum.PxIdentity), PxTransform::destroy) +fun ScopedMemory.createPxTransform() = autoDelete(PxTransform(PxIDENTITYEnum.PxIdentity.value), PxTransform::destroy) fun ScopedMemory.createPxTransform(p: PxVec3, q: PxQuat) = autoDelete(PxTransform(p, q), PxTransform::destroy) fun ScopedMemory.createPxTransform(p: Vec3f, q: QuatF) = autoDelete(PxTransform(p.toPxVec3(createPxVec3()), q.toPxQuat(createPxQuat())), PxTransform::destroy) diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Physics.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Physics.web.kt similarity index 95% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Physics.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Physics.web.kt index 0ca2185ff..2a1f188c4 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Physics.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Physics.web.kt @@ -70,9 +70,9 @@ object PhysicsImpl : PhysicsSystem { // init vehicle simulation framework PxVehicleTopLevelFunctions.InitVehicleExtension(foundation) vehicleFrame = PxVehicleFrame().apply { - lngAxis = PxVehicleAxesEnum.ePosZ - latAxis = PxVehicleAxesEnum.ePosX - vrtAxis = PxVehicleAxesEnum.ePosY + lngAxisEnum = PxVehicleAxesEnum.ePosZ + latAxisEnum = PxVehicleAxesEnum.ePosX + vrtAxisEnum = PxVehicleAxesEnum.ePosY } defaultCpuDispatcher = PxTopLevelFunctions.DefaultCpuDispatcherCreate(0) diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.web.kt similarity index 99% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.web.kt index 9395f20c6..7397a9c17 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/PhysicsWorld.web.kt @@ -18,6 +18,7 @@ import physx.* import physx.prototypes.NativeArrayHelpers import physx.prototypes.PxTopLevelFunctions import physx.prototypes.SupportFunctions +import kotlin.js.unsafeCast actual fun PhysicsWorld(scene: Scene?, isContinuousCollisionDetection: Boolean) : PhysicsWorld { return PhysicsWorldImpl(scene, isContinuousCollisionDetection) @@ -269,7 +270,7 @@ class PhysicsWorldImpl(scene: Scene?, val isContinuousCollisionDetection: Boolea val pairsWrapped = PxTriggerPairFromPointer(pairs) for (i in 0 until count) { val pair = NativeArrayHelpers.getTriggerPairAt(pairsWrapped, i) - val isEnter = pair.status == PxPairFlagEnum.eNOTIFY_TOUCH_FOUND + val isEnter = pair.statusEnum == PxPairFlagEnum.eNOTIFY_TOUCH_FOUND val trigger = pxActors[pair.triggerActor.ptr] val actor = pxActors[pair.otherActor.ptr] if (trigger != null && actor != null) { diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidActor.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidActor.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidActor.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidActor.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidBody.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidBody.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidBody.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidBody.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidDynamic.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidDynamic.web.kt similarity index 97% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidDynamic.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidDynamic.web.kt index 47973a3b4..e410cf4fc 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidDynamic.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidDynamic.web.kt @@ -7,10 +7,7 @@ import de.fabmax.kool.math.QuatF import de.fabmax.kool.math.Vec3f import de.fabmax.kool.util.logE import de.fabmax.kool.util.scopedMem -import physx.PxRigidBodyFlagEnum -import physx.PxRigidDynamic -import physx.PxRigidDynamicLockFlagEnum -import physx.globalPose +import physx.* // GENERATED CODE BELOW: // Transformed from desktop source diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidStatic.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidStatic.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/RigidStatic.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/RigidStatic.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Shape.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Shape.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/Shape.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/Shape.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/Articulation.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/Articulation.web.kt similarity index 98% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/Articulation.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/Articulation.web.kt index 643ad5fc9..4c7324ff6 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/Articulation.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/Articulation.web.kt @@ -11,6 +11,7 @@ import physx.PxArticulationFlagEnum import physx.PxArticulationLink import physx.PxArticulationReducedCoordinate import physx.prototypes.SupportFunctions +import physx.setArticulationFlag // GENERATED CODE BELOW: // Transformed from desktop source diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.web.kt similarity index 99% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.web.kt index f3fcf9533..0ac58f23a 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationJoint.web.kt @@ -99,7 +99,7 @@ class ArticulationJointImpl(val pxJoint: PxArticulationJointReducedCoordinate) : ) { scopedMem { val drive = createPxArticulationDrive() - drive.driveType = driveType.pxVal + drive.driveTypeEnum = driveType.pxVal drive.stiffness = stiffness drive.damping = damping pxJoint.setDriveParams(axis.pxVal, drive) diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationLink.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationLink.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationLink.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/articulations/ArticulationLink.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/CharacterController.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/CharacterController.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/CharacterController.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/CharacterController.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.web.kt similarity index 94% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.web.kt index 5bf16d23f..1f3c4bc0e 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/CharacterControllerManager.web.kt @@ -33,13 +33,13 @@ class CharacterControllerManagerImpl(private val world: PhysicsWorld) : Characte val desc = PxCapsuleControllerDesc() desc.height = charProperties.height desc.radius = charProperties.radius - desc.climbingMode = PxCapsuleClimbingModeEnum.eEASY + desc.climbingModeEnum = PxCapsuleClimbingModeEnum.eEASY desc.slopeLimit = cos(charProperties.slopeLimit.rad) desc.material = Physics.defaultMaterial.pxMaterial desc.contactOffset = charProperties.contactOffset desc.reportCallback = hitCallback.callback desc.behaviorCallback = behaviorCallback.callback - desc.nonWalkableMode = when (charProperties.nonWalkableMode) { + desc.nonWalkableModeEnum = when (charProperties.nonWalkableMode) { NonWalkableMode.PREVENT_CLIMBING -> PxControllerNonWalkableModeEnum.ePREVENT_CLIMBING NonWalkableMode.PREVENT_CLIMBING_AND_FORCE_SLIDING -> PxControllerNonWalkableModeEnum.ePREVENT_CLIMBING_AND_FORCE_SLIDING } diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/ControllerBehaviorCallback.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/ControllerBehaviorCallback.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/ControllerBehaviorCallback.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/ControllerBehaviorCallback.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/ControllerHitListener.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/ControllerHitListener.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/character/ControllerHitListener.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/character/ControllerHitListener.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/CollisionGeometry.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/CollisionGeometry.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/CollisionGeometry.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/CollisionGeometry.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/ConvexMesh.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/ConvexMesh.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/ConvexMesh.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/ConvexMesh.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.web.kt similarity index 94% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.web.kt index 53a91cdd8..7096e5a3a 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/HeightField.web.kt @@ -3,10 +3,7 @@ package de.fabmax.kool.physics.geometry import de.fabmax.kool.physics.* import de.fabmax.kool.util.Heightmap import de.fabmax.kool.util.scopedMem -import physx.PxArray_PxHeightFieldSample -import physx.PxHeightField -import physx.PxHeightFieldFormatEnum -import physx.PxHeightFieldGeometry +import physx.* import physx.prototypes.PxTopLevelFunctions import kotlin.math.max import kotlin.math.roundToInt @@ -56,7 +53,7 @@ class HeightFieldImpl( } val desc = createPxHeightFieldDesc() - desc.format = PxHeightFieldFormatEnum.eS16_TM + desc.formatEnum = PxHeightFieldFormatEnum.eS16_TM desc.nbRows = rows desc.nbColumns = cols desc.samples.data = samples.begin() diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/TriangleMesh.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/TriangleMesh.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/geometry/TriangleMesh.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/geometry/TriangleMesh.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/D6Joint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/D6Joint.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/D6Joint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/D6Joint.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/DistanceJoint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/DistanceJoint.web.kt similarity index 93% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/DistanceJoint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/DistanceJoint.web.kt index a59fbf460..493d40a8f 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/DistanceJoint.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/DistanceJoint.web.kt @@ -6,10 +6,7 @@ import de.fabmax.kool.physics.RigidActor import de.fabmax.kool.physics.createPxTransform import de.fabmax.kool.physics.toPxTransform import de.fabmax.kool.util.scopedMem -import physx.PxDistanceJoint -import physx.PxDistanceJointFlagEnum -import physx.maxDistance -import physx.minDistance +import physx.* import physx.prototypes.PxTopLevelFunctions // GENERATED CODE BELOW: diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/FixedJoint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/FixedJoint.web.kt similarity index 100% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/FixedJoint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/FixedJoint.web.kt diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/Joint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/Joint.web.kt similarity index 94% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/Joint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/Joint.web.kt index 19009bac0..be1f820bb 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/Joint.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/Joint.web.kt @@ -2,9 +2,7 @@ package de.fabmax.kool.physics.joints import de.fabmax.kool.math.PoseF import de.fabmax.kool.util.BaseReleasable -import physx.PxConstraintFlagEnum -import physx.PxJoint -import physx.constraintFlags +import physx.* // GENERATED CODE BELOW: // Transformed from desktop source diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/PrismaticJoint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/PrismaticJoint.web.kt similarity index 98% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/PrismaticJoint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/PrismaticJoint.web.kt index cbe41e18a..f5f8f72d7 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/PrismaticJoint.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/PrismaticJoint.web.kt @@ -6,6 +6,7 @@ import de.fabmax.kool.util.scopedMem import physx.PxPrismaticJoint import physx.PxPrismaticJointFlagEnum import physx.prototypes.PxTopLevelFunctions +import physx.setPrismaticJointFlag // GENERATED CODE BELOW: // Transformed from desktop source diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/RevoluteJoint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/RevoluteJoint.web.kt similarity index 95% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/RevoluteJoint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/RevoluteJoint.web.kt index ef2048fb8..ea1f6c94a 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/RevoluteJoint.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/RevoluteJoint.web.kt @@ -6,10 +6,7 @@ import de.fabmax.kool.math.Vec3f import de.fabmax.kool.physics.* import de.fabmax.kool.physics.joints.RevoluteJoint.Companion.computeFrame import de.fabmax.kool.util.scopedMem -import physx.PxRevoluteJoint -import physx.PxRevoluteJointFlagEnum -import physx.driveForceLimit -import physx.driveVelocity +import physx.* import physx.prototypes.PxTopLevelFunctions // GENERATED CODE BELOW: diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/SphericalJoint.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/SphericalJoint.web.kt similarity index 98% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/SphericalJoint.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/SphericalJoint.web.kt index ce361c4a0..55fa5066c 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/joints/SphericalJoint.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/joints/SphericalJoint.web.kt @@ -7,6 +7,7 @@ import de.fabmax.kool.util.scopedMem import physx.PxSphericalJoint import physx.PxSphericalJointFlagEnum import physx.prototypes.PxTopLevelFunctions +import physx.setSphericalJointFlag // GENERATED CODE BELOW: // Transformed from desktop source diff --git a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.js.kt b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.web.kt similarity index 97% rename from kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.js.kt rename to kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.web.kt index 70371701d..80f57a1c3 100644 --- a/kool-physics/src/jsMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.js.kt +++ b/kool-physics/src/webMain/kotlin/de/fabmax/kool/physics/vehicle/Vehicle.web.kt @@ -85,13 +85,13 @@ class VehicleImpl( init { vehicleSimulationContext = PxVehiclePhysXSimulationContext().apply { setToDefault() - frame.lngAxis = PxVehicleAxesEnum.ePosZ - frame.latAxis = PxVehicleAxesEnum.ePosX - frame.vrtAxis = PxVehicleAxesEnum.ePosY + frame.lngAxisEnum = PxVehicleAxesEnum.ePosZ + frame.latAxisEnum = PxVehicleAxesEnum.ePosX + frame.vrtAxisEnum = PxVehicleAxesEnum.ePosY scale.scale = 1f world.gravity.toPxVec3(gravity) physxScene = (world as PhysicsWorldImpl).pxScene - physxActorUpdateMode = PxVehiclePhysXActorUpdateModeEnum.eAPPLY_VELOCITY + physxActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum.eAPPLY_VELOCITY physxUnitCylinderSweepMesh = PhysicsImpl.unitCylinder } pxVehicle = createVehicle(vehicleProps) @@ -266,9 +266,9 @@ class VehicleImpl( } baseParams.frame.apply { - latAxis = PxVehicleAxesEnum.ePosX - lngAxis = PxVehicleAxesEnum.ePosZ - vrtAxis = PxVehicleAxesEnum.ePosY + latAxisEnum = PxVehicleAxesEnum.ePosX + lngAxisEnum = PxVehicleAxesEnum.ePosZ + vrtAxisEnum = PxVehicleAxesEnum.ePosY } baseParams.scale.scale = 1f @@ -346,7 +346,7 @@ class VehicleImpl( // Set up the suspensions // Compute the mass supported by each suspension spring. - baseParams.suspensionStateCalculationParams.suspensionJounceCalculationType = + baseParams.suspensionStateCalculationParams.suspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum.eSWEEP baseParams.suspensionStateCalculationParams.limitSuspensionExpansionVelocity = false @@ -467,7 +467,7 @@ class VehicleImpl( engineDriveParams.clutchCommandResponseParams.maxResponse = vehicleProps.clutchStrength engineDriveParams.clutchParams.apply { - accuracyMode = PxVehicleClutchAccuracyModeEnum.eBEST_POSSIBLE + accuracyModeEnum = PxVehicleClutchAccuracyModeEnum.eBEST_POSSIBLE estimateIterations = 5 } diff --git a/kool-physics/src/jsMain/kotlin/physx/Character.kt b/kool-physics/src/webMain/kotlin/physx/Character.kt similarity index 56% rename from kool-physics/src/jsMain/kotlin/physx/Character.kt rename to kool-physics/src/webMain/kotlin/physx/Character.kt index c5f4bd85b..12302468a 100644 --- a/kool-physics/src/jsMain/kotlin/physx/Character.kt +++ b/kool-physics/src/webMain/kotlin/physx/Character.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxBoxController : PxController { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxBoxController : JsAny, PxController { /** * @return WebIDL type: float */ @@ -41,7 +44,7 @@ external interface PxBoxController : PxController { } -fun PxBoxControllerFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBoxController = js("_module.wrapPointer(ptr, _module.PxBoxController)") +fun PxBoxControllerFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBoxController = js("_module.wrapPointer(ptr, _module.PxBoxController)") var PxBoxController.halfHeight get() = getHalfHeight() @@ -53,7 +56,7 @@ var PxBoxController.halfForwardExtent get() = getHalfForwardExtent() set(value) { setHalfForwardExtent(value) } -external interface PxBoxControllerDesc : PxControllerDesc { +external interface PxBoxControllerDesc : JsAny, DestroyableNative, PxControllerDesc { /** * WebIDL type: float */ @@ -71,30 +74,22 @@ external interface PxBoxControllerDesc : PxControllerDesc { } -fun PxBoxControllerDesc(_module: dynamic = PhysXJsLoader.physXJs): PxBoxControllerDesc = js("new _module.PxBoxControllerDesc()") - -fun PxBoxControllerDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBoxControllerDesc = js("_module.wrapPointer(ptr, _module.PxBoxControllerDesc)") +fun PxBoxControllerDesc(_module: JsAny = PhysXJsLoader.physXJs): PxBoxControllerDesc = js("new _module.PxBoxControllerDesc()") -fun PxBoxControllerDesc.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBoxControllerDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBoxControllerDesc = js("_module.wrapPointer(ptr, _module.PxBoxControllerDesc)") -external interface PxBoxObstacle : PxObstacle { +external interface PxBoxObstacle : JsAny, DestroyableNative, PxObstacle { /** * WebIDL type: [PxVec3] (Value) */ var mHalfExtents: PxVec3 } -fun PxBoxObstacle(_module: dynamic = PhysXJsLoader.physXJs): PxBoxObstacle = js("new _module.PxBoxObstacle()") +fun PxBoxObstacle(_module: JsAny = PhysXJsLoader.physXJs): PxBoxObstacle = js("new _module.PxBoxObstacle()") -fun PxBoxObstacleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBoxObstacle = js("_module.wrapPointer(ptr, _module.PxBoxObstacle)") +fun PxBoxObstacleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBoxObstacle = js("_module.wrapPointer(ptr, _module.PxBoxObstacle)") -fun PxBoxObstacle.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxCapsuleController : PxController { +external interface PxCapsuleController : JsAny, PxController { /** * @return WebIDL type: float */ @@ -120,17 +115,17 @@ external interface PxCapsuleController : PxController { /** * @return WebIDL type: [PxCapsuleClimbingModeEnum] (enum) */ - fun getClimbingMode(): PxCapsuleClimbingModeEnum + fun getClimbingMode(): Int /** * @param mode WebIDL type: [PxCapsuleClimbingModeEnum] (enum) * @return WebIDL type: boolean */ - fun setClimbingMode(mode: PxCapsuleClimbingModeEnum): Boolean + fun setClimbingMode(mode: Int): Boolean } -fun PxCapsuleControllerFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCapsuleController = js("_module.wrapPointer(ptr, _module.PxCapsuleController)") +fun PxCapsuleControllerFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCapsuleController = js("_module.wrapPointer(ptr, _module.PxCapsuleController)") var PxCapsuleController.radius get() = getRadius() @@ -138,11 +133,13 @@ var PxCapsuleController.radius var PxCapsuleController.height get() = getHeight() set(value) { setHeight(value) } -var PxCapsuleController.climbingMode - get() = getClimbingMode() - set(value) { setClimbingMode(value) } +var PxCapsuleController.climbingMode: PxCapsuleClimbingModeEnum + get() = PxCapsuleClimbingModeEnum.forValue(getClimbingMode()) + set(value) { setClimbingMode(value.value) } + +fun PxCapsuleController.setClimbingMode(mode: PxCapsuleClimbingModeEnum) = setClimbingMode(mode.value) -external interface PxCapsuleControllerDesc : PxControllerDesc { +external interface PxCapsuleControllerDesc : JsAny, DestroyableNative, PxControllerDesc { /** * WebIDL type: float */ @@ -154,21 +151,21 @@ external interface PxCapsuleControllerDesc : PxControllerDesc { /** * WebIDL type: [PxCapsuleClimbingModeEnum] (enum) */ - var climbingMode: PxCapsuleClimbingModeEnum + var climbingMode: Int fun setToDefault() } -fun PxCapsuleControllerDesc(_module: dynamic = PhysXJsLoader.physXJs): PxCapsuleControllerDesc = js("new _module.PxCapsuleControllerDesc()") +fun PxCapsuleControllerDesc(_module: JsAny = PhysXJsLoader.physXJs): PxCapsuleControllerDesc = js("new _module.PxCapsuleControllerDesc()") -fun PxCapsuleControllerDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCapsuleControllerDesc = js("_module.wrapPointer(ptr, _module.PxCapsuleControllerDesc)") +fun PxCapsuleControllerDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCapsuleControllerDesc = js("_module.wrapPointer(ptr, _module.PxCapsuleControllerDesc)") -fun PxCapsuleControllerDesc.destroy() { - PhysXJsLoader.destroy(this) -} +var PxCapsuleControllerDesc.climbingModeEnum: PxCapsuleClimbingModeEnum + get() = PxCapsuleClimbingModeEnum.forValue(climbingMode) + set(value) { climbingMode = value.value } -external interface PxCapsuleObstacle : PxObstacle { +external interface PxCapsuleObstacle : JsAny, DestroyableNative, PxObstacle { /** * WebIDL type: float */ @@ -179,15 +176,11 @@ external interface PxCapsuleObstacle : PxObstacle { var mRadius: Float } -fun PxCapsuleObstacle(_module: dynamic = PhysXJsLoader.physXJs): PxCapsuleObstacle = js("new _module.PxCapsuleObstacle()") - -fun PxCapsuleObstacleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCapsuleObstacle = js("_module.wrapPointer(ptr, _module.PxCapsuleObstacle)") +fun PxCapsuleObstacle(_module: JsAny = PhysXJsLoader.physXJs): PxCapsuleObstacle = js("new _module.PxCapsuleObstacle()") -fun PxCapsuleObstacle.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxCapsuleObstacleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCapsuleObstacle = js("_module.wrapPointer(ptr, _module.PxCapsuleObstacle)") -external interface PxController { +external interface PxController : JsAny { /** * Native object address. */ @@ -196,7 +189,7 @@ external interface PxController { /** * @return WebIDL type: [PxControllerShapeTypeEnum] (enum) */ - fun getType(): PxControllerShapeTypeEnum + fun getType(): Int fun release() @@ -259,12 +252,12 @@ external interface PxController { /** * @param flag WebIDL type: [PxControllerNonWalkableModeEnum] (enum) */ - fun setNonWalkableMode(flag: PxControllerNonWalkableModeEnum) + fun setNonWalkableMode(flag: Int) /** * @return WebIDL type: [PxControllerNonWalkableModeEnum] (enum) */ - fun getNonWalkableMode(): PxControllerNonWalkableModeEnum + fun getNonWalkableMode(): Int /** * @return WebIDL type: float @@ -306,12 +299,12 @@ external interface PxController { /** * @return WebIDL type: VoidPtr */ - fun getUserData(): Any + fun getUserData(): JsAny /** * @param userData WebIDL type: VoidPtr */ - fun setUserData(userData: Any) + fun setUserData(userData: JsAny) /** * @param state WebIDL type: [PxControllerState] (Ref) @@ -330,10 +323,10 @@ external interface PxController { } -fun PxControllerFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxController = js("_module.wrapPointer(ptr, _module.PxController)") +fun PxControllerFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxController = js("_module.wrapPointer(ptr, _module.PxController)") -val PxController.type - get() = getType() +val PxController.type: PxControllerShapeTypeEnum + get() = PxControllerShapeTypeEnum.forValue(getType()) val PxController.actor get() = getActor() val PxController.scene @@ -348,9 +341,9 @@ var PxController.footPosition var PxController.stepOffset get() = getStepOffset() set(value) { setStepOffset(value) } -var PxController.nonWalkableMode - get() = getNonWalkableMode() - set(value) { setNonWalkableMode(value) } +var PxController.nonWalkableMode: PxControllerNonWalkableModeEnum + get() = PxControllerNonWalkableModeEnum.forValue(getNonWalkableMode()) + set(value) { setNonWalkableMode(value.value) } var PxController.contactOffset get() = getContactOffset() set(value) { setContactOffset(value) } @@ -364,11 +357,13 @@ var PxController.userData get() = getUserData() set(value) { setUserData(value) } -external interface PxControllerBehaviorCallback +fun PxController.setNonWalkableMode(flag: PxControllerNonWalkableModeEnum) = setNonWalkableMode(flag.value) -fun PxControllerBehaviorCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerBehaviorCallback = js("_module.wrapPointer(ptr, _module.PxControllerBehaviorCallback)") +external interface PxControllerBehaviorCallback : JsAny -external interface SimpleControllerBehaviorCallback : PxControllerBehaviorCallback { +fun PxControllerBehaviorCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerBehaviorCallback = js("_module.wrapPointer(ptr, _module.PxControllerBehaviorCallback)") + +external interface SimpleControllerBehaviorCallback : JsAny, DestroyableNative, PxControllerBehaviorCallback { /** * @param shape WebIDL type: [PxShape] (Const, Ref) * @param actor WebIDL type: [PxActor] (Const, Ref) @@ -390,11 +385,7 @@ external interface SimpleControllerBehaviorCallback : PxControllerBehaviorCallba } -fun SimpleControllerBehaviorCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): SimpleControllerBehaviorCallback = js("_module.wrapPointer(ptr, _module.SimpleControllerBehaviorCallback)") - -fun SimpleControllerBehaviorCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun SimpleControllerBehaviorCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): SimpleControllerBehaviorCallback = js("_module.wrapPointer(ptr, _module.SimpleControllerBehaviorCallback)") external interface PxControllerBehaviorCallbackImpl : SimpleControllerBehaviorCallback { /** @@ -418,9 +409,9 @@ external interface PxControllerBehaviorCallbackImpl : SimpleControllerBehaviorCa } -fun PxControllerBehaviorCallbackImpl(_module: dynamic = PhysXJsLoader.physXJs): PxControllerBehaviorCallbackImpl = js("new _module.PxControllerBehaviorCallbackImpl()") +fun PxControllerBehaviorCallbackImpl(_module: JsAny = PhysXJsLoader.physXJs): PxControllerBehaviorCallbackImpl = js("new _module.PxControllerBehaviorCallbackImpl()") -external interface PxControllerBehaviorFlags { +external interface PxControllerBehaviorFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -430,32 +421,32 @@ external interface PxControllerBehaviorFlags { * @param flag WebIDL type: [PxControllerBehaviorFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxControllerBehaviorFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxControllerBehaviorFlagEnum] (enum) */ - fun raise(flag: PxControllerBehaviorFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxControllerBehaviorFlagEnum] (enum) */ - fun clear(flag: PxControllerBehaviorFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxControllerBehaviorFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxControllerBehaviorFlags = js("new _module.PxControllerBehaviorFlags(flags)") +fun PxControllerBehaviorFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxControllerBehaviorFlags = js("new _module.PxControllerBehaviorFlags(flags)") -fun PxControllerBehaviorFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerBehaviorFlags = js("_module.wrapPointer(ptr, _module.PxControllerBehaviorFlags)") +fun PxControllerBehaviorFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerBehaviorFlags = js("_module.wrapPointer(ptr, _module.PxControllerBehaviorFlags)") -fun PxControllerBehaviorFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllerBehaviorFlags.isSet(flag: PxControllerBehaviorFlagEnum) = isSet(flag.value) +fun PxControllerBehaviorFlags.raise(flag: PxControllerBehaviorFlagEnum) = raise(flag.value) +fun PxControllerBehaviorFlags.clear(flag: PxControllerBehaviorFlagEnum) = clear(flag.value) -external interface PxControllerCollisionFlags { +external interface PxControllerCollisionFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -465,32 +456,32 @@ external interface PxControllerCollisionFlags { * @param flag WebIDL type: [PxControllerCollisionFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxControllerCollisionFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxControllerCollisionFlagEnum] (enum) */ - fun raise(flag: PxControllerCollisionFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxControllerCollisionFlagEnum] (enum) */ - fun clear(flag: PxControllerCollisionFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxControllerCollisionFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxControllerCollisionFlags = js("new _module.PxControllerCollisionFlags(flags)") +fun PxControllerCollisionFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxControllerCollisionFlags = js("new _module.PxControllerCollisionFlags(flags)") -fun PxControllerCollisionFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerCollisionFlags = js("_module.wrapPointer(ptr, _module.PxControllerCollisionFlags)") +fun PxControllerCollisionFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerCollisionFlags = js("_module.wrapPointer(ptr, _module.PxControllerCollisionFlags)") -fun PxControllerCollisionFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllerCollisionFlags.isSet(flag: PxControllerCollisionFlagEnum) = isSet(flag.value) +fun PxControllerCollisionFlags.raise(flag: PxControllerCollisionFlagEnum) = raise(flag.value) +fun PxControllerCollisionFlags.clear(flag: PxControllerCollisionFlagEnum) = clear(flag.value) -external interface PxControllerDesc { +external interface PxControllerDesc : JsAny { /** * Native object address. */ @@ -547,7 +538,7 @@ external interface PxControllerDesc { /** * WebIDL type: [PxControllerNonWalkableModeEnum] (enum) */ - var nonWalkableMode: PxControllerNonWalkableModeEnum + var nonWalkableMode: Int /** * WebIDL type: [PxMaterial] */ @@ -559,7 +550,7 @@ external interface PxControllerDesc { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @return WebIDL type: boolean @@ -569,16 +560,20 @@ external interface PxControllerDesc { /** * @return WebIDL type: [PxControllerShapeTypeEnum] (enum) */ - fun getType(): PxControllerShapeTypeEnum + fun getType(): Int } -fun PxControllerDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerDesc = js("_module.wrapPointer(ptr, _module.PxControllerDesc)") +fun PxControllerDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerDesc = js("_module.wrapPointer(ptr, _module.PxControllerDesc)") -val PxControllerDesc.type - get() = getType() +val PxControllerDesc.type: PxControllerShapeTypeEnum + get() = PxControllerShapeTypeEnum.forValue(getType()) -external interface PxControllerFilters { +var PxControllerDesc.nonWalkableModeEnum: PxControllerNonWalkableModeEnum + get() = PxControllerNonWalkableModeEnum.forValue(nonWalkableMode) + set(value) { nonWalkableMode = value.value } + +external interface PxControllerFilters : JsAny, DestroyableNative { /** * Native object address. */ @@ -602,20 +597,16 @@ external interface PxControllerFilters { var mCCTFilterCallback: PxControllerFilterCallback } -fun PxControllerFilters(_module: dynamic = PhysXJsLoader.physXJs): PxControllerFilters = js("new _module.PxControllerFilters()") +fun PxControllerFilters(_module: JsAny = PhysXJsLoader.physXJs): PxControllerFilters = js("new _module.PxControllerFilters()") /** * @param filterData WebIDL type: [PxFilterData] (Const) */ -fun PxControllerFilters(filterData: PxFilterData, _module: dynamic = PhysXJsLoader.physXJs): PxControllerFilters = js("new _module.PxControllerFilters(filterData)") - -fun PxControllerFiltersFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerFilters = js("_module.wrapPointer(ptr, _module.PxControllerFilters)") +fun PxControllerFilters(filterData: PxFilterData, _module: JsAny = PhysXJsLoader.physXJs): PxControllerFilters = js("new _module.PxControllerFilters(filterData)") -fun PxControllerFilters.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllerFiltersFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerFilters = js("_module.wrapPointer(ptr, _module.PxControllerFilters)") -external interface PxControllerFilterCallback { +external interface PxControllerFilterCallback : JsAny, DestroyableNative { /** * Native object address. */ @@ -630,11 +621,7 @@ external interface PxControllerFilterCallback { } -fun PxControllerFilterCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerFilterCallback = js("_module.wrapPointer(ptr, _module.PxControllerFilterCallback)") - -fun PxControllerFilterCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllerFilterCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerFilterCallback = js("_module.wrapPointer(ptr, _module.PxControllerFilterCallback)") external interface PxControllerFilterCallbackImpl : PxControllerFilterCallback { /** @@ -646,9 +633,9 @@ external interface PxControllerFilterCallbackImpl : PxControllerFilterCallback { } -fun PxControllerFilterCallbackImpl(_module: dynamic = PhysXJsLoader.physXJs): PxControllerFilterCallbackImpl = js("new _module.PxControllerFilterCallbackImpl()") +fun PxControllerFilterCallbackImpl(_module: JsAny = PhysXJsLoader.physXJs): PxControllerFilterCallbackImpl = js("new _module.PxControllerFilterCallbackImpl()") -external interface PxControllerHit { +external interface PxControllerHit : JsAny, DestroyableNative { /** * Native object address. */ @@ -676,13 +663,9 @@ external interface PxControllerHit { var length: Float } -fun PxControllerHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerHit = js("_module.wrapPointer(ptr, _module.PxControllerHit)") - -fun PxControllerHit.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllerHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerHit = js("_module.wrapPointer(ptr, _module.PxControllerHit)") -external interface PxControllerManager { +external interface PxControllerManager : JsAny { /** * Native object address. */ @@ -763,7 +746,7 @@ external interface PxControllerManager { } -fun PxControllerManagerFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerManager = js("_module.wrapPointer(ptr, _module.PxControllerManager)") +fun PxControllerManagerFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerManager = js("_module.wrapPointer(ptr, _module.PxControllerManager)") val PxControllerManager.scene get() = getScene() @@ -772,20 +755,16 @@ val PxControllerManager.nbControllers val PxControllerManager.nbObstacleContexts get() = getNbObstacleContexts() -external interface PxControllerObstacleHit : PxControllerHit { +external interface PxControllerObstacleHit : JsAny, DestroyableNative, PxControllerHit { /** * WebIDL type: VoidPtr (Const) */ - var userData: Any + var userData: JsAny } -fun PxControllerObstacleHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerObstacleHit = js("_module.wrapPointer(ptr, _module.PxControllerObstacleHit)") +fun PxControllerObstacleHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerObstacleHit = js("_module.wrapPointer(ptr, _module.PxControllerObstacleHit)") -fun PxControllerObstacleHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxControllerShapeHit : PxControllerHit { +external interface PxControllerShapeHit : JsAny, DestroyableNative, PxControllerHit { /** * WebIDL type: [PxShape] */ @@ -800,26 +779,18 @@ external interface PxControllerShapeHit : PxControllerHit { var triangleIndex: Int } -fun PxControllerShapeHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerShapeHit = js("_module.wrapPointer(ptr, _module.PxControllerShapeHit)") - -fun PxControllerShapeHit.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllerShapeHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerShapeHit = js("_module.wrapPointer(ptr, _module.PxControllerShapeHit)") -external interface PxControllersHit : PxControllerHit { +external interface PxControllersHit : JsAny, DestroyableNative, PxControllerHit { /** * WebIDL type: [PxController] */ var other: PxController } -fun PxControllersHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllersHit = js("_module.wrapPointer(ptr, _module.PxControllersHit)") - -fun PxControllersHit.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxControllersHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllersHit = js("_module.wrapPointer(ptr, _module.PxControllersHit)") -external interface PxControllerState { +external interface PxControllerState : JsAny, DestroyableNative { /** * Native object address. */ @@ -859,15 +830,11 @@ external interface PxControllerState { var isMovingUp: Boolean } -fun PxControllerState(_module: dynamic = PhysXJsLoader.physXJs): PxControllerState = js("new _module.PxControllerState()") +fun PxControllerState(_module: JsAny = PhysXJsLoader.physXJs): PxControllerState = js("new _module.PxControllerState()") -fun PxControllerStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerState = js("_module.wrapPointer(ptr, _module.PxControllerState)") +fun PxControllerStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerState = js("_module.wrapPointer(ptr, _module.PxControllerState)") -fun PxControllerState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxControllerStats { +external interface PxControllerStats : JsAny, DestroyableNative { /** * Native object address. */ @@ -891,13 +858,9 @@ external interface PxControllerStats { var nbTessellation: Short } -fun PxControllerStatsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxControllerStats = js("_module.wrapPointer(ptr, _module.PxControllerStats)") +fun PxControllerStatsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxControllerStats = js("_module.wrapPointer(ptr, _module.PxControllerStats)") -fun PxControllerStats.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxExtendedVec3 { +external interface PxExtendedVec3 : JsAny, DestroyableNative { /** * Native object address. */ @@ -917,22 +880,18 @@ external interface PxExtendedVec3 { var z: Double } -fun PxExtendedVec3(_module: dynamic = PhysXJsLoader.physXJs): PxExtendedVec3 = js("new _module.PxExtendedVec3()") +fun PxExtendedVec3(_module: JsAny = PhysXJsLoader.physXJs): PxExtendedVec3 = js("new _module.PxExtendedVec3()") /** * @param x WebIDL type: double * @param y WebIDL type: double * @param z WebIDL type: double */ -fun PxExtendedVec3(x: Double, y: Double, z: Double, _module: dynamic = PhysXJsLoader.physXJs): PxExtendedVec3 = js("new _module.PxExtendedVec3(x, y, z)") +fun PxExtendedVec3(x: Double, y: Double, z: Double, _module: JsAny = PhysXJsLoader.physXJs): PxExtendedVec3 = js("new _module.PxExtendedVec3(x, y, z)") -fun PxExtendedVec3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxExtendedVec3 = js("_module.wrapPointer(ptr, _module.PxExtendedVec3)") +fun PxExtendedVec3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxExtendedVec3 = js("_module.wrapPointer(ptr, _module.PxExtendedVec3)") -fun PxExtendedVec3.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxObstacle { +external interface PxObstacle : JsAny, DestroyableNative { /** * Native object address. */ @@ -941,7 +900,7 @@ external interface PxObstacle { /** * WebIDL type: VoidPtr */ - var mUserData: Any + var mUserData: JsAny /** * WebIDL type: [PxExtendedVec3] (Value) */ @@ -954,20 +913,16 @@ external interface PxObstacle { /** * @return WebIDL type: [PxGeometryTypeEnum] (enum) */ - fun getType(): PxGeometryTypeEnum + fun getType(): Int } -fun PxObstacleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxObstacle = js("_module.wrapPointer(ptr, _module.PxObstacle)") - -fun PxObstacle.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxObstacleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxObstacle = js("_module.wrapPointer(ptr, _module.PxObstacle)") -val PxObstacle.type - get() = getType() +val PxObstacle.type: PxGeometryTypeEnum + get() = PxGeometryTypeEnum.forValue(getType()) -external interface PxObstacleContext { +external interface PxObstacleContext : JsAny, DestroyableNative { /** * Native object address. */ @@ -1018,18 +973,14 @@ external interface PxObstacleContext { } -fun PxObstacleContextFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxObstacleContext = js("_module.wrapPointer(ptr, _module.PxObstacleContext)") - -fun PxObstacleContext.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxObstacleContextFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxObstacleContext = js("_module.wrapPointer(ptr, _module.PxObstacleContext)") val PxObstacleContext.controllerManager get() = getControllerManager() val PxObstacleContext.nbObstacles get() = getNbObstacles() -external interface PxUserControllerHitReport { +external interface PxUserControllerHitReport : JsAny { /** * Native object address. */ @@ -1052,7 +1003,7 @@ external interface PxUserControllerHitReport { } -fun PxUserControllerHitReportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxUserControllerHitReport = js("_module.wrapPointer(ptr, _module.PxUserControllerHitReport)") +fun PxUserControllerHitReportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxUserControllerHitReport = js("_module.wrapPointer(ptr, _module.PxUserControllerHitReport)") external interface PxUserControllerHitReportImpl : PxUserControllerHitReport { /** @@ -1072,42 +1023,86 @@ external interface PxUserControllerHitReportImpl : PxUserControllerHitReport { } -fun PxUserControllerHitReportImpl(_module: dynamic = PhysXJsLoader.physXJs): PxUserControllerHitReportImpl = js("new _module.PxUserControllerHitReportImpl()") +fun PxUserControllerHitReportImpl(_module: JsAny = PhysXJsLoader.physXJs): PxUserControllerHitReportImpl = js("new _module.PxUserControllerHitReportImpl()") value class PxCapsuleClimbingModeEnum private constructor(val value: Int) { companion object { - val eEASY: PxCapsuleClimbingModeEnum = PxCapsuleClimbingModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxCapsuleClimbingModeEnum_eEASY()) - val eCONSTRAINED: PxCapsuleClimbingModeEnum = PxCapsuleClimbingModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxCapsuleClimbingModeEnum_eCONSTRAINED()) + val eEASY: PxCapsuleClimbingModeEnum = PxCapsuleClimbingModeEnum(PxCapsuleClimbingModeEnum_eEASY(PhysXJsLoader.physXJs)) + val eCONSTRAINED: PxCapsuleClimbingModeEnum = PxCapsuleClimbingModeEnum(PxCapsuleClimbingModeEnum_eCONSTRAINED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eEASY.value -> eEASY + eCONSTRAINED.value -> eCONSTRAINED + else -> error("Invalid enum value $value for enum PxCapsuleClimbingModeEnum") + } } } +private fun PxCapsuleClimbingModeEnum_eEASY(module: JsAny): Int = js("module._emscripten_enum_PxCapsuleClimbingModeEnum_eEASY()") +private fun PxCapsuleClimbingModeEnum_eCONSTRAINED(module: JsAny): Int = js("module._emscripten_enum_PxCapsuleClimbingModeEnum_eCONSTRAINED()") + value class PxControllerBehaviorFlagEnum private constructor(val value: Int) { companion object { - val eCCT_CAN_RIDE_ON_OBJECT: PxControllerBehaviorFlagEnum = PxControllerBehaviorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerBehaviorFlagEnum_eCCT_CAN_RIDE_ON_OBJECT()) - val eCCT_SLIDE: PxControllerBehaviorFlagEnum = PxControllerBehaviorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerBehaviorFlagEnum_eCCT_SLIDE()) - val eCCT_USER_DEFINED_RIDE: PxControllerBehaviorFlagEnum = PxControllerBehaviorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerBehaviorFlagEnum_eCCT_USER_DEFINED_RIDE()) + val eCCT_CAN_RIDE_ON_OBJECT: PxControllerBehaviorFlagEnum = PxControllerBehaviorFlagEnum(PxControllerBehaviorFlagEnum_eCCT_CAN_RIDE_ON_OBJECT(PhysXJsLoader.physXJs)) + val eCCT_SLIDE: PxControllerBehaviorFlagEnum = PxControllerBehaviorFlagEnum(PxControllerBehaviorFlagEnum_eCCT_SLIDE(PhysXJsLoader.physXJs)) + val eCCT_USER_DEFINED_RIDE: PxControllerBehaviorFlagEnum = PxControllerBehaviorFlagEnum(PxControllerBehaviorFlagEnum_eCCT_USER_DEFINED_RIDE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eCCT_CAN_RIDE_ON_OBJECT.value -> eCCT_CAN_RIDE_ON_OBJECT + eCCT_SLIDE.value -> eCCT_SLIDE + eCCT_USER_DEFINED_RIDE.value -> eCCT_USER_DEFINED_RIDE + else -> error("Invalid enum value $value for enum PxControllerBehaviorFlagEnum") + } } } +private fun PxControllerBehaviorFlagEnum_eCCT_CAN_RIDE_ON_OBJECT(module: JsAny): Int = js("module._emscripten_enum_PxControllerBehaviorFlagEnum_eCCT_CAN_RIDE_ON_OBJECT()") +private fun PxControllerBehaviorFlagEnum_eCCT_SLIDE(module: JsAny): Int = js("module._emscripten_enum_PxControllerBehaviorFlagEnum_eCCT_SLIDE()") +private fun PxControllerBehaviorFlagEnum_eCCT_USER_DEFINED_RIDE(module: JsAny): Int = js("module._emscripten_enum_PxControllerBehaviorFlagEnum_eCCT_USER_DEFINED_RIDE()") + value class PxControllerCollisionFlagEnum private constructor(val value: Int) { companion object { - val eCOLLISION_SIDES: PxControllerCollisionFlagEnum = PxControllerCollisionFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerCollisionFlagEnum_eCOLLISION_SIDES()) - val eCOLLISION_UP: PxControllerCollisionFlagEnum = PxControllerCollisionFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerCollisionFlagEnum_eCOLLISION_UP()) - val eCOLLISION_DOWN: PxControllerCollisionFlagEnum = PxControllerCollisionFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerCollisionFlagEnum_eCOLLISION_DOWN()) + val eCOLLISION_SIDES: PxControllerCollisionFlagEnum = PxControllerCollisionFlagEnum(PxControllerCollisionFlagEnum_eCOLLISION_SIDES(PhysXJsLoader.physXJs)) + val eCOLLISION_UP: PxControllerCollisionFlagEnum = PxControllerCollisionFlagEnum(PxControllerCollisionFlagEnum_eCOLLISION_UP(PhysXJsLoader.physXJs)) + val eCOLLISION_DOWN: PxControllerCollisionFlagEnum = PxControllerCollisionFlagEnum(PxControllerCollisionFlagEnum_eCOLLISION_DOWN(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eCOLLISION_SIDES.value -> eCOLLISION_SIDES + eCOLLISION_UP.value -> eCOLLISION_UP + eCOLLISION_DOWN.value -> eCOLLISION_DOWN + else -> error("Invalid enum value $value for enum PxControllerCollisionFlagEnum") + } } } +private fun PxControllerCollisionFlagEnum_eCOLLISION_SIDES(module: JsAny): Int = js("module._emscripten_enum_PxControllerCollisionFlagEnum_eCOLLISION_SIDES()") +private fun PxControllerCollisionFlagEnum_eCOLLISION_UP(module: JsAny): Int = js("module._emscripten_enum_PxControllerCollisionFlagEnum_eCOLLISION_UP()") +private fun PxControllerCollisionFlagEnum_eCOLLISION_DOWN(module: JsAny): Int = js("module._emscripten_enum_PxControllerCollisionFlagEnum_eCOLLISION_DOWN()") + value class PxControllerNonWalkableModeEnum private constructor(val value: Int) { companion object { - val ePREVENT_CLIMBING: PxControllerNonWalkableModeEnum = PxControllerNonWalkableModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING()) - val ePREVENT_CLIMBING_AND_FORCE_SLIDING: PxControllerNonWalkableModeEnum = PxControllerNonWalkableModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING_AND_FORCE_SLIDING()) + val ePREVENT_CLIMBING: PxControllerNonWalkableModeEnum = PxControllerNonWalkableModeEnum(PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING(PhysXJsLoader.physXJs)) + val ePREVENT_CLIMBING_AND_FORCE_SLIDING: PxControllerNonWalkableModeEnum = PxControllerNonWalkableModeEnum(PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING_AND_FORCE_SLIDING(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePREVENT_CLIMBING.value -> ePREVENT_CLIMBING + ePREVENT_CLIMBING_AND_FORCE_SLIDING.value -> ePREVENT_CLIMBING_AND_FORCE_SLIDING + else -> error("Invalid enum value $value for enum PxControllerNonWalkableModeEnum") + } } } +private fun PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING(module: JsAny): Int = js("module._emscripten_enum_PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING()") +private fun PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING_AND_FORCE_SLIDING(module: JsAny): Int = js("module._emscripten_enum_PxControllerNonWalkableModeEnum_ePREVENT_CLIMBING_AND_FORCE_SLIDING()") + value class PxControllerShapeTypeEnum private constructor(val value: Int) { companion object { - val eBOX: PxControllerShapeTypeEnum = PxControllerShapeTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerShapeTypeEnum_eBOX()) - val eCAPSULE: PxControllerShapeTypeEnum = PxControllerShapeTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxControllerShapeTypeEnum_eCAPSULE()) + val eBOX: PxControllerShapeTypeEnum = PxControllerShapeTypeEnum(PxControllerShapeTypeEnum_eBOX(PhysXJsLoader.physXJs)) + val eCAPSULE: PxControllerShapeTypeEnum = PxControllerShapeTypeEnum(PxControllerShapeTypeEnum_eCAPSULE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eBOX.value -> eBOX + eCAPSULE.value -> eCAPSULE + else -> error("Invalid enum value $value for enum PxControllerShapeTypeEnum") + } } } +private fun PxControllerShapeTypeEnum_eBOX(module: JsAny): Int = js("module._emscripten_enum_PxControllerShapeTypeEnum_eBOX()") +private fun PxControllerShapeTypeEnum_eCAPSULE(module: JsAny): Int = js("module._emscripten_enum_PxControllerShapeTypeEnum_eCAPSULE()") + diff --git a/kool-physics/src/jsMain/kotlin/physx/Common.kt b/kool-physics/src/webMain/kotlin/physx/Common.kt similarity index 55% rename from kool-physics/src/jsMain/kotlin/physx/Common.kt rename to kool-physics/src/webMain/kotlin/physx/Common.kt index c800d3e20..fa456b482 100644 --- a/kool-physics/src/jsMain/kotlin/physx/Common.kt +++ b/kool-physics/src/webMain/kotlin/physx/Common.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxDebugPoint { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxDebugPoint : JsAny { /** * Native object address. */ @@ -21,9 +24,9 @@ external interface PxDebugPoint { var color: Int } -fun PxDebugPointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDebugPoint = js("_module.wrapPointer(ptr, _module.PxDebugPoint)") +fun PxDebugPointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDebugPoint = js("_module.wrapPointer(ptr, _module.PxDebugPoint)") -external interface PxDebugLine { +external interface PxDebugLine : JsAny { /** * Native object address. */ @@ -47,9 +50,9 @@ external interface PxDebugLine { var color1: Int } -fun PxDebugLineFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDebugLine = js("_module.wrapPointer(ptr, _module.PxDebugLine)") +fun PxDebugLineFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDebugLine = js("_module.wrapPointer(ptr, _module.PxDebugLine)") -external interface PxDebugTriangle { +external interface PxDebugTriangle : JsAny { /** * Native object address. */ @@ -81,9 +84,9 @@ external interface PxDebugTriangle { var color2: Int } -fun PxDebugTriangleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDebugTriangle = js("_module.wrapPointer(ptr, _module.PxDebugTriangle)") +fun PxDebugTriangleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDebugTriangle = js("_module.wrapPointer(ptr, _module.PxDebugTriangle)") -external interface PxRenderBuffer { +external interface PxRenderBuffer : JsAny { /** * Native object address. */ @@ -165,7 +168,7 @@ external interface PxRenderBuffer { } -fun PxRenderBufferFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRenderBuffer = js("_module.wrapPointer(ptr, _module.PxRenderBuffer)") +fun PxRenderBufferFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRenderBuffer = js("_module.wrapPointer(ptr, _module.PxRenderBuffer)") val PxRenderBuffer.nbPoints get() = getNbPoints() @@ -180,7 +183,7 @@ val PxRenderBuffer.nbTriangles val PxRenderBuffer.triangles get() = getTriangles() -external interface PxBase { +external interface PxBase : JsAny { /** * Native object address. */ @@ -202,7 +205,7 @@ external interface PxBase { * @param flag WebIDL type: [PxBaseFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setBaseFlag(flag: PxBaseFlagEnum, value: Boolean) + fun setBaseFlag(flag: Int, value: Boolean) /** * @param inFlags WebIDL type: [PxBaseFlags] (Ref) @@ -221,7 +224,7 @@ external interface PxBase { } -fun PxBaseFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBase = js("_module.wrapPointer(ptr, _module.PxBase)") +fun PxBaseFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBase = js("_module.wrapPointer(ptr, _module.PxBase)") val PxBase.concreteTypeName get() = getConcreteTypeName() @@ -232,7 +235,9 @@ var PxBase.baseFlags get() = getBaseFlags() set(value) { setBaseFlags(value) } -external interface PxBaseFlags { +fun PxBase.setBaseFlag(flag: PxBaseFlagEnum, value: Boolean) = setBaseFlag(flag.value, value) + +external interface PxBaseFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -242,55 +247,47 @@ external interface PxBaseFlags { * @param flag WebIDL type: [PxBaseFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxBaseFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxBaseFlagEnum] (enum) */ - fun raise(flag: PxBaseFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxBaseFlagEnum] (enum) */ - fun clear(flag: PxBaseFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxBaseFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxBaseFlags = js("new _module.PxBaseFlags(flags)") - -fun PxBaseFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBaseFlags = js("_module.wrapPointer(ptr, _module.PxBaseFlags)") +fun PxBaseFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxBaseFlags = js("new _module.PxBaseFlags(flags)") -fun PxBaseFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBaseFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBaseFlags = js("_module.wrapPointer(ptr, _module.PxBaseFlags)") -external interface PxBaseTask +fun PxBaseFlags.isSet(flag: PxBaseFlagEnum) = isSet(flag.value) +fun PxBaseFlags.raise(flag: PxBaseFlagEnum) = raise(flag.value) +fun PxBaseFlags.clear(flag: PxBaseFlagEnum) = clear(flag.value) -fun PxBaseTaskFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBaseTask = js("_module.wrapPointer(ptr, _module.PxBaseTask)") +external interface PxBaseTask : JsAny, DestroyableNative -fun PxBaseTask.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBaseTaskFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBaseTask = js("_module.wrapPointer(ptr, _module.PxBaseTask)") -external interface PxBoundedData : PxStridedData { +external interface PxBoundedData : JsAny, DestroyableNative, PxStridedData { /** * WebIDL type: unsigned long */ var count: Int } -fun PxBoundedData(_module: dynamic = PhysXJsLoader.physXJs): PxBoundedData = js("new _module.PxBoundedData()") - -fun PxBoundedDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBoundedData = js("_module.wrapPointer(ptr, _module.PxBoundedData)") +fun PxBoundedData(_module: JsAny = PhysXJsLoader.physXJs): PxBoundedData = js("new _module.PxBoundedData()") -fun PxBoundedData.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBoundedDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBoundedData = js("_module.wrapPointer(ptr, _module.PxBoundedData)") -external interface PxBounds3 { +external interface PxBounds3 : JsAny, DestroyableNative { /** * Native object address. */ @@ -391,19 +388,15 @@ external interface PxBounds3 { } -fun PxBounds3(_module: dynamic = PhysXJsLoader.physXJs): PxBounds3 = js("new _module.PxBounds3()") +fun PxBounds3(_module: JsAny = PhysXJsLoader.physXJs): PxBounds3 = js("new _module.PxBounds3()") /** * @param minimum WebIDL type: [PxVec3] (Const, Ref) * @param maximum WebIDL type: [PxVec3] (Const, Ref) */ -fun PxBounds3(minimum: PxVec3, maximum: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): PxBounds3 = js("new _module.PxBounds3(minimum, maximum)") - -fun PxBounds3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBounds3 = js("_module.wrapPointer(ptr, _module.PxBounds3)") +fun PxBounds3(minimum: PxVec3, maximum: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): PxBounds3 = js("new _module.PxBounds3(minimum, maximum)") -fun PxBounds3.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBounds3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBounds3 = js("_module.wrapPointer(ptr, _module.PxBounds3)") val PxBounds3.center get() = getCenter() @@ -412,7 +405,7 @@ val PxBounds3.dimensions val PxBounds3.extents get() = getExtents() -external interface PxCollection { +external interface PxCollection : JsAny { /** * Native object address. */ @@ -483,50 +476,34 @@ external interface PxCollection { } -fun PxCollectionFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCollection = js("_module.wrapPointer(ptr, _module.PxCollection)") +fun PxCollectionFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCollection = js("_module.wrapPointer(ptr, _module.PxCollection)") val PxCollection.nbObjects get() = getNbObjects() val PxCollection.nbIds get() = getNbIds() -external interface PxCpuDispatcher +external interface PxCpuDispatcher : JsAny, DestroyableNative -fun PxCpuDispatcherFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCpuDispatcher = js("_module.wrapPointer(ptr, _module.PxCpuDispatcher)") +fun PxCpuDispatcherFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCpuDispatcher = js("_module.wrapPointer(ptr, _module.PxCpuDispatcher)") -fun PxCpuDispatcher.destroy() { - PhysXJsLoader.destroy(this) -} +external interface PxDefaultAllocator : JsAny, DestroyableNative -external interface PxDefaultAllocator +fun PxDefaultAllocator(_module: JsAny = PhysXJsLoader.physXJs): PxDefaultAllocator = js("new _module.PxDefaultAllocator()") -fun PxDefaultAllocator(_module: dynamic = PhysXJsLoader.physXJs): PxDefaultAllocator = js("new _module.PxDefaultAllocator()") +fun PxDefaultAllocatorFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDefaultAllocator = js("_module.wrapPointer(ptr, _module.PxDefaultAllocator)") -fun PxDefaultAllocatorFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDefaultAllocator = js("_module.wrapPointer(ptr, _module.PxDefaultAllocator)") +external interface PxDefaultCpuDispatcher : JsAny, DestroyableNative, PxCpuDispatcher -fun PxDefaultAllocator.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxDefaultCpuDispatcherFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDefaultCpuDispatcher = js("_module.wrapPointer(ptr, _module.PxDefaultCpuDispatcher)") -external interface PxDefaultCpuDispatcher : PxCpuDispatcher +external interface PxDefaultErrorCallback : JsAny, DestroyableNative, PxErrorCallback -fun PxDefaultCpuDispatcherFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDefaultCpuDispatcher = js("_module.wrapPointer(ptr, _module.PxDefaultCpuDispatcher)") +fun PxDefaultErrorCallback(_module: JsAny = PhysXJsLoader.physXJs): PxDefaultErrorCallback = js("new _module.PxDefaultErrorCallback()") -fun PxDefaultCpuDispatcher.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxDefaultErrorCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDefaultErrorCallback = js("_module.wrapPointer(ptr, _module.PxDefaultErrorCallback)") -external interface PxDefaultErrorCallback : PxErrorCallback - -fun PxDefaultErrorCallback(_module: dynamic = PhysXJsLoader.physXJs): PxDefaultErrorCallback = js("new _module.PxDefaultErrorCallback()") - -fun PxDefaultErrorCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDefaultErrorCallback = js("_module.wrapPointer(ptr, _module.PxDefaultErrorCallback)") - -fun PxDefaultErrorCallback.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxErrorCallback { +external interface PxErrorCallback : JsAny, DestroyableNative { /** * Native object address. */ @@ -538,15 +515,13 @@ external interface PxErrorCallback { * @param file WebIDL type: DOMString (Const) * @param line WebIDL type: long */ - fun reportError(code: PxErrorCodeEnum, message: String, file: String, line: Int) + fun reportError(code: Int, message: String, file: String, line: Int) } -fun PxErrorCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxErrorCallback = js("_module.wrapPointer(ptr, _module.PxErrorCallback)") +fun PxErrorCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxErrorCallback = js("_module.wrapPointer(ptr, _module.PxErrorCallback)") -fun PxErrorCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxErrorCallback.reportError(code: PxErrorCodeEnum, message: String, file: String, line: Int) = reportError(code.value, message, file, line) external interface PxErrorCallbackImpl : PxErrorCallback { /** @@ -559,9 +534,9 @@ external interface PxErrorCallbackImpl : PxErrorCallback { } -fun PxErrorCallbackImpl(_module: dynamic = PhysXJsLoader.physXJs): PxErrorCallbackImpl = js("new _module.PxErrorCallbackImpl()") +fun PxErrorCallbackImpl(_module: JsAny = PhysXJsLoader.physXJs): PxErrorCallbackImpl = js("new _module.PxErrorCallbackImpl()") -external interface PxFoundation { +external interface PxFoundation : JsAny { /** * Native object address. */ @@ -571,21 +546,17 @@ external interface PxFoundation { } -fun PxFoundationFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxFoundation = js("_module.wrapPointer(ptr, _module.PxFoundation)") +fun PxFoundationFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxFoundation = js("_module.wrapPointer(ptr, _module.PxFoundation)") -external interface PxInputData +external interface PxInputData : JsAny, DestroyableNative -fun PxInputDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxInputData = js("_module.wrapPointer(ptr, _module.PxInputData)") +fun PxInputDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxInputData = js("_module.wrapPointer(ptr, _module.PxInputData)") -fun PxInputData.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxInsertionCallback +external interface PxInsertionCallback : JsAny -fun PxInsertionCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxInsertionCallback = js("_module.wrapPointer(ptr, _module.PxInsertionCallback)") +fun PxInsertionCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxInsertionCallback = js("_module.wrapPointer(ptr, _module.PxInsertionCallback)") -external interface PxMat33 { +external interface PxMat33 : JsAny, DestroyableNative { /** * Native object address. */ @@ -633,25 +604,21 @@ external interface PxMat33 { } -fun PxMat33(_module: dynamic = PhysXJsLoader.physXJs): PxMat33 = js("new _module.PxMat33()") +fun PxMat33(_module: JsAny = PhysXJsLoader.physXJs): PxMat33 = js("new _module.PxMat33()") /** * @param r WebIDL type: [PxIDENTITYEnum] (enum) */ -fun PxMat33(r: PxIDENTITYEnum, _module: dynamic = PhysXJsLoader.physXJs): PxMat33 = js("new _module.PxMat33(r)") +fun PxMat33(r: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMat33 = js("new _module.PxMat33(r)") /** * @param col0 WebIDL type: [PxVec3] (Const, Ref) * @param col1 WebIDL type: [PxVec3] (Const, Ref) * @param col2 WebIDL type: [PxVec3] (Const, Ref) */ -fun PxMat33(col0: PxVec3, col1: PxVec3, col2: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): PxMat33 = js("new _module.PxMat33(col0, col1, col2)") +fun PxMat33(col0: PxVec3, col1: PxVec3, col2: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): PxMat33 = js("new _module.PxMat33(col0, col1, col2)") -fun PxMat33FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMat33 = js("_module.wrapPointer(ptr, _module.PxMat33)") - -fun PxMat33.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxMat33FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMat33 = js("_module.wrapPointer(ptr, _module.PxMat33)") val PxMat33.transpose get() = getTranspose() @@ -660,15 +627,11 @@ val PxMat33.inverse val PxMat33.determinant get() = getDeterminant() -external interface PxOutputStream - -fun PxOutputStreamFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxOutputStream = js("_module.wrapPointer(ptr, _module.PxOutputStream)") +external interface PxOutputStream : JsAny, DestroyableNative -fun PxOutputStream.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxOutputStreamFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxOutputStream = js("_module.wrapPointer(ptr, _module.PxOutputStream)") -external interface PxPlane { +external interface PxPlane : JsAny, DestroyableNative { /** * Native object address. */ @@ -722,7 +685,7 @@ external interface PxPlane { } -fun PxPlane(_module: dynamic = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane()") +fun PxPlane(_module: JsAny = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane()") /** * @param nx WebIDL type: float @@ -730,28 +693,24 @@ fun PxPlane(_module: dynamic = PhysXJsLoader.physXJs): PxPlane = js("new _module * @param nz WebIDL type: float * @param distance WebIDL type: float */ -fun PxPlane(nx: Float, ny: Float, nz: Float, distance: Float, _module: dynamic = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane(nx, ny, nz, distance)") +fun PxPlane(nx: Float, ny: Float, nz: Float, distance: Float, _module: JsAny = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane(nx, ny, nz, distance)") /** * @param normal WebIDL type: [PxVec3] (Const, Ref) * @param distance WebIDL type: float */ -fun PxPlane(normal: PxVec3, distance: Float, _module: dynamic = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane(normal, distance)") +fun PxPlane(normal: PxVec3, distance: Float, _module: JsAny = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane(normal, distance)") /** * @param p0 WebIDL type: [PxVec3] (Const, Ref) * @param p1 WebIDL type: [PxVec3] (Const, Ref) * @param p2 WebIDL type: [PxVec3] (Const, Ref) */ -fun PxPlane(p0: PxVec3, p1: PxVec3, p2: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane(p0, p1, p2)") - -fun PxPlaneFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPlane = js("_module.wrapPointer(ptr, _module.PxPlane)") +fun PxPlane(p0: PxVec3, p1: PxVec3, p2: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): PxPlane = js("new _module.PxPlane(p0, p1, p2)") -fun PxPlane.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxPlaneFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPlane = js("_module.wrapPointer(ptr, _module.PxPlane)") -external interface PxQuat { +external interface PxQuat : JsAny, DestroyableNative { /** * Native object address. */ @@ -870,12 +829,12 @@ external interface PxQuat { } -fun PxQuat(_module: dynamic = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat()") +fun PxQuat(_module: JsAny = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat()") /** * @param r WebIDL type: [PxIDENTITYEnum] (enum) */ -fun PxQuat(r: PxIDENTITYEnum, _module: dynamic = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat(r)") +fun PxQuat(r: Int, _module: JsAny = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat(r)") /** * @param nx WebIDL type: float @@ -883,19 +842,15 @@ fun PxQuat(r: PxIDENTITYEnum, _module: dynamic = PhysXJsLoader.physXJs): PxQuat * @param nz WebIDL type: float * @param nw WebIDL type: float */ -fun PxQuat(nx: Float, ny: Float, nz: Float, nw: Float, _module: dynamic = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat(nx, ny, nz, nw)") +fun PxQuat(nx: Float, ny: Float, nz: Float, nw: Float, _module: JsAny = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat(nx, ny, nz, nw)") /** * @param angleRadians WebIDL type: float * @param unitAxis WebIDL type: [PxVec3] (Const, Ref) */ -fun PxQuat(angleRadians: Float, unitAxis: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat(angleRadians, unitAxis)") +fun PxQuat(angleRadians: Float, unitAxis: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): PxQuat = js("new _module.PxQuat(angleRadians, unitAxis)") -fun PxQuatFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxQuat = js("_module.wrapPointer(ptr, _module.PxQuat)") - -fun PxQuat.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxQuatFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxQuat = js("_module.wrapPointer(ptr, _module.PxQuat)") val PxQuat.angle get() = getAngle() @@ -912,7 +867,7 @@ val PxQuat.basisVector1 val PxQuat.basisVector2 get() = getBasisVector2() -external interface PxRefCounted : PxBase { +external interface PxRefCounted : JsAny, PxBase { /** * @return WebIDL type: unsigned long */ @@ -922,12 +877,12 @@ external interface PxRefCounted : PxBase { } -fun PxRefCountedFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRefCounted = js("_module.wrapPointer(ptr, _module.PxRefCounted)") +fun PxRefCountedFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRefCounted = js("_module.wrapPointer(ptr, _module.PxRefCounted)") val PxRefCounted.referenceCount get() = getReferenceCount() -external interface PxStridedData { +external interface PxStridedData : JsAny, DestroyableNative { /** * Native object address. */ @@ -940,16 +895,12 @@ external interface PxStridedData { /** * WebIDL type: VoidPtr (Const) */ - var data: Any + var data: JsAny } -fun PxStridedDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxStridedData = js("_module.wrapPointer(ptr, _module.PxStridedData)") - -fun PxStridedData.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxStridedDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxStridedData = js("_module.wrapPointer(ptr, _module.PxStridedData)") -external interface PxTolerancesScale { +external interface PxTolerancesScale : JsAny, DestroyableNative { /** * Native object address. */ @@ -971,15 +922,11 @@ external interface PxTolerancesScale { } -fun PxTolerancesScale(_module: dynamic = PhysXJsLoader.physXJs): PxTolerancesScale = js("new _module.PxTolerancesScale()") - -fun PxTolerancesScaleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTolerancesScale = js("_module.wrapPointer(ptr, _module.PxTolerancesScale)") +fun PxTolerancesScale(_module: JsAny = PhysXJsLoader.physXJs): PxTolerancesScale = js("new _module.PxTolerancesScale()") -fun PxTolerancesScale.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTolerancesScaleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTolerancesScale = js("_module.wrapPointer(ptr, _module.PxTolerancesScale)") -external interface PxTransform { +external interface PxTransform : JsAny, DestroyableNative { /** * Native object address. */ @@ -1033,31 +980,27 @@ external interface PxTransform { } -fun PxTransform(_module: dynamic = PhysXJsLoader.physXJs): PxTransform = js("new _module.PxTransform()") +fun PxTransform(_module: JsAny = PhysXJsLoader.physXJs): PxTransform = js("new _module.PxTransform()") /** * @param r WebIDL type: [PxIDENTITYEnum] (enum) */ -fun PxTransform(r: PxIDENTITYEnum, _module: dynamic = PhysXJsLoader.physXJs): PxTransform = js("new _module.PxTransform(r)") +fun PxTransform(r: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTransform = js("new _module.PxTransform(r)") /** * @param p0 WebIDL type: [PxVec3] (Const, Ref) * @param q0 WebIDL type: [PxQuat] (Const, Ref) */ -fun PxTransform(p0: PxVec3, q0: PxQuat, _module: dynamic = PhysXJsLoader.physXJs): PxTransform = js("new _module.PxTransform(p0, q0)") +fun PxTransform(p0: PxVec3, q0: PxQuat, _module: JsAny = PhysXJsLoader.physXJs): PxTransform = js("new _module.PxTransform(p0, q0)") -fun PxTransformFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTransform = js("_module.wrapPointer(ptr, _module.PxTransform)") - -fun PxTransform.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTransformFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTransform = js("_module.wrapPointer(ptr, _module.PxTransform)") val PxTransform.inverse get() = getInverse() val PxTransform.normalized get() = getNormalized() -external interface PxTypedBoundedData_PxU16 { +external interface PxTypedBoundedData_PxU16 : JsAny, DestroyableNative { /** * Native object address. */ @@ -1073,13 +1016,9 @@ external interface PxTypedBoundedData_PxU16 { var data: PxU16Ptr } -fun PxTypedBoundedData_PxU16FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTypedBoundedData_PxU16 = js("_module.wrapPointer(ptr, _module.PxTypedBoundedData_PxU16)") +fun PxTypedBoundedData_PxU16FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTypedBoundedData_PxU16 = js("_module.wrapPointer(ptr, _module.PxTypedBoundedData_PxU16)") -fun PxTypedBoundedData_PxU16.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxTypedBoundedData_PxU16Const { +external interface PxTypedBoundedData_PxU16Const : JsAny, DestroyableNative { /** * Native object address. */ @@ -1095,13 +1034,9 @@ external interface PxTypedBoundedData_PxU16Const { var data: PxU16ConstPtr } -fun PxTypedBoundedData_PxU16ConstFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTypedBoundedData_PxU16Const = js("_module.wrapPointer(ptr, _module.PxTypedBoundedData_PxU16Const)") - -fun PxTypedBoundedData_PxU16Const.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTypedBoundedData_PxU16ConstFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTypedBoundedData_PxU16Const = js("_module.wrapPointer(ptr, _module.PxTypedBoundedData_PxU16Const)") -external interface PxVec3 { +external interface PxVec3 : JsAny, DestroyableNative { /** * Native object address. */ @@ -1212,25 +1147,21 @@ external interface PxVec3 { } -fun PxVec3(_module: dynamic = PhysXJsLoader.physXJs): PxVec3 = js("new _module.PxVec3()") +fun PxVec3(_module: JsAny = PhysXJsLoader.physXJs): PxVec3 = js("new _module.PxVec3()") /** * @param x WebIDL type: float * @param y WebIDL type: float * @param z WebIDL type: float */ -fun PxVec3(x: Float, y: Float, z: Float, _module: dynamic = PhysXJsLoader.physXJs): PxVec3 = js("new _module.PxVec3(x, y, z)") +fun PxVec3(x: Float, y: Float, z: Float, _module: JsAny = PhysXJsLoader.physXJs): PxVec3 = js("new _module.PxVec3(x, y, z)") -fun PxVec3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVec3 = js("_module.wrapPointer(ptr, _module.PxVec3)") - -fun PxVec3.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVec3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVec3 = js("_module.wrapPointer(ptr, _module.PxVec3)") val PxVec3.normalized get() = getNormalized() -external interface PxVec4 { +external interface PxVec4 : JsAny, DestroyableNative { /** * Native object address. */ @@ -1319,7 +1250,7 @@ external interface PxVec4 { } -fun PxVec4(_module: dynamic = PhysXJsLoader.physXJs): PxVec4 = js("new _module.PxVec4()") +fun PxVec4(_module: JsAny = PhysXJsLoader.physXJs): PxVec4 = js("new _module.PxVec4()") /** * @param x WebIDL type: float @@ -1327,13 +1258,9 @@ fun PxVec4(_module: dynamic = PhysXJsLoader.physXJs): PxVec4 = js("new _module.P * @param z WebIDL type: float * @param w WebIDL type: float */ -fun PxVec4(x: Float, y: Float, z: Float, w: Float, _module: dynamic = PhysXJsLoader.physXJs): PxVec4 = js("new _module.PxVec4(x, y, z, w)") +fun PxVec4(x: Float, y: Float, z: Float, w: Float, _module: JsAny = PhysXJsLoader.physXJs): PxVec4 = js("new _module.PxVec4(x, y, z, w)") -fun PxVec4FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVec4 = js("_module.wrapPointer(ptr, _module.PxVec4)") - -fun PxVec4.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVec4FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVec4 = js("_module.wrapPointer(ptr, _module.PxVec4)") val PxVec4.normalized get() = getNormalized() @@ -1342,46 +1269,112 @@ val PxVec4.xYZ value class PxDebugColorEnum private constructor(val value: Int) { companion object { - val eARGB_BLACK: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_BLACK()) - val eARGB_RED: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_RED()) - val eARGB_GREEN: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_GREEN()) - val eARGB_BLUE: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_BLUE()) - val eARGB_YELLOW: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_YELLOW()) - val eARGB_MAGENTA: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_MAGENTA()) - val eARGB_CYAN: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_CYAN()) - val eARGB_WHITE: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_WHITE()) - val eARGB_GREY: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_GREY()) - val eARGB_DARKRED: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_DARKRED()) - val eARGB_DARKGREEN: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_DARKGREEN()) - val eARGB_DARKBLUE: PxDebugColorEnum = PxDebugColorEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDebugColorEnum_eARGB_DARKBLUE()) + val eARGB_BLACK: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_BLACK(PhysXJsLoader.physXJs)) + val eARGB_RED: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_RED(PhysXJsLoader.physXJs)) + val eARGB_GREEN: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_GREEN(PhysXJsLoader.physXJs)) + val eARGB_BLUE: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_BLUE(PhysXJsLoader.physXJs)) + val eARGB_YELLOW: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_YELLOW(PhysXJsLoader.physXJs)) + val eARGB_MAGENTA: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_MAGENTA(PhysXJsLoader.physXJs)) + val eARGB_CYAN: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_CYAN(PhysXJsLoader.physXJs)) + val eARGB_WHITE: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_WHITE(PhysXJsLoader.physXJs)) + val eARGB_GREY: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_GREY(PhysXJsLoader.physXJs)) + val eARGB_DARKRED: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_DARKRED(PhysXJsLoader.physXJs)) + val eARGB_DARKGREEN: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_DARKGREEN(PhysXJsLoader.physXJs)) + val eARGB_DARKBLUE: PxDebugColorEnum = PxDebugColorEnum(PxDebugColorEnum_eARGB_DARKBLUE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eARGB_BLACK.value -> eARGB_BLACK + eARGB_RED.value -> eARGB_RED + eARGB_GREEN.value -> eARGB_GREEN + eARGB_BLUE.value -> eARGB_BLUE + eARGB_YELLOW.value -> eARGB_YELLOW + eARGB_MAGENTA.value -> eARGB_MAGENTA + eARGB_CYAN.value -> eARGB_CYAN + eARGB_WHITE.value -> eARGB_WHITE + eARGB_GREY.value -> eARGB_GREY + eARGB_DARKRED.value -> eARGB_DARKRED + eARGB_DARKGREEN.value -> eARGB_DARKGREEN + eARGB_DARKBLUE.value -> eARGB_DARKBLUE + else -> error("Invalid enum value $value for enum PxDebugColorEnum") + } } } +private fun PxDebugColorEnum_eARGB_BLACK(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_BLACK()") +private fun PxDebugColorEnum_eARGB_RED(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_RED()") +private fun PxDebugColorEnum_eARGB_GREEN(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_GREEN()") +private fun PxDebugColorEnum_eARGB_BLUE(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_BLUE()") +private fun PxDebugColorEnum_eARGB_YELLOW(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_YELLOW()") +private fun PxDebugColorEnum_eARGB_MAGENTA(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_MAGENTA()") +private fun PxDebugColorEnum_eARGB_CYAN(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_CYAN()") +private fun PxDebugColorEnum_eARGB_WHITE(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_WHITE()") +private fun PxDebugColorEnum_eARGB_GREY(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_GREY()") +private fun PxDebugColorEnum_eARGB_DARKRED(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_DARKRED()") +private fun PxDebugColorEnum_eARGB_DARKGREEN(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_DARKGREEN()") +private fun PxDebugColorEnum_eARGB_DARKBLUE(module: JsAny): Int = js("module._emscripten_enum_PxDebugColorEnum_eARGB_DARKBLUE()") + value class PxBaseFlagEnum private constructor(val value: Int) { companion object { - val eOWNS_MEMORY: PxBaseFlagEnum = PxBaseFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBaseFlagEnum_eOWNS_MEMORY()) - val eIS_RELEASABLE: PxBaseFlagEnum = PxBaseFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBaseFlagEnum_eIS_RELEASABLE()) + val eOWNS_MEMORY: PxBaseFlagEnum = PxBaseFlagEnum(PxBaseFlagEnum_eOWNS_MEMORY(PhysXJsLoader.physXJs)) + val eIS_RELEASABLE: PxBaseFlagEnum = PxBaseFlagEnum(PxBaseFlagEnum_eIS_RELEASABLE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eOWNS_MEMORY.value -> eOWNS_MEMORY + eIS_RELEASABLE.value -> eIS_RELEASABLE + else -> error("Invalid enum value $value for enum PxBaseFlagEnum") + } } } +private fun PxBaseFlagEnum_eOWNS_MEMORY(module: JsAny): Int = js("module._emscripten_enum_PxBaseFlagEnum_eOWNS_MEMORY()") +private fun PxBaseFlagEnum_eIS_RELEASABLE(module: JsAny): Int = js("module._emscripten_enum_PxBaseFlagEnum_eIS_RELEASABLE()") + value class PxErrorCodeEnum private constructor(val value: Int) { companion object { - val eNO_ERROR: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eNO_ERROR()) - val eDEBUG_INFO: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eDEBUG_INFO()) - val eDEBUG_WARNING: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eDEBUG_WARNING()) - val eINVALID_PARAMETER: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eINVALID_PARAMETER()) - val eINVALID_OPERATION: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eINVALID_OPERATION()) - val eOUT_OF_MEMORY: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eOUT_OF_MEMORY()) - val eINTERNAL_ERROR: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eINTERNAL_ERROR()) - val eABORT: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eABORT()) - val ePERF_WARNING: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_ePERF_WARNING()) - val eMASK_ALL: PxErrorCodeEnum = PxErrorCodeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxErrorCodeEnum_eMASK_ALL()) + val eNO_ERROR: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eNO_ERROR(PhysXJsLoader.physXJs)) + val eDEBUG_INFO: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eDEBUG_INFO(PhysXJsLoader.physXJs)) + val eDEBUG_WARNING: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eDEBUG_WARNING(PhysXJsLoader.physXJs)) + val eINVALID_PARAMETER: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eINVALID_PARAMETER(PhysXJsLoader.physXJs)) + val eINVALID_OPERATION: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eINVALID_OPERATION(PhysXJsLoader.physXJs)) + val eOUT_OF_MEMORY: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eOUT_OF_MEMORY(PhysXJsLoader.physXJs)) + val eINTERNAL_ERROR: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eINTERNAL_ERROR(PhysXJsLoader.physXJs)) + val eABORT: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eABORT(PhysXJsLoader.physXJs)) + val ePERF_WARNING: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_ePERF_WARNING(PhysXJsLoader.physXJs)) + val eMASK_ALL: PxErrorCodeEnum = PxErrorCodeEnum(PxErrorCodeEnum_eMASK_ALL(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNO_ERROR.value -> eNO_ERROR + eDEBUG_INFO.value -> eDEBUG_INFO + eDEBUG_WARNING.value -> eDEBUG_WARNING + eINVALID_PARAMETER.value -> eINVALID_PARAMETER + eINVALID_OPERATION.value -> eINVALID_OPERATION + eOUT_OF_MEMORY.value -> eOUT_OF_MEMORY + eINTERNAL_ERROR.value -> eINTERNAL_ERROR + eABORT.value -> eABORT + ePERF_WARNING.value -> ePERF_WARNING + eMASK_ALL.value -> eMASK_ALL + else -> error("Invalid enum value $value for enum PxErrorCodeEnum") + } } } +private fun PxErrorCodeEnum_eNO_ERROR(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eNO_ERROR()") +private fun PxErrorCodeEnum_eDEBUG_INFO(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eDEBUG_INFO()") +private fun PxErrorCodeEnum_eDEBUG_WARNING(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eDEBUG_WARNING()") +private fun PxErrorCodeEnum_eINVALID_PARAMETER(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eINVALID_PARAMETER()") +private fun PxErrorCodeEnum_eINVALID_OPERATION(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eINVALID_OPERATION()") +private fun PxErrorCodeEnum_eOUT_OF_MEMORY(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eOUT_OF_MEMORY()") +private fun PxErrorCodeEnum_eINTERNAL_ERROR(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eINTERNAL_ERROR()") +private fun PxErrorCodeEnum_eABORT(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eABORT()") +private fun PxErrorCodeEnum_ePERF_WARNING(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_ePERF_WARNING()") +private fun PxErrorCodeEnum_eMASK_ALL(module: JsAny): Int = js("module._emscripten_enum_PxErrorCodeEnum_eMASK_ALL()") + value class PxIDENTITYEnum private constructor(val value: Int) { companion object { - val PxIdentity: PxIDENTITYEnum = PxIDENTITYEnum(PhysXJsLoader.physXJs._emscripten_enum_PxIDENTITYEnum_PxIdentity()) + val PxIdentity: PxIDENTITYEnum = PxIDENTITYEnum(PxIDENTITYEnum_PxIdentity(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + PxIdentity.value -> PxIdentity + else -> error("Invalid enum value $value for enum PxIDENTITYEnum") + } } } +private fun PxIDENTITYEnum_PxIdentity(module: JsAny): Int = js("module._emscripten_enum_PxIDENTITYEnum_PxIdentity()") + diff --git a/kool-physics/src/webMain/kotlin/physx/Cooking.kt b/kool-physics/src/webMain/kotlin/physx/Cooking.kt new file mode 100644 index 000000000..e994e8180 --- /dev/null +++ b/kool-physics/src/webMain/kotlin/physx/Cooking.kt @@ -0,0 +1,363 @@ +/* + * Generated from WebIDL by webidl-util + */ +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") + +package physx + +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxBVH33MidphaseDesc : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: float + */ + var meshSizePerformanceTradeOff: Float + /** + * WebIDL type: [PxMeshCookingHintEnum] (enum) + */ + var meshCookingHint: Int + + fun setToDefault() + + /** + * @return WebIDL type: boolean + */ + fun isValid(): Boolean + +} + +fun PxBVH33MidphaseDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBVH33MidphaseDesc = js("_module.wrapPointer(ptr, _module.PxBVH33MidphaseDesc)") + +var PxBVH33MidphaseDesc.meshCookingHintEnum: PxMeshCookingHintEnum + get() = PxMeshCookingHintEnum.forValue(meshCookingHint) + set(value) { meshCookingHint = value.value } + +external interface PxBVH34MidphaseDesc : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: unsigned long + */ + var numPrimsPerLeaf: Int + + fun setToDefault() + + /** + * @return WebIDL type: boolean + */ + fun isValid(): Boolean + +} + +fun PxBVH34MidphaseDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBVH34MidphaseDesc = js("_module.wrapPointer(ptr, _module.PxBVH34MidphaseDesc)") + +external interface PxConvexFlags : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param flag WebIDL type: [PxConvexFlagEnum] (enum) + * @return WebIDL type: boolean + */ + fun isSet(flag: Int): Boolean + + /** + * @param flag WebIDL type: [PxConvexFlagEnum] (enum) + */ + fun raise(flag: Int) + + /** + * @param flag WebIDL type: [PxConvexFlagEnum] (enum) + */ + fun clear(flag: Int) + +} + +/** + * @param flags WebIDL type: unsigned short + */ +fun PxConvexFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxConvexFlags = js("new _module.PxConvexFlags(flags)") + +fun PxConvexFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexFlags = js("_module.wrapPointer(ptr, _module.PxConvexFlags)") + +fun PxConvexFlags.isSet(flag: PxConvexFlagEnum) = isSet(flag.value) +fun PxConvexFlags.raise(flag: PxConvexFlagEnum) = raise(flag.value) +fun PxConvexFlags.clear(flag: PxConvexFlagEnum) = clear(flag.value) + +external interface PxConvexMeshDesc : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [PxBoundedData] (Value) + */ + var points: PxBoundedData + /** + * WebIDL type: [PxConvexFlags] (Value) + */ + var flags: PxConvexFlags +} + +fun PxConvexMeshDesc(_module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshDesc = js("new _module.PxConvexMeshDesc()") + +fun PxConvexMeshDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshDesc = js("_module.wrapPointer(ptr, _module.PxConvexMeshDesc)") + +external interface PxCookingParams : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: float + */ + var areaTestEpsilon: Float + /** + * WebIDL type: float + */ + var planeTolerance: Float + /** + * WebIDL type: [PxConvexMeshCookingTypeEnum] (enum) + */ + var convexMeshCookingType: Int + /** + * WebIDL type: boolean + */ + var suppressTriangleMeshRemapTable: Boolean + /** + * WebIDL type: boolean + */ + var buildTriangleAdjacencies: Boolean + /** + * WebIDL type: boolean + */ + var buildGPUData: Boolean + /** + * WebIDL type: [PxTolerancesScale] (Value) + */ + var scale: PxTolerancesScale + /** + * WebIDL type: [PxMeshPreprocessingFlags] (Value) + */ + var meshPreprocessParams: PxMeshPreprocessingFlags + /** + * WebIDL type: float + */ + var meshWeldTolerance: Float + /** + * WebIDL type: [PxMidphaseDesc] (Value) + */ + var midphaseDesc: PxMidphaseDesc + /** + * WebIDL type: unsigned long + */ + var gaussMapLimit: Int +} + +/** + * @param sc WebIDL type: [PxTolerancesScale] (Const, Ref) + */ +fun PxCookingParams(sc: PxTolerancesScale, _module: JsAny = PhysXJsLoader.physXJs): PxCookingParams = js("new _module.PxCookingParams(sc)") + +fun PxCookingParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCookingParams = js("_module.wrapPointer(ptr, _module.PxCookingParams)") + +var PxCookingParams.convexMeshCookingTypeEnum: PxConvexMeshCookingTypeEnum + get() = PxConvexMeshCookingTypeEnum.forValue(convexMeshCookingType) + set(value) { convexMeshCookingType = value.value } + +external interface PxMeshPreprocessingFlags : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param flag WebIDL type: [PxMeshPreprocessingFlagEnum] (enum) + * @return WebIDL type: boolean + */ + fun isSet(flag: Int): Boolean + + /** + * @param flag WebIDL type: [PxMeshPreprocessingFlagEnum] (enum) + */ + fun raise(flag: Int) + + /** + * @param flag WebIDL type: [PxMeshPreprocessingFlagEnum] (enum) + */ + fun clear(flag: Int) + +} + +/** + * @param flags WebIDL type: unsigned long + */ +fun PxMeshPreprocessingFlags(flags: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMeshPreprocessingFlags = js("new _module.PxMeshPreprocessingFlags(flags)") + +fun PxMeshPreprocessingFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMeshPreprocessingFlags = js("_module.wrapPointer(ptr, _module.PxMeshPreprocessingFlags)") + +fun PxMeshPreprocessingFlags.isSet(flag: PxMeshPreprocessingFlagEnum) = isSet(flag.value) +fun PxMeshPreprocessingFlags.raise(flag: PxMeshPreprocessingFlagEnum) = raise(flag.value) +fun PxMeshPreprocessingFlags.clear(flag: PxMeshPreprocessingFlagEnum) = clear(flag.value) + +external interface PxMidphaseDesc : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [PxBVH33MidphaseDesc] (Value) + */ + var mBVH33Desc: PxBVH33MidphaseDesc + /** + * WebIDL type: [PxBVH34MidphaseDesc] (Value) + */ + var mBVH34Desc: PxBVH34MidphaseDesc + + /** + * @return WebIDL type: [PxMeshMidPhaseEnum] (enum) + */ + fun getType(): Int + + /** + * @param type WebIDL type: [PxMeshMidPhaseEnum] (enum) + */ + fun setToDefault(type: Int) + + /** + * @return WebIDL type: boolean + */ + fun isValid(): Boolean + +} + +fun PxMidphaseDesc(_module: JsAny = PhysXJsLoader.physXJs): PxMidphaseDesc = js("new _module.PxMidphaseDesc()") + +fun PxMidphaseDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMidphaseDesc = js("_module.wrapPointer(ptr, _module.PxMidphaseDesc)") + +val PxMidphaseDesc.type: PxMeshMidPhaseEnum + get() = PxMeshMidPhaseEnum.forValue(getType()) + +fun PxMidphaseDesc.setToDefault(type: PxMeshMidPhaseEnum) = setToDefault(type.value) + +external interface PxTriangleMeshDesc : JsAny, DestroyableNative, PxSimpleTriangleMesh { + /** + * WebIDL type: [PxTypedBoundedData_PxU16Const] (Const, Value) + */ + var materialIndices: PxTypedBoundedData_PxU16Const +} + +fun PxTriangleMeshDesc(_module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshDesc = js("new _module.PxTriangleMeshDesc()") + +fun PxTriangleMeshDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshDesc = js("_module.wrapPointer(ptr, _module.PxTriangleMeshDesc)") + +value class PxConvexFlagEnum private constructor(val value: Int) { + companion object { + val e16_BIT_INDICES: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_e16_BIT_INDICES(PhysXJsLoader.physXJs)) + val eCOMPUTE_CONVEX: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_eCOMPUTE_CONVEX(PhysXJsLoader.physXJs)) + val eCHECK_ZERO_AREA_TRIANGLES: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_eCHECK_ZERO_AREA_TRIANGLES(PhysXJsLoader.physXJs)) + val eQUANTIZE_INPUT: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_eQUANTIZE_INPUT(PhysXJsLoader.physXJs)) + val eDISABLE_MESH_VALIDATION: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_eDISABLE_MESH_VALIDATION(PhysXJsLoader.physXJs)) + val ePLANE_SHIFTING: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_ePLANE_SHIFTING(PhysXJsLoader.physXJs)) + val eFAST_INERTIA_COMPUTATION: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_eFAST_INERTIA_COMPUTATION(PhysXJsLoader.physXJs)) + val eSHIFT_VERTICES: PxConvexFlagEnum = PxConvexFlagEnum(PxConvexFlagEnum_eSHIFT_VERTICES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + e16_BIT_INDICES.value -> e16_BIT_INDICES + eCOMPUTE_CONVEX.value -> eCOMPUTE_CONVEX + eCHECK_ZERO_AREA_TRIANGLES.value -> eCHECK_ZERO_AREA_TRIANGLES + eQUANTIZE_INPUT.value -> eQUANTIZE_INPUT + eDISABLE_MESH_VALIDATION.value -> eDISABLE_MESH_VALIDATION + ePLANE_SHIFTING.value -> ePLANE_SHIFTING + eFAST_INERTIA_COMPUTATION.value -> eFAST_INERTIA_COMPUTATION + eSHIFT_VERTICES.value -> eSHIFT_VERTICES + else -> error("Invalid enum value $value for enum PxConvexFlagEnum") + } + } +} + +private fun PxConvexFlagEnum_e16_BIT_INDICES(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_e16_BIT_INDICES()") +private fun PxConvexFlagEnum_eCOMPUTE_CONVEX(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_eCOMPUTE_CONVEX()") +private fun PxConvexFlagEnum_eCHECK_ZERO_AREA_TRIANGLES(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_eCHECK_ZERO_AREA_TRIANGLES()") +private fun PxConvexFlagEnum_eQUANTIZE_INPUT(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_eQUANTIZE_INPUT()") +private fun PxConvexFlagEnum_eDISABLE_MESH_VALIDATION(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_eDISABLE_MESH_VALIDATION()") +private fun PxConvexFlagEnum_ePLANE_SHIFTING(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_ePLANE_SHIFTING()") +private fun PxConvexFlagEnum_eFAST_INERTIA_COMPUTATION(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_eFAST_INERTIA_COMPUTATION()") +private fun PxConvexFlagEnum_eSHIFT_VERTICES(module: JsAny): Int = js("module._emscripten_enum_PxConvexFlagEnum_eSHIFT_VERTICES()") + +value class PxConvexMeshCookingTypeEnum private constructor(val value: Int) { + companion object { + val eQUICKHULL: PxConvexMeshCookingTypeEnum = PxConvexMeshCookingTypeEnum(PxConvexMeshCookingTypeEnum_eQUICKHULL(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eQUICKHULL.value -> eQUICKHULL + else -> error("Invalid enum value $value for enum PxConvexMeshCookingTypeEnum") + } + } +} + +private fun PxConvexMeshCookingTypeEnum_eQUICKHULL(module: JsAny): Int = js("module._emscripten_enum_PxConvexMeshCookingTypeEnum_eQUICKHULL()") + +value class PxMeshCookingHintEnum private constructor(val value: Int) { + companion object { + val eSIM_PERFORMANCE: PxMeshCookingHintEnum = PxMeshCookingHintEnum(PxMeshCookingHintEnum_eSIM_PERFORMANCE(PhysXJsLoader.physXJs)) + val eCOOKING_PERFORMANCE: PxMeshCookingHintEnum = PxMeshCookingHintEnum(PxMeshCookingHintEnum_eCOOKING_PERFORMANCE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSIM_PERFORMANCE.value -> eSIM_PERFORMANCE + eCOOKING_PERFORMANCE.value -> eCOOKING_PERFORMANCE + else -> error("Invalid enum value $value for enum PxMeshCookingHintEnum") + } + } +} + +private fun PxMeshCookingHintEnum_eSIM_PERFORMANCE(module: JsAny): Int = js("module._emscripten_enum_PxMeshCookingHintEnum_eSIM_PERFORMANCE()") +private fun PxMeshCookingHintEnum_eCOOKING_PERFORMANCE(module: JsAny): Int = js("module._emscripten_enum_PxMeshCookingHintEnum_eCOOKING_PERFORMANCE()") + +value class PxMeshPreprocessingFlagEnum private constructor(val value: Int) { + companion object { + val eWELD_VERTICES: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PxMeshPreprocessingFlagEnum_eWELD_VERTICES(PhysXJsLoader.physXJs)) + val eDISABLE_CLEAN_MESH: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PxMeshPreprocessingFlagEnum_eDISABLE_CLEAN_MESH(PhysXJsLoader.physXJs)) + val eDISABLE_ACTIVE_EDGES_PRECOMPUTE: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PxMeshPreprocessingFlagEnum_eDISABLE_ACTIVE_EDGES_PRECOMPUTE(PhysXJsLoader.physXJs)) + val eFORCE_32BIT_INDICES: PxMeshPreprocessingFlagEnum = PxMeshPreprocessingFlagEnum(PxMeshPreprocessingFlagEnum_eFORCE_32BIT_INDICES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eWELD_VERTICES.value -> eWELD_VERTICES + eDISABLE_CLEAN_MESH.value -> eDISABLE_CLEAN_MESH + eDISABLE_ACTIVE_EDGES_PRECOMPUTE.value -> eDISABLE_ACTIVE_EDGES_PRECOMPUTE + eFORCE_32BIT_INDICES.value -> eFORCE_32BIT_INDICES + else -> error("Invalid enum value $value for enum PxMeshPreprocessingFlagEnum") + } + } +} + +private fun PxMeshPreprocessingFlagEnum_eWELD_VERTICES(module: JsAny): Int = js("module._emscripten_enum_PxMeshPreprocessingFlagEnum_eWELD_VERTICES()") +private fun PxMeshPreprocessingFlagEnum_eDISABLE_CLEAN_MESH(module: JsAny): Int = js("module._emscripten_enum_PxMeshPreprocessingFlagEnum_eDISABLE_CLEAN_MESH()") +private fun PxMeshPreprocessingFlagEnum_eDISABLE_ACTIVE_EDGES_PRECOMPUTE(module: JsAny): Int = js("module._emscripten_enum_PxMeshPreprocessingFlagEnum_eDISABLE_ACTIVE_EDGES_PRECOMPUTE()") +private fun PxMeshPreprocessingFlagEnum_eFORCE_32BIT_INDICES(module: JsAny): Int = js("module._emscripten_enum_PxMeshPreprocessingFlagEnum_eFORCE_32BIT_INDICES()") + +value class PxMeshMidPhaseEnum private constructor(val value: Int) { + companion object { + val eBVH33: PxMeshMidPhaseEnum = PxMeshMidPhaseEnum(PxMeshMidPhaseEnum_eBVH33(PhysXJsLoader.physXJs)) + val eBVH34: PxMeshMidPhaseEnum = PxMeshMidPhaseEnum(PxMeshMidPhaseEnum_eBVH34(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eBVH33.value -> eBVH33 + eBVH34.value -> eBVH34 + else -> error("Invalid enum value $value for enum PxMeshMidPhaseEnum") + } + } +} + +private fun PxMeshMidPhaseEnum_eBVH33(module: JsAny): Int = js("module._emscripten_enum_PxMeshMidPhaseEnum_eBVH33()") +private fun PxMeshMidPhaseEnum_eBVH34(module: JsAny): Int = js("module._emscripten_enum_PxMeshMidPhaseEnum_eBVH34()") + diff --git a/kool-physics/src/jsMain/kotlin/physx/Extensions.kt b/kool-physics/src/webMain/kotlin/physx/Extensions.kt similarity index 62% rename from kool-physics/src/jsMain/kotlin/physx/Extensions.kt rename to kool-physics/src/webMain/kotlin/physx/Extensions.kt index 2a1738b98..a8a881da3 100644 --- a/kool-physics/src/jsMain/kotlin/physx/Extensions.kt +++ b/kool-physics/src/webMain/kotlin/physx/Extensions.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxGjkQueryProximityInfoResult { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxGjkQueryProximityInfoResult : JsAny, DestroyableNative { /** * Native object address. */ @@ -33,15 +36,11 @@ external interface PxGjkQueryProximityInfoResult { var separation: Float } -fun PxGjkQueryProximityInfoResult(_module: dynamic = PhysXJsLoader.physXJs): PxGjkQueryProximityInfoResult = js("new _module.PxGjkQueryProximityInfoResult()") - -fun PxGjkQueryProximityInfoResultFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGjkQueryProximityInfoResult = js("_module.wrapPointer(ptr, _module.PxGjkQueryProximityInfoResult)") +fun PxGjkQueryProximityInfoResult(_module: JsAny = PhysXJsLoader.physXJs): PxGjkQueryProximityInfoResult = js("new _module.PxGjkQueryProximityInfoResult()") -fun PxGjkQueryProximityInfoResult.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGjkQueryProximityInfoResultFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGjkQueryProximityInfoResult = js("_module.wrapPointer(ptr, _module.PxGjkQueryProximityInfoResult)") -external interface PxGjkQueryRaycastResult { +external interface PxGjkQueryRaycastResult : JsAny, DestroyableNative { /** * Native object address. */ @@ -65,15 +64,11 @@ external interface PxGjkQueryRaycastResult { var p: PxVec3 } -fun PxGjkQueryRaycastResult(_module: dynamic = PhysXJsLoader.physXJs): PxGjkQueryRaycastResult = js("new _module.PxGjkQueryRaycastResult()") +fun PxGjkQueryRaycastResult(_module: JsAny = PhysXJsLoader.physXJs): PxGjkQueryRaycastResult = js("new _module.PxGjkQueryRaycastResult()") -fun PxGjkQueryRaycastResultFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGjkQueryRaycastResult = js("_module.wrapPointer(ptr, _module.PxGjkQueryRaycastResult)") +fun PxGjkQueryRaycastResultFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGjkQueryRaycastResult = js("_module.wrapPointer(ptr, _module.PxGjkQueryRaycastResult)") -fun PxGjkQueryRaycastResult.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxGjkQuerySweepResult { +external interface PxGjkQuerySweepResult : JsAny, DestroyableNative { /** * Native object address. */ @@ -97,15 +92,11 @@ external interface PxGjkQuerySweepResult { var p: PxVec3 } -fun PxGjkQuerySweepResult(_module: dynamic = PhysXJsLoader.physXJs): PxGjkQuerySweepResult = js("new _module.PxGjkQuerySweepResult()") - -fun PxGjkQuerySweepResultFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGjkQuerySweepResult = js("_module.wrapPointer(ptr, _module.PxGjkQuerySweepResult)") +fun PxGjkQuerySweepResult(_module: JsAny = PhysXJsLoader.physXJs): PxGjkQuerySweepResult = js("new _module.PxGjkQuerySweepResult()") -fun PxGjkQuerySweepResult.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGjkQuerySweepResultFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGjkQuerySweepResult = js("_module.wrapPointer(ptr, _module.PxGjkQuerySweepResult)") -external interface PxGjkQuery { +external interface PxGjkQuery : JsAny, DestroyableNative { /** * Native object address. */ @@ -157,13 +148,9 @@ external interface PxGjkQuery { } -fun PxGjkQueryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGjkQuery = js("_module.wrapPointer(ptr, _module.PxGjkQuery)") - -fun PxGjkQuery.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGjkQueryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGjkQuery = js("_module.wrapPointer(ptr, _module.PxGjkQuery)") -external interface PxGjkQueryExt { +external interface PxGjkQueryExt : JsAny, DestroyableNative { /** * Native object address. */ @@ -183,13 +170,9 @@ external interface PxGjkQueryExt { } -fun PxGjkQueryExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGjkQueryExt = js("_module.wrapPointer(ptr, _module.PxGjkQueryExt)") +fun PxGjkQueryExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGjkQueryExt = js("_module.wrapPointer(ptr, _module.PxGjkQueryExt)") -fun PxGjkQueryExt.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface Support { +external interface Support : JsAny, DestroyableNative { /** * Native object address. */ @@ -208,16 +191,12 @@ external interface Support { } -fun SupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): Support = js("_module.wrapPointer(ptr, _module.Support)") - -fun Support.destroy() { - PhysXJsLoader.destroy(this) -} +fun SupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Support = js("_module.wrapPointer(ptr, _module.Support)") val Support.margin get() = getMargin() -external interface BoxSupport : Support { +external interface BoxSupport : JsAny, DestroyableNative, Support { /** * WebIDL type: [PxVec3] (Value) */ @@ -231,21 +210,17 @@ external interface BoxSupport : Support { /** * @param halfExtents WebIDL type: [PxVec3] (Const, Ref) */ -fun BoxSupport(halfExtents: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): BoxSupport = js("new _module.BoxSupport(halfExtents)") +fun BoxSupport(halfExtents: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): BoxSupport = js("new _module.BoxSupport(halfExtents)") /** * @param halfExtents WebIDL type: [PxVec3] (Const, Ref) * @param margin WebIDL type: float */ -fun BoxSupport(halfExtents: PxVec3, margin: Float, _module: dynamic = PhysXJsLoader.physXJs): BoxSupport = js("new _module.BoxSupport(halfExtents, margin)") - -fun BoxSupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): BoxSupport = js("_module.wrapPointer(ptr, _module.BoxSupport)") +fun BoxSupport(halfExtents: PxVec3, margin: Float, _module: JsAny = PhysXJsLoader.physXJs): BoxSupport = js("new _module.BoxSupport(halfExtents, margin)") -fun BoxSupport.destroy() { - PhysXJsLoader.destroy(this) -} +fun BoxSupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): BoxSupport = js("_module.wrapPointer(ptr, _module.BoxSupport)") -external interface CapsuleSupport : Support { +external interface CapsuleSupport : JsAny, DestroyableNative, Support { /** * WebIDL type: float */ @@ -260,36 +235,28 @@ external interface CapsuleSupport : Support { * @param radius WebIDL type: float * @param halfHeight WebIDL type: float */ -fun CapsuleSupport(radius: Float, halfHeight: Float, _module: dynamic = PhysXJsLoader.physXJs): CapsuleSupport = js("new _module.CapsuleSupport(radius, halfHeight)") +fun CapsuleSupport(radius: Float, halfHeight: Float, _module: JsAny = PhysXJsLoader.physXJs): CapsuleSupport = js("new _module.CapsuleSupport(radius, halfHeight)") -fun CapsuleSupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): CapsuleSupport = js("_module.wrapPointer(ptr, _module.CapsuleSupport)") +fun CapsuleSupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): CapsuleSupport = js("_module.wrapPointer(ptr, _module.CapsuleSupport)") -fun CapsuleSupport.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface ConvexGeomSupport : Support +external interface ConvexGeomSupport : JsAny, DestroyableNative, Support -fun ConvexGeomSupport(_module: dynamic = PhysXJsLoader.physXJs): ConvexGeomSupport = js("new _module.ConvexGeomSupport()") +fun ConvexGeomSupport(_module: JsAny = PhysXJsLoader.physXJs): ConvexGeomSupport = js("new _module.ConvexGeomSupport()") /** * @param geom WebIDL type: [PxGeometry] (Const, Ref) */ -fun ConvexGeomSupport(geom: PxGeometry, _module: dynamic = PhysXJsLoader.physXJs): ConvexGeomSupport = js("new _module.ConvexGeomSupport(geom)") +fun ConvexGeomSupport(geom: PxGeometry, _module: JsAny = PhysXJsLoader.physXJs): ConvexGeomSupport = js("new _module.ConvexGeomSupport(geom)") /** * @param geom WebIDL type: [PxGeometry] (Const, Ref) * @param margin WebIDL type: float */ -fun ConvexGeomSupport(geom: PxGeometry, margin: Float, _module: dynamic = PhysXJsLoader.physXJs): ConvexGeomSupport = js("new _module.ConvexGeomSupport(geom, margin)") +fun ConvexGeomSupport(geom: PxGeometry, margin: Float, _module: JsAny = PhysXJsLoader.physXJs): ConvexGeomSupport = js("new _module.ConvexGeomSupport(geom, margin)") -fun ConvexGeomSupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): ConvexGeomSupport = js("_module.wrapPointer(ptr, _module.ConvexGeomSupport)") +fun ConvexGeomSupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): ConvexGeomSupport = js("_module.wrapPointer(ptr, _module.ConvexGeomSupport)") -fun ConvexGeomSupport.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface ConvexMeshSupport : Support { +external interface ConvexMeshSupport : JsAny, DestroyableNative, Support { /** * WebIDL type: [PxVec3] (Value) */ @@ -307,20 +274,20 @@ external interface ConvexMeshSupport : Support { /** * @param convexMesh WebIDL type: [PxConvexMesh] (Const, Ref) */ -fun ConvexMeshSupport(convexMesh: PxConvexMesh, _module: dynamic = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh)") +fun ConvexMeshSupport(convexMesh: PxConvexMesh, _module: JsAny = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh)") /** * @param convexMesh WebIDL type: [PxConvexMesh] (Const, Ref) * @param scale WebIDL type: [PxVec3] (Const, Ref) */ -fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh, scale)") +fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh, scale)") /** * @param convexMesh WebIDL type: [PxConvexMesh] (Const, Ref) * @param scale WebIDL type: [PxVec3] (Const, Ref) * @param scaleRotation WebIDL type: [PxQuat] (Const, Ref) */ -fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, scaleRotation: PxQuat, _module: dynamic = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh, scale, scaleRotation)") +fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, scaleRotation: PxQuat, _module: JsAny = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh, scale, scaleRotation)") /** * @param convexMesh WebIDL type: [PxConvexMesh] (Const, Ref) @@ -328,15 +295,11 @@ fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, scaleRotation: Px * @param scaleRotation WebIDL type: [PxQuat] (Const, Ref) * @param margin WebIDL type: float */ -fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, scaleRotation: PxQuat, margin: Float, _module: dynamic = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh, scale, scaleRotation, margin)") - -fun ConvexMeshSupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): ConvexMeshSupport = js("_module.wrapPointer(ptr, _module.ConvexMeshSupport)") +fun ConvexMeshSupport(convexMesh: PxConvexMesh, scale: PxVec3, scaleRotation: PxQuat, margin: Float, _module: JsAny = PhysXJsLoader.physXJs): ConvexMeshSupport = js("new _module.ConvexMeshSupport(convexMesh, scale, scaleRotation, margin)") -fun ConvexMeshSupport.destroy() { - PhysXJsLoader.destroy(this) -} +fun ConvexMeshSupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): ConvexMeshSupport = js("_module.wrapPointer(ptr, _module.ConvexMeshSupport)") -external interface SphereSupport : Support { +external interface SphereSupport : JsAny, DestroyableNative, Support { /** * WebIDL type: float */ @@ -346,15 +309,11 @@ external interface SphereSupport : Support { /** * @param radius WebIDL type: float */ -fun SphereSupport(radius: Float, _module: dynamic = PhysXJsLoader.physXJs): SphereSupport = js("new _module.SphereSupport(radius)") +fun SphereSupport(radius: Float, _module: JsAny = PhysXJsLoader.physXJs): SphereSupport = js("new _module.SphereSupport(radius)") -fun SphereSupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): SphereSupport = js("_module.wrapPointer(ptr, _module.SphereSupport)") - -fun SphereSupport.destroy() { - PhysXJsLoader.destroy(this) -} +fun SphereSupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): SphereSupport = js("_module.wrapPointer(ptr, _module.SphereSupport)") -external interface CustomSupport : Support { +external interface CustomSupport : JsAny, DestroyableNative, Support { /** * @return WebIDL type: float */ @@ -368,11 +327,7 @@ external interface CustomSupport : Support { } -fun CustomSupportFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): CustomSupport = js("_module.wrapPointer(ptr, _module.CustomSupport)") - -fun CustomSupport.destroy() { - PhysXJsLoader.destroy(this) -} +fun CustomSupportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): CustomSupport = js("_module.wrapPointer(ptr, _module.CustomSupport)") val CustomSupport.customMargin get() = getCustomMargin() @@ -391,20 +346,20 @@ external interface CustomSupportImpl : CustomSupport { } -fun CustomSupportImpl(_module: dynamic = PhysXJsLoader.physXJs): CustomSupportImpl = js("new _module.CustomSupportImpl()") +fun CustomSupportImpl(_module: JsAny = PhysXJsLoader.physXJs): CustomSupportImpl = js("new _module.CustomSupportImpl()") -external interface PxD6Joint : PxJoint { +external interface PxD6Joint : JsAny, DestroyableNative, PxJoint { /** * @param axis WebIDL type: [PxD6AxisEnum] (enum) * @param type WebIDL type: [PxD6MotionEnum] (enum) */ - fun setMotion(axis: PxD6AxisEnum, type: PxD6MotionEnum) + fun setMotion(axis: Int, type: Int) /** * @param axis WebIDL type: [PxD6AxisEnum] (enum) * @return WebIDL type: [PxD6MotionEnum] (enum) */ - fun getMotion(axis: PxD6AxisEnum): PxD6MotionEnum + fun getMotion(axis: Int): Int /** * @return WebIDL type: float @@ -430,7 +385,7 @@ external interface PxD6Joint : PxJoint { * @param axis WebIDL type: [PxD6AxisEnum] (enum) * @param limit WebIDL type: [PxJointLinearLimitPair] (Const, Ref) */ - fun setLinearLimit(axis: PxD6AxisEnum, limit: PxJointLinearLimitPair) + fun setLinearLimit(axis: Int, limit: PxJointLinearLimitPair) /** * @param limit WebIDL type: [PxJointAngularLimitPair] (Const, Ref) @@ -451,13 +406,13 @@ external interface PxD6Joint : PxJoint { * @param index WebIDL type: [PxD6DriveEnum] (enum) * @param drive WebIDL type: [PxD6JointDrive] (Const, Ref) */ - fun setDrive(index: PxD6DriveEnum, drive: PxD6JointDrive) + fun setDrive(index: Int, drive: PxD6JointDrive) /** * @param index WebIDL type: [PxD6DriveEnum] (enum) * @return WebIDL type: [PxD6JointDrive] (Value) */ - fun getDrive(index: PxD6DriveEnum): PxD6JointDrive + fun getDrive(index: Int): PxD6JointDrive /** * @param pose WebIDL type: [PxTransform] (Const, Ref) @@ -489,11 +444,7 @@ external interface PxD6Joint : PxJoint { } -fun PxD6JointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxD6Joint = js("_module.wrapPointer(ptr, _module.PxD6Joint)") - -fun PxD6Joint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxD6JointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxD6Joint = js("_module.wrapPointer(ptr, _module.PxD6Joint)") val PxD6Joint.twistAngle get() = getTwistAngle() @@ -506,7 +457,13 @@ var PxD6Joint.drivePosition get() = getDrivePosition() set(value) { setDrivePosition(value) } -external interface PxD6JointDrive : PxSpring { +fun PxD6Joint.setMotion(axis: PxD6AxisEnum, type: PxD6MotionEnum) = setMotion(axis.value, type.value) +fun PxD6Joint.getMotion(axis: PxD6AxisEnum) = PxD6MotionEnum.forValue(getMotion(axis.value)) +fun PxD6Joint.setLinearLimit(axis: PxD6AxisEnum, limit: PxJointLinearLimitPair) = setLinearLimit(axis.value, limit) +fun PxD6Joint.setDrive(index: PxD6DriveEnum, drive: PxD6JointDrive) = setDrive(index.value, drive) +fun PxD6Joint.getDrive(index: PxD6DriveEnum) = getDrive(index.value) + +external interface PxD6JointDrive : JsAny, DestroyableNative, PxSpring { /** * WebIDL type: float */ @@ -517,14 +474,14 @@ external interface PxD6JointDrive : PxSpring { var flags: PxD6JointDriveFlags } -fun PxD6JointDrive(_module: dynamic = PhysXJsLoader.physXJs): PxD6JointDrive = js("new _module.PxD6JointDrive()") +fun PxD6JointDrive(_module: JsAny = PhysXJsLoader.physXJs): PxD6JointDrive = js("new _module.PxD6JointDrive()") /** * @param driveStiffness WebIDL type: float * @param driveDamping WebIDL type: float * @param driveForceLimit WebIDL type: float */ -fun PxD6JointDrive(driveStiffness: Float, driveDamping: Float, driveForceLimit: Float, _module: dynamic = PhysXJsLoader.physXJs): PxD6JointDrive = js("new _module.PxD6JointDrive(driveStiffness, driveDamping, driveForceLimit)") +fun PxD6JointDrive(driveStiffness: Float, driveDamping: Float, driveForceLimit: Float, _module: JsAny = PhysXJsLoader.physXJs): PxD6JointDrive = js("new _module.PxD6JointDrive(driveStiffness, driveDamping, driveForceLimit)") /** * @param driveStiffness WebIDL type: float @@ -532,15 +489,11 @@ fun PxD6JointDrive(driveStiffness: Float, driveDamping: Float, driveForceLimit: * @param driveForceLimit WebIDL type: float * @param isAcceleration WebIDL type: boolean */ -fun PxD6JointDrive(driveStiffness: Float, driveDamping: Float, driveForceLimit: Float, isAcceleration: Boolean, _module: dynamic = PhysXJsLoader.physXJs): PxD6JointDrive = js("new _module.PxD6JointDrive(driveStiffness, driveDamping, driveForceLimit, isAcceleration)") +fun PxD6JointDrive(driveStiffness: Float, driveDamping: Float, driveForceLimit: Float, isAcceleration: Boolean, _module: JsAny = PhysXJsLoader.physXJs): PxD6JointDrive = js("new _module.PxD6JointDrive(driveStiffness, driveDamping, driveForceLimit, isAcceleration)") -fun PxD6JointDriveFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxD6JointDrive = js("_module.wrapPointer(ptr, _module.PxD6JointDrive)") +fun PxD6JointDriveFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxD6JointDrive = js("_module.wrapPointer(ptr, _module.PxD6JointDrive)") -fun PxD6JointDrive.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxD6JointDriveFlags { +external interface PxD6JointDriveFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -550,32 +503,32 @@ external interface PxD6JointDriveFlags { * @param flag WebIDL type: [PxD6JointDriveFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxD6JointDriveFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxD6JointDriveFlagEnum] (enum) */ - fun raise(flag: PxD6JointDriveFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxD6JointDriveFlagEnum] (enum) */ - fun clear(flag: PxD6JointDriveFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned long */ -fun PxD6JointDriveFlags(flags: Int, _module: dynamic = PhysXJsLoader.physXJs): PxD6JointDriveFlags = js("new _module.PxD6JointDriveFlags(flags)") +fun PxD6JointDriveFlags(flags: Int, _module: JsAny = PhysXJsLoader.physXJs): PxD6JointDriveFlags = js("new _module.PxD6JointDriveFlags(flags)") -fun PxD6JointDriveFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxD6JointDriveFlags = js("_module.wrapPointer(ptr, _module.PxD6JointDriveFlags)") +fun PxD6JointDriveFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxD6JointDriveFlags = js("_module.wrapPointer(ptr, _module.PxD6JointDriveFlags)") -fun PxD6JointDriveFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxD6JointDriveFlags.isSet(flag: PxD6JointDriveFlagEnum) = isSet(flag.value) +fun PxD6JointDriveFlags.raise(flag: PxD6JointDriveFlagEnum) = raise(flag.value) +fun PxD6JointDriveFlags.clear(flag: PxD6JointDriveFlagEnum) = clear(flag.value) -external interface PxDistanceJoint : PxJoint { +external interface PxDistanceJoint : JsAny, DestroyableNative, PxJoint { /** * @return WebIDL type: float */ @@ -640,7 +593,7 @@ external interface PxDistanceJoint : PxJoint { * @param flag WebIDL type: [PxDistanceJointFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setDistanceJointFlag(flag: PxDistanceJointFlagEnum, value: Boolean) + fun setDistanceJointFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxDistanceJointFlags] (Value) @@ -649,11 +602,7 @@ external interface PxDistanceJoint : PxJoint { } -fun PxDistanceJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDistanceJoint = js("_module.wrapPointer(ptr, _module.PxDistanceJoint)") - -fun PxDistanceJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxDistanceJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDistanceJoint = js("_module.wrapPointer(ptr, _module.PxDistanceJoint)") val PxDistanceJoint.distance get() = getDistance() @@ -677,7 +626,9 @@ var PxDistanceJoint.distanceJointFlags get() = getDistanceJointFlags() set(value) { setDistanceJointFlags(value) } -external interface PxDistanceJointFlags { +fun PxDistanceJoint.setDistanceJointFlag(flag: PxDistanceJointFlagEnum, value: Boolean) = setDistanceJointFlag(flag.value, value) + +external interface PxDistanceJointFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -687,40 +638,36 @@ external interface PxDistanceJointFlags { * @param flag WebIDL type: [PxDistanceJointFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxDistanceJointFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxDistanceJointFlagEnum] (enum) */ - fun raise(flag: PxDistanceJointFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxDistanceJointFlagEnum] (enum) */ - fun clear(flag: PxDistanceJointFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxDistanceJointFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxDistanceJointFlags = js("new _module.PxDistanceJointFlags(flags)") +fun PxDistanceJointFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxDistanceJointFlags = js("new _module.PxDistanceJointFlags(flags)") -fun PxDistanceJointFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDistanceJointFlags = js("_module.wrapPointer(ptr, _module.PxDistanceJointFlags)") +fun PxDistanceJointFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDistanceJointFlags = js("_module.wrapPointer(ptr, _module.PxDistanceJointFlags)") -fun PxDistanceJointFlags.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxFixedJoint : PxJoint +fun PxDistanceJointFlags.isSet(flag: PxDistanceJointFlagEnum) = isSet(flag.value) +fun PxDistanceJointFlags.raise(flag: PxDistanceJointFlagEnum) = raise(flag.value) +fun PxDistanceJointFlags.clear(flag: PxDistanceJointFlagEnum) = clear(flag.value) -fun PxFixedJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxFixedJoint = js("_module.wrapPointer(ptr, _module.PxFixedJoint)") +external interface PxFixedJoint : JsAny, DestroyableNative, PxJoint -fun PxFixedJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxFixedJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxFixedJoint = js("_module.wrapPointer(ptr, _module.PxFixedJoint)") -external interface PxGearJoint : PxJoint { +external interface PxGearJoint : JsAny, DestroyableNative, PxJoint { /** * @param hinge0 WebIDL type: [PxBase] (Const) * @param hinge1 WebIDL type: [PxBase] (Const) @@ -740,21 +687,17 @@ external interface PxGearJoint : PxJoint { } -fun PxGearJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGearJoint = js("_module.wrapPointer(ptr, _module.PxGearJoint)") - -fun PxGearJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGearJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGearJoint = js("_module.wrapPointer(ptr, _module.PxGearJoint)") var PxGearJoint.gearRatio get() = getGearRatio() set(value) { setGearRatio(value) } -external interface PxJoint : PxBase { +external interface PxJoint : JsAny, PxBase { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @param actor0 WebIDL type: [PxRigidActor] @@ -766,13 +709,13 @@ external interface PxJoint : PxBase { * @param actor WebIDL type: [PxJointActorIndexEnum] (enum) * @param localPose WebIDL type: [PxTransform] (Const, Ref) */ - fun setLocalPose(actor: PxJointActorIndexEnum, localPose: PxTransform) + fun setLocalPose(actor: Int, localPose: PxTransform) /** * @param actor WebIDL type: [PxJointActorIndexEnum] (enum) * @return WebIDL type: [PxTransform] (Value) */ - fun getLocalPose(actor: PxJointActorIndexEnum): PxTransform + fun getLocalPose(actor: Int): PxTransform /** * @return WebIDL type: [PxTransform] (Value) @@ -804,7 +747,7 @@ external interface PxJoint : PxBase { * @param flag WebIDL type: [PxConstraintFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setConstraintFlag(flag: PxConstraintFlagEnum, value: Boolean) + fun setConstraintFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxConstraintFlags] (Value) @@ -873,7 +816,7 @@ external interface PxJoint : PxBase { } -fun PxJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJoint = js("_module.wrapPointer(ptr, _module.PxJoint)") +fun PxJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJoint = js("_module.wrapPointer(ptr, _module.PxJoint)") val PxJoint.relativeTransform get() = getRelativeTransform() @@ -905,7 +848,11 @@ var PxJoint.name get() = getName() set(value) { setName(value) } -external interface PxJointAngularLimitPair : PxJointLimitParameters { +fun PxJoint.setLocalPose(actor: PxJointActorIndexEnum, localPose: PxTransform) = setLocalPose(actor.value, localPose) +fun PxJoint.getLocalPose(actor: PxJointActorIndexEnum) = getLocalPose(actor.value) +fun PxJoint.setConstraintFlag(flag: PxConstraintFlagEnum, value: Boolean) = setConstraintFlag(flag.value, value) + +external interface PxJointAngularLimitPair : JsAny, DestroyableNative, PxJointLimitParameters { /** * WebIDL type: float */ @@ -920,22 +867,18 @@ external interface PxJointAngularLimitPair : PxJointLimitParameters { * @param lowerLimit WebIDL type: float * @param upperLimit WebIDL type: float */ -fun PxJointAngularLimitPair(lowerLimit: Float, upperLimit: Float, _module: dynamic = PhysXJsLoader.physXJs): PxJointAngularLimitPair = js("new _module.PxJointAngularLimitPair(lowerLimit, upperLimit)") +fun PxJointAngularLimitPair(lowerLimit: Float, upperLimit: Float, _module: JsAny = PhysXJsLoader.physXJs): PxJointAngularLimitPair = js("new _module.PxJointAngularLimitPair(lowerLimit, upperLimit)") /** * @param lowerLimit WebIDL type: float * @param upperLimit WebIDL type: float * @param spring WebIDL type: [PxSpring] (Const, Ref) */ -fun PxJointAngularLimitPair(lowerLimit: Float, upperLimit: Float, spring: PxSpring, _module: dynamic = PhysXJsLoader.physXJs): PxJointAngularLimitPair = js("new _module.PxJointAngularLimitPair(lowerLimit, upperLimit, spring)") +fun PxJointAngularLimitPair(lowerLimit: Float, upperLimit: Float, spring: PxSpring, _module: JsAny = PhysXJsLoader.physXJs): PxJointAngularLimitPair = js("new _module.PxJointAngularLimitPair(lowerLimit, upperLimit, spring)") -fun PxJointAngularLimitPairFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJointAngularLimitPair = js("_module.wrapPointer(ptr, _module.PxJointAngularLimitPair)") +fun PxJointAngularLimitPairFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJointAngularLimitPair = js("_module.wrapPointer(ptr, _module.PxJointAngularLimitPair)") -fun PxJointAngularLimitPair.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxJointLimitCone : PxJointLimitParameters { +external interface PxJointLimitCone : JsAny, DestroyableNative, PxJointLimitParameters { /** * WebIDL type: float */ @@ -950,22 +893,18 @@ external interface PxJointLimitCone : PxJointLimitParameters { * @param yLimitAngle WebIDL type: float * @param zLimitAngle WebIDL type: float */ -fun PxJointLimitCone(yLimitAngle: Float, zLimitAngle: Float, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitCone = js("new _module.PxJointLimitCone(yLimitAngle, zLimitAngle)") +fun PxJointLimitCone(yLimitAngle: Float, zLimitAngle: Float, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitCone = js("new _module.PxJointLimitCone(yLimitAngle, zLimitAngle)") /** * @param yLimitAngle WebIDL type: float * @param zLimitAngle WebIDL type: float * @param spring WebIDL type: [PxSpring] (Const, Ref) */ -fun PxJointLimitCone(yLimitAngle: Float, zLimitAngle: Float, spring: PxSpring, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitCone = js("new _module.PxJointLimitCone(yLimitAngle, zLimitAngle, spring)") +fun PxJointLimitCone(yLimitAngle: Float, zLimitAngle: Float, spring: PxSpring, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitCone = js("new _module.PxJointLimitCone(yLimitAngle, zLimitAngle, spring)") -fun PxJointLimitConeFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitCone = js("_module.wrapPointer(ptr, _module.PxJointLimitCone)") +fun PxJointLimitConeFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitCone = js("_module.wrapPointer(ptr, _module.PxJointLimitCone)") -fun PxJointLimitCone.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxJointLimitParameters { +external interface PxJointLimitParameters : JsAny { /** * Native object address. */ @@ -1000,9 +939,9 @@ external interface PxJointLimitParameters { } -fun PxJointLimitParametersFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitParameters = js("_module.wrapPointer(ptr, _module.PxJointLimitParameters)") +fun PxJointLimitParametersFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitParameters = js("_module.wrapPointer(ptr, _module.PxJointLimitParameters)") -external interface PxJointLimitPyramid : PxJointLimitParameters { +external interface PxJointLimitPyramid : JsAny, DestroyableNative, PxJointLimitParameters { /** * WebIDL type: float */ @@ -1027,7 +966,7 @@ external interface PxJointLimitPyramid : PxJointLimitParameters { * @param zLimitAngleMin WebIDL type: float * @param zLimitAngleMax WebIDL type: float */ -fun PxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax: Float, zLimitAngleMin: Float, zLimitAngleMax: Float, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitPyramid = js("new _module.PxJointLimitPyramid(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax)") +fun PxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax: Float, zLimitAngleMin: Float, zLimitAngleMax: Float, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitPyramid = js("new _module.PxJointLimitPyramid(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax)") /** * @param yLimitAngleMin WebIDL type: float @@ -1036,15 +975,11 @@ fun PxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax: Float, zLimitAngl * @param zLimitAngleMax WebIDL type: float * @param spring WebIDL type: [PxSpring] (Const, Ref) */ -fun PxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax: Float, zLimitAngleMin: Float, zLimitAngleMax: Float, spring: PxSpring, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitPyramid = js("new _module.PxJointLimitPyramid(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax, spring)") - -fun PxJointLimitPyramidFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJointLimitPyramid = js("_module.wrapPointer(ptr, _module.PxJointLimitPyramid)") +fun PxJointLimitPyramid(yLimitAngleMin: Float, yLimitAngleMax: Float, zLimitAngleMin: Float, zLimitAngleMax: Float, spring: PxSpring, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitPyramid = js("new _module.PxJointLimitPyramid(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax, spring)") -fun PxJointLimitPyramid.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxJointLimitPyramidFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJointLimitPyramid = js("_module.wrapPointer(ptr, _module.PxJointLimitPyramid)") -external interface PxJointLinearLimit : PxJointLimitParameters { +external interface PxJointLinearLimit : JsAny, DestroyableNative, PxJointLimitParameters { /** * WebIDL type: float */ @@ -1055,15 +990,11 @@ external interface PxJointLinearLimit : PxJointLimitParameters { * @param extent WebIDL type: float * @param spring WebIDL type: [PxSpring] (Const, Ref) */ -fun PxJointLinearLimit(extent: Float, spring: PxSpring, _module: dynamic = PhysXJsLoader.physXJs): PxJointLinearLimit = js("new _module.PxJointLinearLimit(extent, spring)") - -fun PxJointLinearLimitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJointLinearLimit = js("_module.wrapPointer(ptr, _module.PxJointLinearLimit)") +fun PxJointLinearLimit(extent: Float, spring: PxSpring, _module: JsAny = PhysXJsLoader.physXJs): PxJointLinearLimit = js("new _module.PxJointLinearLimit(extent, spring)") -fun PxJointLinearLimit.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxJointLinearLimitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJointLinearLimit = js("_module.wrapPointer(ptr, _module.PxJointLinearLimit)") -external interface PxJointLinearLimitPair : PxJointLimitParameters { +external interface PxJointLinearLimitPair : JsAny, DestroyableNative, PxJointLimitParameters { /** * WebIDL type: float */ @@ -1079,15 +1010,11 @@ external interface PxJointLinearLimitPair : PxJointLimitParameters { * @param upperLimit WebIDL type: float * @param spring WebIDL type: [PxSpring] (Const, Ref) */ -fun PxJointLinearLimitPair(lowerLimit: Float, upperLimit: Float, spring: PxSpring, _module: dynamic = PhysXJsLoader.physXJs): PxJointLinearLimitPair = js("new _module.PxJointLinearLimitPair(lowerLimit, upperLimit, spring)") +fun PxJointLinearLimitPair(lowerLimit: Float, upperLimit: Float, spring: PxSpring, _module: JsAny = PhysXJsLoader.physXJs): PxJointLinearLimitPair = js("new _module.PxJointLinearLimitPair(lowerLimit, upperLimit, spring)") -fun PxJointLinearLimitPairFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxJointLinearLimitPair = js("_module.wrapPointer(ptr, _module.PxJointLinearLimitPair)") +fun PxJointLinearLimitPairFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxJointLinearLimitPair = js("_module.wrapPointer(ptr, _module.PxJointLinearLimitPair)") -fun PxJointLinearLimitPair.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxPrismaticJoint : PxJoint { +external interface PxPrismaticJoint : JsAny, DestroyableNative, PxJoint { /** * @return WebIDL type: float */ @@ -1112,7 +1039,7 @@ external interface PxPrismaticJoint : PxJoint { * @param flag WebIDL type: [PxPrismaticJointFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setPrismaticJointFlag(flag: PxPrismaticJointFlagEnum, value: Boolean) + fun setPrismaticJointFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxPrismaticJointFlags] (Value) @@ -1121,11 +1048,7 @@ external interface PxPrismaticJoint : PxJoint { } -fun PxPrismaticJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPrismaticJoint = js("_module.wrapPointer(ptr, _module.PxPrismaticJoint)") - -fun PxPrismaticJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxPrismaticJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPrismaticJoint = js("_module.wrapPointer(ptr, _module.PxPrismaticJoint)") val PxPrismaticJoint.position get() = getPosition() @@ -1136,7 +1059,9 @@ var PxPrismaticJoint.prismaticJointFlags get() = getPrismaticJointFlags() set(value) { setPrismaticJointFlags(value) } -external interface PxPrismaticJointFlags { +fun PxPrismaticJoint.setPrismaticJointFlag(flag: PxPrismaticJointFlagEnum, value: Boolean) = setPrismaticJointFlag(flag.value, value) + +external interface PxPrismaticJointFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1146,32 +1071,32 @@ external interface PxPrismaticJointFlags { * @param flag WebIDL type: [PxPrismaticJointFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxPrismaticJointFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxPrismaticJointFlagEnum] (enum) */ - fun raise(flag: PxPrismaticJointFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxPrismaticJointFlagEnum] (enum) */ - fun clear(flag: PxPrismaticJointFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxPrismaticJointFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxPrismaticJointFlags = js("new _module.PxPrismaticJointFlags(flags)") +fun PxPrismaticJointFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxPrismaticJointFlags = js("new _module.PxPrismaticJointFlags(flags)") -fun PxPrismaticJointFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPrismaticJointFlags = js("_module.wrapPointer(ptr, _module.PxPrismaticJointFlags)") +fun PxPrismaticJointFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPrismaticJointFlags = js("_module.wrapPointer(ptr, _module.PxPrismaticJointFlags)") -fun PxPrismaticJointFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxPrismaticJointFlags.isSet(flag: PxPrismaticJointFlagEnum) = isSet(flag.value) +fun PxPrismaticJointFlags.raise(flag: PxPrismaticJointFlagEnum) = raise(flag.value) +fun PxPrismaticJointFlags.clear(flag: PxPrismaticJointFlagEnum) = clear(flag.value) -external interface PxRackAndPinionJoint : PxJoint { +external interface PxRackAndPinionJoint : JsAny, DestroyableNative, PxJoint { /** * @param hinge WebIDL type: [PxBase] (Const) * @param prismatic WebIDL type: [PxBase] (Const) @@ -1199,17 +1124,13 @@ external interface PxRackAndPinionJoint : PxJoint { } -fun PxRackAndPinionJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRackAndPinionJoint = js("_module.wrapPointer(ptr, _module.PxRackAndPinionJoint)") - -fun PxRackAndPinionJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRackAndPinionJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRackAndPinionJoint = js("_module.wrapPointer(ptr, _module.PxRackAndPinionJoint)") var PxRackAndPinionJoint.ratio get() = getRatio() set(value) { setRatio(value) } -external interface PxRevoluteJoint : PxJoint { +external interface PxRevoluteJoint : JsAny, DestroyableNative, PxJoint { /** * @return WebIDL type: float */ @@ -1270,7 +1191,7 @@ external interface PxRevoluteJoint : PxJoint { * @param flag WebIDL type: [PxRevoluteJointFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setRevoluteJointFlag(flag: PxRevoluteJointFlagEnum, value: Boolean) + fun setRevoluteJointFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxRevoluteJointFlags] (Value) @@ -1279,11 +1200,7 @@ external interface PxRevoluteJoint : PxJoint { } -fun PxRevoluteJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRevoluteJoint = js("_module.wrapPointer(ptr, _module.PxRevoluteJoint)") - -fun PxRevoluteJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRevoluteJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRevoluteJoint = js("_module.wrapPointer(ptr, _module.PxRevoluteJoint)") val PxRevoluteJoint.angle get() = getAngle() @@ -1303,7 +1220,9 @@ var PxRevoluteJoint.revoluteJointFlags get() = getRevoluteJointFlags() set(value) { setRevoluteJointFlags(value) } -external interface PxRevoluteJointFlags { +fun PxRevoluteJoint.setRevoluteJointFlag(flag: PxRevoluteJointFlagEnum, value: Boolean) = setRevoluteJointFlag(flag.value, value) + +external interface PxRevoluteJointFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1313,32 +1232,32 @@ external interface PxRevoluteJointFlags { * @param flag WebIDL type: [PxRevoluteJointFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxRevoluteJointFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxRevoluteJointFlagEnum] (enum) */ - fun raise(flag: PxRevoluteJointFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxRevoluteJointFlagEnum] (enum) */ - fun clear(flag: PxRevoluteJointFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxRevoluteJointFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxRevoluteJointFlags = js("new _module.PxRevoluteJointFlags(flags)") +fun PxRevoluteJointFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxRevoluteJointFlags = js("new _module.PxRevoluteJointFlags(flags)") -fun PxRevoluteJointFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRevoluteJointFlags = js("_module.wrapPointer(ptr, _module.PxRevoluteJointFlags)") +fun PxRevoluteJointFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRevoluteJointFlags = js("_module.wrapPointer(ptr, _module.PxRevoluteJointFlags)") -fun PxRevoluteJointFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRevoluteJointFlags.isSet(flag: PxRevoluteJointFlagEnum) = isSet(flag.value) +fun PxRevoluteJointFlags.raise(flag: PxRevoluteJointFlagEnum) = raise(flag.value) +fun PxRevoluteJointFlags.clear(flag: PxRevoluteJointFlagEnum) = clear(flag.value) -external interface PxSphericalJoint : PxJoint { +external interface PxSphericalJoint : JsAny, DestroyableNative, PxJoint { /** * @param limitCone WebIDL type: [PxJointLimitCone] (Const, Ref) */ @@ -1363,7 +1282,7 @@ external interface PxSphericalJoint : PxJoint { * @param flag WebIDL type: [PxSphericalJointFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setSphericalJointFlag(flag: PxSphericalJointFlagEnum, value: Boolean) + fun setSphericalJointFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxSphericalJointFlags] (Value) @@ -1372,11 +1291,7 @@ external interface PxSphericalJoint : PxJoint { } -fun PxSphericalJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSphericalJoint = js("_module.wrapPointer(ptr, _module.PxSphericalJoint)") - -fun PxSphericalJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSphericalJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSphericalJoint = js("_module.wrapPointer(ptr, _module.PxSphericalJoint)") val PxSphericalJoint.swingYAngle get() = getSwingYAngle() @@ -1387,7 +1302,9 @@ var PxSphericalJoint.sphericalJointFlags get() = getSphericalJointFlags() set(value) { setSphericalJointFlags(value) } -external interface PxSphericalJointFlags { +fun PxSphericalJoint.setSphericalJointFlag(flag: PxSphericalJointFlagEnum, value: Boolean) = setSphericalJointFlag(flag.value, value) + +external interface PxSphericalJointFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1397,32 +1314,32 @@ external interface PxSphericalJointFlags { * @param flag WebIDL type: [PxSphericalJointFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxSphericalJointFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxSphericalJointFlagEnum] (enum) */ - fun raise(flag: PxSphericalJointFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxSphericalJointFlagEnum] (enum) */ - fun clear(flag: PxSphericalJointFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxSphericalJointFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxSphericalJointFlags = js("new _module.PxSphericalJointFlags(flags)") +fun PxSphericalJointFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxSphericalJointFlags = js("new _module.PxSphericalJointFlags(flags)") -fun PxSphericalJointFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSphericalJointFlags = js("_module.wrapPointer(ptr, _module.PxSphericalJointFlags)") +fun PxSphericalJointFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSphericalJointFlags = js("_module.wrapPointer(ptr, _module.PxSphericalJointFlags)") -fun PxSphericalJointFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSphericalJointFlags.isSet(flag: PxSphericalJointFlagEnum) = isSet(flag.value) +fun PxSphericalJointFlags.raise(flag: PxSphericalJointFlagEnum) = raise(flag.value) +fun PxSphericalJointFlags.clear(flag: PxSphericalJointFlagEnum) = clear(flag.value) -external interface PxSpring { +external interface PxSpring : JsAny, DestroyableNative { /** * Native object address. */ @@ -1442,15 +1359,11 @@ external interface PxSpring { * @param stiffness WebIDL type: float * @param damping WebIDL type: float */ -fun PxSpring(stiffness: Float, damping: Float, _module: dynamic = PhysXJsLoader.physXJs): PxSpring = js("new _module.PxSpring(stiffness, damping)") - -fun PxSpringFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSpring = js("_module.wrapPointer(ptr, _module.PxSpring)") +fun PxSpring(stiffness: Float, damping: Float, _module: JsAny = PhysXJsLoader.physXJs): PxSpring = js("new _module.PxSpring(stiffness, damping)") -fun PxSpring.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSpringFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSpring = js("_module.wrapPointer(ptr, _module.PxSpring)") -external interface PxExtensionTopLevelFunctions { +external interface PxExtensionTopLevelFunctions : JsAny { /** * Native object address. */ @@ -1467,9 +1380,9 @@ external interface PxExtensionTopLevelFunctions { } -fun PxExtensionTopLevelFunctionsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxExtensionTopLevelFunctions = js("_module.wrapPointer(ptr, _module.PxExtensionTopLevelFunctions)") +fun PxExtensionTopLevelFunctionsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxExtensionTopLevelFunctions = js("_module.wrapPointer(ptr, _module.PxExtensionTopLevelFunctions)") -external interface PxCollectionExt { +external interface PxCollectionExt : JsAny, DestroyableNative { /** * Native object address. */ @@ -1507,19 +1420,15 @@ external interface PxCollectionExt { } -fun PxCollectionExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCollectionExt = js("_module.wrapPointer(ptr, _module.PxCollectionExt)") - -fun PxCollectionExt.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxCollectionExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCollectionExt = js("_module.wrapPointer(ptr, _module.PxCollectionExt)") -external interface PxDefaultMemoryInputData : PxInputData { +external interface PxDefaultMemoryInputData : JsAny, DestroyableNative, PxInputData { /** * @param dest WebIDL type: VoidPtr * @param count WebIDL type: unsigned long * @return WebIDL type: unsigned long */ - fun read(dest: Any, count: Int): Int + fun read(dest: JsAny, count: Int): Int /** * @return WebIDL type: unsigned long @@ -1542,23 +1451,19 @@ external interface PxDefaultMemoryInputData : PxInputData { * @param data WebIDL type: [PxU8Ptr] (Ref) * @param length WebIDL type: unsigned long */ -fun PxDefaultMemoryInputData(data: PxU8Ptr, length: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDefaultMemoryInputData = js("new _module.PxDefaultMemoryInputData(data, length)") +fun PxDefaultMemoryInputData(data: PxU8Ptr, length: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDefaultMemoryInputData = js("new _module.PxDefaultMemoryInputData(data, length)") -fun PxDefaultMemoryInputDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDefaultMemoryInputData = js("_module.wrapPointer(ptr, _module.PxDefaultMemoryInputData)") - -fun PxDefaultMemoryInputData.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxDefaultMemoryInputDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDefaultMemoryInputData = js("_module.wrapPointer(ptr, _module.PxDefaultMemoryInputData)") val PxDefaultMemoryInputData.length get() = getLength() -external interface PxDefaultMemoryOutputStream : PxOutputStream { +external interface PxDefaultMemoryOutputStream : JsAny, DestroyableNative, PxOutputStream { /** * @param src WebIDL type: VoidPtr * @param count WebIDL type: unsigned long */ - fun write(src: Any, count: Int) + fun write(src: JsAny, count: Int) /** * @return WebIDL type: unsigned long @@ -1568,24 +1473,20 @@ external interface PxDefaultMemoryOutputStream : PxOutputStream { /** * @return WebIDL type: VoidPtr */ - fun getData(): Any + fun getData(): JsAny } -fun PxDefaultMemoryOutputStream(_module: dynamic = PhysXJsLoader.physXJs): PxDefaultMemoryOutputStream = js("new _module.PxDefaultMemoryOutputStream()") - -fun PxDefaultMemoryOutputStreamFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDefaultMemoryOutputStream = js("_module.wrapPointer(ptr, _module.PxDefaultMemoryOutputStream)") +fun PxDefaultMemoryOutputStream(_module: JsAny = PhysXJsLoader.physXJs): PxDefaultMemoryOutputStream = js("new _module.PxDefaultMemoryOutputStream()") -fun PxDefaultMemoryOutputStream.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxDefaultMemoryOutputStreamFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDefaultMemoryOutputStream = js("_module.wrapPointer(ptr, _module.PxDefaultMemoryOutputStream)") val PxDefaultMemoryOutputStream.size get() = getSize() val PxDefaultMemoryOutputStream.data get() = getData() -external interface PxMassProperties { +external interface PxMassProperties : JsAny, DestroyableNative { /** * Native object address. */ @@ -1649,27 +1550,23 @@ external interface PxMassProperties { } -fun PxMassProperties(_module: dynamic = PhysXJsLoader.physXJs): PxMassProperties = js("new _module.PxMassProperties()") +fun PxMassProperties(_module: JsAny = PhysXJsLoader.physXJs): PxMassProperties = js("new _module.PxMassProperties()") /** * @param m WebIDL type: float * @param inertiaT WebIDL type: [PxMat33] (Const, Ref) * @param com WebIDL type: [PxVec3] (Const, Ref) */ -fun PxMassProperties(m: Float, inertiaT: PxMat33, com: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): PxMassProperties = js("new _module.PxMassProperties(m, inertiaT, com)") +fun PxMassProperties(m: Float, inertiaT: PxMat33, com: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): PxMassProperties = js("new _module.PxMassProperties(m, inertiaT, com)") /** * @param geometry WebIDL type: [PxGeometry] (Const, Ref) */ -fun PxMassProperties(geometry: PxGeometry, _module: dynamic = PhysXJsLoader.physXJs): PxMassProperties = js("new _module.PxMassProperties(geometry)") - -fun PxMassPropertiesFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMassProperties = js("_module.wrapPointer(ptr, _module.PxMassProperties)") +fun PxMassProperties(geometry: PxGeometry, _module: JsAny = PhysXJsLoader.physXJs): PxMassProperties = js("new _module.PxMassProperties(geometry)") -fun PxMassProperties.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxMassPropertiesFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMassProperties = js("_module.wrapPointer(ptr, _module.PxMassProperties)") -external interface PxMeshOverlapUtil { +external interface PxMeshOverlapUtil : JsAny, DestroyableNative { /** * Native object address. */ @@ -1696,20 +1593,16 @@ external interface PxMeshOverlapUtil { } -fun PxMeshOverlapUtil(_module: dynamic = PhysXJsLoader.physXJs): PxMeshOverlapUtil = js("new _module.PxMeshOverlapUtil()") +fun PxMeshOverlapUtil(_module: JsAny = PhysXJsLoader.physXJs): PxMeshOverlapUtil = js("new _module.PxMeshOverlapUtil()") -fun PxMeshOverlapUtilFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMeshOverlapUtil = js("_module.wrapPointer(ptr, _module.PxMeshOverlapUtil)") - -fun PxMeshOverlapUtil.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxMeshOverlapUtilFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMeshOverlapUtil = js("_module.wrapPointer(ptr, _module.PxMeshOverlapUtil)") val PxMeshOverlapUtil.results get() = getResults() val PxMeshOverlapUtil.nbResults get() = getNbResults() -external interface PxRigidActorExt { +external interface PxRigidActorExt : JsAny, DestroyableNative { /** * Native object address. */ @@ -1734,13 +1627,9 @@ external interface PxRigidActorExt { } -fun PxRigidActorExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidActorExt = js("_module.wrapPointer(ptr, _module.PxRigidActorExt)") +fun PxRigidActorExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidActorExt = js("_module.wrapPointer(ptr, _module.PxRigidActorExt)") -fun PxRigidActorExt.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxRigidBodyExt { +external interface PxRigidBodyExt : JsAny, DestroyableNative { /** * Native object address. */ @@ -1807,7 +1696,7 @@ external interface PxRigidBodyExt { * @param pos WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun addForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) + fun addForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1816,7 +1705,7 @@ external interface PxRigidBodyExt { * @param mode WebIDL type: [PxForceModeEnum] (enum) * @param wakeup WebIDL type: boolean */ - fun addForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) + fun addForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int, wakeup: Boolean) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1831,7 +1720,7 @@ external interface PxRigidBodyExt { * @param pos WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun addForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) + fun addForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1840,7 +1729,7 @@ external interface PxRigidBodyExt { * @param mode WebIDL type: [PxForceModeEnum] (enum) * @param wakeup WebIDL type: boolean */ - fun addForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) + fun addForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int, wakeup: Boolean) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1855,7 +1744,7 @@ external interface PxRigidBodyExt { * @param pos WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun addLocalForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) + fun addLocalForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1864,7 +1753,7 @@ external interface PxRigidBodyExt { * @param mode WebIDL type: [PxForceModeEnum] (enum) * @param wakeup WebIDL type: boolean */ - fun addLocalForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) + fun addLocalForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int, wakeup: Boolean) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1879,7 +1768,7 @@ external interface PxRigidBodyExt { * @param pos WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun addLocalForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) + fun addLocalForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int) /** * @param body WebIDL type: [PxRigidBody] (Ref) @@ -1888,7 +1777,7 @@ external interface PxRigidBodyExt { * @param mode WebIDL type: [PxForceModeEnum] (enum) * @param wakeup WebIDL type: boolean */ - fun addLocalForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) + fun addLocalForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: Int, wakeup: Boolean) /** * @param body WebIDL type: [PxRigidBody] (Const, Ref) @@ -1946,13 +1835,18 @@ external interface PxRigidBodyExt { } -fun PxRigidBodyExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidBodyExt = js("_module.wrapPointer(ptr, _module.PxRigidBodyExt)") +fun PxRigidBodyExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidBodyExt = js("_module.wrapPointer(ptr, _module.PxRigidBodyExt)") -fun PxRigidBodyExt.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRigidBodyExt.addForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) = addForceAtPos(body, force, pos, mode.value) +fun PxRigidBodyExt.addForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) = addForceAtPos(body, force, pos, mode.value, wakeup) +fun PxRigidBodyExt.addForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) = addForceAtLocalPos(body, force, pos, mode.value) +fun PxRigidBodyExt.addForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) = addForceAtLocalPos(body, force, pos, mode.value, wakeup) +fun PxRigidBodyExt.addLocalForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) = addLocalForceAtPos(body, force, pos, mode.value) +fun PxRigidBodyExt.addLocalForceAtPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) = addLocalForceAtPos(body, force, pos, mode.value, wakeup) +fun PxRigidBodyExt.addLocalForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum) = addLocalForceAtLocalPos(body, force, pos, mode.value) +fun PxRigidBodyExt.addLocalForceAtLocalPos(body: PxRigidBody, force: PxVec3, pos: PxVec3, mode: PxForceModeEnum, wakeup: Boolean) = addLocalForceAtLocalPos(body, force, pos, mode.value, wakeup) -external interface PxSerialization { +external interface PxSerialization : JsAny, DestroyableNative { /** * Native object address. */ @@ -2022,7 +1916,7 @@ external interface PxSerialization { * @param sr WebIDL type: [PxSerializationRegistry] (Ref) * @return WebIDL type: [PxCollection] */ - fun createCollectionFromBinary(memBlock: Any, sr: PxSerializationRegistry): PxCollection + fun createCollectionFromBinary(memBlock: JsAny, sr: PxSerializationRegistry): PxCollection /** * @param memBlock WebIDL type: VoidPtr @@ -2030,7 +1924,7 @@ external interface PxSerialization { * @param externalRefs WebIDL type: [PxCollection] (Const) * @return WebIDL type: [PxCollection] */ - fun createCollectionFromBinary(memBlock: Any, sr: PxSerializationRegistry, externalRefs: PxCollection): PxCollection + fun createCollectionFromBinary(memBlock: JsAny, sr: PxSerializationRegistry, externalRefs: PxCollection): PxCollection /** * @param outputStream WebIDL type: [PxOutputStream] (Ref) @@ -2094,13 +1988,9 @@ external interface PxSerialization { } -fun PxSerializationFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSerialization = js("_module.wrapPointer(ptr, _module.PxSerialization)") +fun PxSerializationFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSerialization = js("_module.wrapPointer(ptr, _module.PxSerialization)") -fun PxSerialization.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxSerializationRegistry { +external interface PxSerializationRegistry : JsAny { /** * Native object address. */ @@ -2110,76 +2000,164 @@ external interface PxSerializationRegistry { } -fun PxSerializationRegistryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSerializationRegistry = js("_module.wrapPointer(ptr, _module.PxSerializationRegistry)") +fun PxSerializationRegistryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSerializationRegistry = js("_module.wrapPointer(ptr, _module.PxSerializationRegistry)") value class PxD6AxisEnum private constructor(val value: Int) { companion object { - val eX: PxD6AxisEnum = PxD6AxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6AxisEnum_eX()) - val eY: PxD6AxisEnum = PxD6AxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6AxisEnum_eY()) - val eZ: PxD6AxisEnum = PxD6AxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6AxisEnum_eZ()) - val eTWIST: PxD6AxisEnum = PxD6AxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6AxisEnum_eTWIST()) - val eSWING1: PxD6AxisEnum = PxD6AxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6AxisEnum_eSWING1()) - val eSWING2: PxD6AxisEnum = PxD6AxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6AxisEnum_eSWING2()) + val eX: PxD6AxisEnum = PxD6AxisEnum(PxD6AxisEnum_eX(PhysXJsLoader.physXJs)) + val eY: PxD6AxisEnum = PxD6AxisEnum(PxD6AxisEnum_eY(PhysXJsLoader.physXJs)) + val eZ: PxD6AxisEnum = PxD6AxisEnum(PxD6AxisEnum_eZ(PhysXJsLoader.physXJs)) + val eTWIST: PxD6AxisEnum = PxD6AxisEnum(PxD6AxisEnum_eTWIST(PhysXJsLoader.physXJs)) + val eSWING1: PxD6AxisEnum = PxD6AxisEnum(PxD6AxisEnum_eSWING1(PhysXJsLoader.physXJs)) + val eSWING2: PxD6AxisEnum = PxD6AxisEnum(PxD6AxisEnum_eSWING2(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eX.value -> eX + eY.value -> eY + eZ.value -> eZ + eTWIST.value -> eTWIST + eSWING1.value -> eSWING1 + eSWING2.value -> eSWING2 + else -> error("Invalid enum value $value for enum PxD6AxisEnum") + } } } +private fun PxD6AxisEnum_eX(module: JsAny): Int = js("module._emscripten_enum_PxD6AxisEnum_eX()") +private fun PxD6AxisEnum_eY(module: JsAny): Int = js("module._emscripten_enum_PxD6AxisEnum_eY()") +private fun PxD6AxisEnum_eZ(module: JsAny): Int = js("module._emscripten_enum_PxD6AxisEnum_eZ()") +private fun PxD6AxisEnum_eTWIST(module: JsAny): Int = js("module._emscripten_enum_PxD6AxisEnum_eTWIST()") +private fun PxD6AxisEnum_eSWING1(module: JsAny): Int = js("module._emscripten_enum_PxD6AxisEnum_eSWING1()") +private fun PxD6AxisEnum_eSWING2(module: JsAny): Int = js("module._emscripten_enum_PxD6AxisEnum_eSWING2()") + value class PxD6DriveEnum private constructor(val value: Int) { companion object { - val eX: PxD6DriveEnum = PxD6DriveEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6DriveEnum_eX()) - val eY: PxD6DriveEnum = PxD6DriveEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6DriveEnum_eY()) - val eZ: PxD6DriveEnum = PxD6DriveEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6DriveEnum_eZ()) - val eSWING: PxD6DriveEnum = PxD6DriveEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6DriveEnum_eSWING()) - val eTWIST: PxD6DriveEnum = PxD6DriveEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6DriveEnum_eTWIST()) - val eSLERP: PxD6DriveEnum = PxD6DriveEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6DriveEnum_eSLERP()) + val eX: PxD6DriveEnum = PxD6DriveEnum(PxD6DriveEnum_eX(PhysXJsLoader.physXJs)) + val eY: PxD6DriveEnum = PxD6DriveEnum(PxD6DriveEnum_eY(PhysXJsLoader.physXJs)) + val eZ: PxD6DriveEnum = PxD6DriveEnum(PxD6DriveEnum_eZ(PhysXJsLoader.physXJs)) + val eSWING: PxD6DriveEnum = PxD6DriveEnum(PxD6DriveEnum_eSWING(PhysXJsLoader.physXJs)) + val eTWIST: PxD6DriveEnum = PxD6DriveEnum(PxD6DriveEnum_eTWIST(PhysXJsLoader.physXJs)) + val eSLERP: PxD6DriveEnum = PxD6DriveEnum(PxD6DriveEnum_eSLERP(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eX.value -> eX + eY.value -> eY + eZ.value -> eZ + eSWING.value -> eSWING + eTWIST.value -> eTWIST + eSLERP.value -> eSLERP + else -> error("Invalid enum value $value for enum PxD6DriveEnum") + } } } +private fun PxD6DriveEnum_eX(module: JsAny): Int = js("module._emscripten_enum_PxD6DriveEnum_eX()") +private fun PxD6DriveEnum_eY(module: JsAny): Int = js("module._emscripten_enum_PxD6DriveEnum_eY()") +private fun PxD6DriveEnum_eZ(module: JsAny): Int = js("module._emscripten_enum_PxD6DriveEnum_eZ()") +private fun PxD6DriveEnum_eSWING(module: JsAny): Int = js("module._emscripten_enum_PxD6DriveEnum_eSWING()") +private fun PxD6DriveEnum_eTWIST(module: JsAny): Int = js("module._emscripten_enum_PxD6DriveEnum_eTWIST()") +private fun PxD6DriveEnum_eSLERP(module: JsAny): Int = js("module._emscripten_enum_PxD6DriveEnum_eSLERP()") + value class PxD6JointDriveFlagEnum private constructor(val value: Int) { companion object { - val eACCELERATION: PxD6JointDriveFlagEnum = PxD6JointDriveFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6JointDriveFlagEnum_eACCELERATION()) + val eACCELERATION: PxD6JointDriveFlagEnum = PxD6JointDriveFlagEnum(PxD6JointDriveFlagEnum_eACCELERATION(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eACCELERATION.value -> eACCELERATION + else -> error("Invalid enum value $value for enum PxD6JointDriveFlagEnum") + } } } +private fun PxD6JointDriveFlagEnum_eACCELERATION(module: JsAny): Int = js("module._emscripten_enum_PxD6JointDriveFlagEnum_eACCELERATION()") + value class PxD6MotionEnum private constructor(val value: Int) { companion object { - val eLOCKED: PxD6MotionEnum = PxD6MotionEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6MotionEnum_eLOCKED()) - val eLIMITED: PxD6MotionEnum = PxD6MotionEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6MotionEnum_eLIMITED()) - val eFREE: PxD6MotionEnum = PxD6MotionEnum(PhysXJsLoader.physXJs._emscripten_enum_PxD6MotionEnum_eFREE()) + val eLOCKED: PxD6MotionEnum = PxD6MotionEnum(PxD6MotionEnum_eLOCKED(PhysXJsLoader.physXJs)) + val eLIMITED: PxD6MotionEnum = PxD6MotionEnum(PxD6MotionEnum_eLIMITED(PhysXJsLoader.physXJs)) + val eFREE: PxD6MotionEnum = PxD6MotionEnum(PxD6MotionEnum_eFREE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLOCKED.value -> eLOCKED + eLIMITED.value -> eLIMITED + eFREE.value -> eFREE + else -> error("Invalid enum value $value for enum PxD6MotionEnum") + } } } +private fun PxD6MotionEnum_eLOCKED(module: JsAny): Int = js("module._emscripten_enum_PxD6MotionEnum_eLOCKED()") +private fun PxD6MotionEnum_eLIMITED(module: JsAny): Int = js("module._emscripten_enum_PxD6MotionEnum_eLIMITED()") +private fun PxD6MotionEnum_eFREE(module: JsAny): Int = js("module._emscripten_enum_PxD6MotionEnum_eFREE()") + value class PxDistanceJointFlagEnum private constructor(val value: Int) { companion object { - val eMAX_DISTANCE_ENABLED: PxDistanceJointFlagEnum = PxDistanceJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDistanceJointFlagEnum_eMAX_DISTANCE_ENABLED()) - val eMIN_DISTANCE_ENABLED: PxDistanceJointFlagEnum = PxDistanceJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDistanceJointFlagEnum_eMIN_DISTANCE_ENABLED()) - val eSPRING_ENABLED: PxDistanceJointFlagEnum = PxDistanceJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDistanceJointFlagEnum_eSPRING_ENABLED()) + val eMAX_DISTANCE_ENABLED: PxDistanceJointFlagEnum = PxDistanceJointFlagEnum(PxDistanceJointFlagEnum_eMAX_DISTANCE_ENABLED(PhysXJsLoader.physXJs)) + val eMIN_DISTANCE_ENABLED: PxDistanceJointFlagEnum = PxDistanceJointFlagEnum(PxDistanceJointFlagEnum_eMIN_DISTANCE_ENABLED(PhysXJsLoader.physXJs)) + val eSPRING_ENABLED: PxDistanceJointFlagEnum = PxDistanceJointFlagEnum(PxDistanceJointFlagEnum_eSPRING_ENABLED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eMAX_DISTANCE_ENABLED.value -> eMAX_DISTANCE_ENABLED + eMIN_DISTANCE_ENABLED.value -> eMIN_DISTANCE_ENABLED + eSPRING_ENABLED.value -> eSPRING_ENABLED + else -> error("Invalid enum value $value for enum PxDistanceJointFlagEnum") + } } } +private fun PxDistanceJointFlagEnum_eMAX_DISTANCE_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxDistanceJointFlagEnum_eMAX_DISTANCE_ENABLED()") +private fun PxDistanceJointFlagEnum_eMIN_DISTANCE_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxDistanceJointFlagEnum_eMIN_DISTANCE_ENABLED()") +private fun PxDistanceJointFlagEnum_eSPRING_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxDistanceJointFlagEnum_eSPRING_ENABLED()") + value class PxJointActorIndexEnum private constructor(val value: Int) { companion object { - val eACTOR0: PxJointActorIndexEnum = PxJointActorIndexEnum(PhysXJsLoader.physXJs._emscripten_enum_PxJointActorIndexEnum_eACTOR0()) - val eACTOR1: PxJointActorIndexEnum = PxJointActorIndexEnum(PhysXJsLoader.physXJs._emscripten_enum_PxJointActorIndexEnum_eACTOR1()) + val eACTOR0: PxJointActorIndexEnum = PxJointActorIndexEnum(PxJointActorIndexEnum_eACTOR0(PhysXJsLoader.physXJs)) + val eACTOR1: PxJointActorIndexEnum = PxJointActorIndexEnum(PxJointActorIndexEnum_eACTOR1(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eACTOR0.value -> eACTOR0 + eACTOR1.value -> eACTOR1 + else -> error("Invalid enum value $value for enum PxJointActorIndexEnum") + } } } +private fun PxJointActorIndexEnum_eACTOR0(module: JsAny): Int = js("module._emscripten_enum_PxJointActorIndexEnum_eACTOR0()") +private fun PxJointActorIndexEnum_eACTOR1(module: JsAny): Int = js("module._emscripten_enum_PxJointActorIndexEnum_eACTOR1()") + value class PxPrismaticJointFlagEnum private constructor(val value: Int) { companion object { - val eLIMIT_ENABLED: PxPrismaticJointFlagEnum = PxPrismaticJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPrismaticJointFlagEnum_eLIMIT_ENABLED()) + val eLIMIT_ENABLED: PxPrismaticJointFlagEnum = PxPrismaticJointFlagEnum(PxPrismaticJointFlagEnum_eLIMIT_ENABLED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLIMIT_ENABLED.value -> eLIMIT_ENABLED + else -> error("Invalid enum value $value for enum PxPrismaticJointFlagEnum") + } } } +private fun PxPrismaticJointFlagEnum_eLIMIT_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxPrismaticJointFlagEnum_eLIMIT_ENABLED()") + value class PxRevoluteJointFlagEnum private constructor(val value: Int) { companion object { - val eLIMIT_ENABLED: PxRevoluteJointFlagEnum = PxRevoluteJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRevoluteJointFlagEnum_eLIMIT_ENABLED()) - val eDRIVE_ENABLED: PxRevoluteJointFlagEnum = PxRevoluteJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRevoluteJointFlagEnum_eDRIVE_ENABLED()) - val eDRIVE_FREESPIN: PxRevoluteJointFlagEnum = PxRevoluteJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRevoluteJointFlagEnum_eDRIVE_FREESPIN()) + val eLIMIT_ENABLED: PxRevoluteJointFlagEnum = PxRevoluteJointFlagEnum(PxRevoluteJointFlagEnum_eLIMIT_ENABLED(PhysXJsLoader.physXJs)) + val eDRIVE_ENABLED: PxRevoluteJointFlagEnum = PxRevoluteJointFlagEnum(PxRevoluteJointFlagEnum_eDRIVE_ENABLED(PhysXJsLoader.physXJs)) + val eDRIVE_FREESPIN: PxRevoluteJointFlagEnum = PxRevoluteJointFlagEnum(PxRevoluteJointFlagEnum_eDRIVE_FREESPIN(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLIMIT_ENABLED.value -> eLIMIT_ENABLED + eDRIVE_ENABLED.value -> eDRIVE_ENABLED + eDRIVE_FREESPIN.value -> eDRIVE_FREESPIN + else -> error("Invalid enum value $value for enum PxRevoluteJointFlagEnum") + } } } +private fun PxRevoluteJointFlagEnum_eLIMIT_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxRevoluteJointFlagEnum_eLIMIT_ENABLED()") +private fun PxRevoluteJointFlagEnum_eDRIVE_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxRevoluteJointFlagEnum_eDRIVE_ENABLED()") +private fun PxRevoluteJointFlagEnum_eDRIVE_FREESPIN(module: JsAny): Int = js("module._emscripten_enum_PxRevoluteJointFlagEnum_eDRIVE_FREESPIN()") + value class PxSphericalJointFlagEnum private constructor(val value: Int) { companion object { - val eLIMIT_ENABLED: PxSphericalJointFlagEnum = PxSphericalJointFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSphericalJointFlagEnum_eLIMIT_ENABLED()) + val eLIMIT_ENABLED: PxSphericalJointFlagEnum = PxSphericalJointFlagEnum(PxSphericalJointFlagEnum_eLIMIT_ENABLED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLIMIT_ENABLED.value -> eLIMIT_ENABLED + else -> error("Invalid enum value $value for enum PxSphericalJointFlagEnum") + } } } +private fun PxSphericalJointFlagEnum_eLIMIT_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxSphericalJointFlagEnum_eLIMIT_ENABLED()") + diff --git a/kool-physics/src/jsMain/kotlin/physx/Geometry.kt b/kool-physics/src/webMain/kotlin/physx/Geometry.kt similarity index 53% rename from kool-physics/src/jsMain/kotlin/physx/Geometry.kt rename to kool-physics/src/webMain/kotlin/physx/Geometry.kt index abc8d5447..7c6c118f6 100644 --- a/kool-physics/src/jsMain/kotlin/physx/Geometry.kt +++ b/kool-physics/src/webMain/kotlin/physx/Geometry.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxBoxGeometry : PxGeometry { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxBoxGeometry : JsAny, DestroyableNative, PxGeometry { /** * WebIDL type: [PxVec3] (Value) */ @@ -17,19 +20,15 @@ external interface PxBoxGeometry : PxGeometry { * @param hy WebIDL type: float * @param hz WebIDL type: float */ -fun PxBoxGeometry(hx: Float, hy: Float, hz: Float, _module: dynamic = PhysXJsLoader.physXJs): PxBoxGeometry = js("new _module.PxBoxGeometry(hx, hy, hz)") - -fun PxBoxGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBoxGeometry = js("_module.wrapPointer(ptr, _module.PxBoxGeometry)") +fun PxBoxGeometry(hx: Float, hy: Float, hz: Float, _module: JsAny = PhysXJsLoader.physXJs): PxBoxGeometry = js("new _module.PxBoxGeometry(hx, hy, hz)") -fun PxBoxGeometry.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBoxGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBoxGeometry = js("_module.wrapPointer(ptr, _module.PxBoxGeometry)") -external interface PxBVH : PxBase +external interface PxBVH : JsAny, PxBase -fun PxBVHFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBVH = js("_module.wrapPointer(ptr, _module.PxBVH)") +fun PxBVHFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBVH = js("_module.wrapPointer(ptr, _module.PxBVH)") -external interface PxCapsuleGeometry : PxGeometry { +external interface PxCapsuleGeometry : JsAny, DestroyableNative, PxGeometry { /** * WebIDL type: float */ @@ -44,15 +43,11 @@ external interface PxCapsuleGeometry : PxGeometry { * @param radius WebIDL type: float * @param halfHeight WebIDL type: float */ -fun PxCapsuleGeometry(radius: Float, halfHeight: Float, _module: dynamic = PhysXJsLoader.physXJs): PxCapsuleGeometry = js("new _module.PxCapsuleGeometry(radius, halfHeight)") +fun PxCapsuleGeometry(radius: Float, halfHeight: Float, _module: JsAny = PhysXJsLoader.physXJs): PxCapsuleGeometry = js("new _module.PxCapsuleGeometry(radius, halfHeight)") -fun PxCapsuleGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxCapsuleGeometry = js("_module.wrapPointer(ptr, _module.PxCapsuleGeometry)") +fun PxCapsuleGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxCapsuleGeometry = js("_module.wrapPointer(ptr, _module.PxCapsuleGeometry)") -fun PxCapsuleGeometry.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxContactBuffer { +external interface PxContactBuffer : JsAny, DestroyableNative { /** * Native object address. */ @@ -103,16 +98,12 @@ external interface PxContactBuffer { } -fun PxContactBufferFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactBuffer = js("_module.wrapPointer(ptr, _module.PxContactBuffer)") - -fun PxContactBuffer.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxContactBufferFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactBuffer = js("_module.wrapPointer(ptr, _module.PxContactBuffer)") inline fun PxContactBuffer.getContacts(index: Int) = get_contacts(index) inline fun PxContactBuffer.setContacts(index: Int, value: PxContactPoint) = set_contacts(index, value) -external interface PxContactPoint { +external interface PxContactPoint : JsAny, DestroyableNative { /** * Native object address. */ @@ -164,15 +155,210 @@ external interface PxContactPoint { var damping: Float } -fun PxContactPoint(_module: dynamic = PhysXJsLoader.physXJs): PxContactPoint = js("new _module.PxContactPoint()") +fun PxContactPoint(_module: JsAny = PhysXJsLoader.physXJs): PxContactPoint = js("new _module.PxContactPoint()") + +fun PxContactPointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactPoint = js("_module.wrapPointer(ptr, _module.PxContactPoint)") -fun PxContactPointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactPoint = js("_module.wrapPointer(ptr, _module.PxContactPoint)") +external interface PxConvexCoreBox : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [PxVec3] (Value) + */ + var extents: PxVec3 +} + +/** + * @param eX WebIDL type: float + * @param eY WebIDL type: float + * @param eZ WebIDL type: float + */ +fun PxConvexCoreBox(eX: Float, eY: Float, eZ: Float, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreBox = js("new _module.PxConvexCoreBox(eX, eY, eZ)") + +fun PxConvexCoreBoxFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreBox = js("_module.wrapPointer(ptr, _module.PxConvexCoreBox)") + +external interface PxConvexCoreCone : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int -fun PxContactPoint.destroy() { - PhysXJsLoader.destroy(this) + /** + * WebIDL type: float + */ + var height: Float + /** + * WebIDL type: float + */ + var radius: Float } -external interface PxConvexMesh : PxRefCounted { +/** + * @param height WebIDL type: float + * @param radius WebIDL type: float + */ +fun PxConvexCoreCone(height: Float, radius: Float, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreCone = js("new _module.PxConvexCoreCone(height, radius)") + +fun PxConvexCoreConeFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreCone = js("_module.wrapPointer(ptr, _module.PxConvexCoreCone)") + +external interface PxConvexCoreCylinder : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: float + */ + var height: Float + /** + * WebIDL type: float + */ + var radius: Float +} + +/** + * @param height WebIDL type: float + * @param radius WebIDL type: float + */ +fun PxConvexCoreCylinder(height: Float, radius: Float, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreCylinder = js("new _module.PxConvexCoreCylinder(height, radius)") + +fun PxConvexCoreCylinderFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreCylinder = js("_module.wrapPointer(ptr, _module.PxConvexCoreCylinder)") + +external interface PxConvexCoreEllipsoid : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: [PxVec3] (Value) + */ + var radii: PxVec3 +} + +/** + * @param rX WebIDL type: float + * @param rY WebIDL type: float + * @param rZ WebIDL type: float + */ +fun PxConvexCoreEllipsoid(rX: Float, rY: Float, rZ: Float, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreEllipsoid = js("new _module.PxConvexCoreEllipsoid(rX, rY, rZ)") + +fun PxConvexCoreEllipsoidFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreEllipsoid = js("_module.wrapPointer(ptr, _module.PxConvexCoreEllipsoid)") + +external interface PxConvexCorePoint : JsAny, DestroyableNative + +fun PxConvexCorePoint(_module: JsAny = PhysXJsLoader.physXJs): PxConvexCorePoint = js("new _module.PxConvexCorePoint()") + +fun PxConvexCorePointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCorePoint = js("_module.wrapPointer(ptr, _module.PxConvexCorePoint)") + +external interface PxConvexCoreSegment : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * WebIDL type: float + */ + var length: Float +} + +/** + * @param length WebIDL type: float + */ +fun PxConvexCoreSegment(length: Float, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreSegment = js("new _module.PxConvexCoreSegment(length)") + +fun PxConvexCoreSegmentFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreSegment = js("_module.wrapPointer(ptr, _module.PxConvexCoreSegment)") + +external interface PxConvexCoreGeometry : JsAny, DestroyableNative, PxGeometry { + /** + * @return WebIDL type: [PxConvexCoreTypeEnum] (enum) + */ + fun getCoreType(): Int + + /** + * @return WebIDL type: VoidPtr (Const) + */ + fun getCoreData(): JsAny + + /** + * @return WebIDL type: float + */ + fun getMargin(): Float + + /** + * @return WebIDL type: boolean + */ + fun isValid(): Boolean + +} + +fun PxConvexCoreGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreGeometry = js("_module.wrapPointer(ptr, _module.PxConvexCoreGeometry)") + +val PxConvexCoreGeometry.coreType: PxConvexCoreTypeEnum + get() = PxConvexCoreTypeEnum.forValue(getCoreType()) +val PxConvexCoreGeometry.coreData + get() = getCoreData() +val PxConvexCoreGeometry.margin + get() = getMargin() + +external interface PxConvexCoreGeometryFactory : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param box WebIDL type: [PxConvexCoreBox] (Const, Ref) + * @param margin WebIDL type: float + * @return WebIDL type: [PxConvexCoreGeometry] + */ + fun createFromBox(box: PxConvexCoreBox, margin: Float): PxConvexCoreGeometry + + /** + * @param cone WebIDL type: [PxConvexCoreCone] (Const, Ref) + * @param margin WebIDL type: float + * @return WebIDL type: [PxConvexCoreGeometry] + */ + fun createFromCone(cone: PxConvexCoreCone, margin: Float): PxConvexCoreGeometry + + /** + * @param cylinder WebIDL type: [PxConvexCoreCylinder] (Const, Ref) + * @param margin WebIDL type: float + * @return WebIDL type: [PxConvexCoreGeometry] + */ + fun createFromCylinder(cylinder: PxConvexCoreCylinder, margin: Float): PxConvexCoreGeometry + + /** + * @param ellipsoid WebIDL type: [PxConvexCoreEllipsoid] (Const, Ref) + * @param margin WebIDL type: float + * @return WebIDL type: [PxConvexCoreGeometry] + */ + fun createFromEllipsoid(ellipsoid: PxConvexCoreEllipsoid, margin: Float): PxConvexCoreGeometry + + /** + * @param point WebIDL type: [PxConvexCorePoint] (Const, Ref) + * @param margin WebIDL type: float + * @return WebIDL type: [PxConvexCoreGeometry] + */ + fun createFromPoint(point: PxConvexCorePoint, margin: Float): PxConvexCoreGeometry + + /** + * @param segment WebIDL type: [PxConvexCoreSegment] (Const, Ref) + * @param margin WebIDL type: float + * @return WebIDL type: [PxConvexCoreGeometry] + */ + fun createFromSegment(segment: PxConvexCoreSegment, margin: Float): PxConvexCoreGeometry + +} + +fun PxConvexCoreGeometryFactoryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexCoreGeometryFactory = js("_module.wrapPointer(ptr, _module.PxConvexCoreGeometryFactory)") + +external interface PxConvexMesh : JsAny, PxRefCounted { /** * @return WebIDL type: unsigned long */ @@ -212,7 +398,7 @@ external interface PxConvexMesh : PxRefCounted { } -fun PxConvexMeshFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMesh = js("_module.wrapPointer(ptr, _module.PxConvexMesh)") +fun PxConvexMeshFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMesh = js("_module.wrapPointer(ptr, _module.PxConvexMesh)") val PxConvexMesh.nbVertices get() = getNbVertices() @@ -225,7 +411,7 @@ val PxConvexMesh.nbPolygons val PxConvexMesh.localBounds get() = getLocalBounds() -external interface PxConvexMeshGeometry : PxGeometry { +external interface PxConvexMeshGeometry : JsAny, DestroyableNative, PxGeometry { /** * WebIDL type: [PxMeshScale] (Value) */ @@ -243,28 +429,24 @@ external interface PxConvexMeshGeometry : PxGeometry { /** * @param mesh WebIDL type: [PxConvexMesh] */ -fun PxConvexMeshGeometry(mesh: PxConvexMesh, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("new _module.PxConvexMeshGeometry(mesh)") +fun PxConvexMeshGeometry(mesh: PxConvexMesh, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("new _module.PxConvexMeshGeometry(mesh)") /** * @param mesh WebIDL type: [PxConvexMesh] * @param scaling WebIDL type: [PxMeshScale] (Const, Ref) */ -fun PxConvexMeshGeometry(mesh: PxConvexMesh, scaling: PxMeshScale, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("new _module.PxConvexMeshGeometry(mesh, scaling)") +fun PxConvexMeshGeometry(mesh: PxConvexMesh, scaling: PxMeshScale, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("new _module.PxConvexMeshGeometry(mesh, scaling)") /** * @param mesh WebIDL type: [PxConvexMesh] * @param scaling WebIDL type: [PxMeshScale] (Const, Ref) * @param flags WebIDL type: [PxConvexMeshGeometryFlags] (Ref) */ -fun PxConvexMeshGeometry(mesh: PxConvexMesh, scaling: PxMeshScale, flags: PxConvexMeshGeometryFlags, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("new _module.PxConvexMeshGeometry(mesh, scaling, flags)") - -fun PxConvexMeshGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("_module.wrapPointer(ptr, _module.PxConvexMeshGeometry)") +fun PxConvexMeshGeometry(mesh: PxConvexMesh, scaling: PxMeshScale, flags: PxConvexMeshGeometryFlags, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("new _module.PxConvexMeshGeometry(mesh, scaling, flags)") -fun PxConvexMeshGeometry.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxConvexMeshGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshGeometry = js("_module.wrapPointer(ptr, _module.PxConvexMeshGeometry)") -external interface PxConvexMeshGeometryFlags { +external interface PxConvexMeshGeometryFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -274,32 +456,32 @@ external interface PxConvexMeshGeometryFlags { * @param flag WebIDL type: [PxConvexMeshGeometryFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxConvexMeshGeometryFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxConvexMeshGeometryFlagEnum] (enum) */ - fun raise(flag: PxConvexMeshGeometryFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxConvexMeshGeometryFlagEnum] (enum) */ - fun clear(flag: PxConvexMeshGeometryFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxConvexMeshGeometryFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshGeometryFlags = js("new _module.PxConvexMeshGeometryFlags(flags)") +fun PxConvexMeshGeometryFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshGeometryFlags = js("new _module.PxConvexMeshGeometryFlags(flags)") -fun PxConvexMeshGeometryFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConvexMeshGeometryFlags = js("_module.wrapPointer(ptr, _module.PxConvexMeshGeometryFlags)") +fun PxConvexMeshGeometryFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConvexMeshGeometryFlags = js("_module.wrapPointer(ptr, _module.PxConvexMeshGeometryFlags)") -fun PxConvexMeshGeometryFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxConvexMeshGeometryFlags.isSet(flag: PxConvexMeshGeometryFlagEnum) = isSet(flag.value) +fun PxConvexMeshGeometryFlags.raise(flag: PxConvexMeshGeometryFlagEnum) = raise(flag.value) +fun PxConvexMeshGeometryFlags.clear(flag: PxConvexMeshGeometryFlagEnum) = clear(flag.value) -external interface PxGeometry { +external interface PxGeometry : JsAny, DestroyableNative { /** * Native object address. */ @@ -308,20 +490,16 @@ external interface PxGeometry { /** * @return WebIDL type: [PxGeometryTypeEnum] (enum) */ - fun getType(): PxGeometryTypeEnum + fun getType(): Int } -fun PxGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGeometry = js("_module.wrapPointer(ptr, _module.PxGeometry)") - -fun PxGeometry.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGeometry = js("_module.wrapPointer(ptr, _module.PxGeometry)") -val PxGeometry.type - get() = getType() +val PxGeometry.type: PxGeometryTypeEnum + get() = PxGeometryTypeEnum.forValue(getType()) -external interface PxGeometryHolder { +external interface PxGeometryHolder : JsAny, DestroyableNative { /** * Native object address. */ @@ -330,7 +508,7 @@ external interface PxGeometryHolder { /** * @return WebIDL type: [PxGeometryTypeEnum] (enum) */ - fun getType(): PxGeometryTypeEnum + fun getType(): Int /** * @return WebIDL type: [PxSphereGeometry] (Ref) @@ -374,23 +552,19 @@ external interface PxGeometryHolder { } -fun PxGeometryHolder(_module: dynamic = PhysXJsLoader.physXJs): PxGeometryHolder = js("new _module.PxGeometryHolder()") +fun PxGeometryHolder(_module: JsAny = PhysXJsLoader.physXJs): PxGeometryHolder = js("new _module.PxGeometryHolder()") /** * @param geometry WebIDL type: [PxGeometry] (Const, Ref) */ -fun PxGeometryHolder(geometry: PxGeometry, _module: dynamic = PhysXJsLoader.physXJs): PxGeometryHolder = js("new _module.PxGeometryHolder(geometry)") - -fun PxGeometryHolderFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGeometryHolder = js("_module.wrapPointer(ptr, _module.PxGeometryHolder)") +fun PxGeometryHolder(geometry: PxGeometry, _module: JsAny = PhysXJsLoader.physXJs): PxGeometryHolder = js("new _module.PxGeometryHolder(geometry)") -fun PxGeometryHolder.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGeometryHolderFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGeometryHolder = js("_module.wrapPointer(ptr, _module.PxGeometryHolder)") -val PxGeometryHolder.type - get() = getType() +val PxGeometryHolder.type: PxGeometryTypeEnum + get() = PxGeometryTypeEnum.forValue(getType()) -external interface PxGeometryQuery { +external interface PxGeometryQuery : JsAny, DestroyableNative { /** * Native object address. */ @@ -497,19 +671,15 @@ external interface PxGeometryQuery { } -fun PxGeometryQueryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGeometryQuery = js("_module.wrapPointer(ptr, _module.PxGeometryQuery)") +fun PxGeometryQueryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGeometryQuery = js("_module.wrapPointer(ptr, _module.PxGeometryQuery)") -fun PxGeometryQuery.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxHeightField : PxRefCounted { +external interface PxHeightField : JsAny, PxRefCounted { /** * @param destBuffer WebIDL type: VoidPtr * @param destBufferSize WebIDL type: unsigned long * @return WebIDL type: unsigned long */ - fun saveCells(destBuffer: Any, destBufferSize: Int): Int + fun saveCells(destBuffer: JsAny, destBufferSize: Int): Int /** * @param startCol WebIDL type: long @@ -541,7 +711,7 @@ external interface PxHeightField : PxRefCounted { /** * @return WebIDL type: [PxHeightFieldFormatEnum] (enum) */ - fun getFormat(): PxHeightFieldFormatEnum + fun getFormat(): Int /** * @return WebIDL type: unsigned long @@ -591,14 +761,14 @@ external interface PxHeightField : PxRefCounted { } -fun PxHeightFieldFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHeightField = js("_module.wrapPointer(ptr, _module.PxHeightField)") +fun PxHeightFieldFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHeightField = js("_module.wrapPointer(ptr, _module.PxHeightField)") val PxHeightField.nbRows get() = getNbRows() val PxHeightField.nbColumns get() = getNbColumns() -val PxHeightField.format - get() = getFormat() +val PxHeightField.format: PxHeightFieldFormatEnum + get() = PxHeightFieldFormatEnum.forValue(getFormat()) val PxHeightField.sampleStride get() = getSampleStride() val PxHeightField.convexEdgeThreshold @@ -608,7 +778,7 @@ val PxHeightField.flags val PxHeightField.timestamp get() = getTimestamp() -external interface PxHeightFieldDesc { +external interface PxHeightFieldDesc : JsAny, DestroyableNative { /** * Native object address. */ @@ -625,7 +795,7 @@ external interface PxHeightFieldDesc { /** * WebIDL type: [PxHeightFieldFormatEnum] (enum) */ - var format: PxHeightFieldFormatEnum + var format: Int /** * WebIDL type: [PxStridedData] (Value) */ @@ -648,15 +818,15 @@ external interface PxHeightFieldDesc { } -fun PxHeightFieldDesc(_module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldDesc = js("new _module.PxHeightFieldDesc()") +fun PxHeightFieldDesc(_module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldDesc = js("new _module.PxHeightFieldDesc()") -fun PxHeightFieldDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldDesc = js("_module.wrapPointer(ptr, _module.PxHeightFieldDesc)") +fun PxHeightFieldDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldDesc = js("_module.wrapPointer(ptr, _module.PxHeightFieldDesc)") -fun PxHeightFieldDesc.destroy() { - PhysXJsLoader.destroy(this) -} +var PxHeightFieldDesc.formatEnum: PxHeightFieldFormatEnum + get() = PxHeightFieldFormatEnum.forValue(format) + set(value) { format = value.value } -external interface PxHeightFieldFlags { +external interface PxHeightFieldFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -666,32 +836,32 @@ external interface PxHeightFieldFlags { * @param flag WebIDL type: [PxHeightFieldFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxHeightFieldFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxHeightFieldFlagEnum] (enum) */ - fun raise(flag: PxHeightFieldFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxHeightFieldFlagEnum] (enum) */ - fun clear(flag: PxHeightFieldFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxHeightFieldFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldFlags = js("new _module.PxHeightFieldFlags(flags)") +fun PxHeightFieldFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldFlags = js("new _module.PxHeightFieldFlags(flags)") -fun PxHeightFieldFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldFlags = js("_module.wrapPointer(ptr, _module.PxHeightFieldFlags)") +fun PxHeightFieldFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldFlags = js("_module.wrapPointer(ptr, _module.PxHeightFieldFlags)") -fun PxHeightFieldFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxHeightFieldFlags.isSet(flag: PxHeightFieldFlagEnum) = isSet(flag.value) +fun PxHeightFieldFlags.raise(flag: PxHeightFieldFlagEnum) = raise(flag.value) +fun PxHeightFieldFlags.clear(flag: PxHeightFieldFlagEnum) = clear(flag.value) -external interface PxHeightFieldGeometry : PxGeometry { +external interface PxHeightFieldGeometry : JsAny, DestroyableNative, PxGeometry { /** * WebIDL type: [PxHeightField] */ @@ -720,7 +890,7 @@ external interface PxHeightFieldGeometry : PxGeometry { } -fun PxHeightFieldGeometry(_module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldGeometry = js("new _module.PxHeightFieldGeometry()") +fun PxHeightFieldGeometry(_module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldGeometry = js("new _module.PxHeightFieldGeometry()") /** * @param hf WebIDL type: [PxHeightField] @@ -729,15 +899,11 @@ fun PxHeightFieldGeometry(_module: dynamic = PhysXJsLoader.physXJs): PxHeightFie * @param rowScale WebIDL type: float * @param columnScale WebIDL type: float */ -fun PxHeightFieldGeometry(hf: PxHeightField, flags: PxMeshGeometryFlags, heightScale: Float, rowScale: Float, columnScale: Float, _module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldGeometry = js("new _module.PxHeightFieldGeometry(hf, flags, heightScale, rowScale, columnScale)") - -fun PxHeightFieldGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldGeometry = js("_module.wrapPointer(ptr, _module.PxHeightFieldGeometry)") +fun PxHeightFieldGeometry(hf: PxHeightField, flags: PxMeshGeometryFlags, heightScale: Float, rowScale: Float, columnScale: Float, _module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldGeometry = js("new _module.PxHeightFieldGeometry(hf, flags, heightScale, rowScale, columnScale)") -fun PxHeightFieldGeometry.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxHeightFieldGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldGeometry = js("_module.wrapPointer(ptr, _module.PxHeightFieldGeometry)") -external interface PxHeightFieldSample { +external interface PxHeightFieldSample : JsAny, DestroyableNative { /** * Native object address. */ @@ -767,15 +933,11 @@ external interface PxHeightFieldSample { } -fun PxHeightFieldSample(_module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldSample = js("new _module.PxHeightFieldSample()") +fun PxHeightFieldSample(_module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldSample = js("new _module.PxHeightFieldSample()") -fun PxHeightFieldSampleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHeightFieldSample = js("_module.wrapPointer(ptr, _module.PxHeightFieldSample)") +fun PxHeightFieldSampleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHeightFieldSample = js("_module.wrapPointer(ptr, _module.PxHeightFieldSample)") -fun PxHeightFieldSample.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxHullPolygon { +external interface PxHullPolygon : JsAny, DestroyableNative { /** * Native object address. */ @@ -796,18 +958,14 @@ external interface PxHullPolygon { var mIndexBase: Short } -fun PxHullPolygon(_module: dynamic = PhysXJsLoader.physXJs): PxHullPolygon = js("new _module.PxHullPolygon()") +fun PxHullPolygon(_module: JsAny = PhysXJsLoader.physXJs): PxHullPolygon = js("new _module.PxHullPolygon()") -fun PxHullPolygonFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHullPolygon = js("_module.wrapPointer(ptr, _module.PxHullPolygon)") - -fun PxHullPolygon.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxHullPolygonFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHullPolygon = js("_module.wrapPointer(ptr, _module.PxHullPolygon)") inline fun PxHullPolygon.getMPlane(index: Int) = get_mPlane(index) inline fun PxHullPolygon.setMPlane(index: Int, value: Float) = set_mPlane(index, value) -external interface PxMeshFlags { +external interface PxMeshFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -817,32 +975,32 @@ external interface PxMeshFlags { * @param flag WebIDL type: [PxMeshFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxMeshFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxMeshFlagEnum] (enum) */ - fun raise(flag: PxMeshFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxMeshFlagEnum] (enum) */ - fun clear(flag: PxMeshFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxMeshFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxMeshFlags = js("new _module.PxMeshFlags(flags)") +fun PxMeshFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxMeshFlags = js("new _module.PxMeshFlags(flags)") -fun PxMeshFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMeshFlags = js("_module.wrapPointer(ptr, _module.PxMeshFlags)") +fun PxMeshFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMeshFlags = js("_module.wrapPointer(ptr, _module.PxMeshFlags)") -fun PxMeshFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxMeshFlags.isSet(flag: PxMeshFlagEnum) = isSet(flag.value) +fun PxMeshFlags.raise(flag: PxMeshFlagEnum) = raise(flag.value) +fun PxMeshFlags.clear(flag: PxMeshFlagEnum) = clear(flag.value) -external interface PxMeshGeometryFlags { +external interface PxMeshGeometryFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -852,63 +1010,55 @@ external interface PxMeshGeometryFlags { * @param flag WebIDL type: [PxMeshGeometryFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxMeshGeometryFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxMeshGeometryFlagEnum] (enum) */ - fun raise(flag: PxMeshGeometryFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxMeshGeometryFlagEnum] (enum) */ - fun clear(flag: PxMeshGeometryFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxMeshGeometryFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxMeshGeometryFlags = js("new _module.PxMeshGeometryFlags(flags)") +fun PxMeshGeometryFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxMeshGeometryFlags = js("new _module.PxMeshGeometryFlags(flags)") -fun PxMeshGeometryFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMeshGeometryFlags = js("_module.wrapPointer(ptr, _module.PxMeshGeometryFlags)") +fun PxMeshGeometryFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMeshGeometryFlags = js("_module.wrapPointer(ptr, _module.PxMeshGeometryFlags)") -fun PxMeshGeometryFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxMeshGeometryFlags.isSet(flag: PxMeshGeometryFlagEnum) = isSet(flag.value) +fun PxMeshGeometryFlags.raise(flag: PxMeshGeometryFlagEnum) = raise(flag.value) +fun PxMeshGeometryFlags.clear(flag: PxMeshGeometryFlagEnum) = clear(flag.value) -external interface PxMeshScale +external interface PxMeshScale : JsAny, DestroyableNative -fun PxMeshScale(_module: dynamic = PhysXJsLoader.physXJs): PxMeshScale = js("new _module.PxMeshScale()") +fun PxMeshScale(_module: JsAny = PhysXJsLoader.physXJs): PxMeshScale = js("new _module.PxMeshScale()") /** * @param r WebIDL type: float */ -fun PxMeshScale(r: Float, _module: dynamic = PhysXJsLoader.physXJs): PxMeshScale = js("new _module.PxMeshScale(r)") +fun PxMeshScale(r: Float, _module: JsAny = PhysXJsLoader.physXJs): PxMeshScale = js("new _module.PxMeshScale(r)") /** * @param s WebIDL type: [PxVec3] (Const, Ref) * @param r WebIDL type: [PxQuat] (Const, Ref) */ -fun PxMeshScale(s: PxVec3, r: PxQuat, _module: dynamic = PhysXJsLoader.physXJs): PxMeshScale = js("new _module.PxMeshScale(s, r)") +fun PxMeshScale(s: PxVec3, r: PxQuat, _module: JsAny = PhysXJsLoader.physXJs): PxMeshScale = js("new _module.PxMeshScale(s, r)") -fun PxMeshScaleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMeshScale = js("_module.wrapPointer(ptr, _module.PxMeshScale)") +fun PxMeshScaleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMeshScale = js("_module.wrapPointer(ptr, _module.PxMeshScale)") -fun PxMeshScale.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxPlaneGeometry : PxGeometry +external interface PxPlaneGeometry : JsAny, DestroyableNative, PxGeometry -fun PxPlaneGeometry(_module: dynamic = PhysXJsLoader.physXJs): PxPlaneGeometry = js("new _module.PxPlaneGeometry()") +fun PxPlaneGeometry(_module: JsAny = PhysXJsLoader.physXJs): PxPlaneGeometry = js("new _module.PxPlaneGeometry()") -fun PxPlaneGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPlaneGeometry = js("_module.wrapPointer(ptr, _module.PxPlaneGeometry)") +fun PxPlaneGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPlaneGeometry = js("_module.wrapPointer(ptr, _module.PxPlaneGeometry)") -fun PxPlaneGeometry.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxSimpleTriangleMesh { +external interface PxSimpleTriangleMesh : JsAny, DestroyableNative { /** * Native object address. */ @@ -936,15 +1086,11 @@ external interface PxSimpleTriangleMesh { } -fun PxSimpleTriangleMesh(_module: dynamic = PhysXJsLoader.physXJs): PxSimpleTriangleMesh = js("new _module.PxSimpleTriangleMesh()") - -fun PxSimpleTriangleMeshFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSimpleTriangleMesh = js("_module.wrapPointer(ptr, _module.PxSimpleTriangleMesh)") +fun PxSimpleTriangleMesh(_module: JsAny = PhysXJsLoader.physXJs): PxSimpleTriangleMesh = js("new _module.PxSimpleTriangleMesh()") -fun PxSimpleTriangleMesh.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSimpleTriangleMeshFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSimpleTriangleMesh = js("_module.wrapPointer(ptr, _module.PxSimpleTriangleMesh)") -external interface PxSphereGeometry : PxGeometry { +external interface PxSphereGeometry : JsAny, DestroyableNative, PxGeometry { /** * WebIDL type: float */ @@ -954,15 +1100,11 @@ external interface PxSphereGeometry : PxGeometry { /** * @param ir WebIDL type: float */ -fun PxSphereGeometry(ir: Float, _module: dynamic = PhysXJsLoader.physXJs): PxSphereGeometry = js("new _module.PxSphereGeometry(ir)") +fun PxSphereGeometry(ir: Float, _module: JsAny = PhysXJsLoader.physXJs): PxSphereGeometry = js("new _module.PxSphereGeometry(ir)") -fun PxSphereGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSphereGeometry = js("_module.wrapPointer(ptr, _module.PxSphereGeometry)") - -fun PxSphereGeometry.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSphereGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSphereGeometry = js("_module.wrapPointer(ptr, _module.PxSphereGeometry)") -external interface PxTetMaker { +external interface PxTetMaker : JsAny { /** * Native object address. */ @@ -1178,9 +1320,9 @@ external interface PxTetMaker { } -fun PxTetMakerFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetMaker = js("_module.wrapPointer(ptr, _module.PxTetMaker)") +fun PxTetMakerFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetMaker = js("_module.wrapPointer(ptr, _module.PxTetMaker)") -external interface PxTetrahedronMeshAnalysisResults { +external interface PxTetrahedronMeshAnalysisResults : JsAny, DestroyableNative { /** * Native object address. */ @@ -1190,32 +1332,32 @@ external interface PxTetrahedronMeshAnalysisResults { * @param flag WebIDL type: [PxTetrahedronMeshAnalysisResultEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxTetrahedronMeshAnalysisResultEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxTetrahedronMeshAnalysisResultEnum] (enum) */ - fun raise(flag: PxTetrahedronMeshAnalysisResultEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxTetrahedronMeshAnalysisResultEnum] (enum) */ - fun clear(flag: PxTetrahedronMeshAnalysisResultEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned long */ -fun PxTetrahedronMeshAnalysisResults(flags: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshAnalysisResults = js("new _module.PxTetrahedronMeshAnalysisResults(flags)") +fun PxTetrahedronMeshAnalysisResults(flags: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshAnalysisResults = js("new _module.PxTetrahedronMeshAnalysisResults(flags)") -fun PxTetrahedronMeshAnalysisResultsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshAnalysisResults = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshAnalysisResults)") +fun PxTetrahedronMeshAnalysisResultsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshAnalysisResults = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshAnalysisResults)") -fun PxTetrahedronMeshAnalysisResults.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTetrahedronMeshAnalysisResults.isSet(flag: PxTetrahedronMeshAnalysisResultEnum) = isSet(flag.value) +fun PxTetrahedronMeshAnalysisResults.raise(flag: PxTetrahedronMeshAnalysisResultEnum) = raise(flag.value) +fun PxTetrahedronMeshAnalysisResults.clear(flag: PxTetrahedronMeshAnalysisResultEnum) = clear(flag.value) -external interface PxTetrahedronMeshDesc { +external interface PxTetrahedronMeshDesc : JsAny, DestroyableNative { /** * Native object address. */ @@ -1249,20 +1391,20 @@ external interface PxTetrahedronMeshDesc { } -fun PxTetrahedronMeshDesc(_module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc()") +fun PxTetrahedronMeshDesc(_module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc()") /** * @param meshVertices WebIDL type: [PxArray_PxVec3] (Ref) * @param meshTetIndices WebIDL type: [PxArray_PxU32] (Ref) */ -fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_PxU32, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc(meshVertices, meshTetIndices)") +fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_PxU32, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc(meshVertices, meshTetIndices)") /** * @param meshVertices WebIDL type: [PxArray_PxVec3] (Ref) * @param meshTetIndices WebIDL type: [PxArray_PxU32] (Ref) * @param meshFormat WebIDL type: [PxTetrahedronMeshFormatEnum] (enum) */ -fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_PxU32, meshFormat: PxTetrahedronMeshFormatEnum, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc(meshVertices, meshTetIndices, meshFormat)") +fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_PxU32, meshFormat: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc(meshVertices, meshTetIndices, meshFormat)") /** * @param meshVertices WebIDL type: [PxArray_PxVec3] (Ref) @@ -1270,15 +1412,11 @@ fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_ * @param meshFormat WebIDL type: [PxTetrahedronMeshFormatEnum] (enum) * @param numberOfTetsPerHexElement WebIDL type: unsigned short */ -fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_PxU32, meshFormat: PxTetrahedronMeshFormatEnum, numberOfTetsPerHexElement: Short, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc(meshVertices, meshTetIndices, meshFormat, numberOfTetsPerHexElement)") - -fun PxTetrahedronMeshDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshDesc)") +fun PxTetrahedronMeshDesc(meshVertices: PxArray_PxVec3, meshTetIndices: PxArray_PxU32, meshFormat: Int, numberOfTetsPerHexElement: Short, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("new _module.PxTetrahedronMeshDesc(meshVertices, meshTetIndices, meshFormat, numberOfTetsPerHexElement)") -fun PxTetrahedronMeshDesc.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTetrahedronMeshDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshDesc = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshDesc)") -external interface PxTetrahedronMesh : PxRefCounted { +external interface PxTetrahedronMesh : JsAny, PxRefCounted { /** * @return WebIDL type: unsigned long */ @@ -1297,7 +1435,7 @@ external interface PxTetrahedronMesh : PxRefCounted { /** * @return WebIDL type: VoidPtr (Const) */ - fun getTetrahedrons(): Any + fun getTetrahedrons(): JsAny /** * @return WebIDL type: [PxTetrahedronMeshFlags] (Value) @@ -1316,7 +1454,7 @@ external interface PxTetrahedronMesh : PxRefCounted { } -fun PxTetrahedronMeshFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMesh = js("_module.wrapPointer(ptr, _module.PxTetrahedronMesh)") +fun PxTetrahedronMeshFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMesh = js("_module.wrapPointer(ptr, _module.PxTetrahedronMesh)") val PxTetrahedronMesh.nbVertices get() = getNbVertices() @@ -1333,7 +1471,7 @@ val PxTetrahedronMesh.tetrahedraRemap val PxTetrahedronMesh.localBounds get() = getLocalBounds() -external interface PxTetrahedronMeshExt { +external interface PxTetrahedronMeshExt : JsAny { /** * Native object address. */ @@ -1388,9 +1526,9 @@ external interface PxTetrahedronMeshExt { } -fun PxTetrahedronMeshExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshExt = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshExt)") +fun PxTetrahedronMeshExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshExt = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshExt)") -external interface PxTetrahedronMeshFlags { +external interface PxTetrahedronMeshFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1400,32 +1538,32 @@ external interface PxTetrahedronMeshFlags { * @param flag WebIDL type: [PxTetrahedronMeshFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxTetrahedronMeshFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxTetrahedronMeshFlagEnum] (enum) */ - fun raise(flag: PxTetrahedronMeshFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxTetrahedronMeshFlagEnum] (enum) */ - fun clear(flag: PxTetrahedronMeshFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxTetrahedronMeshFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshFlags = js("new _module.PxTetrahedronMeshFlags(flags)") +fun PxTetrahedronMeshFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshFlags = js("new _module.PxTetrahedronMeshFlags(flags)") -fun PxTetrahedronMeshFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshFlags = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshFlags)") +fun PxTetrahedronMeshFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshFlags = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshFlags)") -fun PxTetrahedronMeshFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTetrahedronMeshFlags.isSet(flag: PxTetrahedronMeshFlagEnum) = isSet(flag.value) +fun PxTetrahedronMeshFlags.raise(flag: PxTetrahedronMeshFlagEnum) = raise(flag.value) +fun PxTetrahedronMeshFlags.clear(flag: PxTetrahedronMeshFlagEnum) = clear(flag.value) -external interface PxTetrahedronMeshGeometry : PxGeometry { +external interface PxTetrahedronMeshGeometry : JsAny, PxGeometry { /** * WebIDL type: [PxTetrahedronMesh] */ @@ -1441,11 +1579,11 @@ external interface PxTetrahedronMeshGeometry : PxGeometry { /** * @param mesh WebIDL type: [PxTetrahedronMesh] */ -fun PxTetrahedronMeshGeometry(mesh: PxTetrahedronMesh, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshGeometry = js("new _module.PxTetrahedronMeshGeometry(mesh)") +fun PxTetrahedronMeshGeometry(mesh: PxTetrahedronMesh, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshGeometry = js("new _module.PxTetrahedronMeshGeometry(mesh)") -fun PxTetrahedronMeshGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTetrahedronMeshGeometry = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshGeometry)") +fun PxTetrahedronMeshGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTetrahedronMeshGeometry = js("_module.wrapPointer(ptr, _module.PxTetrahedronMeshGeometry)") -external interface PxTriangle { +external interface PxTriangle : JsAny, DestroyableNative { /** * Native object address. */ @@ -1475,22 +1613,18 @@ external interface PxTriangle { } -fun PxTriangle(_module: dynamic = PhysXJsLoader.physXJs): PxTriangle = js("new _module.PxTriangle()") +fun PxTriangle(_module: JsAny = PhysXJsLoader.physXJs): PxTriangle = js("new _module.PxTriangle()") /** * @param p0 WebIDL type: [PxVec3] (Const, Ref) * @param p1 WebIDL type: [PxVec3] (Const, Ref) * @param p2 WebIDL type: [PxVec3] (Const, Ref) */ -fun PxTriangle(p0: PxVec3, p1: PxVec3, p2: PxVec3, _module: dynamic = PhysXJsLoader.physXJs): PxTriangle = js("new _module.PxTriangle(p0, p1, p2)") - -fun PxTriangleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangle = js("_module.wrapPointer(ptr, _module.PxTriangle)") +fun PxTriangle(p0: PxVec3, p1: PxVec3, p2: PxVec3, _module: JsAny = PhysXJsLoader.physXJs): PxTriangle = js("new _module.PxTriangle(p0, p1, p2)") -fun PxTriangle.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTriangleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangle = js("_module.wrapPointer(ptr, _module.PxTriangle)") -external interface PxTriangleMesh : PxRefCounted { +external interface PxTriangleMesh : JsAny, PxRefCounted { /** * @return WebIDL type: unsigned long */ @@ -1519,7 +1653,7 @@ external interface PxTriangleMesh : PxRefCounted { /** * @return WebIDL type: VoidPtr (Const) */ - fun getTriangles(): Any + fun getTriangles(): JsAny /** * @return WebIDL type: [PxTriangleMeshFlags] (Value) @@ -1544,7 +1678,7 @@ external interface PxTriangleMesh : PxRefCounted { } -fun PxTriangleMeshFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMesh = js("_module.wrapPointer(ptr, _module.PxTriangleMesh)") +fun PxTriangleMeshFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMesh = js("_module.wrapPointer(ptr, _module.PxTriangleMesh)") val PxTriangleMesh.nbVertices get() = getNbVertices() @@ -1563,7 +1697,7 @@ val PxTriangleMesh.trianglesRemap val PxTriangleMesh.localBounds get() = getLocalBounds() -external interface PxTriangleMeshAnalysisResults { +external interface PxTriangleMeshAnalysisResults : JsAny, DestroyableNative { /** * Native object address. */ @@ -1573,32 +1707,32 @@ external interface PxTriangleMeshAnalysisResults { * @param flag WebIDL type: [PxTriangleMeshAnalysisResultEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxTriangleMeshAnalysisResultEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxTriangleMeshAnalysisResultEnum] (enum) */ - fun raise(flag: PxTriangleMeshAnalysisResultEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxTriangleMeshAnalysisResultEnum] (enum) */ - fun clear(flag: PxTriangleMeshAnalysisResultEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned long */ -fun PxTriangleMeshAnalysisResults(flags: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshAnalysisResults = js("new _module.PxTriangleMeshAnalysisResults(flags)") +fun PxTriangleMeshAnalysisResults(flags: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshAnalysisResults = js("new _module.PxTriangleMeshAnalysisResults(flags)") -fun PxTriangleMeshAnalysisResultsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshAnalysisResults = js("_module.wrapPointer(ptr, _module.PxTriangleMeshAnalysisResults)") +fun PxTriangleMeshAnalysisResultsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshAnalysisResults = js("_module.wrapPointer(ptr, _module.PxTriangleMeshAnalysisResults)") -fun PxTriangleMeshAnalysisResults.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTriangleMeshAnalysisResults.isSet(flag: PxTriangleMeshAnalysisResultEnum) = isSet(flag.value) +fun PxTriangleMeshAnalysisResults.raise(flag: PxTriangleMeshAnalysisResultEnum) = raise(flag.value) +fun PxTriangleMeshAnalysisResults.clear(flag: PxTriangleMeshAnalysisResultEnum) = clear(flag.value) -external interface PxTriangleMeshFlags { +external interface PxTriangleMeshFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1608,32 +1742,32 @@ external interface PxTriangleMeshFlags { * @param flag WebIDL type: [PxTriangleMeshFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxTriangleMeshFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxTriangleMeshFlagEnum] (enum) */ - fun raise(flag: PxTriangleMeshFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxTriangleMeshFlagEnum] (enum) */ - fun clear(flag: PxTriangleMeshFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxTriangleMeshFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshFlags = js("new _module.PxTriangleMeshFlags(flags)") +fun PxTriangleMeshFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshFlags = js("new _module.PxTriangleMeshFlags(flags)") -fun PxTriangleMeshFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshFlags = js("_module.wrapPointer(ptr, _module.PxTriangleMeshFlags)") +fun PxTriangleMeshFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshFlags = js("_module.wrapPointer(ptr, _module.PxTriangleMeshFlags)") -fun PxTriangleMeshFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTriangleMeshFlags.isSet(flag: PxTriangleMeshFlagEnum) = isSet(flag.value) +fun PxTriangleMeshFlags.raise(flag: PxTriangleMeshFlagEnum) = raise(flag.value) +fun PxTriangleMeshFlags.clear(flag: PxTriangleMeshFlagEnum) = clear(flag.value) -external interface PxTriangleMeshGeometry : PxGeometry { +external interface PxTriangleMeshGeometry : JsAny, DestroyableNative, PxGeometry { /** * WebIDL type: [PxMeshScale] (Value) */ @@ -1657,115 +1791,263 @@ external interface PxTriangleMeshGeometry : PxGeometry { /** * @param mesh WebIDL type: [PxTriangleMesh] */ -fun PxTriangleMeshGeometry(mesh: PxTriangleMesh, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("new _module.PxTriangleMeshGeometry(mesh)") +fun PxTriangleMeshGeometry(mesh: PxTriangleMesh, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("new _module.PxTriangleMeshGeometry(mesh)") /** * @param mesh WebIDL type: [PxTriangleMesh] * @param scaling WebIDL type: [PxMeshScale] (Const, Ref) */ -fun PxTriangleMeshGeometry(mesh: PxTriangleMesh, scaling: PxMeshScale, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("new _module.PxTriangleMeshGeometry(mesh, scaling)") +fun PxTriangleMeshGeometry(mesh: PxTriangleMesh, scaling: PxMeshScale, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("new _module.PxTriangleMeshGeometry(mesh, scaling)") /** * @param mesh WebIDL type: [PxTriangleMesh] * @param scaling WebIDL type: [PxMeshScale] (Const, Ref) * @param flags WebIDL type: [PxMeshGeometryFlags] (Ref) */ -fun PxTriangleMeshGeometry(mesh: PxTriangleMesh, scaling: PxMeshScale, flags: PxMeshGeometryFlags, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("new _module.PxTriangleMeshGeometry(mesh, scaling, flags)") +fun PxTriangleMeshGeometry(mesh: PxTriangleMesh, scaling: PxMeshScale, flags: PxMeshGeometryFlags, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("new _module.PxTriangleMeshGeometry(mesh, scaling, flags)") -fun PxTriangleMeshGeometryFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("_module.wrapPointer(ptr, _module.PxTriangleMeshGeometry)") +fun PxTriangleMeshGeometryFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriangleMeshGeometry = js("_module.wrapPointer(ptr, _module.PxTriangleMeshGeometry)") -fun PxTriangleMeshGeometry.destroy() { - PhysXJsLoader.destroy(this) +value class PxConvexCoreTypeEnum private constructor(val value: Int) { + companion object { + val ePOINT: PxConvexCoreTypeEnum = PxConvexCoreTypeEnum(PxConvexCoreTypeEnum_ePOINT(PhysXJsLoader.physXJs)) + val eSEGMENT: PxConvexCoreTypeEnum = PxConvexCoreTypeEnum(PxConvexCoreTypeEnum_eSEGMENT(PhysXJsLoader.physXJs)) + val eBOX: PxConvexCoreTypeEnum = PxConvexCoreTypeEnum(PxConvexCoreTypeEnum_eBOX(PhysXJsLoader.physXJs)) + val eELLIPSOID: PxConvexCoreTypeEnum = PxConvexCoreTypeEnum(PxConvexCoreTypeEnum_eELLIPSOID(PhysXJsLoader.physXJs)) + val eCYLINDER: PxConvexCoreTypeEnum = PxConvexCoreTypeEnum(PxConvexCoreTypeEnum_eCYLINDER(PhysXJsLoader.physXJs)) + val eCONE: PxConvexCoreTypeEnum = PxConvexCoreTypeEnum(PxConvexCoreTypeEnum_eCONE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePOINT.value -> ePOINT + eSEGMENT.value -> eSEGMENT + eBOX.value -> eBOX + eELLIPSOID.value -> eELLIPSOID + eCYLINDER.value -> eCYLINDER + eCONE.value -> eCONE + else -> error("Invalid enum value $value for enum PxConvexCoreTypeEnum") + } + } } +private fun PxConvexCoreTypeEnum_ePOINT(module: JsAny): Int = js("module._emscripten_enum_PxConvexCoreTypeEnum_ePOINT()") +private fun PxConvexCoreTypeEnum_eSEGMENT(module: JsAny): Int = js("module._emscripten_enum_PxConvexCoreTypeEnum_eSEGMENT()") +private fun PxConvexCoreTypeEnum_eBOX(module: JsAny): Int = js("module._emscripten_enum_PxConvexCoreTypeEnum_eBOX()") +private fun PxConvexCoreTypeEnum_eELLIPSOID(module: JsAny): Int = js("module._emscripten_enum_PxConvexCoreTypeEnum_eELLIPSOID()") +private fun PxConvexCoreTypeEnum_eCYLINDER(module: JsAny): Int = js("module._emscripten_enum_PxConvexCoreTypeEnum_eCYLINDER()") +private fun PxConvexCoreTypeEnum_eCONE(module: JsAny): Int = js("module._emscripten_enum_PxConvexCoreTypeEnum_eCONE()") + value class PxConvexMeshGeometryFlagEnum private constructor(val value: Int) { companion object { - val eTIGHT_BOUNDS: PxConvexMeshGeometryFlagEnum = PxConvexMeshGeometryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConvexMeshGeometryFlagEnum_eTIGHT_BOUNDS()) + val eTIGHT_BOUNDS: PxConvexMeshGeometryFlagEnum = PxConvexMeshGeometryFlagEnum(PxConvexMeshGeometryFlagEnum_eTIGHT_BOUNDS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eTIGHT_BOUNDS.value -> eTIGHT_BOUNDS + else -> error("Invalid enum value $value for enum PxConvexMeshGeometryFlagEnum") + } } } +private fun PxConvexMeshGeometryFlagEnum_eTIGHT_BOUNDS(module: JsAny): Int = js("module._emscripten_enum_PxConvexMeshGeometryFlagEnum_eTIGHT_BOUNDS()") + value class PxGeometryTypeEnum private constructor(val value: Int) { companion object { - val eSPHERE: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eSPHERE()) - val ePLANE: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_ePLANE()) - val eCAPSULE: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eCAPSULE()) - val eBOX: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eBOX()) - val eCONVEXMESH: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eCONVEXMESH()) - val eTRIANGLEMESH: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eTRIANGLEMESH()) - val eHEIGHTFIELD: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eHEIGHTFIELD()) - val eCUSTOM: PxGeometryTypeEnum = PxGeometryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxGeometryTypeEnum_eCUSTOM()) + val eSPHERE: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eSPHERE(PhysXJsLoader.physXJs)) + val ePLANE: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_ePLANE(PhysXJsLoader.physXJs)) + val eCAPSULE: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eCAPSULE(PhysXJsLoader.physXJs)) + val eBOX: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eBOX(PhysXJsLoader.physXJs)) + val eCONVEXCORE: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eCONVEXCORE(PhysXJsLoader.physXJs)) + val eCONVEXMESH: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eCONVEXMESH(PhysXJsLoader.physXJs)) + val ePARTICLESYSTEM: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_ePARTICLESYSTEM(PhysXJsLoader.physXJs)) + val eTETRAHEDRONMESH: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eTETRAHEDRONMESH(PhysXJsLoader.physXJs)) + val eTRIANGLEMESH: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eTRIANGLEMESH(PhysXJsLoader.physXJs)) + val eHEIGHTFIELD: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eHEIGHTFIELD(PhysXJsLoader.physXJs)) + val eCUSTOM: PxGeometryTypeEnum = PxGeometryTypeEnum(PxGeometryTypeEnum_eCUSTOM(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSPHERE.value -> eSPHERE + ePLANE.value -> ePLANE + eCAPSULE.value -> eCAPSULE + eBOX.value -> eBOX + eCONVEXCORE.value -> eCONVEXCORE + eCONVEXMESH.value -> eCONVEXMESH + ePARTICLESYSTEM.value -> ePARTICLESYSTEM + eTETRAHEDRONMESH.value -> eTETRAHEDRONMESH + eTRIANGLEMESH.value -> eTRIANGLEMESH + eHEIGHTFIELD.value -> eHEIGHTFIELD + eCUSTOM.value -> eCUSTOM + else -> error("Invalid enum value $value for enum PxGeometryTypeEnum") + } } } +private fun PxGeometryTypeEnum_eSPHERE(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eSPHERE()") +private fun PxGeometryTypeEnum_ePLANE(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_ePLANE()") +private fun PxGeometryTypeEnum_eCAPSULE(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eCAPSULE()") +private fun PxGeometryTypeEnum_eBOX(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eBOX()") +private fun PxGeometryTypeEnum_eCONVEXCORE(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eCONVEXCORE()") +private fun PxGeometryTypeEnum_eCONVEXMESH(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eCONVEXMESH()") +private fun PxGeometryTypeEnum_ePARTICLESYSTEM(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_ePARTICLESYSTEM()") +private fun PxGeometryTypeEnum_eTETRAHEDRONMESH(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eTETRAHEDRONMESH()") +private fun PxGeometryTypeEnum_eTRIANGLEMESH(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eTRIANGLEMESH()") +private fun PxGeometryTypeEnum_eHEIGHTFIELD(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eHEIGHTFIELD()") +private fun PxGeometryTypeEnum_eCUSTOM(module: JsAny): Int = js("module._emscripten_enum_PxGeometryTypeEnum_eCUSTOM()") + value class PxHeightFieldFlagEnum private constructor(val value: Int) { companion object { - val eNO_BOUNDARY_EDGES: PxHeightFieldFlagEnum = PxHeightFieldFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHeightFieldFlagEnum_eNO_BOUNDARY_EDGES()) + val eNO_BOUNDARY_EDGES: PxHeightFieldFlagEnum = PxHeightFieldFlagEnum(PxHeightFieldFlagEnum_eNO_BOUNDARY_EDGES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNO_BOUNDARY_EDGES.value -> eNO_BOUNDARY_EDGES + else -> error("Invalid enum value $value for enum PxHeightFieldFlagEnum") + } } } +private fun PxHeightFieldFlagEnum_eNO_BOUNDARY_EDGES(module: JsAny): Int = js("module._emscripten_enum_PxHeightFieldFlagEnum_eNO_BOUNDARY_EDGES()") + value class PxHeightFieldFormatEnum private constructor(val value: Int) { companion object { - val eS16_TM: PxHeightFieldFormatEnum = PxHeightFieldFormatEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHeightFieldFormatEnum_eS16_TM()) + val eS16_TM: PxHeightFieldFormatEnum = PxHeightFieldFormatEnum(PxHeightFieldFormatEnum_eS16_TM(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eS16_TM.value -> eS16_TM + else -> error("Invalid enum value $value for enum PxHeightFieldFormatEnum") + } } } +private fun PxHeightFieldFormatEnum_eS16_TM(module: JsAny): Int = js("module._emscripten_enum_PxHeightFieldFormatEnum_eS16_TM()") + value class PxMeshFlagEnum private constructor(val value: Int) { companion object { - val eFLIPNORMALS: PxMeshFlagEnum = PxMeshFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshFlagEnum_eFLIPNORMALS()) - val e16_BIT_INDICES: PxMeshFlagEnum = PxMeshFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshFlagEnum_e16_BIT_INDICES()) + val eFLIPNORMALS: PxMeshFlagEnum = PxMeshFlagEnum(PxMeshFlagEnum_eFLIPNORMALS(PhysXJsLoader.physXJs)) + val e16_BIT_INDICES: PxMeshFlagEnum = PxMeshFlagEnum(PxMeshFlagEnum_e16_BIT_INDICES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eFLIPNORMALS.value -> eFLIPNORMALS + e16_BIT_INDICES.value -> e16_BIT_INDICES + else -> error("Invalid enum value $value for enum PxMeshFlagEnum") + } } } +private fun PxMeshFlagEnum_eFLIPNORMALS(module: JsAny): Int = js("module._emscripten_enum_PxMeshFlagEnum_eFLIPNORMALS()") +private fun PxMeshFlagEnum_e16_BIT_INDICES(module: JsAny): Int = js("module._emscripten_enum_PxMeshFlagEnum_e16_BIT_INDICES()") + value class PxMeshGeometryFlagEnum private constructor(val value: Int) { companion object { - val eDOUBLE_SIDED: PxMeshGeometryFlagEnum = PxMeshGeometryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMeshGeometryFlagEnum_eDOUBLE_SIDED()) + val eDOUBLE_SIDED: PxMeshGeometryFlagEnum = PxMeshGeometryFlagEnum(PxMeshGeometryFlagEnum_eDOUBLE_SIDED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eDOUBLE_SIDED.value -> eDOUBLE_SIDED + else -> error("Invalid enum value $value for enum PxMeshGeometryFlagEnum") + } } } +private fun PxMeshGeometryFlagEnum_eDOUBLE_SIDED(module: JsAny): Int = js("module._emscripten_enum_PxMeshGeometryFlagEnum_eDOUBLE_SIDED()") + value class PxTetrahedronMeshAnalysisResultEnum private constructor(val value: Int) { companion object { - val eVALID: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eVALID()) - val eDEGENERATE_TETRAHEDRON: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eDEGENERATE_TETRAHEDRON()) - val eMESH_IS_PROBLEMATIC: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC()) - val eMESH_IS_INVALID: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_INVALID()) + val eVALID: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PxTetrahedronMeshAnalysisResultEnum_eVALID(PhysXJsLoader.physXJs)) + val eDEGENERATE_TETRAHEDRON: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PxTetrahedronMeshAnalysisResultEnum_eDEGENERATE_TETRAHEDRON(PhysXJsLoader.physXJs)) + val eMESH_IS_PROBLEMATIC: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC(PhysXJsLoader.physXJs)) + val eMESH_IS_INVALID: PxTetrahedronMeshAnalysisResultEnum = PxTetrahedronMeshAnalysisResultEnum(PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_INVALID(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eVALID.value -> eVALID + eDEGENERATE_TETRAHEDRON.value -> eDEGENERATE_TETRAHEDRON + eMESH_IS_PROBLEMATIC.value -> eMESH_IS_PROBLEMATIC + eMESH_IS_INVALID.value -> eMESH_IS_INVALID + else -> error("Invalid enum value $value for enum PxTetrahedronMeshAnalysisResultEnum") + } } } +private fun PxTetrahedronMeshAnalysisResultEnum_eVALID(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eVALID()") +private fun PxTetrahedronMeshAnalysisResultEnum_eDEGENERATE_TETRAHEDRON(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eDEGENERATE_TETRAHEDRON()") +private fun PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC()") +private fun PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_INVALID(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshAnalysisResultEnum_eMESH_IS_INVALID()") + value class PxTetrahedronMeshFlagEnum private constructor(val value: Int) { companion object { - val e16_BIT_INDICES: PxTetrahedronMeshFlagEnum = PxTetrahedronMeshFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshFlagEnum_e16_BIT_INDICES()) + val e16_BIT_INDICES: PxTetrahedronMeshFlagEnum = PxTetrahedronMeshFlagEnum(PxTetrahedronMeshFlagEnum_e16_BIT_INDICES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + e16_BIT_INDICES.value -> e16_BIT_INDICES + else -> error("Invalid enum value $value for enum PxTetrahedronMeshFlagEnum") + } } } +private fun PxTetrahedronMeshFlagEnum_e16_BIT_INDICES(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshFlagEnum_e16_BIT_INDICES()") + value class PxTetrahedronMeshFormatEnum private constructor(val value: Int) { companion object { - val eTET_MESH: PxTetrahedronMeshFormatEnum = PxTetrahedronMeshFormatEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshFormatEnum_eTET_MESH()) - val eHEX_MESH: PxTetrahedronMeshFormatEnum = PxTetrahedronMeshFormatEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTetrahedronMeshFormatEnum_eHEX_MESH()) + val eTET_MESH: PxTetrahedronMeshFormatEnum = PxTetrahedronMeshFormatEnum(PxTetrahedronMeshFormatEnum_eTET_MESH(PhysXJsLoader.physXJs)) + val eHEX_MESH: PxTetrahedronMeshFormatEnum = PxTetrahedronMeshFormatEnum(PxTetrahedronMeshFormatEnum_eHEX_MESH(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eTET_MESH.value -> eTET_MESH + eHEX_MESH.value -> eHEX_MESH + else -> error("Invalid enum value $value for enum PxTetrahedronMeshFormatEnum") + } } } +private fun PxTetrahedronMeshFormatEnum_eTET_MESH(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshFormatEnum_eTET_MESH()") +private fun PxTetrahedronMeshFormatEnum_eHEX_MESH(module: JsAny): Int = js("module._emscripten_enum_PxTetrahedronMeshFormatEnum_eHEX_MESH()") + value class PxTriangleMeshAnalysisResultEnum private constructor(val value: Int) { companion object { - val eVALID: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eVALID()) - val eZERO_VOLUME: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eZERO_VOLUME()) - val eOPEN_BOUNDARIES: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eOPEN_BOUNDARIES()) - val eSELF_INTERSECTIONS: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eSELF_INTERSECTIONS()) - val eINCONSISTENT_TRIANGLE_ORIENTATION: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eINCONSISTENT_TRIANGLE_ORIENTATION()) - val eCONTAINS_ACUTE_ANGLED_TRIANGLES: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eCONTAINS_ACUTE_ANGLED_TRIANGLES()) - val eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES()) - val eCONTAINS_DUPLICATE_POINTS: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eCONTAINS_DUPLICATE_POINTS()) - val eCONTAINS_INVALID_POINTS: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eCONTAINS_INVALID_POINTS()) - val eREQUIRES_32BIT_INDEX_BUFFER: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eREQUIRES_32BIT_INDEX_BUFFER()) - val eTRIANGLE_INDEX_OUT_OF_RANGE: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eTRIANGLE_INDEX_OUT_OF_RANGE()) - val eMESH_IS_PROBLEMATIC: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC()) - val eMESH_IS_INVALID: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eMESH_IS_INVALID()) + val eVALID: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eVALID(PhysXJsLoader.physXJs)) + val eZERO_VOLUME: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eZERO_VOLUME(PhysXJsLoader.physXJs)) + val eOPEN_BOUNDARIES: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eOPEN_BOUNDARIES(PhysXJsLoader.physXJs)) + val eSELF_INTERSECTIONS: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eSELF_INTERSECTIONS(PhysXJsLoader.physXJs)) + val eINCONSISTENT_TRIANGLE_ORIENTATION: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eINCONSISTENT_TRIANGLE_ORIENTATION(PhysXJsLoader.physXJs)) + val eCONTAINS_ACUTE_ANGLED_TRIANGLES: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eCONTAINS_ACUTE_ANGLED_TRIANGLES(PhysXJsLoader.physXJs)) + val eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES(PhysXJsLoader.physXJs)) + val eCONTAINS_DUPLICATE_POINTS: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eCONTAINS_DUPLICATE_POINTS(PhysXJsLoader.physXJs)) + val eCONTAINS_INVALID_POINTS: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eCONTAINS_INVALID_POINTS(PhysXJsLoader.physXJs)) + val eREQUIRES_32BIT_INDEX_BUFFER: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eREQUIRES_32BIT_INDEX_BUFFER(PhysXJsLoader.physXJs)) + val eTRIANGLE_INDEX_OUT_OF_RANGE: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eTRIANGLE_INDEX_OUT_OF_RANGE(PhysXJsLoader.physXJs)) + val eMESH_IS_PROBLEMATIC: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC(PhysXJsLoader.physXJs)) + val eMESH_IS_INVALID: PxTriangleMeshAnalysisResultEnum = PxTriangleMeshAnalysisResultEnum(PxTriangleMeshAnalysisResultEnum_eMESH_IS_INVALID(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eVALID.value -> eVALID + eZERO_VOLUME.value -> eZERO_VOLUME + eOPEN_BOUNDARIES.value -> eOPEN_BOUNDARIES + eSELF_INTERSECTIONS.value -> eSELF_INTERSECTIONS + eINCONSISTENT_TRIANGLE_ORIENTATION.value -> eINCONSISTENT_TRIANGLE_ORIENTATION + eCONTAINS_ACUTE_ANGLED_TRIANGLES.value -> eCONTAINS_ACUTE_ANGLED_TRIANGLES + eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES.value -> eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES + eCONTAINS_DUPLICATE_POINTS.value -> eCONTAINS_DUPLICATE_POINTS + eCONTAINS_INVALID_POINTS.value -> eCONTAINS_INVALID_POINTS + eREQUIRES_32BIT_INDEX_BUFFER.value -> eREQUIRES_32BIT_INDEX_BUFFER + eTRIANGLE_INDEX_OUT_OF_RANGE.value -> eTRIANGLE_INDEX_OUT_OF_RANGE + eMESH_IS_PROBLEMATIC.value -> eMESH_IS_PROBLEMATIC + eMESH_IS_INVALID.value -> eMESH_IS_INVALID + else -> error("Invalid enum value $value for enum PxTriangleMeshAnalysisResultEnum") + } } } +private fun PxTriangleMeshAnalysisResultEnum_eVALID(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eVALID()") +private fun PxTriangleMeshAnalysisResultEnum_eZERO_VOLUME(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eZERO_VOLUME()") +private fun PxTriangleMeshAnalysisResultEnum_eOPEN_BOUNDARIES(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eOPEN_BOUNDARIES()") +private fun PxTriangleMeshAnalysisResultEnum_eSELF_INTERSECTIONS(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eSELF_INTERSECTIONS()") +private fun PxTriangleMeshAnalysisResultEnum_eINCONSISTENT_TRIANGLE_ORIENTATION(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eINCONSISTENT_TRIANGLE_ORIENTATION()") +private fun PxTriangleMeshAnalysisResultEnum_eCONTAINS_ACUTE_ANGLED_TRIANGLES(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eCONTAINS_ACUTE_ANGLED_TRIANGLES()") +private fun PxTriangleMeshAnalysisResultEnum_eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES()") +private fun PxTriangleMeshAnalysisResultEnum_eCONTAINS_DUPLICATE_POINTS(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eCONTAINS_DUPLICATE_POINTS()") +private fun PxTriangleMeshAnalysisResultEnum_eCONTAINS_INVALID_POINTS(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eCONTAINS_INVALID_POINTS()") +private fun PxTriangleMeshAnalysisResultEnum_eREQUIRES_32BIT_INDEX_BUFFER(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eREQUIRES_32BIT_INDEX_BUFFER()") +private fun PxTriangleMeshAnalysisResultEnum_eTRIANGLE_INDEX_OUT_OF_RANGE(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eTRIANGLE_INDEX_OUT_OF_RANGE()") +private fun PxTriangleMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eMESH_IS_PROBLEMATIC()") +private fun PxTriangleMeshAnalysisResultEnum_eMESH_IS_INVALID(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshAnalysisResultEnum_eMESH_IS_INVALID()") + value class PxTriangleMeshFlagEnum private constructor(val value: Int) { companion object { - val e16_BIT_INDICES: PxTriangleMeshFlagEnum = PxTriangleMeshFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshFlagEnum_e16_BIT_INDICES()) - val eADJACENCY_INFO: PxTriangleMeshFlagEnum = PxTriangleMeshFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriangleMeshFlagEnum_eADJACENCY_INFO()) + val e16_BIT_INDICES: PxTriangleMeshFlagEnum = PxTriangleMeshFlagEnum(PxTriangleMeshFlagEnum_e16_BIT_INDICES(PhysXJsLoader.physXJs)) + val eADJACENCY_INFO: PxTriangleMeshFlagEnum = PxTriangleMeshFlagEnum(PxTriangleMeshFlagEnum_eADJACENCY_INFO(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + e16_BIT_INDICES.value -> e16_BIT_INDICES + eADJACENCY_INFO.value -> eADJACENCY_INFO + else -> error("Invalid enum value $value for enum PxTriangleMeshFlagEnum") + } } } +private fun PxTriangleMeshFlagEnum_e16_BIT_INDICES(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshFlagEnum_e16_BIT_INDICES()") +private fun PxTriangleMeshFlagEnum_eADJACENCY_INFO(module: JsAny): Int = js("module._emscripten_enum_PxTriangleMeshFlagEnum_eADJACENCY_INFO()") + diff --git a/kool-physics/src/jsMain/kotlin/physx/PhysXJs.kt b/kool-physics/src/webMain/kotlin/physx/PhysXJs.kt similarity index 97% rename from kool-physics/src/jsMain/kotlin/physx/PhysXJs.kt rename to kool-physics/src/webMain/kotlin/physx/PhysXJs.kt index a6ce371ef..c23f61716 100644 --- a/kool-physics/src/jsMain/kotlin/physx/PhysXJs.kt +++ b/kool-physics/src/webMain/kotlin/physx/PhysXJs.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxTopLevelFunctions { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxTopLevelFunctions : JsAny { /** * Native object address. */ @@ -339,5 +342,5 @@ external interface PxTopLevelFunctions { } -fun PxTopLevelFunctionsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTopLevelFunctions = js("_module.wrapPointer(ptr, _module.PxTopLevelFunctions)") +fun PxTopLevelFunctionsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTopLevelFunctions = js("_module.wrapPointer(ptr, _module.PxTopLevelFunctions)") diff --git a/kool-physics/src/webMain/kotlin/physx/PhysXJsLoader.kt b/kool-physics/src/webMain/kotlin/physx/PhysXJsLoader.kt new file mode 100644 index 000000000..0921ff1d0 --- /dev/null +++ b/kool-physics/src/webMain/kotlin/physx/PhysXJsLoader.kt @@ -0,0 +1,17 @@ +/* + * Generated from WebIDL by webidl-util + */ + +package physx + +import kotlin.js.JsAny + +internal expect object PhysXJsLoader { + internal val physXJs: JsAny + val isLoaded: Boolean + suspend fun loadModule() +} + +sealed external interface DestroyableNative : JsAny + +expect fun DestroyableNative.destroy() \ No newline at end of file diff --git a/kool-physics/src/jsMain/kotlin/physx/Physics.kt b/kool-physics/src/webMain/kotlin/physx/Physics.kt similarity index 54% rename from kool-physics/src/jsMain/kotlin/physx/Physics.kt rename to kool-physics/src/webMain/kotlin/physx/Physics.kt index 7d4b8009e..39af5ffa3 100644 --- a/kool-physics/src/jsMain/kotlin/physx/Physics.kt +++ b/kool-physics/src/webMain/kotlin/physx/Physics.kt @@ -1,15 +1,18 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxScene : PxSceneSQSystem { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxScene : JsAny, PxSceneSQSystem { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @param actor WebIDL type: [PxActor] (Ref) @@ -137,12 +140,12 @@ external interface PxScene : PxSceneSQSystem { * @param data WebIDL type: VoidPtr (Const) * @param dataSize WebIDL type: unsigned long */ - fun setFilterShaderData(data: Any, dataSize: Int) + fun setFilterShaderData(data: JsAny, dataSize: Int) /** * @return WebIDL type: VoidPtr (Const) */ - fun getFilterShaderData(): Any + fun getFilterShaderData(): JsAny /** * @return WebIDL type: unsigned long @@ -163,12 +166,12 @@ external interface PxScene : PxSceneSQSystem { /** * @return WebIDL type: [PxPairFilteringModeEnum] (enum) */ - fun getKinematicKinematicFilteringMode(): PxPairFilteringModeEnum + fun getKinematicKinematicFilteringMode(): Int /** * @return WebIDL type: [PxPairFilteringModeEnum] (enum) */ - fun getStaticKinematicFilteringMode(): PxPairFilteringModeEnum + fun getStaticKinematicFilteringMode(): Int /** * @param elapsedTime WebIDL type: float @@ -189,7 +192,7 @@ external interface PxScene : PxSceneSQSystem { * @param scratchMemBlock WebIDL type: VoidPtr * @return WebIDL type: boolean */ - fun simulate(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: Any): Boolean + fun simulate(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: JsAny): Boolean /** * @param elapsedTime WebIDL type: float @@ -198,7 +201,7 @@ external interface PxScene : PxSceneSQSystem { * @param scratchMemBlockSize WebIDL type: unsigned long * @return WebIDL type: boolean */ - fun simulate(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: Any, scratchMemBlockSize: Int): Boolean + fun simulate(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: JsAny, scratchMemBlockSize: Int): Boolean /** * @param elapsedTime WebIDL type: float @@ -208,7 +211,7 @@ external interface PxScene : PxSceneSQSystem { * @param controlSimulation WebIDL type: boolean * @return WebIDL type: boolean */ - fun simulate(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: Any, scratchMemBlockSize: Int, controlSimulation: Boolean): Boolean + fun simulate(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: JsAny, scratchMemBlockSize: Int, controlSimulation: Boolean): Boolean /** * @return WebIDL type: boolean @@ -240,7 +243,7 @@ external interface PxScene : PxSceneSQSystem { * @param scratchMemBlock WebIDL type: VoidPtr * @return WebIDL type: boolean */ - fun collide(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: Any): Boolean + fun collide(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: JsAny): Boolean /** * @param elapsedTime WebIDL type: float @@ -249,7 +252,7 @@ external interface PxScene : PxSceneSQSystem { * @param scratchMemBlockSize WebIDL type: unsigned long * @return WebIDL type: boolean */ - fun collide(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: Any, scratchMemBlockSize: Int): Boolean + fun collide(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: JsAny, scratchMemBlockSize: Int): Boolean /** * @param elapsedTime WebIDL type: float @@ -259,7 +262,7 @@ external interface PxScene : PxSceneSQSystem { * @param controlSimulation WebIDL type: boolean * @return WebIDL type: boolean */ - fun collide(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: Any, scratchMemBlockSize: Int, controlSimulation: Boolean): Boolean + fun collide(elapsedTime: Float, completionTask: PxBaseTask, scratchMemBlock: JsAny, scratchMemBlockSize: Int, controlSimulation: Boolean): Boolean /** * @return WebIDL type: boolean @@ -391,12 +394,12 @@ external interface PxScene : PxSceneSQSystem { /** * @return WebIDL type: [PxFrictionTypeEnum] (enum) */ - fun getFrictionType(): PxFrictionTypeEnum + fun getFrictionType(): Int /** * @return WebIDL type: [PxSolverTypeEnum] (enum) */ - fun getSolverType(): PxSolverTypeEnum + fun getSolverType(): Int /** * @return WebIDL type: [PxRenderBuffer] (Const, Ref) @@ -408,13 +411,13 @@ external interface PxScene : PxSceneSQSystem { * @param value WebIDL type: float * @return WebIDL type: boolean */ - fun setVisualizationParameter(param: PxVisualizationParameterEnum, value: Float): Boolean + fun setVisualizationParameter(param: Int, value: Float): Boolean /** * @param paramEnum WebIDL type: [PxVisualizationParameterEnum] (enum) * @return WebIDL type: float */ - fun getVisualizationParameter(paramEnum: PxVisualizationParameterEnum): Float + fun getVisualizationParameter(paramEnum: Int): Float /** * @param box WebIDL type: [PxBounds3] (Const, Ref) @@ -434,7 +437,7 @@ external interface PxScene : PxSceneSQSystem { /** * @return WebIDL type: [PxBroadPhaseTypeEnum] (enum) */ - fun getBroadPhaseType(): PxBroadPhaseTypeEnum + fun getBroadPhaseType(): Int /** * @param caps WebIDL type: [PxBroadPhaseCaps] (Ref) @@ -557,7 +560,7 @@ external interface PxScene : PxSceneSQSystem { * @param flag WebIDL type: [PxSceneFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setFlag(flag: PxSceneFlagEnum, value: Boolean) + fun setFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxSceneFlags] (Value) @@ -591,7 +594,7 @@ external interface PxScene : PxSceneSQSystem { } -fun PxSceneFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxScene = js("_module.wrapPointer(ptr, _module.PxScene)") +fun PxSceneFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxScene = js("_module.wrapPointer(ptr, _module.PxScene)") val PxScene.wakeCounterResetValue get() = getWakeCounterResetValue() @@ -607,18 +610,18 @@ val PxScene.filterShaderDataSize get() = getFilterShaderDataSize() val PxScene.filterShader get() = getFilterShader() -val PxScene.kinematicKinematicFilteringMode - get() = getKinematicKinematicFilteringMode() -val PxScene.staticKinematicFilteringMode - get() = getStaticKinematicFilteringMode() -val PxScene.frictionType - get() = getFrictionType() -val PxScene.solverType - get() = getSolverType() +val PxScene.kinematicKinematicFilteringMode: PxPairFilteringModeEnum + get() = PxPairFilteringModeEnum.forValue(getKinematicKinematicFilteringMode()) +val PxScene.staticKinematicFilteringMode: PxPairFilteringModeEnum + get() = PxPairFilteringModeEnum.forValue(getStaticKinematicFilteringMode()) +val PxScene.frictionType: PxFrictionTypeEnum + get() = PxFrictionTypeEnum.forValue(getFrictionType()) +val PxScene.solverType: PxSolverTypeEnum + get() = PxSolverTypeEnum.forValue(getSolverType()) val PxScene.renderBuffer get() = getRenderBuffer() -val PxScene.broadPhaseType - get() = getBroadPhaseType() +val PxScene.broadPhaseType: PxBroadPhaseTypeEnum + get() = PxBroadPhaseTypeEnum.forValue(getBroadPhaseType()) val PxScene.nbBroadPhaseRegions get() = getNbBroadPhaseRegions() val PxScene.nbContactDataBlocksUsed @@ -676,7 +679,11 @@ var PxScene.limits get() = getLimits() set(value) { setLimits(value) } -external interface PxSceneDesc { +fun PxScene.setVisualizationParameter(param: PxVisualizationParameterEnum, value: Float) = setVisualizationParameter(param.value, value) +fun PxScene.getVisualizationParameter(paramEnum: PxVisualizationParameterEnum) = getVisualizationParameter(paramEnum.value) +fun PxScene.setFlag(flag: PxSceneFlagEnum, value: Boolean) = setFlag(flag.value, value) + +external interface PxSceneDesc : JsAny, DestroyableNative { /** * Native object address. */ @@ -693,7 +700,7 @@ external interface PxSceneDesc { /** * WebIDL type: VoidPtr (Const) */ - var filterShaderData: Any + var filterShaderData: JsAny /** * WebIDL type: unsigned long */ @@ -705,15 +712,15 @@ external interface PxSceneDesc { /** * WebIDL type: [PxPairFilteringModeEnum] (enum) */ - var kineKineFilteringMode: PxPairFilteringModeEnum + var kineKineFilteringMode: Int /** * WebIDL type: [PxPairFilteringModeEnum] (enum) */ - var staticKineFilteringMode: PxPairFilteringModeEnum + var staticKineFilteringMode: Int /** * WebIDL type: [PxBroadPhaseTypeEnum] (enum) */ - var broadPhaseType: PxBroadPhaseTypeEnum + var broadPhaseType: Int /** * WebIDL type: [PxSceneLimits] (Value) */ @@ -721,11 +728,11 @@ external interface PxSceneDesc { /** * WebIDL type: [PxFrictionTypeEnum] (enum) */ - var frictionType: PxFrictionTypeEnum + var frictionType: Int /** * WebIDL type: [PxSolverTypeEnum] (enum) */ - var solverType: PxSolverTypeEnum + var solverType: Int /** * WebIDL type: float */ @@ -749,7 +756,7 @@ external interface PxSceneDesc { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * WebIDL type: unsigned long */ @@ -813,11 +820,11 @@ external interface PxSceneDesc { /** * WebIDL type: [PxPruningStructureTypeEnum] (enum) */ - var staticStructure: PxPruningStructureTypeEnum + var staticStructure: Int /** * WebIDL type: [PxPruningStructureTypeEnum] (enum) */ - var dynamicStructure: PxPruningStructureTypeEnum + var dynamicStructure: Int /** * WebIDL type: unsigned long */ @@ -825,15 +832,15 @@ external interface PxSceneDesc { /** * WebIDL type: [PxDynamicTreeSecondaryPrunerEnum] (enum) */ - var dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPrunerEnum + var dynamicTreeSecondaryPruner: Int /** * WebIDL type: [PxBVHBuildStrategyEnum] (enum) */ - var staticBVHBuildStrategy: PxBVHBuildStrategyEnum + var staticBVHBuildStrategy: Int /** * WebIDL type: [PxBVHBuildStrategyEnum] (enum) */ - var dynamicBVHBuildStrategy: PxBVHBuildStrategyEnum + var dynamicBVHBuildStrategy: Int /** * WebIDL type: unsigned long */ @@ -845,7 +852,7 @@ external interface PxSceneDesc { /** * WebIDL type: [PxSceneQueryUpdateModeEnum] (enum) */ - var sceneQueryUpdateMode: PxSceneQueryUpdateModeEnum + var sceneQueryUpdateMode: Int /** * @param scale WebIDL type: [PxTolerancesScale] (Const, Ref) @@ -862,15 +869,45 @@ external interface PxSceneDesc { /** * @param scale WebIDL type: [PxTolerancesScale] (Const, Ref) */ -fun PxSceneDesc(scale: PxTolerancesScale, _module: dynamic = PhysXJsLoader.physXJs): PxSceneDesc = js("new _module.PxSceneDesc(scale)") - -fun PxSceneDescFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSceneDesc = js("_module.wrapPointer(ptr, _module.PxSceneDesc)") - -fun PxSceneDesc.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxSceneFlags { +fun PxSceneDesc(scale: PxTolerancesScale, _module: JsAny = PhysXJsLoader.physXJs): PxSceneDesc = js("new _module.PxSceneDesc(scale)") + +fun PxSceneDescFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSceneDesc = js("_module.wrapPointer(ptr, _module.PxSceneDesc)") + +var PxSceneDesc.kineKineFilteringModeEnum: PxPairFilteringModeEnum + get() = PxPairFilteringModeEnum.forValue(kineKineFilteringMode) + set(value) { kineKineFilteringMode = value.value } +var PxSceneDesc.staticKineFilteringModeEnum: PxPairFilteringModeEnum + get() = PxPairFilteringModeEnum.forValue(staticKineFilteringMode) + set(value) { staticKineFilteringMode = value.value } +var PxSceneDesc.broadPhaseTypeEnum: PxBroadPhaseTypeEnum + get() = PxBroadPhaseTypeEnum.forValue(broadPhaseType) + set(value) { broadPhaseType = value.value } +var PxSceneDesc.frictionTypeEnum: PxFrictionTypeEnum + get() = PxFrictionTypeEnum.forValue(frictionType) + set(value) { frictionType = value.value } +var PxSceneDesc.solverTypeEnum: PxSolverTypeEnum + get() = PxSolverTypeEnum.forValue(solverType) + set(value) { solverType = value.value } +var PxSceneDesc.staticStructureEnum: PxPruningStructureTypeEnum + get() = PxPruningStructureTypeEnum.forValue(staticStructure) + set(value) { staticStructure = value.value } +var PxSceneDesc.dynamicStructureEnum: PxPruningStructureTypeEnum + get() = PxPruningStructureTypeEnum.forValue(dynamicStructure) + set(value) { dynamicStructure = value.value } +var PxSceneDesc.dynamicTreeSecondaryPrunerEnum: PxDynamicTreeSecondaryPrunerEnum + get() = PxDynamicTreeSecondaryPrunerEnum.forValue(dynamicTreeSecondaryPruner) + set(value) { dynamicTreeSecondaryPruner = value.value } +var PxSceneDesc.staticBVHBuildStrategyEnum: PxBVHBuildStrategyEnum + get() = PxBVHBuildStrategyEnum.forValue(staticBVHBuildStrategy) + set(value) { staticBVHBuildStrategy = value.value } +var PxSceneDesc.dynamicBVHBuildStrategyEnum: PxBVHBuildStrategyEnum + get() = PxBVHBuildStrategyEnum.forValue(dynamicBVHBuildStrategy) + set(value) { dynamicBVHBuildStrategy = value.value } +var PxSceneDesc.sceneQueryUpdateModeEnum: PxSceneQueryUpdateModeEnum + get() = PxSceneQueryUpdateModeEnum.forValue(sceneQueryUpdateMode) + set(value) { sceneQueryUpdateMode = value.value } + +external interface PxSceneFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -880,32 +917,32 @@ external interface PxSceneFlags { * @param flag WebIDL type: [PxSceneFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxSceneFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxSceneFlagEnum] (enum) */ - fun raise(flag: PxSceneFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxSceneFlagEnum] (enum) */ - fun clear(flag: PxSceneFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned long */ -fun PxSceneFlags(flags: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSceneFlags = js("new _module.PxSceneFlags(flags)") +fun PxSceneFlags(flags: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSceneFlags = js("new _module.PxSceneFlags(flags)") -fun PxSceneFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSceneFlags = js("_module.wrapPointer(ptr, _module.PxSceneFlags)") +fun PxSceneFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSceneFlags = js("_module.wrapPointer(ptr, _module.PxSceneFlags)") -fun PxSceneFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSceneFlags.isSet(flag: PxSceneFlagEnum) = isSet(flag.value) +fun PxSceneFlags.raise(flag: PxSceneFlagEnum) = raise(flag.value) +fun PxSceneFlags.clear(flag: PxSceneFlagEnum) = clear(flag.value) -external interface PxSceneLimits { +external interface PxSceneLimits : JsAny, DestroyableNative { /** * Native object address. */ @@ -953,15 +990,11 @@ external interface PxSceneLimits { } -fun PxSceneLimits(_module: dynamic = PhysXJsLoader.physXJs): PxSceneLimits = js("new _module.PxSceneLimits()") - -fun PxSceneLimitsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSceneLimits = js("_module.wrapPointer(ptr, _module.PxSceneLimits)") +fun PxSceneLimits(_module: JsAny = PhysXJsLoader.physXJs): PxSceneLimits = js("new _module.PxSceneLimits()") -fun PxSceneLimits.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSceneLimitsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSceneLimits = js("_module.wrapPointer(ptr, _module.PxSceneLimits)") -external interface PxArticulationAttachment { +external interface PxArticulationAttachment : JsAny, DestroyableNative { /** * Native object address. */ @@ -970,7 +1003,7 @@ external interface PxArticulationAttachment { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @param restLength WebIDL type: float @@ -1036,11 +1069,7 @@ external interface PxArticulationAttachment { } -fun PxArticulationAttachmentFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationAttachment = js("_module.wrapPointer(ptr, _module.PxArticulationAttachment)") - -fun PxArticulationAttachment.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationAttachmentFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationAttachment = js("_module.wrapPointer(ptr, _module.PxArticulationAttachment)") val PxArticulationAttachment.link get() = getLink() @@ -1062,7 +1091,7 @@ var PxArticulationAttachment.coefficient get() = getCoefficient() set(value) { setCoefficient(value) } -external interface PxArticulationCache { +external interface PxArticulationCache : JsAny, DestroyableNative { /** * Native object address. */ @@ -1123,11 +1152,11 @@ external interface PxArticulationCache { /** * WebIDL type: VoidPtr */ - var scratchMemory: Any + var scratchMemory: JsAny /** * WebIDL type: VoidPtr */ - var scratchAllocator: Any + var scratchAllocator: JsAny /** * WebIDL type: unsigned long */ @@ -1137,13 +1166,9 @@ external interface PxArticulationCache { } -fun PxArticulationCacheFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationCache = js("_module.wrapPointer(ptr, _module.PxArticulationCache)") +fun PxArticulationCacheFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationCache = js("_module.wrapPointer(ptr, _module.PxArticulationCache)") -fun PxArticulationCache.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArticulationCacheFlags { +external interface PxArticulationCacheFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1153,32 +1178,32 @@ external interface PxArticulationCacheFlags { * @param flag WebIDL type: [PxArticulationCacheFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxArticulationCacheFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxArticulationCacheFlagEnum] (enum) */ - fun raise(flag: PxArticulationCacheFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxArticulationCacheFlagEnum] (enum) */ - fun clear(flag: PxArticulationCacheFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned long */ -fun PxArticulationCacheFlags(flags: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationCacheFlags = js("new _module.PxArticulationCacheFlags(flags)") +fun PxArticulationCacheFlags(flags: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationCacheFlags = js("new _module.PxArticulationCacheFlags(flags)") -fun PxArticulationCacheFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationCacheFlags = js("_module.wrapPointer(ptr, _module.PxArticulationCacheFlags)") +fun PxArticulationCacheFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationCacheFlags = js("_module.wrapPointer(ptr, _module.PxArticulationCacheFlags)") -fun PxArticulationCacheFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationCacheFlags.isSet(flag: PxArticulationCacheFlagEnum) = isSet(flag.value) +fun PxArticulationCacheFlags.raise(flag: PxArticulationCacheFlagEnum) = raise(flag.value) +fun PxArticulationCacheFlags.clear(flag: PxArticulationCacheFlagEnum) = clear(flag.value) -external interface PxArticulationDrive { +external interface PxArticulationDrive : JsAny, DestroyableNative { /** * Native object address. */ @@ -1199,10 +1224,10 @@ external interface PxArticulationDrive { /** * WebIDL type: [PxArticulationDriveTypeEnum] (enum) */ - var driveType: PxArticulationDriveTypeEnum + var driveType: Int } -fun PxArticulationDrive(_module: dynamic = PhysXJsLoader.physXJs): PxArticulationDrive = js("new _module.PxArticulationDrive()") +fun PxArticulationDrive(_module: JsAny = PhysXJsLoader.physXJs): PxArticulationDrive = js("new _module.PxArticulationDrive()") /** * @param stiffness WebIDL type: float @@ -1210,15 +1235,15 @@ fun PxArticulationDrive(_module: dynamic = PhysXJsLoader.physXJs): PxArticulatio * @param maxForce WebIDL type: float * @param driveType WebIDL type: [PxArticulationDriveTypeEnum] (enum) */ -fun PxArticulationDrive(stiffness: Float, damping: Float, maxForce: Float, driveType: PxArticulationDriveTypeEnum, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationDrive = js("new _module.PxArticulationDrive(stiffness, damping, maxForce, driveType)") +fun PxArticulationDrive(stiffness: Float, damping: Float, maxForce: Float, driveType: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationDrive = js("new _module.PxArticulationDrive(stiffness, damping, maxForce, driveType)") -fun PxArticulationDriveFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationDrive = js("_module.wrapPointer(ptr, _module.PxArticulationDrive)") +fun PxArticulationDriveFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationDrive = js("_module.wrapPointer(ptr, _module.PxArticulationDrive)") -fun PxArticulationDrive.destroy() { - PhysXJsLoader.destroy(this) -} +var PxArticulationDrive.driveTypeEnum: PxArticulationDriveTypeEnum + get() = PxArticulationDriveTypeEnum.forValue(driveType) + set(value) { driveType = value.value } -external interface PxArticulationFixedTendon : PxArticulationTendon { +external interface PxArticulationFixedTendon : JsAny, DestroyableNative, PxArticulationTendon { /** * @param parent WebIDL type: [PxArticulationTendonJoint] * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) @@ -1227,7 +1252,7 @@ external interface PxArticulationFixedTendon : PxArticulationTendon { * @param link WebIDL type: [PxArticulationLink] * @return WebIDL type: [PxArticulationTendonJoint] */ - fun createTendonJoint(parent: PxArticulationTendonJoint, axis: PxArticulationAxisEnum, coefficient: Float, recipCoefficient: Float, link: PxArticulationLink): PxArticulationTendonJoint + fun createTendonJoint(parent: PxArticulationTendonJoint, axis: Int, coefficient: Float, recipCoefficient: Float, link: PxArticulationLink): PxArticulationTendonJoint /** * @return WebIDL type: unsigned long @@ -1256,11 +1281,7 @@ external interface PxArticulationFixedTendon : PxArticulationTendon { } -fun PxArticulationFixedTendonFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationFixedTendon = js("_module.wrapPointer(ptr, _module.PxArticulationFixedTendon)") - -fun PxArticulationFixedTendon.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationFixedTendonFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationFixedTendon = js("_module.wrapPointer(ptr, _module.PxArticulationFixedTendon)") val PxArticulationFixedTendon.nbTendonJoints get() = getNbTendonJoints() @@ -1272,7 +1293,9 @@ var PxArticulationFixedTendon.limitParameters get() = getLimitParameters() set(value) { setLimitParameters(value) } -external interface PxArticulationFlags { +fun PxArticulationFixedTendon.createTendonJoint(parent: PxArticulationTendonJoint, axis: PxArticulationAxisEnum, coefficient: Float, recipCoefficient: Float, link: PxArticulationLink) = createTendonJoint(parent, axis.value, coefficient, recipCoefficient, link) + +external interface PxArticulationFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1282,32 +1305,32 @@ external interface PxArticulationFlags { * @param flag WebIDL type: [PxArticulationFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxArticulationFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxArticulationFlagEnum] (enum) */ - fun raise(flag: PxArticulationFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxArticulationFlagEnum] (enum) */ - fun clear(flag: PxArticulationFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxArticulationFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationFlags = js("new _module.PxArticulationFlags(flags)") +fun PxArticulationFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationFlags = js("new _module.PxArticulationFlags(flags)") -fun PxArticulationFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationFlags = js("_module.wrapPointer(ptr, _module.PxArticulationFlags)") +fun PxArticulationFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationFlags = js("_module.wrapPointer(ptr, _module.PxArticulationFlags)") -fun PxArticulationFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationFlags.isSet(flag: PxArticulationFlagEnum) = isSet(flag.value) +fun PxArticulationFlags.raise(flag: PxArticulationFlagEnum) = raise(flag.value) +fun PxArticulationFlags.clear(flag: PxArticulationFlagEnum) = clear(flag.value) -external interface PxArticulationJointReducedCoordinate : PxBase { +external interface PxArticulationJointReducedCoordinate : JsAny, DestroyableNative, PxBase { /** * @return WebIDL type: [PxArticulationLink] (Ref) */ @@ -1341,92 +1364,92 @@ external interface PxArticulationJointReducedCoordinate : PxBase { /** * @param jointType WebIDL type: [PxArticulationJointTypeEnum] (enum) */ - fun setJointType(jointType: PxArticulationJointTypeEnum) + fun setJointType(jointType: Int) /** * @return WebIDL type: [PxArticulationJointTypeEnum] (enum) */ - fun getJointType(): PxArticulationJointTypeEnum + fun getJointType(): Int /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param motion WebIDL type: [PxArticulationMotionEnum] (enum) */ - fun setMotion(axis: PxArticulationAxisEnum, motion: PxArticulationMotionEnum) + fun setMotion(axis: Int, motion: Int) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: [PxArticulationMotionEnum] (enum) */ - fun getMotion(axis: PxArticulationAxisEnum): PxArticulationMotionEnum + fun getMotion(axis: Int): Int /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param limit WebIDL type: [PxArticulationLimit] (Const, Ref) */ - fun setLimitParams(axis: PxArticulationAxisEnum, limit: PxArticulationLimit) + fun setLimitParams(axis: Int, limit: PxArticulationLimit) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: [PxArticulationLimit] (Value) */ - fun getLimitParams(axis: PxArticulationAxisEnum): PxArticulationLimit + fun getLimitParams(axis: Int): PxArticulationLimit /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param drive WebIDL type: [PxArticulationDrive] (Const, Ref) */ - fun setDriveParams(axis: PxArticulationAxisEnum, drive: PxArticulationDrive) + fun setDriveParams(axis: Int, drive: PxArticulationDrive) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param target WebIDL type: float */ - fun setDriveTarget(axis: PxArticulationAxisEnum, target: Float) + fun setDriveTarget(axis: Int, target: Float) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param target WebIDL type: float * @param autowake WebIDL type: boolean */ - fun setDriveTarget(axis: PxArticulationAxisEnum, target: Float, autowake: Boolean) + fun setDriveTarget(axis: Int, target: Float, autowake: Boolean) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: float */ - fun getDriveTarget(axis: PxArticulationAxisEnum): Float + fun getDriveTarget(axis: Int): Float /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param targetVel WebIDL type: float */ - fun setDriveVelocity(axis: PxArticulationAxisEnum, targetVel: Float) + fun setDriveVelocity(axis: Int, targetVel: Float) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param targetVel WebIDL type: float * @param autowake WebIDL type: boolean */ - fun setDriveVelocity(axis: PxArticulationAxisEnum, targetVel: Float, autowake: Boolean) + fun setDriveVelocity(axis: Int, targetVel: Float, autowake: Boolean) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: float */ - fun getDriveVelocity(axis: PxArticulationAxisEnum): Float + fun getDriveVelocity(axis: Int): Float /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param armature WebIDL type: float */ - fun setArmature(axis: PxArticulationAxisEnum, armature: Float) + fun setArmature(axis: Int, armature: Float) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: float */ - fun getArmature(axis: PxArticulationAxisEnum): Float + fun getArmature(axis: Int): Float /** * @param coefficient WebIDL type: float @@ -1452,33 +1475,29 @@ external interface PxArticulationJointReducedCoordinate : PxBase { * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param jointPos WebIDL type: float */ - fun setJointPosition(axis: PxArticulationAxisEnum, jointPos: Float) + fun setJointPosition(axis: Int, jointPos: Float) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: float */ - fun getJointPosition(axis: PxArticulationAxisEnum): Float + fun getJointPosition(axis: Int): Float /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param jointVel WebIDL type: float */ - fun setJointVelocity(axis: PxArticulationAxisEnum, jointVel: Float) + fun setJointVelocity(axis: Int, jointVel: Float) /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @return WebIDL type: float */ - fun getJointVelocity(axis: PxArticulationAxisEnum): Float + fun getJointVelocity(axis: Int): Float } -fun PxArticulationJointReducedCoordinateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationJointReducedCoordinate = js("_module.wrapPointer(ptr, _module.PxArticulationJointReducedCoordinate)") - -fun PxArticulationJointReducedCoordinate.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationJointReducedCoordinateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationJointReducedCoordinate = js("_module.wrapPointer(ptr, _module.PxArticulationJointReducedCoordinate)") val PxArticulationJointReducedCoordinate.parentArticulationLink get() = getParentArticulationLink() @@ -1491,9 +1510,9 @@ var PxArticulationJointReducedCoordinate.parentPose var PxArticulationJointReducedCoordinate.childPose get() = getChildPose() set(value) { setChildPose(value) } -var PxArticulationJointReducedCoordinate.jointType - get() = getJointType() - set(value) { setJointType(value) } +var PxArticulationJointReducedCoordinate.jointType: PxArticulationJointTypeEnum + get() = PxArticulationJointTypeEnum.forValue(getJointType()) + set(value) { setJointType(value.value) } var PxArticulationJointReducedCoordinate.frictionCoefficient get() = getFrictionCoefficient() set(value) { setFrictionCoefficient(value) } @@ -1501,7 +1520,26 @@ var PxArticulationJointReducedCoordinate.maxJointVelocity get() = getMaxJointVelocity() set(value) { setMaxJointVelocity(value) } -external interface PxArticulationKinematicFlags { +fun PxArticulationJointReducedCoordinate.setJointType(jointType: PxArticulationJointTypeEnum) = setJointType(jointType.value) +fun PxArticulationJointReducedCoordinate.setMotion(axis: PxArticulationAxisEnum, motion: PxArticulationMotionEnum) = setMotion(axis.value, motion.value) +fun PxArticulationJointReducedCoordinate.getMotion(axis: PxArticulationAxisEnum) = PxArticulationMotionEnum.forValue(getMotion(axis.value)) +fun PxArticulationJointReducedCoordinate.setLimitParams(axis: PxArticulationAxisEnum, limit: PxArticulationLimit) = setLimitParams(axis.value, limit) +fun PxArticulationJointReducedCoordinate.getLimitParams(axis: PxArticulationAxisEnum) = getLimitParams(axis.value) +fun PxArticulationJointReducedCoordinate.setDriveParams(axis: PxArticulationAxisEnum, drive: PxArticulationDrive) = setDriveParams(axis.value, drive) +fun PxArticulationJointReducedCoordinate.setDriveTarget(axis: PxArticulationAxisEnum, target: Float) = setDriveTarget(axis.value, target) +fun PxArticulationJointReducedCoordinate.setDriveTarget(axis: PxArticulationAxisEnum, target: Float, autowake: Boolean) = setDriveTarget(axis.value, target, autowake) +fun PxArticulationJointReducedCoordinate.getDriveTarget(axis: PxArticulationAxisEnum) = getDriveTarget(axis.value) +fun PxArticulationJointReducedCoordinate.setDriveVelocity(axis: PxArticulationAxisEnum, targetVel: Float) = setDriveVelocity(axis.value, targetVel) +fun PxArticulationJointReducedCoordinate.setDriveVelocity(axis: PxArticulationAxisEnum, targetVel: Float, autowake: Boolean) = setDriveVelocity(axis.value, targetVel, autowake) +fun PxArticulationJointReducedCoordinate.getDriveVelocity(axis: PxArticulationAxisEnum) = getDriveVelocity(axis.value) +fun PxArticulationJointReducedCoordinate.setArmature(axis: PxArticulationAxisEnum, armature: Float) = setArmature(axis.value, armature) +fun PxArticulationJointReducedCoordinate.getArmature(axis: PxArticulationAxisEnum) = getArmature(axis.value) +fun PxArticulationJointReducedCoordinate.setJointPosition(axis: PxArticulationAxisEnum, jointPos: Float) = setJointPosition(axis.value, jointPos) +fun PxArticulationJointReducedCoordinate.getJointPosition(axis: PxArticulationAxisEnum) = getJointPosition(axis.value) +fun PxArticulationJointReducedCoordinate.setJointVelocity(axis: PxArticulationAxisEnum, jointVel: Float) = setJointVelocity(axis.value, jointVel) +fun PxArticulationJointReducedCoordinate.getJointVelocity(axis: PxArticulationAxisEnum) = getJointVelocity(axis.value) + +external interface PxArticulationKinematicFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -1511,32 +1549,32 @@ external interface PxArticulationKinematicFlags { * @param flag WebIDL type: [PxArticulationKinematicFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxArticulationKinematicFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxArticulationKinematicFlagEnum] (enum) */ - fun raise(flag: PxArticulationKinematicFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxArticulationKinematicFlagEnum] (enum) */ - fun clear(flag: PxArticulationKinematicFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxArticulationKinematicFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationKinematicFlags = js("new _module.PxArticulationKinematicFlags(flags)") +fun PxArticulationKinematicFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationKinematicFlags = js("new _module.PxArticulationKinematicFlags(flags)") -fun PxArticulationKinematicFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationKinematicFlags = js("_module.wrapPointer(ptr, _module.PxArticulationKinematicFlags)") +fun PxArticulationKinematicFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationKinematicFlags = js("_module.wrapPointer(ptr, _module.PxArticulationKinematicFlags)") -fun PxArticulationKinematicFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationKinematicFlags.isSet(flag: PxArticulationKinematicFlagEnum) = isSet(flag.value) +fun PxArticulationKinematicFlags.raise(flag: PxArticulationKinematicFlagEnum) = raise(flag.value) +fun PxArticulationKinematicFlags.clear(flag: PxArticulationKinematicFlagEnum) = clear(flag.value) -external interface PxArticulationLink : PxRigidBody { +external interface PxArticulationLink : JsAny, PxRigidBody { /** * @return WebIDL type: [PxArticulationReducedCoordinate] (Ref) */ @@ -1574,7 +1612,7 @@ external interface PxArticulationLink : PxRigidBody { } -fun PxArticulationLinkFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationLink = js("_module.wrapPointer(ptr, _module.PxArticulationLink)") +fun PxArticulationLinkFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationLink = js("_module.wrapPointer(ptr, _module.PxArticulationLink)") val PxArticulationLink.articulation get() = getArticulation() @@ -1591,7 +1629,7 @@ var PxArticulationLink.cfmScale get() = getCfmScale() set(value) { setCfmScale(value) } -external interface PxArticulationLimit { +external interface PxArticulationLimit : JsAny, DestroyableNative { /** * Native object address. */ @@ -1607,21 +1645,17 @@ external interface PxArticulationLimit { var high: Float } -fun PxArticulationLimit(_module: dynamic = PhysXJsLoader.physXJs): PxArticulationLimit = js("new _module.PxArticulationLimit()") +fun PxArticulationLimit(_module: JsAny = PhysXJsLoader.physXJs): PxArticulationLimit = js("new _module.PxArticulationLimit()") /** * @param low WebIDL type: float * @param high WebIDL type: float */ -fun PxArticulationLimit(low: Float, high: Float, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationLimit = js("new _module.PxArticulationLimit(low, high)") +fun PxArticulationLimit(low: Float, high: Float, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationLimit = js("new _module.PxArticulationLimit(low, high)") -fun PxArticulationLimitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationLimit = js("_module.wrapPointer(ptr, _module.PxArticulationLimit)") +fun PxArticulationLimitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationLimit = js("_module.wrapPointer(ptr, _module.PxArticulationLimit)") -fun PxArticulationLimit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxArticulationRootLinkData { +external interface PxArticulationRootLinkData : JsAny, DestroyableNative { /** * Native object address. */ @@ -1649,15 +1683,11 @@ external interface PxArticulationRootLinkData { var worldAngAccel: PxVec3 } -fun PxArticulationRootLinkData(_module: dynamic = PhysXJsLoader.physXJs): PxArticulationRootLinkData = js("new _module.PxArticulationRootLinkData()") - -fun PxArticulationRootLinkDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationRootLinkData = js("_module.wrapPointer(ptr, _module.PxArticulationRootLinkData)") +fun PxArticulationRootLinkData(_module: JsAny = PhysXJsLoader.physXJs): PxArticulationRootLinkData = js("new _module.PxArticulationRootLinkData()") -fun PxArticulationRootLinkData.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationRootLinkDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationRootLinkData = js("_module.wrapPointer(ptr, _module.PxArticulationRootLinkData)") -external interface PxArticulationReducedCoordinate : PxBase { +external interface PxArticulationReducedCoordinate : JsAny, DestroyableNative, PxBase { /** * @return WebIDL type: [PxScene] */ @@ -1765,7 +1795,7 @@ external interface PxArticulationReducedCoordinate : PxBase { * @param flag WebIDL type: [PxArticulationFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setArticulationFlag(flag: PxArticulationFlagEnum, value: Boolean) + fun setArticulationFlag(flag: Int, value: Boolean) /** * @return WebIDL type: [PxArticulationFlags] (Value) @@ -1980,11 +2010,7 @@ external interface PxArticulationReducedCoordinate : PxBase { } -fun PxArticulationReducedCoordinateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationReducedCoordinate = js("_module.wrapPointer(ptr, _module.PxArticulationReducedCoordinate)") - -fun PxArticulationReducedCoordinate.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationReducedCoordinateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationReducedCoordinate = js("_module.wrapPointer(ptr, _module.PxArticulationReducedCoordinate)") val PxArticulationReducedCoordinate.scene get() = getScene() @@ -2036,7 +2062,9 @@ var PxArticulationReducedCoordinate.rootAngularVelocity get() = getRootAngularVelocity() set(value) { setRootAngularVelocity(value) } -external interface PxArticulationSpatialTendon : PxArticulationTendon { +fun PxArticulationReducedCoordinate.setArticulationFlag(flag: PxArticulationFlagEnum, value: Boolean) = setArticulationFlag(flag.value, value) + +external interface PxArticulationSpatialTendon : JsAny, DestroyableNative, PxArticulationTendon { /** * @param parent WebIDL type: [PxArticulationAttachment] * @param coefficient WebIDL type: float @@ -2053,16 +2081,12 @@ external interface PxArticulationSpatialTendon : PxArticulationTendon { } -fun PxArticulationSpatialTendonFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationSpatialTendon = js("_module.wrapPointer(ptr, _module.PxArticulationSpatialTendon)") - -fun PxArticulationSpatialTendon.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationSpatialTendonFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationSpatialTendon = js("_module.wrapPointer(ptr, _module.PxArticulationSpatialTendon)") val PxArticulationSpatialTendon.nbAttachments get() = getNbAttachments() -external interface PxArticulationTendon : PxBase { +external interface PxArticulationTendon : JsAny, DestroyableNative, PxBase { /** * @param stiffness WebIDL type: float */ @@ -2116,11 +2140,7 @@ external interface PxArticulationTendon : PxBase { } -fun PxArticulationTendonFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationTendon = js("_module.wrapPointer(ptr, _module.PxArticulationTendon)") - -fun PxArticulationTendon.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationTendonFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationTendon = js("_module.wrapPointer(ptr, _module.PxArticulationTendon)") val PxArticulationTendon.articulation get() = getArticulation() @@ -2138,7 +2158,7 @@ var PxArticulationTendon.offset get() = getOffset() set(value) { setOffset(value) } -external interface PxArticulationTendonJoint { +external interface PxArticulationTendonJoint : JsAny, DestroyableNative { /** * Native object address. */ @@ -2147,14 +2167,14 @@ external interface PxArticulationTendonJoint { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @param axis WebIDL type: [PxArticulationAxisEnum] (enum) * @param coefficient WebIDL type: float * @param recipCoefficient WebIDL type: float */ - fun setCoefficient(axis: PxArticulationAxisEnum, coefficient: Float, recipCoefficient: Float) + fun setCoefficient(axis: Int, coefficient: Float, recipCoefficient: Float) /** * @return WebIDL type: [PxArticulationLink] @@ -2175,11 +2195,7 @@ external interface PxArticulationTendonJoint { } -fun PxArticulationTendonJointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationTendonJoint = js("_module.wrapPointer(ptr, _module.PxArticulationTendonJoint)") - -fun PxArticulationTendonJoint.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxArticulationTendonJointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationTendonJoint = js("_module.wrapPointer(ptr, _module.PxArticulationTendonJoint)") val PxArticulationTendonJoint.link get() = getLink() @@ -2188,7 +2204,9 @@ val PxArticulationTendonJoint.parent val PxArticulationTendonJoint.tendon get() = getTendon() -external interface PxArticulationTendonLimit { +fun PxArticulationTendonJoint.setCoefficient(axis: PxArticulationAxisEnum, coefficient: Float, recipCoefficient: Float) = setCoefficient(axis.value, coefficient, recipCoefficient) + +external interface PxArticulationTendonLimit : JsAny, DestroyableNative { /** * Native object address. */ @@ -2204,13 +2222,9 @@ external interface PxArticulationTendonLimit { var highLimit: Float } -fun PxArticulationTendonLimitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxArticulationTendonLimit = js("_module.wrapPointer(ptr, _module.PxArticulationTendonLimit)") +fun PxArticulationTendonLimitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArticulationTendonLimit = js("_module.wrapPointer(ptr, _module.PxArticulationTendonLimit)") -fun PxArticulationTendonLimit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxSpatialForce { +external interface PxSpatialForce : JsAny, DestroyableNative { /** * Native object address. */ @@ -2226,13 +2240,9 @@ external interface PxSpatialForce { var torque: PxVec3 } -fun PxSpatialForceFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSpatialForce = js("_module.wrapPointer(ptr, _module.PxSpatialForce)") +fun PxSpatialForceFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSpatialForce = js("_module.wrapPointer(ptr, _module.PxSpatialForce)") -fun PxSpatialForce.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxSpatialVelocity { +external interface PxSpatialVelocity : JsAny, DestroyableNative { /** * Native object address. */ @@ -2248,13 +2258,9 @@ external interface PxSpatialVelocity { var angular: PxVec3 } -fun PxSpatialVelocityFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSpatialVelocity = js("_module.wrapPointer(ptr, _module.PxSpatialVelocity)") - -fun PxSpatialVelocity.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSpatialVelocityFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSpatialVelocity = js("_module.wrapPointer(ptr, _module.PxSpatialVelocity)") -external interface PxGeomRaycastHit : PxLocationHit { +external interface PxGeomRaycastHit : JsAny, DestroyableNative, PxLocationHit { /** * WebIDL type: float */ @@ -2271,13 +2277,9 @@ external interface PxGeomRaycastHit : PxLocationHit { } -fun PxGeomRaycastHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGeomRaycastHit = js("_module.wrapPointer(ptr, _module.PxGeomRaycastHit)") - -fun PxGeomRaycastHit.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxGeomRaycastHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGeomRaycastHit = js("_module.wrapPointer(ptr, _module.PxGeomRaycastHit)") -external interface PxGeomSweepHit : PxLocationHit { +external interface PxGeomSweepHit : JsAny, DestroyableNative, PxLocationHit { /** * @return WebIDL type: boolean */ @@ -2285,13 +2287,9 @@ external interface PxGeomSweepHit : PxLocationHit { } -fun PxGeomSweepHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxGeomSweepHit = js("_module.wrapPointer(ptr, _module.PxGeomSweepHit)") +fun PxGeomSweepHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxGeomSweepHit = js("_module.wrapPointer(ptr, _module.PxGeomSweepHit)") -fun PxGeomSweepHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxHitFlags { +external interface PxHitFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -2301,32 +2299,32 @@ external interface PxHitFlags { * @param flag WebIDL type: [PxHitFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxHitFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxHitFlagEnum] (enum) */ - fun raise(flag: PxHitFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxHitFlagEnum] (enum) */ - fun clear(flag: PxHitFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxHitFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxHitFlags = js("new _module.PxHitFlags(flags)") +fun PxHitFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxHitFlags = js("new _module.PxHitFlags(flags)") -fun PxHitFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxHitFlags = js("_module.wrapPointer(ptr, _module.PxHitFlags)") +fun PxHitFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxHitFlags = js("_module.wrapPointer(ptr, _module.PxHitFlags)") -fun PxHitFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxHitFlags.isSet(flag: PxHitFlagEnum) = isSet(flag.value) +fun PxHitFlags.raise(flag: PxHitFlagEnum) = raise(flag.value) +fun PxHitFlags.clear(flag: PxHitFlagEnum) = clear(flag.value) -external interface PxLocationHit : PxQueryHit { +external interface PxLocationHit : JsAny, DestroyableNative, PxQueryHit { /** * WebIDL type: [PxHitFlags] (Value) */ @@ -2345,13 +2343,9 @@ external interface PxLocationHit : PxQueryHit { var distance: Float } -fun PxLocationHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxLocationHit = js("_module.wrapPointer(ptr, _module.PxLocationHit)") +fun PxLocationHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxLocationHit = js("_module.wrapPointer(ptr, _module.PxLocationHit)") -fun PxLocationHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxOverlapBuffer10 : PxOverlapCallback { +external interface PxOverlapBuffer10 : JsAny, DestroyableNative, PxOverlapCallback { /** * WebIDL type: [PxOverlapHit] (Value) */ @@ -2395,13 +2389,9 @@ external interface PxOverlapBuffer10 : PxOverlapCallback { } -fun PxOverlapBuffer10(_module: dynamic = PhysXJsLoader.physXJs): PxOverlapBuffer10 = js("new _module.PxOverlapBuffer10()") +fun PxOverlapBuffer10(_module: JsAny = PhysXJsLoader.physXJs): PxOverlapBuffer10 = js("new _module.PxOverlapBuffer10()") -fun PxOverlapBuffer10FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxOverlapBuffer10 = js("_module.wrapPointer(ptr, _module.PxOverlapBuffer10)") - -fun PxOverlapBuffer10.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxOverlapBuffer10FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxOverlapBuffer10 = js("_module.wrapPointer(ptr, _module.PxOverlapBuffer10)") val PxOverlapBuffer10.nbAnyHits get() = getNbAnyHits() @@ -2412,7 +2402,7 @@ val PxOverlapBuffer10.touches val PxOverlapBuffer10.maxNbTouches get() = getMaxNbTouches() -external interface PxOverlapResult : PxOverlapCallback { +external interface PxOverlapResult : JsAny, DestroyableNative, PxOverlapCallback { /** * WebIDL type: [PxOverlapHit] (Value) */ @@ -2448,20 +2438,16 @@ external interface PxOverlapResult : PxOverlapCallback { } -fun PxOverlapResult(_module: dynamic = PhysXJsLoader.physXJs): PxOverlapResult = js("new _module.PxOverlapResult()") - -fun PxOverlapResultFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxOverlapResult = js("_module.wrapPointer(ptr, _module.PxOverlapResult)") +fun PxOverlapResult(_module: JsAny = PhysXJsLoader.physXJs): PxOverlapResult = js("new _module.PxOverlapResult()") -fun PxOverlapResult.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxOverlapResultFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxOverlapResult = js("_module.wrapPointer(ptr, _module.PxOverlapResult)") val PxOverlapResult.nbAnyHits get() = getNbAnyHits() val PxOverlapResult.nbTouches get() = getNbTouches() -external interface PxOverlapCallback { +external interface PxOverlapCallback : JsAny, DestroyableNative { /** * Native object address. */ @@ -2474,13 +2460,9 @@ external interface PxOverlapCallback { } -fun PxOverlapCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxOverlapCallback = js("_module.wrapPointer(ptr, _module.PxOverlapCallback)") - -fun PxOverlapCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxOverlapCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxOverlapCallback = js("_module.wrapPointer(ptr, _module.PxOverlapCallback)") -external interface PxOverlapHit : PxQueryHit { +external interface PxOverlapHit : JsAny, DestroyableNative, PxQueryHit { /** * WebIDL type: [PxRigidActor] */ @@ -2491,21 +2473,13 @@ external interface PxOverlapHit : PxQueryHit { var shape: PxShape } -fun PxOverlapHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxOverlapHit = js("_module.wrapPointer(ptr, _module.PxOverlapHit)") +fun PxOverlapHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxOverlapHit = js("_module.wrapPointer(ptr, _module.PxOverlapHit)") -fun PxOverlapHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxQueryFilterCallback - -fun PxQueryFilterCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxQueryFilterCallback = js("_module.wrapPointer(ptr, _module.PxQueryFilterCallback)") +external interface PxQueryFilterCallback : JsAny, DestroyableNative -fun PxQueryFilterCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxQueryFilterCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxQueryFilterCallback = js("_module.wrapPointer(ptr, _module.PxQueryFilterCallback)") -external interface SimpleQueryFilterCallback : PxQueryFilterCallback { +external interface SimpleQueryFilterCallback : JsAny, DestroyableNative, PxQueryFilterCallback { /** * @param filterData WebIDL type: [PxFilterData] (Const, Ref) * @param shape WebIDL type: [PxShape] (Const) @@ -2526,11 +2500,7 @@ external interface SimpleQueryFilterCallback : PxQueryFilterCallback { } -fun SimpleQueryFilterCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): SimpleQueryFilterCallback = js("_module.wrapPointer(ptr, _module.SimpleQueryFilterCallback)") - -fun SimpleQueryFilterCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun SimpleQueryFilterCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): SimpleQueryFilterCallback = js("_module.wrapPointer(ptr, _module.SimpleQueryFilterCallback)") external interface PxQueryFilterCallbackImpl : SimpleQueryFilterCallback { /** @@ -2553,9 +2523,9 @@ external interface PxQueryFilterCallbackImpl : SimpleQueryFilterCallback { } -fun PxQueryFilterCallbackImpl(_module: dynamic = PhysXJsLoader.physXJs): PxQueryFilterCallbackImpl = js("new _module.PxQueryFilterCallbackImpl()") +fun PxQueryFilterCallbackImpl(_module: JsAny = PhysXJsLoader.physXJs): PxQueryFilterCallbackImpl = js("new _module.PxQueryFilterCallbackImpl()") -external interface PxQueryFilterData { +external interface PxQueryFilterData : JsAny, DestroyableNative { /** * Native object address. */ @@ -2571,26 +2541,22 @@ external interface PxQueryFilterData { var flags: PxQueryFlags } -fun PxQueryFilterData(_module: dynamic = PhysXJsLoader.physXJs): PxQueryFilterData = js("new _module.PxQueryFilterData()") +fun PxQueryFilterData(_module: JsAny = PhysXJsLoader.physXJs): PxQueryFilterData = js("new _module.PxQueryFilterData()") /** * @param fd WebIDL type: [PxFilterData] (Const, Ref) * @param f WebIDL type: [PxQueryFlags] (Ref) */ -fun PxQueryFilterData(fd: PxFilterData, f: PxQueryFlags, _module: dynamic = PhysXJsLoader.physXJs): PxQueryFilterData = js("new _module.PxQueryFilterData(fd, f)") +fun PxQueryFilterData(fd: PxFilterData, f: PxQueryFlags, _module: JsAny = PhysXJsLoader.physXJs): PxQueryFilterData = js("new _module.PxQueryFilterData(fd, f)") /** * @param f WebIDL type: [PxQueryFlags] (Ref) */ -fun PxQueryFilterData(f: PxQueryFlags, _module: dynamic = PhysXJsLoader.physXJs): PxQueryFilterData = js("new _module.PxQueryFilterData(f)") +fun PxQueryFilterData(f: PxQueryFlags, _module: JsAny = PhysXJsLoader.physXJs): PxQueryFilterData = js("new _module.PxQueryFilterData(f)") -fun PxQueryFilterDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxQueryFilterData = js("_module.wrapPointer(ptr, _module.PxQueryFilterData)") +fun PxQueryFilterDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxQueryFilterData = js("_module.wrapPointer(ptr, _module.PxQueryFilterData)") -fun PxQueryFilterData.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxQueryFlags { +external interface PxQueryFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -2600,32 +2566,32 @@ external interface PxQueryFlags { * @param flag WebIDL type: [PxQueryFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxQueryFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxQueryFlagEnum] (enum) */ - fun raise(flag: PxQueryFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxQueryFlagEnum] (enum) */ - fun clear(flag: PxQueryFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxQueryFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxQueryFlags = js("new _module.PxQueryFlags(flags)") +fun PxQueryFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxQueryFlags = js("new _module.PxQueryFlags(flags)") -fun PxQueryFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxQueryFlags = js("_module.wrapPointer(ptr, _module.PxQueryFlags)") +fun PxQueryFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxQueryFlags = js("_module.wrapPointer(ptr, _module.PxQueryFlags)") -fun PxQueryFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxQueryFlags.isSet(flag: PxQueryFlagEnum) = isSet(flag.value) +fun PxQueryFlags.raise(flag: PxQueryFlagEnum) = raise(flag.value) +fun PxQueryFlags.clear(flag: PxQueryFlagEnum) = clear(flag.value) -external interface PxQueryHit { +external interface PxQueryHit : JsAny, DestroyableNative { /** * Native object address. */ @@ -2637,13 +2603,9 @@ external interface PxQueryHit { var faceIndex: Int } -fun PxQueryHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxQueryHit = js("_module.wrapPointer(ptr, _module.PxQueryHit)") - -fun PxQueryHit.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxQueryHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxQueryHit = js("_module.wrapPointer(ptr, _module.PxQueryHit)") -external interface PxRaycastBuffer10 : PxRaycastCallback { +external interface PxRaycastBuffer10 : JsAny, DestroyableNative, PxRaycastCallback { /** * WebIDL type: [PxRaycastHit] (Value) */ @@ -2687,13 +2649,9 @@ external interface PxRaycastBuffer10 : PxRaycastCallback { } -fun PxRaycastBuffer10(_module: dynamic = PhysXJsLoader.physXJs): PxRaycastBuffer10 = js("new _module.PxRaycastBuffer10()") +fun PxRaycastBuffer10(_module: JsAny = PhysXJsLoader.physXJs): PxRaycastBuffer10 = js("new _module.PxRaycastBuffer10()") -fun PxRaycastBuffer10FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRaycastBuffer10 = js("_module.wrapPointer(ptr, _module.PxRaycastBuffer10)") - -fun PxRaycastBuffer10.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRaycastBuffer10FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRaycastBuffer10 = js("_module.wrapPointer(ptr, _module.PxRaycastBuffer10)") val PxRaycastBuffer10.nbAnyHits get() = getNbAnyHits() @@ -2704,7 +2662,7 @@ val PxRaycastBuffer10.touches val PxRaycastBuffer10.maxNbTouches get() = getMaxNbTouches() -external interface PxRaycastResult : PxRaycastCallback { +external interface PxRaycastResult : JsAny, DestroyableNative, PxRaycastCallback { /** * WebIDL type: [PxRaycastHit] (Value) */ @@ -2740,20 +2698,16 @@ external interface PxRaycastResult : PxRaycastCallback { } -fun PxRaycastResult(_module: dynamic = PhysXJsLoader.physXJs): PxRaycastResult = js("new _module.PxRaycastResult()") - -fun PxRaycastResultFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRaycastResult = js("_module.wrapPointer(ptr, _module.PxRaycastResult)") +fun PxRaycastResult(_module: JsAny = PhysXJsLoader.physXJs): PxRaycastResult = js("new _module.PxRaycastResult()") -fun PxRaycastResult.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRaycastResultFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRaycastResult = js("_module.wrapPointer(ptr, _module.PxRaycastResult)") val PxRaycastResult.nbAnyHits get() = getNbAnyHits() val PxRaycastResult.nbTouches get() = getNbTouches() -external interface PxRaycastCallback { +external interface PxRaycastCallback : JsAny, DestroyableNative { /** * Native object address. */ @@ -2766,13 +2720,9 @@ external interface PxRaycastCallback { } -fun PxRaycastCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRaycastCallback = js("_module.wrapPointer(ptr, _module.PxRaycastCallback)") - -fun PxRaycastCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRaycastCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRaycastCallback = js("_module.wrapPointer(ptr, _module.PxRaycastCallback)") -external interface PxRaycastHit : PxGeomRaycastHit { +external interface PxRaycastHit : JsAny, DestroyableNative, PxGeomRaycastHit { /** * WebIDL type: [PxRigidActor] */ @@ -2783,15 +2733,11 @@ external interface PxRaycastHit : PxGeomRaycastHit { var shape: PxShape } -fun PxRaycastHit(_module: dynamic = PhysXJsLoader.physXJs): PxRaycastHit = js("new _module.PxRaycastHit()") +fun PxRaycastHit(_module: JsAny = PhysXJsLoader.physXJs): PxRaycastHit = js("new _module.PxRaycastHit()") -fun PxRaycastHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRaycastHit = js("_module.wrapPointer(ptr, _module.PxRaycastHit)") +fun PxRaycastHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRaycastHit = js("_module.wrapPointer(ptr, _module.PxRaycastHit)") -fun PxRaycastHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxSceneQuerySystemBase { +external interface PxSceneQuerySystemBase : JsAny { /** * Native object address. */ @@ -2815,12 +2761,12 @@ external interface PxSceneQuerySystemBase { /** * @param updateMode WebIDL type: [PxSceneQueryUpdateModeEnum] (enum) */ - fun setUpdateMode(updateMode: PxSceneQueryUpdateModeEnum) + fun setUpdateMode(updateMode: Int) /** * @return WebIDL type: [PxSceneQueryUpdateModeEnum] (enum) */ - fun getUpdateMode(): PxSceneQueryUpdateModeEnum + fun getUpdateMode(): Int /** * @return WebIDL type: unsigned long @@ -2911,7 +2857,7 @@ external interface PxSceneQuerySystemBase { } -fun PxSceneQuerySystemBaseFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSceneQuerySystemBase = js("_module.wrapPointer(ptr, _module.PxSceneQuerySystemBase)") +fun PxSceneQuerySystemBaseFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSceneQuerySystemBase = js("_module.wrapPointer(ptr, _module.PxSceneQuerySystemBase)") val PxSceneQuerySystemBase.staticTimestamp get() = getStaticTimestamp() @@ -2919,20 +2865,22 @@ val PxSceneQuerySystemBase.staticTimestamp var PxSceneQuerySystemBase.dynamicTreeRebuildRateHint get() = getDynamicTreeRebuildRateHint() set(value) { setDynamicTreeRebuildRateHint(value) } -var PxSceneQuerySystemBase.updateMode - get() = getUpdateMode() - set(value) { setUpdateMode(value) } +var PxSceneQuerySystemBase.updateMode: PxSceneQueryUpdateModeEnum + get() = PxSceneQueryUpdateModeEnum.forValue(getUpdateMode()) + set(value) { setUpdateMode(value.value) } + +fun PxSceneQuerySystemBase.setUpdateMode(updateMode: PxSceneQueryUpdateModeEnum) = setUpdateMode(updateMode.value) -external interface PxSceneSQSystem : PxSceneQuerySystemBase { +external interface PxSceneSQSystem : JsAny, PxSceneQuerySystemBase { /** * @param updateMode WebIDL type: [PxSceneQueryUpdateModeEnum] (enum) */ - fun setSceneQueryUpdateMode(updateMode: PxSceneQueryUpdateModeEnum) + fun setSceneQueryUpdateMode(updateMode: Int) /** * @return WebIDL type: [PxSceneQueryUpdateModeEnum] (enum) */ - fun getSceneQueryUpdateMode(): PxSceneQueryUpdateModeEnum + fun getSceneQueryUpdateMode(): Int /** * @return WebIDL type: unsigned long @@ -2950,12 +2898,12 @@ external interface PxSceneSQSystem : PxSceneQuerySystemBase { /** * @return WebIDL type: [PxPruningStructureTypeEnum] (enum) */ - fun getStaticStructure(): PxPruningStructureTypeEnum + fun getStaticStructure(): Int /** * @return WebIDL type: [PxPruningStructureTypeEnum] (enum) */ - fun getDynamicStructure(): PxPruningStructureTypeEnum + fun getDynamicStructure(): Int fun sceneQueriesUpdate() @@ -2994,20 +2942,22 @@ external interface PxSceneSQSystem : PxSceneQuerySystemBase { } -fun PxSceneSQSystemFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSceneSQSystem = js("_module.wrapPointer(ptr, _module.PxSceneSQSystem)") +fun PxSceneSQSystemFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSceneSQSystem = js("_module.wrapPointer(ptr, _module.PxSceneSQSystem)") val PxSceneSQSystem.sceneQueryStaticTimestamp get() = getSceneQueryStaticTimestamp() -val PxSceneSQSystem.staticStructure - get() = getStaticStructure() -val PxSceneSQSystem.dynamicStructure - get() = getDynamicStructure() +val PxSceneSQSystem.staticStructure: PxPruningStructureTypeEnum + get() = PxPruningStructureTypeEnum.forValue(getStaticStructure()) +val PxSceneSQSystem.dynamicStructure: PxPruningStructureTypeEnum + get() = PxPruningStructureTypeEnum.forValue(getDynamicStructure()) -var PxSceneSQSystem.sceneQueryUpdateMode - get() = getSceneQueryUpdateMode() - set(value) { setSceneQueryUpdateMode(value) } +var PxSceneSQSystem.sceneQueryUpdateMode: PxSceneQueryUpdateModeEnum + get() = PxSceneQueryUpdateModeEnum.forValue(getSceneQueryUpdateMode()) + set(value) { setSceneQueryUpdateMode(value.value) } -external interface PxSweepBuffer10 : PxSweepCallback { +fun PxSceneSQSystem.setSceneQueryUpdateMode(updateMode: PxSceneQueryUpdateModeEnum) = setSceneQueryUpdateMode(updateMode.value) + +external interface PxSweepBuffer10 : JsAny, DestroyableNative, PxSweepCallback { /** * WebIDL type: [PxSweepHit] (Value) */ @@ -3051,13 +3001,9 @@ external interface PxSweepBuffer10 : PxSweepCallback { } -fun PxSweepBuffer10(_module: dynamic = PhysXJsLoader.physXJs): PxSweepBuffer10 = js("new _module.PxSweepBuffer10()") +fun PxSweepBuffer10(_module: JsAny = PhysXJsLoader.physXJs): PxSweepBuffer10 = js("new _module.PxSweepBuffer10()") -fun PxSweepBuffer10FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSweepBuffer10 = js("_module.wrapPointer(ptr, _module.PxSweepBuffer10)") - -fun PxSweepBuffer10.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSweepBuffer10FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSweepBuffer10 = js("_module.wrapPointer(ptr, _module.PxSweepBuffer10)") val PxSweepBuffer10.nbAnyHits get() = getNbAnyHits() @@ -3068,7 +3014,7 @@ val PxSweepBuffer10.touches val PxSweepBuffer10.maxNbTouches get() = getMaxNbTouches() -external interface PxSweepResult : PxSweepCallback { +external interface PxSweepResult : JsAny, DestroyableNative, PxSweepCallback { /** * WebIDL type: [PxSweepHit] (Value) */ @@ -3104,20 +3050,16 @@ external interface PxSweepResult : PxSweepCallback { } -fun PxSweepResult(_module: dynamic = PhysXJsLoader.physXJs): PxSweepResult = js("new _module.PxSweepResult()") - -fun PxSweepResultFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSweepResult = js("_module.wrapPointer(ptr, _module.PxSweepResult)") +fun PxSweepResult(_module: JsAny = PhysXJsLoader.physXJs): PxSweepResult = js("new _module.PxSweepResult()") -fun PxSweepResult.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSweepResultFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSweepResult = js("_module.wrapPointer(ptr, _module.PxSweepResult)") val PxSweepResult.nbAnyHits get() = getNbAnyHits() val PxSweepResult.nbTouches get() = getNbTouches() -external interface PxSweepCallback { +external interface PxSweepCallback : JsAny, DestroyableNative { /** * Native object address. */ @@ -3130,13 +3072,9 @@ external interface PxSweepCallback { } -fun PxSweepCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSweepCallback = js("_module.wrapPointer(ptr, _module.PxSweepCallback)") - -fun PxSweepCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSweepCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSweepCallback = js("_module.wrapPointer(ptr, _module.PxSweepCallback)") -external interface PxSweepHit : PxGeomSweepHit { +external interface PxSweepHit : JsAny, DestroyableNative, PxGeomSweepHit { /** * WebIDL type: [PxRigidActor] */ @@ -3147,24 +3085,20 @@ external interface PxSweepHit : PxGeomSweepHit { var shape: PxShape } -fun PxSweepHit(_module: dynamic = PhysXJsLoader.physXJs): PxSweepHit = js("new _module.PxSweepHit()") +fun PxSweepHit(_module: JsAny = PhysXJsLoader.physXJs): PxSweepHit = js("new _module.PxSweepHit()") -fun PxSweepHitFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSweepHit = js("_module.wrapPointer(ptr, _module.PxSweepHit)") +fun PxSweepHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSweepHit = js("_module.wrapPointer(ptr, _module.PxSweepHit)") -fun PxSweepHit.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxActor : PxBase { +external interface PxActor : JsAny, PxBase { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @return WebIDL type: [PxActorTypeEnum] (enum) */ - fun getType(): PxActorTypeEnum + fun getType(): Int /** * @return WebIDL type: [PxScene] @@ -3196,7 +3130,7 @@ external interface PxActor : PxBase { * @param flag WebIDL type: [PxActorFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setActorFlag(flag: PxActorFlagEnum, value: Boolean) + fun setActorFlag(flag: Int, value: Boolean) /** * @param flags WebIDL type: [PxActorFlags] (Ref) @@ -3230,10 +3164,10 @@ external interface PxActor : PxBase { } -fun PxActorFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxActor = js("_module.wrapPointer(ptr, _module.PxActor)") +fun PxActorFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxActor = js("_module.wrapPointer(ptr, _module.PxActor)") -val PxActor.type - get() = getType() +val PxActor.type: PxActorTypeEnum + get() = PxActorTypeEnum.forValue(getType()) val PxActor.scene get() = getScene() val PxActor.worldBounds @@ -3252,7 +3186,9 @@ var PxActor.ownerClient get() = getOwnerClient() set(value) { setOwnerClient(value) } -external interface PxActorFlags { +fun PxActor.setActorFlag(flag: PxActorFlagEnum, value: Boolean) = setActorFlag(flag.value, value) + +external interface PxActorFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -3262,32 +3198,32 @@ external interface PxActorFlags { * @param flag WebIDL type: [PxActorFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxActorFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxActorFlagEnum] (enum) */ - fun raise(flag: PxActorFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxActorFlagEnum] (enum) */ - fun clear(flag: PxActorFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxActorFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxActorFlags = js("new _module.PxActorFlags(flags)") +fun PxActorFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxActorFlags = js("new _module.PxActorFlags(flags)") -fun PxActorFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxActorFlags = js("_module.wrapPointer(ptr, _module.PxActorFlags)") +fun PxActorFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxActorFlags = js("_module.wrapPointer(ptr, _module.PxActorFlags)") -fun PxActorFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxActorFlags.isSet(flag: PxActorFlagEnum) = isSet(flag.value) +fun PxActorFlags.raise(flag: PxActorFlagEnum) = raise(flag.value) +fun PxActorFlags.clear(flag: PxActorFlagEnum) = clear(flag.value) -external interface PxActorTypeFlags { +external interface PxActorTypeFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -3297,32 +3233,32 @@ external interface PxActorTypeFlags { * @param flag WebIDL type: [PxActorTypeFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxActorTypeFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxActorTypeFlagEnum] (enum) */ - fun raise(flag: PxActorTypeFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxActorTypeFlagEnum] (enum) */ - fun clear(flag: PxActorTypeFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxActorTypeFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxActorTypeFlags = js("new _module.PxActorTypeFlags(flags)") +fun PxActorTypeFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxActorTypeFlags = js("new _module.PxActorTypeFlags(flags)") -fun PxActorTypeFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxActorTypeFlags = js("_module.wrapPointer(ptr, _module.PxActorTypeFlags)") +fun PxActorTypeFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxActorTypeFlags = js("_module.wrapPointer(ptr, _module.PxActorTypeFlags)") -fun PxActorTypeFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxActorTypeFlags.isSet(flag: PxActorTypeFlagEnum) = isSet(flag.value) +fun PxActorTypeFlags.raise(flag: PxActorTypeFlagEnum) = raise(flag.value) +fun PxActorTypeFlags.clear(flag: PxActorTypeFlagEnum) = clear(flag.value) -external interface PxRigidActor : PxActor { +external interface PxRigidActor : JsAny, PxActor { /** * @return WebIDL type: [PxTransform] (Value) */ @@ -3376,7 +3312,7 @@ external interface PxRigidActor : PxActor { } -fun PxRigidActorFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidActor = js("_module.wrapPointer(ptr, _module.PxRigidActor)") +fun PxRigidActorFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidActor = js("_module.wrapPointer(ptr, _module.PxRigidActor)") val PxRigidActor.nbShapes get() = getNbShapes() @@ -3387,7 +3323,7 @@ var PxRigidActor.globalPose get() = getGlobalPose() set(value) { setGlobalPose(value) } -external interface PxRigidBody : PxRigidActor { +external interface PxRigidBody : JsAny, PxRigidActor { /** * @param pose WebIDL type: [PxTransform] (Const, Ref) */ @@ -3487,14 +3423,14 @@ external interface PxRigidBody : PxRigidActor { * @param force WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun addForce(force: PxVec3, mode: PxForceModeEnum) + fun addForce(force: PxVec3, mode: Int) /** * @param force WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) * @param autowake WebIDL type: boolean */ - fun addForce(force: PxVec3, mode: PxForceModeEnum, autowake: Boolean) + fun addForce(force: PxVec3, mode: Int, autowake: Boolean) /** * @param torque WebIDL type: [PxVec3] (Const, Ref) @@ -3505,24 +3441,24 @@ external interface PxRigidBody : PxRigidActor { * @param torque WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun addTorque(torque: PxVec3, mode: PxForceModeEnum) + fun addTorque(torque: PxVec3, mode: Int) /** * @param torque WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) * @param autowake WebIDL type: boolean */ - fun addTorque(torque: PxVec3, mode: PxForceModeEnum, autowake: Boolean) + fun addTorque(torque: PxVec3, mode: Int, autowake: Boolean) /** * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun clearForce(mode: PxForceModeEnum) + fun clearForce(mode: Int) /** * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun clearTorque(mode: PxForceModeEnum) + fun clearTorque(mode: Int) /** * @param force WebIDL type: [PxVec3] (Const, Ref) @@ -3535,13 +3471,13 @@ external interface PxRigidBody : PxRigidActor { * @param torque WebIDL type: [PxVec3] (Const, Ref) * @param mode WebIDL type: [PxForceModeEnum] (enum) */ - fun setForceAndTorque(force: PxVec3, torque: PxVec3, mode: PxForceModeEnum) + fun setForceAndTorque(force: PxVec3, torque: PxVec3, mode: Int) /** * @param flag WebIDL type: [PxRigidBodyFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setRigidBodyFlag(flag: PxRigidBodyFlagEnum, value: Boolean) + fun setRigidBodyFlag(flag: Int, value: Boolean) /** * @param inFlags WebIDL type: [PxRigidBodyFlags] (Ref) @@ -3595,7 +3531,7 @@ external interface PxRigidBody : PxRigidActor { } -fun PxRigidBodyFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidBody = js("_module.wrapPointer(ptr, _module.PxRigidBody)") +fun PxRigidBodyFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidBody = js("_module.wrapPointer(ptr, _module.PxRigidBody)") val PxRigidBody.invMass get() = getInvMass() @@ -3643,7 +3579,16 @@ var PxRigidBody.contactSlopCoefficient get() = getContactSlopCoefficient() set(value) { setContactSlopCoefficient(value) } -external interface PxRigidBodyFlags { +fun PxRigidBody.addForce(force: PxVec3, mode: PxForceModeEnum) = addForce(force, mode.value) +fun PxRigidBody.addForce(force: PxVec3, mode: PxForceModeEnum, autowake: Boolean) = addForce(force, mode.value, autowake) +fun PxRigidBody.addTorque(torque: PxVec3, mode: PxForceModeEnum) = addTorque(torque, mode.value) +fun PxRigidBody.addTorque(torque: PxVec3, mode: PxForceModeEnum, autowake: Boolean) = addTorque(torque, mode.value, autowake) +fun PxRigidBody.clearForce(mode: PxForceModeEnum) = clearForce(mode.value) +fun PxRigidBody.clearTorque(mode: PxForceModeEnum) = clearTorque(mode.value) +fun PxRigidBody.setForceAndTorque(force: PxVec3, torque: PxVec3, mode: PxForceModeEnum) = setForceAndTorque(force, torque, mode.value) +fun PxRigidBody.setRigidBodyFlag(flag: PxRigidBodyFlagEnum, value: Boolean) = setRigidBodyFlag(flag.value, value) + +external interface PxRigidBodyFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -3653,32 +3598,32 @@ external interface PxRigidBodyFlags { * @param flag WebIDL type: [PxRigidBodyFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxRigidBodyFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxRigidBodyFlagEnum] (enum) */ - fun raise(flag: PxRigidBodyFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxRigidBodyFlagEnum] (enum) */ - fun clear(flag: PxRigidBodyFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxRigidBodyFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxRigidBodyFlags = js("new _module.PxRigidBodyFlags(flags)") +fun PxRigidBodyFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxRigidBodyFlags = js("new _module.PxRigidBodyFlags(flags)") -fun PxRigidBodyFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidBodyFlags = js("_module.wrapPointer(ptr, _module.PxRigidBodyFlags)") +fun PxRigidBodyFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidBodyFlags = js("_module.wrapPointer(ptr, _module.PxRigidBodyFlags)") -fun PxRigidBodyFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRigidBodyFlags.isSet(flag: PxRigidBodyFlagEnum) = isSet(flag.value) +fun PxRigidBodyFlags.raise(flag: PxRigidBodyFlagEnum) = raise(flag.value) +fun PxRigidBodyFlags.clear(flag: PxRigidBodyFlagEnum) = clear(flag.value) -external interface PxRigidDynamic : PxRigidBody { +external interface PxRigidDynamic : JsAny, PxRigidBody { /** * @param destination WebIDL type: [PxTransform] (Const, Ref) */ @@ -3724,7 +3669,7 @@ external interface PxRigidDynamic : PxRigidBody { * @param flag WebIDL type: [PxRigidDynamicLockFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setRigidDynamicLockFlag(flag: PxRigidDynamicLockFlagEnum, value: Boolean) + fun setRigidDynamicLockFlag(flag: Int, value: Boolean) /** * @param flags WebIDL type: [PxRigidDynamicLockFlags] (Ref) @@ -3790,7 +3735,7 @@ external interface PxRigidDynamic : PxRigidBody { } -fun PxRigidDynamicFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidDynamic = js("_module.wrapPointer(ptr, _module.PxRigidDynamic)") +fun PxRigidDynamicFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidDynamic = js("_module.wrapPointer(ptr, _module.PxRigidDynamic)") var PxRigidDynamic.sleepThreshold get() = getSleepThreshold() @@ -3808,7 +3753,9 @@ var PxRigidDynamic.contactReportThreshold get() = getContactReportThreshold() set(value) { setContactReportThreshold(value) } -external interface PxRigidDynamicLockFlags { +fun PxRigidDynamic.setRigidDynamicLockFlag(flag: PxRigidDynamicLockFlagEnum, value: Boolean) = setRigidDynamicLockFlag(flag.value, value) + +external interface PxRigidDynamicLockFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -3818,40 +3765,40 @@ external interface PxRigidDynamicLockFlags { * @param flag WebIDL type: [PxRigidDynamicLockFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxRigidDynamicLockFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxRigidDynamicLockFlagEnum] (enum) */ - fun raise(flag: PxRigidDynamicLockFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxRigidDynamicLockFlagEnum] (enum) */ - fun clear(flag: PxRigidDynamicLockFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxRigidDynamicLockFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxRigidDynamicLockFlags = js("new _module.PxRigidDynamicLockFlags(flags)") +fun PxRigidDynamicLockFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxRigidDynamicLockFlags = js("new _module.PxRigidDynamicLockFlags(flags)") -fun PxRigidDynamicLockFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidDynamicLockFlags = js("_module.wrapPointer(ptr, _module.PxRigidDynamicLockFlags)") +fun PxRigidDynamicLockFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidDynamicLockFlags = js("_module.wrapPointer(ptr, _module.PxRigidDynamicLockFlags)") -fun PxRigidDynamicLockFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxRigidDynamicLockFlags.isSet(flag: PxRigidDynamicLockFlagEnum) = isSet(flag.value) +fun PxRigidDynamicLockFlags.raise(flag: PxRigidDynamicLockFlagEnum) = raise(flag.value) +fun PxRigidDynamicLockFlags.clear(flag: PxRigidDynamicLockFlagEnum) = clear(flag.value) -external interface PxRigidStatic : PxRigidActor +external interface PxRigidStatic : JsAny, PxRigidActor -fun PxRigidStaticFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxRigidStatic = js("_module.wrapPointer(ptr, _module.PxRigidStatic)") +fun PxRigidStaticFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRigidStatic = js("_module.wrapPointer(ptr, _module.PxRigidStatic)") -external interface PxShape : PxRefCounted { +external interface PxShape : JsAny, PxRefCounted { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @param geometry WebIDL type: [PxGeometry] (Const, Ref) @@ -3937,7 +3884,7 @@ external interface PxShape : PxRefCounted { * @param flag WebIDL type: [PxShapeFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setFlag(flag: PxShapeFlagEnum, value: Boolean) + fun setFlag(flag: Int, value: Boolean) /** * @param inFlags WebIDL type: [PxShapeFlags] (Ref) @@ -3996,7 +3943,7 @@ external interface PxShape : PxRefCounted { } -fun PxShapeFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxShape = js("_module.wrapPointer(ptr, _module.PxShape)") +fun PxShapeFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxShape = js("_module.wrapPointer(ptr, _module.PxShape)") val PxShape.actor get() = getActor() @@ -4034,7 +3981,9 @@ var PxShape.queryFilterData get() = getQueryFilterData() set(value) { setQueryFilterData(value) } -external interface PxShapeExt { +fun PxShape.setFlag(flag: PxShapeFlagEnum, value: Boolean) = setFlag(flag.value, value) + +external interface PxShapeExt : JsAny, DestroyableNative { /** * Native object address. */ @@ -4099,13 +4048,9 @@ external interface PxShapeExt { } -fun PxShapeExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxShapeExt = js("_module.wrapPointer(ptr, _module.PxShapeExt)") +fun PxShapeExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxShapeExt = js("_module.wrapPointer(ptr, _module.PxShapeExt)") -fun PxShapeExt.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxShapeFlags { +external interface PxShapeFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -4115,32 +4060,32 @@ external interface PxShapeFlags { * @param flag WebIDL type: [PxShapeFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxShapeFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxShapeFlagEnum] (enum) */ - fun raise(flag: PxShapeFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxShapeFlagEnum] (enum) */ - fun clear(flag: PxShapeFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxShapeFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxShapeFlags = js("new _module.PxShapeFlags(flags)") +fun PxShapeFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxShapeFlags = js("new _module.PxShapeFlags(flags)") -fun PxShapeFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxShapeFlags = js("_module.wrapPointer(ptr, _module.PxShapeFlags)") +fun PxShapeFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxShapeFlags = js("_module.wrapPointer(ptr, _module.PxShapeFlags)") -fun PxShapeFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxShapeFlags.isSet(flag: PxShapeFlagEnum) = isSet(flag.value) +fun PxShapeFlags.raise(flag: PxShapeFlagEnum) = raise(flag.value) +fun PxShapeFlags.clear(flag: PxShapeFlagEnum) = clear(flag.value) -external interface PxAggregate : PxBase { +external interface PxAggregate : JsAny, PxBase { /** * @param actor WebIDL type: [PxActor] (Ref) * @return WebIDL type: boolean @@ -4199,7 +4144,7 @@ external interface PxAggregate : PxBase { } -fun PxAggregateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxAggregate = js("_module.wrapPointer(ptr, _module.PxAggregate)") +fun PxAggregateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxAggregate = js("_module.wrapPointer(ptr, _module.PxAggregate)") val PxAggregate.nbActors get() = getNbActors() @@ -4212,15 +4157,11 @@ val PxAggregate.scene val PxAggregate.selfCollision get() = getSelfCollision() -external interface PxBaseMaterial : PxRefCounted +external interface PxBaseMaterial : JsAny, DestroyableNative, PxRefCounted -fun PxBaseMaterialFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBaseMaterial = js("_module.wrapPointer(ptr, _module.PxBaseMaterial)") +fun PxBaseMaterialFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBaseMaterial = js("_module.wrapPointer(ptr, _module.PxBaseMaterial)") -fun PxBaseMaterial.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxBroadPhaseCaps { +external interface PxBroadPhaseCaps : JsAny, DestroyableNative { /** * Native object address. */ @@ -4232,15 +4173,11 @@ external interface PxBroadPhaseCaps { var mMaxNbRegions: Int } -fun PxBroadPhaseCaps(_module: dynamic = PhysXJsLoader.physXJs): PxBroadPhaseCaps = js("new _module.PxBroadPhaseCaps()") - -fun PxBroadPhaseCapsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBroadPhaseCaps = js("_module.wrapPointer(ptr, _module.PxBroadPhaseCaps)") +fun PxBroadPhaseCaps(_module: JsAny = PhysXJsLoader.physXJs): PxBroadPhaseCaps = js("new _module.PxBroadPhaseCaps()") -fun PxBroadPhaseCaps.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBroadPhaseCapsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBroadPhaseCaps = js("_module.wrapPointer(ptr, _module.PxBroadPhaseCaps)") -external interface PxBroadPhaseRegion { +external interface PxBroadPhaseRegion : JsAny, DestroyableNative { /** * Native object address. */ @@ -4253,18 +4190,14 @@ external interface PxBroadPhaseRegion { /** * WebIDL type: VoidPtr */ - var mUserData: Any + var mUserData: JsAny } -fun PxBroadPhaseRegion(_module: dynamic = PhysXJsLoader.physXJs): PxBroadPhaseRegion = js("new _module.PxBroadPhaseRegion()") - -fun PxBroadPhaseRegionFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBroadPhaseRegion = js("_module.wrapPointer(ptr, _module.PxBroadPhaseRegion)") +fun PxBroadPhaseRegion(_module: JsAny = PhysXJsLoader.physXJs): PxBroadPhaseRegion = js("new _module.PxBroadPhaseRegion()") -fun PxBroadPhaseRegion.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxBroadPhaseRegionFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBroadPhaseRegion = js("_module.wrapPointer(ptr, _module.PxBroadPhaseRegion)") -external interface PxBroadPhaseRegionInfo { +external interface PxBroadPhaseRegionInfo : JsAny, DestroyableNative { /** * Native object address. */ @@ -4292,15 +4225,11 @@ external interface PxBroadPhaseRegionInfo { var mOverlap: Boolean } -fun PxBroadPhaseRegionInfo(_module: dynamic = PhysXJsLoader.physXJs): PxBroadPhaseRegionInfo = js("new _module.PxBroadPhaseRegionInfo()") +fun PxBroadPhaseRegionInfo(_module: JsAny = PhysXJsLoader.physXJs): PxBroadPhaseRegionInfo = js("new _module.PxBroadPhaseRegionInfo()") -fun PxBroadPhaseRegionInfoFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxBroadPhaseRegionInfo = js("_module.wrapPointer(ptr, _module.PxBroadPhaseRegionInfo)") +fun PxBroadPhaseRegionInfoFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxBroadPhaseRegionInfo = js("_module.wrapPointer(ptr, _module.PxBroadPhaseRegionInfo)") -fun PxBroadPhaseRegionInfo.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxConstraint : PxBase { +external interface PxConstraint : JsAny, PxBase { /** * @return WebIDL type: [PxScene] */ @@ -4328,7 +4257,7 @@ external interface PxConstraint : PxBase { * @param flag WebIDL type: [PxConstraintFlagEnum] (enum) * @param value WebIDL type: boolean */ - fun setFlag(flag: PxConstraintFlagEnum, value: Boolean) + fun setFlag(flag: Int, value: Boolean) /** * @param linear WebIDL type: [PxVec3] (Ref) @@ -4359,7 +4288,7 @@ external interface PxConstraint : PxBase { } -fun PxConstraintFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConstraint = js("_module.wrapPointer(ptr, _module.PxConstraint)") +fun PxConstraintFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConstraint = js("_module.wrapPointer(ptr, _module.PxConstraint)") val PxConstraint.scene get() = getScene() @@ -4371,7 +4300,9 @@ var PxConstraint.minResponseThreshold get() = getMinResponseThreshold() set(value) { setMinResponseThreshold(value) } -external interface PxConstraintConnector { +fun PxConstraint.setFlag(flag: PxConstraintFlagEnum, value: Boolean) = setFlag(flag.value, value) + +external interface PxConstraintConnector : JsAny, DestroyableNative { /** * Native object address. */ @@ -4412,11 +4343,7 @@ external interface PxConstraintConnector { } -fun PxConstraintConnectorFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConstraintConnector = js("_module.wrapPointer(ptr, _module.PxConstraintConnector)") - -fun PxConstraintConnector.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxConstraintConnectorFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConstraintConnector = js("_module.wrapPointer(ptr, _module.PxConstraintConnector)") val PxConstraintConnector.serializable get() = getSerializable() @@ -4425,7 +4352,7 @@ val PxConstraintConnector.prep val PxConstraintConnector.constantBlock get() = getConstantBlock() -external interface PxConstraintFlags { +external interface PxConstraintFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -4435,32 +4362,32 @@ external interface PxConstraintFlags { * @param flag WebIDL type: [PxConstraintFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxConstraintFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxConstraintFlagEnum] (enum) */ - fun raise(flag: PxConstraintFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxConstraintFlagEnum] (enum) */ - fun clear(flag: PxConstraintFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxConstraintFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxConstraintFlags = js("new _module.PxConstraintFlags(flags)") +fun PxConstraintFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxConstraintFlags = js("new _module.PxConstraintFlags(flags)") -fun PxConstraintFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConstraintFlags = js("_module.wrapPointer(ptr, _module.PxConstraintFlags)") +fun PxConstraintFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConstraintFlags = js("_module.wrapPointer(ptr, _module.PxConstraintFlags)") -fun PxConstraintFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxConstraintFlags.isSet(flag: PxConstraintFlagEnum) = isSet(flag.value) +fun PxConstraintFlags.raise(flag: PxConstraintFlagEnum) = raise(flag.value) +fun PxConstraintFlags.clear(flag: PxConstraintFlagEnum) = clear(flag.value) -external interface PxConstraintInfo { +external interface PxConstraintInfo : JsAny, DestroyableNative { /** * Native object address. */ @@ -4473,28 +4400,20 @@ external interface PxConstraintInfo { /** * WebIDL type: VoidPtr */ - var externalReference: Any + var externalReference: JsAny /** * WebIDL type: unsigned long */ var type: Int } -fun PxConstraintInfoFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConstraintInfo = js("_module.wrapPointer(ptr, _module.PxConstraintInfo)") - -fun PxConstraintInfo.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxConstraintInfoFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConstraintInfo = js("_module.wrapPointer(ptr, _module.PxConstraintInfo)") -external interface PxConstraintSolverPrep +external interface PxConstraintSolverPrep : JsAny, DestroyableNative -fun PxConstraintSolverPrepFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxConstraintSolverPrep = js("_module.wrapPointer(ptr, _module.PxConstraintSolverPrep)") +fun PxConstraintSolverPrepFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxConstraintSolverPrep = js("_module.wrapPointer(ptr, _module.PxConstraintSolverPrep)") -fun PxConstraintSolverPrep.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxContactPairHeaderFlags { +external interface PxContactPairHeaderFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -4504,32 +4423,32 @@ external interface PxContactPairHeaderFlags { * @param flag WebIDL type: [PxContactPairHeaderFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxContactPairHeaderFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxContactPairHeaderFlagEnum] (enum) */ - fun raise(flag: PxContactPairHeaderFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxContactPairHeaderFlagEnum] (enum) */ - fun clear(flag: PxContactPairHeaderFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxContactPairHeaderFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxContactPairHeaderFlags = js("new _module.PxContactPairHeaderFlags(flags)") +fun PxContactPairHeaderFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxContactPairHeaderFlags = js("new _module.PxContactPairHeaderFlags(flags)") -fun PxContactPairHeaderFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactPairHeaderFlags = js("_module.wrapPointer(ptr, _module.PxContactPairHeaderFlags)") +fun PxContactPairHeaderFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactPairHeaderFlags = js("_module.wrapPointer(ptr, _module.PxContactPairHeaderFlags)") -fun PxContactPairHeaderFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxContactPairHeaderFlags.isSet(flag: PxContactPairHeaderFlagEnum) = isSet(flag.value) +fun PxContactPairHeaderFlags.raise(flag: PxContactPairHeaderFlagEnum) = raise(flag.value) +fun PxContactPairHeaderFlags.clear(flag: PxContactPairHeaderFlagEnum) = clear(flag.value) -external interface PxContactPair { +external interface PxContactPair : JsAny, DestroyableNative { /** * Native object address. */ @@ -4566,16 +4485,12 @@ external interface PxContactPair { } -fun PxContactPairFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactPair = js("_module.wrapPointer(ptr, _module.PxContactPair)") - -fun PxContactPair.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxContactPairFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactPair = js("_module.wrapPointer(ptr, _module.PxContactPair)") inline fun PxContactPair.getShapes(index: Int) = get_shapes(index) inline fun PxContactPair.setShapes(index: Int, value: PxShape) = set_shapes(index, value) -external interface PxContactPairFlags { +external interface PxContactPairFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -4585,32 +4500,32 @@ external interface PxContactPairFlags { * @param flag WebIDL type: [PxContactPairFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxContactPairFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxContactPairFlagEnum] (enum) */ - fun raise(flag: PxContactPairFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxContactPairFlagEnum] (enum) */ - fun clear(flag: PxContactPairFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxContactPairFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxContactPairFlags = js("new _module.PxContactPairFlags(flags)") +fun PxContactPairFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxContactPairFlags = js("new _module.PxContactPairFlags(flags)") -fun PxContactPairFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactPairFlags = js("_module.wrapPointer(ptr, _module.PxContactPairFlags)") +fun PxContactPairFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactPairFlags = js("_module.wrapPointer(ptr, _module.PxContactPairFlags)") -fun PxContactPairFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxContactPairFlags.isSet(flag: PxContactPairFlagEnum) = isSet(flag.value) +fun PxContactPairFlags.raise(flag: PxContactPairFlagEnum) = raise(flag.value) +fun PxContactPairFlags.clear(flag: PxContactPairFlagEnum) = clear(flag.value) -external interface PxContactPairHeader { +external interface PxContactPairHeader : JsAny, DestroyableNative { /** * Native object address. */ @@ -4635,16 +4550,12 @@ external interface PxContactPairHeader { var nbPairs: Int } -fun PxContactPairHeaderFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactPairHeader = js("_module.wrapPointer(ptr, _module.PxContactPairHeader)") - -fun PxContactPairHeader.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxContactPairHeaderFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactPairHeader = js("_module.wrapPointer(ptr, _module.PxContactPairHeader)") inline fun PxContactPairHeader.getActors(index: Int) = get_actors(index) inline fun PxContactPairHeader.setActors(index: Int, value: PxActor) = set_actors(index, value) -external interface PxContactPairPoint { +external interface PxContactPairPoint : JsAny, DestroyableNative { /** * Native object address. */ @@ -4676,13 +4587,9 @@ external interface PxContactPairPoint { var internalFaceIndex1: Int } -fun PxContactPairPointFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxContactPairPoint = js("_module.wrapPointer(ptr, _module.PxContactPairPoint)") +fun PxContactPairPointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxContactPairPoint = js("_module.wrapPointer(ptr, _module.PxContactPairPoint)") -fun PxContactPairPoint.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxDominanceGroupPair { +external interface PxDominanceGroupPair : JsAny, DestroyableNative { /** * Native object address. */ @@ -4702,15 +4609,11 @@ external interface PxDominanceGroupPair { * @param a WebIDL type: octet * @param b WebIDL type: octet */ -fun PxDominanceGroupPair(a: Byte, b: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxDominanceGroupPair = js("new _module.PxDominanceGroupPair(a, b)") +fun PxDominanceGroupPair(a: Byte, b: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxDominanceGroupPair = js("new _module.PxDominanceGroupPair(a, b)") -fun PxDominanceGroupPairFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxDominanceGroupPair = js("_module.wrapPointer(ptr, _module.PxDominanceGroupPair)") +fun PxDominanceGroupPairFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxDominanceGroupPair = js("_module.wrapPointer(ptr, _module.PxDominanceGroupPair)") -fun PxDominanceGroupPair.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxFilterData { +external interface PxFilterData : JsAny, DestroyableNative { /** * Native object address. */ @@ -4734,7 +4637,7 @@ external interface PxFilterData { var word3: Int } -fun PxFilterData(_module: dynamic = PhysXJsLoader.physXJs): PxFilterData = js("new _module.PxFilterData()") +fun PxFilterData(_module: JsAny = PhysXJsLoader.physXJs): PxFilterData = js("new _module.PxFilterData()") /** * @param w0 WebIDL type: unsigned long @@ -4742,19 +4645,15 @@ fun PxFilterData(_module: dynamic = PhysXJsLoader.physXJs): PxFilterData = js("n * @param w2 WebIDL type: unsigned long * @param w3 WebIDL type: unsigned long */ -fun PxFilterData(w0: Int, w1: Int, w2: Int, w3: Int, _module: dynamic = PhysXJsLoader.physXJs): PxFilterData = js("new _module.PxFilterData(w0, w1, w2, w3)") - -fun PxFilterDataFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxFilterData = js("_module.wrapPointer(ptr, _module.PxFilterData)") +fun PxFilterData(w0: Int, w1: Int, w2: Int, w3: Int, _module: JsAny = PhysXJsLoader.physXJs): PxFilterData = js("new _module.PxFilterData(w0, w1, w2, w3)") -fun PxFilterData.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxFilterDataFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxFilterData = js("_module.wrapPointer(ptr, _module.PxFilterData)") -external interface PxMaterial : PxBaseMaterial { +external interface PxMaterial : JsAny, PxBaseMaterial { /** * WebIDL type: VoidPtr */ - var userData: Any + var userData: JsAny /** * @param coef WebIDL type: float @@ -4790,7 +4689,7 @@ external interface PxMaterial : PxBaseMaterial { * @param flag WebIDL type: [PxMaterialFlagEnum] (enum) * @param b WebIDL type: boolean */ - fun setFlag(flag: PxMaterialFlagEnum, b: Boolean) + fun setFlag(flag: Int, b: Boolean) /** * @param flags WebIDL type: [PxMaterialFlags] (Ref) @@ -4805,26 +4704,26 @@ external interface PxMaterial : PxBaseMaterial { /** * @param combMode WebIDL type: [PxCombineModeEnum] (enum) */ - fun setFrictionCombineMode(combMode: PxCombineModeEnum) + fun setFrictionCombineMode(combMode: Int) /** * @return WebIDL type: [PxCombineModeEnum] (enum) */ - fun getFrictionCombineMode(): PxCombineModeEnum + fun getFrictionCombineMode(): Int /** * @param combMode WebIDL type: [PxCombineModeEnum] (enum) */ - fun setRestitutionCombineMode(combMode: PxCombineModeEnum) + fun setRestitutionCombineMode(combMode: Int) /** * @return WebIDL type: [PxCombineModeEnum] (enum) */ - fun getRestitutionCombineMode(): PxCombineModeEnum + fun getRestitutionCombineMode(): Int } -fun PxMaterialFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMaterial = js("_module.wrapPointer(ptr, _module.PxMaterial)") +fun PxMaterialFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMaterial = js("_module.wrapPointer(ptr, _module.PxMaterial)") var PxMaterial.dynamicFriction get() = getDynamicFriction() @@ -4838,14 +4737,18 @@ var PxMaterial.restitution var PxMaterial.flags get() = getFlags() set(value) { setFlags(value) } -var PxMaterial.frictionCombineMode - get() = getFrictionCombineMode() - set(value) { setFrictionCombineMode(value) } -var PxMaterial.restitutionCombineMode - get() = getRestitutionCombineMode() - set(value) { setRestitutionCombineMode(value) } +var PxMaterial.frictionCombineMode: PxCombineModeEnum + get() = PxCombineModeEnum.forValue(getFrictionCombineMode()) + set(value) { setFrictionCombineMode(value.value) } +var PxMaterial.restitutionCombineMode: PxCombineModeEnum + get() = PxCombineModeEnum.forValue(getRestitutionCombineMode()) + set(value) { setRestitutionCombineMode(value.value) } -external interface PxMaterialFlags { +fun PxMaterial.setFlag(flag: PxMaterialFlagEnum, b: Boolean) = setFlag(flag.value, b) +fun PxMaterial.setFrictionCombineMode(combMode: PxCombineModeEnum) = setFrictionCombineMode(combMode.value) +fun PxMaterial.setRestitutionCombineMode(combMode: PxCombineModeEnum) = setRestitutionCombineMode(combMode.value) + +external interface PxMaterialFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -4855,32 +4758,32 @@ external interface PxMaterialFlags { * @param flag WebIDL type: [PxMaterialFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxMaterialFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxMaterialFlagEnum] (enum) */ - fun raise(flag: PxMaterialFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxMaterialFlagEnum] (enum) */ - fun clear(flag: PxMaterialFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxMaterialFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxMaterialFlags = js("new _module.PxMaterialFlags(flags)") +fun PxMaterialFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxMaterialFlags = js("new _module.PxMaterialFlags(flags)") -fun PxMaterialFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxMaterialFlags = js("_module.wrapPointer(ptr, _module.PxMaterialFlags)") +fun PxMaterialFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMaterialFlags = js("_module.wrapPointer(ptr, _module.PxMaterialFlags)") -fun PxMaterialFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxMaterialFlags.isSet(flag: PxMaterialFlagEnum) = isSet(flag.value) +fun PxMaterialFlags.raise(flag: PxMaterialFlagEnum) = raise(flag.value) +fun PxMaterialFlags.clear(flag: PxMaterialFlagEnum) = clear(flag.value) -external interface PxPairFlags { +external interface PxPairFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -4890,32 +4793,32 @@ external interface PxPairFlags { * @param flag WebIDL type: [PxPairFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxPairFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxPairFlagEnum] (enum) */ - fun raise(flag: PxPairFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxPairFlagEnum] (enum) */ - fun clear(flag: PxPairFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: unsigned short */ -fun PxPairFlags(flags: Short, _module: dynamic = PhysXJsLoader.physXJs): PxPairFlags = js("new _module.PxPairFlags(flags)") +fun PxPairFlags(flags: Short, _module: JsAny = PhysXJsLoader.physXJs): PxPairFlags = js("new _module.PxPairFlags(flags)") -fun PxPairFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPairFlags = js("_module.wrapPointer(ptr, _module.PxPairFlags)") +fun PxPairFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPairFlags = js("_module.wrapPointer(ptr, _module.PxPairFlags)") -fun PxPairFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxPairFlags.isSet(flag: PxPairFlagEnum) = isSet(flag.value) +fun PxPairFlags.raise(flag: PxPairFlagEnum) = raise(flag.value) +fun PxPairFlags.clear(flag: PxPairFlagEnum) = clear(flag.value) -external interface PxPhysics { +external interface PxPhysics : JsAny, DestroyableNative { /** * Native object address. */ @@ -5020,11 +4923,7 @@ external interface PxPhysics { } -fun PxPhysicsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxPhysics = js("_module.wrapPointer(ptr, _module.PxPhysics)") - -fun PxPhysics.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxPhysicsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPhysics = js("_module.wrapPointer(ptr, _module.PxPhysics)") val PxPhysics.foundation get() = getFoundation() @@ -5035,15 +4934,11 @@ val PxPhysics.nbShapes val PxPhysics.physicsInsertionCallback get() = getPhysicsInsertionCallback() -external interface PxSimulationEventCallback +external interface PxSimulationEventCallback : JsAny, DestroyableNative -fun PxSimulationEventCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSimulationEventCallback = js("_module.wrapPointer(ptr, _module.PxSimulationEventCallback)") - -fun PxSimulationEventCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSimulationEventCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSimulationEventCallback = js("_module.wrapPointer(ptr, _module.PxSimulationEventCallback)") -external interface SimpleSimulationEventCallback : PxSimulationEventCallback { +external interface SimpleSimulationEventCallback : JsAny, DestroyableNative, PxSimulationEventCallback { /** * @param constraints WebIDL type: [PxConstraintInfo] * @param count WebIDL type: unsigned long @@ -5077,11 +4972,7 @@ external interface SimpleSimulationEventCallback : PxSimulationEventCallback { } -fun SimpleSimulationEventCallbackFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): SimpleSimulationEventCallback = js("_module.wrapPointer(ptr, _module.SimpleSimulationEventCallback)") - -fun SimpleSimulationEventCallback.destroy() { - PhysXJsLoader.destroy(this) -} +fun SimpleSimulationEventCallbackFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): SimpleSimulationEventCallback = js("_module.wrapPointer(ptr, _module.SimpleSimulationEventCallback)") external interface PxSimulationEventCallbackImpl : SimpleSimulationEventCallback { /** @@ -5117,17 +5008,13 @@ external interface PxSimulationEventCallbackImpl : SimpleSimulationEventCallback } -fun PxSimulationEventCallbackImpl(_module: dynamic = PhysXJsLoader.physXJs): PxSimulationEventCallbackImpl = js("new _module.PxSimulationEventCallbackImpl()") - -external interface PxSimulationFilterShader +fun PxSimulationEventCallbackImpl(_module: JsAny = PhysXJsLoader.physXJs): PxSimulationEventCallbackImpl = js("new _module.PxSimulationEventCallbackImpl()") -fun PxSimulationFilterShaderFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSimulationFilterShader = js("_module.wrapPointer(ptr, _module.PxSimulationFilterShader)") +external interface PxSimulationFilterShader : JsAny, DestroyableNative -fun PxSimulationFilterShader.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSimulationFilterShaderFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSimulationFilterShader = js("_module.wrapPointer(ptr, _module.PxSimulationFilterShader)") -external interface PxSimulationStatistics { +external interface PxSimulationStatistics : JsAny, DestroyableNative { /** * Native object address. */ @@ -5228,16 +5115,12 @@ external interface PxSimulationStatistics { var nbBroadPhaseRemoves: Int } -fun PxSimulationStatisticsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxSimulationStatistics = js("_module.wrapPointer(ptr, _module.PxSimulationStatistics)") - -fun PxSimulationStatistics.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxSimulationStatisticsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxSimulationStatistics = js("_module.wrapPointer(ptr, _module.PxSimulationStatistics)") inline fun PxSimulationStatistics.getNbShapes(index: Int) = get_nbShapes(index) inline fun PxSimulationStatistics.setNbShapes(index: Int, value: Int) = set_nbShapes(index, value) -external interface PxTriggerPair { +external interface PxTriggerPair : JsAny, DestroyableNative { /** * Native object address. */ @@ -5262,20 +5145,20 @@ external interface PxTriggerPair { /** * WebIDL type: [PxPairFlagEnum] (enum) */ - var status: PxPairFlagEnum + var status: Int /** * WebIDL type: [PxTriggerPairFlags] (Value) */ var flags: PxTriggerPairFlags } -fun PxTriggerPairFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriggerPair = js("_module.wrapPointer(ptr, _module.PxTriggerPair)") +fun PxTriggerPairFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriggerPair = js("_module.wrapPointer(ptr, _module.PxTriggerPair)") -fun PxTriggerPair.destroy() { - PhysXJsLoader.destroy(this) -} +var PxTriggerPair.statusEnum: PxPairFlagEnum + get() = PxPairFlagEnum.forValue(status) + set(value) { status = value.value } -external interface PxTriggerPairFlags { +external interface PxTriggerPairFlags : JsAny, DestroyableNative { /** * Native object address. */ @@ -5285,387 +5168,895 @@ external interface PxTriggerPairFlags { * @param flag WebIDL type: [PxTriggerPairFlagEnum] (enum) * @return WebIDL type: boolean */ - fun isSet(flag: PxTriggerPairFlagEnum): Boolean + fun isSet(flag: Int): Boolean /** * @param flag WebIDL type: [PxTriggerPairFlagEnum] (enum) */ - fun raise(flag: PxTriggerPairFlagEnum) + fun raise(flag: Int) /** * @param flag WebIDL type: [PxTriggerPairFlagEnum] (enum) */ - fun clear(flag: PxTriggerPairFlagEnum) + fun clear(flag: Int) } /** * @param flags WebIDL type: octet */ -fun PxTriggerPairFlags(flags: Byte, _module: dynamic = PhysXJsLoader.physXJs): PxTriggerPairFlags = js("new _module.PxTriggerPairFlags(flags)") +fun PxTriggerPairFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxTriggerPairFlags = js("new _module.PxTriggerPairFlags(flags)") -fun PxTriggerPairFlagsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxTriggerPairFlags = js("_module.wrapPointer(ptr, _module.PxTriggerPairFlags)") +fun PxTriggerPairFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxTriggerPairFlags = js("_module.wrapPointer(ptr, _module.PxTriggerPairFlags)") -fun PxTriggerPairFlags.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxTriggerPairFlags.isSet(flag: PxTriggerPairFlagEnum) = isSet(flag.value) +fun PxTriggerPairFlags.raise(flag: PxTriggerPairFlagEnum) = raise(flag.value) +fun PxTriggerPairFlags.clear(flag: PxTriggerPairFlagEnum) = clear(flag.value) value class PxSceneFlagEnum private constructor(val value: Int) { companion object { - val eENABLE_ACTIVE_ACTORS: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_ACTIVE_ACTORS()) - val eENABLE_CCD: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_CCD()) - val eDISABLE_CCD_RESWEEP: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eDISABLE_CCD_RESWEEP()) - val eENABLE_PCM: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_PCM()) - val eDISABLE_CONTACT_REPORT_BUFFER_RESIZE: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eDISABLE_CONTACT_REPORT_BUFFER_RESIZE()) - val eDISABLE_CONTACT_CACHE: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eDISABLE_CONTACT_CACHE()) - val eREQUIRE_RW_LOCK: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eREQUIRE_RW_LOCK()) - val eENABLE_STABILIZATION: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_STABILIZATION()) - val eENABLE_AVERAGE_POINT: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_AVERAGE_POINT()) - val eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS()) - val eENABLE_GPU_DYNAMICS: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_GPU_DYNAMICS()) - val eENABLE_ENHANCED_DETERMINISM: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_ENHANCED_DETERMINISM()) - val eENABLE_FRICTION_EVERY_ITERATION: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_FRICTION_EVERY_ITERATION()) - val eENABLE_DIRECT_GPU_API: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eENABLE_DIRECT_GPU_API()) - val eMUTABLE_FLAGS: PxSceneFlagEnum = PxSceneFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneFlagEnum_eMUTABLE_FLAGS()) + val eENABLE_ACTIVE_ACTORS: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_ACTIVE_ACTORS(PhysXJsLoader.physXJs)) + val eENABLE_CCD: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_CCD(PhysXJsLoader.physXJs)) + val eDISABLE_CCD_RESWEEP: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eDISABLE_CCD_RESWEEP(PhysXJsLoader.physXJs)) + val eENABLE_PCM: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_PCM(PhysXJsLoader.physXJs)) + val eDISABLE_CONTACT_REPORT_BUFFER_RESIZE: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eDISABLE_CONTACT_REPORT_BUFFER_RESIZE(PhysXJsLoader.physXJs)) + val eDISABLE_CONTACT_CACHE: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eDISABLE_CONTACT_CACHE(PhysXJsLoader.physXJs)) + val eREQUIRE_RW_LOCK: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eREQUIRE_RW_LOCK(PhysXJsLoader.physXJs)) + val eENABLE_STABILIZATION: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_STABILIZATION(PhysXJsLoader.physXJs)) + val eENABLE_AVERAGE_POINT: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_AVERAGE_POINT(PhysXJsLoader.physXJs)) + val eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS(PhysXJsLoader.physXJs)) + val eENABLE_GPU_DYNAMICS: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_GPU_DYNAMICS(PhysXJsLoader.physXJs)) + val eENABLE_ENHANCED_DETERMINISM: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_ENHANCED_DETERMINISM(PhysXJsLoader.physXJs)) + val eENABLE_FRICTION_EVERY_ITERATION: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_FRICTION_EVERY_ITERATION(PhysXJsLoader.physXJs)) + val eENABLE_DIRECT_GPU_API: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eENABLE_DIRECT_GPU_API(PhysXJsLoader.physXJs)) + val eMUTABLE_FLAGS: PxSceneFlagEnum = PxSceneFlagEnum(PxSceneFlagEnum_eMUTABLE_FLAGS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eENABLE_ACTIVE_ACTORS.value -> eENABLE_ACTIVE_ACTORS + eENABLE_CCD.value -> eENABLE_CCD + eDISABLE_CCD_RESWEEP.value -> eDISABLE_CCD_RESWEEP + eENABLE_PCM.value -> eENABLE_PCM + eDISABLE_CONTACT_REPORT_BUFFER_RESIZE.value -> eDISABLE_CONTACT_REPORT_BUFFER_RESIZE + eDISABLE_CONTACT_CACHE.value -> eDISABLE_CONTACT_CACHE + eREQUIRE_RW_LOCK.value -> eREQUIRE_RW_LOCK + eENABLE_STABILIZATION.value -> eENABLE_STABILIZATION + eENABLE_AVERAGE_POINT.value -> eENABLE_AVERAGE_POINT + eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS.value -> eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS + eENABLE_GPU_DYNAMICS.value -> eENABLE_GPU_DYNAMICS + eENABLE_ENHANCED_DETERMINISM.value -> eENABLE_ENHANCED_DETERMINISM + eENABLE_FRICTION_EVERY_ITERATION.value -> eENABLE_FRICTION_EVERY_ITERATION + eENABLE_DIRECT_GPU_API.value -> eENABLE_DIRECT_GPU_API + eMUTABLE_FLAGS.value -> eMUTABLE_FLAGS + else -> error("Invalid enum value $value for enum PxSceneFlagEnum") + } } } +private fun PxSceneFlagEnum_eENABLE_ACTIVE_ACTORS(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_ACTIVE_ACTORS()") +private fun PxSceneFlagEnum_eENABLE_CCD(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_CCD()") +private fun PxSceneFlagEnum_eDISABLE_CCD_RESWEEP(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eDISABLE_CCD_RESWEEP()") +private fun PxSceneFlagEnum_eENABLE_PCM(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_PCM()") +private fun PxSceneFlagEnum_eDISABLE_CONTACT_REPORT_BUFFER_RESIZE(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eDISABLE_CONTACT_REPORT_BUFFER_RESIZE()") +private fun PxSceneFlagEnum_eDISABLE_CONTACT_CACHE(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eDISABLE_CONTACT_CACHE()") +private fun PxSceneFlagEnum_eREQUIRE_RW_LOCK(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eREQUIRE_RW_LOCK()") +private fun PxSceneFlagEnum_eENABLE_STABILIZATION(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_STABILIZATION()") +private fun PxSceneFlagEnum_eENABLE_AVERAGE_POINT(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_AVERAGE_POINT()") +private fun PxSceneFlagEnum_eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS()") +private fun PxSceneFlagEnum_eENABLE_GPU_DYNAMICS(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_GPU_DYNAMICS()") +private fun PxSceneFlagEnum_eENABLE_ENHANCED_DETERMINISM(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_ENHANCED_DETERMINISM()") +private fun PxSceneFlagEnum_eENABLE_FRICTION_EVERY_ITERATION(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_FRICTION_EVERY_ITERATION()") +private fun PxSceneFlagEnum_eENABLE_DIRECT_GPU_API(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eENABLE_DIRECT_GPU_API()") +private fun PxSceneFlagEnum_eMUTABLE_FLAGS(module: JsAny): Int = js("module._emscripten_enum_PxSceneFlagEnum_eMUTABLE_FLAGS()") + value class PxSceneQueryUpdateModeEnum private constructor(val value: Int) { companion object { - val eBUILD_ENABLED_COMMIT_ENABLED: PxSceneQueryUpdateModeEnum = PxSceneQueryUpdateModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_ENABLED()) - val eBUILD_ENABLED_COMMIT_DISABLED: PxSceneQueryUpdateModeEnum = PxSceneQueryUpdateModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_DISABLED()) - val eBUILD_DISABLED_COMMIT_DISABLED: PxSceneQueryUpdateModeEnum = PxSceneQueryUpdateModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSceneQueryUpdateModeEnum_eBUILD_DISABLED_COMMIT_DISABLED()) + val eBUILD_ENABLED_COMMIT_ENABLED: PxSceneQueryUpdateModeEnum = PxSceneQueryUpdateModeEnum(PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_ENABLED(PhysXJsLoader.physXJs)) + val eBUILD_ENABLED_COMMIT_DISABLED: PxSceneQueryUpdateModeEnum = PxSceneQueryUpdateModeEnum(PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_DISABLED(PhysXJsLoader.physXJs)) + val eBUILD_DISABLED_COMMIT_DISABLED: PxSceneQueryUpdateModeEnum = PxSceneQueryUpdateModeEnum(PxSceneQueryUpdateModeEnum_eBUILD_DISABLED_COMMIT_DISABLED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eBUILD_ENABLED_COMMIT_ENABLED.value -> eBUILD_ENABLED_COMMIT_ENABLED + eBUILD_ENABLED_COMMIT_DISABLED.value -> eBUILD_ENABLED_COMMIT_DISABLED + eBUILD_DISABLED_COMMIT_DISABLED.value -> eBUILD_DISABLED_COMMIT_DISABLED + else -> error("Invalid enum value $value for enum PxSceneQueryUpdateModeEnum") + } } } +private fun PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_ENABLED()") +private fun PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_DISABLED(module: JsAny): Int = js("module._emscripten_enum_PxSceneQueryUpdateModeEnum_eBUILD_ENABLED_COMMIT_DISABLED()") +private fun PxSceneQueryUpdateModeEnum_eBUILD_DISABLED_COMMIT_DISABLED(module: JsAny): Int = js("module._emscripten_enum_PxSceneQueryUpdateModeEnum_eBUILD_DISABLED_COMMIT_DISABLED()") + value class PxArticulationAxisEnum private constructor(val value: Int) { companion object { - val eTWIST: PxArticulationAxisEnum = PxArticulationAxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationAxisEnum_eTWIST()) - val eSWING1: PxArticulationAxisEnum = PxArticulationAxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationAxisEnum_eSWING1()) - val eSWING2: PxArticulationAxisEnum = PxArticulationAxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationAxisEnum_eSWING2()) - val eX: PxArticulationAxisEnum = PxArticulationAxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationAxisEnum_eX()) - val eY: PxArticulationAxisEnum = PxArticulationAxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationAxisEnum_eY()) - val eZ: PxArticulationAxisEnum = PxArticulationAxisEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationAxisEnum_eZ()) + val eTWIST: PxArticulationAxisEnum = PxArticulationAxisEnum(PxArticulationAxisEnum_eTWIST(PhysXJsLoader.physXJs)) + val eSWING1: PxArticulationAxisEnum = PxArticulationAxisEnum(PxArticulationAxisEnum_eSWING1(PhysXJsLoader.physXJs)) + val eSWING2: PxArticulationAxisEnum = PxArticulationAxisEnum(PxArticulationAxisEnum_eSWING2(PhysXJsLoader.physXJs)) + val eX: PxArticulationAxisEnum = PxArticulationAxisEnum(PxArticulationAxisEnum_eX(PhysXJsLoader.physXJs)) + val eY: PxArticulationAxisEnum = PxArticulationAxisEnum(PxArticulationAxisEnum_eY(PhysXJsLoader.physXJs)) + val eZ: PxArticulationAxisEnum = PxArticulationAxisEnum(PxArticulationAxisEnum_eZ(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eTWIST.value -> eTWIST + eSWING1.value -> eSWING1 + eSWING2.value -> eSWING2 + eX.value -> eX + eY.value -> eY + eZ.value -> eZ + else -> error("Invalid enum value $value for enum PxArticulationAxisEnum") + } } } +private fun PxArticulationAxisEnum_eTWIST(module: JsAny): Int = js("module._emscripten_enum_PxArticulationAxisEnum_eTWIST()") +private fun PxArticulationAxisEnum_eSWING1(module: JsAny): Int = js("module._emscripten_enum_PxArticulationAxisEnum_eSWING1()") +private fun PxArticulationAxisEnum_eSWING2(module: JsAny): Int = js("module._emscripten_enum_PxArticulationAxisEnum_eSWING2()") +private fun PxArticulationAxisEnum_eX(module: JsAny): Int = js("module._emscripten_enum_PxArticulationAxisEnum_eX()") +private fun PxArticulationAxisEnum_eY(module: JsAny): Int = js("module._emscripten_enum_PxArticulationAxisEnum_eY()") +private fun PxArticulationAxisEnum_eZ(module: JsAny): Int = js("module._emscripten_enum_PxArticulationAxisEnum_eZ()") + value class PxArticulationCacheFlagEnum private constructor(val value: Int) { companion object { - val eVELOCITY: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eVELOCITY()) - val eACCELERATION: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eACCELERATION()) - val ePOSITION: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_ePOSITION()) - val eFORCE: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eFORCE()) - val eLINK_VELOCITY: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eLINK_VELOCITY()) - val eLINK_ACCELERATION: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eLINK_ACCELERATION()) - val eROOT_TRANSFORM: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eROOT_TRANSFORM()) - val eROOT_VELOCITIES: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eROOT_VELOCITIES()) - val eLINK_INCOMING_JOINT_FORCE: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eLINK_INCOMING_JOINT_FORCE()) - val eJOINT_TARGET_POSITIONS: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eJOINT_TARGET_POSITIONS()) - val eJOINT_TARGET_VELOCITIES: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eJOINT_TARGET_VELOCITIES()) - val eALL: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationCacheFlagEnum_eALL()) + val eVELOCITY: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eVELOCITY(PhysXJsLoader.physXJs)) + val eACCELERATION: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eACCELERATION(PhysXJsLoader.physXJs)) + val ePOSITION: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_ePOSITION(PhysXJsLoader.physXJs)) + val eFORCE: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eFORCE(PhysXJsLoader.physXJs)) + val eLINK_VELOCITY: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eLINK_VELOCITY(PhysXJsLoader.physXJs)) + val eLINK_ACCELERATION: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eLINK_ACCELERATION(PhysXJsLoader.physXJs)) + val eROOT_TRANSFORM: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eROOT_TRANSFORM(PhysXJsLoader.physXJs)) + val eROOT_VELOCITIES: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eROOT_VELOCITIES(PhysXJsLoader.physXJs)) + val eLINK_INCOMING_JOINT_FORCE: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eLINK_INCOMING_JOINT_FORCE(PhysXJsLoader.physXJs)) + val eJOINT_TARGET_POSITIONS: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eJOINT_TARGET_POSITIONS(PhysXJsLoader.physXJs)) + val eJOINT_TARGET_VELOCITIES: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eJOINT_TARGET_VELOCITIES(PhysXJsLoader.physXJs)) + val eALL: PxArticulationCacheFlagEnum = PxArticulationCacheFlagEnum(PxArticulationCacheFlagEnum_eALL(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eVELOCITY.value -> eVELOCITY + eACCELERATION.value -> eACCELERATION + ePOSITION.value -> ePOSITION + eFORCE.value -> eFORCE + eLINK_VELOCITY.value -> eLINK_VELOCITY + eLINK_ACCELERATION.value -> eLINK_ACCELERATION + eROOT_TRANSFORM.value -> eROOT_TRANSFORM + eROOT_VELOCITIES.value -> eROOT_VELOCITIES + eLINK_INCOMING_JOINT_FORCE.value -> eLINK_INCOMING_JOINT_FORCE + eJOINT_TARGET_POSITIONS.value -> eJOINT_TARGET_POSITIONS + eJOINT_TARGET_VELOCITIES.value -> eJOINT_TARGET_VELOCITIES + eALL.value -> eALL + else -> error("Invalid enum value $value for enum PxArticulationCacheFlagEnum") + } } } +private fun PxArticulationCacheFlagEnum_eVELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eVELOCITY()") +private fun PxArticulationCacheFlagEnum_eACCELERATION(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eACCELERATION()") +private fun PxArticulationCacheFlagEnum_ePOSITION(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_ePOSITION()") +private fun PxArticulationCacheFlagEnum_eFORCE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eFORCE()") +private fun PxArticulationCacheFlagEnum_eLINK_VELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eLINK_VELOCITY()") +private fun PxArticulationCacheFlagEnum_eLINK_ACCELERATION(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eLINK_ACCELERATION()") +private fun PxArticulationCacheFlagEnum_eROOT_TRANSFORM(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eROOT_TRANSFORM()") +private fun PxArticulationCacheFlagEnum_eROOT_VELOCITIES(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eROOT_VELOCITIES()") +private fun PxArticulationCacheFlagEnum_eLINK_INCOMING_JOINT_FORCE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eLINK_INCOMING_JOINT_FORCE()") +private fun PxArticulationCacheFlagEnum_eJOINT_TARGET_POSITIONS(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eJOINT_TARGET_POSITIONS()") +private fun PxArticulationCacheFlagEnum_eJOINT_TARGET_VELOCITIES(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eJOINT_TARGET_VELOCITIES()") +private fun PxArticulationCacheFlagEnum_eALL(module: JsAny): Int = js("module._emscripten_enum_PxArticulationCacheFlagEnum_eALL()") + value class PxArticulationDriveTypeEnum private constructor(val value: Int) { companion object { - val eFORCE: PxArticulationDriveTypeEnum = PxArticulationDriveTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationDriveTypeEnum_eFORCE()) - val eACCELERATION: PxArticulationDriveTypeEnum = PxArticulationDriveTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationDriveTypeEnum_eACCELERATION()) - val eNONE: PxArticulationDriveTypeEnum = PxArticulationDriveTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationDriveTypeEnum_eNONE()) + val eFORCE: PxArticulationDriveTypeEnum = PxArticulationDriveTypeEnum(PxArticulationDriveTypeEnum_eFORCE(PhysXJsLoader.physXJs)) + val eACCELERATION: PxArticulationDriveTypeEnum = PxArticulationDriveTypeEnum(PxArticulationDriveTypeEnum_eACCELERATION(PhysXJsLoader.physXJs)) + val eNONE: PxArticulationDriveTypeEnum = PxArticulationDriveTypeEnum(PxArticulationDriveTypeEnum_eNONE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eFORCE.value -> eFORCE + eACCELERATION.value -> eACCELERATION + eNONE.value -> eNONE + else -> error("Invalid enum value $value for enum PxArticulationDriveTypeEnum") + } } } +private fun PxArticulationDriveTypeEnum_eFORCE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationDriveTypeEnum_eFORCE()") +private fun PxArticulationDriveTypeEnum_eACCELERATION(module: JsAny): Int = js("module._emscripten_enum_PxArticulationDriveTypeEnum_eACCELERATION()") +private fun PxArticulationDriveTypeEnum_eNONE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationDriveTypeEnum_eNONE()") + value class PxArticulationFlagEnum private constructor(val value: Int) { companion object { - val eFIX_BASE: PxArticulationFlagEnum = PxArticulationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationFlagEnum_eFIX_BASE()) - val eDRIVE_LIMITS_ARE_FORCES: PxArticulationFlagEnum = PxArticulationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationFlagEnum_eDRIVE_LIMITS_ARE_FORCES()) - val eDISABLE_SELF_COLLISION: PxArticulationFlagEnum = PxArticulationFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationFlagEnum_eDISABLE_SELF_COLLISION()) + val eFIX_BASE: PxArticulationFlagEnum = PxArticulationFlagEnum(PxArticulationFlagEnum_eFIX_BASE(PhysXJsLoader.physXJs)) + val eDRIVE_LIMITS_ARE_FORCES: PxArticulationFlagEnum = PxArticulationFlagEnum(PxArticulationFlagEnum_eDRIVE_LIMITS_ARE_FORCES(PhysXJsLoader.physXJs)) + val eDISABLE_SELF_COLLISION: PxArticulationFlagEnum = PxArticulationFlagEnum(PxArticulationFlagEnum_eDISABLE_SELF_COLLISION(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eFIX_BASE.value -> eFIX_BASE + eDRIVE_LIMITS_ARE_FORCES.value -> eDRIVE_LIMITS_ARE_FORCES + eDISABLE_SELF_COLLISION.value -> eDISABLE_SELF_COLLISION + else -> error("Invalid enum value $value for enum PxArticulationFlagEnum") + } } } +private fun PxArticulationFlagEnum_eFIX_BASE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationFlagEnum_eFIX_BASE()") +private fun PxArticulationFlagEnum_eDRIVE_LIMITS_ARE_FORCES(module: JsAny): Int = js("module._emscripten_enum_PxArticulationFlagEnum_eDRIVE_LIMITS_ARE_FORCES()") +private fun PxArticulationFlagEnum_eDISABLE_SELF_COLLISION(module: JsAny): Int = js("module._emscripten_enum_PxArticulationFlagEnum_eDISABLE_SELF_COLLISION()") + value class PxArticulationJointTypeEnum private constructor(val value: Int) { companion object { - val eFIX: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationJointTypeEnum_eFIX()) - val ePRISMATIC: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationJointTypeEnum_ePRISMATIC()) - val eREVOLUTE: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationJointTypeEnum_eREVOLUTE()) - val eSPHERICAL: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationJointTypeEnum_eSPHERICAL()) - val eUNDEFINED: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationJointTypeEnum_eUNDEFINED()) + val eFIX: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PxArticulationJointTypeEnum_eFIX(PhysXJsLoader.physXJs)) + val ePRISMATIC: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PxArticulationJointTypeEnum_ePRISMATIC(PhysXJsLoader.physXJs)) + val eREVOLUTE: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PxArticulationJointTypeEnum_eREVOLUTE(PhysXJsLoader.physXJs)) + val eSPHERICAL: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PxArticulationJointTypeEnum_eSPHERICAL(PhysXJsLoader.physXJs)) + val eUNDEFINED: PxArticulationJointTypeEnum = PxArticulationJointTypeEnum(PxArticulationJointTypeEnum_eUNDEFINED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eFIX.value -> eFIX + ePRISMATIC.value -> ePRISMATIC + eREVOLUTE.value -> eREVOLUTE + eSPHERICAL.value -> eSPHERICAL + eUNDEFINED.value -> eUNDEFINED + else -> error("Invalid enum value $value for enum PxArticulationJointTypeEnum") + } } } +private fun PxArticulationJointTypeEnum_eFIX(module: JsAny): Int = js("module._emscripten_enum_PxArticulationJointTypeEnum_eFIX()") +private fun PxArticulationJointTypeEnum_ePRISMATIC(module: JsAny): Int = js("module._emscripten_enum_PxArticulationJointTypeEnum_ePRISMATIC()") +private fun PxArticulationJointTypeEnum_eREVOLUTE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationJointTypeEnum_eREVOLUTE()") +private fun PxArticulationJointTypeEnum_eSPHERICAL(module: JsAny): Int = js("module._emscripten_enum_PxArticulationJointTypeEnum_eSPHERICAL()") +private fun PxArticulationJointTypeEnum_eUNDEFINED(module: JsAny): Int = js("module._emscripten_enum_PxArticulationJointTypeEnum_eUNDEFINED()") + value class PxArticulationKinematicFlagEnum private constructor(val value: Int) { companion object { - val ePOSITION: PxArticulationKinematicFlagEnum = PxArticulationKinematicFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationKinematicFlagEnum_ePOSITION()) - val eVELOCITY: PxArticulationKinematicFlagEnum = PxArticulationKinematicFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationKinematicFlagEnum_eVELOCITY()) + val ePOSITION: PxArticulationKinematicFlagEnum = PxArticulationKinematicFlagEnum(PxArticulationKinematicFlagEnum_ePOSITION(PhysXJsLoader.physXJs)) + val eVELOCITY: PxArticulationKinematicFlagEnum = PxArticulationKinematicFlagEnum(PxArticulationKinematicFlagEnum_eVELOCITY(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePOSITION.value -> ePOSITION + eVELOCITY.value -> eVELOCITY + else -> error("Invalid enum value $value for enum PxArticulationKinematicFlagEnum") + } } } +private fun PxArticulationKinematicFlagEnum_ePOSITION(module: JsAny): Int = js("module._emscripten_enum_PxArticulationKinematicFlagEnum_ePOSITION()") +private fun PxArticulationKinematicFlagEnum_eVELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxArticulationKinematicFlagEnum_eVELOCITY()") + value class PxArticulationMotionEnum private constructor(val value: Int) { companion object { - val eLOCKED: PxArticulationMotionEnum = PxArticulationMotionEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationMotionEnum_eLOCKED()) - val eLIMITED: PxArticulationMotionEnum = PxArticulationMotionEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationMotionEnum_eLIMITED()) - val eFREE: PxArticulationMotionEnum = PxArticulationMotionEnum(PhysXJsLoader.physXJs._emscripten_enum_PxArticulationMotionEnum_eFREE()) + val eLOCKED: PxArticulationMotionEnum = PxArticulationMotionEnum(PxArticulationMotionEnum_eLOCKED(PhysXJsLoader.physXJs)) + val eLIMITED: PxArticulationMotionEnum = PxArticulationMotionEnum(PxArticulationMotionEnum_eLIMITED(PhysXJsLoader.physXJs)) + val eFREE: PxArticulationMotionEnum = PxArticulationMotionEnum(PxArticulationMotionEnum_eFREE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLOCKED.value -> eLOCKED + eLIMITED.value -> eLIMITED + eFREE.value -> eFREE + else -> error("Invalid enum value $value for enum PxArticulationMotionEnum") + } } } +private fun PxArticulationMotionEnum_eLOCKED(module: JsAny): Int = js("module._emscripten_enum_PxArticulationMotionEnum_eLOCKED()") +private fun PxArticulationMotionEnum_eLIMITED(module: JsAny): Int = js("module._emscripten_enum_PxArticulationMotionEnum_eLIMITED()") +private fun PxArticulationMotionEnum_eFREE(module: JsAny): Int = js("module._emscripten_enum_PxArticulationMotionEnum_eFREE()") + value class PxHitFlagEnum private constructor(val value: Int) { companion object { - val ePOSITION: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_ePOSITION()) - val eNORMAL: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eNORMAL()) - val eUV: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eUV()) - val eASSUME_NO_INITIAL_OVERLAP: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eASSUME_NO_INITIAL_OVERLAP()) - val eANY_HIT: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eANY_HIT()) - val eMESH_MULTIPLE: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eMESH_MULTIPLE()) - val eMESH_BOTH_SIDES: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eMESH_BOTH_SIDES()) - val ePRECISE_SWEEP: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_ePRECISE_SWEEP()) - val eMTD: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eMTD()) - val eFACE_INDEX: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eFACE_INDEX()) - val eDEFAULT: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eDEFAULT()) - val eMODIFIABLE_FLAGS: PxHitFlagEnum = PxHitFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxHitFlagEnum_eMODIFIABLE_FLAGS()) + val ePOSITION: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_ePOSITION(PhysXJsLoader.physXJs)) + val eNORMAL: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eNORMAL(PhysXJsLoader.physXJs)) + val eUV: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eUV(PhysXJsLoader.physXJs)) + val eASSUME_NO_INITIAL_OVERLAP: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eASSUME_NO_INITIAL_OVERLAP(PhysXJsLoader.physXJs)) + val eANY_HIT: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eANY_HIT(PhysXJsLoader.physXJs)) + val eMESH_MULTIPLE: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eMESH_MULTIPLE(PhysXJsLoader.physXJs)) + val eMESH_BOTH_SIDES: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eMESH_BOTH_SIDES(PhysXJsLoader.physXJs)) + val ePRECISE_SWEEP: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_ePRECISE_SWEEP(PhysXJsLoader.physXJs)) + val eMTD: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eMTD(PhysXJsLoader.physXJs)) + val eFACE_INDEX: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eFACE_INDEX(PhysXJsLoader.physXJs)) + val eDEFAULT: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eDEFAULT(PhysXJsLoader.physXJs)) + val eMODIFIABLE_FLAGS: PxHitFlagEnum = PxHitFlagEnum(PxHitFlagEnum_eMODIFIABLE_FLAGS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePOSITION.value -> ePOSITION + eNORMAL.value -> eNORMAL + eUV.value -> eUV + eASSUME_NO_INITIAL_OVERLAP.value -> eASSUME_NO_INITIAL_OVERLAP + eANY_HIT.value -> eANY_HIT + eMESH_MULTIPLE.value -> eMESH_MULTIPLE + eMESH_BOTH_SIDES.value -> eMESH_BOTH_SIDES + ePRECISE_SWEEP.value -> ePRECISE_SWEEP + eMTD.value -> eMTD + eFACE_INDEX.value -> eFACE_INDEX + eDEFAULT.value -> eDEFAULT + eMODIFIABLE_FLAGS.value -> eMODIFIABLE_FLAGS + else -> error("Invalid enum value $value for enum PxHitFlagEnum") + } } } +private fun PxHitFlagEnum_ePOSITION(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_ePOSITION()") +private fun PxHitFlagEnum_eNORMAL(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eNORMAL()") +private fun PxHitFlagEnum_eUV(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eUV()") +private fun PxHitFlagEnum_eASSUME_NO_INITIAL_OVERLAP(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eASSUME_NO_INITIAL_OVERLAP()") +private fun PxHitFlagEnum_eANY_HIT(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eANY_HIT()") +private fun PxHitFlagEnum_eMESH_MULTIPLE(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eMESH_MULTIPLE()") +private fun PxHitFlagEnum_eMESH_BOTH_SIDES(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eMESH_BOTH_SIDES()") +private fun PxHitFlagEnum_ePRECISE_SWEEP(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_ePRECISE_SWEEP()") +private fun PxHitFlagEnum_eMTD(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eMTD()") +private fun PxHitFlagEnum_eFACE_INDEX(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eFACE_INDEX()") +private fun PxHitFlagEnum_eDEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eDEFAULT()") +private fun PxHitFlagEnum_eMODIFIABLE_FLAGS(module: JsAny): Int = js("module._emscripten_enum_PxHitFlagEnum_eMODIFIABLE_FLAGS()") + value class PxQueryFlagEnum private constructor(val value: Int) { companion object { - val eSTATIC: PxQueryFlagEnum = PxQueryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxQueryFlagEnum_eSTATIC()) - val eDYNAMIC: PxQueryFlagEnum = PxQueryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxQueryFlagEnum_eDYNAMIC()) - val ePREFILTER: PxQueryFlagEnum = PxQueryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxQueryFlagEnum_ePREFILTER()) - val ePOSTFILTER: PxQueryFlagEnum = PxQueryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxQueryFlagEnum_ePOSTFILTER()) - val eANY_HIT: PxQueryFlagEnum = PxQueryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxQueryFlagEnum_eANY_HIT()) - val eNO_BLOCK: PxQueryFlagEnum = PxQueryFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxQueryFlagEnum_eNO_BLOCK()) + val eSTATIC: PxQueryFlagEnum = PxQueryFlagEnum(PxQueryFlagEnum_eSTATIC(PhysXJsLoader.physXJs)) + val eDYNAMIC: PxQueryFlagEnum = PxQueryFlagEnum(PxQueryFlagEnum_eDYNAMIC(PhysXJsLoader.physXJs)) + val ePREFILTER: PxQueryFlagEnum = PxQueryFlagEnum(PxQueryFlagEnum_ePREFILTER(PhysXJsLoader.physXJs)) + val ePOSTFILTER: PxQueryFlagEnum = PxQueryFlagEnum(PxQueryFlagEnum_ePOSTFILTER(PhysXJsLoader.physXJs)) + val eANY_HIT: PxQueryFlagEnum = PxQueryFlagEnum(PxQueryFlagEnum_eANY_HIT(PhysXJsLoader.physXJs)) + val eNO_BLOCK: PxQueryFlagEnum = PxQueryFlagEnum(PxQueryFlagEnum_eNO_BLOCK(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSTATIC.value -> eSTATIC + eDYNAMIC.value -> eDYNAMIC + ePREFILTER.value -> ePREFILTER + ePOSTFILTER.value -> ePOSTFILTER + eANY_HIT.value -> eANY_HIT + eNO_BLOCK.value -> eNO_BLOCK + else -> error("Invalid enum value $value for enum PxQueryFlagEnum") + } } } +private fun PxQueryFlagEnum_eSTATIC(module: JsAny): Int = js("module._emscripten_enum_PxQueryFlagEnum_eSTATIC()") +private fun PxQueryFlagEnum_eDYNAMIC(module: JsAny): Int = js("module._emscripten_enum_PxQueryFlagEnum_eDYNAMIC()") +private fun PxQueryFlagEnum_ePREFILTER(module: JsAny): Int = js("module._emscripten_enum_PxQueryFlagEnum_ePREFILTER()") +private fun PxQueryFlagEnum_ePOSTFILTER(module: JsAny): Int = js("module._emscripten_enum_PxQueryFlagEnum_ePOSTFILTER()") +private fun PxQueryFlagEnum_eANY_HIT(module: JsAny): Int = js("module._emscripten_enum_PxQueryFlagEnum_eANY_HIT()") +private fun PxQueryFlagEnum_eNO_BLOCK(module: JsAny): Int = js("module._emscripten_enum_PxQueryFlagEnum_eNO_BLOCK()") + value class PxQueryHitType private constructor(val value: Int) { companion object { - val eNONE: PxQueryHitType = PxQueryHitType(PhysXJsLoader.physXJs._emscripten_enum_PxQueryHitType_eNONE()) - val eBLOCK: PxQueryHitType = PxQueryHitType(PhysXJsLoader.physXJs._emscripten_enum_PxQueryHitType_eBLOCK()) - val eTOUCH: PxQueryHitType = PxQueryHitType(PhysXJsLoader.physXJs._emscripten_enum_PxQueryHitType_eTOUCH()) + val eNONE: PxQueryHitType = PxQueryHitType(PxQueryHitType_eNONE(PhysXJsLoader.physXJs)) + val eBLOCK: PxQueryHitType = PxQueryHitType(PxQueryHitType_eBLOCK(PhysXJsLoader.physXJs)) + val eTOUCH: PxQueryHitType = PxQueryHitType(PxQueryHitType_eTOUCH(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNONE.value -> eNONE + eBLOCK.value -> eBLOCK + eTOUCH.value -> eTOUCH + else -> error("Invalid enum value $value for enum PxQueryHitType") + } } } +private fun PxQueryHitType_eNONE(module: JsAny): Int = js("module._emscripten_enum_PxQueryHitType_eNONE()") +private fun PxQueryHitType_eBLOCK(module: JsAny): Int = js("module._emscripten_enum_PxQueryHitType_eBLOCK()") +private fun PxQueryHitType_eTOUCH(module: JsAny): Int = js("module._emscripten_enum_PxQueryHitType_eTOUCH()") + value class PxActorFlagEnum private constructor(val value: Int) { companion object { - val eVISUALIZATION: PxActorFlagEnum = PxActorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorFlagEnum_eVISUALIZATION()) - val eDISABLE_GRAVITY: PxActorFlagEnum = PxActorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorFlagEnum_eDISABLE_GRAVITY()) - val eSEND_SLEEP_NOTIFIES: PxActorFlagEnum = PxActorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorFlagEnum_eSEND_SLEEP_NOTIFIES()) - val eDISABLE_SIMULATION: PxActorFlagEnum = PxActorFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorFlagEnum_eDISABLE_SIMULATION()) + val eVISUALIZATION: PxActorFlagEnum = PxActorFlagEnum(PxActorFlagEnum_eVISUALIZATION(PhysXJsLoader.physXJs)) + val eDISABLE_GRAVITY: PxActorFlagEnum = PxActorFlagEnum(PxActorFlagEnum_eDISABLE_GRAVITY(PhysXJsLoader.physXJs)) + val eSEND_SLEEP_NOTIFIES: PxActorFlagEnum = PxActorFlagEnum(PxActorFlagEnum_eSEND_SLEEP_NOTIFIES(PhysXJsLoader.physXJs)) + val eDISABLE_SIMULATION: PxActorFlagEnum = PxActorFlagEnum(PxActorFlagEnum_eDISABLE_SIMULATION(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eVISUALIZATION.value -> eVISUALIZATION + eDISABLE_GRAVITY.value -> eDISABLE_GRAVITY + eSEND_SLEEP_NOTIFIES.value -> eSEND_SLEEP_NOTIFIES + eDISABLE_SIMULATION.value -> eDISABLE_SIMULATION + else -> error("Invalid enum value $value for enum PxActorFlagEnum") + } } } +private fun PxActorFlagEnum_eVISUALIZATION(module: JsAny): Int = js("module._emscripten_enum_PxActorFlagEnum_eVISUALIZATION()") +private fun PxActorFlagEnum_eDISABLE_GRAVITY(module: JsAny): Int = js("module._emscripten_enum_PxActorFlagEnum_eDISABLE_GRAVITY()") +private fun PxActorFlagEnum_eSEND_SLEEP_NOTIFIES(module: JsAny): Int = js("module._emscripten_enum_PxActorFlagEnum_eSEND_SLEEP_NOTIFIES()") +private fun PxActorFlagEnum_eDISABLE_SIMULATION(module: JsAny): Int = js("module._emscripten_enum_PxActorFlagEnum_eDISABLE_SIMULATION()") + value class PxActorTypeEnum private constructor(val value: Int) { companion object { - val eRIGID_STATIC: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_eRIGID_STATIC()) - val eRIGID_DYNAMIC: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_eRIGID_DYNAMIC()) - val eARTICULATION_LINK: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_eARTICULATION_LINK()) - val eDEFORMABLE_SURFACE: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_eDEFORMABLE_SURFACE()) - val eDEFORMABLE_VOLUME: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_eDEFORMABLE_VOLUME()) - val eSOFTBODY: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_eSOFTBODY()) - val ePBD_PARTICLESYSTEM: PxActorTypeEnum = PxActorTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeEnum_ePBD_PARTICLESYSTEM()) + val eRIGID_STATIC: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_eRIGID_STATIC(PhysXJsLoader.physXJs)) + val eRIGID_DYNAMIC: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_eRIGID_DYNAMIC(PhysXJsLoader.physXJs)) + val eARTICULATION_LINK: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_eARTICULATION_LINK(PhysXJsLoader.physXJs)) + val eDEFORMABLE_SURFACE: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_eDEFORMABLE_SURFACE(PhysXJsLoader.physXJs)) + val eDEFORMABLE_VOLUME: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_eDEFORMABLE_VOLUME(PhysXJsLoader.physXJs)) + val eSOFTBODY: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_eSOFTBODY(PhysXJsLoader.physXJs)) + val ePBD_PARTICLESYSTEM: PxActorTypeEnum = PxActorTypeEnum(PxActorTypeEnum_ePBD_PARTICLESYSTEM(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eRIGID_STATIC.value -> eRIGID_STATIC + eRIGID_DYNAMIC.value -> eRIGID_DYNAMIC + eARTICULATION_LINK.value -> eARTICULATION_LINK + eDEFORMABLE_SURFACE.value -> eDEFORMABLE_SURFACE + eDEFORMABLE_VOLUME.value -> eDEFORMABLE_VOLUME + eSOFTBODY.value -> eSOFTBODY + ePBD_PARTICLESYSTEM.value -> ePBD_PARTICLESYSTEM + else -> error("Invalid enum value $value for enum PxActorTypeEnum") + } } } +private fun PxActorTypeEnum_eRIGID_STATIC(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_eRIGID_STATIC()") +private fun PxActorTypeEnum_eRIGID_DYNAMIC(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_eRIGID_DYNAMIC()") +private fun PxActorTypeEnum_eARTICULATION_LINK(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_eARTICULATION_LINK()") +private fun PxActorTypeEnum_eDEFORMABLE_SURFACE(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_eDEFORMABLE_SURFACE()") +private fun PxActorTypeEnum_eDEFORMABLE_VOLUME(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_eDEFORMABLE_VOLUME()") +private fun PxActorTypeEnum_eSOFTBODY(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_eSOFTBODY()") +private fun PxActorTypeEnum_ePBD_PARTICLESYSTEM(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeEnum_ePBD_PARTICLESYSTEM()") + value class PxActorTypeFlagEnum private constructor(val value: Int) { companion object { - val eRIGID_STATIC: PxActorTypeFlagEnum = PxActorTypeFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeFlagEnum_eRIGID_STATIC()) - val eRIGID_DYNAMIC: PxActorTypeFlagEnum = PxActorTypeFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxActorTypeFlagEnum_eRIGID_DYNAMIC()) + val eRIGID_STATIC: PxActorTypeFlagEnum = PxActorTypeFlagEnum(PxActorTypeFlagEnum_eRIGID_STATIC(PhysXJsLoader.physXJs)) + val eRIGID_DYNAMIC: PxActorTypeFlagEnum = PxActorTypeFlagEnum(PxActorTypeFlagEnum_eRIGID_DYNAMIC(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eRIGID_STATIC.value -> eRIGID_STATIC + eRIGID_DYNAMIC.value -> eRIGID_DYNAMIC + else -> error("Invalid enum value $value for enum PxActorTypeFlagEnum") + } } } +private fun PxActorTypeFlagEnum_eRIGID_STATIC(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeFlagEnum_eRIGID_STATIC()") +private fun PxActorTypeFlagEnum_eRIGID_DYNAMIC(module: JsAny): Int = js("module._emscripten_enum_PxActorTypeFlagEnum_eRIGID_DYNAMIC()") + value class PxRigidBodyFlagEnum private constructor(val value: Int) { companion object { - val eKINEMATIC: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eKINEMATIC()) - val eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES()) - val eENABLE_CCD: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_CCD()) - val eENABLE_CCD_FRICTION: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_CCD_FRICTION()) - val eENABLE_POSE_INTEGRATION_PREVIEW: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_POSE_INTEGRATION_PREVIEW()) - val eENABLE_SPECULATIVE_CCD: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_SPECULATIVE_CCD()) - val eENABLE_CCD_MAX_CONTACT_IMPULSE: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_CCD_MAX_CONTACT_IMPULSE()) - val eRETAIN_ACCELERATIONS: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidBodyFlagEnum_eRETAIN_ACCELERATIONS()) + val eKINEMATIC: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eKINEMATIC(PhysXJsLoader.physXJs)) + val eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES(PhysXJsLoader.physXJs)) + val eENABLE_CCD: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eENABLE_CCD(PhysXJsLoader.physXJs)) + val eENABLE_CCD_FRICTION: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eENABLE_CCD_FRICTION(PhysXJsLoader.physXJs)) + val eENABLE_POSE_INTEGRATION_PREVIEW: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eENABLE_POSE_INTEGRATION_PREVIEW(PhysXJsLoader.physXJs)) + val eENABLE_SPECULATIVE_CCD: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eENABLE_SPECULATIVE_CCD(PhysXJsLoader.physXJs)) + val eENABLE_CCD_MAX_CONTACT_IMPULSE: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eENABLE_CCD_MAX_CONTACT_IMPULSE(PhysXJsLoader.physXJs)) + val eRETAIN_ACCELERATIONS: PxRigidBodyFlagEnum = PxRigidBodyFlagEnum(PxRigidBodyFlagEnum_eRETAIN_ACCELERATIONS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eKINEMATIC.value -> eKINEMATIC + eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES.value -> eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES + eENABLE_CCD.value -> eENABLE_CCD + eENABLE_CCD_FRICTION.value -> eENABLE_CCD_FRICTION + eENABLE_POSE_INTEGRATION_PREVIEW.value -> eENABLE_POSE_INTEGRATION_PREVIEW + eENABLE_SPECULATIVE_CCD.value -> eENABLE_SPECULATIVE_CCD + eENABLE_CCD_MAX_CONTACT_IMPULSE.value -> eENABLE_CCD_MAX_CONTACT_IMPULSE + eRETAIN_ACCELERATIONS.value -> eRETAIN_ACCELERATIONS + else -> error("Invalid enum value $value for enum PxRigidBodyFlagEnum") + } } } +private fun PxRigidBodyFlagEnum_eKINEMATIC(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eKINEMATIC()") +private fun PxRigidBodyFlagEnum_eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES()") +private fun PxRigidBodyFlagEnum_eENABLE_CCD(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_CCD()") +private fun PxRigidBodyFlagEnum_eENABLE_CCD_FRICTION(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_CCD_FRICTION()") +private fun PxRigidBodyFlagEnum_eENABLE_POSE_INTEGRATION_PREVIEW(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_POSE_INTEGRATION_PREVIEW()") +private fun PxRigidBodyFlagEnum_eENABLE_SPECULATIVE_CCD(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_SPECULATIVE_CCD()") +private fun PxRigidBodyFlagEnum_eENABLE_CCD_MAX_CONTACT_IMPULSE(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eENABLE_CCD_MAX_CONTACT_IMPULSE()") +private fun PxRigidBodyFlagEnum_eRETAIN_ACCELERATIONS(module: JsAny): Int = js("module._emscripten_enum_PxRigidBodyFlagEnum_eRETAIN_ACCELERATIONS()") + value class PxRigidDynamicLockFlagEnum private constructor(val value: Int) { companion object { - val eLOCK_LINEAR_X: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_X()) - val eLOCK_LINEAR_Y: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Y()) - val eLOCK_LINEAR_Z: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Z()) - val eLOCK_ANGULAR_X: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_X()) - val eLOCK_ANGULAR_Y: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Y()) - val eLOCK_ANGULAR_Z: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Z()) + val eLOCK_LINEAR_X: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_X(PhysXJsLoader.physXJs)) + val eLOCK_LINEAR_Y: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Y(PhysXJsLoader.physXJs)) + val eLOCK_LINEAR_Z: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Z(PhysXJsLoader.physXJs)) + val eLOCK_ANGULAR_X: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_X(PhysXJsLoader.physXJs)) + val eLOCK_ANGULAR_Y: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Y(PhysXJsLoader.physXJs)) + val eLOCK_ANGULAR_Z: PxRigidDynamicLockFlagEnum = PxRigidDynamicLockFlagEnum(PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Z(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLOCK_LINEAR_X.value -> eLOCK_LINEAR_X + eLOCK_LINEAR_Y.value -> eLOCK_LINEAR_Y + eLOCK_LINEAR_Z.value -> eLOCK_LINEAR_Z + eLOCK_ANGULAR_X.value -> eLOCK_ANGULAR_X + eLOCK_ANGULAR_Y.value -> eLOCK_ANGULAR_Y + eLOCK_ANGULAR_Z.value -> eLOCK_ANGULAR_Z + else -> error("Invalid enum value $value for enum PxRigidDynamicLockFlagEnum") + } } } +private fun PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_X(module: JsAny): Int = js("module._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_X()") +private fun PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Y(module: JsAny): Int = js("module._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Y()") +private fun PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Z(module: JsAny): Int = js("module._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_LINEAR_Z()") +private fun PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_X(module: JsAny): Int = js("module._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_X()") +private fun PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Y(module: JsAny): Int = js("module._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Y()") +private fun PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Z(module: JsAny): Int = js("module._emscripten_enum_PxRigidDynamicLockFlagEnum_eLOCK_ANGULAR_Z()") + value class PxShapeFlagEnum private constructor(val value: Int) { companion object { - val eSIMULATION_SHAPE: PxShapeFlagEnum = PxShapeFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxShapeFlagEnum_eSIMULATION_SHAPE()) - val eSCENE_QUERY_SHAPE: PxShapeFlagEnum = PxShapeFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxShapeFlagEnum_eSCENE_QUERY_SHAPE()) - val eTRIGGER_SHAPE: PxShapeFlagEnum = PxShapeFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxShapeFlagEnum_eTRIGGER_SHAPE()) - val eVISUALIZATION: PxShapeFlagEnum = PxShapeFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxShapeFlagEnum_eVISUALIZATION()) + val eSIMULATION_SHAPE: PxShapeFlagEnum = PxShapeFlagEnum(PxShapeFlagEnum_eSIMULATION_SHAPE(PhysXJsLoader.physXJs)) + val eSCENE_QUERY_SHAPE: PxShapeFlagEnum = PxShapeFlagEnum(PxShapeFlagEnum_eSCENE_QUERY_SHAPE(PhysXJsLoader.physXJs)) + val eTRIGGER_SHAPE: PxShapeFlagEnum = PxShapeFlagEnum(PxShapeFlagEnum_eTRIGGER_SHAPE(PhysXJsLoader.physXJs)) + val eVISUALIZATION: PxShapeFlagEnum = PxShapeFlagEnum(PxShapeFlagEnum_eVISUALIZATION(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSIMULATION_SHAPE.value -> eSIMULATION_SHAPE + eSCENE_QUERY_SHAPE.value -> eSCENE_QUERY_SHAPE + eTRIGGER_SHAPE.value -> eTRIGGER_SHAPE + eVISUALIZATION.value -> eVISUALIZATION + else -> error("Invalid enum value $value for enum PxShapeFlagEnum") + } } } +private fun PxShapeFlagEnum_eSIMULATION_SHAPE(module: JsAny): Int = js("module._emscripten_enum_PxShapeFlagEnum_eSIMULATION_SHAPE()") +private fun PxShapeFlagEnum_eSCENE_QUERY_SHAPE(module: JsAny): Int = js("module._emscripten_enum_PxShapeFlagEnum_eSCENE_QUERY_SHAPE()") +private fun PxShapeFlagEnum_eTRIGGER_SHAPE(module: JsAny): Int = js("module._emscripten_enum_PxShapeFlagEnum_eTRIGGER_SHAPE()") +private fun PxShapeFlagEnum_eVISUALIZATION(module: JsAny): Int = js("module._emscripten_enum_PxShapeFlagEnum_eVISUALIZATION()") + value class PxBroadPhaseTypeEnum private constructor(val value: Int) { companion object { - val eSAP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBroadPhaseTypeEnum_eSAP()) - val eMBP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBroadPhaseTypeEnum_eMBP()) - val eABP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBroadPhaseTypeEnum_eABP()) - val ePABP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBroadPhaseTypeEnum_ePABP()) - val eGPU: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBroadPhaseTypeEnum_eGPU()) + val eSAP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PxBroadPhaseTypeEnum_eSAP(PhysXJsLoader.physXJs)) + val eMBP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PxBroadPhaseTypeEnum_eMBP(PhysXJsLoader.physXJs)) + val eABP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PxBroadPhaseTypeEnum_eABP(PhysXJsLoader.physXJs)) + val ePABP: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PxBroadPhaseTypeEnum_ePABP(PhysXJsLoader.physXJs)) + val eGPU: PxBroadPhaseTypeEnum = PxBroadPhaseTypeEnum(PxBroadPhaseTypeEnum_eGPU(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSAP.value -> eSAP + eMBP.value -> eMBP + eABP.value -> eABP + ePABP.value -> ePABP + eGPU.value -> eGPU + else -> error("Invalid enum value $value for enum PxBroadPhaseTypeEnum") + } } } +private fun PxBroadPhaseTypeEnum_eSAP(module: JsAny): Int = js("module._emscripten_enum_PxBroadPhaseTypeEnum_eSAP()") +private fun PxBroadPhaseTypeEnum_eMBP(module: JsAny): Int = js("module._emscripten_enum_PxBroadPhaseTypeEnum_eMBP()") +private fun PxBroadPhaseTypeEnum_eABP(module: JsAny): Int = js("module._emscripten_enum_PxBroadPhaseTypeEnum_eABP()") +private fun PxBroadPhaseTypeEnum_ePABP(module: JsAny): Int = js("module._emscripten_enum_PxBroadPhaseTypeEnum_ePABP()") +private fun PxBroadPhaseTypeEnum_eGPU(module: JsAny): Int = js("module._emscripten_enum_PxBroadPhaseTypeEnum_eGPU()") + value class PxBVHBuildStrategyEnum private constructor(val value: Int) { companion object { - val eFAST: PxBVHBuildStrategyEnum = PxBVHBuildStrategyEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBVHBuildStrategyEnum_eFAST()) - val eDEFAULT: PxBVHBuildStrategyEnum = PxBVHBuildStrategyEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBVHBuildStrategyEnum_eDEFAULT()) - val eSAH: PxBVHBuildStrategyEnum = PxBVHBuildStrategyEnum(PhysXJsLoader.physXJs._emscripten_enum_PxBVHBuildStrategyEnum_eSAH()) + val eFAST: PxBVHBuildStrategyEnum = PxBVHBuildStrategyEnum(PxBVHBuildStrategyEnum_eFAST(PhysXJsLoader.physXJs)) + val eDEFAULT: PxBVHBuildStrategyEnum = PxBVHBuildStrategyEnum(PxBVHBuildStrategyEnum_eDEFAULT(PhysXJsLoader.physXJs)) + val eSAH: PxBVHBuildStrategyEnum = PxBVHBuildStrategyEnum(PxBVHBuildStrategyEnum_eSAH(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eFAST.value -> eFAST + eDEFAULT.value -> eDEFAULT + eSAH.value -> eSAH + else -> error("Invalid enum value $value for enum PxBVHBuildStrategyEnum") + } } } +private fun PxBVHBuildStrategyEnum_eFAST(module: JsAny): Int = js("module._emscripten_enum_PxBVHBuildStrategyEnum_eFAST()") +private fun PxBVHBuildStrategyEnum_eDEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxBVHBuildStrategyEnum_eDEFAULT()") +private fun PxBVHBuildStrategyEnum_eSAH(module: JsAny): Int = js("module._emscripten_enum_PxBVHBuildStrategyEnum_eSAH()") + value class PxCombineModeEnum private constructor(val value: Int) { companion object { - val eAVERAGE: PxCombineModeEnum = PxCombineModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxCombineModeEnum_eAVERAGE()) - val eMIN: PxCombineModeEnum = PxCombineModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxCombineModeEnum_eMIN()) - val eMULTIPLY: PxCombineModeEnum = PxCombineModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxCombineModeEnum_eMULTIPLY()) - val eMAX: PxCombineModeEnum = PxCombineModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxCombineModeEnum_eMAX()) + val eAVERAGE: PxCombineModeEnum = PxCombineModeEnum(PxCombineModeEnum_eAVERAGE(PhysXJsLoader.physXJs)) + val eMIN: PxCombineModeEnum = PxCombineModeEnum(PxCombineModeEnum_eMIN(PhysXJsLoader.physXJs)) + val eMULTIPLY: PxCombineModeEnum = PxCombineModeEnum(PxCombineModeEnum_eMULTIPLY(PhysXJsLoader.physXJs)) + val eMAX: PxCombineModeEnum = PxCombineModeEnum(PxCombineModeEnum_eMAX(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eAVERAGE.value -> eAVERAGE + eMIN.value -> eMIN + eMULTIPLY.value -> eMULTIPLY + eMAX.value -> eMAX + else -> error("Invalid enum value $value for enum PxCombineModeEnum") + } } } +private fun PxCombineModeEnum_eAVERAGE(module: JsAny): Int = js("module._emscripten_enum_PxCombineModeEnum_eAVERAGE()") +private fun PxCombineModeEnum_eMIN(module: JsAny): Int = js("module._emscripten_enum_PxCombineModeEnum_eMIN()") +private fun PxCombineModeEnum_eMULTIPLY(module: JsAny): Int = js("module._emscripten_enum_PxCombineModeEnum_eMULTIPLY()") +private fun PxCombineModeEnum_eMAX(module: JsAny): Int = js("module._emscripten_enum_PxCombineModeEnum_eMAX()") + value class PxConstraintFlagEnum private constructor(val value: Int) { companion object { - val eBROKEN: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eBROKEN()) - val eCOLLISION_ENABLED: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eCOLLISION_ENABLED()) - val eVISUALIZATION: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eVISUALIZATION()) - val eDRIVE_LIMITS_ARE_FORCES: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eDRIVE_LIMITS_ARE_FORCES()) - val eIMPROVED_SLERP: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eIMPROVED_SLERP()) - val eDISABLE_PREPROCESSING: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eDISABLE_PREPROCESSING()) - val eENABLE_EXTENDED_LIMITS: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eENABLE_EXTENDED_LIMITS()) - val eGPU_COMPATIBLE: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eGPU_COMPATIBLE()) - val eALWAYS_UPDATE: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eALWAYS_UPDATE()) - val eDISABLE_CONSTRAINT: PxConstraintFlagEnum = PxConstraintFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxConstraintFlagEnum_eDISABLE_CONSTRAINT()) + val eBROKEN: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eBROKEN(PhysXJsLoader.physXJs)) + val eCOLLISION_ENABLED: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eCOLLISION_ENABLED(PhysXJsLoader.physXJs)) + val eVISUALIZATION: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eVISUALIZATION(PhysXJsLoader.physXJs)) + val eDRIVE_LIMITS_ARE_FORCES: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eDRIVE_LIMITS_ARE_FORCES(PhysXJsLoader.physXJs)) + val eIMPROVED_SLERP: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eIMPROVED_SLERP(PhysXJsLoader.physXJs)) + val eDISABLE_PREPROCESSING: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eDISABLE_PREPROCESSING(PhysXJsLoader.physXJs)) + val eENABLE_EXTENDED_LIMITS: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eENABLE_EXTENDED_LIMITS(PhysXJsLoader.physXJs)) + val eGPU_COMPATIBLE: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eGPU_COMPATIBLE(PhysXJsLoader.physXJs)) + val eALWAYS_UPDATE: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eALWAYS_UPDATE(PhysXJsLoader.physXJs)) + val eDISABLE_CONSTRAINT: PxConstraintFlagEnum = PxConstraintFlagEnum(PxConstraintFlagEnum_eDISABLE_CONSTRAINT(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eBROKEN.value -> eBROKEN + eCOLLISION_ENABLED.value -> eCOLLISION_ENABLED + eVISUALIZATION.value -> eVISUALIZATION + eDRIVE_LIMITS_ARE_FORCES.value -> eDRIVE_LIMITS_ARE_FORCES + eIMPROVED_SLERP.value -> eIMPROVED_SLERP + eDISABLE_PREPROCESSING.value -> eDISABLE_PREPROCESSING + eENABLE_EXTENDED_LIMITS.value -> eENABLE_EXTENDED_LIMITS + eGPU_COMPATIBLE.value -> eGPU_COMPATIBLE + eALWAYS_UPDATE.value -> eALWAYS_UPDATE + eDISABLE_CONSTRAINT.value -> eDISABLE_CONSTRAINT + else -> error("Invalid enum value $value for enum PxConstraintFlagEnum") + } } } +private fun PxConstraintFlagEnum_eBROKEN(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eBROKEN()") +private fun PxConstraintFlagEnum_eCOLLISION_ENABLED(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eCOLLISION_ENABLED()") +private fun PxConstraintFlagEnum_eVISUALIZATION(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eVISUALIZATION()") +private fun PxConstraintFlagEnum_eDRIVE_LIMITS_ARE_FORCES(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eDRIVE_LIMITS_ARE_FORCES()") +private fun PxConstraintFlagEnum_eIMPROVED_SLERP(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eIMPROVED_SLERP()") +private fun PxConstraintFlagEnum_eDISABLE_PREPROCESSING(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eDISABLE_PREPROCESSING()") +private fun PxConstraintFlagEnum_eENABLE_EXTENDED_LIMITS(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eENABLE_EXTENDED_LIMITS()") +private fun PxConstraintFlagEnum_eGPU_COMPATIBLE(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eGPU_COMPATIBLE()") +private fun PxConstraintFlagEnum_eALWAYS_UPDATE(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eALWAYS_UPDATE()") +private fun PxConstraintFlagEnum_eDISABLE_CONSTRAINT(module: JsAny): Int = js("module._emscripten_enum_PxConstraintFlagEnum_eDISABLE_CONSTRAINT()") + value class PxContactPairHeaderFlagEnum private constructor(val value: Int) { companion object { - val eREMOVED_ACTOR_0: PxContactPairHeaderFlagEnum = PxContactPairHeaderFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_0()) - val eREMOVED_ACTOR_1: PxContactPairHeaderFlagEnum = PxContactPairHeaderFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_1()) + val eREMOVED_ACTOR_0: PxContactPairHeaderFlagEnum = PxContactPairHeaderFlagEnum(PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_0(PhysXJsLoader.physXJs)) + val eREMOVED_ACTOR_1: PxContactPairHeaderFlagEnum = PxContactPairHeaderFlagEnum(PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_1(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eREMOVED_ACTOR_0.value -> eREMOVED_ACTOR_0 + eREMOVED_ACTOR_1.value -> eREMOVED_ACTOR_1 + else -> error("Invalid enum value $value for enum PxContactPairHeaderFlagEnum") + } } } +private fun PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_0(module: JsAny): Int = js("module._emscripten_enum_PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_0()") +private fun PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_1(module: JsAny): Int = js("module._emscripten_enum_PxContactPairHeaderFlagEnum_eREMOVED_ACTOR_1()") + value class PxContactPairFlagEnum private constructor(val value: Int) { companion object { - val eREMOVED_SHAPE_0: PxContactPairFlagEnum = PxContactPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairFlagEnum_eREMOVED_SHAPE_0()) - val eREMOVED_SHAPE_1: PxContactPairFlagEnum = PxContactPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairFlagEnum_eREMOVED_SHAPE_1()) - val eACTOR_PAIR_HAS_FIRST_TOUCH: PxContactPairFlagEnum = PxContactPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairFlagEnum_eACTOR_PAIR_HAS_FIRST_TOUCH()) - val eACTOR_PAIR_LOST_TOUCH: PxContactPairFlagEnum = PxContactPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairFlagEnum_eACTOR_PAIR_LOST_TOUCH()) - val eINTERNAL_HAS_IMPULSES: PxContactPairFlagEnum = PxContactPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairFlagEnum_eINTERNAL_HAS_IMPULSES()) - val eINTERNAL_CONTACTS_ARE_FLIPPED: PxContactPairFlagEnum = PxContactPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxContactPairFlagEnum_eINTERNAL_CONTACTS_ARE_FLIPPED()) + val eREMOVED_SHAPE_0: PxContactPairFlagEnum = PxContactPairFlagEnum(PxContactPairFlagEnum_eREMOVED_SHAPE_0(PhysXJsLoader.physXJs)) + val eREMOVED_SHAPE_1: PxContactPairFlagEnum = PxContactPairFlagEnum(PxContactPairFlagEnum_eREMOVED_SHAPE_1(PhysXJsLoader.physXJs)) + val eACTOR_PAIR_HAS_FIRST_TOUCH: PxContactPairFlagEnum = PxContactPairFlagEnum(PxContactPairFlagEnum_eACTOR_PAIR_HAS_FIRST_TOUCH(PhysXJsLoader.physXJs)) + val eACTOR_PAIR_LOST_TOUCH: PxContactPairFlagEnum = PxContactPairFlagEnum(PxContactPairFlagEnum_eACTOR_PAIR_LOST_TOUCH(PhysXJsLoader.physXJs)) + val eINTERNAL_HAS_IMPULSES: PxContactPairFlagEnum = PxContactPairFlagEnum(PxContactPairFlagEnum_eINTERNAL_HAS_IMPULSES(PhysXJsLoader.physXJs)) + val eINTERNAL_CONTACTS_ARE_FLIPPED: PxContactPairFlagEnum = PxContactPairFlagEnum(PxContactPairFlagEnum_eINTERNAL_CONTACTS_ARE_FLIPPED(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eREMOVED_SHAPE_0.value -> eREMOVED_SHAPE_0 + eREMOVED_SHAPE_1.value -> eREMOVED_SHAPE_1 + eACTOR_PAIR_HAS_FIRST_TOUCH.value -> eACTOR_PAIR_HAS_FIRST_TOUCH + eACTOR_PAIR_LOST_TOUCH.value -> eACTOR_PAIR_LOST_TOUCH + eINTERNAL_HAS_IMPULSES.value -> eINTERNAL_HAS_IMPULSES + eINTERNAL_CONTACTS_ARE_FLIPPED.value -> eINTERNAL_CONTACTS_ARE_FLIPPED + else -> error("Invalid enum value $value for enum PxContactPairFlagEnum") + } } } +private fun PxContactPairFlagEnum_eREMOVED_SHAPE_0(module: JsAny): Int = js("module._emscripten_enum_PxContactPairFlagEnum_eREMOVED_SHAPE_0()") +private fun PxContactPairFlagEnum_eREMOVED_SHAPE_1(module: JsAny): Int = js("module._emscripten_enum_PxContactPairFlagEnum_eREMOVED_SHAPE_1()") +private fun PxContactPairFlagEnum_eACTOR_PAIR_HAS_FIRST_TOUCH(module: JsAny): Int = js("module._emscripten_enum_PxContactPairFlagEnum_eACTOR_PAIR_HAS_FIRST_TOUCH()") +private fun PxContactPairFlagEnum_eACTOR_PAIR_LOST_TOUCH(module: JsAny): Int = js("module._emscripten_enum_PxContactPairFlagEnum_eACTOR_PAIR_LOST_TOUCH()") +private fun PxContactPairFlagEnum_eINTERNAL_HAS_IMPULSES(module: JsAny): Int = js("module._emscripten_enum_PxContactPairFlagEnum_eINTERNAL_HAS_IMPULSES()") +private fun PxContactPairFlagEnum_eINTERNAL_CONTACTS_ARE_FLIPPED(module: JsAny): Int = js("module._emscripten_enum_PxContactPairFlagEnum_eINTERNAL_CONTACTS_ARE_FLIPPED()") + value class PxDynamicTreeSecondaryPrunerEnum private constructor(val value: Int) { companion object { - val eNONE: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eNONE()) - val eBUCKET: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eBUCKET()) - val eINCREMENTAL: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eINCREMENTAL()) - val eBVH: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PhysXJsLoader.physXJs._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eBVH()) + val eNONE: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PxDynamicTreeSecondaryPrunerEnum_eNONE(PhysXJsLoader.physXJs)) + val eBUCKET: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PxDynamicTreeSecondaryPrunerEnum_eBUCKET(PhysXJsLoader.physXJs)) + val eINCREMENTAL: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PxDynamicTreeSecondaryPrunerEnum_eINCREMENTAL(PhysXJsLoader.physXJs)) + val eBVH: PxDynamicTreeSecondaryPrunerEnum = PxDynamicTreeSecondaryPrunerEnum(PxDynamicTreeSecondaryPrunerEnum_eBVH(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNONE.value -> eNONE + eBUCKET.value -> eBUCKET + eINCREMENTAL.value -> eINCREMENTAL + eBVH.value -> eBVH + else -> error("Invalid enum value $value for enum PxDynamicTreeSecondaryPrunerEnum") + } } } +private fun PxDynamicTreeSecondaryPrunerEnum_eNONE(module: JsAny): Int = js("module._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eNONE()") +private fun PxDynamicTreeSecondaryPrunerEnum_eBUCKET(module: JsAny): Int = js("module._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eBUCKET()") +private fun PxDynamicTreeSecondaryPrunerEnum_eINCREMENTAL(module: JsAny): Int = js("module._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eINCREMENTAL()") +private fun PxDynamicTreeSecondaryPrunerEnum_eBVH(module: JsAny): Int = js("module._emscripten_enum_PxDynamicTreeSecondaryPrunerEnum_eBVH()") + value class PxFilterFlagEnum private constructor(val value: Int) { companion object { - val eKILL: PxFilterFlagEnum = PxFilterFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterFlagEnum_eKILL()) - val eSUPPRESS: PxFilterFlagEnum = PxFilterFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterFlagEnum_eSUPPRESS()) - val eCALLBACK: PxFilterFlagEnum = PxFilterFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterFlagEnum_eCALLBACK()) - val eNOTIFY: PxFilterFlagEnum = PxFilterFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterFlagEnum_eNOTIFY()) - val eDEFAULT: PxFilterFlagEnum = PxFilterFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterFlagEnum_eDEFAULT()) + val eKILL: PxFilterFlagEnum = PxFilterFlagEnum(PxFilterFlagEnum_eKILL(PhysXJsLoader.physXJs)) + val eSUPPRESS: PxFilterFlagEnum = PxFilterFlagEnum(PxFilterFlagEnum_eSUPPRESS(PhysXJsLoader.physXJs)) + val eCALLBACK: PxFilterFlagEnum = PxFilterFlagEnum(PxFilterFlagEnum_eCALLBACK(PhysXJsLoader.physXJs)) + val eNOTIFY: PxFilterFlagEnum = PxFilterFlagEnum(PxFilterFlagEnum_eNOTIFY(PhysXJsLoader.physXJs)) + val eDEFAULT: PxFilterFlagEnum = PxFilterFlagEnum(PxFilterFlagEnum_eDEFAULT(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eKILL.value -> eKILL + eSUPPRESS.value -> eSUPPRESS + eCALLBACK.value -> eCALLBACK + eNOTIFY.value -> eNOTIFY + eDEFAULT.value -> eDEFAULT + else -> error("Invalid enum value $value for enum PxFilterFlagEnum") + } } } +private fun PxFilterFlagEnum_eKILL(module: JsAny): Int = js("module._emscripten_enum_PxFilterFlagEnum_eKILL()") +private fun PxFilterFlagEnum_eSUPPRESS(module: JsAny): Int = js("module._emscripten_enum_PxFilterFlagEnum_eSUPPRESS()") +private fun PxFilterFlagEnum_eCALLBACK(module: JsAny): Int = js("module._emscripten_enum_PxFilterFlagEnum_eCALLBACK()") +private fun PxFilterFlagEnum_eNOTIFY(module: JsAny): Int = js("module._emscripten_enum_PxFilterFlagEnum_eNOTIFY()") +private fun PxFilterFlagEnum_eDEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxFilterFlagEnum_eDEFAULT()") + value class PxFilterObjectFlagEnum private constructor(val value: Int) { companion object { - val eKINEMATIC: PxFilterObjectFlagEnum = PxFilterObjectFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterObjectFlagEnum_eKINEMATIC()) - val eTRIGGER: PxFilterObjectFlagEnum = PxFilterObjectFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFilterObjectFlagEnum_eTRIGGER()) + val eKINEMATIC: PxFilterObjectFlagEnum = PxFilterObjectFlagEnum(PxFilterObjectFlagEnum_eKINEMATIC(PhysXJsLoader.physXJs)) + val eTRIGGER: PxFilterObjectFlagEnum = PxFilterObjectFlagEnum(PxFilterObjectFlagEnum_eTRIGGER(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eKINEMATIC.value -> eKINEMATIC + eTRIGGER.value -> eTRIGGER + else -> error("Invalid enum value $value for enum PxFilterObjectFlagEnum") + } } } +private fun PxFilterObjectFlagEnum_eKINEMATIC(module: JsAny): Int = js("module._emscripten_enum_PxFilterObjectFlagEnum_eKINEMATIC()") +private fun PxFilterObjectFlagEnum_eTRIGGER(module: JsAny): Int = js("module._emscripten_enum_PxFilterObjectFlagEnum_eTRIGGER()") + value class PxForceModeEnum private constructor(val value: Int) { companion object { - val eFORCE: PxForceModeEnum = PxForceModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxForceModeEnum_eFORCE()) - val eIMPULSE: PxForceModeEnum = PxForceModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxForceModeEnum_eIMPULSE()) - val eVELOCITY_CHANGE: PxForceModeEnum = PxForceModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxForceModeEnum_eVELOCITY_CHANGE()) - val eACCELERATION: PxForceModeEnum = PxForceModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxForceModeEnum_eACCELERATION()) + val eFORCE: PxForceModeEnum = PxForceModeEnum(PxForceModeEnum_eFORCE(PhysXJsLoader.physXJs)) + val eIMPULSE: PxForceModeEnum = PxForceModeEnum(PxForceModeEnum_eIMPULSE(PhysXJsLoader.physXJs)) + val eVELOCITY_CHANGE: PxForceModeEnum = PxForceModeEnum(PxForceModeEnum_eVELOCITY_CHANGE(PhysXJsLoader.physXJs)) + val eACCELERATION: PxForceModeEnum = PxForceModeEnum(PxForceModeEnum_eACCELERATION(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eFORCE.value -> eFORCE + eIMPULSE.value -> eIMPULSE + eVELOCITY_CHANGE.value -> eVELOCITY_CHANGE + eACCELERATION.value -> eACCELERATION + else -> error("Invalid enum value $value for enum PxForceModeEnum") + } } } +private fun PxForceModeEnum_eFORCE(module: JsAny): Int = js("module._emscripten_enum_PxForceModeEnum_eFORCE()") +private fun PxForceModeEnum_eIMPULSE(module: JsAny): Int = js("module._emscripten_enum_PxForceModeEnum_eIMPULSE()") +private fun PxForceModeEnum_eVELOCITY_CHANGE(module: JsAny): Int = js("module._emscripten_enum_PxForceModeEnum_eVELOCITY_CHANGE()") +private fun PxForceModeEnum_eACCELERATION(module: JsAny): Int = js("module._emscripten_enum_PxForceModeEnum_eACCELERATION()") + value class PxFrictionTypeEnum private constructor(val value: Int) { companion object { - val ePATCH: PxFrictionTypeEnum = PxFrictionTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFrictionTypeEnum_ePATCH()) - val eFRICTION_COUNT: PxFrictionTypeEnum = PxFrictionTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxFrictionTypeEnum_eFRICTION_COUNT()) + val ePATCH: PxFrictionTypeEnum = PxFrictionTypeEnum(PxFrictionTypeEnum_ePATCH(PhysXJsLoader.physXJs)) + val eFRICTION_COUNT: PxFrictionTypeEnum = PxFrictionTypeEnum(PxFrictionTypeEnum_eFRICTION_COUNT(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePATCH.value -> ePATCH + eFRICTION_COUNT.value -> eFRICTION_COUNT + else -> error("Invalid enum value $value for enum PxFrictionTypeEnum") + } } } +private fun PxFrictionTypeEnum_ePATCH(module: JsAny): Int = js("module._emscripten_enum_PxFrictionTypeEnum_ePATCH()") +private fun PxFrictionTypeEnum_eFRICTION_COUNT(module: JsAny): Int = js("module._emscripten_enum_PxFrictionTypeEnum_eFRICTION_COUNT()") + value class PxMaterialFlagEnum private constructor(val value: Int) { companion object { - val eDISABLE_FRICTION: PxMaterialFlagEnum = PxMaterialFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMaterialFlagEnum_eDISABLE_FRICTION()) - val eDISABLE_STRONG_FRICTION: PxMaterialFlagEnum = PxMaterialFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMaterialFlagEnum_eDISABLE_STRONG_FRICTION()) - val eCOMPLIANT_ACCELERATION_SPRING: PxMaterialFlagEnum = PxMaterialFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxMaterialFlagEnum_eCOMPLIANT_ACCELERATION_SPRING()) + val eDISABLE_FRICTION: PxMaterialFlagEnum = PxMaterialFlagEnum(PxMaterialFlagEnum_eDISABLE_FRICTION(PhysXJsLoader.physXJs)) + val eDISABLE_STRONG_FRICTION: PxMaterialFlagEnum = PxMaterialFlagEnum(PxMaterialFlagEnum_eDISABLE_STRONG_FRICTION(PhysXJsLoader.physXJs)) + val eCOMPLIANT_ACCELERATION_SPRING: PxMaterialFlagEnum = PxMaterialFlagEnum(PxMaterialFlagEnum_eCOMPLIANT_ACCELERATION_SPRING(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eDISABLE_FRICTION.value -> eDISABLE_FRICTION + eDISABLE_STRONG_FRICTION.value -> eDISABLE_STRONG_FRICTION + eCOMPLIANT_ACCELERATION_SPRING.value -> eCOMPLIANT_ACCELERATION_SPRING + else -> error("Invalid enum value $value for enum PxMaterialFlagEnum") + } } } +private fun PxMaterialFlagEnum_eDISABLE_FRICTION(module: JsAny): Int = js("module._emscripten_enum_PxMaterialFlagEnum_eDISABLE_FRICTION()") +private fun PxMaterialFlagEnum_eDISABLE_STRONG_FRICTION(module: JsAny): Int = js("module._emscripten_enum_PxMaterialFlagEnum_eDISABLE_STRONG_FRICTION()") +private fun PxMaterialFlagEnum_eCOMPLIANT_ACCELERATION_SPRING(module: JsAny): Int = js("module._emscripten_enum_PxMaterialFlagEnum_eCOMPLIANT_ACCELERATION_SPRING()") + value class PxPairFilteringModeEnum private constructor(val value: Int) { companion object { - val eKEEP: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFilteringModeEnum_eKEEP()) - val eSUPPRESS: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFilteringModeEnum_eSUPPRESS()) - val eKILL: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFilteringModeEnum_eKILL()) - val eDEFAULT: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFilteringModeEnum_eDEFAULT()) + val eKEEP: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PxPairFilteringModeEnum_eKEEP(PhysXJsLoader.physXJs)) + val eSUPPRESS: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PxPairFilteringModeEnum_eSUPPRESS(PhysXJsLoader.physXJs)) + val eKILL: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PxPairFilteringModeEnum_eKILL(PhysXJsLoader.physXJs)) + val eDEFAULT: PxPairFilteringModeEnum = PxPairFilteringModeEnum(PxPairFilteringModeEnum_eDEFAULT(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eKEEP.value -> eKEEP + eSUPPRESS.value -> eSUPPRESS + eKILL.value -> eKILL + eDEFAULT.value -> eDEFAULT + else -> error("Invalid enum value $value for enum PxPairFilteringModeEnum") + } } } +private fun PxPairFilteringModeEnum_eKEEP(module: JsAny): Int = js("module._emscripten_enum_PxPairFilteringModeEnum_eKEEP()") +private fun PxPairFilteringModeEnum_eSUPPRESS(module: JsAny): Int = js("module._emscripten_enum_PxPairFilteringModeEnum_eSUPPRESS()") +private fun PxPairFilteringModeEnum_eKILL(module: JsAny): Int = js("module._emscripten_enum_PxPairFilteringModeEnum_eKILL()") +private fun PxPairFilteringModeEnum_eDEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxPairFilteringModeEnum_eDEFAULT()") + value class PxPairFlagEnum private constructor(val value: Int) { companion object { - val eSOLVE_CONTACT: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eSOLVE_CONTACT()) - val eMODIFY_CONTACTS: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eMODIFY_CONTACTS()) - val eNOTIFY_TOUCH_FOUND: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_FOUND()) - val eNOTIFY_TOUCH_PERSISTS: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_PERSISTS()) - val eNOTIFY_TOUCH_LOST: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_LOST()) - val eNOTIFY_TOUCH_CCD: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_CCD()) - val eNOTIFY_THRESHOLD_FORCE_FOUND: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_FOUND()) - val eNOTIFY_THRESHOLD_FORCE_PERSISTS: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_PERSISTS()) - val eNOTIFY_THRESHOLD_FORCE_LOST: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_LOST()) - val eNOTIFY_CONTACT_POINTS: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNOTIFY_CONTACT_POINTS()) - val eDETECT_DISCRETE_CONTACT: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eDETECT_DISCRETE_CONTACT()) - val eDETECT_CCD_CONTACT: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eDETECT_CCD_CONTACT()) - val ePRE_SOLVER_VELOCITY: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_ePRE_SOLVER_VELOCITY()) - val ePOST_SOLVER_VELOCITY: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_ePOST_SOLVER_VELOCITY()) - val eCONTACT_EVENT_POSE: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eCONTACT_EVENT_POSE()) - val eNEXT_FREE: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eNEXT_FREE()) - val eCONTACT_DEFAULT: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eCONTACT_DEFAULT()) - val eTRIGGER_DEFAULT: PxPairFlagEnum = PxPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPairFlagEnum_eTRIGGER_DEFAULT()) + val eSOLVE_CONTACT: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eSOLVE_CONTACT(PhysXJsLoader.physXJs)) + val eMODIFY_CONTACTS: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eMODIFY_CONTACTS(PhysXJsLoader.physXJs)) + val eNOTIFY_TOUCH_FOUND: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_TOUCH_FOUND(PhysXJsLoader.physXJs)) + val eNOTIFY_TOUCH_PERSISTS: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_TOUCH_PERSISTS(PhysXJsLoader.physXJs)) + val eNOTIFY_TOUCH_LOST: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_TOUCH_LOST(PhysXJsLoader.physXJs)) + val eNOTIFY_TOUCH_CCD: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_TOUCH_CCD(PhysXJsLoader.physXJs)) + val eNOTIFY_THRESHOLD_FORCE_FOUND: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_FOUND(PhysXJsLoader.physXJs)) + val eNOTIFY_THRESHOLD_FORCE_PERSISTS: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_PERSISTS(PhysXJsLoader.physXJs)) + val eNOTIFY_THRESHOLD_FORCE_LOST: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_LOST(PhysXJsLoader.physXJs)) + val eNOTIFY_CONTACT_POINTS: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNOTIFY_CONTACT_POINTS(PhysXJsLoader.physXJs)) + val eDETECT_DISCRETE_CONTACT: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eDETECT_DISCRETE_CONTACT(PhysXJsLoader.physXJs)) + val eDETECT_CCD_CONTACT: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eDETECT_CCD_CONTACT(PhysXJsLoader.physXJs)) + val ePRE_SOLVER_VELOCITY: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_ePRE_SOLVER_VELOCITY(PhysXJsLoader.physXJs)) + val ePOST_SOLVER_VELOCITY: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_ePOST_SOLVER_VELOCITY(PhysXJsLoader.physXJs)) + val eCONTACT_EVENT_POSE: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eCONTACT_EVENT_POSE(PhysXJsLoader.physXJs)) + val eNEXT_FREE: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eNEXT_FREE(PhysXJsLoader.physXJs)) + val eCONTACT_DEFAULT: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eCONTACT_DEFAULT(PhysXJsLoader.physXJs)) + val eTRIGGER_DEFAULT: PxPairFlagEnum = PxPairFlagEnum(PxPairFlagEnum_eTRIGGER_DEFAULT(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSOLVE_CONTACT.value -> eSOLVE_CONTACT + eMODIFY_CONTACTS.value -> eMODIFY_CONTACTS + eNOTIFY_TOUCH_FOUND.value -> eNOTIFY_TOUCH_FOUND + eNOTIFY_TOUCH_PERSISTS.value -> eNOTIFY_TOUCH_PERSISTS + eNOTIFY_TOUCH_LOST.value -> eNOTIFY_TOUCH_LOST + eNOTIFY_TOUCH_CCD.value -> eNOTIFY_TOUCH_CCD + eNOTIFY_THRESHOLD_FORCE_FOUND.value -> eNOTIFY_THRESHOLD_FORCE_FOUND + eNOTIFY_THRESHOLD_FORCE_PERSISTS.value -> eNOTIFY_THRESHOLD_FORCE_PERSISTS + eNOTIFY_THRESHOLD_FORCE_LOST.value -> eNOTIFY_THRESHOLD_FORCE_LOST + eNOTIFY_CONTACT_POINTS.value -> eNOTIFY_CONTACT_POINTS + eDETECT_DISCRETE_CONTACT.value -> eDETECT_DISCRETE_CONTACT + eDETECT_CCD_CONTACT.value -> eDETECT_CCD_CONTACT + ePRE_SOLVER_VELOCITY.value -> ePRE_SOLVER_VELOCITY + ePOST_SOLVER_VELOCITY.value -> ePOST_SOLVER_VELOCITY + eCONTACT_EVENT_POSE.value -> eCONTACT_EVENT_POSE + eNEXT_FREE.value -> eNEXT_FREE + eCONTACT_DEFAULT.value -> eCONTACT_DEFAULT + eTRIGGER_DEFAULT.value -> eTRIGGER_DEFAULT + else -> error("Invalid enum value $value for enum PxPairFlagEnum") + } } } +private fun PxPairFlagEnum_eSOLVE_CONTACT(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eSOLVE_CONTACT()") +private fun PxPairFlagEnum_eMODIFY_CONTACTS(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eMODIFY_CONTACTS()") +private fun PxPairFlagEnum_eNOTIFY_TOUCH_FOUND(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_FOUND()") +private fun PxPairFlagEnum_eNOTIFY_TOUCH_PERSISTS(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_PERSISTS()") +private fun PxPairFlagEnum_eNOTIFY_TOUCH_LOST(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_LOST()") +private fun PxPairFlagEnum_eNOTIFY_TOUCH_CCD(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_TOUCH_CCD()") +private fun PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_FOUND(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_FOUND()") +private fun PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_PERSISTS(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_PERSISTS()") +private fun PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_LOST(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_THRESHOLD_FORCE_LOST()") +private fun PxPairFlagEnum_eNOTIFY_CONTACT_POINTS(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNOTIFY_CONTACT_POINTS()") +private fun PxPairFlagEnum_eDETECT_DISCRETE_CONTACT(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eDETECT_DISCRETE_CONTACT()") +private fun PxPairFlagEnum_eDETECT_CCD_CONTACT(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eDETECT_CCD_CONTACT()") +private fun PxPairFlagEnum_ePRE_SOLVER_VELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_ePRE_SOLVER_VELOCITY()") +private fun PxPairFlagEnum_ePOST_SOLVER_VELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_ePOST_SOLVER_VELOCITY()") +private fun PxPairFlagEnum_eCONTACT_EVENT_POSE(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eCONTACT_EVENT_POSE()") +private fun PxPairFlagEnum_eNEXT_FREE(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eNEXT_FREE()") +private fun PxPairFlagEnum_eCONTACT_DEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eCONTACT_DEFAULT()") +private fun PxPairFlagEnum_eTRIGGER_DEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxPairFlagEnum_eTRIGGER_DEFAULT()") + value class PxPruningStructureTypeEnum private constructor(val value: Int) { companion object { - val eNONE: PxPruningStructureTypeEnum = PxPruningStructureTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPruningStructureTypeEnum_eNONE()) - val eDYNAMIC_AABB_TREE: PxPruningStructureTypeEnum = PxPruningStructureTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPruningStructureTypeEnum_eDYNAMIC_AABB_TREE()) - val eSTATIC_AABB_TREE: PxPruningStructureTypeEnum = PxPruningStructureTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxPruningStructureTypeEnum_eSTATIC_AABB_TREE()) + val eNONE: PxPruningStructureTypeEnum = PxPruningStructureTypeEnum(PxPruningStructureTypeEnum_eNONE(PhysXJsLoader.physXJs)) + val eDYNAMIC_AABB_TREE: PxPruningStructureTypeEnum = PxPruningStructureTypeEnum(PxPruningStructureTypeEnum_eDYNAMIC_AABB_TREE(PhysXJsLoader.physXJs)) + val eSTATIC_AABB_TREE: PxPruningStructureTypeEnum = PxPruningStructureTypeEnum(PxPruningStructureTypeEnum_eSTATIC_AABB_TREE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNONE.value -> eNONE + eDYNAMIC_AABB_TREE.value -> eDYNAMIC_AABB_TREE + eSTATIC_AABB_TREE.value -> eSTATIC_AABB_TREE + else -> error("Invalid enum value $value for enum PxPruningStructureTypeEnum") + } } } +private fun PxPruningStructureTypeEnum_eNONE(module: JsAny): Int = js("module._emscripten_enum_PxPruningStructureTypeEnum_eNONE()") +private fun PxPruningStructureTypeEnum_eDYNAMIC_AABB_TREE(module: JsAny): Int = js("module._emscripten_enum_PxPruningStructureTypeEnum_eDYNAMIC_AABB_TREE()") +private fun PxPruningStructureTypeEnum_eSTATIC_AABB_TREE(module: JsAny): Int = js("module._emscripten_enum_PxPruningStructureTypeEnum_eSTATIC_AABB_TREE()") + value class PxSolverTypeEnum private constructor(val value: Int) { companion object { - val ePGS: PxSolverTypeEnum = PxSolverTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSolverTypeEnum_ePGS()) - val eTGS: PxSolverTypeEnum = PxSolverTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxSolverTypeEnum_eTGS()) + val ePGS: PxSolverTypeEnum = PxSolverTypeEnum(PxSolverTypeEnum_ePGS(PhysXJsLoader.physXJs)) + val eTGS: PxSolverTypeEnum = PxSolverTypeEnum(PxSolverTypeEnum_eTGS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePGS.value -> ePGS + eTGS.value -> eTGS + else -> error("Invalid enum value $value for enum PxSolverTypeEnum") + } } } +private fun PxSolverTypeEnum_ePGS(module: JsAny): Int = js("module._emscripten_enum_PxSolverTypeEnum_ePGS()") +private fun PxSolverTypeEnum_eTGS(module: JsAny): Int = js("module._emscripten_enum_PxSolverTypeEnum_eTGS()") + value class PxTriggerPairFlagEnum private constructor(val value: Int) { companion object { - val eREMOVED_SHAPE_TRIGGER: PxTriggerPairFlagEnum = PxTriggerPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriggerPairFlagEnum_eREMOVED_SHAPE_TRIGGER()) - val eREMOVED_SHAPE_OTHER: PxTriggerPairFlagEnum = PxTriggerPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriggerPairFlagEnum_eREMOVED_SHAPE_OTHER()) - val eNEXT_FREE: PxTriggerPairFlagEnum = PxTriggerPairFlagEnum(PhysXJsLoader.physXJs._emscripten_enum_PxTriggerPairFlagEnum_eNEXT_FREE()) + val eREMOVED_SHAPE_TRIGGER: PxTriggerPairFlagEnum = PxTriggerPairFlagEnum(PxTriggerPairFlagEnum_eREMOVED_SHAPE_TRIGGER(PhysXJsLoader.physXJs)) + val eREMOVED_SHAPE_OTHER: PxTriggerPairFlagEnum = PxTriggerPairFlagEnum(PxTriggerPairFlagEnum_eREMOVED_SHAPE_OTHER(PhysXJsLoader.physXJs)) + val eNEXT_FREE: PxTriggerPairFlagEnum = PxTriggerPairFlagEnum(PxTriggerPairFlagEnum_eNEXT_FREE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eREMOVED_SHAPE_TRIGGER.value -> eREMOVED_SHAPE_TRIGGER + eREMOVED_SHAPE_OTHER.value -> eREMOVED_SHAPE_OTHER + eNEXT_FREE.value -> eNEXT_FREE + else -> error("Invalid enum value $value for enum PxTriggerPairFlagEnum") + } } } +private fun PxTriggerPairFlagEnum_eREMOVED_SHAPE_TRIGGER(module: JsAny): Int = js("module._emscripten_enum_PxTriggerPairFlagEnum_eREMOVED_SHAPE_TRIGGER()") +private fun PxTriggerPairFlagEnum_eREMOVED_SHAPE_OTHER(module: JsAny): Int = js("module._emscripten_enum_PxTriggerPairFlagEnum_eREMOVED_SHAPE_OTHER()") +private fun PxTriggerPairFlagEnum_eNEXT_FREE(module: JsAny): Int = js("module._emscripten_enum_PxTriggerPairFlagEnum_eNEXT_FREE()") + diff --git a/kool-physics/src/webMain/kotlin/physx/Support.kt b/kool-physics/src/webMain/kotlin/physx/Support.kt new file mode 100644 index 000000000..06eeba1df --- /dev/null +++ b/kool-physics/src/webMain/kotlin/physx/Support.kt @@ -0,0 +1,1768 @@ +/* + * Generated from WebIDL by webidl-util + */ +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") + +package physx + +import kotlin.js.JsAny +import kotlin.js.js + +external interface SupportFunctions : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param actor WebIDL type: [PxRigidActor] (Ref) + * @param index WebIDL type: long + * @return WebIDL type: [PxShape] + */ + fun PxActor_getShape(actor: PxRigidActor, index: Int): PxShape + + /** + * @param scene WebIDL type: [PxScene] + * @return WebIDL type: [PxArray_PxActorPtr] (Ref) + */ + fun PxScene_getActiveActors(scene: PxScene): PxArray_PxActorPtr + + /** + * @param articulation WebIDL type: [PxArticulationReducedCoordinate] + * @return WebIDL type: unsigned long + */ + fun PxArticulationReducedCoordinate_getMinSolverPositionIterations(articulation: PxArticulationReducedCoordinate): Int + + /** + * @param articulation WebIDL type: [PxArticulationReducedCoordinate] + * @return WebIDL type: unsigned long + */ + fun PxArticulationReducedCoordinate_getMinSolverVelocityIterations(articulation: PxArticulationReducedCoordinate): Int + +} + +fun SupportFunctionsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): SupportFunctions = js("_module.wrapPointer(ptr, _module.SupportFunctions)") + +external interface PxU8Ptr : JsAny, DestroyableNative, PxU8ConstPtr + +fun PxU8PtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxU8Ptr = js("_module.wrapPointer(ptr, _module.PxU8Ptr)") + +external interface PxU8ConstPtr : JsAny, DestroyableNative + +fun PxU8ConstPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxU8ConstPtr = js("_module.wrapPointer(ptr, _module.PxU8ConstPtr)") + +external interface PxU16Ptr : JsAny, DestroyableNative, PxU16ConstPtr + +fun PxU16PtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxU16Ptr = js("_module.wrapPointer(ptr, _module.PxU16Ptr)") + +external interface PxU16ConstPtr : JsAny, DestroyableNative + +fun PxU16ConstPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxU16ConstPtr = js("_module.wrapPointer(ptr, _module.PxU16ConstPtr)") + +external interface PxU32Ptr : JsAny, DestroyableNative, PxU32ConstPtr + +fun PxU32PtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxU32Ptr = js("_module.wrapPointer(ptr, _module.PxU32Ptr)") + +external interface PxU32ConstPtr : JsAny, DestroyableNative + +fun PxU32ConstPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxU32ConstPtr = js("_module.wrapPointer(ptr, _module.PxU32ConstPtr)") + +external interface PxI32Ptr : JsAny, DestroyableNative, PxI32ConstPtr + +fun PxI32PtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxI32Ptr = js("_module.wrapPointer(ptr, _module.PxI32Ptr)") + +external interface PxI32ConstPtr : JsAny, DestroyableNative + +fun PxI32ConstPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxI32ConstPtr = js("_module.wrapPointer(ptr, _module.PxI32ConstPtr)") + +external interface PxRealPtr : JsAny, DestroyableNative, PxRealConstPtr + +fun PxRealPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRealPtr = js("_module.wrapPointer(ptr, _module.PxRealPtr)") + +external interface PxRealConstPtr : JsAny, DestroyableNative + +fun PxRealConstPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxRealConstPtr = js("_module.wrapPointer(ptr, _module.PxRealConstPtr)") + +external interface PxActorPtr : JsAny, DestroyableNative + +fun PxActorPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxActorPtr = js("_module.wrapPointer(ptr, _module.PxActorPtr)") + +external interface PxMaterialPtr : JsAny, DestroyableNative + +fun PxMaterialPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMaterialPtr = js("_module.wrapPointer(ptr, _module.PxMaterialPtr)") + +external interface PxMaterialConstPtr : JsAny, DestroyableNative + +fun PxMaterialConstPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxMaterialConstPtr = js("_module.wrapPointer(ptr, _module.PxMaterialConstPtr)") + +external interface PxShapePtr : JsAny, DestroyableNative + +fun PxShapePtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxShapePtr = js("_module.wrapPointer(ptr, _module.PxShapePtr)") + +external interface NativeArrayHelpers : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param base WebIDL type: [PxU8ConstPtr] (Ref) + * @param index WebIDL type: long + * @return WebIDL type: octet + */ + fun getU8At(base: PxU8ConstPtr, index: Int): Byte + + /** + * @param base WebIDL type: [PxU16ConstPtr] (Ref) + * @param index WebIDL type: long + * @return WebIDL type: unsigned short + */ + fun getU16At(base: PxU16ConstPtr, index: Int): Short + + /** + * @param base WebIDL type: [PxU32ConstPtr] (Ref) + * @param index WebIDL type: long + * @return WebIDL type: unsigned long + */ + fun getU32At(base: PxU32ConstPtr, index: Int): Int + + /** + * @param base WebIDL type: [PxRealPtr] (Ref) + * @param index WebIDL type: long + * @return WebIDL type: float + */ + fun getRealAt(base: PxRealPtr, index: Int): Float + + /** + * @param base WebIDL type: VoidPtr + * @param index WebIDL type: long + * @param value WebIDL type: octet + */ + fun setU8At(base: JsAny, index: Int, value: Byte) + + /** + * @param base WebIDL type: VoidPtr + * @param index WebIDL type: long + * @param value WebIDL type: unsigned short + */ + fun setU16At(base: JsAny, index: Int, value: Short) + + /** + * @param base WebIDL type: VoidPtr + * @param index WebIDL type: long + * @param value WebIDL type: unsigned long + */ + fun setU32At(base: JsAny, index: Int, value: Int) + + /** + * @param base WebIDL type: VoidPtr + * @param index WebIDL type: long + * @param value WebIDL type: float + */ + fun setRealAt(base: JsAny, index: Int, value: Float) + + /** + * @param voidPtr WebIDL type: VoidPtr + * @return WebIDL type: [PxU8Ptr] (Value) + */ + fun voidToU8Ptr(voidPtr: JsAny): PxU8Ptr + + /** + * @param voidPtr WebIDL type: VoidPtr + * @return WebIDL type: [PxU16Ptr] (Value) + */ + fun voidToU16Ptr(voidPtr: JsAny): PxU16Ptr + + /** + * @param voidPtr WebIDL type: VoidPtr + * @return WebIDL type: [PxU32Ptr] (Value) + */ + fun voidToU32Ptr(voidPtr: JsAny): PxU32Ptr + + /** + * @param voidPtr WebIDL type: VoidPtr + * @return WebIDL type: [PxI32Ptr] (Value) + */ + fun voidToI32Ptr(voidPtr: JsAny): PxI32Ptr + + /** + * @param voidPtr WebIDL type: VoidPtr + * @return WebIDL type: [PxRealPtr] (Value) + */ + fun voidToRealPtr(voidPtr: JsAny): PxRealPtr + + /** + * @param base WebIDL type: [PxActor] + * @param index WebIDL type: long + * @return WebIDL type: [PxActor] + */ + fun getActorAt(base: PxActor, index: Int): PxActor + + /** + * @param base WebIDL type: [PxBounds3] + * @param index WebIDL type: long + * @return WebIDL type: [PxBounds3] + */ + fun getBounds3At(base: PxBounds3, index: Int): PxBounds3 + + /** + * @param base WebIDL type: [PxContactPair] + * @param index WebIDL type: long + * @return WebIDL type: [PxContactPair] + */ + fun getContactPairAt(base: PxContactPair, index: Int): PxContactPair + + /** + * @param base WebIDL type: [PxContactPairHeader] + * @param index WebIDL type: long + * @return WebIDL type: [PxContactPairHeader] + */ + fun getContactPairHeaderAt(base: PxContactPairHeader, index: Int): PxContactPairHeader + + /** + * @param base WebIDL type: [PxController] + * @param index WebIDL type: long + * @return WebIDL type: [PxController] + */ + fun getControllerAt(base: PxController, index: Int): PxController + + /** + * @param base WebIDL type: [PxControllerShapeHit] + * @param index WebIDL type: long + * @return WebIDL type: [PxControllerShapeHit] + */ + fun getControllerShapeHitAt(base: PxControllerShapeHit, index: Int): PxControllerShapeHit + + /** + * @param base WebIDL type: [PxControllersHit] + * @param index WebIDL type: long + * @return WebIDL type: [PxControllersHit] + */ + fun getControllersHitAt(base: PxControllersHit, index: Int): PxControllersHit + + /** + * @param base WebIDL type: [PxControllerObstacleHit] + * @param index WebIDL type: long + * @return WebIDL type: [PxControllerObstacleHit] + */ + fun getControllerObstacleHitAt(base: PxControllerObstacleHit, index: Int): PxControllerObstacleHit + + /** + * @param base WebIDL type: [PxDebugPoint] + * @param index WebIDL type: long + * @return WebIDL type: [PxDebugPoint] + */ + fun getDebugPointAt(base: PxDebugPoint, index: Int): PxDebugPoint + + /** + * @param base WebIDL type: [PxDebugLine] + * @param index WebIDL type: long + * @return WebIDL type: [PxDebugLine] + */ + fun getDebugLineAt(base: PxDebugLine, index: Int): PxDebugLine + + /** + * @param base WebIDL type: [PxDebugTriangle] + * @param index WebIDL type: long + * @return WebIDL type: [PxDebugTriangle] + */ + fun getDebugTriangleAt(base: PxDebugTriangle, index: Int): PxDebugTriangle + + /** + * @param base WebIDL type: [PxObstacle] + * @param index WebIDL type: long + * @return WebIDL type: [PxObstacle] + */ + fun getObstacleAt(base: PxObstacle, index: Int): PxObstacle + + /** + * @param base WebIDL type: [PxShape] + * @param index WebIDL type: long + * @return WebIDL type: [PxShape] + */ + fun getShapeAt(base: PxShape, index: Int): PxShape + + /** + * @param base WebIDL type: [PxTriggerPair] + * @param index WebIDL type: long + * @return WebIDL type: [PxTriggerPair] + */ + fun getTriggerPairAt(base: PxTriggerPair, index: Int): PxTriggerPair + + /** + * @param base WebIDL type: [PxVec3] + * @param index WebIDL type: long + * @return WebIDL type: [PxVec3] + */ + fun getVec3At(base: PxVec3, index: Int): PxVec3 + +} + +fun NativeArrayHelpersFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): NativeArrayHelpers = js("_module.wrapPointer(ptr, _module.NativeArrayHelpers)") + +external interface PxArray_PxMaterialConst : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxMaterial] (Const) + */ + fun get(index: Int): PxMaterial + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxMaterialConstPtr] (Const, Ref) + */ + fun set(index: Int, value: PxMaterialConstPtr) + + /** + * @return WebIDL type: [PxMaterialConstPtr] + */ + fun begin(): PxMaterialConstPtr + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxMaterial] (Const) + */ + fun pushBack(value: PxMaterial) + + fun clear() + +} + +fun PxArray_PxMaterialConst(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxMaterialConst = js("new _module.PxArray_PxMaterialConst()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxMaterialConst(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxMaterialConst = js("new _module.PxArray_PxMaterialConst(size)") + +fun PxArray_PxMaterialConstFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxMaterialConst = js("_module.wrapPointer(ptr, _module.PxArray_PxMaterialConst)") + +external interface PxArray_PxHeightFieldSample : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxHeightFieldSample] (Ref) + */ + fun get(index: Int): PxHeightFieldSample + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxHeightFieldSample] (Const, Ref) + */ + fun set(index: Int, value: PxHeightFieldSample) + + /** + * @return WebIDL type: [PxHeightFieldSample] + */ + fun begin(): PxHeightFieldSample + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxHeightFieldSample] (Ref) + */ + fun pushBack(value: PxHeightFieldSample) + + fun clear() + +} + +fun PxArray_PxHeightFieldSample(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxHeightFieldSample = js("new _module.PxArray_PxHeightFieldSample()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxHeightFieldSample(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxHeightFieldSample = js("new _module.PxArray_PxHeightFieldSample(size)") + +fun PxArray_PxHeightFieldSampleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxHeightFieldSample = js("_module.wrapPointer(ptr, _module.PxArray_PxHeightFieldSample)") + +external interface PxArray_PxReal : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: float + */ + fun get(index: Int): Float + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: float + */ + fun set(index: Int, value: Float) + + /** + * @return WebIDL type: VoidPtr + */ + fun begin(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: float + */ + fun pushBack(value: Float) + + fun clear() + +} + +fun PxArray_PxReal(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxReal = js("new _module.PxArray_PxReal()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxReal(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxReal = js("new _module.PxArray_PxReal(size)") + +fun PxArray_PxRealFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxReal = js("_module.wrapPointer(ptr, _module.PxArray_PxReal)") + +external interface PxArray_PxU8 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: octet + */ + fun get(index: Int): Byte + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: octet + */ + fun set(index: Int, value: Byte) + + /** + * @return WebIDL type: VoidPtr + */ + fun begin(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: octet + */ + fun pushBack(value: Byte) + + /** + * @param buffer WebIDL type: VoidPtr + * @param size WebIDL type: unsigned long + */ + fun setFromBuffer(buffer: JsAny, size: Int) + + fun clear() + +} + +fun PxArray_PxU8(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU8 = js("new _module.PxArray_PxU8()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxU8(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU8 = js("new _module.PxArray_PxU8(size)") + +fun PxArray_PxU8FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU8 = js("_module.wrapPointer(ptr, _module.PxArray_PxU8)") + +external interface PxArray_PxU16 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: unsigned short + */ + fun get(index: Int): Short + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: unsigned short + */ + fun set(index: Int, value: Short) + + /** + * @return WebIDL type: VoidPtr + */ + fun begin(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: unsigned short + */ + fun pushBack(value: Short) + + fun clear() + +} + +fun PxArray_PxU16(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU16 = js("new _module.PxArray_PxU16()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxU16(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU16 = js("new _module.PxArray_PxU16(size)") + +fun PxArray_PxU16FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU16 = js("_module.wrapPointer(ptr, _module.PxArray_PxU16)") + +external interface PxArray_PxU32 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: unsigned long + */ + fun get(index: Int): Int + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: unsigned long + */ + fun set(index: Int, value: Int) + + /** + * @return WebIDL type: VoidPtr + */ + fun begin(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: unsigned long + */ + fun pushBack(value: Int) + + fun clear() + +} + +fun PxArray_PxU32(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU32 = js("new _module.PxArray_PxU32()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxU32(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU32 = js("new _module.PxArray_PxU32(size)") + +fun PxArray_PxU32FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxU32 = js("_module.wrapPointer(ptr, _module.PxArray_PxU32)") + +external interface PxArray_PxVec3 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxVec3] (Ref) + */ + fun get(index: Int): PxVec3 + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxVec3] (Const, Ref) + */ + fun set(index: Int, value: PxVec3) + + /** + * @return WebIDL type: [PxVec3] + */ + fun begin(): PxVec3 + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxVec3] (Ref) + */ + fun pushBack(value: PxVec3) + + fun clear() + +} + +fun PxArray_PxVec3(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxVec3 = js("new _module.PxArray_PxVec3()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxVec3(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxVec3 = js("new _module.PxArray_PxVec3(size)") + +fun PxArray_PxVec3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxVec3 = js("_module.wrapPointer(ptr, _module.PxArray_PxVec3)") + +external interface PxArray_PxVec4 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxVec4] (Ref) + */ + fun get(index: Int): PxVec4 + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxVec4] (Const, Ref) + */ + fun set(index: Int, value: PxVec4) + + /** + * @return WebIDL type: [PxVec4] + */ + fun begin(): PxVec4 + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxVec4] (Ref) + */ + fun pushBack(value: PxVec4) + + fun clear() + +} + +fun PxArray_PxVec4(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxVec4 = js("new _module.PxArray_PxVec4()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxVec4(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxVec4 = js("new _module.PxArray_PxVec4(size)") + +fun PxArray_PxVec4FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxVec4 = js("_module.wrapPointer(ptr, _module.PxArray_PxVec4)") + +external interface PxArray_PxActorPtr : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxActor] + */ + fun get(index: Int): PxActor + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxActorPtr] (Const, Ref) + */ + fun set(index: Int, value: PxActorPtr) + + /** + * @return WebIDL type: [PxActorPtr] + */ + fun begin(): PxActorPtr + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxActor] + */ + fun pushBack(value: PxActor) + + fun clear() + +} + +fun PxArray_PxActorPtr(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxActorPtr = js("new _module.PxArray_PxActorPtr()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxActorPtr(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxActorPtr = js("new _module.PxArray_PxActorPtr(size)") + +fun PxArray_PxActorPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxActorPtr = js("_module.wrapPointer(ptr, _module.PxArray_PxActorPtr)") + +external interface PxArray_PxContactPairPoint : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxContactPairPoint] (Ref) + */ + fun get(index: Int): PxContactPairPoint + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxContactPairPoint] (Const, Ref) + */ + fun set(index: Int, value: PxContactPairPoint) + + /** + * @return WebIDL type: [PxContactPairPoint] + */ + fun begin(): PxContactPairPoint + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxContactPairPoint] (Ref) + */ + fun pushBack(value: PxContactPairPoint) + + fun clear() + +} + +fun PxArray_PxContactPairPoint(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxContactPairPoint = js("new _module.PxArray_PxContactPairPoint()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxContactPairPoint(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxContactPairPoint = js("new _module.PxArray_PxContactPairPoint(size)") + +fun PxArray_PxContactPairPointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxContactPairPoint = js("_module.wrapPointer(ptr, _module.PxArray_PxContactPairPoint)") + +external interface PxArray_PxRaycastHit : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxRaycastHit] (Ref) + */ + fun get(index: Int): PxRaycastHit + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxRaycastHit] (Const, Ref) + */ + fun set(index: Int, value: PxRaycastHit) + + /** + * @return WebIDL type: [PxRaycastHit] + */ + fun begin(): PxRaycastHit + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxRaycastHit] (Ref) + */ + fun pushBack(value: PxRaycastHit) + + fun clear() + +} + +fun PxArray_PxRaycastHit(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxRaycastHit = js("new _module.PxArray_PxRaycastHit()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxRaycastHit(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxRaycastHit = js("new _module.PxArray_PxRaycastHit(size)") + +fun PxArray_PxRaycastHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxRaycastHit = js("_module.wrapPointer(ptr, _module.PxArray_PxRaycastHit)") + +external interface PxArray_PxSweepHit : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxSweepHit] (Ref) + */ + fun get(index: Int): PxSweepHit + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxSweepHit] (Const, Ref) + */ + fun set(index: Int, value: PxSweepHit) + + /** + * @return WebIDL type: [PxSweepHit] + */ + fun begin(): PxSweepHit + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxSweepHit] (Ref) + */ + fun pushBack(value: PxSweepHit) + + fun clear() + +} + +fun PxArray_PxSweepHit(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxSweepHit = js("new _module.PxArray_PxSweepHit()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxSweepHit(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxSweepHit = js("new _module.PxArray_PxSweepHit(size)") + +fun PxArray_PxSweepHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxSweepHit = js("_module.wrapPointer(ptr, _module.PxArray_PxSweepHit)") + +external interface Vector_PxMaterialConst : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxMaterial] (Const) + */ + fun at(index: Int): PxMaterial + + /** + * @return WebIDL type: [PxMaterialConstPtr] + */ + fun data(): PxMaterialConstPtr + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxMaterial] (Const) + */ + fun push_back(value: PxMaterial) + + fun clear() + +} + +fun Vector_PxMaterialConst(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxMaterialConst = js("new _module.Vector_PxMaterialConst()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxMaterialConst(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxMaterialConst = js("new _module.Vector_PxMaterialConst(size)") + +fun Vector_PxMaterialConstFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxMaterialConst = js("_module.wrapPointer(ptr, _module.Vector_PxMaterialConst)") + +external interface Vector_PxHeightFieldSample : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxHeightFieldSample] (Ref) + */ + fun at(index: Int): PxHeightFieldSample + + /** + * @return WebIDL type: [PxHeightFieldSample] + */ + fun data(): PxHeightFieldSample + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxHeightFieldSample] (Ref) + */ + fun push_back(value: PxHeightFieldSample) + + fun clear() + +} + +fun Vector_PxHeightFieldSample(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxHeightFieldSample = js("new _module.Vector_PxHeightFieldSample()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxHeightFieldSample(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxHeightFieldSample = js("new _module.Vector_PxHeightFieldSample(size)") + +fun Vector_PxHeightFieldSampleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxHeightFieldSample = js("_module.wrapPointer(ptr, _module.Vector_PxHeightFieldSample)") + +external interface PxArray_PxShapePtr : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxShape] + */ + fun get(index: Int): PxShape + + /** + * @param index WebIDL type: unsigned long + * @param value WebIDL type: [PxShapePtr] (Const, Ref) + */ + fun set(index: Int, value: PxShapePtr) + + /** + * @return WebIDL type: [PxShapePtr] + */ + fun begin(): PxShapePtr + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxShape] + */ + fun pushBack(value: PxShape) + + fun clear() + +} + +fun PxArray_PxShapePtr(_module: JsAny = PhysXJsLoader.physXJs): PxArray_PxShapePtr = js("new _module.PxArray_PxShapePtr()") + +/** + * @param size WebIDL type: unsigned long + */ +fun PxArray_PxShapePtr(size: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxShapePtr = js("new _module.PxArray_PxShapePtr(size)") + +fun PxArray_PxShapePtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxArray_PxShapePtr = js("_module.wrapPointer(ptr, _module.PxArray_PxShapePtr)") + +external interface Vector_PxReal : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: float + */ + fun at(index: Int): Float + + /** + * @return WebIDL type: VoidPtr + */ + fun data(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: float + */ + fun push_back(value: Float) + + fun clear() + +} + +fun Vector_PxReal(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxReal = js("new _module.Vector_PxReal()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxReal(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxReal = js("new _module.Vector_PxReal(size)") + +fun Vector_PxRealFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxReal = js("_module.wrapPointer(ptr, _module.Vector_PxReal)") + +external interface Vector_PxU8 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: octet + */ + fun at(index: Int): Byte + + /** + * @return WebIDL type: VoidPtr + */ + fun data(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: octet + */ + fun push_back(value: Byte) + + fun clear() + +} + +fun Vector_PxU8(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxU8 = js("new _module.Vector_PxU8()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxU8(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxU8 = js("new _module.Vector_PxU8(size)") + +fun Vector_PxU8FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxU8 = js("_module.wrapPointer(ptr, _module.Vector_PxU8)") + +external interface Vector_PxU16 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: unsigned short + */ + fun at(index: Int): Short + + /** + * @return WebIDL type: VoidPtr + */ + fun data(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: unsigned short + */ + fun push_back(value: Short) + + fun clear() + +} + +fun Vector_PxU16(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxU16 = js("new _module.Vector_PxU16()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxU16(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxU16 = js("new _module.Vector_PxU16(size)") + +fun Vector_PxU16FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxU16 = js("_module.wrapPointer(ptr, _module.Vector_PxU16)") + +external interface Vector_PxU32 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: unsigned long + */ + fun at(index: Int): Int + + /** + * @return WebIDL type: VoidPtr + */ + fun data(): JsAny + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: unsigned long + */ + fun push_back(value: Int) + + fun clear() + +} + +fun Vector_PxU32(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxU32 = js("new _module.Vector_PxU32()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxU32(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxU32 = js("new _module.Vector_PxU32(size)") + +fun Vector_PxU32FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxU32 = js("_module.wrapPointer(ptr, _module.Vector_PxU32)") + +external interface Vector_PxVec3 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxVec3] (Ref) + */ + fun at(index: Int): PxVec3 + + /** + * @return WebIDL type: [PxVec3] + */ + fun data(): PxVec3 + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxVec3] (Ref) + */ + fun push_back(value: PxVec3) + + fun clear() + +} + +fun Vector_PxVec3(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxVec3 = js("new _module.Vector_PxVec3()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxVec3(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxVec3 = js("new _module.Vector_PxVec3(size)") + +fun Vector_PxVec3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxVec3 = js("_module.wrapPointer(ptr, _module.Vector_PxVec3)") + +external interface Vector_PxVec4 : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxVec4] (Ref) + */ + fun at(index: Int): PxVec4 + + /** + * @return WebIDL type: [PxVec4] + */ + fun data(): PxVec4 + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxVec4] (Ref) + */ + fun push_back(value: PxVec4) + + fun clear() + +} + +fun Vector_PxVec4(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxVec4 = js("new _module.Vector_PxVec4()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxVec4(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxVec4 = js("new _module.Vector_PxVec4(size)") + +fun Vector_PxVec4FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxVec4 = js("_module.wrapPointer(ptr, _module.Vector_PxVec4)") + +external interface Vector_PxActorPtr : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxActor] + */ + fun at(index: Int): PxActor + + /** + * @return WebIDL type: [PxActorPtr] + */ + fun data(): PxActorPtr + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxActor] + */ + fun push_back(value: PxActor) + + fun clear() + +} + +fun Vector_PxActorPtr(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxActorPtr = js("new _module.Vector_PxActorPtr()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxActorPtr(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxActorPtr = js("new _module.Vector_PxActorPtr(size)") + +fun Vector_PxActorPtrFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxActorPtr = js("_module.wrapPointer(ptr, _module.Vector_PxActorPtr)") + +external interface Vector_PxContactPairPoint : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxContactPairPoint] (Ref) + */ + fun at(index: Int): PxContactPairPoint + + /** + * @return WebIDL type: [PxContactPairPoint] + */ + fun data(): PxContactPairPoint + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxContactPairPoint] (Ref) + */ + fun push_back(value: PxContactPairPoint) + + fun clear() + +} + +fun Vector_PxContactPairPoint(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxContactPairPoint = js("new _module.Vector_PxContactPairPoint()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxContactPairPoint(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxContactPairPoint = js("new _module.Vector_PxContactPairPoint(size)") + +fun Vector_PxContactPairPointFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxContactPairPoint = js("_module.wrapPointer(ptr, _module.Vector_PxContactPairPoint)") + +external interface Vector_PxRaycastHit : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxRaycastHit] (Ref) + */ + fun at(index: Int): PxRaycastHit + + /** + * @return WebIDL type: [PxRaycastHit] + */ + fun data(): PxRaycastHit + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxRaycastHit] (Ref) + */ + fun push_back(value: PxRaycastHit) + + fun clear() + +} + +fun Vector_PxRaycastHit(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxRaycastHit = js("new _module.Vector_PxRaycastHit()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxRaycastHit(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxRaycastHit = js("new _module.Vector_PxRaycastHit(size)") + +fun Vector_PxRaycastHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxRaycastHit = js("_module.wrapPointer(ptr, _module.Vector_PxRaycastHit)") + +external interface Vector_PxSweepHit : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param index WebIDL type: unsigned long + * @return WebIDL type: [PxSweepHit] (Ref) + */ + fun at(index: Int): PxSweepHit + + /** + * @return WebIDL type: [PxSweepHit] + */ + fun data(): PxSweepHit + + /** + * @return WebIDL type: unsigned long + */ + fun size(): Int + + /** + * @param value WebIDL type: [PxSweepHit] (Ref) + */ + fun push_back(value: PxSweepHit) + + fun clear() + +} + +fun Vector_PxSweepHit(_module: JsAny = PhysXJsLoader.physXJs): Vector_PxSweepHit = js("new _module.Vector_PxSweepHit()") + +/** + * @param size WebIDL type: unsigned long + */ +fun Vector_PxSweepHit(size: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxSweepHit = js("new _module.Vector_PxSweepHit(size)") + +fun Vector_PxSweepHitFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): Vector_PxSweepHit = js("_module.wrapPointer(ptr, _module.Vector_PxSweepHit)") + +external interface PassThroughFilterShader : JsAny, DestroyableNative, PxSimulationFilterShader { + /** + * WebIDL type: unsigned long + */ + var outputPairFlags: Int + + /** + * @param attributes0 WebIDL type: unsigned long + * @param filterData0w0 WebIDL type: unsigned long + * @param filterData0w1 WebIDL type: unsigned long + * @param filterData0w2 WebIDL type: unsigned long + * @param filterData0w3 WebIDL type: unsigned long + * @param attributes1 WebIDL type: unsigned long + * @param filterData1w0 WebIDL type: unsigned long + * @param filterData1w1 WebIDL type: unsigned long + * @param filterData1w2 WebIDL type: unsigned long + * @param filterData1w3 WebIDL type: unsigned long + * @return WebIDL type: unsigned long + */ + fun filterShader(attributes0: Int, filterData0w0: Int, filterData0w1: Int, filterData0w2: Int, filterData0w3: Int, attributes1: Int, filterData1w0: Int, filterData1w1: Int, filterData1w2: Int, filterData1w3: Int): Int + +} + +fun PassThroughFilterShaderFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PassThroughFilterShader = js("_module.wrapPointer(ptr, _module.PassThroughFilterShader)") + +external interface PassThroughFilterShaderImpl : PassThroughFilterShader { + /** + * param attributes0 WebIDL type: unsigned long + * param filterData0w0 WebIDL type: unsigned long + * param filterData0w1 WebIDL type: unsigned long + * param filterData0w2 WebIDL type: unsigned long + * param filterData0w3 WebIDL type: unsigned long + * param attributes1 WebIDL type: unsigned long + * param filterData1w0 WebIDL type: unsigned long + * param filterData1w1 WebIDL type: unsigned long + * param filterData1w2 WebIDL type: unsigned long + * param filterData1w3 WebIDL type: unsigned long + * return WebIDL type: unsigned long + */ + var filterShader: (attributes0: Int, filterData0w0: Int, filterData0w1: Int, filterData0w2: Int, filterData0w3: Int, attributes1: Int, filterData1w0: Int, filterData1w1: Int, filterData1w2: Int, filterData1w3: Int) -> Int + +} + +fun PassThroughFilterShaderImpl(_module: JsAny = PhysXJsLoader.physXJs): PassThroughFilterShaderImpl = js("new _module.PassThroughFilterShaderImpl()") + +external interface PxPvd : JsAny { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param transport WebIDL type: [PxPvdTransport] (Ref) + * @param flags WebIDL type: [PxPvdInstrumentationFlags] (Ref) + * @return WebIDL type: boolean + */ + fun connect(transport: PxPvdTransport, flags: PxPvdInstrumentationFlags): Boolean + + fun release() + +} + +fun PxPvdFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPvd = js("_module.wrapPointer(ptr, _module.PxPvd)") + +external interface PxPvdTransport : JsAny { + /** + * Native object address. + */ + val ptr: Int + + /** + * @return WebIDL type: boolean + */ + fun connect(): Boolean + + /** + * @return WebIDL type: boolean + */ + fun isConnected(): Boolean + + fun disconnect() + + fun release() + + fun flush() + +} + +fun PxPvdTransportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPvdTransport = js("_module.wrapPointer(ptr, _module.PxPvdTransport)") + +external interface SimplePvdTransport : JsAny, DestroyableNative, PxPvdTransport { + /** + * @param inBytes WebIDL type: any + * @param inLength WebIDL type: unsigned long + */ + fun send(inBytes: Int, inLength: Int) + +} + +fun SimplePvdTransportFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): SimplePvdTransport = js("_module.wrapPointer(ptr, _module.SimplePvdTransport)") + +external interface SimplPvdTransportImpl : SimplePvdTransport { + /** + * return WebIDL type: boolean + */ + var connect: () -> Boolean + + /** + * return WebIDL type: boolean + */ + var isConnected: () -> Boolean + + var disconnect: () -> Unit + + /** + * param inBytes WebIDL type: any + * param inLength WebIDL type: unsigned long + */ + var send: (inBytes: Int, inLength: Int) -> Unit + + var flush: () -> Unit + +} + +fun SimplPvdTransportImpl(_module: JsAny = PhysXJsLoader.physXJs): SimplPvdTransportImpl = js("new _module.SimplPvdTransportImpl()") + +external interface PxPvdInstrumentationFlags : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param flag WebIDL type: [PxPvdInstrumentationFlagEnum] (enum) + * @return WebIDL type: boolean + */ + fun isSet(flag: Int): Boolean + + /** + * @param flag WebIDL type: [PxPvdInstrumentationFlagEnum] (enum) + */ + fun raise(flag: Int) + + /** + * @param flag WebIDL type: [PxPvdInstrumentationFlagEnum] (enum) + */ + fun clear(flag: Int) + +} + +/** + * @param flags WebIDL type: octet + */ +fun PxPvdInstrumentationFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxPvdInstrumentationFlags = js("new _module.PxPvdInstrumentationFlags(flags)") + +fun PxPvdInstrumentationFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPvdInstrumentationFlags = js("_module.wrapPointer(ptr, _module.PxPvdInstrumentationFlags)") + +fun PxPvdInstrumentationFlags.isSet(flag: PxPvdInstrumentationFlagEnum) = isSet(flag.value) +fun PxPvdInstrumentationFlags.raise(flag: PxPvdInstrumentationFlagEnum) = raise(flag.value) +fun PxPvdInstrumentationFlags.clear(flag: PxPvdInstrumentationFlagEnum) = clear(flag.value) + +external interface PxPvdSceneClient : JsAny { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) + * @param value WebIDL type: boolean + */ + fun setScenePvdFlag(flag: Int, value: Boolean) + + /** + * @param flags WebIDL type: [PxPvdSceneFlags] (Ref) + */ + fun setScenePvdFlags(flags: PxPvdSceneFlags) + + /** + * @return WebIDL type: [PxPvdSceneFlags] (Value) + */ + fun getScenePvdFlags(): PxPvdSceneFlags + + /** + * @param name WebIDL type: DOMString + * @param origin WebIDL type: [PxVec3] (Const, Ref) + * @param up WebIDL type: [PxVec3] (Const, Ref) + * @param target WebIDL type: [PxVec3] (Const, Ref) + */ + fun updateCamera(name: String, origin: PxVec3, up: PxVec3, target: PxVec3) + +} + +fun PxPvdSceneClientFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPvdSceneClient = js("_module.wrapPointer(ptr, _module.PxPvdSceneClient)") + +var PxPvdSceneClient.scenePvdFlags + get() = getScenePvdFlags() + set(value) { setScenePvdFlags(value) } + +fun PxPvdSceneClient.setScenePvdFlag(flag: PxPvdSceneFlagEnum, value: Boolean) = setScenePvdFlag(flag.value, value) + +external interface PxPvdSceneFlags : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) + * @return WebIDL type: boolean + */ + fun isSet(flag: Int): Boolean + + /** + * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) + */ + fun raise(flag: Int) + + /** + * @param flag WebIDL type: [PxPvdSceneFlagEnum] (enum) + */ + fun clear(flag: Int) + +} + +/** + * @param flags WebIDL type: octet + */ +fun PxPvdSceneFlags(flags: Byte, _module: JsAny = PhysXJsLoader.physXJs): PxPvdSceneFlags = js("new _module.PxPvdSceneFlags(flags)") + +fun PxPvdSceneFlagsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxPvdSceneFlags = js("_module.wrapPointer(ptr, _module.PxPvdSceneFlags)") + +fun PxPvdSceneFlags.isSet(flag: PxPvdSceneFlagEnum) = isSet(flag.value) +fun PxPvdSceneFlags.raise(flag: PxPvdSceneFlagEnum) = raise(flag.value) +fun PxPvdSceneFlags.clear(flag: PxPvdSceneFlagEnum) = clear(flag.value) + +external interface PxOmniPvd : JsAny, DestroyableNative { + /** + * Native object address. + */ + val ptr: Int + + /** + * @return WebIDL type: boolean + */ + fun startSampling(): Boolean + + fun release() + +} + +fun PxOmniPvdFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxOmniPvd = js("_module.wrapPointer(ptr, _module.PxOmniPvd)") + +value class PxVisualizationParameterEnum private constructor(val value: Int) { + companion object { + val eSCALE: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eSCALE(PhysXJsLoader.physXJs)) + val eWORLD_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eWORLD_AXES(PhysXJsLoader.physXJs)) + val eBODY_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eBODY_AXES(PhysXJsLoader.physXJs)) + val eBODY_MASS_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eBODY_MASS_AXES(PhysXJsLoader.physXJs)) + val eBODY_LIN_VELOCITY: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eBODY_LIN_VELOCITY(PhysXJsLoader.physXJs)) + val eBODY_ANG_VELOCITY: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eBODY_ANG_VELOCITY(PhysXJsLoader.physXJs)) + val eCONTACT_POINT: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCONTACT_POINT(PhysXJsLoader.physXJs)) + val eCONTACT_NORMAL: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCONTACT_NORMAL(PhysXJsLoader.physXJs)) + val eCONTACT_ERROR: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCONTACT_ERROR(PhysXJsLoader.physXJs)) + val eCONTACT_FORCE: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCONTACT_FORCE(PhysXJsLoader.physXJs)) + val eACTOR_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eACTOR_AXES(PhysXJsLoader.physXJs)) + val eCOLLISION_AABBS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_AABBS(PhysXJsLoader.physXJs)) + val eCOLLISION_SHAPES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_SHAPES(PhysXJsLoader.physXJs)) + val eCOLLISION_AXES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_AXES(PhysXJsLoader.physXJs)) + val eCOLLISION_COMPOUNDS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_COMPOUNDS(PhysXJsLoader.physXJs)) + val eCOLLISION_FNORMALS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_FNORMALS(PhysXJsLoader.physXJs)) + val eCOLLISION_EDGES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_EDGES(PhysXJsLoader.physXJs)) + val eCOLLISION_STATIC: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_STATIC(PhysXJsLoader.physXJs)) + val eCOLLISION_DYNAMIC: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCOLLISION_DYNAMIC(PhysXJsLoader.physXJs)) + val eJOINT_LOCAL_FRAMES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eJOINT_LOCAL_FRAMES(PhysXJsLoader.physXJs)) + val eJOINT_LIMITS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eJOINT_LIMITS(PhysXJsLoader.physXJs)) + val eCULL_BOX: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eCULL_BOX(PhysXJsLoader.physXJs)) + val eMBP_REGIONS: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eMBP_REGIONS(PhysXJsLoader.physXJs)) + val eSIMULATION_MESH: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eSIMULATION_MESH(PhysXJsLoader.physXJs)) + val eSDF: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eSDF(PhysXJsLoader.physXJs)) + val eNUM_VALUES: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eNUM_VALUES(PhysXJsLoader.physXJs)) + val eFORCE_DWORD: PxVisualizationParameterEnum = PxVisualizationParameterEnum(PxVisualizationParameterEnum_eFORCE_DWORD(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSCALE.value -> eSCALE + eWORLD_AXES.value -> eWORLD_AXES + eBODY_AXES.value -> eBODY_AXES + eBODY_MASS_AXES.value -> eBODY_MASS_AXES + eBODY_LIN_VELOCITY.value -> eBODY_LIN_VELOCITY + eBODY_ANG_VELOCITY.value -> eBODY_ANG_VELOCITY + eCONTACT_POINT.value -> eCONTACT_POINT + eCONTACT_NORMAL.value -> eCONTACT_NORMAL + eCONTACT_ERROR.value -> eCONTACT_ERROR + eCONTACT_FORCE.value -> eCONTACT_FORCE + eACTOR_AXES.value -> eACTOR_AXES + eCOLLISION_AABBS.value -> eCOLLISION_AABBS + eCOLLISION_SHAPES.value -> eCOLLISION_SHAPES + eCOLLISION_AXES.value -> eCOLLISION_AXES + eCOLLISION_COMPOUNDS.value -> eCOLLISION_COMPOUNDS + eCOLLISION_FNORMALS.value -> eCOLLISION_FNORMALS + eCOLLISION_EDGES.value -> eCOLLISION_EDGES + eCOLLISION_STATIC.value -> eCOLLISION_STATIC + eCOLLISION_DYNAMIC.value -> eCOLLISION_DYNAMIC + eJOINT_LOCAL_FRAMES.value -> eJOINT_LOCAL_FRAMES + eJOINT_LIMITS.value -> eJOINT_LIMITS + eCULL_BOX.value -> eCULL_BOX + eMBP_REGIONS.value -> eMBP_REGIONS + eSIMULATION_MESH.value -> eSIMULATION_MESH + eSDF.value -> eSDF + eNUM_VALUES.value -> eNUM_VALUES + eFORCE_DWORD.value -> eFORCE_DWORD + else -> error("Invalid enum value $value for enum PxVisualizationParameterEnum") + } + } +} + +private fun PxVisualizationParameterEnum_eSCALE(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eSCALE()") +private fun PxVisualizationParameterEnum_eWORLD_AXES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eWORLD_AXES()") +private fun PxVisualizationParameterEnum_eBODY_AXES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eBODY_AXES()") +private fun PxVisualizationParameterEnum_eBODY_MASS_AXES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eBODY_MASS_AXES()") +private fun PxVisualizationParameterEnum_eBODY_LIN_VELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eBODY_LIN_VELOCITY()") +private fun PxVisualizationParameterEnum_eBODY_ANG_VELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eBODY_ANG_VELOCITY()") +private fun PxVisualizationParameterEnum_eCONTACT_POINT(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_POINT()") +private fun PxVisualizationParameterEnum_eCONTACT_NORMAL(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_NORMAL()") +private fun PxVisualizationParameterEnum_eCONTACT_ERROR(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_ERROR()") +private fun PxVisualizationParameterEnum_eCONTACT_FORCE(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCONTACT_FORCE()") +private fun PxVisualizationParameterEnum_eACTOR_AXES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eACTOR_AXES()") +private fun PxVisualizationParameterEnum_eCOLLISION_AABBS(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_AABBS()") +private fun PxVisualizationParameterEnum_eCOLLISION_SHAPES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_SHAPES()") +private fun PxVisualizationParameterEnum_eCOLLISION_AXES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_AXES()") +private fun PxVisualizationParameterEnum_eCOLLISION_COMPOUNDS(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_COMPOUNDS()") +private fun PxVisualizationParameterEnum_eCOLLISION_FNORMALS(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_FNORMALS()") +private fun PxVisualizationParameterEnum_eCOLLISION_EDGES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_EDGES()") +private fun PxVisualizationParameterEnum_eCOLLISION_STATIC(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_STATIC()") +private fun PxVisualizationParameterEnum_eCOLLISION_DYNAMIC(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCOLLISION_DYNAMIC()") +private fun PxVisualizationParameterEnum_eJOINT_LOCAL_FRAMES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eJOINT_LOCAL_FRAMES()") +private fun PxVisualizationParameterEnum_eJOINT_LIMITS(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eJOINT_LIMITS()") +private fun PxVisualizationParameterEnum_eCULL_BOX(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eCULL_BOX()") +private fun PxVisualizationParameterEnum_eMBP_REGIONS(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eMBP_REGIONS()") +private fun PxVisualizationParameterEnum_eSIMULATION_MESH(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eSIMULATION_MESH()") +private fun PxVisualizationParameterEnum_eSDF(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eSDF()") +private fun PxVisualizationParameterEnum_eNUM_VALUES(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eNUM_VALUES()") +private fun PxVisualizationParameterEnum_eFORCE_DWORD(module: JsAny): Int = js("module._emscripten_enum_PxVisualizationParameterEnum_eFORCE_DWORD()") + +value class PxPvdInstrumentationFlagEnum private constructor(val value: Int) { + companion object { + val eDEBUG: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PxPvdInstrumentationFlagEnum_eDEBUG(PhysXJsLoader.physXJs)) + val ePROFILE: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PxPvdInstrumentationFlagEnum_ePROFILE(PhysXJsLoader.physXJs)) + val eMEMORY: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PxPvdInstrumentationFlagEnum_eMEMORY(PhysXJsLoader.physXJs)) + val eALL: PxPvdInstrumentationFlagEnum = PxPvdInstrumentationFlagEnum(PxPvdInstrumentationFlagEnum_eALL(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eDEBUG.value -> eDEBUG + ePROFILE.value -> ePROFILE + eMEMORY.value -> eMEMORY + eALL.value -> eALL + else -> error("Invalid enum value $value for enum PxPvdInstrumentationFlagEnum") + } + } +} + +private fun PxPvdInstrumentationFlagEnum_eDEBUG(module: JsAny): Int = js("module._emscripten_enum_PxPvdInstrumentationFlagEnum_eDEBUG()") +private fun PxPvdInstrumentationFlagEnum_ePROFILE(module: JsAny): Int = js("module._emscripten_enum_PxPvdInstrumentationFlagEnum_ePROFILE()") +private fun PxPvdInstrumentationFlagEnum_eMEMORY(module: JsAny): Int = js("module._emscripten_enum_PxPvdInstrumentationFlagEnum_eMEMORY()") +private fun PxPvdInstrumentationFlagEnum_eALL(module: JsAny): Int = js("module._emscripten_enum_PxPvdInstrumentationFlagEnum_eALL()") + +value class PxPvdSceneFlagEnum private constructor(val value: Int) { + companion object { + val eTRANSMIT_CONTACTS: PxPvdSceneFlagEnum = PxPvdSceneFlagEnum(PxPvdSceneFlagEnum_eTRANSMIT_CONTACTS(PhysXJsLoader.physXJs)) + val eTRANSMIT_SCENEQUERIES: PxPvdSceneFlagEnum = PxPvdSceneFlagEnum(PxPvdSceneFlagEnum_eTRANSMIT_SCENEQUERIES(PhysXJsLoader.physXJs)) + val eTRANSMIT_CONSTRAINTS: PxPvdSceneFlagEnum = PxPvdSceneFlagEnum(PxPvdSceneFlagEnum_eTRANSMIT_CONSTRAINTS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eTRANSMIT_CONTACTS.value -> eTRANSMIT_CONTACTS + eTRANSMIT_SCENEQUERIES.value -> eTRANSMIT_SCENEQUERIES + eTRANSMIT_CONSTRAINTS.value -> eTRANSMIT_CONSTRAINTS + else -> error("Invalid enum value $value for enum PxPvdSceneFlagEnum") + } + } +} + +private fun PxPvdSceneFlagEnum_eTRANSMIT_CONTACTS(module: JsAny): Int = js("module._emscripten_enum_PxPvdSceneFlagEnum_eTRANSMIT_CONTACTS()") +private fun PxPvdSceneFlagEnum_eTRANSMIT_SCENEQUERIES(module: JsAny): Int = js("module._emscripten_enum_PxPvdSceneFlagEnum_eTRANSMIT_SCENEQUERIES()") +private fun PxPvdSceneFlagEnum_eTRANSMIT_CONSTRAINTS(module: JsAny): Int = js("module._emscripten_enum_PxPvdSceneFlagEnum_eTRANSMIT_CONSTRAINTS()") + diff --git a/kool-physics/src/jsMain/kotlin/physx/Vehicle2.kt b/kool-physics/src/webMain/kotlin/physx/Vehicle2.kt similarity index 64% rename from kool-physics/src/jsMain/kotlin/physx/Vehicle2.kt rename to kool-physics/src/webMain/kotlin/physx/Vehicle2.kt index 7452afd13..d1ec3620a 100644 --- a/kool-physics/src/jsMain/kotlin/physx/Vehicle2.kt +++ b/kool-physics/src/webMain/kotlin/physx/Vehicle2.kt @@ -1,11 +1,14 @@ /* * Generated from WebIDL by webidl-util */ -@file:Suppress("UnsafeCastFromDynamic", "ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "NOTHING_TO_INLINE") +@file:Suppress("ClassName", "FunctionName", "UNUSED_PARAMETER", "unused", "NOTHING_TO_INLINE") package physx -external interface PxVehicleTopLevelFunctions { +import kotlin.js.JsAny +import kotlin.js.js + +external interface PxVehicleTopLevelFunctions : JsAny { /** * Native object address. */ @@ -32,7 +35,7 @@ external interface PxVehicleTopLevelFunctions { * @param sprungMasses WebIDL type: [PxArray_PxReal] (Ref) * @return WebIDL type: boolean */ - fun VehicleComputeSprungMasses(nbSprungMasses: Int, sprungMassCoordinates: PxArray_PxVec3, totalMass: Float, gravityDirection: PxVehicleAxesEnum, sprungMasses: PxArray_PxReal): Boolean + fun VehicleComputeSprungMasses(nbSprungMasses: Int, sprungMassCoordinates: PxArray_PxVec3, totalMass: Float, gravityDirection: Int, sprungMasses: PxArray_PxReal): Boolean /** * @param vehicleFrame WebIDL type: [PxVehicleFrame] (Const, Ref) @@ -49,9 +52,11 @@ external interface PxVehicleTopLevelFunctions { } -fun PxVehicleTopLevelFunctionsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTopLevelFunctions = js("_module.wrapPointer(ptr, _module.PxVehicleTopLevelFunctions)") +fun PxVehicleTopLevelFunctionsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTopLevelFunctions = js("_module.wrapPointer(ptr, _module.PxVehicleTopLevelFunctions)") + +fun PxVehicleTopLevelFunctions.VehicleComputeSprungMasses(nbSprungMasses: Int, sprungMassCoordinates: PxArray_PxVec3, totalMass: Float, gravityDirection: PxVehicleAxesEnum, sprungMasses: PxArray_PxReal) = VehicleComputeSprungMasses(nbSprungMasses, sprungMassCoordinates, totalMass, gravityDirection.value, sprungMasses) -external interface PxVehicleAckermannParams { +external interface PxVehicleAckermannParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -92,18 +97,14 @@ external interface PxVehicleAckermannParams { } -fun PxVehicleAckermannParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleAckermannParams = js("new _module.PxVehicleAckermannParams()") - -fun PxVehicleAckermannParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleAckermannParams = js("_module.wrapPointer(ptr, _module.PxVehicleAckermannParams)") +fun PxVehicleAckermannParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleAckermannParams = js("new _module.PxVehicleAckermannParams()") -fun PxVehicleAckermannParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleAckermannParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleAckermannParams = js("_module.wrapPointer(ptr, _module.PxVehicleAckermannParams)") inline fun PxVehicleAckermannParams.getWheelIds(index: Int) = get_wheelIds(index) inline fun PxVehicleAckermannParams.setWheelIds(index: Int, value: Int) = set_wheelIds(index, value) -external interface PxVehicleAntiRollForceParams { +external interface PxVehicleAntiRollForceParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -139,15 +140,11 @@ external interface PxVehicleAntiRollForceParams { } -fun PxVehicleAntiRollForceParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleAntiRollForceParams = js("new _module.PxVehicleAntiRollForceParams()") - -fun PxVehicleAntiRollForceParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleAntiRollForceParams = js("_module.wrapPointer(ptr, _module.PxVehicleAntiRollForceParams)") +fun PxVehicleAntiRollForceParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleAntiRollForceParams = js("new _module.PxVehicleAntiRollForceParams()") -fun PxVehicleAntiRollForceParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleAntiRollForceParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleAntiRollForceParams = js("_module.wrapPointer(ptr, _module.PxVehicleAntiRollForceParams)") -external interface PxVehicleAntiRollTorque { +external interface PxVehicleAntiRollTorque : JsAny, DestroyableNative { /** * Native object address. */ @@ -162,15 +159,11 @@ external interface PxVehicleAntiRollTorque { } -fun PxVehicleAntiRollTorque(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleAntiRollTorque = js("new _module.PxVehicleAntiRollTorque()") +fun PxVehicleAntiRollTorque(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleAntiRollTorque = js("new _module.PxVehicleAntiRollTorque()") -fun PxVehicleAntiRollTorqueFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleAntiRollTorque = js("_module.wrapPointer(ptr, _module.PxVehicleAntiRollTorque)") +fun PxVehicleAntiRollTorqueFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleAntiRollTorque = js("_module.wrapPointer(ptr, _module.PxVehicleAntiRollTorque)") -fun PxVehicleAntiRollTorque.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleAutoboxParams { +external interface PxVehicleAutoboxParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -208,20 +201,16 @@ external interface PxVehicleAutoboxParams { } -fun PxVehicleAutoboxParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleAutoboxParams = js("new _module.PxVehicleAutoboxParams()") - -fun PxVehicleAutoboxParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleAutoboxParams = js("_module.wrapPointer(ptr, _module.PxVehicleAutoboxParams)") +fun PxVehicleAutoboxParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleAutoboxParams = js("new _module.PxVehicleAutoboxParams()") -fun PxVehicleAutoboxParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleAutoboxParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleAutoboxParams = js("_module.wrapPointer(ptr, _module.PxVehicleAutoboxParams)") inline fun PxVehicleAutoboxParams.getUpRatios(index: Int) = get_upRatios(index) inline fun PxVehicleAutoboxParams.setUpRatios(index: Int, value: Float) = set_upRatios(index, value) inline fun PxVehicleAutoboxParams.getDownRatios(index: Int) = get_downRatios(index) inline fun PxVehicleAutoboxParams.setDownRatios(index: Int, value: Float) = set_downRatios(index, value) -external interface PxVehicleAutoboxState { +external interface PxVehicleAutoboxState : JsAny, DestroyableNative { /** * Native object address. */ @@ -240,15 +229,11 @@ external interface PxVehicleAutoboxState { } -fun PxVehicleAutoboxState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleAutoboxState = js("new _module.PxVehicleAutoboxState()") - -fun PxVehicleAutoboxStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleAutoboxState = js("_module.wrapPointer(ptr, _module.PxVehicleAutoboxState)") +fun PxVehicleAutoboxState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleAutoboxState = js("new _module.PxVehicleAutoboxState()") -fun PxVehicleAutoboxState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleAutoboxStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleAutoboxState = js("_module.wrapPointer(ptr, _module.PxVehicleAutoboxState)") -external interface PxVehicleAxleDescription { +external interface PxVehicleAxleDescription : JsAny, DestroyableNative { /** * Native object address. */ @@ -306,13 +291,9 @@ external interface PxVehicleAxleDescription { } -fun PxVehicleAxleDescription(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleAxleDescription = js("new _module.PxVehicleAxleDescription()") +fun PxVehicleAxleDescription(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleAxleDescription = js("new _module.PxVehicleAxleDescription()") -fun PxVehicleAxleDescriptionFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleAxleDescription = js("_module.wrapPointer(ptr, _module.PxVehicleAxleDescription)") - -fun PxVehicleAxleDescription.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleAxleDescriptionFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleAxleDescription = js("_module.wrapPointer(ptr, _module.PxVehicleAxleDescription)") inline fun PxVehicleAxleDescription.getNbWheelsPerAxle(index: Int) = get_nbWheelsPerAxle(index) inline fun PxVehicleAxleDescription.setNbWheelsPerAxle(index: Int, value: Int) = set_nbWheelsPerAxle(index, value) @@ -321,7 +302,7 @@ inline fun PxVehicleAxleDescription.setAxleToWheelIds(index: Int, value: Int) = inline fun PxVehicleAxleDescription.getWheelIdsInAxleOrder(index: Int) = get_wheelIdsInAxleOrder(index) inline fun PxVehicleAxleDescription.setWheelIdsInAxleOrder(index: Int, value: Int) = set_wheelIdsInAxleOrder(index, value) -external interface PxVehicleBrakeCommandResponseParams : PxVehicleCommandResponseParams { +external interface PxVehicleBrakeCommandResponseParams : JsAny, DestroyableNative, PxVehicleCommandResponseParams { /** * @param srcFrame WebIDL type: [PxVehicleFrame] (Const, Ref) * @param trgFrame WebIDL type: [PxVehicleFrame] (Const, Ref) @@ -339,15 +320,11 @@ external interface PxVehicleBrakeCommandResponseParams : PxVehicleCommandRespons } -fun PxVehicleBrakeCommandResponseParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleBrakeCommandResponseParams = js("new _module.PxVehicleBrakeCommandResponseParams()") - -fun PxVehicleBrakeCommandResponseParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleBrakeCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleBrakeCommandResponseParams)") +fun PxVehicleBrakeCommandResponseParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleBrakeCommandResponseParams = js("new _module.PxVehicleBrakeCommandResponseParams()") -fun PxVehicleBrakeCommandResponseParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleBrakeCommandResponseParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleBrakeCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleBrakeCommandResponseParams)") -external interface PxVehicleClutchCommandResponseParams { +external interface PxVehicleClutchCommandResponseParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -374,15 +351,11 @@ external interface PxVehicleClutchCommandResponseParams { } -fun PxVehicleClutchCommandResponseParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseParams = js("new _module.PxVehicleClutchCommandResponseParams()") - -fun PxVehicleClutchCommandResponseParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleClutchCommandResponseParams)") +fun PxVehicleClutchCommandResponseParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseParams = js("new _module.PxVehicleClutchCommandResponseParams()") -fun PxVehicleClutchCommandResponseParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleClutchCommandResponseParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleClutchCommandResponseParams)") -external interface PxVehicleClutchCommandResponseState { +external interface PxVehicleClutchCommandResponseState : JsAny, DestroyableNative { /** * Native object address. */ @@ -401,15 +374,11 @@ external interface PxVehicleClutchCommandResponseState { } -fun PxVehicleClutchCommandResponseState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseState = js("new _module.PxVehicleClutchCommandResponseState()") +fun PxVehicleClutchCommandResponseState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseState = js("new _module.PxVehicleClutchCommandResponseState()") -fun PxVehicleClutchCommandResponseStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseState = js("_module.wrapPointer(ptr, _module.PxVehicleClutchCommandResponseState)") +fun PxVehicleClutchCommandResponseStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchCommandResponseState = js("_module.wrapPointer(ptr, _module.PxVehicleClutchCommandResponseState)") -fun PxVehicleClutchCommandResponseState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleClutchParams { +external interface PxVehicleClutchParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -418,7 +387,7 @@ external interface PxVehicleClutchParams { /** * WebIDL type: [PxVehicleClutchAccuracyModeEnum] (enum) */ - var accuracyMode: PxVehicleClutchAccuracyModeEnum + var accuracyMode: Int /** * WebIDL type: unsigned long */ @@ -440,15 +409,15 @@ external interface PxVehicleClutchParams { } -fun PxVehicleClutchParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchParams = js("new _module.PxVehicleClutchParams()") +fun PxVehicleClutchParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchParams = js("new _module.PxVehicleClutchParams()") -fun PxVehicleClutchParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchParams = js("_module.wrapPointer(ptr, _module.PxVehicleClutchParams)") +fun PxVehicleClutchParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchParams = js("_module.wrapPointer(ptr, _module.PxVehicleClutchParams)") -fun PxVehicleClutchParams.destroy() { - PhysXJsLoader.destroy(this) -} +var PxVehicleClutchParams.accuracyModeEnum: PxVehicleClutchAccuracyModeEnum + get() = PxVehicleClutchAccuracyModeEnum.forValue(accuracyMode) + set(value) { accuracyMode = value.value } -external interface PxVehicleClutchSlipState { +external interface PxVehicleClutchSlipState : JsAny, DestroyableNative { /** * Native object address. */ @@ -463,15 +432,11 @@ external interface PxVehicleClutchSlipState { } -fun PxVehicleClutchSlipState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchSlipState = js("new _module.PxVehicleClutchSlipState()") +fun PxVehicleClutchSlipState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchSlipState = js("new _module.PxVehicleClutchSlipState()") -fun PxVehicleClutchSlipStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleClutchSlipState = js("_module.wrapPointer(ptr, _module.PxVehicleClutchSlipState)") - -fun PxVehicleClutchSlipState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleClutchSlipStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleClutchSlipState = js("_module.wrapPointer(ptr, _module.PxVehicleClutchSlipState)") -external interface PxVehicleCommandNonLinearResponseParams { +external interface PxVehicleCommandNonLinearResponseParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -516,13 +481,9 @@ external interface PxVehicleCommandNonLinearResponseParams { } -fun PxVehicleCommandNonLinearResponseParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandNonLinearResponseParams = js("new _module.PxVehicleCommandNonLinearResponseParams()") +fun PxVehicleCommandNonLinearResponseParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandNonLinearResponseParams = js("new _module.PxVehicleCommandNonLinearResponseParams()") -fun PxVehicleCommandNonLinearResponseParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandNonLinearResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleCommandNonLinearResponseParams)") - -fun PxVehicleCommandNonLinearResponseParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleCommandNonLinearResponseParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandNonLinearResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleCommandNonLinearResponseParams)") inline fun PxVehicleCommandNonLinearResponseParams.getSpeedResponses(index: Int) = get_speedResponses(index) inline fun PxVehicleCommandNonLinearResponseParams.setSpeedResponses(index: Int, value: Float) = set_speedResponses(index, value) @@ -533,7 +494,7 @@ inline fun PxVehicleCommandNonLinearResponseParams.setNbSpeedResponsesPerCommand inline fun PxVehicleCommandNonLinearResponseParams.getCommandValues(index: Int) = get_commandValues(index) inline fun PxVehicleCommandNonLinearResponseParams.setCommandValues(index: Int, value: Float) = set_commandValues(index, value) -external interface PxVehicleCommandResponseParams { +external interface PxVehicleCommandResponseParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -554,18 +515,14 @@ external interface PxVehicleCommandResponseParams { var maxResponse: Float } -fun PxVehicleCommandResponseParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandResponseParams = js("new _module.PxVehicleCommandResponseParams()") - -fun PxVehicleCommandResponseParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleCommandResponseParams)") +fun PxVehicleCommandResponseParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandResponseParams = js("new _module.PxVehicleCommandResponseParams()") -fun PxVehicleCommandResponseParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleCommandResponseParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleCommandResponseParams)") inline fun PxVehicleCommandResponseParams.getWheelResponseMultipliers(index: Int) = get_wheelResponseMultipliers(index) inline fun PxVehicleCommandResponseParams.setWheelResponseMultipliers(index: Int, value: Float) = set_wheelResponseMultipliers(index, value) -external interface PxVehicleCommandState { +external interface PxVehicleCommandState : JsAny, DestroyableNative { /** * Native object address. */ @@ -593,18 +550,14 @@ external interface PxVehicleCommandState { } -fun PxVehicleCommandState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandState = js("new _module.PxVehicleCommandState()") - -fun PxVehicleCommandStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleCommandState)") +fun PxVehicleCommandState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandState = js("new _module.PxVehicleCommandState()") -fun PxVehicleCommandState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleCommandStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleCommandState)") inline fun PxVehicleCommandState.getBrakes(index: Int) = get_brakes(index) inline fun PxVehicleCommandState.setBrakes(index: Int, value: Float) = set_brakes(index, value) -external interface PxVehicleCommandValueResponseTable { +external interface PxVehicleCommandValueResponseTable : JsAny, DestroyableNative { /** * Native object address. */ @@ -616,23 +569,15 @@ external interface PxVehicleCommandValueResponseTable { var commandValue: Float } -fun PxVehicleCommandValueResponseTable(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandValueResponseTable = js("new _module.PxVehicleCommandValueResponseTable()") +fun PxVehicleCommandValueResponseTable(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandValueResponseTable = js("new _module.PxVehicleCommandValueResponseTable()") -fun PxVehicleCommandValueResponseTableFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleCommandValueResponseTable = js("_module.wrapPointer(ptr, _module.PxVehicleCommandValueResponseTable)") +fun PxVehicleCommandValueResponseTableFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleCommandValueResponseTable = js("_module.wrapPointer(ptr, _module.PxVehicleCommandValueResponseTable)") -fun PxVehicleCommandValueResponseTable.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleComponent - -fun PxVehicleComponentFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleComponent = js("_module.wrapPointer(ptr, _module.PxVehicleComponent)") +external interface PxVehicleComponent : JsAny, DestroyableNative -fun PxVehicleComponent.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleComponentFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleComponent = js("_module.wrapPointer(ptr, _module.PxVehicleComponent)") -external interface PxVehicleComponentSequence { +external interface PxVehicleComponentSequence : JsAny, DestroyableNative { /** * Native object address. */ @@ -671,15 +616,11 @@ external interface PxVehicleComponentSequence { } -fun PxVehicleComponentSequence(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleComponentSequence = js("new _module.PxVehicleComponentSequence()") - -fun PxVehicleComponentSequenceFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleComponentSequence = js("_module.wrapPointer(ptr, _module.PxVehicleComponentSequence)") +fun PxVehicleComponentSequence(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleComponentSequence = js("new _module.PxVehicleComponentSequence()") -fun PxVehicleComponentSequence.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleComponentSequenceFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleComponentSequence = js("_module.wrapPointer(ptr, _module.PxVehicleComponentSequence)") -external interface PxVehicleConstraintConnector : PxConstraintConnector { +external interface PxVehicleConstraintConnector : JsAny, DestroyableNative, PxConstraintConnector { /** * @param constraintState WebIDL type: [PxVehiclePhysXConstraintState] */ @@ -689,23 +630,19 @@ external interface PxVehicleConstraintConnector : PxConstraintConnector { } -fun PxVehicleConstraintConnector(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleConstraintConnector = js("new _module.PxVehicleConstraintConnector()") +fun PxVehicleConstraintConnector(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleConstraintConnector = js("new _module.PxVehicleConstraintConnector()") /** * @param vehicleConstraintState WebIDL type: [PxVehiclePhysXConstraintState] */ -fun PxVehicleConstraintConnector(vehicleConstraintState: PxVehiclePhysXConstraintState, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleConstraintConnector = js("new _module.PxVehicleConstraintConnector(vehicleConstraintState)") +fun PxVehicleConstraintConnector(vehicleConstraintState: PxVehiclePhysXConstraintState, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleConstraintConnector = js("new _module.PxVehicleConstraintConnector(vehicleConstraintState)") -fun PxVehicleConstraintConnectorFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleConstraintConnector = js("_module.wrapPointer(ptr, _module.PxVehicleConstraintConnector)") - -fun PxVehicleConstraintConnector.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleConstraintConnectorFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleConstraintConnector = js("_module.wrapPointer(ptr, _module.PxVehicleConstraintConnector)") val PxVehicleConstraintConnector.constantBlock get() = getConstantBlock() -external interface PxVehicleDifferentialState { +external interface PxVehicleDifferentialState : JsAny, DestroyableNative { /** * Native object address. */ @@ -735,13 +672,9 @@ external interface PxVehicleDifferentialState { } -fun PxVehicleDifferentialState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleDifferentialState = js("new _module.PxVehicleDifferentialState()") - -fun PxVehicleDifferentialStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleDifferentialState = js("_module.wrapPointer(ptr, _module.PxVehicleDifferentialState)") +fun PxVehicleDifferentialState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleDifferentialState = js("new _module.PxVehicleDifferentialState()") -fun PxVehicleDifferentialState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleDifferentialStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleDifferentialState = js("_module.wrapPointer(ptr, _module.PxVehicleDifferentialState)") inline fun PxVehicleDifferentialState.getConnectedWheels(index: Int) = get_connectedWheels(index) inline fun PxVehicleDifferentialState.setConnectedWheels(index: Int, value: Int) = set_connectedWheels(index, value) @@ -750,7 +683,7 @@ inline fun PxVehicleDifferentialState.setTorqueRatiosAllWheels(index: Int, value inline fun PxVehicleDifferentialState.getAveWheelSpeedContributionAllWheels(index: Int) = get_aveWheelSpeedContributionAllWheels(index) inline fun PxVehicleDifferentialState.setAveWheelSpeedContributionAllWheels(index: Int, value: Float) = set_aveWheelSpeedContributionAllWheels(index, value) -external interface PxVehicleDirectDriveThrottleCommandResponseParams : PxVehicleCommandResponseParams { +external interface PxVehicleDirectDriveThrottleCommandResponseParams : JsAny, DestroyableNative, PxVehicleCommandResponseParams { /** * @param srcFrame WebIDL type: [PxVehicleFrame] (Const, Ref) * @param trgFrame WebIDL type: [PxVehicleFrame] (Const, Ref) @@ -768,15 +701,11 @@ external interface PxVehicleDirectDriveThrottleCommandResponseParams : PxVehicle } -fun PxVehicleDirectDriveThrottleCommandResponseParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleDirectDriveThrottleCommandResponseParams = js("new _module.PxVehicleDirectDriveThrottleCommandResponseParams()") - -fun PxVehicleDirectDriveThrottleCommandResponseParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleDirectDriveThrottleCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleDirectDriveThrottleCommandResponseParams)") +fun PxVehicleDirectDriveThrottleCommandResponseParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleDirectDriveThrottleCommandResponseParams = js("new _module.PxVehicleDirectDriveThrottleCommandResponseParams()") -fun PxVehicleDirectDriveThrottleCommandResponseParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleDirectDriveThrottleCommandResponseParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleDirectDriveThrottleCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleDirectDriveThrottleCommandResponseParams)") -external interface PxVehicleDirectDriveTransmissionCommandState { +external interface PxVehicleDirectDriveTransmissionCommandState : JsAny, DestroyableNative { /** * Native object address. */ @@ -785,21 +714,21 @@ external interface PxVehicleDirectDriveTransmissionCommandState { /** * WebIDL type: [PxVehicleDirectDriveTransmissionCommandStateEnum] (enum) */ - var gear: PxVehicleDirectDriveTransmissionCommandStateEnum + var gear: Int fun setToDefault() } -fun PxVehicleDirectDriveTransmissionCommandState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleDirectDriveTransmissionCommandState = js("new _module.PxVehicleDirectDriveTransmissionCommandState()") +fun PxVehicleDirectDriveTransmissionCommandState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleDirectDriveTransmissionCommandState = js("new _module.PxVehicleDirectDriveTransmissionCommandState()") -fun PxVehicleDirectDriveTransmissionCommandStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleDirectDriveTransmissionCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleDirectDriveTransmissionCommandState)") +fun PxVehicleDirectDriveTransmissionCommandStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleDirectDriveTransmissionCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleDirectDriveTransmissionCommandState)") -fun PxVehicleDirectDriveTransmissionCommandState.destroy() { - PhysXJsLoader.destroy(this) -} +var PxVehicleDirectDriveTransmissionCommandState.gearEnum: PxVehicleDirectDriveTransmissionCommandStateEnum + get() = PxVehicleDirectDriveTransmissionCommandStateEnum.forValue(gear) + set(value) { gear = value.value } -external interface PxVehicleEngineDriveThrottleCommandResponseState { +external interface PxVehicleEngineDriveThrottleCommandResponseState : JsAny, DestroyableNative { /** * Native object address. */ @@ -814,15 +743,11 @@ external interface PxVehicleEngineDriveThrottleCommandResponseState { } -fun PxVehicleEngineDriveThrottleCommandResponseState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineDriveThrottleCommandResponseState = js("new _module.PxVehicleEngineDriveThrottleCommandResponseState()") - -fun PxVehicleEngineDriveThrottleCommandResponseStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineDriveThrottleCommandResponseState = js("_module.wrapPointer(ptr, _module.PxVehicleEngineDriveThrottleCommandResponseState)") +fun PxVehicleEngineDriveThrottleCommandResponseState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineDriveThrottleCommandResponseState = js("new _module.PxVehicleEngineDriveThrottleCommandResponseState()") -fun PxVehicleEngineDriveThrottleCommandResponseState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleEngineDriveThrottleCommandResponseStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineDriveThrottleCommandResponseState = js("_module.wrapPointer(ptr, _module.PxVehicleEngineDriveThrottleCommandResponseState)") -external interface PxVehicleEngineDriveTransmissionCommandState { +external interface PxVehicleEngineDriveTransmissionCommandState : JsAny, DestroyableNative { /** * Native object address. */ @@ -841,15 +766,11 @@ external interface PxVehicleEngineDriveTransmissionCommandState { } -fun PxVehicleEngineDriveTransmissionCommandState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineDriveTransmissionCommandState = js("new _module.PxVehicleEngineDriveTransmissionCommandState()") +fun PxVehicleEngineDriveTransmissionCommandState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineDriveTransmissionCommandState = js("new _module.PxVehicleEngineDriveTransmissionCommandState()") -fun PxVehicleEngineDriveTransmissionCommandStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineDriveTransmissionCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleEngineDriveTransmissionCommandState)") - -fun PxVehicleEngineDriveTransmissionCommandState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleEngineDriveTransmissionCommandStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineDriveTransmissionCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleEngineDriveTransmissionCommandState)") -external interface PxVehicleEngineParams { +external interface PxVehicleEngineParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -904,15 +825,11 @@ external interface PxVehicleEngineParams { } -fun PxVehicleEngineParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineParams = js("new _module.PxVehicleEngineParams()") +fun PxVehicleEngineParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineParams = js("new _module.PxVehicleEngineParams()") -fun PxVehicleEngineParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineParams = js("_module.wrapPointer(ptr, _module.PxVehicleEngineParams)") +fun PxVehicleEngineParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineParams = js("_module.wrapPointer(ptr, _module.PxVehicleEngineParams)") -fun PxVehicleEngineParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleEngineState { +external interface PxVehicleEngineState : JsAny, DestroyableNative { /** * Native object address. */ @@ -927,15 +844,11 @@ external interface PxVehicleEngineState { } -fun PxVehicleEngineState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineState = js("new _module.PxVehicleEngineState()") - -fun PxVehicleEngineStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleEngineState = js("_module.wrapPointer(ptr, _module.PxVehicleEngineState)") +fun PxVehicleEngineState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineState = js("new _module.PxVehicleEngineState()") -fun PxVehicleEngineState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleEngineStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleEngineState = js("_module.wrapPointer(ptr, _module.PxVehicleEngineState)") -external interface PxVehicleFixedSizeLookupTableFloat_3 { +external interface PxVehicleFixedSizeLookupTableFloat_3 : JsAny, DestroyableNative { /** * Native object address. */ @@ -963,15 +876,11 @@ external interface PxVehicleFixedSizeLookupTableFloat_3 { } -fun PxVehicleFixedSizeLookupTableFloat_3(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableFloat_3 = js("new _module.PxVehicleFixedSizeLookupTableFloat_3()") - -fun PxVehicleFixedSizeLookupTableFloat_3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableFloat_3 = js("_module.wrapPointer(ptr, _module.PxVehicleFixedSizeLookupTableFloat_3)") +fun PxVehicleFixedSizeLookupTableFloat_3(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableFloat_3 = js("new _module.PxVehicleFixedSizeLookupTableFloat_3()") -fun PxVehicleFixedSizeLookupTableFloat_3.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleFixedSizeLookupTableFloat_3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableFloat_3 = js("_module.wrapPointer(ptr, _module.PxVehicleFixedSizeLookupTableFloat_3)") -external interface PxVehicleFixedSizeLookupTableVec3_3 { +external interface PxVehicleFixedSizeLookupTableVec3_3 : JsAny, DestroyableNative { /** * Native object address. */ @@ -999,15 +908,11 @@ external interface PxVehicleFixedSizeLookupTableVec3_3 { } -fun PxVehicleFixedSizeLookupTableVec3_3(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableVec3_3 = js("new _module.PxVehicleFixedSizeLookupTableVec3_3()") +fun PxVehicleFixedSizeLookupTableVec3_3(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableVec3_3 = js("new _module.PxVehicleFixedSizeLookupTableVec3_3()") -fun PxVehicleFixedSizeLookupTableVec3_3FromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableVec3_3 = js("_module.wrapPointer(ptr, _module.PxVehicleFixedSizeLookupTableVec3_3)") +fun PxVehicleFixedSizeLookupTableVec3_3FromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleFixedSizeLookupTableVec3_3 = js("_module.wrapPointer(ptr, _module.PxVehicleFixedSizeLookupTableVec3_3)") -fun PxVehicleFixedSizeLookupTableVec3_3.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleFourWheelDriveDifferentialParams : PxVehicleMultiWheelDriveDifferentialParams { +external interface PxVehicleFourWheelDriveDifferentialParams : JsAny, DestroyableNative, PxVehicleMultiWheelDriveDifferentialParams { /** * WebIDL type: unsigned long */ @@ -1060,20 +965,16 @@ external interface PxVehicleFourWheelDriveDifferentialParams : PxVehicleMultiWhe } -fun PxVehicleFourWheelDriveDifferentialParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleFourWheelDriveDifferentialParams = js("new _module.PxVehicleFourWheelDriveDifferentialParams()") - -fun PxVehicleFourWheelDriveDifferentialParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleFourWheelDriveDifferentialParams = js("_module.wrapPointer(ptr, _module.PxVehicleFourWheelDriveDifferentialParams)") +fun PxVehicleFourWheelDriveDifferentialParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleFourWheelDriveDifferentialParams = js("new _module.PxVehicleFourWheelDriveDifferentialParams()") -fun PxVehicleFourWheelDriveDifferentialParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleFourWheelDriveDifferentialParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleFourWheelDriveDifferentialParams = js("_module.wrapPointer(ptr, _module.PxVehicleFourWheelDriveDifferentialParams)") inline fun PxVehicleFourWheelDriveDifferentialParams.getFrontWheelIds(index: Int) = get_frontWheelIds(index) inline fun PxVehicleFourWheelDriveDifferentialParams.setFrontWheelIds(index: Int, value: Int) = set_frontWheelIds(index, value) inline fun PxVehicleFourWheelDriveDifferentialParams.getRearWheelIds(index: Int) = get_rearWheelIds(index) inline fun PxVehicleFourWheelDriveDifferentialParams.setRearWheelIds(index: Int, value: Int) = set_rearWheelIds(index, value) -external interface PxVehicleFrame { +external interface PxVehicleFrame : JsAny, DestroyableNative { /** * Native object address. */ @@ -1082,15 +983,15 @@ external interface PxVehicleFrame { /** * WebIDL type: [PxVehicleAxesEnum] (enum) */ - var lngAxis: PxVehicleAxesEnum + var lngAxis: Int /** * WebIDL type: [PxVehicleAxesEnum] (enum) */ - var latAxis: PxVehicleAxesEnum + var latAxis: Int /** * WebIDL type: [PxVehicleAxesEnum] (enum) */ - var vrtAxis: PxVehicleAxesEnum + var vrtAxis: Int fun setToDefault() @@ -1106,18 +1007,24 @@ external interface PxVehicleFrame { } -fun PxVehicleFrame(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleFrame = js("new _module.PxVehicleFrame()") - -fun PxVehicleFrameFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleFrame = js("_module.wrapPointer(ptr, _module.PxVehicleFrame)") +fun PxVehicleFrame(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleFrame = js("new _module.PxVehicleFrame()") -fun PxVehicleFrame.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleFrameFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleFrame = js("_module.wrapPointer(ptr, _module.PxVehicleFrame)") val PxVehicleFrame.frame get() = getFrame() -external interface PxVehicleGearboxParams { +var PxVehicleFrame.lngAxisEnum: PxVehicleAxesEnum + get() = PxVehicleAxesEnum.forValue(lngAxis) + set(value) { lngAxis = value.value } +var PxVehicleFrame.latAxisEnum: PxVehicleAxesEnum + get() = PxVehicleAxesEnum.forValue(latAxis) + set(value) { latAxis = value.value } +var PxVehicleFrame.vrtAxisEnum: PxVehicleAxesEnum + get() = PxVehicleAxesEnum.forValue(vrtAxis) + set(value) { vrtAxis = value.value } + +external interface PxVehicleGearboxParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1161,18 +1068,14 @@ external interface PxVehicleGearboxParams { } -fun PxVehicleGearboxParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleGearboxParams = js("new _module.PxVehicleGearboxParams()") - -fun PxVehicleGearboxParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleGearboxParams = js("_module.wrapPointer(ptr, _module.PxVehicleGearboxParams)") +fun PxVehicleGearboxParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleGearboxParams = js("new _module.PxVehicleGearboxParams()") -fun PxVehicleGearboxParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleGearboxParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleGearboxParams = js("_module.wrapPointer(ptr, _module.PxVehicleGearboxParams)") inline fun PxVehicleGearboxParams.getRatios(index: Int) = get_ratios(index) inline fun PxVehicleGearboxParams.setRatios(index: Int, value: Float) = set_ratios(index, value) -external interface PxVehicleGearboxState { +external interface PxVehicleGearboxState : JsAny, DestroyableNative { /** * Native object address. */ @@ -1195,15 +1098,11 @@ external interface PxVehicleGearboxState { } -fun PxVehicleGearboxState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleGearboxState = js("new _module.PxVehicleGearboxState()") +fun PxVehicleGearboxState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleGearboxState = js("new _module.PxVehicleGearboxState()") -fun PxVehicleGearboxStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleGearboxState = js("_module.wrapPointer(ptr, _module.PxVehicleGearboxState)") +fun PxVehicleGearboxStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleGearboxState = js("_module.wrapPointer(ptr, _module.PxVehicleGearboxState)") -fun PxVehicleGearboxState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleMultiWheelDriveDifferentialParams { +external interface PxVehicleMultiWheelDriveDifferentialParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1239,20 +1138,16 @@ external interface PxVehicleMultiWheelDriveDifferentialParams { } -fun PxVehicleMultiWheelDriveDifferentialParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleMultiWheelDriveDifferentialParams = js("new _module.PxVehicleMultiWheelDriveDifferentialParams()") +fun PxVehicleMultiWheelDriveDifferentialParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleMultiWheelDriveDifferentialParams = js("new _module.PxVehicleMultiWheelDriveDifferentialParams()") -fun PxVehicleMultiWheelDriveDifferentialParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleMultiWheelDriveDifferentialParams = js("_module.wrapPointer(ptr, _module.PxVehicleMultiWheelDriveDifferentialParams)") - -fun PxVehicleMultiWheelDriveDifferentialParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleMultiWheelDriveDifferentialParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleMultiWheelDriveDifferentialParams = js("_module.wrapPointer(ptr, _module.PxVehicleMultiWheelDriveDifferentialParams)") inline fun PxVehicleMultiWheelDriveDifferentialParams.getTorqueRatios(index: Int) = get_torqueRatios(index) inline fun PxVehicleMultiWheelDriveDifferentialParams.setTorqueRatios(index: Int, value: Float) = set_torqueRatios(index, value) inline fun PxVehicleMultiWheelDriveDifferentialParams.getAveWheelSpeedRatios(index: Int) = get_aveWheelSpeedRatios(index) inline fun PxVehicleMultiWheelDriveDifferentialParams.setAveWheelSpeedRatios(index: Int, value: Float) = set_aveWheelSpeedRatios(index, value) -external interface PxVehiclePhysXActor { +external interface PxVehiclePhysXActor : JsAny, DestroyableNative { /** * Native object address. */ @@ -1272,16 +1167,12 @@ external interface PxVehiclePhysXActor { } -fun PxVehiclePhysXActorFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXActor = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXActor)") - -fun PxVehiclePhysXActor.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehiclePhysXActorFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXActor = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXActor)") inline fun PxVehiclePhysXActor.getWheelShapes(index: Int) = get_wheelShapes(index) inline fun PxVehiclePhysXActor.setWheelShapes(index: Int, value: PxShape) = set_wheelShapes(index, value) -external interface PxVehiclePhysXConstraints { +external interface PxVehiclePhysXConstraints : JsAny, DestroyableNative { /** * Native object address. */ @@ -1307,11 +1198,7 @@ external interface PxVehiclePhysXConstraints { } -fun PxVehiclePhysXConstraintsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXConstraints = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXConstraints)") - -fun PxVehiclePhysXConstraints.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehiclePhysXConstraintsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXConstraints = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXConstraints)") inline fun PxVehiclePhysXConstraints.getConstraintStates(index: Int) = get_constraintStates(index) inline fun PxVehiclePhysXConstraints.setConstraintStates(index: Int, value: PxVehiclePhysXConstraintState) = set_constraintStates(index, value) @@ -1320,7 +1207,7 @@ inline fun PxVehiclePhysXConstraints.setConstraints(index: Int, value: PxConstra inline fun PxVehiclePhysXConstraints.getConstraintConnectors(index: Int) = get_constraintConnectors(index) inline fun PxVehiclePhysXConstraints.setConstraintConnectors(index: Int, value: PxVehicleConstraintConnector) = set_constraintConnectors(index, value) -external interface PxVehiclePhysXConstraintState { +external interface PxVehiclePhysXConstraintState : JsAny, DestroyableNative { /** * Native object address. */ @@ -1371,13 +1258,9 @@ external interface PxVehiclePhysXConstraintState { } -fun PxVehiclePhysXConstraintState(_module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXConstraintState = js("new _module.PxVehiclePhysXConstraintState()") +fun PxVehiclePhysXConstraintState(_module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXConstraintState = js("new _module.PxVehiclePhysXConstraintState()") -fun PxVehiclePhysXConstraintStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXConstraintState = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXConstraintState)") - -fun PxVehiclePhysXConstraintState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehiclePhysXConstraintStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXConstraintState = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXConstraintState)") inline fun PxVehiclePhysXConstraintState.getTireActiveStatus(index: Int) = get_tireActiveStatus(index) inline fun PxVehiclePhysXConstraintState.setTireActiveStatus(index: Int, value: Boolean) = set_tireActiveStatus(index, value) @@ -1388,7 +1271,7 @@ inline fun PxVehiclePhysXConstraintState.setTireAngulars(index: Int, value: PxVe inline fun PxVehiclePhysXConstraintState.getTireDamping(index: Int) = get_tireDamping(index) inline fun PxVehiclePhysXConstraintState.setTireDamping(index: Int, value: Float) = set_tireDamping(index, value) -external interface PxVehiclePhysXMaterialFriction { +external interface PxVehiclePhysXMaterialFriction : JsAny, DestroyableNative { /** * Native object address. */ @@ -1410,15 +1293,11 @@ external interface PxVehiclePhysXMaterialFriction { } -fun PxVehiclePhysXMaterialFriction(_module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXMaterialFriction = js("new _module.PxVehiclePhysXMaterialFriction()") - -fun PxVehiclePhysXMaterialFrictionFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXMaterialFriction = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXMaterialFriction)") +fun PxVehiclePhysXMaterialFriction(_module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXMaterialFriction = js("new _module.PxVehiclePhysXMaterialFriction()") -fun PxVehiclePhysXMaterialFriction.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehiclePhysXMaterialFrictionFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXMaterialFriction = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXMaterialFriction)") -external interface PxVehiclePhysXMaterialFrictionParams { +external interface PxVehiclePhysXMaterialFrictionParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1444,13 +1323,9 @@ external interface PxVehiclePhysXMaterialFrictionParams { } -fun PxVehiclePhysXMaterialFrictionParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXMaterialFrictionParams = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXMaterialFrictionParams)") - -fun PxVehiclePhysXMaterialFrictionParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehiclePhysXMaterialFrictionParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXMaterialFrictionParams = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXMaterialFrictionParams)") -external interface PxVehiclePhysXRoadGeometryQueryParams { +external interface PxVehiclePhysXRoadGeometryQueryParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1459,7 +1334,7 @@ external interface PxVehiclePhysXRoadGeometryQueryParams { /** * WebIDL type: [PxVehiclePhysXRoadGeometryQueryTypeEnum] (enum) */ - var roadGeometryQueryType: PxVehiclePhysXRoadGeometryQueryTypeEnum + var roadGeometryQueryType: Int /** * WebIDL type: [PxQueryFilterData] (Value) */ @@ -1489,13 +1364,13 @@ external interface PxVehiclePhysXRoadGeometryQueryParams { } -fun PxVehiclePhysXRoadGeometryQueryParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXRoadGeometryQueryParams = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXRoadGeometryQueryParams)") +fun PxVehiclePhysXRoadGeometryQueryParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXRoadGeometryQueryParams = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXRoadGeometryQueryParams)") -fun PxVehiclePhysXRoadGeometryQueryParams.destroy() { - PhysXJsLoader.destroy(this) -} +var PxVehiclePhysXRoadGeometryQueryParams.roadGeometryQueryTypeEnum: PxVehiclePhysXRoadGeometryQueryTypeEnum + get() = PxVehiclePhysXRoadGeometryQueryTypeEnum.forValue(roadGeometryQueryType) + set(value) { roadGeometryQueryType = value.value } -external interface PxVehiclePhysXSimulationContext : PxVehicleSimulationContext { +external interface PxVehiclePhysXSimulationContext : JsAny, PxVehicleSimulationContext { /** * WebIDL type: [PxConvexMesh] (Const) */ @@ -1507,7 +1382,7 @@ external interface PxVehiclePhysXSimulationContext : PxVehicleSimulationContext /** * WebIDL type: [PxVehiclePhysXActorUpdateModeEnum] (enum) */ - var physxActorUpdateMode: PxVehiclePhysXActorUpdateModeEnum + var physxActorUpdateMode: Int /** * WebIDL type: float */ @@ -1528,11 +1403,15 @@ external interface PxVehiclePhysXSimulationContext : PxVehicleSimulationContext } -fun PxVehiclePhysXSimulationContext(_module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXSimulationContext = js("new _module.PxVehiclePhysXSimulationContext()") +fun PxVehiclePhysXSimulationContext(_module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXSimulationContext = js("new _module.PxVehiclePhysXSimulationContext()") + +fun PxVehiclePhysXSimulationContextFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXSimulationContext = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXSimulationContext)") -fun PxVehiclePhysXSimulationContextFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXSimulationContext = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXSimulationContext)") +var PxVehiclePhysXSimulationContext.physxActorUpdateModeEnum: PxVehiclePhysXActorUpdateModeEnum + get() = PxVehiclePhysXActorUpdateModeEnum.forValue(physxActorUpdateMode) + set(value) { physxActorUpdateMode = value.value } -external interface PxVehiclePhysXSteerState { +external interface PxVehiclePhysXSteerState : JsAny, DestroyableNative { /** * Native object address. */ @@ -1547,13 +1426,9 @@ external interface PxVehiclePhysXSteerState { } -fun PxVehiclePhysXSteerStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXSteerState = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXSteerState)") - -fun PxVehiclePhysXSteerState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehiclePhysXSteerStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXSteerState = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXSteerState)") -external interface PxVehiclePhysXSuspensionLimitConstraintParams { +external interface PxVehiclePhysXSuspensionLimitConstraintParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1566,7 +1441,7 @@ external interface PxVehiclePhysXSuspensionLimitConstraintParams { /** * WebIDL type: [PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum] (enum) */ - var directionForSuspensionLimitConstraint: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum + var directionForSuspensionLimitConstraint: Int /** * @param srcFrame WebIDL type: [PxVehicleFrame] (Const, Ref) @@ -1584,17 +1459,17 @@ external interface PxVehiclePhysXSuspensionLimitConstraintParams { } -fun PxVehiclePhysXSuspensionLimitConstraintParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePhysXSuspensionLimitConstraintParams = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXSuspensionLimitConstraintParams)") +fun PxVehiclePhysXSuspensionLimitConstraintParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePhysXSuspensionLimitConstraintParams = js("_module.wrapPointer(ptr, _module.PxVehiclePhysXSuspensionLimitConstraintParams)") -fun PxVehiclePhysXSuspensionLimitConstraintParams.destroy() { - PhysXJsLoader.destroy(this) -} +var PxVehiclePhysXSuspensionLimitConstraintParams.directionForSuspensionLimitConstraintEnum: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum + get() = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum.forValue(directionForSuspensionLimitConstraint) + set(value) { directionForSuspensionLimitConstraint = value.value } -external interface PxVehiclePvdContext +external interface PxVehiclePvdContext : JsAny -fun PxVehiclePvdContextFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehiclePvdContext = js("_module.wrapPointer(ptr, _module.PxVehiclePvdContext)") +fun PxVehiclePvdContextFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehiclePvdContext = js("_module.wrapPointer(ptr, _module.PxVehiclePvdContext)") -external interface PxVehicleRigidBodyParams { +external interface PxVehicleRigidBodyParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1625,15 +1500,11 @@ external interface PxVehicleRigidBodyParams { } -fun PxVehicleRigidBodyParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleRigidBodyParams = js("new _module.PxVehicleRigidBodyParams()") +fun PxVehicleRigidBodyParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleRigidBodyParams = js("new _module.PxVehicleRigidBodyParams()") -fun PxVehicleRigidBodyParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleRigidBodyParams = js("_module.wrapPointer(ptr, _module.PxVehicleRigidBodyParams)") +fun PxVehicleRigidBodyParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleRigidBodyParams = js("_module.wrapPointer(ptr, _module.PxVehicleRigidBodyParams)") -fun PxVehicleRigidBodyParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleRigidBodyState { +external interface PxVehicleRigidBodyState : JsAny, DestroyableNative { /** * Native object address. */ @@ -1690,15 +1561,11 @@ external interface PxVehicleRigidBodyState { } -fun PxVehicleRigidBodyState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleRigidBodyState = js("new _module.PxVehicleRigidBodyState()") - -fun PxVehicleRigidBodyStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleRigidBodyState = js("_module.wrapPointer(ptr, _module.PxVehicleRigidBodyState)") +fun PxVehicleRigidBodyState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleRigidBodyState = js("new _module.PxVehicleRigidBodyState()") -fun PxVehicleRigidBodyState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleRigidBodyStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleRigidBodyState = js("_module.wrapPointer(ptr, _module.PxVehicleRigidBodyState)") -external interface PxVehicleRoadGeometryState { +external interface PxVehicleRoadGeometryState : JsAny, DestroyableNative { /** * Native object address. */ @@ -1725,15 +1592,11 @@ external interface PxVehicleRoadGeometryState { } -fun PxVehicleRoadGeometryState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleRoadGeometryState = js("new _module.PxVehicleRoadGeometryState()") +fun PxVehicleRoadGeometryState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleRoadGeometryState = js("new _module.PxVehicleRoadGeometryState()") -fun PxVehicleRoadGeometryStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleRoadGeometryState = js("_module.wrapPointer(ptr, _module.PxVehicleRoadGeometryState)") +fun PxVehicleRoadGeometryStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleRoadGeometryState = js("_module.wrapPointer(ptr, _module.PxVehicleRoadGeometryState)") -fun PxVehicleRoadGeometryState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleScale { +external interface PxVehicleScale : JsAny, DestroyableNative { /** * Native object address. */ @@ -1753,15 +1616,11 @@ external interface PxVehicleScale { } -fun PxVehicleScale(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleScale = js("new _module.PxVehicleScale()") +fun PxVehicleScale(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleScale = js("new _module.PxVehicleScale()") -fun PxVehicleScaleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleScale = js("_module.wrapPointer(ptr, _module.PxVehicleScale)") +fun PxVehicleScaleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleScale = js("_module.wrapPointer(ptr, _module.PxVehicleScale)") -fun PxVehicleScale.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleSimulationContext { +external interface PxVehicleSimulationContext : JsAny, DestroyableNative { /** * Native object address. */ @@ -1799,7 +1658,7 @@ external interface PxVehicleSimulationContext { /** * @return WebIDL type: [PxVehicleSimulationContextTypeEnum] (enum) */ - fun getType(): PxVehicleSimulationContextTypeEnum + fun getType(): Int fun setToDefault() @@ -1814,18 +1673,14 @@ external interface PxVehicleSimulationContext { } -fun PxVehicleSimulationContext(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSimulationContext = js("new _module.PxVehicleSimulationContext()") - -fun PxVehicleSimulationContextFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSimulationContext = js("_module.wrapPointer(ptr, _module.PxVehicleSimulationContext)") +fun PxVehicleSimulationContext(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSimulationContext = js("new _module.PxVehicleSimulationContext()") -fun PxVehicleSimulationContext.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleSimulationContextFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSimulationContext = js("_module.wrapPointer(ptr, _module.PxVehicleSimulationContext)") -val PxVehicleSimulationContext.type - get() = getType() +val PxVehicleSimulationContext.type: PxVehicleSimulationContextTypeEnum + get() = PxVehicleSimulationContextTypeEnum.forValue(getType()) -external interface PxVehicleSteerCommandResponseParams : PxVehicleCommandResponseParams { +external interface PxVehicleSteerCommandResponseParams : JsAny, DestroyableNative, PxVehicleCommandResponseParams { /** * @param srcFrame WebIDL type: [PxVehicleFrame] (Const, Ref) * @param trgFrame WebIDL type: [PxVehicleFrame] (Const, Ref) @@ -1843,15 +1698,11 @@ external interface PxVehicleSteerCommandResponseParams : PxVehicleCommandRespons } -fun PxVehicleSteerCommandResponseParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSteerCommandResponseParams = js("new _module.PxVehicleSteerCommandResponseParams()") +fun PxVehicleSteerCommandResponseParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSteerCommandResponseParams = js("new _module.PxVehicleSteerCommandResponseParams()") -fun PxVehicleSteerCommandResponseParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSteerCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleSteerCommandResponseParams)") - -fun PxVehicleSteerCommandResponseParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleSteerCommandResponseParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSteerCommandResponseParams = js("_module.wrapPointer(ptr, _module.PxVehicleSteerCommandResponseParams)") -external interface PxVehicleSuspensionComplianceParams { +external interface PxVehicleSuspensionComplianceParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1890,15 +1741,11 @@ external interface PxVehicleSuspensionComplianceParams { } -fun PxVehicleSuspensionComplianceParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceParams = js("new _module.PxVehicleSuspensionComplianceParams()") +fun PxVehicleSuspensionComplianceParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceParams = js("new _module.PxVehicleSuspensionComplianceParams()") -fun PxVehicleSuspensionComplianceParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionComplianceParams)") +fun PxVehicleSuspensionComplianceParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionComplianceParams)") -fun PxVehicleSuspensionComplianceParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleSuspensionComplianceState { +external interface PxVehicleSuspensionComplianceState : JsAny, DestroyableNative { /** * Native object address. */ @@ -1925,15 +1772,11 @@ external interface PxVehicleSuspensionComplianceState { } -fun PxVehicleSuspensionComplianceState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceState = js("new _module.PxVehicleSuspensionComplianceState()") - -fun PxVehicleSuspensionComplianceStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceState = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionComplianceState)") +fun PxVehicleSuspensionComplianceState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceState = js("new _module.PxVehicleSuspensionComplianceState()") -fun PxVehicleSuspensionComplianceState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleSuspensionComplianceStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionComplianceState = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionComplianceState)") -external interface PxVehicleSuspensionForce { +external interface PxVehicleSuspensionForce : JsAny, DestroyableNative { /** * Native object address. */ @@ -1956,15 +1799,11 @@ external interface PxVehicleSuspensionForce { } -fun PxVehicleSuspensionForce(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionForce = js("new _module.PxVehicleSuspensionForce()") - -fun PxVehicleSuspensionForceFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionForce = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionForce)") +fun PxVehicleSuspensionForce(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionForce = js("new _module.PxVehicleSuspensionForce()") -fun PxVehicleSuspensionForce.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleSuspensionForceFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionForce = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionForce)") -external interface PxVehicleSuspensionForceParams { +external interface PxVehicleSuspensionForceParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -1999,15 +1838,11 @@ external interface PxVehicleSuspensionForceParams { } -fun PxVehicleSuspensionForceParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionForceParams = js("new _module.PxVehicleSuspensionForceParams()") +fun PxVehicleSuspensionForceParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionForceParams = js("new _module.PxVehicleSuspensionForceParams()") -fun PxVehicleSuspensionForceParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionForceParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionForceParams)") +fun PxVehicleSuspensionForceParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionForceParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionForceParams)") -fun PxVehicleSuspensionForceParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleSuspensionParams { +external interface PxVehicleSuspensionParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2046,15 +1881,11 @@ external interface PxVehicleSuspensionParams { } -fun PxVehicleSuspensionParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionParams = js("new _module.PxVehicleSuspensionParams()") - -fun PxVehicleSuspensionParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionParams)") +fun PxVehicleSuspensionParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionParams = js("new _module.PxVehicleSuspensionParams()") -fun PxVehicleSuspensionParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleSuspensionParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionParams)") -external interface PxVehicleSuspensionState { +external interface PxVehicleSuspensionState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2081,15 +1912,11 @@ external interface PxVehicleSuspensionState { } -fun PxVehicleSuspensionState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionState = js("new _module.PxVehicleSuspensionState()") - -fun PxVehicleSuspensionStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionState = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionState)") +fun PxVehicleSuspensionState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionState = js("new _module.PxVehicleSuspensionState()") -fun PxVehicleSuspensionState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleSuspensionStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionState = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionState)") -external interface PxVehicleSuspensionStateCalculationParams { +external interface PxVehicleSuspensionStateCalculationParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2098,7 +1925,7 @@ external interface PxVehicleSuspensionStateCalculationParams { /** * WebIDL type: [PxVehicleSuspensionJounceCalculationTypeEnum] (enum) */ - var suspensionJounceCalculationType: PxVehicleSuspensionJounceCalculationTypeEnum + var suspensionJounceCalculationType: Int /** * WebIDL type: boolean */ @@ -2120,15 +1947,15 @@ external interface PxVehicleSuspensionStateCalculationParams { } -fun PxVehicleSuspensionStateCalculationParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionStateCalculationParams = js("new _module.PxVehicleSuspensionStateCalculationParams()") +fun PxVehicleSuspensionStateCalculationParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionStateCalculationParams = js("new _module.PxVehicleSuspensionStateCalculationParams()") -fun PxVehicleSuspensionStateCalculationParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleSuspensionStateCalculationParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionStateCalculationParams)") +fun PxVehicleSuspensionStateCalculationParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleSuspensionStateCalculationParams = js("_module.wrapPointer(ptr, _module.PxVehicleSuspensionStateCalculationParams)") -fun PxVehicleSuspensionStateCalculationParams.destroy() { - PhysXJsLoader.destroy(this) -} +var PxVehicleSuspensionStateCalculationParams.suspensionJounceCalculationTypeEnum: PxVehicleSuspensionJounceCalculationTypeEnum + get() = PxVehicleSuspensionJounceCalculationTypeEnum.forValue(suspensionJounceCalculationType) + set(value) { suspensionJounceCalculationType = value.value } -external interface PxVehicleTankDriveDifferentialParams : PxVehicleMultiWheelDriveDifferentialParams { +external interface PxVehicleTankDriveDifferentialParams : JsAny, DestroyableNative, PxVehicleMultiWheelDriveDifferentialParams { /** * WebIDL type: unsigned long */ @@ -2192,13 +2019,9 @@ external interface PxVehicleTankDriveDifferentialParams : PxVehicleMultiWheelDri } -fun PxVehicleTankDriveDifferentialParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTankDriveDifferentialParams = js("new _module.PxVehicleTankDriveDifferentialParams()") - -fun PxVehicleTankDriveDifferentialParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTankDriveDifferentialParams = js("_module.wrapPointer(ptr, _module.PxVehicleTankDriveDifferentialParams)") +fun PxVehicleTankDriveDifferentialParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTankDriveDifferentialParams = js("new _module.PxVehicleTankDriveDifferentialParams()") -fun PxVehicleTankDriveDifferentialParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTankDriveDifferentialParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTankDriveDifferentialParams = js("_module.wrapPointer(ptr, _module.PxVehicleTankDriveDifferentialParams)") inline fun PxVehicleTankDriveDifferentialParams.getThrustIdPerTrack(index: Int) = get_thrustIdPerTrack(index) inline fun PxVehicleTankDriveDifferentialParams.setThrustIdPerTrack(index: Int, value: Int) = set_thrustIdPerTrack(index, value) @@ -2209,7 +2032,7 @@ inline fun PxVehicleTankDriveDifferentialParams.setTrackToWheelIds(index: Int, v inline fun PxVehicleTankDriveDifferentialParams.getWheelIdsInTrackOrder(index: Int) = get_wheelIdsInTrackOrder(index) inline fun PxVehicleTankDriveDifferentialParams.setWheelIdsInTrackOrder(index: Int, value: Int) = set_wheelIdsInTrackOrder(index, value) -external interface PxVehicleTankDriveTransmissionCommandState : PxVehicleEngineDriveTransmissionCommandState { +external interface PxVehicleTankDriveTransmissionCommandState : JsAny, DestroyableNative, PxVehicleEngineDriveTransmissionCommandState { /** * WebIDL type: float */ @@ -2220,18 +2043,14 @@ external interface PxVehicleTankDriveTransmissionCommandState : PxVehicleEngineD } -fun PxVehicleTankDriveTransmissionCommandState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTankDriveTransmissionCommandState = js("new _module.PxVehicleTankDriveTransmissionCommandState()") +fun PxVehicleTankDriveTransmissionCommandState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTankDriveTransmissionCommandState = js("new _module.PxVehicleTankDriveTransmissionCommandState()") -fun PxVehicleTankDriveTransmissionCommandStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTankDriveTransmissionCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleTankDriveTransmissionCommandState)") - -fun PxVehicleTankDriveTransmissionCommandState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTankDriveTransmissionCommandStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTankDriveTransmissionCommandState = js("_module.wrapPointer(ptr, _module.PxVehicleTankDriveTransmissionCommandState)") inline fun PxVehicleTankDriveTransmissionCommandState.getThrusts(index: Int) = get_thrusts(index) inline fun PxVehicleTankDriveTransmissionCommandState.setThrusts(index: Int, value: Float) = set_thrusts(index, value) -external interface PxVehicleTireAxisStickyParams { +external interface PxVehicleTireAxisStickyParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2266,15 +2085,11 @@ external interface PxVehicleTireAxisStickyParams { } -fun PxVehicleTireAxisStickyParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireAxisStickyParams = js("new _module.PxVehicleTireAxisStickyParams()") +fun PxVehicleTireAxisStickyParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireAxisStickyParams = js("new _module.PxVehicleTireAxisStickyParams()") -fun PxVehicleTireAxisStickyParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireAxisStickyParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireAxisStickyParams)") +fun PxVehicleTireAxisStickyParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireAxisStickyParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireAxisStickyParams)") -fun PxVehicleTireAxisStickyParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleTireCamberAngleState { +external interface PxVehicleTireCamberAngleState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2289,15 +2104,11 @@ external interface PxVehicleTireCamberAngleState { } -fun PxVehicleTireCamberAngleState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireCamberAngleState = js("new _module.PxVehicleTireCamberAngleState()") - -fun PxVehicleTireCamberAngleStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireCamberAngleState = js("_module.wrapPointer(ptr, _module.PxVehicleTireCamberAngleState)") +fun PxVehicleTireCamberAngleState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireCamberAngleState = js("new _module.PxVehicleTireCamberAngleState()") -fun PxVehicleTireCamberAngleState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireCamberAngleStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireCamberAngleState = js("_module.wrapPointer(ptr, _module.PxVehicleTireCamberAngleState)") -external interface PxVehicleTireDirectionState { +external interface PxVehicleTireDirectionState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2313,18 +2124,14 @@ external interface PxVehicleTireDirectionState { } -fun PxVehicleTireDirectionState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireDirectionState = js("new _module.PxVehicleTireDirectionState()") +fun PxVehicleTireDirectionState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireDirectionState = js("new _module.PxVehicleTireDirectionState()") -fun PxVehicleTireDirectionStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireDirectionState = js("_module.wrapPointer(ptr, _module.PxVehicleTireDirectionState)") - -fun PxVehicleTireDirectionState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireDirectionStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireDirectionState = js("_module.wrapPointer(ptr, _module.PxVehicleTireDirectionState)") inline fun PxVehicleTireDirectionState.getDirections(index: Int) = get_directions(index) inline fun PxVehicleTireDirectionState.setDirections(index: Int, value: PxVec3) = set_directions(index, value) -external interface PxVehicleTireForce { +external interface PxVehicleTireForce : JsAny, DestroyableNative { /** * Native object address. */ @@ -2353,20 +2160,16 @@ external interface PxVehicleTireForce { } -fun PxVehicleTireForce(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireForce = js("new _module.PxVehicleTireForce()") +fun PxVehicleTireForce(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireForce = js("new _module.PxVehicleTireForce()") -fun PxVehicleTireForceFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireForce = js("_module.wrapPointer(ptr, _module.PxVehicleTireForce)") - -fun PxVehicleTireForce.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireForceFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireForce = js("_module.wrapPointer(ptr, _module.PxVehicleTireForce)") inline fun PxVehicleTireForce.getForces(index: Int) = get_forces(index) inline fun PxVehicleTireForce.setForces(index: Int, value: PxVec3) = set_forces(index, value) inline fun PxVehicleTireForce.getTorques(index: Int) = get_torques(index) inline fun PxVehicleTireForce.setTorques(index: Int, value: PxVec3) = set_torques(index, value) -external interface PxVehicleTireForceParams { +external interface PxVehicleTireForceParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2409,15 +2212,11 @@ external interface PxVehicleTireForceParams { } -fun PxVehicleTireForceParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireForceParams = js("new _module.PxVehicleTireForceParams()") - -fun PxVehicleTireForceParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireForceParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireForceParams)") +fun PxVehicleTireForceParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireForceParams = js("new _module.PxVehicleTireForceParams()") -fun PxVehicleTireForceParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireForceParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireForceParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireForceParams)") -external interface PxVehicleTireForceParamsExt { +external interface PxVehicleTireForceParamsExt : JsAny { /** * Native object address. */ @@ -2441,9 +2240,9 @@ external interface PxVehicleTireForceParamsExt { } -fun PxVehicleTireForceParamsExtFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireForceParamsExt = js("_module.wrapPointer(ptr, _module.PxVehicleTireForceParamsExt)") +fun PxVehicleTireForceParamsExtFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireForceParamsExt = js("_module.wrapPointer(ptr, _module.PxVehicleTireForceParamsExt)") -external interface PxVehicleTireGripState { +external interface PxVehicleTireGripState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2462,13 +2261,9 @@ external interface PxVehicleTireGripState { } -fun PxVehicleTireGripStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireGripState = js("_module.wrapPointer(ptr, _module.PxVehicleTireGripState)") - -fun PxVehicleTireGripState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireGripStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireGripState = js("_module.wrapPointer(ptr, _module.PxVehicleTireGripState)") -external interface PxVehicleTireSlipParams { +external interface PxVehicleTireSlipParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2505,15 +2300,11 @@ external interface PxVehicleTireSlipParams { } -fun PxVehicleTireSlipParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireSlipParams = js("new _module.PxVehicleTireSlipParams()") +fun PxVehicleTireSlipParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireSlipParams = js("new _module.PxVehicleTireSlipParams()") -fun PxVehicleTireSlipParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireSlipParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireSlipParams)") +fun PxVehicleTireSlipParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireSlipParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireSlipParams)") -fun PxVehicleTireSlipParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleTireSlipState { +external interface PxVehicleTireSlipState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2529,18 +2320,14 @@ external interface PxVehicleTireSlipState { } -fun PxVehicleTireSlipState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireSlipState = js("new _module.PxVehicleTireSlipState()") - -fun PxVehicleTireSlipStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireSlipState = js("_module.wrapPointer(ptr, _module.PxVehicleTireSlipState)") +fun PxVehicleTireSlipState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireSlipState = js("new _module.PxVehicleTireSlipState()") -fun PxVehicleTireSlipState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireSlipStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireSlipState = js("_module.wrapPointer(ptr, _module.PxVehicleTireSlipState)") inline fun PxVehicleTireSlipState.getSlips(index: Int) = get_slips(index) inline fun PxVehicleTireSlipState.setSlips(index: Int, value: Float) = set_slips(index, value) -external interface PxVehicleTireSpeedState { +external interface PxVehicleTireSpeedState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2556,18 +2343,14 @@ external interface PxVehicleTireSpeedState { } -fun PxVehicleTireSpeedState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireSpeedState = js("new _module.PxVehicleTireSpeedState()") - -fun PxVehicleTireSpeedStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireSpeedState = js("_module.wrapPointer(ptr, _module.PxVehicleTireSpeedState)") +fun PxVehicleTireSpeedState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireSpeedState = js("new _module.PxVehicleTireSpeedState()") -fun PxVehicleTireSpeedState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireSpeedStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireSpeedState = js("_module.wrapPointer(ptr, _module.PxVehicleTireSpeedState)") inline fun PxVehicleTireSpeedState.getSpeedStates(index: Int) = get_speedStates(index) inline fun PxVehicleTireSpeedState.setSpeedStates(index: Int, value: Float) = set_speedStates(index, value) -external interface PxVehicleTireStickyParams { +external interface PxVehicleTireStickyParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2597,18 +2380,14 @@ external interface PxVehicleTireStickyParams { } -fun PxVehicleTireStickyParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireStickyParams = js("new _module.PxVehicleTireStickyParams()") +fun PxVehicleTireStickyParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireStickyParams = js("new _module.PxVehicleTireStickyParams()") -fun PxVehicleTireStickyParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireStickyParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireStickyParams)") - -fun PxVehicleTireStickyParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireStickyParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireStickyParams = js("_module.wrapPointer(ptr, _module.PxVehicleTireStickyParams)") inline fun PxVehicleTireStickyParams.getStickyParams(index: Int) = get_stickyParams(index) inline fun PxVehicleTireStickyParams.setStickyParams(index: Int, value: PxVehicleTireAxisStickyParams) = set_stickyParams(index, value) -external interface PxVehicleTireStickyState { +external interface PxVehicleTireStickyState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2629,20 +2408,16 @@ external interface PxVehicleTireStickyState { } -fun PxVehicleTireStickyState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireStickyState = js("new _module.PxVehicleTireStickyState()") - -fun PxVehicleTireStickyStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTireStickyState = js("_module.wrapPointer(ptr, _module.PxVehicleTireStickyState)") +fun PxVehicleTireStickyState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireStickyState = js("new _module.PxVehicleTireStickyState()") -fun PxVehicleTireStickyState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTireStickyStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTireStickyState = js("_module.wrapPointer(ptr, _module.PxVehicleTireStickyState)") inline fun PxVehicleTireStickyState.getLowSpeedTime(index: Int) = get_lowSpeedTime(index) inline fun PxVehicleTireStickyState.setLowSpeedTime(index: Int, value: Float) = set_lowSpeedTime(index, value) inline fun PxVehicleTireStickyState.getActiveStatus(index: Int) = get_activeStatus(index) inline fun PxVehicleTireStickyState.setActiveStatus(index: Int, value: Boolean) = set_activeStatus(index, value) -external interface PxVehicleTorqueCurveLookupTable { +external interface PxVehicleTorqueCurveLookupTable : JsAny, DestroyableNative { /** * Native object address. */ @@ -2670,15 +2445,11 @@ external interface PxVehicleTorqueCurveLookupTable { } -fun PxVehicleTorqueCurveLookupTable(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleTorqueCurveLookupTable = js("new _module.PxVehicleTorqueCurveLookupTable()") - -fun PxVehicleTorqueCurveLookupTableFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleTorqueCurveLookupTable = js("_module.wrapPointer(ptr, _module.PxVehicleTorqueCurveLookupTable)") +fun PxVehicleTorqueCurveLookupTable(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleTorqueCurveLookupTable = js("new _module.PxVehicleTorqueCurveLookupTable()") -fun PxVehicleTorqueCurveLookupTable.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleTorqueCurveLookupTableFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleTorqueCurveLookupTable = js("_module.wrapPointer(ptr, _module.PxVehicleTorqueCurveLookupTable)") -external interface PxVehicleWheelActuationState { +external interface PxVehicleWheelActuationState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2697,15 +2468,11 @@ external interface PxVehicleWheelActuationState { } -fun PxVehicleWheelActuationState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelActuationState = js("new _module.PxVehicleWheelActuationState()") +fun PxVehicleWheelActuationState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelActuationState = js("new _module.PxVehicleWheelActuationState()") -fun PxVehicleWheelActuationStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelActuationState = js("_module.wrapPointer(ptr, _module.PxVehicleWheelActuationState)") +fun PxVehicleWheelActuationStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelActuationState = js("_module.wrapPointer(ptr, _module.PxVehicleWheelActuationState)") -fun PxVehicleWheelActuationState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface PxVehicleWheelConstraintGroupState { +external interface PxVehicleWheelConstraintGroupState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2769,13 +2536,9 @@ external interface PxVehicleWheelConstraintGroupState { } -fun PxVehicleWheelConstraintGroupState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelConstraintGroupState = js("new _module.PxVehicleWheelConstraintGroupState()") +fun PxVehicleWheelConstraintGroupState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelConstraintGroupState = js("new _module.PxVehicleWheelConstraintGroupState()") -fun PxVehicleWheelConstraintGroupStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelConstraintGroupState = js("_module.wrapPointer(ptr, _module.PxVehicleWheelConstraintGroupState)") - -fun PxVehicleWheelConstraintGroupState.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleWheelConstraintGroupStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelConstraintGroupState = js("_module.wrapPointer(ptr, _module.PxVehicleWheelConstraintGroupState)") val PxVehicleWheelConstraintGroupState.nbConstraintGroups get() = getNbConstraintGroups() @@ -2789,7 +2552,7 @@ inline fun PxVehicleWheelConstraintGroupState.setWheelIdsInGroupOrder(index: Int inline fun PxVehicleWheelConstraintGroupState.getWheelMultipliersInGroupOrder(index: Int) = get_wheelMultipliersInGroupOrder(index) inline fun PxVehicleWheelConstraintGroupState.setWheelMultipliersInGroupOrder(index: Int, value: Float) = set_wheelMultipliersInGroupOrder(index, value) -external interface PxVehicleWheelLocalPose { +external interface PxVehicleWheelLocalPose : JsAny, DestroyableNative { /** * Native object address. */ @@ -2804,15 +2567,11 @@ external interface PxVehicleWheelLocalPose { } -fun PxVehicleWheelLocalPose(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelLocalPose = js("new _module.PxVehicleWheelLocalPose()") - -fun PxVehicleWheelLocalPoseFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelLocalPose = js("_module.wrapPointer(ptr, _module.PxVehicleWheelLocalPose)") +fun PxVehicleWheelLocalPose(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelLocalPose = js("new _module.PxVehicleWheelLocalPose()") -fun PxVehicleWheelLocalPose.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleWheelLocalPoseFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelLocalPose = js("_module.wrapPointer(ptr, _module.PxVehicleWheelLocalPose)") -external interface PxVehicleWheelParams { +external interface PxVehicleWheelParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2855,15 +2614,11 @@ external interface PxVehicleWheelParams { } -fun PxVehicleWheelParams(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelParams = js("new _module.PxVehicleWheelParams()") - -fun PxVehicleWheelParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelParams = js("_module.wrapPointer(ptr, _module.PxVehicleWheelParams)") +fun PxVehicleWheelParams(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelParams = js("new _module.PxVehicleWheelParams()") -fun PxVehicleWheelParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PxVehicleWheelParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelParams = js("_module.wrapPointer(ptr, _module.PxVehicleWheelParams)") -external interface PxVehicleWheelRigidBody1dState { +external interface PxVehicleWheelRigidBody1dState : JsAny, DestroyableNative { /** * Native object address. */ @@ -2886,15 +2641,11 @@ external interface PxVehicleWheelRigidBody1dState { } -fun PxVehicleWheelRigidBody1dState(_module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelRigidBody1dState = js("new _module.PxVehicleWheelRigidBody1dState()") +fun PxVehicleWheelRigidBody1dState(_module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelRigidBody1dState = js("new _module.PxVehicleWheelRigidBody1dState()") -fun PxVehicleWheelRigidBody1dStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PxVehicleWheelRigidBody1dState = js("_module.wrapPointer(ptr, _module.PxVehicleWheelRigidBody1dState)") +fun PxVehicleWheelRigidBody1dStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PxVehicleWheelRigidBody1dState = js("_module.wrapPointer(ptr, _module.PxVehicleWheelRigidBody1dState)") -fun PxVehicleWheelRigidBody1dState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface BaseVehicleParams { +external interface BaseVehicleParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -2985,13 +2736,9 @@ external interface BaseVehicleParams { } -fun BaseVehicleParams(_module: dynamic = PhysXJsLoader.physXJs): BaseVehicleParams = js("new _module.BaseVehicleParams()") - -fun BaseVehicleParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): BaseVehicleParams = js("_module.wrapPointer(ptr, _module.BaseVehicleParams)") +fun BaseVehicleParams(_module: JsAny = PhysXJsLoader.physXJs): BaseVehicleParams = js("new _module.BaseVehicleParams()") -fun BaseVehicleParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun BaseVehicleParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): BaseVehicleParams = js("_module.wrapPointer(ptr, _module.BaseVehicleParams)") inline fun BaseVehicleParams.getBrakeResponseParams(index: Int) = get_brakeResponseParams(index) inline fun BaseVehicleParams.setBrakeResponseParams(index: Int, value: PxVehicleBrakeCommandResponseParams) = set_brakeResponseParams(index, value) @@ -3010,7 +2757,7 @@ inline fun BaseVehicleParams.setTireForceParams(index: Int, value: PxVehicleTire inline fun BaseVehicleParams.getWheelParams(index: Int) = get_wheelParams(index) inline fun BaseVehicleParams.setWheelParams(index: Int, value: PxVehicleWheelParams) = set_wheelParams(index, value) -external interface BaseVehicleState { +external interface BaseVehicleState : JsAny, DestroyableNative { /** * Native object address. */ @@ -3109,13 +2856,9 @@ external interface BaseVehicleState { } -fun BaseVehicleState(_module: dynamic = PhysXJsLoader.physXJs): BaseVehicleState = js("new _module.BaseVehicleState()") - -fun BaseVehicleStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): BaseVehicleState = js("_module.wrapPointer(ptr, _module.BaseVehicleState)") +fun BaseVehicleState(_module: JsAny = PhysXJsLoader.physXJs): BaseVehicleState = js("new _module.BaseVehicleState()") -fun BaseVehicleState.destroy() { - PhysXJsLoader.destroy(this) -} +fun BaseVehicleStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): BaseVehicleState = js("_module.wrapPointer(ptr, _module.BaseVehicleState)") inline fun BaseVehicleState.getBrakeCommandResponseStates(index: Int) = get_brakeCommandResponseStates(index) inline fun BaseVehicleState.setBrakeCommandResponseStates(index: Int, value: Float) = set_brakeCommandResponseStates(index, value) @@ -3150,7 +2893,7 @@ inline fun BaseVehicleState.setWheelRigidBody1dStates(index: Int, value: PxVehic inline fun BaseVehicleState.getWheelLocalPoses(index: Int) = get_wheelLocalPoses(index) inline fun BaseVehicleState.setWheelLocalPoses(index: Int, value: PxVehicleWheelLocalPose) = set_wheelLocalPoses(index, value) -external interface PhysXIntegrationParams { +external interface PhysXIntegrationParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -3239,17 +2982,13 @@ external interface PhysXIntegrationParams { * @param physxActorBoxShapeLocalPose WebIDL type: [PxTransform] (Const, Ref) * @param roadGeometryQueryType WebIDL type: [PxVehiclePhysXRoadGeometryQueryTypeEnum] (enum) */ - fun create(axleDesc: PxVehicleAxleDescription, roadQueryFilterData: PxQueryFilterData, roadQueryFilterCallback: PxQueryFilterCallback?, materialFrictions: PxVehiclePhysXMaterialFriction, nbMaterialFrictions: Int, defaultFriction: Float, physxActorCMassLocalPose: PxTransform, actorGeometry: PxGeometry, physxActorBoxShapeLocalPose: PxTransform, roadGeometryQueryType: PxVehiclePhysXRoadGeometryQueryTypeEnum) + fun create(axleDesc: PxVehicleAxleDescription, roadQueryFilterData: PxQueryFilterData, roadQueryFilterCallback: PxQueryFilterCallback?, materialFrictions: PxVehiclePhysXMaterialFriction, nbMaterialFrictions: Int, defaultFriction: Float, physxActorCMassLocalPose: PxTransform, actorGeometry: PxGeometry, physxActorBoxShapeLocalPose: PxTransform, roadGeometryQueryType: Int) } -fun PhysXIntegrationParams(_module: dynamic = PhysXJsLoader.physXJs): PhysXIntegrationParams = js("new _module.PhysXIntegrationParams()") +fun PhysXIntegrationParams(_module: JsAny = PhysXJsLoader.physXJs): PhysXIntegrationParams = js("new _module.PhysXIntegrationParams()") -fun PhysXIntegrationParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PhysXIntegrationParams = js("_module.wrapPointer(ptr, _module.PhysXIntegrationParams)") - -fun PhysXIntegrationParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun PhysXIntegrationParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PhysXIntegrationParams = js("_module.wrapPointer(ptr, _module.PhysXIntegrationParams)") inline fun PhysXIntegrationParams.getPhysxMaterialFrictionParams(index: Int) = get_physxMaterialFrictionParams(index) inline fun PhysXIntegrationParams.setPhysxMaterialFrictionParams(index: Int, value: PxVehiclePhysXMaterialFrictionParams) = set_physxMaterialFrictionParams(index, value) @@ -3258,7 +2997,9 @@ inline fun PhysXIntegrationParams.setPhysxSuspensionLimitConstraintParams(index: inline fun PhysXIntegrationParams.getPhysxWheelShapeLocalPoses(index: Int) = get_physxWheelShapeLocalPoses(index) inline fun PhysXIntegrationParams.setPhysxWheelShapeLocalPoses(index: Int, value: PxTransform) = set_physxWheelShapeLocalPoses(index, value) -external interface PhysXIntegrationState { +fun PhysXIntegrationParams.create(axleDesc: PxVehicleAxleDescription, roadQueryFilterData: PxQueryFilterData, roadQueryFilterCallback: PxQueryFilterCallback?, materialFrictions: PxVehiclePhysXMaterialFriction, nbMaterialFrictions: Int, defaultFriction: Float, physxActorCMassLocalPose: PxTransform, actorGeometry: PxGeometry, physxActorBoxShapeLocalPose: PxTransform, roadGeometryQueryType: PxVehiclePhysXRoadGeometryQueryTypeEnum) = create(axleDesc, roadQueryFilterData, roadQueryFilterCallback, materialFrictions, nbMaterialFrictions, defaultFriction, physxActorCMassLocalPose, actorGeometry, physxActorBoxShapeLocalPose, roadGeometryQueryType.value) + +external interface PhysXIntegrationState : JsAny, DestroyableNative { /** * Native object address. */ @@ -3292,15 +3033,11 @@ external interface PhysXIntegrationState { } -fun PhysXIntegrationState(_module: dynamic = PhysXJsLoader.physXJs): PhysXIntegrationState = js("new _module.PhysXIntegrationState()") +fun PhysXIntegrationState(_module: JsAny = PhysXJsLoader.physXJs): PhysXIntegrationState = js("new _module.PhysXIntegrationState()") -fun PhysXIntegrationStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PhysXIntegrationState = js("_module.wrapPointer(ptr, _module.PhysXIntegrationState)") +fun PhysXIntegrationStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PhysXIntegrationState = js("_module.wrapPointer(ptr, _module.PhysXIntegrationState)") -fun PhysXIntegrationState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface DirectDrivetrainParams { +external interface DirectDrivetrainParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -3328,15 +3065,11 @@ external interface DirectDrivetrainParams { } -fun DirectDrivetrainParams(_module: dynamic = PhysXJsLoader.physXJs): DirectDrivetrainParams = js("new _module.DirectDrivetrainParams()") - -fun DirectDrivetrainParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): DirectDrivetrainParams = js("_module.wrapPointer(ptr, _module.DirectDrivetrainParams)") +fun DirectDrivetrainParams(_module: JsAny = PhysXJsLoader.physXJs): DirectDrivetrainParams = js("new _module.DirectDrivetrainParams()") -fun DirectDrivetrainParams.destroy() { - PhysXJsLoader.destroy(this) -} +fun DirectDrivetrainParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): DirectDrivetrainParams = js("_module.wrapPointer(ptr, _module.DirectDrivetrainParams)") -external interface DirectDrivetrainState { +external interface DirectDrivetrainState : JsAny, DestroyableNative { /** * Native object address. */ @@ -3352,18 +3085,14 @@ external interface DirectDrivetrainState { } -fun DirectDrivetrainState(_module: dynamic = PhysXJsLoader.physXJs): DirectDrivetrainState = js("new _module.DirectDrivetrainState()") - -fun DirectDrivetrainStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): DirectDrivetrainState = js("_module.wrapPointer(ptr, _module.DirectDrivetrainState)") +fun DirectDrivetrainState(_module: JsAny = PhysXJsLoader.physXJs): DirectDrivetrainState = js("new _module.DirectDrivetrainState()") -fun DirectDrivetrainState.destroy() { - PhysXJsLoader.destroy(this) -} +fun DirectDrivetrainStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): DirectDrivetrainState = js("_module.wrapPointer(ptr, _module.DirectDrivetrainState)") inline fun DirectDrivetrainState.getDirectDriveThrottleResponseStates(index: Int) = get_directDriveThrottleResponseStates(index) inline fun DirectDrivetrainState.setDirectDriveThrottleResponseStates(index: Int, value: Float) = set_directDriveThrottleResponseStates(index, value) -external interface EngineDrivetrainParams { +external interface EngineDrivetrainParams : JsAny, DestroyableNative { /** * Native object address. */ @@ -3419,15 +3148,11 @@ external interface EngineDrivetrainParams { } -fun EngineDrivetrainParams(_module: dynamic = PhysXJsLoader.physXJs): EngineDrivetrainParams = js("new _module.EngineDrivetrainParams()") +fun EngineDrivetrainParams(_module: JsAny = PhysXJsLoader.physXJs): EngineDrivetrainParams = js("new _module.EngineDrivetrainParams()") -fun EngineDrivetrainParamsFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): EngineDrivetrainParams = js("_module.wrapPointer(ptr, _module.EngineDrivetrainParams)") +fun EngineDrivetrainParamsFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): EngineDrivetrainParams = js("_module.wrapPointer(ptr, _module.EngineDrivetrainParams)") -fun EngineDrivetrainParams.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface EngineDrivetrainState { +external interface EngineDrivetrainState : JsAny, DestroyableNative { /** * Native object address. */ @@ -3470,15 +3195,11 @@ external interface EngineDrivetrainState { } -fun EngineDrivetrainState(_module: dynamic = PhysXJsLoader.physXJs): EngineDrivetrainState = js("new _module.EngineDrivetrainState()") +fun EngineDrivetrainState(_module: JsAny = PhysXJsLoader.physXJs): EngineDrivetrainState = js("new _module.EngineDrivetrainState()") -fun EngineDrivetrainStateFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): EngineDrivetrainState = js("_module.wrapPointer(ptr, _module.EngineDrivetrainState)") +fun EngineDrivetrainStateFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): EngineDrivetrainState = js("_module.wrapPointer(ptr, _module.EngineDrivetrainState)") -fun EngineDrivetrainState.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface BaseVehicle { +external interface BaseVehicle : JsAny, DestroyableNative { /** * Native object address. */ @@ -3521,13 +3242,9 @@ external interface BaseVehicle { } -fun BaseVehicleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): BaseVehicle = js("_module.wrapPointer(ptr, _module.BaseVehicle)") - -fun BaseVehicle.destroy() { - PhysXJsLoader.destroy(this) -} +fun BaseVehicleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): BaseVehicle = js("_module.wrapPointer(ptr, _module.BaseVehicle)") -external interface PhysXActorVehicle : BaseVehicle { +external interface PhysXActorVehicle : JsAny, DestroyableNative, BaseVehicle { /** * WebIDL type: [PhysXIntegrationParams] (Value) */ @@ -3551,13 +3268,9 @@ external interface PhysXActorVehicle : BaseVehicle { } -fun PhysXActorVehicleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): PhysXActorVehicle = js("_module.wrapPointer(ptr, _module.PhysXActorVehicle)") - -fun PhysXActorVehicle.destroy() { - PhysXJsLoader.destroy(this) -} +fun PhysXActorVehicleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): PhysXActorVehicle = js("_module.wrapPointer(ptr, _module.PhysXActorVehicle)") -external interface DirectDriveVehicle : PhysXActorVehicle { +external interface DirectDriveVehicle : JsAny, DestroyableNative, PhysXActorVehicle { /** * WebIDL type: [DirectDrivetrainParams] (Value) */ @@ -3595,15 +3308,11 @@ external interface DirectDriveVehicle : PhysXActorVehicle { } -fun DirectDriveVehicle(_module: dynamic = PhysXJsLoader.physXJs): DirectDriveVehicle = js("new _module.DirectDriveVehicle()") +fun DirectDriveVehicle(_module: JsAny = PhysXJsLoader.physXJs): DirectDriveVehicle = js("new _module.DirectDriveVehicle()") -fun DirectDriveVehicleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): DirectDriveVehicle = js("_module.wrapPointer(ptr, _module.DirectDriveVehicle)") +fun DirectDriveVehicleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): DirectDriveVehicle = js("_module.wrapPointer(ptr, _module.DirectDriveVehicle)") -fun DirectDriveVehicle.destroy() { - PhysXJsLoader.destroy(this) -} - -external interface EngineDriveVehicle : PhysXActorVehicle { +external interface EngineDriveVehicle : JsAny, DestroyableNative, PhysXActorVehicle { /** * WebIDL type: [EngineDrivetrainParams] (Value) */ @@ -3623,7 +3332,7 @@ external interface EngineDriveVehicle : PhysXActorVehicle { /** * WebIDL type: [EngineDriveVehicleEnum] (enum) */ - var differentialType: EngineDriveVehicleEnum + var differentialType: Int /** * @param physics WebIDL type: [PxPhysics] (Ref) @@ -3632,7 +3341,7 @@ external interface EngineDriveVehicle : PhysXActorVehicle { * @param differentialType WebIDL type: [EngineDriveVehicleEnum] (enum) * @return WebIDL type: boolean */ - fun initialize(physics: PxPhysics, params: PxCookingParams, defaultMaterial: PxMaterial, differentialType: EngineDriveVehicleEnum): Boolean + fun initialize(physics: PxPhysics, params: PxCookingParams, defaultMaterial: PxMaterial, differentialType: Int): Boolean /** * @param physics WebIDL type: [PxPhysics] (Ref) @@ -3642,7 +3351,7 @@ external interface EngineDriveVehicle : PhysXActorVehicle { * @param addPhysXBeginEndComponents WebIDL type: boolean * @return WebIDL type: boolean */ - fun initialize(physics: PxPhysics, params: PxCookingParams, defaultMaterial: PxMaterial, differentialType: EngineDriveVehicleEnum, addPhysXBeginEndComponents: Boolean): Boolean + fun initialize(physics: PxPhysics, params: PxCookingParams, defaultMaterial: PxMaterial, differentialType: Int, addPhysXBeginEndComponents: Boolean): Boolean /** * @param addPhysXBeginEndComponents WebIDL type: boolean @@ -3651,129 +3360,272 @@ external interface EngineDriveVehicle : PhysXActorVehicle { } -fun EngineDriveVehicle(_module: dynamic = PhysXJsLoader.physXJs): EngineDriveVehicle = js("new _module.EngineDriveVehicle()") +fun EngineDriveVehicle(_module: JsAny = PhysXJsLoader.physXJs): EngineDriveVehicle = js("new _module.EngineDriveVehicle()") -fun EngineDriveVehicleFromPointer(ptr: Int, _module: dynamic = PhysXJsLoader.physXJs): EngineDriveVehicle = js("_module.wrapPointer(ptr, _module.EngineDriveVehicle)") +fun EngineDriveVehicleFromPointer(ptr: Int, _module: JsAny = PhysXJsLoader.physXJs): EngineDriveVehicle = js("_module.wrapPointer(ptr, _module.EngineDriveVehicle)") -fun EngineDriveVehicle.destroy() { - PhysXJsLoader.destroy(this) -} +var EngineDriveVehicle.differentialTypeEnum: EngineDriveVehicleEnum + get() = EngineDriveVehicleEnum.forValue(differentialType) + set(value) { differentialType = value.value } + +fun EngineDriveVehicle.initialize(physics: PxPhysics, params: PxCookingParams, defaultMaterial: PxMaterial, differentialType: EngineDriveVehicleEnum) = initialize(physics, params, defaultMaterial, differentialType.value) +fun EngineDriveVehicle.initialize(physics: PxPhysics, params: PxCookingParams, defaultMaterial: PxMaterial, differentialType: EngineDriveVehicleEnum, addPhysXBeginEndComponents: Boolean) = initialize(physics, params, defaultMaterial, differentialType.value, addPhysXBeginEndComponents) value class PxVehicleAxesEnum private constructor(val value: Int) { companion object { - val ePosX: PxVehicleAxesEnum = PxVehicleAxesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleAxesEnum_ePosX()) - val eNegX: PxVehicleAxesEnum = PxVehicleAxesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleAxesEnum_eNegX()) - val ePosY: PxVehicleAxesEnum = PxVehicleAxesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleAxesEnum_ePosY()) - val eNegY: PxVehicleAxesEnum = PxVehicleAxesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleAxesEnum_eNegY()) - val ePosZ: PxVehicleAxesEnum = PxVehicleAxesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleAxesEnum_ePosZ()) - val eNegZ: PxVehicleAxesEnum = PxVehicleAxesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleAxesEnum_eNegZ()) + val ePosX: PxVehicleAxesEnum = PxVehicleAxesEnum(PxVehicleAxesEnum_ePosX(PhysXJsLoader.physXJs)) + val eNegX: PxVehicleAxesEnum = PxVehicleAxesEnum(PxVehicleAxesEnum_eNegX(PhysXJsLoader.physXJs)) + val ePosY: PxVehicleAxesEnum = PxVehicleAxesEnum(PxVehicleAxesEnum_ePosY(PhysXJsLoader.physXJs)) + val eNegY: PxVehicleAxesEnum = PxVehicleAxesEnum(PxVehicleAxesEnum_eNegY(PhysXJsLoader.physXJs)) + val ePosZ: PxVehicleAxesEnum = PxVehicleAxesEnum(PxVehicleAxesEnum_ePosZ(PhysXJsLoader.physXJs)) + val eNegZ: PxVehicleAxesEnum = PxVehicleAxesEnum(PxVehicleAxesEnum_eNegZ(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + ePosX.value -> ePosX + eNegX.value -> eNegX + ePosY.value -> ePosY + eNegY.value -> eNegY + ePosZ.value -> ePosZ + eNegZ.value -> eNegZ + else -> error("Invalid enum value $value for enum PxVehicleAxesEnum") + } } } +private fun PxVehicleAxesEnum_ePosX(module: JsAny): Int = js("module._emscripten_enum_PxVehicleAxesEnum_ePosX()") +private fun PxVehicleAxesEnum_eNegX(module: JsAny): Int = js("module._emscripten_enum_PxVehicleAxesEnum_eNegX()") +private fun PxVehicleAxesEnum_ePosY(module: JsAny): Int = js("module._emscripten_enum_PxVehicleAxesEnum_ePosY()") +private fun PxVehicleAxesEnum_eNegY(module: JsAny): Int = js("module._emscripten_enum_PxVehicleAxesEnum_eNegY()") +private fun PxVehicleAxesEnum_ePosZ(module: JsAny): Int = js("module._emscripten_enum_PxVehicleAxesEnum_ePosZ()") +private fun PxVehicleAxesEnum_eNegZ(module: JsAny): Int = js("module._emscripten_enum_PxVehicleAxesEnum_eNegZ()") + value class PxVehicleClutchAccuracyModeEnum private constructor(val value: Int) { companion object { - val eESTIMATE: PxVehicleClutchAccuracyModeEnum = PxVehicleClutchAccuracyModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleClutchAccuracyModeEnum_eESTIMATE()) - val eBEST_POSSIBLE: PxVehicleClutchAccuracyModeEnum = PxVehicleClutchAccuracyModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleClutchAccuracyModeEnum_eBEST_POSSIBLE()) + val eESTIMATE: PxVehicleClutchAccuracyModeEnum = PxVehicleClutchAccuracyModeEnum(PxVehicleClutchAccuracyModeEnum_eESTIMATE(PhysXJsLoader.physXJs)) + val eBEST_POSSIBLE: PxVehicleClutchAccuracyModeEnum = PxVehicleClutchAccuracyModeEnum(PxVehicleClutchAccuracyModeEnum_eBEST_POSSIBLE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eESTIMATE.value -> eESTIMATE + eBEST_POSSIBLE.value -> eBEST_POSSIBLE + else -> error("Invalid enum value $value for enum PxVehicleClutchAccuracyModeEnum") + } } } +private fun PxVehicleClutchAccuracyModeEnum_eESTIMATE(module: JsAny): Int = js("module._emscripten_enum_PxVehicleClutchAccuracyModeEnum_eESTIMATE()") +private fun PxVehicleClutchAccuracyModeEnum_eBEST_POSSIBLE(module: JsAny): Int = js("module._emscripten_enum_PxVehicleClutchAccuracyModeEnum_eBEST_POSSIBLE()") + value class PxVehicleCommandNonLinearResponseParamsEnum private constructor(val value: Int) { companion object { - val eMAX_NB_COMMAND_VALUES: PxVehicleCommandNonLinearResponseParamsEnum = PxVehicleCommandNonLinearResponseParamsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleCommandNonLinearResponseParamsEnum_eMAX_NB_COMMAND_VALUES()) + val eMAX_NB_COMMAND_VALUES: PxVehicleCommandNonLinearResponseParamsEnum = PxVehicleCommandNonLinearResponseParamsEnum(PxVehicleCommandNonLinearResponseParamsEnum_eMAX_NB_COMMAND_VALUES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eMAX_NB_COMMAND_VALUES.value -> eMAX_NB_COMMAND_VALUES + else -> error("Invalid enum value $value for enum PxVehicleCommandNonLinearResponseParamsEnum") + } } } +private fun PxVehicleCommandNonLinearResponseParamsEnum_eMAX_NB_COMMAND_VALUES(module: JsAny): Int = js("module._emscripten_enum_PxVehicleCommandNonLinearResponseParamsEnum_eMAX_NB_COMMAND_VALUES()") + value class PxVehicleCommandValueResponseTableEnum private constructor(val value: Int) { companion object { - val eMAX_NB_SPEED_RESPONSES: PxVehicleCommandValueResponseTableEnum = PxVehicleCommandValueResponseTableEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleCommandValueResponseTableEnum_eMAX_NB_SPEED_RESPONSES()) + val eMAX_NB_SPEED_RESPONSES: PxVehicleCommandValueResponseTableEnum = PxVehicleCommandValueResponseTableEnum(PxVehicleCommandValueResponseTableEnum_eMAX_NB_SPEED_RESPONSES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eMAX_NB_SPEED_RESPONSES.value -> eMAX_NB_SPEED_RESPONSES + else -> error("Invalid enum value $value for enum PxVehicleCommandValueResponseTableEnum") + } } } +private fun PxVehicleCommandValueResponseTableEnum_eMAX_NB_SPEED_RESPONSES(module: JsAny): Int = js("module._emscripten_enum_PxVehicleCommandValueResponseTableEnum_eMAX_NB_SPEED_RESPONSES()") + value class PxVehicleDirectDriveTransmissionCommandStateEnum private constructor(val value: Int) { companion object { - val eREVERSE: PxVehicleDirectDriveTransmissionCommandStateEnum = PxVehicleDirectDriveTransmissionCommandStateEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleDirectDriveTransmissionCommandStateEnum_eREVERSE()) - val eNEUTRAL: PxVehicleDirectDriveTransmissionCommandStateEnum = PxVehicleDirectDriveTransmissionCommandStateEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleDirectDriveTransmissionCommandStateEnum_eNEUTRAL()) - val eFORWARD: PxVehicleDirectDriveTransmissionCommandStateEnum = PxVehicleDirectDriveTransmissionCommandStateEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleDirectDriveTransmissionCommandStateEnum_eFORWARD()) + val eREVERSE: PxVehicleDirectDriveTransmissionCommandStateEnum = PxVehicleDirectDriveTransmissionCommandStateEnum(PxVehicleDirectDriveTransmissionCommandStateEnum_eREVERSE(PhysXJsLoader.physXJs)) + val eNEUTRAL: PxVehicleDirectDriveTransmissionCommandStateEnum = PxVehicleDirectDriveTransmissionCommandStateEnum(PxVehicleDirectDriveTransmissionCommandStateEnum_eNEUTRAL(PhysXJsLoader.physXJs)) + val eFORWARD: PxVehicleDirectDriveTransmissionCommandStateEnum = PxVehicleDirectDriveTransmissionCommandStateEnum(PxVehicleDirectDriveTransmissionCommandStateEnum_eFORWARD(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eREVERSE.value -> eREVERSE + eNEUTRAL.value -> eNEUTRAL + eFORWARD.value -> eFORWARD + else -> error("Invalid enum value $value for enum PxVehicleDirectDriveTransmissionCommandStateEnum") + } } } +private fun PxVehicleDirectDriveTransmissionCommandStateEnum_eREVERSE(module: JsAny): Int = js("module._emscripten_enum_PxVehicleDirectDriveTransmissionCommandStateEnum_eREVERSE()") +private fun PxVehicleDirectDriveTransmissionCommandStateEnum_eNEUTRAL(module: JsAny): Int = js("module._emscripten_enum_PxVehicleDirectDriveTransmissionCommandStateEnum_eNEUTRAL()") +private fun PxVehicleDirectDriveTransmissionCommandStateEnum_eFORWARD(module: JsAny): Int = js("module._emscripten_enum_PxVehicleDirectDriveTransmissionCommandStateEnum_eFORWARD()") + value class PxVehicleEngineDriveTransmissionCommandStateEnum private constructor(val value: Int) { companion object { - val eAUTOMATIC_GEAR: PxVehicleEngineDriveTransmissionCommandStateEnum = PxVehicleEngineDriveTransmissionCommandStateEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleEngineDriveTransmissionCommandStateEnum_eAUTOMATIC_GEAR()) + val eAUTOMATIC_GEAR: PxVehicleEngineDriveTransmissionCommandStateEnum = PxVehicleEngineDriveTransmissionCommandStateEnum(PxVehicleEngineDriveTransmissionCommandStateEnum_eAUTOMATIC_GEAR(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eAUTOMATIC_GEAR.value -> eAUTOMATIC_GEAR + else -> error("Invalid enum value $value for enum PxVehicleEngineDriveTransmissionCommandStateEnum") + } } } +private fun PxVehicleEngineDriveTransmissionCommandStateEnum_eAUTOMATIC_GEAR(module: JsAny): Int = js("module._emscripten_enum_PxVehicleEngineDriveTransmissionCommandStateEnum_eAUTOMATIC_GEAR()") + value class PxVehicleGearboxParamsEnum private constructor(val value: Int) { companion object { - val eMAX_NB_GEARS: PxVehicleGearboxParamsEnum = PxVehicleGearboxParamsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleGearboxParamsEnum_eMAX_NB_GEARS()) + val eMAX_NB_GEARS: PxVehicleGearboxParamsEnum = PxVehicleGearboxParamsEnum(PxVehicleGearboxParamsEnum_eMAX_NB_GEARS(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eMAX_NB_GEARS.value -> eMAX_NB_GEARS + else -> error("Invalid enum value $value for enum PxVehicleGearboxParamsEnum") + } } } +private fun PxVehicleGearboxParamsEnum_eMAX_NB_GEARS(module: JsAny): Int = js("module._emscripten_enum_PxVehicleGearboxParamsEnum_eMAX_NB_GEARS()") + value class PxVehicleLimitsEnum private constructor(val value: Int) { companion object { - val eMAX_NB_WHEELS: PxVehicleLimitsEnum = PxVehicleLimitsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleLimitsEnum_eMAX_NB_WHEELS()) - val eMAX_NB_AXLES: PxVehicleLimitsEnum = PxVehicleLimitsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleLimitsEnum_eMAX_NB_AXLES()) + val eMAX_NB_WHEELS: PxVehicleLimitsEnum = PxVehicleLimitsEnum(PxVehicleLimitsEnum_eMAX_NB_WHEELS(PhysXJsLoader.physXJs)) + val eMAX_NB_AXLES: PxVehicleLimitsEnum = PxVehicleLimitsEnum(PxVehicleLimitsEnum_eMAX_NB_AXLES(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eMAX_NB_WHEELS.value -> eMAX_NB_WHEELS + eMAX_NB_AXLES.value -> eMAX_NB_AXLES + else -> error("Invalid enum value $value for enum PxVehicleLimitsEnum") + } } } +private fun PxVehicleLimitsEnum_eMAX_NB_WHEELS(module: JsAny): Int = js("module._emscripten_enum_PxVehicleLimitsEnum_eMAX_NB_WHEELS()") +private fun PxVehicleLimitsEnum_eMAX_NB_AXLES(module: JsAny): Int = js("module._emscripten_enum_PxVehicleLimitsEnum_eMAX_NB_AXLES()") + value class PxVehiclePhysXActorUpdateModeEnum private constructor(val value: Int) { companion object { - val eAPPLY_VELOCITY: PxVehiclePhysXActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXActorUpdateModeEnum_eAPPLY_VELOCITY()) - val eAPPLY_ACCELERATION: PxVehiclePhysXActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXActorUpdateModeEnum_eAPPLY_ACCELERATION()) + val eAPPLY_VELOCITY: PxVehiclePhysXActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum(PxVehiclePhysXActorUpdateModeEnum_eAPPLY_VELOCITY(PhysXJsLoader.physXJs)) + val eAPPLY_ACCELERATION: PxVehiclePhysXActorUpdateModeEnum = PxVehiclePhysXActorUpdateModeEnum(PxVehiclePhysXActorUpdateModeEnum_eAPPLY_ACCELERATION(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eAPPLY_VELOCITY.value -> eAPPLY_VELOCITY + eAPPLY_ACCELERATION.value -> eAPPLY_ACCELERATION + else -> error("Invalid enum value $value for enum PxVehiclePhysXActorUpdateModeEnum") + } } } +private fun PxVehiclePhysXActorUpdateModeEnum_eAPPLY_VELOCITY(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXActorUpdateModeEnum_eAPPLY_VELOCITY()") +private fun PxVehiclePhysXActorUpdateModeEnum_eAPPLY_ACCELERATION(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXActorUpdateModeEnum_eAPPLY_ACCELERATION()") + value class PxVehiclePhysXConstraintLimitsEnum private constructor(val value: Int) { companion object { - val eNB_DOFS_PER_PXCONSTRAINT: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_PXCONSTRAINT()) - val eNB_DOFS_PER_WHEEL: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_WHEEL()) - val eNB_WHEELS_PER_PXCONSTRAINT: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_WHEELS_PER_PXCONSTRAINT()) - val eNB_CONSTRAINTS_PER_VEHICLE: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_CONSTRAINTS_PER_VEHICLE()) + val eNB_DOFS_PER_PXCONSTRAINT: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_PXCONSTRAINT(PhysXJsLoader.physXJs)) + val eNB_DOFS_PER_WHEEL: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_WHEEL(PhysXJsLoader.physXJs)) + val eNB_WHEELS_PER_PXCONSTRAINT: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PxVehiclePhysXConstraintLimitsEnum_eNB_WHEELS_PER_PXCONSTRAINT(PhysXJsLoader.physXJs)) + val eNB_CONSTRAINTS_PER_VEHICLE: PxVehiclePhysXConstraintLimitsEnum = PxVehiclePhysXConstraintLimitsEnum(PxVehiclePhysXConstraintLimitsEnum_eNB_CONSTRAINTS_PER_VEHICLE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNB_DOFS_PER_PXCONSTRAINT.value -> eNB_DOFS_PER_PXCONSTRAINT + eNB_DOFS_PER_WHEEL.value -> eNB_DOFS_PER_WHEEL + eNB_WHEELS_PER_PXCONSTRAINT.value -> eNB_WHEELS_PER_PXCONSTRAINT + eNB_CONSTRAINTS_PER_VEHICLE.value -> eNB_CONSTRAINTS_PER_VEHICLE + else -> error("Invalid enum value $value for enum PxVehiclePhysXConstraintLimitsEnum") + } } } +private fun PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_PXCONSTRAINT(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_PXCONSTRAINT()") +private fun PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_WHEEL(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_DOFS_PER_WHEEL()") +private fun PxVehiclePhysXConstraintLimitsEnum_eNB_WHEELS_PER_PXCONSTRAINT(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_WHEELS_PER_PXCONSTRAINT()") +private fun PxVehiclePhysXConstraintLimitsEnum_eNB_CONSTRAINTS_PER_VEHICLE(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXConstraintLimitsEnum_eNB_CONSTRAINTS_PER_VEHICLE()") + value class PxVehiclePhysXRoadGeometryQueryTypeEnum private constructor(val value: Int) { companion object { - val eNONE: PxVehiclePhysXRoadGeometryQueryTypeEnum = PxVehiclePhysXRoadGeometryQueryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXRoadGeometryQueryTypeEnum_eNONE()) - val eRAYCAST: PxVehiclePhysXRoadGeometryQueryTypeEnum = PxVehiclePhysXRoadGeometryQueryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXRoadGeometryQueryTypeEnum_eRAYCAST()) - val eSWEEP: PxVehiclePhysXRoadGeometryQueryTypeEnum = PxVehiclePhysXRoadGeometryQueryTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXRoadGeometryQueryTypeEnum_eSWEEP()) + val eNONE: PxVehiclePhysXRoadGeometryQueryTypeEnum = PxVehiclePhysXRoadGeometryQueryTypeEnum(PxVehiclePhysXRoadGeometryQueryTypeEnum_eNONE(PhysXJsLoader.physXJs)) + val eRAYCAST: PxVehiclePhysXRoadGeometryQueryTypeEnum = PxVehiclePhysXRoadGeometryQueryTypeEnum(PxVehiclePhysXRoadGeometryQueryTypeEnum_eRAYCAST(PhysXJsLoader.physXJs)) + val eSWEEP: PxVehiclePhysXRoadGeometryQueryTypeEnum = PxVehiclePhysXRoadGeometryQueryTypeEnum(PxVehiclePhysXRoadGeometryQueryTypeEnum_eSWEEP(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eNONE.value -> eNONE + eRAYCAST.value -> eRAYCAST + eSWEEP.value -> eSWEEP + else -> error("Invalid enum value $value for enum PxVehiclePhysXRoadGeometryQueryTypeEnum") + } } } +private fun PxVehiclePhysXRoadGeometryQueryTypeEnum_eNONE(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXRoadGeometryQueryTypeEnum_eNONE()") +private fun PxVehiclePhysXRoadGeometryQueryTypeEnum_eRAYCAST(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXRoadGeometryQueryTypeEnum_eRAYCAST()") +private fun PxVehiclePhysXRoadGeometryQueryTypeEnum_eSWEEP(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXRoadGeometryQueryTypeEnum_eSWEEP()") + value class PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum private constructor(val value: Int) { companion object { - val eSUSPENSION: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eSUSPENSION()) - val eROAD_GEOMETRY_NORMAL: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eROAD_GEOMETRY_NORMAL()) - val eNONE: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eNONE()) + val eSUSPENSION: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum(PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eSUSPENSION(PhysXJsLoader.physXJs)) + val eROAD_GEOMETRY_NORMAL: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum(PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eROAD_GEOMETRY_NORMAL(PhysXJsLoader.physXJs)) + val eNONE: PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum = PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum(PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eNONE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eSUSPENSION.value -> eSUSPENSION + eROAD_GEOMETRY_NORMAL.value -> eROAD_GEOMETRY_NORMAL + eNONE.value -> eNONE + else -> error("Invalid enum value $value for enum PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum") + } } } +private fun PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eSUSPENSION(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eSUSPENSION()") +private fun PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eROAD_GEOMETRY_NORMAL(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eROAD_GEOMETRY_NORMAL()") +private fun PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eNONE(module: JsAny): Int = js("module._emscripten_enum_PxVehiclePhysXSuspensionLimitConstraintParamsDirectionSpecifierEnum_eNONE()") + value class PxVehicleSimulationContextTypeEnum private constructor(val value: Int) { companion object { - val eDEFAULT: PxVehicleSimulationContextTypeEnum = PxVehicleSimulationContextTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleSimulationContextTypeEnum_eDEFAULT()) - val ePHYSX: PxVehicleSimulationContextTypeEnum = PxVehicleSimulationContextTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleSimulationContextTypeEnum_ePHYSX()) + val eDEFAULT: PxVehicleSimulationContextTypeEnum = PxVehicleSimulationContextTypeEnum(PxVehicleSimulationContextTypeEnum_eDEFAULT(PhysXJsLoader.physXJs)) + val ePHYSX: PxVehicleSimulationContextTypeEnum = PxVehicleSimulationContextTypeEnum(PxVehicleSimulationContextTypeEnum_ePHYSX(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eDEFAULT.value -> eDEFAULT + ePHYSX.value -> ePHYSX + else -> error("Invalid enum value $value for enum PxVehicleSimulationContextTypeEnum") + } } } +private fun PxVehicleSimulationContextTypeEnum_eDEFAULT(module: JsAny): Int = js("module._emscripten_enum_PxVehicleSimulationContextTypeEnum_eDEFAULT()") +private fun PxVehicleSimulationContextTypeEnum_ePHYSX(module: JsAny): Int = js("module._emscripten_enum_PxVehicleSimulationContextTypeEnum_ePHYSX()") + value class PxVehicleSuspensionJounceCalculationTypeEnum private constructor(val value: Int) { companion object { - val eRAYCAST: PxVehicleSuspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleSuspensionJounceCalculationTypeEnum_eRAYCAST()) - val eSWEEP: PxVehicleSuspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleSuspensionJounceCalculationTypeEnum_eSWEEP()) + val eRAYCAST: PxVehicleSuspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum(PxVehicleSuspensionJounceCalculationTypeEnum_eRAYCAST(PhysXJsLoader.physXJs)) + val eSWEEP: PxVehicleSuspensionJounceCalculationTypeEnum = PxVehicleSuspensionJounceCalculationTypeEnum(PxVehicleSuspensionJounceCalculationTypeEnum_eSWEEP(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eRAYCAST.value -> eRAYCAST + eSWEEP.value -> eSWEEP + else -> error("Invalid enum value $value for enum PxVehicleSuspensionJounceCalculationTypeEnum") + } } } +private fun PxVehicleSuspensionJounceCalculationTypeEnum_eRAYCAST(module: JsAny): Int = js("module._emscripten_enum_PxVehicleSuspensionJounceCalculationTypeEnum_eRAYCAST()") +private fun PxVehicleSuspensionJounceCalculationTypeEnum_eSWEEP(module: JsAny): Int = js("module._emscripten_enum_PxVehicleSuspensionJounceCalculationTypeEnum_eSWEEP()") + value class PxVehicleTireDirectionModesEnum private constructor(val value: Int) { companion object { - val eLONGITUDINAL: PxVehicleTireDirectionModesEnum = PxVehicleTireDirectionModesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleTireDirectionModesEnum_eLONGITUDINAL()) - val eLATERAL: PxVehicleTireDirectionModesEnum = PxVehicleTireDirectionModesEnum(PhysXJsLoader.physXJs._emscripten_enum_PxVehicleTireDirectionModesEnum_eLATERAL()) + val eLONGITUDINAL: PxVehicleTireDirectionModesEnum = PxVehicleTireDirectionModesEnum(PxVehicleTireDirectionModesEnum_eLONGITUDINAL(PhysXJsLoader.physXJs)) + val eLATERAL: PxVehicleTireDirectionModesEnum = PxVehicleTireDirectionModesEnum(PxVehicleTireDirectionModesEnum_eLATERAL(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eLONGITUDINAL.value -> eLONGITUDINAL + eLATERAL.value -> eLATERAL + else -> error("Invalid enum value $value for enum PxVehicleTireDirectionModesEnum") + } } } +private fun PxVehicleTireDirectionModesEnum_eLONGITUDINAL(module: JsAny): Int = js("module._emscripten_enum_PxVehicleTireDirectionModesEnum_eLONGITUDINAL()") +private fun PxVehicleTireDirectionModesEnum_eLATERAL(module: JsAny): Int = js("module._emscripten_enum_PxVehicleTireDirectionModesEnum_eLATERAL()") + value class EngineDriveVehicleEnum private constructor(val value: Int) { companion object { - val eDIFFTYPE_FOURWHEELDRIVE: EngineDriveVehicleEnum = EngineDriveVehicleEnum(PhysXJsLoader.physXJs._emscripten_enum_EngineDriveVehicleEnum_eDIFFTYPE_FOURWHEELDRIVE()) - val eDIFFTYPE_MULTIWHEELDRIVE: EngineDriveVehicleEnum = EngineDriveVehicleEnum(PhysXJsLoader.physXJs._emscripten_enum_EngineDriveVehicleEnum_eDIFFTYPE_MULTIWHEELDRIVE()) - val eDIFFTYPE_TANKDRIVE: EngineDriveVehicleEnum = EngineDriveVehicleEnum(PhysXJsLoader.physXJs._emscripten_enum_EngineDriveVehicleEnum_eDIFFTYPE_TANKDRIVE()) + val eDIFFTYPE_FOURWHEELDRIVE: EngineDriveVehicleEnum = EngineDriveVehicleEnum(EngineDriveVehicleEnum_eDIFFTYPE_FOURWHEELDRIVE(PhysXJsLoader.physXJs)) + val eDIFFTYPE_MULTIWHEELDRIVE: EngineDriveVehicleEnum = EngineDriveVehicleEnum(EngineDriveVehicleEnum_eDIFFTYPE_MULTIWHEELDRIVE(PhysXJsLoader.physXJs)) + val eDIFFTYPE_TANKDRIVE: EngineDriveVehicleEnum = EngineDriveVehicleEnum(EngineDriveVehicleEnum_eDIFFTYPE_TANKDRIVE(PhysXJsLoader.physXJs)) + fun forValue(value: Int) = when(value) { + eDIFFTYPE_FOURWHEELDRIVE.value -> eDIFFTYPE_FOURWHEELDRIVE + eDIFFTYPE_MULTIWHEELDRIVE.value -> eDIFFTYPE_MULTIWHEELDRIVE + eDIFFTYPE_TANKDRIVE.value -> eDIFFTYPE_TANKDRIVE + else -> error("Invalid enum value $value for enum EngineDriveVehicleEnum") + } } } +private fun EngineDriveVehicleEnum_eDIFFTYPE_FOURWHEELDRIVE(module: JsAny): Int = js("module._emscripten_enum_EngineDriveVehicleEnum_eDIFFTYPE_FOURWHEELDRIVE()") +private fun EngineDriveVehicleEnum_eDIFFTYPE_MULTIWHEELDRIVE(module: JsAny): Int = js("module._emscripten_enum_EngineDriveVehicleEnum_eDIFFTYPE_MULTIWHEELDRIVE()") +private fun EngineDriveVehicleEnum_eDIFFTYPE_TANKDRIVE(module: JsAny): Int = js("module._emscripten_enum_EngineDriveVehicleEnum_eDIFFTYPE_TANKDRIVE()") + diff --git a/kool-physics/src/webMain/kotlin/physx/prototypes/Prototypes.kt b/kool-physics/src/webMain/kotlin/physx/prototypes/Prototypes.kt new file mode 100644 index 000000000..cc89a7d37 --- /dev/null +++ b/kool-physics/src/webMain/kotlin/physx/prototypes/Prototypes.kt @@ -0,0 +1,59 @@ +@file:Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE", "unused") + +package physx.prototypes + +import physx.* +import kotlin.js.JsAny +import kotlin.js.js + +val NativeArrayHelpers: NativeArrayHelpers = NativeArrayHelpers(PhysXJsLoader.physXJs) +private fun NativeArrayHelpers(module: JsAny): NativeArrayHelpers = js("module.NativeArrayHelpers.prototype") + +val PxCollectionExt: PxCollectionExt = PxCollectionExt(PhysXJsLoader.physXJs) +private fun PxCollectionExt(module: JsAny): PxCollectionExt = js("module.PxCollectionExt.prototype") + +val PxConvexCoreGeometryFactory: PxConvexCoreGeometryFactory = PxConvexCoreGeometryFactory(PhysXJsLoader.physXJs) +private fun PxConvexCoreGeometryFactory(module: JsAny): PxConvexCoreGeometryFactory = js("module.PxConvexCoreGeometryFactory.prototype") + +val PxExtensionTopLevelFunctions: PxExtensionTopLevelFunctions = PxExtensionTopLevelFunctions(PhysXJsLoader.physXJs) +private fun PxExtensionTopLevelFunctions(module: JsAny): PxExtensionTopLevelFunctions = js("module.PxExtensionTopLevelFunctions.prototype") + +val PxGeometryQuery: PxGeometryQuery = PxGeometryQuery(PhysXJsLoader.physXJs) +private fun PxGeometryQuery(module: JsAny): PxGeometryQuery = js("module.PxGeometryQuery.prototype") + +val PxGjkQuery: PxGjkQuery = PxGjkQuery(PhysXJsLoader.physXJs) +private fun PxGjkQuery(module: JsAny): PxGjkQuery = js("module.PxGjkQuery.prototype") + +val PxGjkQueryExt: PxGjkQueryExt = PxGjkQueryExt(PhysXJsLoader.physXJs) +private fun PxGjkQueryExt(module: JsAny): PxGjkQueryExt = js("module.PxGjkQueryExt.prototype") + +val PxRigidActorExt: PxRigidActorExt = PxRigidActorExt(PhysXJsLoader.physXJs) +private fun PxRigidActorExt(module: JsAny): PxRigidActorExt = js("module.PxRigidActorExt.prototype") + +val PxRigidBodyExt: PxRigidBodyExt = PxRigidBodyExt(PhysXJsLoader.physXJs) +private fun PxRigidBodyExt(module: JsAny): PxRigidBodyExt = js("module.PxRigidBodyExt.prototype") + +val PxSerialization: PxSerialization = PxSerialization(PhysXJsLoader.physXJs) +private fun PxSerialization(module: JsAny): PxSerialization = js("module.PxSerialization.prototype") + +val PxShapeExt: PxShapeExt = PxShapeExt(PhysXJsLoader.physXJs) +private fun PxShapeExt(module: JsAny): PxShapeExt = js("module.PxShapeExt.prototype") + +val PxTetMaker: PxTetMaker = PxTetMaker(PhysXJsLoader.physXJs) +private fun PxTetMaker(module: JsAny): PxTetMaker = js("module.PxTetMaker.prototype") + +val PxTetrahedronMeshExt: PxTetrahedronMeshExt = PxTetrahedronMeshExt(PhysXJsLoader.physXJs) +private fun PxTetrahedronMeshExt(module: JsAny): PxTetrahedronMeshExt = js("module.PxTetrahedronMeshExt.prototype") + +val PxTopLevelFunctions: PxTopLevelFunctions = PxTopLevelFunctions(PhysXJsLoader.physXJs) +private fun PxTopLevelFunctions(module: JsAny): PxTopLevelFunctions = js("module.PxTopLevelFunctions.prototype") + +val PxVehicleTireForceParamsExt: PxVehicleTireForceParamsExt = PxVehicleTireForceParamsExt(PhysXJsLoader.physXJs) +private fun PxVehicleTireForceParamsExt(module: JsAny): PxVehicleTireForceParamsExt = js("module.PxVehicleTireForceParamsExt.prototype") + +val PxVehicleTopLevelFunctions: PxVehicleTopLevelFunctions = PxVehicleTopLevelFunctions(PhysXJsLoader.physXJs) +private fun PxVehicleTopLevelFunctions(module: JsAny): PxVehicleTopLevelFunctions = js("module.PxVehicleTopLevelFunctions.prototype") + +val SupportFunctions: SupportFunctions = SupportFunctions(PhysXJsLoader.physXJs) +private fun SupportFunctions(module: JsAny): SupportFunctions = js("module.SupportFunctions.prototype") +