aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2014-02-07 19:39:36 +0100
committerJulien Gouesse <[email protected]>2014-02-07 19:39:36 +0100
commitf7b44e9467c48fc623c0d451c3456263b8a04ffc (patch)
tree3c931610c20905330ebef177f21ba21f95d6868d
parent68891c20e8b7297d339ca760b52ad6ff31e4a0cc (diff)
Adds some other intermediary classes into the MD3 importer
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java45
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java6
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java61
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java38
4 files changed, 149 insertions, 1 deletions
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java
new file mode 100644
index 0000000..e24d903
--- /dev/null
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * Ardor3D is free software: you can redistribute it and/or modify it
+ * under the terms of its license which may be found in the accompanying
+ * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
+ */
+
+package com.ardor3d.extension.model.md3;
+
+import com.ardor3d.math.Vector3;
+import com.ardor3d.math.type.ReadOnlyVector3;
+
+/**
+ * frame of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#Frame
+ */
+final class Md3Frame {
+
+ /** First corner of the bounding box. */
+ final Vector3 _minBounds;
+ /** Second corner of the bounding box. */
+ final Vector3 _maxBounds;
+ /** Local origin, usually (0, 0, 0). */
+ final Vector3 _localOrigin;
+ /** Radius of the bounding sphere. */
+ final float _radius;
+ /** name */
+ final String _name;
+
+ Md3Frame(final ReadOnlyVector3 minBounds, final ReadOnlyVector3 maxBounds, final ReadOnlyVector3 localOrigin,
+ final float radius, final String name) {
+ super();
+ _minBounds = new Vector3();
+ _maxBounds = new Vector3();
+ _localOrigin = new Vector3();
+ _minBounds.set(minBounds);
+ _maxBounds.set(maxBounds);
+ _localOrigin.set(localOrigin);
+ _radius = radius;
+ _name = name;
+ }
+
+}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java
index a7bf15d..ddc96ab 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java
@@ -33,7 +33,10 @@ final class Md3Header {
final int _numSurface;
/** Number of Skin objects, unused */
final int _numSkins;
- /** Relative offset from start of MD3 object where Frame objects start. The Frame objects are written sequentially, that is, when you read one Frame object, you do not need to seek() for the next object. */
+ /**
+ * Relative offset from start of MD3 object where Frame objects start. The Frame objects are written sequentially,
+ * that is, when you read one Frame object, you do not need to seek() for the next object.
+ */
final int _offsetFrame;
/** Relative offset from start of MD3 where Tag objects start. Similarly written sequentially. */
final int _offsetTag;
@@ -45,6 +48,7 @@ final class Md3Header {
Md3Header(final int magic, final int version, final String name, final int flags, final int numFrames,
final int numTags, final int numSurface, final int numSkins, final int offsetFrame, final int offsetTag,
final int offsetSurface, final int offsetEnd) {
+ super();
_magic = magic;
_version = version;
_name = name;
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java
new file mode 100644
index 0000000..03905c0
--- /dev/null
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * Ardor3D is free software: you can redistribute it and/or modify it
+ * under the terms of its license which may be found in the accompanying
+ * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
+ */
+
+package com.ardor3d.extension.model.md3;
+
+import com.ardor3d.math.Vector2;
+import com.ardor3d.math.Vector3;
+
+/**
+ * Surface of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#Surface
+ */
+final class Md3Surface {
+
+ /** name */
+ String name;
+ /** flags */
+ int flags;
+ /** Number of animation frames. This should match NUM_FRAMES in the MD3 header. */
+ int numFrames;
+ /**
+ * Number of Shader objects defined in this Surface, with a limit of MD3_MAX_SHADERS. Current value of
+ * MD3_MAX_SHADERS is 256.
+ */
+ int numShaders;
+ /** Number of Vertex objects defined in this Surface, up to MD3_MAX_VERTS. Current value of MD3_MAX_VERTS is 4096. */
+ int numVerts;
+ /**
+ * Number of Triangle objects defined in this Surface, maximum of MD3_MAX_TRIANGLES. Current value of
+ * MD3_MAX_TRIANGLES is 8192.
+ */
+ int numTriangles;
+ /** Relative offset from SURFACE_START where the list of Triangle objects starts. */
+ int offsetTriangles;
+ /** Relative offset from SURFACE_START where the list of Shader objects starts. */
+ int offsetShaders;
+ /** Relative offset from SURFACE_START where the list of ST objects (s-t texture coordinates) starts. */
+ int offsetTexCoord;
+ /** Relative offset from SURFACE_START where the list of Vertex objects (X-Y-Z-N vertices) starts. */
+ int offsetXyzNormal;
+ /** Relative offset from SURFACE_START to where the Surface object ends. */
+ int offsetEnd;
+ /** */
+ int[] triIndexes;
+ /** */
+ Vector2[] texCoords;
+ /** */
+ Vector3[][] verts;
+ /** */
+ Vector3[][] norms;
+
+ Md3Surface() {
+ super();
+ }
+}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java
new file mode 100644
index 0000000..e344bea
--- /dev/null
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * Ardor3D is free software: you can redistribute it and/or modify it
+ * under the terms of its license which may be found in the accompanying
+ * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
+ */
+
+package com.ardor3d.extension.model.md3;
+
+import com.ardor3d.math.Matrix3;
+import com.ardor3d.math.Vector3;
+import com.ardor3d.math.type.ReadOnlyMatrix3;
+import com.ardor3d.math.type.ReadOnlyVector3;
+
+/**
+ * Tag of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#Tag
+ */
+final class Md3Tag {
+
+ /** name */
+ final String _name;
+ /** coordinates */
+ final Vector3 _origin;
+ /** 3x3 rotation matrix */
+ final Matrix3 _axis;
+
+ Md3Tag(final String name, final ReadOnlyVector3 origin, final ReadOnlyMatrix3 axis) {
+ super();
+ _origin = new Vector3();
+ _axis = new Matrix3();
+ _name = name;
+ _origin.set(origin);
+ _axis.set(axis);
+ }
+}