-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Forgot to push this. 46mins 22 seconds
Showing
34 changed files
with
1,738 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/assetLoading/java/gg/generationsmod/rarecandy/FileLocator.java
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,19 @@ | ||
package gg.generationsmod.rarecandy; | ||
|
||
import java.awt.image.BufferedImage; | ||
|
||
/** | ||
* Method to find and locate files based on the name of the file. | ||
*/ | ||
@FunctionalInterface | ||
public interface FileLocator { | ||
|
||
byte[] getFile(String name); | ||
|
||
/** | ||
* Expects a Native Byte Buffer | ||
*/ | ||
default BufferedImage readImage(String name) { | ||
return null; | ||
} | ||
} |
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,6 @@ | ||
package gg.generationsmod.rarecandy; | ||
|
||
public record Pair<K, V>( | ||
K a, | ||
V b | ||
) {} |
162 changes: 162 additions & 0 deletions
162
src/assetLoading/java/gg/generationsmod/rarecandy/assimp/AssimpModelLoader.java
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,162 @@ | ||
package gg.generationsmod.rarecandy.assimp; | ||
|
||
import gg.generationsmod.rarecandy.FileLocator; | ||
import gg.generationsmod.rarecandy.model.Mesh; | ||
import gg.generationsmod.rarecandy.model.Model; | ||
import gg.generationsmod.rarecandy.model.animation.BoneNode; | ||
import gg.generationsmod.rarecandy.model.animation.Skeleton; | ||
import gg.generationsmod.rarecandy.model.animation.Bone; | ||
import gg.generationsmod.rarecandy.model.config.ModelConfig; | ||
import org.joml.Vector2f; | ||
import org.joml.Vector3f; | ||
import org.lwjgl.BufferUtils; | ||
import org.lwjgl.assimp.*; | ||
import org.lwjgl.system.MemoryUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class AssimpModelLoader { | ||
|
||
public static Model load(String name, FileLocator locator, int extraFlags) { | ||
var fileIo = AIFileIO.create() | ||
.OpenProc((pFileIO, pFileName, openMode) -> { | ||
var fileName = MemoryUtil.memUTF8(pFileName); | ||
var bytes = locator.getFile(fileName); | ||
var data = BufferUtils.createByteBuffer(bytes.length); | ||
data.put(bytes); | ||
data.flip(); | ||
|
||
return AIFile.create() | ||
.ReadProc((pFile, pBuffer, size, count) -> { | ||
var max = Math.min(data.remaining() / size, count); | ||
MemoryUtil.memCopy(MemoryUtil.memAddress(data), pBuffer, max * size); | ||
data.position((int) (data.position() + max * size)); | ||
return max; | ||
}) | ||
.SeekProc((pFile, offset, origin) -> { | ||
switch (origin) { | ||
case Assimp.aiOrigin_CUR -> data.position(data.position() + (int) offset); | ||
case Assimp.aiOrigin_SET -> data.position((int) offset); | ||
case Assimp.aiOrigin_END -> data.position(data.limit() + (int) offset); | ||
} | ||
|
||
return 0; | ||
}) | ||
.FileSizeProc(pFile -> data.limit()) | ||
.address(); | ||
}) | ||
.CloseProc((pFileIO, pFile) -> { | ||
var aiFile = AIFile.create(pFile); | ||
aiFile.ReadProc().free(); | ||
aiFile.SeekProc().free(); | ||
aiFile.FileSizeProc().free(); | ||
}); | ||
|
||
var scene = Assimp.aiImportFileEx(name, Assimp.aiProcess_Triangulate | Assimp.aiProcess_JoinIdenticalVertices | Assimp.aiProcess_ImproveCacheLocality | extraFlags, fileIo); | ||
if (scene == null) throw new RuntimeException(Assimp.aiGetErrorString()); | ||
var result = readScene(scene, locator); | ||
Assimp.aiReleaseImport(scene); | ||
return result; | ||
} | ||
|
||
private static Model readScene(AIScene scene, FileLocator locator) { | ||
var skeleton = new Skeleton(BoneNode.create(scene.mRootNode())); | ||
var config = readConfig(locator); | ||
var materials = readMaterialData(scene); | ||
var meshes = readMeshData(skeleton, scene, new HashMap<>()); | ||
return new Model(materials, meshes, skeleton, config); | ||
} | ||
|
||
private static ModelConfig readConfig(FileLocator locator) { | ||
var json = new String(locator.getFile("model.config.json")); | ||
return ModelConfig.GSON.fromJson(json, ModelConfig.class); | ||
} | ||
|
||
private static Mesh[] readMeshData(Skeleton skeleton, AIScene scene, Map<String, Bone> boneMap) { | ||
var meshes = new Mesh[scene.mNumMeshes()]; | ||
|
||
for (int i = 0; i < scene.mNumMeshes(); i++) { | ||
var mesh = AIMesh.create(scene.mMeshes().get(i)); | ||
var name = mesh.mName().dataString(); | ||
var material = mesh.mMaterialIndex(); | ||
var indices = new ArrayList<Integer>(); | ||
var positions = new ArrayList<Vector3f>(); | ||
var uvs = new ArrayList<Vector2f>(); | ||
var normals = new ArrayList<Vector3f>(); | ||
var bones = new ArrayList<Bone>(); | ||
|
||
// Indices | ||
var aiFaces = mesh.mFaces(); | ||
for (int j = 0; j < mesh.mNumFaces(); j++) { | ||
var aiFace = aiFaces.get(j); | ||
indices.add(aiFace.mIndices().get(0)); | ||
indices.add(aiFace.mIndices().get(1)); | ||
indices.add(aiFace.mIndices().get(2)); | ||
} | ||
|
||
// Positions | ||
var aiVert = mesh.mVertices(); | ||
for (int j = 0; j < mesh.mNumVertices(); j++) | ||
positions.add(new Vector3f(aiVert.get(j).x(), aiVert.get(j).y(), aiVert.get(j).z())); | ||
|
||
// UV's | ||
var aiUV = mesh.mTextureCoords(0); | ||
if (aiUV != null) { | ||
while (aiUV.remaining() > 0) { | ||
var uv = aiUV.get(); | ||
uvs.add(new Vector2f(uv.x(), 1 - uv.y())); | ||
} | ||
} | ||
|
||
// Normals | ||
var aiNormals = mesh.mNormals(); | ||
if (aiNormals != null) { | ||
for (int j = 0; j < mesh.mNumVertices(); j++) | ||
normals.add(new Vector3f(aiNormals.get(j).x(), aiNormals.get(j).y(), aiNormals.get(j).z())); | ||
} | ||
|
||
// Bones | ||
if (mesh.mBones() != null) { | ||
var aiBones = requireNonNull(mesh.mBones()); | ||
|
||
for (int j = 0; j < aiBones.capacity(); j++) { | ||
var aiBone = AIBone.create(aiBones.get(j)); | ||
var bone = Bone.from(aiBone); | ||
bones.add(bone); | ||
boneMap.put(bone.name, bone); | ||
} | ||
} | ||
|
||
skeleton.store(bones.toArray(Bone[]::new)); | ||
meshes[i] = new Mesh(name, material, indices, positions, uvs, normals, bones); | ||
} | ||
|
||
skeleton.calculateBoneData(); | ||
return meshes; | ||
} | ||
|
||
private static String[] readMaterialData(AIScene scene) { | ||
var materials = new String[scene.mNumMaterials()]; | ||
|
||
for (int i = 0; i < scene.mNumMaterials(); i++) { | ||
var aiMat = AIMaterial.create(scene.mMaterials().get(i)); | ||
|
||
for (int j = 0; j < aiMat.mNumProperties(); j++) { | ||
var property = AIMaterialProperty.create(aiMat.mProperties().get(j)); | ||
var name = property.mKey().dataString(); | ||
var data = property.mData(); | ||
|
||
if (name.equals(Assimp.AI_MATKEY_NAME)) { | ||
var matName = AIString.create(MemoryUtil.memAddress(data)).dataString(); | ||
materials[i] = matName; | ||
} | ||
} | ||
} | ||
|
||
return materials; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/assetLoading/java/gg/generationsmod/rarecandy/model/Mesh.java
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,17 @@ | ||
package gg.generationsmod.rarecandy.model; | ||
|
||
import gg.generationsmod.rarecandy.model.animation.Bone; | ||
import org.joml.Vector2f; | ||
import org.joml.Vector3f; | ||
|
||
import java.util.List; | ||
|
||
public record Mesh( | ||
String name, | ||
int material, | ||
List<Integer> indices, | ||
List<Vector3f> positions, | ||
List<Vector2f> uvs, | ||
List<Vector3f> normals, | ||
List<Bone> bones | ||
) {} |
11 changes: 11 additions & 0 deletions
11
src/assetLoading/java/gg/generationsmod/rarecandy/model/Model.java
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,11 @@ | ||
package gg.generationsmod.rarecandy.model; | ||
|
||
import gg.generationsmod.rarecandy.model.animation.Skeleton; | ||
import gg.generationsmod.rarecandy.model.config.ModelConfig; | ||
|
||
public record Model( | ||
String[] materialReferences, | ||
Mesh[] meshes, | ||
Skeleton skeleton, | ||
ModelConfig config | ||
) {} |
157 changes: 157 additions & 0 deletions
157
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/Animation.java
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,157 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import gg.generationsmod.rarecandy.model.animation.tranm.*; | ||
import org.joml.Matrix4f; | ||
import org.joml.Quaternionf; | ||
import org.joml.Vector3f; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
public class Animation { | ||
public final String name; | ||
public final double animationDuration; | ||
public Map<String, Integer> nodeIdMap = new HashMap<>(); | ||
public final AnimationNode[] animationNodes; | ||
public float ticksPerSecond; | ||
public final Skeleton skeleton; | ||
public boolean ignoreInstancedTime = false; | ||
|
||
public Animation(String name, gg.generationsmod.rarecandy.model.animation.tranm.Animation rawAnimation, Skeleton skeleton) { | ||
this.name = name; | ||
this.ticksPerSecond = 60; | ||
this.skeleton = skeleton; | ||
this.animationNodes = fillAnimationNodesTrinity(rawAnimation); | ||
this.animationDuration = findLastKeyTime(); | ||
|
||
for (var animationNode : animationNodes) { | ||
if (animationNode != null) { | ||
if (animationNode.positionKeys.getAtTime((int) animationDuration - 10) == null) | ||
animationNode.positionKeys.add(animationDuration, animationNode.positionKeys.get(0).value()); | ||
if (animationNode.rotationKeys.getAtTime((int) animationDuration - 10) == null) | ||
animationNode.rotationKeys.add(animationDuration, animationNode.rotationKeys.get(0).value()); | ||
if (animationNode.scaleKeys.getAtTime((int) animationDuration - 10) == null) | ||
animationNode.scaleKeys.add(animationDuration, animationNode.scaleKeys.get(0).value()); | ||
} | ||
} | ||
} | ||
|
||
private double findLastKeyTime() { | ||
var duration = 0d; | ||
|
||
for (var value : this.animationNodes) { | ||
if (value != null) | ||
for (var key : value.positionKeys) //noinspection ManualMinMaxCalculation | ||
duration = key.time() > duration ? key.time() : duration; | ||
} | ||
|
||
return duration; | ||
} | ||
|
||
public float getAnimationTime(double secondsPassed) { | ||
var ticksPassed = (float) secondsPassed * ticksPerSecond; | ||
return (float) (ticksPassed % animationDuration); | ||
} | ||
|
||
public Matrix4f[] getFrameTransform(double secondsPassed) { | ||
var boneTransforms = new Matrix4f[this.skeleton.bones.length]; | ||
readNodeHierarchy(getAnimationTime(secondsPassed), skeleton.rootNode, new Matrix4f().identity(), boneTransforms); | ||
return boneTransforms; | ||
} | ||
|
||
public void readNodeHierarchy(float animTime, BoneNode node, Matrix4f parentTransform, Matrix4f[] boneTransforms) { | ||
var name = node.name; | ||
var nodeTransform = new Matrix4f(node.transform); | ||
|
||
var animationNodeId = nodeIdMap.getOrDefault(name, -1); | ||
if (animationNodeId != -1) { | ||
var animNode = animationNodes[animationNodeId]; | ||
|
||
if (animNode != null) { | ||
var scale = AnimationMath.calcInterpolatedScaling(animTime, animNode); | ||
var rotation = AnimationMath.calcInterpolatedRotation(animTime, animNode); | ||
var translation = AnimationMath.calcInterpolatedPosition(animTime, animNode); | ||
nodeTransform.identity().translationRotateScale(translation, rotation, scale); | ||
} | ||
} | ||
|
||
var globalTransform = parentTransform.mul(nodeTransform, new Matrix4f()); | ||
var bone = skeleton.getBone(name); | ||
if (bone != null) boneTransforms[skeleton.getId(bone)] = globalTransform.mul(bone.inverseBindMatrix, new Matrix4f()); | ||
|
||
for (var child : node.children) | ||
readNodeHierarchy(animTime, child, globalTransform, boneTransforms); | ||
} | ||
|
||
private AnimationNode[] fillAnimationNodesTrinity(gg.generationsmod.rarecandy.model.animation.tranm.Animation rawAnimation) { | ||
var animationNodes = new AnimationNode[skeleton.nodes.length]; // BoneGroup | ||
|
||
for (int i = 0; i < rawAnimation.anim().bonesLength(); i++) { | ||
var boneAnim = rawAnimation.anim().bones(i); | ||
nodeIdMap.put(Objects.requireNonNull(boneAnim.name()).replace(".trmdl", ""), i); | ||
animationNodes[i] = new AnimationNode(); | ||
|
||
switch (boneAnim.rotType()) { | ||
case QuatTrack.DynamicQuatTrack -> | ||
TranmUtil.processDynamicQuatTrack((DynamicQuatTrack) Objects.requireNonNull(boneAnim.rot(new DynamicQuatTrack())), animationNodes[i].rotationKeys); | ||
case QuatTrack.FixedQuatTrack -> | ||
TranmUtil.processFixedQuatTrack((FixedQuatTrack) Objects.requireNonNull(boneAnim.rot(new FixedQuatTrack())), animationNodes[i].rotationKeys); | ||
case QuatTrack.Framed8QuatTrack -> | ||
TranmUtil.processFramed8QuatTrack((Framed8QuatTrack) Objects.requireNonNull(boneAnim.rot(new Framed8QuatTrack())), animationNodes[i].rotationKeys); | ||
case QuatTrack.Framed16QuatTrack -> | ||
TranmUtil.processFramed16QuatTrack((Framed16QuatTrack) Objects.requireNonNull(boneAnim.rot(new Framed16QuatTrack())), animationNodes[i].rotationKeys); | ||
} | ||
|
||
switch (boneAnim.scaleType()) { | ||
case VectorTrack.DynamicVectorTrack -> | ||
TranmUtil.processDynamicVecTrack((DynamicVectorTrack) Objects.requireNonNull(boneAnim.scale(new DynamicVectorTrack())), animationNodes[i].scaleKeys); | ||
case VectorTrack.FixedVectorTrack -> | ||
TranmUtil.processFixedVecTrack((FixedVectorTrack) Objects.requireNonNull(boneAnim.scale(new FixedVectorTrack())), animationNodes[i].scaleKeys); | ||
case VectorTrack.Framed8VectorTrack -> | ||
TranmUtil.processFramed8VecTrack((Framed8VectorTrack) Objects.requireNonNull(boneAnim.scale(new Framed8VectorTrack())), animationNodes[i].scaleKeys); | ||
case VectorTrack.Framed16VectorTrack -> | ||
TranmUtil.processFramed16VecTrack((Framed16VectorTrack) Objects.requireNonNull(boneAnim.scale(new Framed16VectorTrack())), animationNodes[i].scaleKeys); | ||
} | ||
|
||
switch (boneAnim.transType()) { | ||
case VectorTrack.DynamicVectorTrack -> | ||
TranmUtil.processDynamicVecTrack((DynamicVectorTrack) Objects.requireNonNull(boneAnim.trans(new DynamicVectorTrack())), animationNodes[i].positionKeys); | ||
case VectorTrack.FixedVectorTrack -> | ||
TranmUtil.processFixedVecTrack((FixedVectorTrack) Objects.requireNonNull(boneAnim.trans(new FixedVectorTrack())), animationNodes[i].positionKeys); | ||
case VectorTrack.Framed8VectorTrack -> | ||
TranmUtil.processFramed8VecTrack((Framed8VectorTrack) Objects.requireNonNull(boneAnim.trans(new Framed8VectorTrack())), animationNodes[i].positionKeys); | ||
case VectorTrack.Framed16VectorTrack -> | ||
TranmUtil.processFramed16VecTrack((Framed16VectorTrack) Objects.requireNonNull(boneAnim.trans(new Framed16VectorTrack())), animationNodes[i].positionKeys); | ||
} | ||
} | ||
|
||
return animationNodes; | ||
} | ||
|
||
public static class AnimationNode { | ||
public final TransformStorage<Vector3f> positionKeys = new TransformStorage<>(); | ||
public final TransformStorage<Quaternionf> rotationKeys = new TransformStorage<>(); | ||
public final TransformStorage<Vector3f> scaleKeys = new TransformStorage<>(); | ||
|
||
public AnimationNode() { | ||
} | ||
|
||
public TransformStorage.TimeKey<Vector3f> getDefaultPosition() { | ||
return positionKeys.get(0); | ||
} | ||
|
||
public TransformStorage.TimeKey<Quaternionf> getDefaultRotation() { | ||
return rotationKeys.get(0); | ||
} | ||
|
||
public TransformStorage.TimeKey<Vector3f> getDefaultScale() { | ||
return scaleKeys.get(0); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.name; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/AnimationMath.java
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,71 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import gg.generationsmod.rarecandy.Pair; | ||
import org.joml.Quaternionf; | ||
import org.joml.Vector3f; | ||
|
||
public class AnimationMath { | ||
|
||
public static Vector3f calcInterpolatedPosition(float animTime, Animation.AnimationNode node) { | ||
if (node.positionKeys.size() == 1) return node.getDefaultPosition().value(); | ||
|
||
var positions = findPositions(animTime, node); | ||
var deltaTime = (float) (positions.b().time() - positions.a().time()); | ||
var factor = (animTime - (float) positions.a().time()) / deltaTime; | ||
var start = new Vector3f(positions.a().value()); | ||
var end = new Vector3f(positions.b().value()); | ||
var delta = new Vector3f(end.sub(start)); | ||
return new Vector3f(start.add(delta.mul(factor))); | ||
} | ||
|
||
public static Quaternionf calcInterpolatedRotation(float animTime, Animation.AnimationNode node) { | ||
if (node.rotationKeys.size() == 1) return new Quaternionf(node.getDefaultRotation().value()); | ||
|
||
var rotations = findRotations(animTime, node); | ||
var deltaTime = (float) (rotations.b().time() - rotations.a().time()); | ||
var factor = (animTime - (float) rotations.a().time()) / deltaTime; | ||
var start = new Quaternionf(rotations.a().value()); | ||
var end = new Quaternionf(rotations.b().value()); | ||
return new Quaternionf(start.slerp(end, factor)); | ||
} | ||
|
||
public static Vector3f calcInterpolatedScaling(float animTime, Animation.AnimationNode node) { | ||
if (node.scaleKeys.size() == 1) return node.getDefaultScale().value(); | ||
|
||
var out = new Vector3f(); | ||
var scalings = findScalings(animTime, node); | ||
var deltaTime = (float) (scalings.b().time() - scalings.a().time()); | ||
var factor = (animTime - (float) scalings.a().time()) / deltaTime; | ||
var start = new Vector3f(scalings.a().value()); | ||
var end = new Vector3f(scalings.b().value()); | ||
var delta = new Vector3f(end.sub(start)); | ||
return out.add(start.add(delta.mul(factor))); | ||
} | ||
|
||
public static Pair<TransformStorage.TimeKey<Vector3f>, TransformStorage.TimeKey<Vector3f>> findPositions(float animTime, Animation.AnimationNode node) { | ||
for (var key : node.positionKeys) { | ||
if (animTime < key.time()) | ||
return new Pair<>(node.positionKeys.getBefore(key), key); | ||
} | ||
|
||
return new Pair<>(node.positionKeys.get(0), node.positionKeys.get(1)); | ||
} | ||
|
||
public static Pair<TransformStorage.TimeKey<Quaternionf>, TransformStorage.TimeKey<Quaternionf>> findRotations(float animTime, Animation.AnimationNode node) { | ||
for (var key : node.rotationKeys) { | ||
if (animTime < key.time()) | ||
return new Pair<>(node.rotationKeys.getBefore(key), key); | ||
} | ||
|
||
return new Pair<>(node.rotationKeys.get(0), node.rotationKeys.get(1)); | ||
} | ||
|
||
public static Pair<TransformStorage.TimeKey<Vector3f>, TransformStorage.TimeKey<Vector3f>> findScalings(float animTime, Animation.AnimationNode node) { | ||
for (var key : node.scaleKeys) { | ||
if (animTime < key.time()) | ||
return new Pair<>(node.scaleKeys.getBefore(key), key); | ||
} | ||
|
||
return new Pair<>(node.scaleKeys.get(0), node.scaleKeys.get(1)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/Bone.java
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,53 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import org.joml.Matrix4f; | ||
import org.lwjgl.assimp.AIBone; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* We re-use this structure for multiple meshes so if you are accessing this value from outside a meshes bone array do NOT trust it. | ||
*/ | ||
public class Bone { | ||
|
||
public String name; | ||
public VertexWeight[] weights; | ||
public Matrix4f inverseBindMatrix; | ||
|
||
@Override | ||
public String toString() { | ||
return "Bone{" + "name='" + name + '\'' + '}'; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(name); | ||
} | ||
|
||
public static Bone from(AIBone bone) { | ||
var b = new Bone(); | ||
b.inverseBindMatrix = BoneNode.from(bone.mOffsetMatrix()); | ||
b.name = bone.mName().dataString(); | ||
|
||
var aiWeights = Objects.requireNonNull(bone.mWeights()); | ||
var vertexWeights = new Bone.VertexWeight[aiWeights.capacity()]; | ||
for (int i = 0; i < aiWeights.capacity(); i++) { | ||
var aiWeight = aiWeights.get(i); | ||
vertexWeights[i] = new Bone.VertexWeight(aiWeight.mVertexId(), aiWeight.mWeight()); | ||
} | ||
|
||
b.weights = vertexWeights; | ||
return b; | ||
} | ||
|
||
public static class VertexWeight { | ||
|
||
public int vertexId; | ||
public float weight; | ||
|
||
public VertexWeight(int vertexId, float weight) { | ||
this.vertexId = vertexId; | ||
this.weight = weight; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/BoneNode.java
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,37 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import org.joml.Matrix4f; | ||
import org.lwjgl.assimp.AIMatrix4x4; | ||
import org.lwjgl.assimp.AINode; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class BoneNode { | ||
public final String name; | ||
public final BoneNode parent; | ||
public final Matrix4f transform; | ||
public final List<BoneNode> children = new ArrayList<>(); | ||
|
||
private BoneNode(AINode aiNode, BoneNode parent) { | ||
this.name = aiNode.mName().dataString(); | ||
this.parent = parent; | ||
this.transform = from(aiNode.mTransformation()); | ||
|
||
for (int i = 0; i < aiNode.mNumChildren(); i++) | ||
children.add(new BoneNode(AINode.create(aiNode.mChildren().get(i)), this)); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Joint{" + "name='" + name + '\'' + '}'; | ||
} | ||
|
||
public static BoneNode create(AINode aiRoot) { | ||
return new BoneNode(aiRoot, null); | ||
} | ||
|
||
public static Matrix4f from(AIMatrix4x4 aiMat4) { | ||
return new Matrix4f().m00(aiMat4.a1()).m10(aiMat4.a2()).m20(aiMat4.a3()).m30(aiMat4.a4()).m01(aiMat4.b1()).m11(aiMat4.b2()).m21(aiMat4.b3()).m31(aiMat4.b4()).m02(aiMat4.c1()).m12(aiMat4.c2()).m22(aiMat4.c3()).m32(aiMat4.c4()).m03(aiMat4.d1()).m13(aiMat4.d2()).m23(aiMat4.d3()).m33(aiMat4.d4()); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/Skeleton.java
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,55 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class Skeleton { | ||
public final BoneNode[] nodes; | ||
public final Map<String, Bone> boneMap; | ||
public final Map<Bone, Integer> cachedBoneIds = new HashMap<>(); | ||
public final BoneNode rootNode; | ||
public Bone[] bones; | ||
|
||
public Skeleton(BoneNode root) { | ||
var jointList = new ArrayList<BoneNode>(); | ||
populateJoints(root, jointList); | ||
this.rootNode = root; | ||
this.nodes = new BoneNode[jointList.size()]; | ||
this.boneMap = new HashMap<>(); | ||
|
||
for (int i = 0; i < jointList.size(); i++) { | ||
var joint = jointList.get(i); | ||
this.nodes[i] = joint; | ||
} | ||
} | ||
|
||
private static void populateJoints(BoneNode joint, ArrayList<BoneNode> jointList) { | ||
jointList.add(joint); | ||
for (var child : joint.children) populateJoints(child, jointList); | ||
} | ||
|
||
public int getId(Bone bone) { | ||
if (cachedBoneIds.get(bone) == null) { | ||
for (int i = 0; i < bones.length; i++) | ||
if (bone.name.equals(bones[i].name)) return i; | ||
|
||
System.out.println("Something is about to go wrong. Bone cannot be found inside of skeleton \"" + bone.name + "\""); | ||
cachedBoneIds.put(bone, 0); | ||
} | ||
|
||
return cachedBoneIds.get(bone); | ||
} | ||
|
||
public void store(Bone[] bones) { | ||
for (var bone : bones) boneMap.put(bone.name, bone); | ||
} | ||
|
||
public void calculateBoneData() { | ||
this.bones = boneMap.values().toArray(Bone[]::new); | ||
} | ||
|
||
public Bone getBone(String name) { | ||
return boneMap.get(name); | ||
} | ||
} |
121 changes: 121 additions & 0 deletions
121
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/TranmUtil.java
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,121 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import gg.generationsmod.rarecandy.model.animation.tranm.*; | ||
import org.joml.Quaternionf; | ||
import org.joml.Vector3f; | ||
|
||
public class TranmUtil { | ||
private static final int[][] QUATERNION_SWIZZLES = { | ||
new int[]{0, 3, 2, 1}, new int[]{3, 0, 2, 1}, | ||
new int[]{3, 2, 0, 1}, new int[]{3, 2, 1, 0} | ||
}; | ||
|
||
private static short unpackS15(short u15) { | ||
int sign = (u15 >> 14) & 1; | ||
u15 &= 0x3FFF; | ||
if (sign == 0) u15 -= 0x4000; | ||
return u15; | ||
} | ||
|
||
public static Quaternionf packedToQuat(short z, short y, short x) { | ||
int count = 15; | ||
int BASE = (1 << count) - 1; | ||
float maxVal = 1 / (0x399E * (float) Math.sqrt(2.0)); // such obvious, so constant, wow | ||
|
||
long cq = x & 0xFFFF; | ||
cq <<= 16; | ||
cq |= (int) y & 0xFFFF; | ||
cq <<= 16; | ||
cq |= (int) z & 0xFFFF; | ||
|
||
short extra = (short) (cq & 0x7); | ||
long num = cq >> 3; | ||
|
||
x = unpackS15((short) ((num >> (count * 2)) & BASE)); | ||
y = unpackS15((short) ((num >> (count)) & BASE)); | ||
z = unpackS15((short) ((num >> (0)) & BASE)); | ||
|
||
float fx = x * maxVal; | ||
float fy = y * maxVal; | ||
float fz = z * maxVal; | ||
|
||
float[] quat = { | ||
(float) Math.sqrt(1 - fx * fx - fy * fy - fz * fz), | ||
fx, | ||
fy, | ||
fz | ||
}; | ||
|
||
int[] qmap = QUATERNION_SWIZZLES[(extra & 3)]; | ||
Quaternionf q = new Quaternionf(quat[qmap[0]], quat[qmap[1]], quat[qmap[2]], quat[qmap[3]]); | ||
if ((extra >> 2) != 0) q.mul(-1); | ||
|
||
return q; | ||
} | ||
|
||
public static void processDynamicQuatTrack(DynamicQuatTrack track, TransformStorage<Quaternionf> rotationKeys) { | ||
for (int i = 0; i < track.vecLength(); i++) { | ||
var vec = track.vec(i); | ||
rotationKeys.add(i, TranmUtil.packedToQuat((short) vec.x(), (short) vec.y(), (short) vec.z())); | ||
} | ||
} | ||
|
||
public static void processFixedQuatTrack(FixedQuatTrack track, TransformStorage<Quaternionf> rotationKeys) { | ||
var vec = track.vec(); | ||
rotationKeys.add(0, TranmUtil.packedToQuat((short) vec.x(), (short) vec.y(), (short) vec.z())); | ||
} | ||
|
||
public static void processFramed8QuatTrack(Framed8QuatTrack track, TransformStorage<Quaternionf> rotationKeys) { | ||
var frames = track.framesVector(); | ||
for (int i = 0; i < track.vecLength(); i++) { | ||
int frame = i; | ||
var vec = track.vec(i); | ||
|
||
if (i < frames.length()) frame = frames.getAsUnsigned(i); | ||
rotationKeys.add(frame, TranmUtil.packedToQuat((short) vec.x(), (short) vec.y(), (short) vec.z())); | ||
} | ||
} | ||
|
||
public static void processFramed16QuatTrack(Framed16QuatTrack track, TransformStorage<Quaternionf> rotationKeys) { | ||
var frames = track.framesVector(); | ||
for (int i = 0; i < track.vecLength(); i++) { | ||
int frame = i; | ||
var vec = track.vec(i); | ||
|
||
if (i < frames.length()) frame = frames.getAsUnsigned(i); | ||
rotationKeys.add(frame, TranmUtil.packedToQuat((short) vec.x(), (short) vec.y(), (short) vec.z())); | ||
} | ||
} | ||
|
||
public static void processDynamicVecTrack(DynamicVectorTrack track, TransformStorage<Vector3f> vecKeys) { | ||
for (int i = 0; i < track.vecLength(); i++) { | ||
var vec = track.vec(i); | ||
vecKeys.add(i, new Vector3f(vec.x(), vec.y(), vec.z())); | ||
} | ||
} | ||
|
||
public static void processFixedVecTrack(FixedVectorTrack track, TransformStorage<Vector3f> vecKeys) { | ||
var vec = track.vec(); | ||
vecKeys.add(0, new Vector3f(vec.x(), vec.y(), vec.z())); | ||
} | ||
|
||
public static void processFramed8VecTrack(Framed8VectorTrack track, TransformStorage<Vector3f> vecKeys) { | ||
for (int i = 0; i < track.vecLength(); i++) { | ||
int frame = i; | ||
var vec = track.vec(i); | ||
|
||
if (i < track.framesLength()) frame = track.frames(i); | ||
vecKeys.add(frame, new Vector3f(vec.x(), vec.y(), vec.z())); | ||
} | ||
} | ||
|
||
public static void processFramed16VecTrack(Framed16VectorTrack track, TransformStorage<Vector3f> vecKeys) { | ||
for (int i = 0; i < track.vecLength(); i++) { | ||
int frame = i; | ||
var vec = track.vec(i); | ||
|
||
if (i < track.framesLength()) frame = track.frames(i); | ||
vecKeys.add(frame, new Vector3f(vec.x(), vec.y(), vec.z())); | ||
} | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/TransformStorage.java
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,75 @@ | ||
package gg.generationsmod.rarecandy.model.animation; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Arrays; | ||
import java.util.Iterator; | ||
import java.util.TreeMap; | ||
|
||
public class TransformStorage<T> implements Iterable<TransformStorage.TimeKey<T>> { | ||
public final TreeMap<Double, TimeKey<T>> keys = new TreeMap<>(); | ||
public TimeKey<T>[] values = new TimeKey[0]; | ||
|
||
@NotNull | ||
@Override | ||
public Iterator<TimeKey<T>> iterator() { | ||
return new Iterator<>() { | ||
private int i = 0; | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return values.length > i; | ||
} | ||
|
||
@Override | ||
public TimeKey<T> next() { | ||
return values[i++]; | ||
} | ||
}; | ||
} | ||
|
||
public void add(double time, T value) { | ||
values = Arrays.copyOf(values, values.length + 1); | ||
var key = new TimeKey<>(time, values.length - 1, value); | ||
keys.put(time, key); | ||
values[values.length - 1] = key; | ||
} | ||
|
||
public TimeKey<T> get(int i) { | ||
if (i > values().length) return null; | ||
return values()[i]; | ||
} | ||
|
||
public TimeKey<T> getAtTime(int animationDuration) { | ||
for (var value : values()) { | ||
if (value.time() == animationDuration) return value; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public int indexOf(TimeKey<T> value) { | ||
return value.idx; | ||
} | ||
|
||
public TimeKey<T> getBefore(TimeKey<T> valueAhead) { | ||
var index = indexOf(valueAhead); | ||
return get(Math.max(0, index - 1)); | ||
} | ||
|
||
public TimeKey<T>[] values() { | ||
return values; | ||
} | ||
|
||
public int size() { | ||
return keys.size(); | ||
} | ||
|
||
record TimeKey<T>(double time, int idx, T value) implements Comparable<TimeKey<T>> { | ||
|
||
@Override | ||
public int compareTo(@NotNull TransformStorage.TimeKey<T> timeKey2) { | ||
return Double.compare(time, timeKey2.time); | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Animation.java
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,52 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Animation extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Animation getRootAsAnimation(ByteBuffer _bb) { return getRootAsAnimation(_bb, new Animation()); } | ||
public static Animation getRootAsAnimation(ByteBuffer _bb, Animation obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Animation __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Metadata meta() { return meta(new Metadata()); } | ||
public Metadata meta(Metadata obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } | ||
public SkelAnim anim() { return anim(new SkelAnim()); } | ||
public SkelAnim anim(SkelAnim obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } | ||
|
||
public static int createAnimation(FlatBufferBuilder builder, | ||
int metaOffset, | ||
int animOffset) { | ||
builder.startTable(2); | ||
Animation.addAnim(builder, animOffset); | ||
Animation.addMeta(builder, metaOffset); | ||
return Animation.endAnimation(builder); | ||
} | ||
|
||
public static void startAnimation(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addMeta(FlatBufferBuilder builder, int metaOffset) { builder.addOffset(0, metaOffset, 0); } | ||
public static void addAnim(FlatBufferBuilder builder, int animOffset) { builder.addOffset(1, animOffset, 0); } | ||
public static int endAnimation(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
public static void finishAnimationBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } | ||
public static void finishSizePrefixedAnimationBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Animation get(int j) { return get(new Animation(), j); } | ||
public Animation get(Animation obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
70 changes: 70 additions & 0 deletions
70
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Bone.java
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,70 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Bone extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Bone getRootAsBone(ByteBuffer _bb) { return getRootAsBone(_bb, new Bone()); } | ||
public static Bone getRootAsBone(ByteBuffer _bb, Bone obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Bone __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } | ||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } | ||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } | ||
public byte scaleType() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; } | ||
public Table scale(Table obj) { int o = __offset(8); return o != 0 ? __union(obj, o + bb_pos) : null; } | ||
public byte rotType() { int o = __offset(10); return o != 0 ? bb.get(o + bb_pos) : 0; } | ||
public Table rot(Table obj) { int o = __offset(12); return o != 0 ? __union(obj, o + bb_pos) : null; } | ||
public byte transType() { int o = __offset(14); return o != 0 ? bb.get(o + bb_pos) : 0; } | ||
public Table trans(Table obj) { int o = __offset(16); return o != 0 ? __union(obj, o + bb_pos) : null; } | ||
|
||
public static int createBone(FlatBufferBuilder builder, | ||
int nameOffset, | ||
byte scaleType, | ||
int scaleOffset, | ||
byte rotType, | ||
int rotOffset, | ||
byte transType, | ||
int transOffset) { | ||
builder.startTable(7); | ||
Bone.addTrans(builder, transOffset); | ||
Bone.addRot(builder, rotOffset); | ||
Bone.addScale(builder, scaleOffset); | ||
Bone.addName(builder, nameOffset); | ||
Bone.addTransType(builder, transType); | ||
Bone.addRotType(builder, rotType); | ||
Bone.addScaleType(builder, scaleType); | ||
return Bone.endBone(builder); | ||
} | ||
|
||
public static void startBone(FlatBufferBuilder builder) { builder.startTable(7); } | ||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); } | ||
public static void addScaleType(FlatBufferBuilder builder, byte scaleType) { builder.addByte(1, scaleType, 0); } | ||
public static void addScale(FlatBufferBuilder builder, int scaleOffset) { builder.addOffset(2, scaleOffset, 0); } | ||
public static void addRotType(FlatBufferBuilder builder, byte rotType) { builder.addByte(3, rotType, 0); } | ||
public static void addRot(FlatBufferBuilder builder, int rotOffset) { builder.addOffset(4, rotOffset, 0); } | ||
public static void addTransType(FlatBufferBuilder builder, byte transType) { builder.addByte(5, transType, 0); } | ||
public static void addTrans(FlatBufferBuilder builder, int transOffset) { builder.addOffset(6, transOffset, 0); } | ||
public static int endBone(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Bone get(int j) { return get(new Bone(), j); } | ||
public Bone get(Bone obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
40 changes: 40 additions & 0 deletions
40
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/BoneInit.java
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,40 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class BoneInit extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static BoneInit getRootAsBoneInit(ByteBuffer _bb) { return getRootAsBoneInit(_bb, new BoneInit()); } | ||
public static BoneInit getRootAsBoneInit(ByteBuffer _bb, BoneInit obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public BoneInit __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public long isInit() { int o = __offset(4); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } | ||
public Transform transform() { return transform(new Transform()); } | ||
public Transform transform(Transform obj) { int o = __offset(6); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } | ||
|
||
public static void startBoneInit(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addIsInit(FlatBufferBuilder builder, long isInit) { builder.addInt(0, (int) isInit, (int) 0L); } | ||
public static void addTransform(FlatBufferBuilder builder, int transformOffset) { builder.addStruct(1, transformOffset, 0); } | ||
public static int endBoneInit(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public BoneInit get(int j) { return get(new BoneInit(), j); } | ||
public BoneInit get(BoneInit obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
...assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/DynamicQuatTrack.java
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,49 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class DynamicQuatTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static DynamicQuatTrack getRootAsDynamicQuatTrack(ByteBuffer _bb) { return getRootAsDynamicQuatTrack(_bb, new DynamicQuatTrack()); } | ||
public static DynamicQuatTrack getRootAsDynamicQuatTrack(ByteBuffer _bb, DynamicQuatTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public DynamicQuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Vec3s vec(int j) { return vec(new Vec3s(), j); } | ||
public Vec3s vec(Vec3s obj, int j) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o) + j * 6, bb) : null; } | ||
public int vecLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public Vec3s.Vector vecVector() { return vecVector(new Vec3s.Vector()); } | ||
public Vec3s.Vector vecVector(Vec3s.Vector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 6, bb) : null; } | ||
|
||
public static int createDynamicQuatTrack(FlatBufferBuilder builder, | ||
int vecOffset) { | ||
builder.startTable(1); | ||
DynamicQuatTrack.addVec(builder, vecOffset); | ||
return DynamicQuatTrack.endDynamicQuatTrack(builder); | ||
} | ||
|
||
public static void startDynamicQuatTrack(FlatBufferBuilder builder) { builder.startTable(1); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addOffset(0, vecOffset, 0); } | ||
public static void startVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(6, numElems, 2); } | ||
public static int endDynamicQuatTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public DynamicQuatTrack get(int j) { return get(new DynamicQuatTrack(), j); } | ||
public DynamicQuatTrack get(DynamicQuatTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
...setLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/DynamicVectorTrack.java
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,49 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class DynamicVectorTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static DynamicVectorTrack getRootAsDynamicVectorTrack(ByteBuffer _bb) { return getRootAsDynamicVectorTrack(_bb, new DynamicVectorTrack()); } | ||
public static DynamicVectorTrack getRootAsDynamicVectorTrack(ByteBuffer _bb, DynamicVectorTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public DynamicVectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Vec3f vec(int j) { return vec(new Vec3f(), j); } | ||
public Vec3f vec(Vec3f obj, int j) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o) + j * 12, bb) : null; } | ||
public int vecLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public Vec3f.Vector vecVector() { return vecVector(new Vec3f.Vector()); } | ||
public Vec3f.Vector vecVector(Vec3f.Vector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 12, bb) : null; } | ||
|
||
public static int createDynamicVectorTrack(FlatBufferBuilder builder, | ||
int vecOffset) { | ||
builder.startTable(1); | ||
DynamicVectorTrack.addVec(builder, vecOffset); | ||
return DynamicVectorTrack.endDynamicVectorTrack(builder); | ||
} | ||
|
||
public static void startDynamicVectorTrack(FlatBufferBuilder builder) { builder.startTable(1); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addOffset(0, vecOffset, 0); } | ||
public static void startVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(12, numElems, 4); } | ||
public static int endDynamicVectorTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public DynamicVectorTrack get(int j) { return get(new DynamicVectorTrack(), j); } | ||
public DynamicVectorTrack get(DynamicVectorTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
38 changes: 38 additions & 0 deletions
38
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/FixedQuatTrack.java
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,38 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class FixedQuatTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static FixedQuatTrack getRootAsFixedQuatTrack(ByteBuffer _bb) { return getRootAsFixedQuatTrack(_bb, new FixedQuatTrack()); } | ||
public static FixedQuatTrack getRootAsFixedQuatTrack(ByteBuffer _bb, FixedQuatTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public FixedQuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Vec3s vec() { return vec(new Vec3s()); } | ||
public Vec3s vec(Vec3s obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } | ||
|
||
public static void startFixedQuatTrack(FlatBufferBuilder builder) { builder.startTable(1); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addStruct(0, vecOffset, 0); } | ||
public static int endFixedQuatTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public FixedQuatTrack get(int j) { return get(new FixedQuatTrack(), j); } | ||
public FixedQuatTrack get(FixedQuatTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
38 changes: 38 additions & 0 deletions
38
...assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/FixedVectorTrack.java
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,38 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class FixedVectorTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static FixedVectorTrack getRootAsFixedVectorTrack(ByteBuffer _bb) { return getRootAsFixedVectorTrack(_bb, new FixedVectorTrack()); } | ||
public static FixedVectorTrack getRootAsFixedVectorTrack(ByteBuffer _bb, FixedVectorTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public FixedVectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Vec3f vec() { return vec(new Vec3f()); } | ||
public Vec3f vec(Vec3f obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } | ||
|
||
public static void startFixedVectorTrack(FlatBufferBuilder builder) { builder.startTable(1); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addStruct(0, vecOffset, 0); } | ||
public static int endFixedVectorTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public FixedVectorTrack get(int j) { return get(new FixedVectorTrack(), j); } | ||
public FixedVectorTrack get(FixedVectorTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
57 changes: 57 additions & 0 deletions
57
...ssetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Framed16QuatTrack.java
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,57 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.*; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Framed16QuatTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Framed16QuatTrack getRootAsFramed16QuatTrack(ByteBuffer _bb) { return getRootAsFramed16QuatTrack(_bb, new Framed16QuatTrack()); } | ||
public static Framed16QuatTrack getRootAsFramed16QuatTrack(ByteBuffer _bb, Framed16QuatTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Framed16QuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public int frames(int j) { int o = __offset(4); return o != 0 ? bb.getShort(__vector(o) + j * 2) & 0xFFFF : 0; } | ||
public int framesLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public ShortVector framesVector() { return framesVector(new ShortVector()); } | ||
public ShortVector framesVector(ShortVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), bb) : null; } | ||
public ByteBuffer framesAsByteBuffer() { return __vector_as_bytebuffer(4, 2); } | ||
public ByteBuffer framesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 2); } | ||
public Vec3s vec(int j) { return vec(new Vec3s(), j); } | ||
public Vec3s vec(Vec3s obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o) + j * 6, bb) : null; } | ||
public int vecLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } | ||
public Vec3s.Vector vecVector() { return vecVector(new Vec3s.Vector()); } | ||
public Vec3s.Vector vecVector(Vec3s.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 6, bb) : null; } | ||
|
||
public static int createFramed16QuatTrack(FlatBufferBuilder builder, | ||
int framesOffset, | ||
int vecOffset) { | ||
builder.startTable(2); | ||
Framed16QuatTrack.addVec(builder, vecOffset); | ||
Framed16QuatTrack.addFrames(builder, framesOffset); | ||
return Framed16QuatTrack.endFramed16QuatTrack(builder); | ||
} | ||
|
||
public static void startFramed16QuatTrack(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addFrames(FlatBufferBuilder builder, int framesOffset) { builder.addOffset(0, framesOffset, 0); } | ||
public static int createFramesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(2, data.length, 2); for (int i = data.length - 1; i >= 0; i--) builder.addShort((short) data[i]); return builder.endVector(); } | ||
public static void startFramesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(2, numElems, 2); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addOffset(1, vecOffset, 0); } | ||
public static void startVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(6, numElems, 2); } | ||
public static int endFramed16QuatTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Framed16QuatTrack get(int j) { return get(new Framed16QuatTrack(), j); } | ||
public Framed16QuatTrack get(Framed16QuatTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
57 changes: 57 additions & 0 deletions
57
...etLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Framed16VectorTrack.java
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,57 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.*; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Framed16VectorTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Framed16VectorTrack getRootAsFramed16VectorTrack(ByteBuffer _bb) { return getRootAsFramed16VectorTrack(_bb, new Framed16VectorTrack()); } | ||
public static Framed16VectorTrack getRootAsFramed16VectorTrack(ByteBuffer _bb, Framed16VectorTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Framed16VectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public int frames(int j) { int o = __offset(4); return o != 0 ? bb.getShort(__vector(o) + j * 2) & 0xFFFF : 0; } | ||
public int framesLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public ShortVector framesVector() { return framesVector(new ShortVector()); } | ||
public ShortVector framesVector(ShortVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), bb) : null; } | ||
public ByteBuffer framesAsByteBuffer() { return __vector_as_bytebuffer(4, 2); } | ||
public ByteBuffer framesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 2); } | ||
public Vec3f vec(int j) { return vec(new Vec3f(), j); } | ||
public Vec3f vec(Vec3f obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o) + j * 12, bb) : null; } | ||
public int vecLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } | ||
public Vec3f.Vector vecVector() { return vecVector(new Vec3f.Vector()); } | ||
public Vec3f.Vector vecVector(Vec3f.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 12, bb) : null; } | ||
|
||
public static int createFramed16VectorTrack(FlatBufferBuilder builder, | ||
int framesOffset, | ||
int vecOffset) { | ||
builder.startTable(2); | ||
Framed16VectorTrack.addVec(builder, vecOffset); | ||
Framed16VectorTrack.addFrames(builder, framesOffset); | ||
return Framed16VectorTrack.endFramed16VectorTrack(builder); | ||
} | ||
|
||
public static void startFramed16VectorTrack(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addFrames(FlatBufferBuilder builder, int framesOffset) { builder.addOffset(0, framesOffset, 0); } | ||
public static int createFramesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(2, data.length, 2); for (int i = data.length - 1; i >= 0; i--) builder.addShort((short) data[i]); return builder.endVector(); } | ||
public static void startFramesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(2, numElems, 2); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addOffset(1, vecOffset, 0); } | ||
public static void startVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(12, numElems, 4); } | ||
public static int endFramed16VectorTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Framed16VectorTrack get(int j) { return get(new Framed16VectorTrack(), j); } | ||
public Framed16VectorTrack get(Framed16VectorTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
58 changes: 58 additions & 0 deletions
58
...assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Framed8QuatTrack.java
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,58 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.*; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Framed8QuatTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Framed8QuatTrack getRootAsFramed8QuatTrack(ByteBuffer _bb) { return getRootAsFramed8QuatTrack(_bb, new Framed8QuatTrack()); } | ||
public static Framed8QuatTrack getRootAsFramed8QuatTrack(ByteBuffer _bb, Framed8QuatTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Framed8QuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public int frames(int j) { int o = __offset(4); return o != 0 ? bb.get(__vector(o) + j) & 0xFF : 0; } | ||
public int framesLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public ByteVector framesVector() { return framesVector(new ByteVector()); } | ||
public ByteVector framesVector(ByteVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), bb) : null; } | ||
public ByteBuffer framesAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } | ||
public ByteBuffer framesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } | ||
public Vec3s vec(int j) { return vec(new Vec3s(), j); } | ||
public Vec3s vec(Vec3s obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o) + j * 6, bb) : null; } | ||
public int vecLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } | ||
public Vec3s.Vector vecVector() { return vecVector(new Vec3s.Vector()); } | ||
public Vec3s.Vector vecVector(Vec3s.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 6, bb) : null; } | ||
|
||
public static int createFramed8QuatTrack(FlatBufferBuilder builder, | ||
int framesOffset, | ||
int vecOffset) { | ||
builder.startTable(2); | ||
Framed8QuatTrack.addVec(builder, vecOffset); | ||
Framed8QuatTrack.addFrames(builder, framesOffset); | ||
return Framed8QuatTrack.endFramed8QuatTrack(builder); | ||
} | ||
|
||
public static void startFramed8QuatTrack(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addFrames(FlatBufferBuilder builder, int framesOffset) { builder.addOffset(0, framesOffset, 0); } | ||
public static int createFramesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); } | ||
public static int createFramesVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); } | ||
public static void startFramesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addOffset(1, vecOffset, 0); } | ||
public static void startVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(6, numElems, 2); } | ||
public static int endFramed8QuatTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Framed8QuatTrack get(int j) { return get(new Framed8QuatTrack(), j); } | ||
public Framed8QuatTrack get(Framed8QuatTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
58 changes: 58 additions & 0 deletions
58
...setLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Framed8VectorTrack.java
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,58 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.*; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Framed8VectorTrack extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Framed8VectorTrack getRootAsFramed8VectorTrack(ByteBuffer _bb) { return getRootAsFramed8VectorTrack(_bb, new Framed8VectorTrack()); } | ||
public static Framed8VectorTrack getRootAsFramed8VectorTrack(ByteBuffer _bb, Framed8VectorTrack obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Framed8VectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public int frames(int j) { int o = __offset(4); return o != 0 ? bb.get(__vector(o) + j) & 0xFF : 0; } | ||
public int framesLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public ByteVector framesVector() { return framesVector(new ByteVector()); } | ||
public ByteVector framesVector(ByteVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), bb) : null; } | ||
public ByteBuffer framesAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } | ||
public ByteBuffer framesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } | ||
public Vec3f vec(int j) { return vec(new Vec3f(), j); } | ||
public Vec3f vec(Vec3f obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o) + j * 12, bb) : null; } | ||
public int vecLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } | ||
public Vec3f.Vector vecVector() { return vecVector(new Vec3f.Vector()); } | ||
public Vec3f.Vector vecVector(Vec3f.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 12, bb) : null; } | ||
|
||
public static int createFramed8VectorTrack(FlatBufferBuilder builder, | ||
int framesOffset, | ||
int vecOffset) { | ||
builder.startTable(2); | ||
Framed8VectorTrack.addVec(builder, vecOffset); | ||
Framed8VectorTrack.addFrames(builder, framesOffset); | ||
return Framed8VectorTrack.endFramed8VectorTrack(builder); | ||
} | ||
|
||
public static void startFramed8VectorTrack(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addFrames(FlatBufferBuilder builder, int framesOffset) { builder.addOffset(0, framesOffset, 0); } | ||
public static int createFramesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); } | ||
public static int createFramesVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); } | ||
public static void startFramesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } | ||
public static void addVec(FlatBufferBuilder builder, int vecOffset) { builder.addOffset(1, vecOffset, 0); } | ||
public static void startVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(12, numElems, 4); } | ||
public static int endFramed8VectorTrack(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Framed8VectorTrack get(int j) { return get(new Framed8VectorTrack(), j); } | ||
public Framed8VectorTrack get(Framed8VectorTrack obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
52 changes: 52 additions & 0 deletions
52
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Metadata.java
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,52 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Metadata extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static Metadata getRootAsMetadata(ByteBuffer _bb) { return getRootAsMetadata(_bb, new Metadata()); } | ||
public static Metadata getRootAsMetadata(ByteBuffer _bb, Metadata obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Metadata __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public long loops() { int o = __offset(4); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } | ||
public long keyframes() { int o = __offset(6); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } | ||
public long fps() { int o = __offset(8); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } | ||
|
||
public static int createMetadata(FlatBufferBuilder builder, | ||
long loops, | ||
long keyframes, | ||
long fps) { | ||
builder.startTable(3); | ||
Metadata.addFps(builder, fps); | ||
Metadata.addKeyframes(builder, keyframes); | ||
Metadata.addLoops(builder, loops); | ||
return Metadata.endMetadata(builder); | ||
} | ||
|
||
public static void startMetadata(FlatBufferBuilder builder) { builder.startTable(3); } | ||
public static void addLoops(FlatBufferBuilder builder, long loops) { builder.addInt(0, (int) loops, (int) 0L); } | ||
public static void addKeyframes(FlatBufferBuilder builder, long keyframes) { builder.addInt(1, (int) keyframes, (int) 0L); } | ||
public static void addFps(FlatBufferBuilder builder, long fps) { builder.addInt(2, (int) fps, (int) 0L); } | ||
public static int endMetadata(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Metadata get(int j) { return get(new Metadata(), j); } | ||
public Metadata get(Metadata obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/QuatTrack.java
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 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
@SuppressWarnings("unused") | ||
public final class QuatTrack { | ||
private QuatTrack() { } | ||
public static final byte NONE = 0; | ||
public static final byte FixedQuatTrack = 1; | ||
public static final byte DynamicQuatTrack = 2; | ||
public static final byte Framed16QuatTrack = 3; | ||
public static final byte Framed8QuatTrack = 4; | ||
|
||
public static final String[] names = { "NONE", "FixedQuatTrack", "DynamicQuatTrack", "Framed16QuatTrack", "Framed8QuatTrack", }; | ||
|
||
public static String name(int e) { return names[e]; } | ||
} | ||
|
60 changes: 60 additions & 0 deletions
60
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/SkelAnim.java
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,60 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.Constants; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class SkelAnim extends Table { | ||
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } | ||
public static SkelAnim getRootAsSkelAnim(ByteBuffer _bb) { return getRootAsSkelAnim(_bb, new SkelAnim()); } | ||
public static SkelAnim getRootAsSkelAnim(ByteBuffer _bb, SkelAnim obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public SkelAnim __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Bone bones(int j) { return bones(new Bone(), j); } | ||
public Bone bones(Bone obj, int j) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } | ||
public int bonesLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } | ||
public Bone.Vector bonesVector() { return bonesVector(new Bone.Vector()); } | ||
public Bone.Vector bonesVector(Bone.Vector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } | ||
public BoneInit initData(int j) { return initData(new BoneInit(), j); } | ||
public BoneInit initData(BoneInit obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } | ||
public int initDataLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } | ||
public BoneInit.Vector initDataVector() { return initDataVector(new BoneInit.Vector()); } | ||
public BoneInit.Vector initDataVector(BoneInit.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } | ||
|
||
public static int createSkelAnim(FlatBufferBuilder builder, | ||
int bonesOffset, | ||
int initDataOffset) { | ||
builder.startTable(2); | ||
SkelAnim.addInitData(builder, initDataOffset); | ||
SkelAnim.addBones(builder, bonesOffset); | ||
return SkelAnim.endSkelAnim(builder); | ||
} | ||
|
||
public static void startSkelAnim(FlatBufferBuilder builder) { builder.startTable(2); } | ||
public static void addBones(FlatBufferBuilder builder, int bonesOffset) { builder.addOffset(0, bonesOffset, 0); } | ||
public static int createBonesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } | ||
public static void startBonesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } | ||
public static void addInitData(FlatBufferBuilder builder, int initDataOffset) { builder.addOffset(1, initDataOffset, 0); } | ||
public static int createInitDataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } | ||
public static void startInitDataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } | ||
public static int endSkelAnim(FlatBufferBuilder builder) { | ||
int o = builder.endTable(); | ||
return o; | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public SkelAnim get(int j) { return get(new SkelAnim(), j); } | ||
public SkelAnim get(SkelAnim obj, int j) { return obj.__assign(Table.__indirect(__element(j), bb), bb); } | ||
} | ||
} | ||
|
48 changes: 48 additions & 0 deletions
48
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Transform.java
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,48 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Transform extends Struct { | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Transform __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public Vec3f scale() { return scale(new Vec3f()); } | ||
public Vec3f scale(Vec3f obj) { return obj.__assign(bb_pos, bb); } | ||
public Vec4f rotate() { return rotate(new Vec4f()); } | ||
public Vec4f rotate(Vec4f obj) { return obj.__assign(bb_pos + 12, bb); } | ||
public Vec3f translate() { return translate(new Vec3f()); } | ||
public Vec3f translate(Vec3f obj) { return obj.__assign(bb_pos + 28, bb); } | ||
|
||
public static int createTransform(FlatBufferBuilder builder, float scale_x, float scale_y, float scale_z, float rotate_x, float rotate_y, float rotate_z, float rotate_w, float translate_x, float translate_y, float translate_z) { | ||
builder.prep(4, 40); | ||
builder.prep(4, 12); | ||
builder.putFloat(translate_z); | ||
builder.putFloat(translate_y); | ||
builder.putFloat(translate_x); | ||
builder.prep(4, 16); | ||
builder.putFloat(rotate_w); | ||
builder.putFloat(rotate_z); | ||
builder.putFloat(rotate_y); | ||
builder.putFloat(rotate_x); | ||
builder.prep(4, 12); | ||
builder.putFloat(scale_z); | ||
builder.putFloat(scale_y); | ||
builder.putFloat(scale_x); | ||
return builder.offset(); | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Transform get(int j) { return get(new Transform(), j); } | ||
public Transform get(Transform obj, int j) { return obj.__assign(__element(j), bb); } | ||
} | ||
} | ||
|
35 changes: 35 additions & 0 deletions
35
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Vec3f.java
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 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Vec3f extends Struct { | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Vec3f __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public float x() { return bb.getFloat(bb_pos); } | ||
public float y() { return bb.getFloat(bb_pos + 4); } | ||
public float z() { return bb.getFloat(bb_pos + 8); } | ||
|
||
public static int createVec3f(FlatBufferBuilder builder, float x, float y, float z) { | ||
builder.prep(4, 12); | ||
builder.putFloat(z); | ||
builder.putFloat(y); | ||
builder.putFloat(x); | ||
return builder.offset(); | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Vec3f get(int j) { return get(new Vec3f(), j); } | ||
public Vec3f get(Vec3f obj, int j) { return obj.__assign(__element(j), bb); } | ||
} | ||
} | ||
|
35 changes: 35 additions & 0 deletions
35
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Vec3s.java
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 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Vec3s extends Struct { | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Vec3s __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public int x() { return bb.getShort(bb_pos) & 0xFFFF; } | ||
public int y() { return bb.getShort(bb_pos + 2) & 0xFFFF; } | ||
public int z() { return bb.getShort(bb_pos + 4) & 0xFFFF; } | ||
|
||
public static int createVec3s(FlatBufferBuilder builder, int x, int y, int z) { | ||
builder.prep(2, 6); | ||
builder.putShort((short) z); | ||
builder.putShort((short) y); | ||
builder.putShort((short) x); | ||
return builder.offset(); | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Vec3s get(int j) { return get(new Vec3s(), j); } | ||
public Vec3s get(Vec3s obj, int j) { return obj.__assign(__element(j), bb); } | ||
} | ||
} | ||
|
37 changes: 37 additions & 0 deletions
37
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Vec4f.java
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,37 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Vec4f extends Struct { | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Vec4f __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public float x() { return bb.getFloat(bb_pos); } | ||
public float y() { return bb.getFloat(bb_pos + 4); } | ||
public float z() { return bb.getFloat(bb_pos + 8); } | ||
public float w() { return bb.getFloat(bb_pos + 12); } | ||
|
||
public static int createVec4f(FlatBufferBuilder builder, float x, float y, float z, float w) { | ||
builder.prep(4, 16); | ||
builder.putFloat(w); | ||
builder.putFloat(z); | ||
builder.putFloat(y); | ||
builder.putFloat(x); | ||
return builder.offset(); | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Vec4f get(int j) { return get(new Vec4f(), j); } | ||
public Vec4f get(Vec4f obj, int j) { return obj.__assign(__element(j), bb); } | ||
} | ||
} | ||
|
37 changes: 37 additions & 0 deletions
37
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/Vec4s.java
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,37 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
import com.google.flatbuffers.BaseVector; | ||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
@SuppressWarnings("unused") | ||
public final class Vec4s extends Struct { | ||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } | ||
public Vec4s __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public int x() { return bb.getShort(bb_pos) & 0xFFFF; } | ||
public int y() { return bb.getShort(bb_pos + 2) & 0xFFFF; } | ||
public int z() { return bb.getShort(bb_pos + 4) & 0xFFFF; } | ||
public int w() { return bb.getShort(bb_pos + 6) & 0xFFFF; } | ||
|
||
public static int createVec4s(FlatBufferBuilder builder, int x, int y, int z, int w) { | ||
builder.prep(2, 8); | ||
builder.putShort((short) w); | ||
builder.putShort((short) z); | ||
builder.putShort((short) y); | ||
builder.putShort((short) x); | ||
return builder.offset(); | ||
} | ||
|
||
public static final class Vector extends BaseVector { | ||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } | ||
|
||
public Vec4s get(int j) { return get(new Vec4s(), j); } | ||
public Vec4s get(Vec4s obj, int j) { return obj.__assign(__element(j), bb); } | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
src/assetLoading/java/gg/generationsmod/rarecandy/model/animation/tranm/VectorTrack.java
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 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package gg.generationsmod.rarecandy.model.animation.tranm; | ||
|
||
@SuppressWarnings("unused") | ||
public final class VectorTrack { | ||
private VectorTrack() { } | ||
public static final byte NONE = 0; | ||
public static final byte FixedVectorTrack = 1; | ||
public static final byte DynamicVectorTrack = 2; | ||
public static final byte Framed16VectorTrack = 3; | ||
public static final byte Framed8VectorTrack = 4; | ||
|
||
public static final String[] names = { "NONE", "FixedVectorTrack", "DynamicVectorTrack", "Framed16VectorTrack", "Framed8VectorTrack", }; | ||
|
||
public static String name(int e) { return names[e]; } | ||
} | ||
|
48 changes: 48 additions & 0 deletions
48
src/assetLoading/java/gg/generationsmod/rarecandy/model/material/ShadingMethod.java
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,48 @@ | ||
package gg.generationsmod.rarecandy.model.material; | ||
|
||
public enum ShadingMethod { | ||
/** | ||
* Flat shading. Shading is done on per-face base, diffuse only. Also known as 'faceted shading' | ||
*/ | ||
FLAT, | ||
/** | ||
* Simple Gouraud shading | ||
*/ | ||
GOURAUD, | ||
/** | ||
* Phong-Shading | ||
*/ | ||
PHONG, | ||
/** | ||
* Phong-Blinn-Shading | ||
*/ | ||
BLINN, | ||
/** | ||
* Toon-Shading per pixel. Also known as 'comic' shader | ||
*/ | ||
TOON, | ||
/** | ||
* OrenNayar-Shading per pixel. Extension to standard Lambertian shading, taking the roughness of the material into account | ||
*/ | ||
OREN_NAYAR, | ||
/** | ||
* Minnaert-Shading per pixel. Extension to standard Lambertian shading, taking the 'darkness' of the material into account | ||
*/ | ||
MINNAERT, | ||
/** | ||
* CookTorrance-Shading per pixel. Special shader for metallic surfaces | ||
*/ | ||
COOK_TORRANCE, | ||
/** | ||
* No shading at all. Constant light influence of 1.0. Also known as "Unlit" | ||
*/ | ||
NO_SHADING, | ||
/** | ||
* Fresnel shading | ||
*/ | ||
FRESNEL, | ||
/** | ||
* Physically Based Rendering. | ||
*/ | ||
PBR_BRDF, | ||
} |
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