kitgit

tirbofish/dropbear · commit

3b8f08e43b03ef03f676ec91ea33eef48220caa5

wip: animation wip: animation scripting feature: implemented puffin profiler into dropbear_engine refactor: completely remade the asset server, with support for typesafe handles instead of using arbitrary values (fixes #87) refactor: model importing to be able to export in a custom format during production builds are still not available yet because the other crates are still fucked.

Unverified

Thribhu K <4tkbytes@pm.me> · 2026-02-11 10:03

view full diff

diff --git a/scripting/commonMain/kotlin/com/dropbear/asset/model/Animation.kt b/scripting/commonMain/kotlin/com/dropbear/asset/model/Animation.kt
new file mode 100644
index 0000000..226e577
--- /dev/null
+++ b/scripting/commonMain/kotlin/com/dropbear/asset/model/Animation.kt
@@ -0,0 +1,29 @@
+package com.dropbear.asset.model
+
+import com.dropbear.math.Vector3f
+import com.dropbear.math.Quaternionf
+
+data class Animation(
+    val name: String,
+    val channels: List<AnimationChannel>,
+    val duration: Float
+)
+
+data class AnimationChannel(
+    val targetNode: Int,
+    val times: DoubleArray,
+    val values: ChannelValues,
+    val interpolation: AnimationInterpolation
+)
+
+enum class AnimationInterpolation {
+    LINEAR,
+    STEP,
+    CUBICSPLINE
+}
+
+sealed class ChannelValues {
+    data class Translations(val values: List<Vector3f>) : ChannelValues()
+    data class Rotations(val values: List<Quaternionf>) : ChannelValues()
+    data class Scales(val values: List<Vector3f>) : ChannelValues()
+}
diff --git a/scripting/commonMain/kotlin/com/dropbear/asset/model/Material.kt b/scripting/commonMain/kotlin/com/dropbear/asset/model/Material.kt
new file mode 100644
index 0000000..9e1c9ce
--- /dev/null
+++ b/scripting/commonMain/kotlin/com/dropbear/asset/model/Material.kt
@@ -0,0 +1,24 @@
+package com.dropbear.asset.model
+
+import com.dropbear.asset.Texture
+import com.dropbear.math.Vector2f
+import com.dropbear.math.Vector3f
+import com.dropbear.math.Vector4f
+
+data class Material(
+    val name: String,
+    val diffuseTexture: Texture,
+    val normalTexture: Texture,
+    val tint: Vector4f,
+    val emissiveFactor: Vector3f,
+    val metallicFactor: Float,
+    val roughnessFactor: Float,
+    val alphaCutoff: Float?,
+    val doubleSided: Boolean,
+    val occlusionStrength: Float,
+    val normalScale: Float,
+    val uvTiling: Vector2f,
+    val emissiveTexture: Texture?,
+    val metallicRoughnessTexture: Texture?,
+    val occlusionTexture: Texture?
+)
diff --git a/scripting/commonMain/kotlin/com/dropbear/asset/model/ModelVertex.kt b/scripting/commonMain/kotlin/com/dropbear/asset/model/ModelVertex.kt
new file mode 100644
index 0000000..82f946c
--- /dev/null
+++ b/scripting/commonMain/kotlin/com/dropbear/asset/model/ModelVertex.kt
@@ -0,0 +1,16 @@
+package com.dropbear.asset.model
+
+import com.dropbear.math.Vector2f
+import com.dropbear.math.Vector3f
+import com.dropbear.math.Vector4f
+
+data class ModelVertex(
+    val position: Vector3f,
+    val normal: Vector3f,
+    val tangent: Vector4f,
+    val texCoords0: Vector2f,
+    val texCoords1: Vector2f,
+    val colour0: Vector4f,
+    val joints0: IntArray,
+    val weights0: Vector4f
+)
diff --git a/scripting/commonMain/kotlin/com/dropbear/asset/model/Node.kt b/scripting/commonMain/kotlin/com/dropbear/asset/model/Node.kt
new file mode 100644
index 0000000..c9b3a6a
--- /dev/null
+++ b/scripting/commonMain/kotlin/com/dropbear/asset/model/Node.kt
@@ -0,0 +1,17 @@
+package com.dropbear.asset.model
+
+import com.dropbear.math.Vector3f
+import com.dropbear.math.Quaternionf
+
+data class NodeTransform(
+    val translation: Vector3f,
+    val rotation: Quaternionf,
+    val scale: Vector3f
+)
+
+data class Node(
+    val name: String,
+    val parent: Int?,
+    val children: List<Int>,
+    val transform: NodeTransform
+)
diff --git a/scripting/commonMain/kotlin/com/dropbear/asset/model/Skin.kt b/scripting/commonMain/kotlin/com/dropbear/asset/model/Skin.kt
new file mode 100644
index 0000000..5f31487
--- /dev/null
+++ b/scripting/commonMain/kotlin/com/dropbear/asset/model/Skin.kt
@@ -0,0 +1,8 @@
+package com.dropbear.asset.model
+
+data class Skin(
+    val name: String,
+    val joints: List<Int>,
+    val inverseBindMatrices: List<DoubleArray>,
+    val skeletonRoot: Int?
+)