-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/feature/label-mapping'
# Conflicts: # build.gradle.kts # src/main/kotlin/stan/qodat/scene/runescape/animation/Animation.kt
- Loading branch information
Showing
95 changed files
with
9,194 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 1 addition & 16 deletions
17
qodat-api/src/main/kotlin/qodat/cache/definition/AnimationFrameDefinition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
package qodat.cache.definition | ||
|
||
/** | ||
* TODO: add documentation | ||
* | ||
* @author Stan van der Bend (https://www.rune-server.ee/members/StanDev/) | ||
* @since 28/01/2021 | ||
*/ | ||
interface AnimationFrameDefinition { | ||
|
||
val transformationCount : Int | ||
val transformationGroupAccessIndices : IntArray | ||
val transformationDeltaX : IntArray | ||
val transformationDeltaY : IntArray | ||
val transformationDeltaZ : IntArray | ||
|
||
val transformationGroup : AnimationTransformationGroup | ||
} | ||
interface AnimationFrameDefinition |
18 changes: 18 additions & 0 deletions
18
qodat-api/src/main/kotlin/qodat/cache/definition/AnimationFrameLegacyDefinition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package qodat.cache.definition | ||
|
||
/** | ||
* TODO: add documentation | ||
* | ||
* @author Stan van der Bend (https://www.rune-server.ee/members/StanDev/) | ||
* @since 28/01/2021 | ||
*/ | ||
interface AnimationFrameLegacyDefinition : AnimationFrameDefinition { | ||
|
||
val transformationCount : Int | ||
val transformationGroupAccessIndices : IntArray | ||
val transformationDeltaX : IntArray | ||
val transformationDeltaY : IntArray | ||
val transformationDeltaZ : IntArray | ||
|
||
val transformationGroup : AnimationTransformationGroup | ||
} |
13 changes: 13 additions & 0 deletions
13
qodat-api/src/main/kotlin/qodat/cache/definition/AnimationMayaDefinition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package qodat.cache.definition | ||
|
||
import net.runelite.cache.definitions.SequenceDefinition | ||
|
||
interface AnimationMayaDefinition : AnimationDefinition { | ||
|
||
val animMayaID : Int | ||
val animMayaFrameSounds: Map<Int, SequenceDefinition.Sound> | ||
val animMayaStart: Int | ||
val animMayaEnd: Int | ||
val animMayaMasks: BooleanArray | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package jagex; | ||
|
||
public enum AnimationState implements MouseWheel { | ||
|
||
DEFAULT(0, 0), | ||
CUSTOM1(1, 1), | ||
CUSTOM2(2, 2), | ||
REPEAT(3, 3), | ||
MIRROR(4, 4); | ||
|
||
final int field1508; | ||
final int field1507; | ||
|
||
AnimationState(int var3, int var4) { | ||
this.field1508 = var3; | ||
this.field1507 = var4; | ||
} | ||
|
||
static AnimationState method2292(int var0) { | ||
AnimationState var1 = (AnimationState)class4.findEnumerated(method2852(), var0); | ||
if (var1 == null) { | ||
var1 = DEFAULT; | ||
} | ||
|
||
return var1; | ||
} | ||
|
||
public int rsOrdinal() { | ||
return this.field1507; | ||
} | ||
|
||
static AnimationState[] method2852() { | ||
return new AnimationState[]{AnimationState.DEFAULT, AnimationState.CUSTOM1, AnimationState.CUSTOM2, AnimationState.REPEAT, AnimationState.MIRROR}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
package jagex; | ||
|
||
public class Bone { | ||
|
||
public final int index; | ||
public Bone parentBone; | ||
float[][] rotations; | ||
final BoneTransform[] boneTransforms; | ||
BoneTransform[] computedBoneTransforms; | ||
BoneTransform[] finalBoneTransforms; | ||
BoneTransform baseTransform = new BoneTransform(); | ||
boolean baseTransformUpdate = true; | ||
BoneTransform globalTransform = new BoneTransform(); | ||
boolean globalTransformUpdated = true; | ||
BoneTransform localTransform = new BoneTransform(); | ||
float[][] inverseBindMatrices; | ||
float[][] bindMatrices; | ||
float[][] positions; | ||
|
||
public Bone(int transformCount, Buffer buffer, boolean readTransforms) { | ||
this.index = buffer.readShort(); | ||
this.boneTransforms = new BoneTransform[transformCount]; | ||
this.computedBoneTransforms = new BoneTransform[this.boneTransforms.length]; | ||
this.finalBoneTransforms = new BoneTransform[this.boneTransforms.length]; | ||
this.rotations = new float[this.boneTransforms.length][3]; | ||
|
||
for(int i = 0; i < this.boneTransforms.length; ++i) { | ||
this.boneTransforms[i] = new BoneTransform(buffer, readTransforms); | ||
this.rotations[i][0] = buffer.readIntAsFloat(); | ||
this.rotations[i][1] = buffer.readIntAsFloat(); | ||
this.rotations[i][2] = buffer.readIntAsFloat(); | ||
} | ||
|
||
this.updateTransforms(); | ||
} | ||
|
||
void updateTransforms() { | ||
this.inverseBindMatrices = new float[this.boneTransforms.length][3]; | ||
this.bindMatrices = new float[this.boneTransforms.length][3]; | ||
this.positions = new float[this.boneTransforms.length][3]; | ||
BoneTransform tempTransform; | ||
synchronized(BoneTransform.classPool) { | ||
if (BoneTransform.poolSize == 0) { | ||
tempTransform = new BoneTransform(); | ||
} else { | ||
BoneTransform.classPool[--BoneTransform.poolSize].identityMatrix(); | ||
tempTransform = BoneTransform.classPool[BoneTransform.poolSize]; | ||
} | ||
} | ||
|
||
BoneTransform transform = tempTransform; | ||
|
||
for(int i = 0; i < this.boneTransforms.length; ++i) { | ||
BoneTransform bone = this.getBoneTransform(i); | ||
transform.copy(bone); | ||
transform.normalize(); | ||
this.inverseBindMatrices[i] = transform.extractRotation(); | ||
this.bindMatrices[i][0] = bone.matrix[12]; | ||
this.bindMatrices[i][1] = bone.matrix[13]; | ||
this.bindMatrices[i][2] = bone.matrix[14]; | ||
this.positions[i] = bone.extractScale(); | ||
} | ||
|
||
transform.release(); | ||
} | ||
|
||
BoneTransform getBoneTransform(int index) { | ||
return this.boneTransforms[index]; | ||
} | ||
|
||
BoneTransform getComputedBoneTransform(int index) { | ||
if (this.computedBoneTransforms[index] == null) { | ||
this.computedBoneTransforms[index] = new BoneTransform(this.getBoneTransform(index)); | ||
if (this.parentBone != null) { | ||
this.computedBoneTransforms[index].combine(this.parentBone.getComputedBoneTransform(index)); | ||
} else { | ||
this.computedBoneTransforms[index].combine(BoneTransform.identity); | ||
} | ||
} | ||
|
||
return this.computedBoneTransforms[index]; | ||
} | ||
|
||
BoneTransform getFinalBoneTransform(int index) { | ||
if (this.finalBoneTransforms[index] == null) { | ||
this.finalBoneTransforms[index] = new BoneTransform(this.getComputedBoneTransform(index)); | ||
this.finalBoneTransforms[index].normalize(); | ||
} | ||
|
||
return this.finalBoneTransforms[index]; | ||
} | ||
|
||
void setBaseTransform(BoneTransform var1) { | ||
this.baseTransform.copy(var1); | ||
this.baseTransformUpdate = true; | ||
this.globalTransformUpdated = true; | ||
} | ||
|
||
BoneTransform getBaseTransform() { | ||
return this.baseTransform; | ||
} | ||
|
||
BoneTransform getGlobalTransform() { | ||
if (this.baseTransformUpdate) { | ||
this.globalTransform.copy(this.getBaseTransform()); | ||
if (this.parentBone != null) { | ||
this.globalTransform.combine(this.parentBone.getGlobalTransform()); | ||
} | ||
|
||
this.baseTransformUpdate = false; | ||
} | ||
|
||
return this.globalTransform; | ||
} | ||
|
||
public BoneTransform getTransform(int index) { | ||
if (this.globalTransformUpdated) { | ||
this.localTransform.copy(this.getFinalBoneTransform(index)); | ||
this.localTransform.combine(this.getGlobalTransform()); | ||
this.globalTransformUpdated = false; | ||
} | ||
|
||
return this.localTransform; | ||
} | ||
|
||
float[] getInverseBindMatrix(int index) { | ||
return this.inverseBindMatrices[index]; | ||
} | ||
|
||
float[] getBindMatrix(int index) { | ||
return this.bindMatrices[index]; | ||
} | ||
|
||
float[] getPosition(int index) { | ||
return this.positions[index]; | ||
} | ||
} |
Oops, something went wrong.