diff --git a/build.gradle.kts b/build.gradle.kts index c3519a2..3264b9c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ repositories { jcenter() } -version = "0.2.9" +version = "0.3.0" allprojects { group = "stan.qodat" diff --git a/qodat-api/src/main/kotlin/qodat/cache/models/RS2Model.java b/qodat-api/src/main/kotlin/qodat/cache/models/RS2Model.java index af2d97b..e77e128 100644 --- a/qodat-api/src/main/kotlin/qodat/cache/models/RS2Model.java +++ b/qodat-api/src/main/kotlin/qodat/cache/models/RS2Model.java @@ -583,19 +583,19 @@ public void setTexturePrimaryColors(short[] texturePrimaryColors) { this.texturePrimaryColors = texturePrimaryColors; } - public void setAnimayaGroups(int[][] animayaGroups) { + public void setMayaGroups(int[][] animayaGroups) { this.animayaGroups = animayaGroups; } - public void setAnimayaScales(int[][] animayaScales) { + public void setMayaScales(int[][] animayaScales) { this.animayaScales = animayaScales; } - public int[][] getAnimayaGroups() { + public int[][] getMayaGroups() { return animayaGroups; } - public int[][] getAnimayaScales() { + public int[][] getMayaScales() { return animayaScales; } diff --git a/qodat-api/src/main/kotlin/qodat/cache/models/RS2ModelBuilder.kt b/qodat-api/src/main/kotlin/qodat/cache/models/RS2ModelBuilder.kt index ec28bcb..42000bb 100644 --- a/qodat-api/src/main/kotlin/qodat/cache/models/RS2ModelBuilder.kt +++ b/qodat-api/src/main/kotlin/qodat/cache/models/RS2ModelBuilder.kt @@ -22,6 +22,7 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { private var copyFaceSkins = false private var copyFaceColors = true private var copyFaceTextures = false + private var copyMayaGroups = false private var vertexPositionsX : IntArray private var vertexPositionsY : IntArray @@ -37,6 +38,8 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { private val faceRenderPriorities: ByteArray? private val faceRenderTypes: ByteArray? private val faceSkins: IntArray? + private val mayaGroups: Array? + private val mayaScales: Array? init { for(definition in modelDefinitions){ @@ -50,6 +53,8 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { globalPriority = definition.getPriority() copyFaceSkins = copyFaceSkins or (definition.getFaceSkins() != null) copyFaceTextures = copyFaceTextures or (definition.getFaceTextures() != null) + if (definition is RS2Model) + copyMayaGroups = copyMayaGroups or (definition.mayaGroups != null) } vertexPositionsX = IntArray(vertexCount) @@ -67,6 +72,13 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { faceColors = if(copyFaceColors) ShortArray(faceCount) else null faceSkins = if(copyFaceSkins) IntArray(faceCount) else null faceTextures = if(copyFaceTextures) ShortArray(faceCount) {(-1).toShort()} else null + if(copyMayaGroups) { + mayaGroups = arrayOfNulls(vertexCount) + mayaScales = arrayOfNulls(vertexCount) + } else { + mayaGroups = null + mayaScales = null + } for(definition in modelDefinitions){ for(srcFaceIdx in 0 until definition.getFaceCount()){ @@ -101,6 +113,10 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { val skins = model.getVertexSkins() if (skins != null) vertexSkins[vertexIdx] = skins[localVertexIdx] + if (model is RS2Model) { + model.mayaGroups?.get(localVertexIdx)?.let { mayaGroups?.set(vertexIdx, it) } + model.mayaScales?.get(localVertexIdx)?.let { mayaScales?.set(vertexIdx, it) } + } return vertexIdx++ } @@ -121,6 +137,8 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { setFaceSkins(faceSkins) setFaceTextures(faceTextures) setPriority(globalPriority) + mayaGroups = this@RS2ModelBuilder.mayaGroups + mayaScales = this@RS2ModelBuilder.mayaScales } private fun ByteArray.tryCopy(srcIdx: Int, byteArray: ByteArray?) { @@ -135,4 +153,4 @@ class RS2ModelBuilder(vararg modelDefinitions: ModelDefinition) { if (shortArray != null) this[faceIdx] = shortArray[srcIdx] } -} \ No newline at end of file +} diff --git a/qodat-api/src/main/kotlin/qodat/cache/models/RSModelLoader.kt b/qodat-api/src/main/kotlin/qodat/cache/models/RSModelLoader.kt index 45e9553..1caa4cc 100644 --- a/qodat-api/src/main/kotlin/qodat/cache/models/RSModelLoader.kt +++ b/qodat-api/src/main/kotlin/qodat/cache/models/RSModelLoader.kt @@ -54,8 +54,8 @@ class RSModelLoader { setFaceTextureConfigs(it.textureCoords) faceRenderPriorities = it.faceRenderPriorities faceRenderTypes = it.faceRenderTypes - setAnimayaGroups(it.animayaGroups) - setAnimayaScales(it.animayaScales) + setMayaGroups(it.animayaGroups) + setMayaScales(it.animayaScales) } } diff --git a/src/main/kotlin/stan/qodat/scene/runescape/model/ModelSkeleton.kt b/src/main/kotlin/stan/qodat/scene/runescape/model/ModelSkeleton.kt index 9f5a5c7..8e4bc84 100644 --- a/src/main/kotlin/stan/qodat/scene/runescape/model/ModelSkeleton.kt +++ b/src/main/kotlin/stan/qodat/scene/runescape/model/ModelSkeleton.kt @@ -126,9 +126,9 @@ open class ModelSkeleton(internal val modelDefinition: ModelDefinition) val duration = anim.duration for (vertex in 0 until getVertexCount()) { - val boneIndices = modelDefinition.animayaGroups[vertex] + val boneIndices = modelDefinition.mayaGroups[vertex] if (boneIndices != null && boneIndices.isNotEmpty()) { - val scales = modelDefinition.animayaScales[vertex] + val scales = modelDefinition.mayaScales[vertex] field2703.zeroMatrix() for ((index, boneIndex) in boneIndices.withIndex()) { val bone = animSkeleton.getBone(boneIndex)