Refactor three package. Add MeshLine

This commit is contained in:
Alexander Nozik 2022-08-14 22:03:46 +03:00
parent 98bb935de5
commit cb25dca34c
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
189 changed files with 573 additions and 461 deletions

View File

@ -3,10 +3,15 @@
## [Unreleased]
### Added
- Context receivers flag
- MeshLine for thick lines
### Changed
- Naming of Canvas3D options
- Lights are added to the scene instead of 3D options
- Visions **must** be rooted in order to subscribe to updates.
- Visions use flows instead of direct subscriptions.
- Radical change of inner workings of vision children and properties.
- Three package changed to `three`.
- Naming of Canvas3D options.
- Lights are added to the scene instead of 3D options.
### Deprecated

View File

@ -1,8 +1,5 @@
package space.kscience.visionforge.solid.demo
import info.laht.threekt.core.Object3D
import info.laht.threekt.geometries.BoxGeometry
import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.meta.asValue
import space.kscience.dataforge.meta.int
import space.kscience.dataforge.meta.number
@ -13,6 +10,9 @@ import space.kscience.visionforge.setChild
import space.kscience.visionforge.solid.SolidGroup
import space.kscience.visionforge.solid.layer
import space.kscience.visionforge.solid.three.*
import three.core.Object3D
import three.geometries.BoxGeometry
import three.objects.Mesh
import kotlin.math.max
internal fun SolidGroup.varBox(

View File

@ -1,6 +1,5 @@
package space.kscience.visionforge.react
import info.laht.threekt.math.Color
import kotlinx.css.margin
import kotlinx.css.pct
import kotlinx.css.px
@ -25,6 +24,7 @@ import space.kscience.visionforge.widgetType
import styled.css
import styled.styledInput
import styled.styledSelect
import three.math.Color
public external interface ValueChooserProps : Props {
public var descriptor: MetaDescriptor?

View File

@ -10,7 +10,11 @@ import space.kscience.visionforge.*
public class PolyLine(public val points: List<Point3D>) : SolidBase<PolyLine>() {
//var lineType by string()
public var thickness: Number by properties.getProperty(SolidMaterial.MATERIAL_KEY).number { 1.0 }
public var thickness: Number by properties.root(inherit = false, includeStyles = true).number { DEFAULT_THICKNESS }
public companion object {
public const val DEFAULT_THICKNESS: Double = 1.0
}
}
@VisionBuilder

View File

@ -12,4 +12,5 @@ dependencies {
api(project(":visionforge-solid"))
implementation(npm("three", "0.143.0"))
implementation(npm("three-csg-ts", "3.1.10"))
implementation(npm("three.meshline","1.4.0"))
}

View File

@ -1,8 +0,0 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.core
import info.laht.threekt.math.Vector2
external class Shape(points: Array<Vector2>) : Path

View File

@ -1,6 +0,0 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.core
external class ShapePath

View File

@ -1,8 +0,0 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
import info.laht.threekt.core.BufferGeometry
public external class EdgesGeometry(geometry: BufferGeometry, thresholdAngle: Int = definedExternally) : BufferGeometry

View File

@ -1,9 +0,0 @@
@file:Suppress("FunctionName")
package info.laht.threekt
import info.laht.threekt.renderers.WebGLRenderer
import info.laht.threekt.renderers.WebGLRendererParams
fun WebGLRenderer(builder: WebGLRendererParams.() -> Unit): WebGLRenderer =
WebGLRenderer(WebGLRendererParams().apply(builder))

View File

@ -1,8 +1,8 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.lights.AmbientLight
import info.laht.threekt.math.Color
import space.kscience.visionforge.solid.AmbientLightSource
import three.lights.AmbientLight
import three.math.Color
import kotlin.reflect.KClass
public object ThreeAmbientLightFactory : ThreeFactory<AmbientLightSource> {

View File

@ -1,8 +1,8 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.geometries.BoxGeometry
import space.kscience.visionforge.solid.Box
import space.kscience.visionforge.solid.detail
import three.geometries.BoxGeometry
public object ThreeBoxFactory : ThreeMeshFactory<Box>(Box::class) {
override fun buildGeometry(obj: Box): BoxGeometry =

View File

@ -1,18 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.WebGLRenderer
import info.laht.threekt.cameras.PerspectiveCamera
import info.laht.threekt.core.Object3D
import info.laht.threekt.core.Raycaster
import info.laht.threekt.external.controls.OrbitControls
import info.laht.threekt.external.controls.TrackballControls
import info.laht.threekt.geometries.EdgesGeometry
import info.laht.threekt.helpers.AxesHelper
import info.laht.threekt.materials.LineBasicMaterial
import info.laht.threekt.math.*
import info.laht.threekt.objects.LineSegments
import info.laht.threekt.objects.Mesh
import info.laht.threekt.scenes.Scene
import kotlinx.browser.window
import org.w3c.dom.Element
import org.w3c.dom.HTMLCanvasElement
@ -25,8 +12,19 @@ import space.kscience.dataforge.names.*
import space.kscience.visionforge.Colors
import space.kscience.visionforge.solid.Solid
import space.kscience.visionforge.solid.specifications.*
import space.kscience.visionforge.solid.three.ThreeMaterials.HIGHLIGHT_MATERIAL
import space.kscience.visionforge.solid.three.ThreeMaterials.SELECTED_MATERIAL
import three.WebGLRenderer
import three.cameras.PerspectiveCamera
import three.core.Object3D
import three.core.Raycaster
import three.external.controls.OrbitControls
import three.external.controls.TrackballControls
import three.geometries.EdgesGeometry
import three.helpers.AxesHelper
import three.math.*
import three.meshline.MeshLine
import three.meshline.MeshLineMaterial
import three.objects.Mesh
import three.scenes.Scene
import kotlin.math.cos
import kotlin.math.sin
@ -278,7 +276,7 @@ public class ThreeCanvas(
private fun Object3D.toggleHighlight(
highlight: Boolean,
edgesName: String,
material: LineBasicMaterial = SELECTED_MATERIAL,
material: MeshLineMaterial,
) {
if (userData[DO_NOT_HIGHLIGHT_TAG] == true) {
@ -286,8 +284,8 @@ public class ThreeCanvas(
}
if (isMesh(this)) {
val highlightMesh = getObjectByName(edgesName) ?: LineSegments(
EdgesGeometry(geometry),
val highlightMesh = getObjectByName(edgesName) ?: Mesh(
MeshLine(EdgesGeometry(geometry)),
material
).also {
it.name = edgesName
@ -319,6 +317,19 @@ public class ThreeCanvas(
}
public companion object {
public val SELECTED_MATERIAL: MeshLineMaterial = MeshLineMaterial().apply {
color.set(Colors.ivory)
linewidth = 2.0
cached = true
}
public val HIGHLIGHT_MATERIAL: MeshLineMaterial = MeshLineMaterial().apply {
color.set(Colors.blue)
linewidth = 2.0
cached = true
}
public const val DO_NOT_HIGHLIGHT_TAG: String = "doNotHighlight"
private const val HIGHLIGHT_NAME = "@highlight"
private const val SELECT_NAME = "@select"

View File

@ -1,11 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.DoubleSide
import info.laht.threekt.core.Object3D
import info.laht.threekt.geometries.PlaneGeometry
import info.laht.threekt.materials.MeshBasicMaterial
import info.laht.threekt.objects.Mesh
import info.laht.threekt.textures.Texture
import kotlinx.browser.document
import org.w3c.dom.CanvasRenderingContext2D
import org.w3c.dom.CanvasTextBaseline
@ -14,6 +8,12 @@ import org.w3c.dom.MIDDLE
import space.kscience.visionforge.solid.SolidLabel
import space.kscience.visionforge.solid.SolidMaterial
import space.kscience.visionforge.solid.three.ThreeCanvas.Companion.DO_NOT_HIGHLIGHT_TAG
import three.DoubleSide
import three.core.Object3D
import three.geometries.PlaneGeometry
import three.materials.MeshBasicMaterial
import three.objects.Mesh
import three.textures.Texture
import kotlin.reflect.KClass
/**

View File

@ -1,11 +1,11 @@
package space.kscience.visionforge.solid.three
import CSG
import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.names.startsWith
import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.solid.Composite
import space.kscience.visionforge.solid.CompositeType
import three.objects.Mesh
import kotlin.reflect.KClass
/**

View File

@ -1,9 +1,9 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.geometries.CylinderGeometry
import space.kscience.visionforge.solid.ConeSegment
import space.kscience.visionforge.solid.detail
import three.core.BufferGeometry
import three.geometries.CylinderGeometry
import kotlin.math.PI
import kotlin.math.pow

View File

@ -1,7 +1,7 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.external.geometries.ConvexBufferGeometry
import space.kscience.visionforge.solid.Convex
import three.external.geometries.ConvexBufferGeometry
public object ThreeConvexFactory : ThreeMeshFactory<Convex>(Convex::class) {
override fun buildGeometry(obj: Convex): ConvexBufferGeometry {

View File

@ -1,8 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.core.Object3D
import info.laht.threekt.math.Euler
import space.kscience.dataforge.misc.Type
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.startsWith
@ -11,6 +8,9 @@ import space.kscience.visionforge.solid.*
import space.kscience.visionforge.solid.SolidMaterial.Companion.MATERIAL_KEY
import space.kscience.visionforge.solid.three.ThreeFactory.Companion.TYPE
import space.kscience.visionforge.visible
import three.core.BufferGeometry
import three.core.Object3D
import three.math.Euler
import kotlin.reflect.KClass
/**

View File

@ -1,8 +1,8 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.core.Float32BufferAttribute
import info.laht.threekt.math.Vector3
import three.core.BufferGeometry
import three.core.Float32BufferAttribute
import three.math.Vector3
import space.kscience.dataforge.meta.Meta
import space.kscience.visionforge.solid.GeometryBuilder
import space.kscience.visionforge.solid.Point3D

View File

@ -1,6 +1,6 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.Object3D
import three.core.Object3D
import space.kscience.visionforge.solid.SolidBase
/**

View File

@ -1,9 +1,9 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.Object3D
import info.laht.threekt.geometries.TextBufferGeometry
import info.laht.threekt.objects.Mesh
import three.core.Object3D
import three.geometries.TextBufferGeometry
import three.objects.Mesh
import kotlinx.js.jso
import space.kscience.dataforge.context.logger
import space.kscience.dataforge.context.warn

View File

@ -1,9 +1,9 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.core.Object3D
import info.laht.threekt.math.Color
import info.laht.threekt.objects.LineSegments
import three.core.BufferGeometry
import three.core.Object3D
import three.math.Color
import three.objects.LineSegments
import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.solid.PolyLine
import space.kscience.visionforge.solid.SolidMaterial

View File

@ -1,11 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.materials.LineBasicMaterial
import info.laht.threekt.materials.Material
import info.laht.threekt.materials.MeshBasicMaterial
import info.laht.threekt.materials.MeshStandardMaterial
import info.laht.threekt.math.Color
import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName
@ -16,6 +10,12 @@ import space.kscience.visionforge.getStyleNodes
import space.kscience.visionforge.solid.ColorAccessor
import space.kscience.visionforge.solid.SolidMaterial
import space.kscience.visionforge.solid.SolidReference
import three.materials.LineBasicMaterial
import three.materials.Material
import three.materials.MeshBasicMaterial
import three.materials.MeshStandardMaterial
import three.math.Color
import three.objects.Mesh
public object ThreeMaterials {
@ -37,18 +37,6 @@ public object ThreeMaterials {
cached = true
}
public val SELECTED_MATERIAL: LineBasicMaterial = LineBasicMaterial().apply {
color.set(Colors.ivory)
linewidth = 2.0
cached = true
}
public val HIGHLIGHT_MATERIAL: LineBasicMaterial = LineBasicMaterial().apply {
color.set(Colors.blue)
linewidth = 2.0
cached = true
}
private val lineMaterialCache = HashMap<Int, LineBasicMaterial>()
private fun buildLineMaterial(meta: Meta): LineBasicMaterial = LineBasicMaterial().apply {
@ -124,7 +112,7 @@ public fun ColorAccessor.threeColor(): Color? {
}
}
private var Material.cached: Boolean
internal var Material.cached: Boolean
get() = userData["cached"] == true
set(value) {
userData["cached"] = value

View File

@ -1,9 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.geometries.EdgesGeometry
import info.laht.threekt.objects.LineSegments
import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.meta.boolean
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName
@ -18,6 +14,10 @@ import space.kscience.visionforge.solid.layer
import space.kscience.visionforge.solid.three.ThreeMeshFactory.Companion.EDGES_ENABLED_KEY
import space.kscience.visionforge.solid.three.ThreeMeshFactory.Companion.EDGES_MATERIAL_KEY
import space.kscience.visionforge.solid.three.ThreeMeshFactory.Companion.EDGES_OBJECT_NAME
import three.core.BufferGeometry
import three.geometries.EdgesGeometry
import three.objects.LineSegments
import three.objects.Mesh
import kotlin.reflect.KClass
/**

View File

@ -0,0 +1,41 @@
package space.kscience.visionforge.solid.three
import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.solid.PolyLine
import space.kscience.visionforge.solid.color
import space.kscience.visionforge.solid.string
import three.core.Object3D
import three.math.Color
import three.meshline.MeshLine
import three.meshline.MeshLineMaterial
import three.objects.Mesh
import kotlin.math.ceil
import kotlin.reflect.KClass
public object ThreeMeshLineFactory : ThreeFactory<PolyLine> {
override val type: KClass<in PolyLine> get() = PolyLine::class
override fun build(three: ThreePlugin, vision: PolyLine, observe: Boolean): Object3D {
val geometry = MeshLine(
Array((vision.points.size - 1) * 2) {
vision.points[ceil(it / 2.0).toInt()].toVector()
}
)
val material = MeshLineMaterial().apply {
thickness = vision.thickness.toFloat()
color = vision.color.string?.let { Color(it) } ?: ThreeMaterials.DEFAULT_LINE_COLOR
}
return Mesh(geometry, material).apply {
updatePosition(vision)
//layers.enable(obj.layer)
//add listener to object properties
if (observe) {
vision.onPropertyChange(three.context) { propertyName ->
updateProperty(vision, propertyName)
}
}
}
}
}

View File

@ -1,6 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.Object3D
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.w3c.dom.Element
@ -15,9 +14,10 @@ import space.kscience.visionforge.VisionChildren
import space.kscience.visionforge.solid.*
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
import space.kscience.visionforge.visible
import three.core.Object3D
import kotlin.collections.set
import kotlin.reflect.KClass
import info.laht.threekt.objects.Group as ThreeGroup
import three.objects.Group as ThreeGroup
public class ThreePlugin : AbstractPlugin(), ElementVisionRenderer {
override val tag: PluginTag get() = Companion.tag
@ -35,7 +35,7 @@ public class ThreePlugin : AbstractPlugin(), ElementVisionRenderer {
objectFactories[Convex::class] = ThreeConvexFactory
objectFactories[Sphere::class] = ThreeSphereFactory
objectFactories[ConeSegment::class] = ThreeConeFactory
objectFactories[PolyLine::class] = ThreeLineFactory
objectFactories[PolyLine::class] = ThreeSmartLineFactory
objectFactories[SolidLabel::class] = ThreeCanvasLabelFactory
objectFactories[AmbientLightSource::class] = ThreeAmbientLightFactory
objectFactories[PointLightSource::class] = ThreePointLightFactory
@ -182,7 +182,7 @@ internal fun Object3D.getOrCreateGroup(name: Name): Object3D {
name.isEmpty() -> this
name.length == 1 -> {
val token = name.tokens.first()
children.find { it.name == token.toString() } ?: info.laht.threekt.objects.Group().also { group ->
children.find { it.name == token.toString() } ?: ThreeGroup().also { group ->
group.name = token.toString()
this.add(group)
}

View File

@ -1,11 +1,11 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.lights.PointLight
import info.laht.threekt.math.Color
import space.kscience.dataforge.names.asName
import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.solid.LightSource
import space.kscience.visionforge.solid.PointLightSource
import three.lights.PointLight
import three.math.Color
import kotlin.reflect.KClass
public object ThreePointLightFactory : ThreeFactory<PointLightSource> {

View File

@ -1,7 +1,5 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.Object3D
import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.cutFirst
import space.kscience.dataforge.names.firstOrNull
@ -9,6 +7,8 @@ import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.solid.Solid
import space.kscience.visionforge.solid.SolidReference
import space.kscience.visionforge.solid.SolidReference.Companion.REFERENCE_CHILD_PROPERTY_PREFIX
import three.core.Object3D
import three.objects.Mesh
import kotlin.reflect.KClass
public object ThreeReferenceFactory : ThreeFactory<SolidReference> {

View File

@ -0,0 +1,17 @@
package space.kscience.visionforge.solid.three
import space.kscience.visionforge.solid.PolyLine
import three.core.Object3D
import kotlin.reflect.KClass
public object ThreeSmartLineFactory : ThreeFactory<PolyLine> {
override val type: KClass<in PolyLine> get() = PolyLine::class
override fun build(three: ThreePlugin, vision: PolyLine, observe: Boolean): Object3D {
return if (vision.thickness == 1.0) {
ThreeLineFactory.build(three, vision, observe)
} else {
ThreeMeshLineFactory.build(three, vision, observe)
}
}
}

View File

@ -1,9 +1,9 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.geometries.SphereGeometry
import space.kscience.visionforge.solid.Sphere
import space.kscience.visionforge.solid.detail
import three.core.BufferGeometry
import three.geometries.SphereGeometry
public object ThreeSphereFactory : ThreeMeshFactory<Sphere>(Sphere::class) {
override fun buildGeometry(obj: Sphere): BufferGeometry {

View File

@ -10,10 +10,10 @@
@file:JsModule("three-csg-ts")
@file:JsNonModule
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.math.Matrix4
import info.laht.threekt.math.Vector3
import info.laht.threekt.objects.Mesh
import three.core.BufferGeometry
import three.math.Matrix4
import three.math.Vector3
import three.objects.Mesh
public external class CSG {
public fun clone(): CSG

View File

@ -1,16 +1,16 @@
package space.kscience.visionforge.solid.three
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.core.Layers
import info.laht.threekt.core.Object3D
import info.laht.threekt.external.controls.OrbitControls
import info.laht.threekt.materials.Material
import info.laht.threekt.math.Vector3
import info.laht.threekt.objects.Mesh
import info.laht.threekt.textures.Texture
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.float
import space.kscience.dataforge.meta.get
import three.core.BufferGeometry
import three.core.Layers
import three.core.Object3D
import three.external.controls.OrbitControls
import three.materials.Material
import three.math.Vector3
import three.objects.Mesh
import three.textures.Texture
import kotlin.contracts.contract
import kotlin.math.PI

View File

@ -26,7 +26,7 @@
@file:JsNonModule
@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "unused")
package info.laht.threekt
package three
external val REVISION: String

View File

@ -2,9 +2,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.animation
package three.animation
import info.laht.threekt.core.Object3D
import three.core.Object3D
external class AnimationAction(
mixer: AnimationMixer,

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.animation
package three.animation
/**
* An AnimationClip is a reusable set of keyframe tracks which represent an animation.

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.animation
package three.animation
import info.laht.threekt.core.Object3D
import three.core.Object3D
/**
* The AnimationMixer is a player for animations on a particular object in the scene.

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.animation
package three.animation
external object AnimationUtils {
//TODO

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.animation
package three.animation
import org.khronos.webgl.Float32Array

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.audio
package three.audio
/**
* Create a non-positional ( global ) audio object.

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.audio
package three.audio
/**
* This contains methods for setting up an AudioContext.

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.audio
package three.audio
import info.laht.threekt.core.Object3D
import three.core.Object3D
/**
* Create a non-positional ( global ) audio object.

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.audio
package three.audio
/**
* Create a positional audio object.

View File

@ -25,11 +25,11 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.cameras
package three.cameras
import info.laht.threekt.core.Object3D
import info.laht.threekt.math.Matrix4
import info.laht.threekt.math.Vector3
import three.core.Object3D
import three.math.Matrix4
import three.math.Vector3
external interface View {
var enabled: Boolean

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.cameras
package three.cameras
external class OrthographicCamera(
varleft: Int,

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.cameras
package three.cameras
external class PerspectiveCamera(fov: Int, aspect: Double, near: Number, far: Number) : Camera {

View File

@ -25,12 +25,12 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
import info.laht.threekt.math.Color
import info.laht.threekt.math.Vector2
import info.laht.threekt.math.Vector3
import info.laht.threekt.math.Vector4
import three.math.Color
import three.math.Vector2
import three.math.Vector3
import three.math.Vector4
abstract external class BufferAttribute protected constructor(
array: dynamic,

View File

@ -25,12 +25,12 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
import info.laht.threekt.math.Box3
import info.laht.threekt.math.Matrix4
import info.laht.threekt.math.Sphere
import info.laht.threekt.math.Vector3
import three.math.Box3
import three.math.Matrix4
import three.math.Sphere
import three.math.Vector3
/**
* This class is an efficient alternative to Geometry, because it stores all data, including vertex positions,

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
/**
* Object for keeping track of time.

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
external open class EventDispatcher {

View File

@ -25,10 +25,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
import info.laht.threekt.math.Color
import info.laht.threekt.math.Vector3
import three.math.Color
import three.math.Vector3
external class Face3 {

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
external class InstancedBufferGeometry : BufferGeometry {

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
/**
* A Layers object assigns an Object3D to 1 or more of 32 layers numbered 0 to 31 - internally the

View File

@ -26,9 +26,9 @@
@file:JsNonModule
package info.laht.threekt.core
package three.core
import info.laht.threekt.math.*
import three.math.*
/**
* This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in 3D space.

View File

@ -25,12 +25,12 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
import info.laht.threekt.cameras.Camera
import info.laht.threekt.math.Ray
import info.laht.threekt.math.Vector2
import info.laht.threekt.math.Vector3
import three.cameras.Camera
import three.math.Ray
import three.math.Vector2
import three.math.Vector3
external interface Params {
var Mesh: dynamic

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.core
package three.core
external class Uniform {

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external
package three.external
import org.w3c.dom.Element

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external
package three.external
external object ImprovedNoise {

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external
package three.external
external object SimplexNoise {

View File

@ -25,10 +25,10 @@
@file:JsModule("three/examples/jsm/controls/FlyControls.js")
@file:JsNonModule
package info.laht.threekt.external.controls
package three.external.controls
import info.laht.threekt.core.Object3D
import org.w3c.dom.Node
import three.core.Object3D
external class FlyControls(`object`: Object3D, domElement: Node = definedExternally) {

View File

@ -25,11 +25,11 @@
@file:JsModule("three/examples/jsm/controls/OrbitControls.js")
@file:JsNonModule
package info.laht.threekt.external.controls
package three.external.controls
import info.laht.threekt.core.Object3D
import info.laht.threekt.math.Vector3
import org.w3c.dom.Node
import three.core.Object3D
import three.math.Vector3
/**
* This set of controls performs orbiting, dollying (zooming), and panning.

View File

@ -9,13 +9,13 @@
@file:JsModule("three/examples/jsm/controls/TrackballControls.js")
@file:JsNonModule
package info.laht.threekt.external.controls
package three.external.controls
import info.laht.threekt.cameras.Camera
import info.laht.threekt.core.EventDispatcher
import info.laht.threekt.math.Vector3
import org.w3c.dom.HTMLElement
import org.w3c.dom.Node
import three.cameras.Camera
import three.core.EventDispatcher
import three.math.Vector3
external interface `T$0` {
var left: Number

View File

@ -25,10 +25,10 @@
@file:JsModule("three/examples/jsm/controls/TransformControls.js")
@file:JsNonModule
package info.laht.threekt.external.controls
package three.external.controls
import info.laht.threekt.core.Object3D
import org.w3c.dom.Node
import three.core.Object3D
external class TransformControls(`object`: Object3D, domElement: Node = definedExternally) : Object3D {

View File

@ -25,9 +25,9 @@
@file:JsModule("three/examples/jsm/exporters/OBJExporter.js")
@file:JsNonModule
package info.laht.threekt.external.exporters
package three.external.exporters
import info.laht.threekt.core.Object3D
import three.core.Object3D
external class OBJExporter {

View File

@ -25,10 +25,10 @@
@file:JsModule("three/examples/jsm/exporters/STLExporter.js")
@file:JsNonModule
package info.laht.threekt.external.exporters
package three.external.exporters
import info.laht.threekt.core.Object3D
import org.khronos.webgl.DataView
import three.core.Object3D
external class STLExporter {

View File

@ -1,10 +1,10 @@
@file:JsModule("three/examples/jsm/geometries/ConvexGeometry.js")
@file:JsNonModule
package info.laht.threekt.external.geometries
package three.external.geometries
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.math.Vector3
import three.core.BufferGeometry
import three.math.Vector3
external class ConvexGeometry(points: Array<Vector3>) : BufferGeometry

View File

@ -1,4 +1,4 @@
package info.laht.threekt.external.libs
package three.external.libs
/**
* @param name The name of this GUI

View File

@ -25,7 +25,7 @@
@file:JsModule("three/examples/jsm/libs/stats.module.js")
@file:JsNonModule
package info.laht.threekt.external.libs
package three.external.libs
import org.w3c.dom.Node

View File

@ -24,7 +24,7 @@
@file:JsModule("three/examples/jsm/libs/dat.gui.module.js")
@file:JsNonModule
package info.laht.threekt.external.libs
package three.external.libs
import org.w3c.dom.Element

View File

@ -25,11 +25,11 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
import info.laht.threekt.core.Object3D
import info.laht.threekt.loaders.LoadingManager
import org.w3c.xhr.XMLHttpRequest
import three.core.Object3D
import three.loaders.LoadingManager
external class BabylonLoader(
manager: LoadingManager = definedExternally

View File

@ -1,14 +1,14 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
import info.laht.threekt.animation.AnimationClip
import info.laht.threekt.cameras.Camera
import info.laht.threekt.loaders.LoadingManager
import info.laht.threekt.scenes.Scene
import org.khronos.webgl.ArrayBuffer
import org.w3c.xhr.XMLHttpRequest
import three.animation.AnimationClip
import three.cameras.Camera
import three.loaders.LoadingManager
import three.scenes.Scene
external interface GLTFOnLoadCallback {
val animations: Array<AnimationClip>

View File

@ -25,7 +25,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
external object LoaderSupport {

View File

@ -25,11 +25,11 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
import info.laht.threekt.core.Object3D
import info.laht.threekt.loaders.LoadingManager
import org.w3c.xhr.XMLHttpRequest
import three.core.Object3D
import three.loaders.LoadingManager
external class MTLLoader(
loadingManager: LoadingManager = definedExternally

View File

@ -25,12 +25,12 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
import info.laht.threekt.core.Object3D
import info.laht.threekt.loaders.LoadingManager
import info.laht.threekt.objects.Mesh
import org.w3c.xhr.XMLHttpRequest
import three.core.Object3D
import three.loaders.LoadingManager
import three.objects.Mesh
/**
* A loader for loading a .obj resource.

View File

@ -25,11 +25,11 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
import info.laht.threekt.loaders.LoadingManager
import info.laht.threekt.objects.Mesh
import org.w3c.xhr.XMLHttpRequest
import three.loaders.LoadingManager
import three.objects.Mesh
external interface Detail {
var loaderRootNode: Mesh

View File

@ -25,11 +25,11 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.loaders
package three.external.loaders
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.core.Object3D
import org.w3c.xhr.XMLHttpRequest
import three.core.BufferGeometry
import three.core.Object3D
external class STLLoader {

View File

@ -25,8 +25,8 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.objects
package three.external.objects
import info.laht.threekt.objects.Mesh
import three.objects.Mesh
external class Sky : Mesh

View File

@ -25,8 +25,8 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.external.objects
package three.external.objects
import info.laht.threekt.objects.Mesh
import three.objects.Mesh
external class Water(width: Int, height: Int, options: WaterOptions = definedExternally) : Mesh

View File

@ -22,10 +22,10 @@
* THE SOFTWARE.
*/
package info.laht.threekt.external.objects
package three.external.objects
import info.laht.threekt.math.Vector3
import info.laht.threekt.textures.Texture
import three.math.Vector3
import three.textures.Texture
data class WaterOptions(

View File

@ -1,13 +1,13 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras
package three.extras
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.core.Object3D
import info.laht.threekt.materials.Material
import info.laht.threekt.objects.Group
import info.laht.threekt.scenes.Scene
import three.core.BufferGeometry
import three.core.Object3D
import three.materials.Material
import three.objects.Group
import three.scenes.Scene
/**
* A class containing useful utility functions for scene manipulation.

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.core
package three.extras.core
external abstract class Curve<E> {

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.core
package three.extras.core
open external class CurvePath<E> : Curve<E> {

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.core
package three.extras.core
import info.laht.threekt.math.Vector2
import three.math.Vector2
open external class Path : CurvePath<Vector2> {

View File

@ -0,0 +1,8 @@
@file:JsModule("three")
@file:JsNonModule
package three.extras.core
import three.math.Vector2
external class Shape(points: Array<Vector2>) : Path

View File

@ -0,0 +1,6 @@
@file:JsModule("three")
@file:JsNonModule
package three.extras.core
external class ShapePath

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
external class ArcCurve(
aX: Number = definedExternally,

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector3
import three.extras.core.Curve
import three.math.Vector3
external class CatmullRomCurve3(

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector2
import three.extras.core.Curve
import three.math.Vector2
open external class EllipseCurve(
aX: Number = definedExternally,

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector2
import three.extras.core.Curve
import three.math.Vector2
external class LineCurve(
v1: Vector2 = definedExternally,

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector3
import three.extras.core.Curve
import three.math.Vector3
external class LineCurve3(
v1: Vector3 = definedExternally,

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector2
import three.extras.core.Curve
import three.math.Vector2
external class QuadricBezierCurve : Curve<Vector2> {

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector3
import three.extras.core.Curve
import three.math.Vector3
external class QuadricBezierCurve3 : Curve<Vector3> {

View File

@ -1,10 +1,10 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.extras.curves
package three.extras.curves
import info.laht.threekt.extras.core.Curve
import info.laht.threekt.math.Vector2
import three.extras.core.Curve
import three.math.Vector2
external class SplineCurve(
points: Array<Vector2> = definedExternally

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import three.core.BufferGeometry
external class BoxGeometry(

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import three.core.BufferGeometry
external class ConeGeometry(

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import three.core.BufferGeometry
external class CylinderGeometry(
radiusTop: Number,

View File

@ -0,0 +1,8 @@
@file:JsModule("three")
@file:JsNonModule
package three.geometries
import three.core.BufferGeometry
public external class EdgesGeometry(geometry: BufferGeometry, thresholdAngle: Int = definedExternally) : BufferGeometry

View File

@ -8,11 +8,11 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import info.laht.threekt.extras.core.Shape
import info.laht.threekt.math.Vector2
import three.core.BufferGeometry
import three.extras.core.Shape
import three.math.Vector2
external interface ExtrudeGeometryOptions {
var curveSegments: Number?

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import three.core.BufferGeometry
external class PlaneGeometry(

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import three.core.BufferGeometry
external class SphereGeometry(
radius: Number,

View File

@ -1,7 +1,7 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
external interface TextGeometryParameters {

View File

@ -1,9 +1,9 @@
@file:JsModule("three")
@file:JsNonModule
package info.laht.threekt.geometries
package three.geometries
import info.laht.threekt.core.BufferGeometry
import three.core.BufferGeometry
external class TorusGeometry(

Some files were not shown because too many files have changed in this diff Show More