Skip to content

Commit

Permalink
Merge pull request #648 from baaahs/apps-kapow
Browse files Browse the repository at this point in the history
Stuff to support apps
  • Loading branch information
xian authored Dec 8, 2024
2 parents 39512ca + 71ab04b commit d142fa5
Show file tree
Hide file tree
Showing 425 changed files with 4,252 additions and 1,392 deletions.
25 changes: 21 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# Kotlin:
.kotlin

# Gradle:
.gradle
build

# IntelliJ/JetBrains:
.idea
.gradle
node_modules

# Mac:
.DS_Store
.kotlin
.java-version

# JDK:
.java-version

# JS:
node_modules

# Android
local.properties

# iOS/Swift/Xcode:
xcuserdata/
7 changes: 1 addition & 6 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
object Versions {
const val kotlin = "2.0.21"
const val kotlinGradlePlugin = kotlin
const val dokka = "1.7.10"

const val lwjgl = "3.3.1"

const val kotlinWrappers = "1.0.0-pre.816"
const val kotlinWrappers = "1.0.0-pre.804"

// Test:
const val junit = "5.11.3"
Expand Down
2 changes: 1 addition & 1 deletion data/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"runningShowPath":"BRC 2024.sparkle","runningScenePath":"BAAAHS.scene","version":0}
{"runningShowPath":"BRC 2024.sparkle","runningScenePath":"Living Room 2.scene","version":0}
8 changes: 2 additions & 6 deletions ext/three/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("multiplatform") version Versions.kotlin
alias(libs.plugins.kotlinMultiplatform)
}

group = "org.baaahs"
Expand All @@ -8,17 +8,13 @@ version = "0.0.1"
fun kotlinw(target: String): String =
"org.jetbrains.kotlin-wrappers:kotlin-$target:${Versions.kotlinWrappers}"

repositories {
mavenCentral()
}

kotlin {
js(IR) {
browser()
}

sourceSets {
val jsMain by getting {
jsMain {
dependencies {
implementation(kotlinw("browser-js"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ external interface GeometryGroup {
set(value) = definedExternally
}

external interface `T$12` {
@nativeGetter
operator fun get(name: String): Array<dynamic /* BufferAttribute | InterleavedBufferAttribute */>?
@nativeSetter
operator fun set(name: String, value: Array<dynamic /* BufferAttribute | InterleavedBufferAttribute */>)
}
external interface `T$12`

open external class BufferGeometry<Attributes : NormalOrGLBufferAttributes> : EventDispatcher/*<`T$8`>*/ {
open var id: Number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
@file:JsNonModule
package three

external interface `T$88` {
@nativeGetter
operator fun get(id: String): Array<Number>?
@nativeSetter
operator fun set(id: String, value: Array<Number>)
}
external interface `T$88`

open external class CameraHelper(camera: Camera) : LineSegments<BufferGeometry<NormalBufferAttributes>, dynamic> {
override var override: Any
Expand Down
7 changes: 1 addition & 6 deletions ext/three/src/jsMain/kotlin/three/Loader.module_three.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ package three
import org.w3c.xhr.ProgressEvent
import kotlin.js.Promise

external interface `T$89` {
@nativeGetter
operator fun get(header: String): String?
@nativeSetter
operator fun set(header: String, value: String)
}
external interface `T$89`

open external class Loader<TData, TUrl>(manager: LoadingManager = definedExternally) {
open var crossOrigin: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ import org.w3c.performance.*
import org.w3c.workers.*
import org.w3c.xhr.*

external interface `T$90` {
@nativeGetter
operator fun get(key: String): Texture?
@nativeSetter
operator fun set(key: String, value: Texture)
}
external interface `T$90`

open external class MaterialLoader(manager: LoadingManager = definedExternally) : Loader__1<Material> {
open var textures: `T$90`
Expand Down
7 changes: 1 addition & 6 deletions ext/three/src/jsMain/kotlin/three/Mesh.module_three.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ external interface MeshJSON : Object3DJSON {
// override var `object`: MeshJSONObject
}

external interface `T$31` {
@nativeGetter
operator fun get(key: String): Number?
@nativeSetter
operator fun set(key: String, value: Number)
}
external interface `T$31`

open external class Mesh<TGeometry : BufferGeometry<NormalBufferAttributes>, TMaterial/*, TEventMap : Object3DEventMap*/>(geometry: TGeometry = definedExternally, material: TMaterial = definedExternally) : Object3D/*<Object3DEventMap>*/ {
open val isMesh: Boolean
Expand Down
135 changes: 135 additions & 0 deletions ext/three/src/jsMain/kotlin/three/NativeAccessors.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
@file:Suppress("NOTHING_TO_INLINE", "UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")

package three

import three.addons.GLTFLoaderPlugin
import three.addons.MTLLoader
import three.addons.MaterialInfo

inline operator fun `T$12`.get(name: String): Array<dynamic /* BufferAttribute | InterleavedBufferAttribute */>? =
asDynamic()[name] as? Array<dynamic /* BufferAttribute | InterleavedBufferAttribute */>

inline operator fun `T$12`.set(name: String, value: Array<dynamic /* BufferAttribute | InterleavedBufferAttribute */>) {
asDynamic()[name] = value
}

inline operator fun `T$16`.get(define: String): dynamic /* String? | Number? | Boolean? */ =
asDynamic()[define]

inline operator fun `T$16`.set(define: String, value: String) {
asDynamic()[define] = value
}

inline operator fun `T$16`.set(define: String, value: Number) {
asDynamic()[define] = value
}

inline operator fun `T$16`.set(define: String, value: Boolean) {
asDynamic()[define] = value
}

inline operator fun `T$17`.get(uniform: String): IUniform__0? =
asDynamic()[uniform] as? IUniform__0

inline operator fun `T$17`.set(uniform: String, value: IUniform__0) {
asDynamic()[uniform] = value
}

inline operator fun `T$31`.get(key: String): Number? =
asDynamic()[key] as? Number

inline operator fun `T$31`.set(key: String, value: Number) {
asDynamic()[key] = value
}

inline operator fun `T$79`.get(name: String): GLTFLoaderPlugin? =
asDynamic()[name] as? GLTFLoaderPlugin

inline operator fun `T$79`.set(name: String, value: GLTFLoaderPlugin) {
asDynamic()[name] = value
}

inline operator fun `T$88`.get(id: String): Array<Number>? =
asDynamic()[id] as? Array<Number>

inline operator fun `T$88`.set(id: String, value: Array<Number>) {
asDynamic()[id] = value
}

inline operator fun `T$89`.get(header: String): String? =
asDynamic()[header] as? String

inline operator fun `T$89`.set(header: String, value: String) {
asDynamic()[header] = value
}

inline operator fun `T$90`.get(key: String): Texture? =
asDynamic()[key] as? Texture

inline operator fun `T$90`.set(key: String, value: Texture) {
asDynamic()[key] = value
}

inline operator fun `T$91`.get(key: String): dynamic /* InstancedBufferGeometry? | BufferGeometry<NormalBufferAttributes>? */ =
asDynamic()[key]

inline operator fun `T$91`.set(key: String, value: InstancedBufferGeometry) {
asDynamic()[key] = value
}

inline operator fun `T$91`.set(key: String, value: BufferGeometry<NormalBufferAttributes>) {
asDynamic()[key] = value
}

inline operator fun `T$92`.get(key: String): Material? =
asDynamic()[key] as? Material

inline operator fun `T$92`.set(key: String, value: Material) {
asDynamic()[key] = value
}

inline operator fun `T$93`.get(key: String): AnimationClip? =
asDynamic()[key] as? AnimationClip

inline operator fun `T$93`.set(key: String, value: AnimationClip) {
asDynamic()[key] = value
}

inline operator fun `T$94`.get(key: String): Source? =
asDynamic()[key] as? Source

inline operator fun `T$94`.set(key: String, value: Source) {
asDynamic()[key] = value
}

inline operator fun ShaderLib.get(name: String): ShaderLibShader? =
asDynamic()[name] as? ShaderLibShader

inline operator fun ShaderLib.set(name: String, value: ShaderLibShader) {
asDynamic()[name] = value
}

// Nested interfaces:

inline operator fun MTLLoader.`T$82`.get(key: String): MaterialInfo? =
asDynamic()[key] as? MaterialInfo

inline operator fun MTLLoader.`T$82`.set(key: String, value: MaterialInfo) {
asDynamic()[key] = value
}

inline operator fun MTLLoader.`T$83`.get(key: String): Material? =
asDynamic()[key] as? Material

inline operator fun MTLLoader.`T$83`.set(key: String, value: Material) {
asDynamic()[key] = value
}

// three.addons:

inline operator fun three.addons.`T$88`.get(name: String): `T$54`? =
asDynamic()[name] as? `T$54`

inline operator fun three.addons.`T$88`.set(name: String, value: `T$54`) {
asDynamic()[name] = value
}
33 changes: 4 additions & 29 deletions ext/three/src/jsMain/kotlin/three/ObjectLoader.module_three.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,10 @@ package three
import org.w3c.xhr.ProgressEvent
import kotlin.js.Promise

external interface `T$91` {
@nativeGetter
operator fun get(key: String): dynamic /* InstancedBufferGeometry? | BufferGeometry<NormalBufferAttributes>? */
@nativeSetter
operator fun set(key: String, value: InstancedBufferGeometry)
@nativeSetter
operator fun set(key: String, value: BufferGeometry<NormalBufferAttributes>)
}

external interface `T$92` {
@nativeGetter
operator fun get(key: String): Material?
@nativeSetter
operator fun set(key: String, value: Material)
}

external interface `T$93` {
@nativeGetter
operator fun get(key: String): AnimationClip?
@nativeSetter
operator fun set(key: String, value: AnimationClip)
}

external interface `T$94` {
@nativeGetter
operator fun get(key: String): Source?
@nativeSetter
operator fun set(key: String, value: Source)
}
external interface `T$91`
external interface `T$92`
external interface `T$93`
external interface `T$94`

open external class ObjectLoader(manager: LoadingManager = definedExternally) : Loader__1<Object3D/*<Object3DEventMap>*/> {
override fun load(url: String, onLoad: (data: Object3D/*<Object3DEventMap>*/) -> Unit, onProgress: (event: ProgressEvent) -> Unit, onError: (err: Any) -> Unit)
Expand Down
4 changes: 0 additions & 4 deletions ext/three/src/jsMain/kotlin/three/ShaderLib.module_three.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ external interface ShaderLibShader {
}

external object ShaderLib {
@nativeGetter
operator fun get(name: String): ShaderLibShader?
@nativeSetter
operator fun set(name: String, value: ShaderLibShader)
var basic: ShaderLibShader
var lambert: ShaderLibShader
var phong: ShaderLibShader
Expand Down
18 changes: 2 additions & 16 deletions ext/three/src/jsMain/kotlin/three/WebGLPrograms.module_three.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ import org.w3c.performance.*
import org.w3c.workers.*
import org.w3c.xhr.*

external interface `T$16` {
@nativeGetter
operator fun get(define: String): dynamic /* String? | Number? | Boolean? */
@nativeSetter
operator fun set(define: String, value: String)
@nativeSetter
operator fun set(define: String, value: Number)
@nativeSetter
operator fun set(define: String, value: Boolean)
}
external interface `T$16`

external interface WebGLProgramParameters {
var shaderID: String
Expand Down Expand Up @@ -209,12 +200,7 @@ external interface WebGLProgramParameters {
var customProgramCacheKey: String
}

external interface `T$17` {
@nativeGetter
operator fun get(uniform: String): IUniform__0?
@nativeSetter
operator fun set(uniform: String, value: IUniform__0)
}
external interface `T$17`

external interface WebGLProgramParametersWithUniforms : WebGLProgramParameters {
var uniforms: `T$17`
Expand Down
1 change: 0 additions & 1 deletion ext/three/src/jsMain/kotlin/three/addons/3DMLoader.d.ts.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS")
package three.addons

import org.khronos.webgl.ArrayBuffer
Expand Down
1 change: 0 additions & 1 deletion ext/three/src/jsMain/kotlin/three/addons/3MFLoader.d.ts.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS")
package three.addons

import org.khronos.webgl.ArrayBuffer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS")
package three.addons

import three.IUniform
Expand Down
1 change: 0 additions & 1 deletion ext/three/src/jsMain/kotlin/three/addons/AMFLoader.d.ts.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS")
package three.addons

import org.khronos.webgl.ArrayBuffer
Expand Down
Loading

0 comments on commit d142fa5

Please sign in to comment.