Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="Opengl Animation/lib/natives"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="Animation"/>
<classpathentry kind="src" path="ColladaParser"/>
<classpathentry kind="src" path="Engine"/>
<classpathentry kind="src" path="Resources"/>
<classpathentry kind="lib" path="lib/jars/lwjgl_util.jar"/>
<classpathentry kind="lib" path="lib/jars/lwjgl.jar"/>
<classpathentry kind="lib" path="lib/jars/PNGDecoder.jar"/>
<classpathentry kind="lib" path="lib/jars/slick-util.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar




lib/

17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Opengl Animation</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
4 changes: 3 additions & 1 deletion Animation/animatedModel/AnimatedModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public void update() {
* animation pose.
*/
public Matrix4f[] getJointTransforms() {
Matrix4f[] jointMatrices = new Matrix4f[jointCount];
Matrix4f[] jointMatrices = new Matrix4f[jointCount+1];
System.out.println("AnimatedModel jointCount" +jointCount);
addJointsToArray(rootJoint, jointMatrices);
return jointMatrices;
}
Expand All @@ -141,6 +142,7 @@ public Matrix4f[] getJointTransforms() {
* - the array of joint transforms that is being filled.
*/
private void addJointsToArray(Joint headJoint, Matrix4f[] jointMatrices) {
System.out.println("AnimatedModel headJoint " +headJoint.children.size());
jointMatrices[headJoint.index] = headJoint.getAnimatedTransform();
for (Joint childJoint : headJoint.children) {
addJointsToArray(childJoint, jointMatrices);
Expand Down
46 changes: 46 additions & 0 deletions Animation/animatedModel/AnimatedSubModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package animatedModel;

import java.util.List;

import animation.Animation;

public class AnimatedSubModel {
private List<AnimatedModel> animatedSubModels;
private List<Animation> animations;
private List<SubModelInfo> subModelInfo;




public AnimatedSubModel(List<AnimatedModel> animatedSubModels, List<Animation> animations,
List<SubModelInfo> subModelInfo) {

this.animatedSubModels = animatedSubModels;
this.animations = animations;
this.subModelInfo = subModelInfo;
}



public List<AnimatedModel> getAnimatedSubModels() {
return animatedSubModels;
}

public List<Animation> getAnimations() {
return animations;
}



public List<SubModelInfo> getSubModelInfo() {
return subModelInfo;
}








}
26 changes: 26 additions & 0 deletions Animation/animatedModel/AnimationNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package animatedModel;

import xmlParser.XmlNode;

public class AnimationNode {

private XmlNode nodeAnimation;
private XmlNode skeletonNode ;

public AnimationNode(XmlNode nodeAnimation, XmlNode skeletonNode) {

this.nodeAnimation = nodeAnimation;
this.skeletonNode = skeletonNode;
}

public XmlNode getNodeAnimation() {
return nodeAnimation;
}

public XmlNode getSkeletonNode() {
return skeletonNode;
}



}
35 changes: 35 additions & 0 deletions Animation/animatedModel/SubModelInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package animatedModel;

import xmlParser.XmlNode;

/**
*
* @author Kundan
*
*/
public class SubModelInfo {

private XmlNode geometryChild;
private XmlNode skinChild;
private XmlNode skeletonChild;
public SubModelInfo(XmlNode geometryChildren, XmlNode skinChildren, XmlNode skeletonChildren) {

this.geometryChild = geometryChildren;
this.skinChild = skinChildren;
this.skeletonChild = skeletonChildren;

}

public XmlNode getGeometryChildren() {
return geometryChild;
}
public XmlNode getSkinChildren() {
return skinChild;
}
public XmlNode getSkeletonChildren() {
return skeletonChild;
}



}
5 changes: 3 additions & 2 deletions Animation/loaders/AnimatedModelLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import animatedModel.AnimatedModel;
import animatedModel.Joint;
import animatedModel.SubModelInfo;
import colladaLoader.ColladaLoader;
import dataStructures.AnimatedModelData;
import dataStructures.JointData;
Expand All @@ -23,8 +24,8 @@ public class AnimatedModelLoader {
* - the file containing the data for the entity.
* @return The animated entity (no animation applied though)
*/
public static AnimatedModel loadEntity(MyFile modelFile, MyFile textureFile) {
AnimatedModelData entityData = ColladaLoader.loadColladaModel(modelFile, GeneralSettings.MAX_WEIGHTS);
public static AnimatedModel loadEntity(SubModelInfo subModels, MyFile textureFile) {
AnimatedModelData entityData = ColladaLoader.loadColladaModel(subModels, GeneralSettings.MAX_WEIGHTS);
Vao model = createVao(entityData.getMeshData());
Texture texture = loadTexture(textureFile);
SkeletonData skeletonData = entityData.getJointsData();
Expand Down
5 changes: 3 additions & 2 deletions Animation/loaders/AnimationLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;

import animatedModel.AnimationNode;
import animation.Animation;
import animation.JointTransform;
import animation.KeyFrame;
Expand Down Expand Up @@ -34,8 +35,8 @@ public class AnimationLoader {
* animation.
* @return The animation made from the data in the file.
*/
public static Animation loadAnimation(MyFile colladaFile) {
AnimationData animationData = ColladaLoader.loadColladaAnimation(colladaFile);
public static Animation loadAnimation(AnimationNode animationNode) {
AnimationData animationData = ColladaLoader.loadColladaAnimation(animationNode);
KeyFrame[] frames = new KeyFrame[animationData.keyFrames.length];
for (int i = 0; i < frames.length; i++) {
frames[i] = createKeyFrame(animationData.keyFrames[i]);
Expand Down
Loading