You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
|
2
|
3
(9) |
|
4
(28) |
5
(1) |
6
(9) |
7
(9) |
8
|
9
(7) |
10
|
|
11
(1) |
12
(18) |
13
(8) |
14
|
15
|
16
(2) |
17
(2) |
|
18
(17) |
19
(5) |
20
(5) |
21
(12) |
22
(1) |
23
|
24
|
|
25
|
26
(1) |
27
|
28
|
29
(3) |
30
(2) |
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-19 22:24:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28263/src/java/org/lwjgl/util Modified Files: GL.java Log Message: Now with all the ARB and EXT methods! Index: GL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/GL.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- GL.java 18 Apr 2004 16:24:58 -0000 1.1 +++ GL.java 19 Apr 2004 22:24:30 -0000 1.2 @@ -32,27 +32,26 @@ package org.lwjgl.util; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import org.lwjgl.opengl.GL11; [...2816 lines suppressed...] + * @param size + * @param stride + * @param pPointer + */ + public static void glVertexWeightPointerEXT(int size, int stride, + FloatBuffer pPointer) { + EXTVertexWeighting.glVertexWeightPointerEXT(size, stride, pPointer); + } + /** + * @param size + * @param type + * @param stride + * @param buffer_offset + */ + public static void glVertexWeightPointerEXT(int size, int type, int stride, + int buffer_offset) { + EXTVertexWeighting.glVertexWeightPointerEXT(size, type, stride, + buffer_offset); + } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-19 21:55:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21411/src/java/org/lwjgl/util/vector Modified Files: Vector3f.java Vector2f.java Vector4f.java Added Files: WritableVector4f.java WritableVector2f.java WritableVector3f.java Log Message: Tweaks to the Vector package, and finalized the Model structure. So I hope. --- NEW FILE: WritableVector2f.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * $Id: WritableVector2f.java,v 1.1 2004/04/19 21:54:58 cix_foo Exp $ * Writable interface to Vector2fs * @author $author$ * @version $revision$ */ public interface WritableVector2f { /** * Set the X value * @param x */ public void setX(float x); /** * Set the Y value * @param y */ public void setY(float y); /** * Set the X,Y values * @param x, y */ public void set(float x, float y); } Index: Vector2f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector/Vector2f.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Vector2f.java 18 Apr 2004 20:01:05 -0000 1.1 +++ Vector2f.java 19 Apr 2004 21:54:58 -0000 1.2 @@ -43,7 +43,7 @@ * @version $Revision$ */ -public class Vector2f extends Vector implements Serializable, ReadableVector2f { +public class Vector2f extends Vector implements Serializable, ReadableVector2f, WritableVector2f { public float x, y; @@ -68,14 +68,12 @@ set(x, y); } - /** - * Set values - * @return this + /* (non-Javadoc) + * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ - public Vector2f set(float x, float y) { + public void set(float x, float y) { this.x = x; this.y = y; - return this; } /** @@ -188,7 +186,8 @@ if (dest == null) return new Vector2f(left.x + right.x, left.y + right.y); else { - return dest.set(left.x + right.x, left.y + right.y); + dest.set(left.x + right.x, left.y + right.y); + return dest; } } @@ -204,7 +203,8 @@ if (dest == null) return new Vector2f(left.x - right.x, left.y - right.y); else { - return dest.set(left.x - right.x, left.y - right.y); + dest.set(left.x - right.x, left.y - right.y); + return dest; } } --- NEW FILE: WritableVector3f.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * $Id: WritableVector3f.java,v 1.1 2004/04/19 21:54:58 cix_foo Exp $ * Writable interface to Vector3fs * @author $author$ * @version $revision$ */ public interface WritableVector3f extends WritableVector2f { /** * Set the Z value * @param z */ public void setZ(float z); /** * Set the X,Y,Z values * @param x, y, z */ public void set(float x, float y, float z); } --- NEW FILE: WritableVector4f.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * $Id: WritableVector4f.java,v 1.1 2004/04/19 21:54:58 cix_foo Exp $ * Writable interface to Vector4fs * @author $author$ * @version $revision$ */ public interface WritableVector4f extends WritableVector3f { /** * Set the W value * @param w */ public void setW(float w); /** * Set the X,Y,Z,W values * @param x, y, z, w */ public void set(float x, float y, float z, float w); } Index: Vector4f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector/Vector4f.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Vector4f.java 18 Apr 2004 20:01:08 -0000 1.1 +++ Vector4f.java 19 Apr 2004 21:54:58 -0000 1.2 @@ -43,7 +43,7 @@ * @version $Revision$ */ -public class Vector4f extends Vector implements Serializable, ReadableVector4f { +public class Vector4f extends Vector implements Serializable, ReadableVector4f, WritableVector4f { public float x, y, z, w; @@ -68,16 +68,31 @@ set(x, y, z, w); } - /** - * Set values - * @return this + /* (non-Javadoc) + * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ - public Vector4f set(float x, float y, float z, float w) { + public void set(float x, float y) { + this.x = x; + this.y = y; + } + + /* (non-Javadoc) + * @see org.lwjgl.util.vector.WritableVector3f#set(float, float, float) + */ + public void set(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + } + + /* (non-Javadoc) + * @see org.lwjgl.util.vector.WritableVector4f#set(float, float, float, float) + */ + public void set(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; - return this; } /** @@ -126,7 +141,8 @@ if (dest == null) return new Vector4f(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); else { - return dest.set(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); + dest.set(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); + return dest; } } @@ -142,7 +158,8 @@ if (dest == null) return new Vector4f(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); else { - return dest.set(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); + dest.set(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); + return dest; } } @@ -294,6 +311,7 @@ this.z = z; } + /* (Overrides) * @see org.lwjgl.vector.ReadableVector3f#getZ() */ Index: Vector3f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector/Vector3f.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Vector3f.java 18 Apr 2004 20:01:06 -0000 1.1 +++ Vector3f.java 19 Apr 2004 21:54:58 -0000 1.2 @@ -43,7 +43,7 @@ * @version $Revision$ */ -public class Vector3f extends Vector implements Serializable, ReadableVector3f { +public class Vector3f extends Vector implements Serializable, ReadableVector3f, WritableVector3f { public float x, y, z; @@ -68,15 +68,21 @@ set(x, y, z); } - /** - * Set values - * @return this + /* (non-Javadoc) + * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ - public Vector3f set(float x, float y, float z) { + public void set(float x, float y) { + this.x = x; + this.y = y; + } + + /* (non-Javadoc) + * @see org.lwjgl.util.vector.WritableVector3f#set(float, float, float) + */ + public void set(float x, float y, float z) { this.x = x; this.y = y; this.z = z; - return this; } /** @@ -123,7 +129,8 @@ if (dest == null) return new Vector3f(left.x + right.x, left.y + right.y, left.z + right.z); else { - return dest.set(left.x + right.x, left.y + right.y, left.z + right.z); + dest.set(left.x + right.x, left.y + right.y, left.z + right.z); + return dest; } } @@ -139,7 +146,8 @@ if (dest == null) return new Vector3f(left.x - right.x, left.y - right.y, left.z - right.z); else { - return dest.set(left.x - right.x, left.y - right.y, left.z - right.z); + dest.set(left.x - right.x, left.y - right.y, left.z - right.z); + return dest; } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-19 21:55:08
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21411/src/java/org/lwjgl/util/model Modified Files: Triangle.java Vertex.java Frame.java Model.java Added Files: Skin.java Removed Files: Mesh.java Log Message: Tweaks to the Vector package, and finalized the Model structure. So I hope. Index: Frame.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Frame.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Frame.java 18 Apr 2004 19:30:32 -0000 1.2 +++ Frame.java 19 Apr 2004 21:54:57 -0000 1.3 @@ -45,11 +45,15 @@ /** The new transformations for each Bone in the Skeleton */ private final Matrix4f[] bone; + /** Frame time */ + private final float time; + /** * C'tor * @param bone[] */ - public Frame(Matrix4f[] bone) { + public Frame(float time, Matrix4f[] bone) { + this.time = time; this.bone = bone; } @@ -59,4 +63,11 @@ public Matrix4f[] getBone() { return bone; } + + /** + * @return the frame time + */ + public float getTime() { + return time; + } } Index: Model.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Model.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Model.java 18 Apr 2004 19:30:32 -0000 1.2 +++ Model.java 19 Apr 2004 21:54:57 -0000 1.3 @@ -51,23 +51,34 @@ public static final long serialVersionUID = 1L; - /** The Mesh */ - private final Mesh mesh; + /** Material */ + private final String material; + + /** Vertices */ + private final Vertex[] vertex; + + /** Triangles */ + private final Triangle[] triangle; /** The animations: a Map of string names to Frame[] arrays */ private final Map animation; /** * C'tor - * @param mesh - * @param frame + * @param material + * @param vertex + * @param triangle + * @param animation */ - public Model(Mesh mesh, Map animation) { - this.mesh = mesh; + public Model(String material, Vertex[] vertex, Triangle[] triangle, Map animation) { + this.material = material; + this.vertex = vertex; + this.triangle = triangle; this.animation = animation; } /** + * Get a named animation from the Model * @param name The name of the animation * @return the Frames of an animation (or null, if no such animation exists) */ @@ -76,10 +87,25 @@ } /** - * @return the Mesh + * @return Returns the material. */ - public Mesh getMesh() { - return mesh; + public String getMaterial() { + return material; + } + + /** + * @return Returns the triangles. + */ + public Triangle[] getTriangle() { + return triangle; } + /** + * @return Returns the vertices + */ + public Vertex[] getVertex() { + return vertex; + } + + } --- Mesh.java DELETED --- Index: Vertex.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Vertex.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Vertex.java 18 Apr 2004 19:30:32 -0000 1.2 +++ Vertex.java 19 Apr 2004 21:54:57 -0000 1.3 @@ -33,10 +33,13 @@ import java.io.Serializable; +import org.lwjgl.util.vector.ReadableVector2f; +import org.lwjgl.util.vector.ReadableVector3f; + /** * $Id$ * - * A single vertex in a Triangle + * A single vertex in a mesh. * * @author $Author$ * @version $Revision$ @@ -46,44 +49,56 @@ public static final long serialVersionUID = 1L; /** Coordinates */ - private final float x, y, z; + private final ReadableVector3f coords; /** Normal */ - private final float nx, ny, nz; + private final ReadableVector3f normal; /** Texture coordinates */ - private final float u, v; + private final ReadableVector2f texCoords; - /** Bone indices: these look up into the current Frame's bone array */ - private final int[] bone; + /** Skin */ + private final Skin[] skin; + + /** + * C'tor + * @param coords + * @param normal + * @param texCoords + * @param skin + */ + public Vertex(ReadableVector3f coords, ReadableVector3f normal, ReadableVector2f texCoords, Skin[] skin) { + this.coords = coords; + this.normal = normal; + this.texCoords = texCoords; + this.skin = skin; + } + + /** + * @return Returns the coords. + */ + public ReadableVector3f getCoords() { + return coords; + } - /** Bone weights (always sum to 1.0f) */ - private final float[] weight; + /** + * @return Returns the normal. + */ + public ReadableVector3f getNormal() { + return normal; + } /** - * C'tor - * @param x - * @param y - * @param z - * @param nx - * @param ny - * @param nz - * @param u - * @param v - * @param bone - * @param weight + * @return Returns the skin. */ - public Vertex(float x, float y, float z, float nx, float ny, float nz, - float u, float v, int[] bone, float[] weight) { - this.x = x; - this.y = y; - this.z = z; - this.nx = nx; - this.ny = ny; - this.nz = nz; - this.u = u; - this.v = v; - this.bone = bone; - this.weight = weight; + public Skin[] getSkin() { + return skin; + } + + /** + * @return Returns the texCoords. + */ + public ReadableVector2f getTexCoords() { + return texCoords; } } --- NEW FILE: Skin.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model; import java.io.Serializable; /** * $Id: Skin.java,v 1.1 2004/04/19 21:54:57 cix_foo Exp $ * Describes how a bone influences a vertex. * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Skin implements Serializable { public static final long serialVersionUID = 1L; /** Bone index */ private final int bone; /** Weight */ private final float weight; /** * C'tor */ public Skin(int bone, float weight) { this.bone = bone; this.weight = weight; } /** * @return Returns the bone index. */ public int getBone() { return bone; } /** * @return Returns the weight. */ public float getWeight() { return weight; } } Index: Triangle.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Triangle.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Triangle.java 18 Apr 2004 18:59:49 -0000 1.1 +++ Triangle.java 19 Apr 2004 21:54:57 -0000 1.2 @@ -31,24 +31,59 @@ */ package org.lwjgl.util.model; +import java.io.Serializable; + /** * $Id$ * @author $Author$ * @version $Revision$ */ -public class Triangle { +public class Triangle implements Serializable { public static final long serialVersionUID = 1L; /** Vertex indices: these look up into the parent Mesh's vertex array */ - private int a, b, c; + private final int a, b, c; /** Adjacency, for stripification */ - private int adjacency; + private final int adjacency; /** * C'tor + * @param a + * @param b + * @param c + * @param adjacency */ - public Triangle() { + public Triangle(int a, int b, int c, int adjacency) { + this.a = a; + this.b = b; + this.c = c; + this.adjacency = adjacency; + } + + /** + * @return Returns the 'a' vertex index + */ + public int getA() { + return a; + } + /** + * @return Returns the 'b' vertex index + */ + public int getB() { + return b; + } + /** + * @return Returns the 'c' vertex index + */ + public int getC() { + return c; + } + /** + * @return Returns the adjacency. + */ + public int getAdjacency() { + return adjacency; } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-19 21:55:07
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21411/src/java/org/lwjgl/util/model/renderer Modified Files: Renderer.java Log Message: Tweaks to the Vector package, and finalized the Model structure. So I hope. Index: Renderer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer/Renderer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Renderer.java 18 Apr 2004 20:01:01 -0000 1.2 +++ Renderer.java 19 Apr 2004 21:54:58 -0000 1.3 @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.Map; +import org.lwjgl.util.model.Frame; import org.lwjgl.util.model.Model; /** @@ -63,11 +64,24 @@ /** * Render a Model * @param model The model to render + * @param animation The name of the animation + * @param time The time for the animation */ - public void render(Model model) { + public void render(Model model, String animation, float time) { // 1. Set up GL state from the Model's material - Renderable material = (Renderable) materials.get(model.getMesh().getMaterial()); + Renderable material = (Renderable) materials.get(model.getMaterial()); + if (material != null) { + material.render(); + } + + // 2. Get the animation + Frame[] frame = model.getAnimation(animation); + if (frame == null) { + return; + } + + // 3. Work out what the nearest frame is to the specified time } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 20:01:53
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23914/src/java/org/lwjgl/test/opengl Modified Files: PbufferTest.java FullScreenWindowedTest.java Log Message: Index: FullScreenWindowedTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- FullScreenWindowedTest.java 4 Apr 2004 12:48:51 -0000 1.29 +++ FullScreenWindowedTest.java 18 Apr 2004 20:01:10 -0000 1.30 @@ -37,7 +37,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; import org.lwjgl.opengl.glu.GLU; -import org.lwjgl.vector.Vector2f; +import org.lwjgl.util.vector.Vector2f; /** * $Id$ Index: PbufferTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- PbufferTest.java 4 Apr 2004 13:18:16 -0000 1.31 +++ PbufferTest.java 18 Apr 2004 20:01:08 -0000 1.32 @@ -42,7 +42,7 @@ import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.Window; import org.lwjgl.opengl.glu.GLU; -import org.lwjgl.vector.Vector2f; +import org.lwjgl.util.vector.Vector2f; /** * $Id$ |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 20:01:44
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23914/src/java/org/lwjgl/test/input Modified Files: MouseCreationTest.java KeyboardTest.java MouseTest.java ControllerTest.java ControllerCreationTest.java Log Message: Index: ControllerTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerTest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ControllerTest.java 4 Apr 2004 12:49:09 -0000 1.22 +++ ControllerTest.java 18 Apr 2004 20:01:28 -0000 1.23 @@ -35,8 +35,8 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.vector.Vector2f; -import org.lwjgl.vector.Vector3f; +import org.lwjgl.util.vector.Vector2f; +import org.lwjgl.util.vector.Vector3f; /** * $Id$ Index: MouseCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- MouseCreationTest.java 26 Mar 2004 21:57:56 -0000 1.28 +++ MouseCreationTest.java 18 Apr 2004 20:01:10 -0000 1.29 @@ -37,7 +37,7 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.vector.Vector2f; +import org.lwjgl.util.vector.Vector2f; /** * $Id$ Index: ControllerCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ControllerCreationTest.java 26 Mar 2004 21:57:56 -0000 1.24 +++ ControllerCreationTest.java 18 Apr 2004 20:01:28 -0000 1.25 @@ -37,7 +37,7 @@ import org.lwjgl.input.Controller; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.vector.Vector2f; +import org.lwjgl.util.vector.Vector2f; /** * $Id$ Index: KeyboardTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/KeyboardTest.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- KeyboardTest.java 7 Apr 2004 07:55:42 -0000 1.24 +++ KeyboardTest.java 18 Apr 2004 20:01:13 -0000 1.25 @@ -36,7 +36,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; import org.lwjgl.opengl.glu.GLU; -import org.lwjgl.vector.Vector2f; +import org.lwjgl.util.vector.Vector2f; /** * $Id$ Index: MouseTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- MouseTest.java 12 Apr 2004 14:46:18 -0000 1.33 +++ MouseTest.java 18 Apr 2004 20:01:14 -0000 1.34 @@ -35,8 +35,8 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.vector.Vector2f; -import org.lwjgl.vector.Vector3f; +import org.lwjgl.util.vector.Vector2f; +import org.lwjgl.util.vector.Vector3f; /** * $Id$ |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 20:01:44
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23914/src/java/org/lwjgl/test/openal Modified Files: MovingSoundTest.java Log Message: Index: MovingSoundTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/MovingSoundTest.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- MovingSoundTest.java 9 Apr 2004 21:38:31 -0000 1.28 +++ MovingSoundTest.java 18 Apr 2004 20:01:02 -0000 1.29 @@ -39,7 +39,7 @@ import org.lwjgl.openal.eax.EAX20; import org.lwjgl.openal.eax.EAXListenerProperties; import org.lwjgl.opengl.Window; -import org.lwjgl.vector.Vector3f; +import org.lwjgl.util.vector.Vector3f; /** * $Id$ |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 20:01:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23914/src/java/org/lwjgl/util/model/renderer Modified Files: Renderer.java Log Message: Index: Renderer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer/Renderer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Renderer.java 18 Apr 2004 19:30:32 -0000 1.1 +++ Renderer.java 18 Apr 2004 20:01:01 -0000 1.2 @@ -65,6 +65,10 @@ * @param model The model to render */ public void render(Model model) { + + // 1. Set up GL state from the Model's material + Renderable material = (Renderable) materials.get(model.getMesh().getMaterial()); + } /** |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 20:01:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23914/src/java/org/lwjgl/util/vector Added Files: Matrix3f.java ReadableVector4f.java Vector2f.java ReadableVector2f.java ReadableVector3f.java Matrix.java Matrix4f.java ReadableVector.java Vector.java Vector3f.java Matrix2f.java Vector4f.java Log Message: --- NEW FILE: Vector2f.java --- /* * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * $Id: Vector2f.java,v 1.1 2004/04/18 20:01:05 cix_foo Exp $ * * Holds a 2-tuple vector. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ public class Vector2f extends Vector implements Serializable, ReadableVector2f { public float x, y; /** * Constructor for Vector3f. */ public Vector2f() { super(); } /** * Constructor */ public Vector2f(ReadableVector2f src) { set(src); } /** * Constructor */ public Vector2f(float x, float y) { set(x, y); } /** * Set values * @return this */ public Vector2f set(float x, float y) { this.x = x; this.y = y; return this; } /** * Load from another Vector2f * @param src The source vector * @return this */ public Vector2f set(ReadableVector2f src) { x = src.getX(); y = src.getY(); return this; } /** * @return the length squared of the vector */ public float lengthSquared() { return x * x + y * y; } /** * Translate a vector * @param x The translation in x * @param y the translation in y * @return this */ public Vector2f translate(float x, float y) { this.x += x; this.y += y; return this; } /** * Negate a vector * @return this */ public Vector negate() { x = -x; y = -y; return this; } /** * Negate a vector and place the result in a destination vector. * @param dest The destination vector or null if a new vector is to be created * @return the negated vector */ public Vector2f negate(Vector2f dest) { if (dest == null) dest = new Vector2f(); dest.x = -x; dest.y = -y; return dest; } /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created * @return the normalised vector */ public Vector2f normalise(Vector2f dest) { float l = length(); if (dest == null) dest = new Vector2f(x / l, y / l); else dest.set(x / l, y / l); return dest; } /** * The dot product of two vectors is calculated as * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z * @param left The LHS vector * @param right The RHS vector * @return left dot right */ public static float dot(Vector2f left, Vector2f right) { return left.x * right.x + left.y * right.y; } /** * Calculate the angle between two vectors, in degrees * @param a A vector * @param b The other vector * @return the angle between the two vectors, in degrees */ public static float angle(Vector2f a, Vector2f b) { float dls = dot(a, b) / (a.length() * b.length()); if (dls < -1f) dls = -1f; else if (dls > 1.0f) dls = 1.0f; return (float) Math.toDegrees(Math.acos(dls)); } /** * Add a vector to another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return the sum of left and right in dest */ public static Vector2f add(Vector2f left, Vector2f right, Vector2f dest) { if (dest == null) return new Vector2f(left.x + right.x, left.y + right.y); else { return dest.set(left.x + right.x, left.y + right.y); } } /** * Subtract a vector from another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return left minus right in dest */ public static Vector2f sub(Vector2f left, Vector2f right, Vector2f dest) { if (dest == null) return new Vector2f(left.x - right.x, left.y - right.y); else { return dest.set(left.x - right.x, left.y - right.y); } } /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ public Vector store(FloatBuffer buf) { buf.put(x); buf.put(y); return this; } /** * Load this vector from a FloatBuffer * @param buf The buffer to load it from, at the current position * @return this */ public Vector load(FloatBuffer buf) { x = buf.get(); y = buf.get(); return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#scale(float) */ public Vector scale(float scale) { x *= scale; y *= scale; return this; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { StringBuffer sb = new StringBuffer(64); sb.append("Vector2f["); sb.append(x); sb.append(", "); sb.append(y); sb.append(']'); return sb.toString(); } /** * @return x */ public final float getX() { return x; } /** * @return y */ public final float getY() { return y; } /** * Set X * @param x */ public final void setX(float x) { this.x = x; } /** * Set Y * @param y */ public final void setY(float y) { this.y = y; } } --- NEW FILE: ReadableVector.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.nio.FloatBuffer; /** * @author foo */ public interface ReadableVector { /** * @return the length of the vector */ public float length(); /** * @return the length squared of the vector */ public float lengthSquared(); /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ public Vector store(FloatBuffer buf); } --- NEW FILE: Matrix.java --- /* * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * $Id: Matrix.java,v 1.1 2004/04/18 20:01:05 cix_foo Exp $ * * Base class for matrices. When a matrix is constructed it will be the identity * matrix unless otherwise stated. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ public abstract class Matrix implements Serializable { /** * Constructor for Matrix. */ public Matrix() { super(); } /** * Set this matrix to be the identity matrix. * @return this */ public abstract Matrix setIdentity(); /** * Invert this matrix * @return this */ public abstract Matrix invert(); /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public abstract Matrix load(FloatBuffer buf); /** * Load from a float buffer. The buffer stores the matrix in row major * (mathematical) order. * * @param buf A float buffer to read from * @return this */ public abstract Matrix loadTranspose(FloatBuffer buf); /** * Negate this matrix * @return this */ public abstract Matrix negate(); /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in * @return this */ public abstract Matrix store(FloatBuffer buf); /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in * @return this */ public abstract Matrix storeTranspose(FloatBuffer buf); /** * Transpose this matrix * @return this */ public abstract Matrix transpose(); /** * Set this matrix to 0. * @return this */ public abstract Matrix setZero(); /** * @return the determinant of the matrix */ public abstract float determinant(); } --- NEW FILE: Matrix2f.java --- /* * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * $Id: Matrix2f.java,v 1.1 2004/04/18 20:01:07 cix_foo Exp $ * * Holds a 2x2 matrix * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ public class Matrix2f extends Matrix implements Serializable { public float m00 = 1.0f, m01, m10, m11 = 1.0f; /** * Constructor for Matrix2f. */ public Matrix2f() { } /** * Constructor */ public Matrix2f(Matrix2f src) { load(src); } /** * Load from another matrix2f * @param src The source matrix * @return this */ public Matrix2f load(Matrix2f src) { m00 = src.m00; m01 = src.m01; m10 = src.m10; m11 = src.m11; return this; } /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public Matrix load(FloatBuffer buf) { m00 = buf.get(); m01 = buf.get(); m10 = buf.get(); m11 = buf.get(); return this; } /** * Load from a float buffer. The buffer stores the matrix in row major * (mathematical) order. * * @param buf A float buffer to read from * @return this */ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); m01 = buf.get(); m11 = buf.get(); return this; } /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m01); buf.put(m10); buf.put(m11); return this; } /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m01); buf.put(m11); return this; } /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix2f add(Matrix2f left, Matrix2f right, Matrix2f dest) { Matrix2f temp = null; if (dest == null) dest = new Matrix2f(); else if (dest == left || dest == right) { temp = dest; dest = new Matrix2f(); } dest.m00 = left.m00 + right.m00; dest.m01 = left.m01 + right.m01; dest.m10 = left.m10 + right.m10; dest.m11 = left.m11 + right.m11; if (temp != null) { temp.load(dest); return temp; } else return dest; } /** * Subtract the right matrix from the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix2f sub(Matrix2f left, Matrix2f right, Matrix2f dest) { Matrix2f temp = null; if (dest == null) dest = new Matrix2f(); else if (dest == left || dest == right) { temp = dest; dest = new Matrix2f(); } dest.m00 = left.m00 - right.m00; dest.m01 = left.m01 - right.m01; dest.m10 = left.m10 - right.m10; dest.m11 = left.m11 - right.m11; if (temp != null) { temp.load(dest); return temp; } else return dest; } /** * Multiply the right matrix by the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix2f mul(Matrix2f left, Matrix2f right, Matrix2f dest) { Matrix2f temp = null; if (dest == null) dest = new Matrix2f(); else if (dest == left || dest == right) { temp = dest; dest = new Matrix2f(); } dest.m00 = left.m00 * right.m00 + left.m10 * right.m01; dest.m01 = left.m01 * right.m00 + left.m11 * right.m01; dest.m10 = left.m00 * right.m10 + left.m10 * right.m11; dest.m11 = left.m01 * right.m10 + left.m11 * right.m11; if (temp != null) { temp.load(dest); return temp; } else return dest; } /** * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ public static Vector2f transform(Matrix2f left, Vector2f right, Vector2f dest) { Vector2f temp = null; if (dest == null) dest = new Vector2f(); else if (dest == right) { temp = dest; dest = new Vector2f(); } dest.x = left.m00 * right.x + left.m10 * right.y; dest.y = left.m01 * right.x + left.m11 * right.y; if (temp != null) { temp.set(dest); return temp; } else return dest; } /** * Transpose this matrix * @return this */ public Matrix transpose() { float temp; temp = m01; m01 = m10; m10 = temp; return this; } /** * Transpose this matrix and place the result in another matrix. * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public Matrix2f transpose(Matrix2f dest) { if (dest == null) dest = new Matrix2f(); if (dest == this) transpose(); else { dest.m01 = m10; dest.m10 = m01; } return dest; } /** * Invert this matrix * @return this if successful, null otherwise */ public Matrix invert() { /* *inv(A) = 1/det(A) * adj(A); */ float determinant = determinant(); if (determinant != 0) { float determinant_inv = 1f/determinant; float t00 = m11*determinant_inv; float t01 = -m01*determinant_inv; float t11 = m00*determinant_inv; float t10 = -m10*determinant_inv; m00 = t00; m01 = t01; m10 = t10; m11 = t11; return this; } else return null; } /** * Returns a string representation of this matrix */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append(m00).append(' ').append(m10).append(' ').append('\n'); buf.append(m01).append(' ').append(m11).append(' ').append('\n'); return buf.toString(); } /** * Negate this matrix * @return this */ public Matrix negate() { m00 = -m00; m01 = -m01; m10 = -m10; m11 = -m11; return this; } /** * Negate this matrix and stash the result in another matrix. * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public Matrix2f negate(Matrix2f dest) { if (dest == null) dest = new Matrix2f(); dest.m00 = -m00; dest.m01 = -m01; dest.m10 = -m10; dest.m11 = -m11; return dest; } /** * Set this matrix to be the identity matrix. * @return this */ public Matrix setIdentity() { m00 = 1.0f; m01 = 0.0f; m10 = 0.0f; m11 = 1.0f; return this; } /** * Set this matrix to 0. * @return this */ public Matrix setZero() { m00 = 0.0f; m01 = 0.0f; m10 = 0.0f; m11 = 0.0f; return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Matrix#determinant() */ public float determinant() { return m00 * m11 - m01*m10; } } --- NEW FILE: Matrix4f.java --- /* * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * Holds a 4x4 float matrix. * * @author foo */ public class Matrix4f extends Matrix implements Serializable { public float m00 = 1.0f, m01, m02, m03, m10, m11 = 1.0f, m12, m13, m20, m21, m22 = 1.0f, m23, m30, m31, m32, m33 = 1.0f; /** * Construct a Matrix4f */ public Matrix4f() { super(); } /** * Returns a string representation of this matrix */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append(m00).append(' ').append(m10).append(' ').append(m20).append(' ').append(m30).append('\n'); buf.append(m01).append(' ').append(m11).append(' ').append(m21).append(' ').append(m31).append('\n'); buf.append(m02).append(' ').append(m12).append(' ').append(m22).append(' ').append(m32).append('\n'); buf.append(m03).append(' ').append(m13).append(' ').append(m23).append(' ').append(m33).append('\n'); return buf.toString(); } /** * Set this matrix to be the identity matrix. * @return this */ public Matrix setIdentity() { m00 = 1.0f; m01 = 0.0f; m02 = 0.0f; m03 = 0.0f; m10 = 0.0f; m11 = 1.0f; m12 = 0.0f; m13 = 0.0f; m20 = 0.0f; m21 = 0.0f; m22 = 1.0f; m23 = 0.0f; m30 = 0.0f; m31 = 0.0f; m32 = 0.0f; m33 = 1.0f; return this; } /** * Set this matrix to 0. * @return this */ public Matrix setZero() { m00 = 0.0f; m01 = 0.0f; m02 = 0.0f; m03 = 0.0f; m10 = 0.0f; m11 = 0.0f; m12 = 0.0f; m13 = 0.0f; m20 = 0.0f; m21 = 0.0f; m22 = 0.0f; m23 = 0.0f; m30 = 0.0f; m31 = 0.0f; m32 = 0.0f; m33 = 0.0f; return this; } /** * Load from another matrix4f * @param src The source matrix * @return this */ public Matrix4f load(Matrix4f src) { m00 = src.m00; m01 = src.m01; m02 = src.m02; m03 = src.m03; m10 = src.m10; m11 = src.m11; m12 = src.m12; m13 = src.m13; m20 = src.m20; m21 = src.m21; m22 = src.m22; m23 = src.m23; m30 = src.m30; m31 = src.m31; m32 = src.m32; m33 = src.m33; return this; } /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public Matrix load(FloatBuffer buf) { m00 = buf.get(); m01 = buf.get(); m02 = buf.get(); m03 = buf.get(); m10 = buf.get(); m11 = buf.get(); m12 = buf.get(); m13 = buf.get(); m20 = buf.get(); m21 = buf.get(); m22 = buf.get(); m23 = buf.get(); m30 = buf.get(); m31 = buf.get(); m32 = buf.get(); m33 = buf.get(); return this; } /** * Load from a float buffer. The buffer stores the matrix in row major * (maths) order. * * @param buf A float buffer to read from * @return this */ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); m20 = buf.get(); m30 = buf.get(); m01 = buf.get(); m11 = buf.get(); m21 = buf.get(); m31 = buf.get(); m02 = buf.get(); m12 = buf.get(); m22 = buf.get(); m32 = buf.get(); m03 = buf.get(); m13 = buf.get(); m23 = buf.get(); m33 = buf.get(); return this; } /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m01); buf.put(m02); buf.put(m03); buf.put(m10); buf.put(m11); buf.put(m12); buf.put(m13); buf.put(m20); buf.put(m21); buf.put(m22); buf.put(m23); buf.put(m30); buf.put(m31); buf.put(m32); buf.put(m33); return this; } /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m20); buf.put(m30); buf.put(m01); buf.put(m11); buf.put(m21); buf.put(m31); buf.put(m02); buf.put(m12); buf.put(m22); buf.put(m32); buf.put(m03); buf.put(m13); buf.put(m23); buf.put(m33); return this; } /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix4f add(Matrix4f left, Matrix4f right, Matrix4f dest) { Matrix4f temp = null; if (dest == null) dest = new Matrix4f(); else if (dest == left || dest == right) { temp = dest; dest = new Matrix4f(); } dest.m00 = left.m00 + right.m00; dest.m01 = left.m01 + right.m01; dest.m02 = left.m02 + right.m02; dest.m03 = left.m03 + right.m03; dest.m10 = left.m10 + right.m10; dest.m11 = left.m11 + right.m11; dest.m12 = left.m12 + right.m12; dest.m13 = left.m13 + right.m13; dest.m20 = left.m20 + right.m20; dest.m21 = left.m21 + right.m21; dest.m22 = left.m22 + right.m22; dest.m23 = left.m23 + right.m23; dest.m30 = left.m30 + right.m30; dest.m31 = left.m31 + right.m31; dest.m32 = left.m32 + right.m32; dest.m33 = left.m33 + right.m33; if (temp != null) { temp.load(dest); return temp; } else return dest; } /** * Subtract the right matrix from the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix4f sub(Matrix4f left, Matrix4f right, Matrix4f dest) { Matrix4f temp = null; if (dest == null) dest = new Matrix4f(); else if (dest == left || dest == right) { temp = dest; dest = new Matrix4f(); } dest.m00 = left.m00 - right.m00; dest.m01 = left.m01 - right.m01; dest.m02 = left.m02 - right.m02; dest.m03 = left.m03 - right.m03; dest.m10 = left.m10 - right.m10; dest.m11 = left.m11 - right.m11; dest.m12 = left.m12 - right.m12; dest.m13 = left.m13 - right.m13; dest.m20 = left.m20 - right.m20; dest.m21 = left.m21 - right.m21; dest.m22 = left.m22 - right.m22; dest.m23 = left.m23 - right.m23; dest.m30 = left.m30 - right.m30; dest.m31 = left.m31 - right.m31; dest.m32 = left.m32 - right.m32; dest.m33 = left.m33 - right.m33; if (temp != null) { temp.load(dest); return temp; } else return dest; } /** * Multiply the right matrix by the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix4f mul(Matrix4f left, Matrix4f right, Matrix4f dest) { Matrix4f temp = null; if (dest == null) dest = new Matrix4f(); else if (dest == left || dest == right) { temp = dest; dest = new Matrix4f(); } dest.m00 = left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02 + left.m30 * right.m03; dest.m01 = left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02 + left.m31 * right.m03; dest.m02 = left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02 + left.m32 * right.m03; dest.m03 = left.m03 * right.m00 + left.m13 * right.m01 + left.m23 * right.m02 + left.m33 * right.m03; dest.m10 = left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12 + left.m30 * right.m13; dest.m11 = left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12 + left.m31 * right.m13; dest.m12 = left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12 + left.m32 * right.m13; dest.m13 = left.m03 * right.m10 + left.m13 * right.m11 + left.m23 * right.m12 + left.m33 * right.m13; dest.m20 = left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22 + left.m30 * right.m23; dest.m21 = left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22 + left.m31 * right.m23; dest.m22 = left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22 + left.m32 * right.m23; dest.m23 = left.m03 * right.m20 + left.m13 * right.m21 + left.m23 * right.m22 + left.m33 * right.m23; dest.m30 = left.m00 * right.m30 + left.m10 * right.m31 + left.m20 * right.m32 + left.m30 * right.m33; dest.m31 = left.m01 * right.m30 + left.m11 * right.m31 + left.m21 * right.m32 + left.m31 * right.m33; dest.m32 = left.m02 * right.m30 + left.m12 * right.m31 + left.m22 * right.m32 + left.m32 * right.m33; dest.m33 = left.m03 * right.m30 + left.m13 * right.m31 + left.m23 * right.m32 + left.m33 * right.m33; if (temp != null) { temp.load(dest); return temp; } else return dest; } /** * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ public static Vector4f transform(Matrix4f left, Vector4f right, Vector4f dest) { Vector4f temp = null; if (dest == null) dest = new Vector4f(); else if (dest == right) { temp = dest; dest = new Vector4f(); } dest.x = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z + left.m30 * right.w; dest.y = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z + left.m31 * right.w; dest.z = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z + left.m32 * right.w; dest.w = left.m03 * right.x + left.m13 * right.y + left.m23 * right.z + left.m33 * right.w; if (temp != null) { temp.set(dest); return temp; } else return dest; } /** * Transpose this matrix * @return this */ public Matrix transpose() { float f = m10; m10 = m01; m01 = f; f = m20; m20 = m02; m02 = f; f = m30; m30 = m03; m03 = f; f = m21; m21 = m12; m12 = f; f = m31; m31 = m13; m13 = f; f = m32; m32 = m23; m23 = f; return this; } /** * Translate this matrix * @param vec The vector to translate by * @return this */ public Matrix4f translate(Vector2f vec) { m30 += m00 * vec.x + m10 * vec.y; m31 += m01 * vec.x + m11 * vec.y; m32 += m02 * vec.x + m12 * vec.y; m33 += m03 * vec.x + m13 * vec.y; return this; } /** * Translate this matrix * @param vec The vector to translate by * @return this */ public Matrix4f translate(Vector3f vec) { m30 += m00 * vec.x + m10 * vec.y + m20 * vec.z; m31 += m01 * vec.x + m11 * vec.y + m21 * vec.z; m32 += m02 * vec.x + m12 * vec.y + m22 * vec.z; m33 += m03 * vec.x + m13 * vec.y + m23 * vec.z; return this; } /** * Scales this matrix * @param vec The vector to scale by * @return this */ public Matrix4f scale(Vector3f vec) { m00 *= vec.x; m01 *= vec.x; m02 *= vec.x; m03 *= vec.x; m10 *= vec.y; m11 *= vec.y; m12 *= vec.y; m13 *= vec.y; m20 *= vec.z; m21 *= vec.z; m22 *= vec.z; m23 *= vec.z; return this; } /** * Rotates the matrix around the given axis the specified angle * @param angle the angle, in degrees. * @param axis The vector representing the rotation axis. Must be normalized. * @return this */ public Matrix4f rotate(float angle, Vector3f axis) { float c = (float) Math.cos(angle); float s = (float) Math.sin(angle); float oneminusc = 1.0f - c; float xy = axis.x*axis.y; float yz = axis.y*axis.z; float xz = axis.x*axis.z; float xs = axis.x*s; float ys = axis.y*s; float zs = axis.z*s; float f00 = axis.x*axis.x*oneminusc+c; float f01 = xy*oneminusc+zs; float f02 = xz*oneminusc-ys; // n[3] not used float f10 = xy*oneminusc-zs; float f11 = axis.y*axis.y*oneminusc+c; float f12 = yz*oneminusc+xs; // n[7] not used float f20 = xz*oneminusc+ys; float f21 = yz*oneminusc-xs; float f22 = axis.z*axis.z*oneminusc+c; float t00 = m00 * f00 + m10 * f01 + m20 * f02; float t01 = m01 * f00 + m11 * f01 + m21 * f02; float t02 = m02 * f00 + m12 * f01 + m22 * f02; float t03 = m03 * f00 + m13 * f01 + m23 * f02; float t10 = m00 * f10 + m10 * f11 + m20 * f12; float t11 = m01 * f10 + m11 * f11 + m21 * f12; float t12 = m02 * f10 + m12 * f11 + m22 * f12; float t13 = m03 * f10 + m13 * f11 + m23 * f12; m20 = m00 * f20 + m10 * f21 + m20 * f22; m21 = m01 * f20 + m11 * f21 + m21 * f22; m22 = m02 * f20 + m12 * f21 + m22 * f22; m23 = m03 * f20 + m13 * f21 + m23 * f22; m00 = t00; m01 = t01; m02 = t02; m03 = t03; m10 = t10; m11 = t11; m12 = t12; m13 = t13; return this; } /** * Rotates the matrix around the given axis the specified angle, and stores it in the specified destination * @param angle the angle, in degrees. * @param axis The vector representing the rotation axis. Must be normalized. * @param dest The destination matrix or null if a new matrix is to be created * @return The rotated matrix */ public Matrix4f rotate(float angle, Vector3f axis, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); else if (dest == this) return rotate(angle, axis); float c = (float) Math.cos(angle); float s = (float) Math.sin(angle); float oneminusc = 1.0f - c; float xy = axis.x*axis.y; float yz = axis.y*axis.z; float xz = axis.x*axis.z; float xs = axis.x*s; float ys = axis.y*s; float zs = axis.z*s; float f0 = axis.x*axis.x*oneminusc+c; float f1 = xy*oneminusc+zs; float f2 = xz*oneminusc-ys; // n[3] not used float f4 = xy*oneminusc-zs; float f5 = axis.y*axis.y*oneminusc+c; float f6 = yz*oneminusc+xs; // n[7] not used float f8 = xz*oneminusc+ys; float f9 = yz*oneminusc-xs; float f10 = axis.z*axis.z*oneminusc+c; /* m[12] to m[15] are not changed by a rotate */ dest.m00 = m00 * f0 + m10 * f1 + m20 * f2; dest.m01 = m01 * f0 + m11 * f1 + m21 * f2; dest.m02 = m02 * f0 + m12 * f1 + m22 * f2; dest.m03 = m03 * f0 + m13 * f1 + m23 * f2; dest.m10 = m00 * f4 + m10 * f5 + m20 * f6; dest.m11 = m01 * f4 + m11 * f5 + m21 * f6; dest.m12 = m02 * f4 + m12 * f5 + m22 * f6; dest.m13 = m03 * f4 + m13 * f5 + m23 * f6; dest.m20 = m00 * f8 + m10 * f9 + m20 * f10; dest.m21 = m01 * f8 + m11 * f9 + m21 * f10; dest.m22 = m02 * f8 + m12 * f9 + m22 * f10; dest.m23 = m03 * f8 + m13 * f9 + m23 * f10; return dest; } /** * Translate this matrix and stash the result in another matrix * @param vec The vector to translate by * @param dest The destination matrix or null if a new matrix is to be created * @return the translated matrix */ public Matrix4f translate(Vector3f vec, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); else if (dest == this) return translate(vec); dest.m30 += m00 * vec.x + m10 * vec.y + m20 * vec.z; dest.m31 += m01 * vec.x + m11 * vec.y + m21 * vec.z; dest.m32 += m02 * vec.x + m12 * vec.y + m22 * vec.z; dest.m33 += m03 * vec.x + m13 * vec.y + m23 * vec.z; return dest; } /** * Translate this matrix and stash the result in another matrix * @param vec The vector to translate by * @param dest The destination matrix or null if a new matrix is to be created * @return the translated matrix */ public Matrix4f translate(Vector2f vec, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); else if (dest == this) return translate(vec); dest.m30 += m00 * vec.x + m10 * vec.y; dest.m31 += m01 * vec.x + m11 * vec.y; dest.m32 += m02 * vec.x + m12 * vec.y; dest.m33 += m03 * vec.x + m13 * vec.y; return dest; } /** * Transpose this matrix and place the result in another matrix * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public Matrix4f transpose(Matrix4f dest) { if (dest == null) { // New matrix needed to store transpose dest = new Matrix4f(); } if (this == dest) { // Destination and source are the same! Run the in-place // transpose instead as the copy transpose will be destructive. transpose(); } else { // Destination differs from source. Perform copy transpose dest.m00 = m00; dest.m01 = m10; dest.m02 = m20; dest.m03 = m30; dest.m10 = m01; dest.m11 = m11; dest.m12 = m21; dest.m13 = m31; dest.m20 = m02; dest.m21 = m12; dest.m22 = m22; dest.m23 = m32; dest.m30 = m03; dest.m31 = m13; dest.m32 = m23; dest.m33 = m33; } return dest; } /** * @return the determinant of the matrix */ public float determinant() { float f = m00 * ((m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32) - m13 * m22 * m31 - m11 * m23 * m32 - m12 * m21 * m33); f -= m01 * ((m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32) - m13 * m22 * m30 - m10 * m23 * m32 - m12 * m20 * m33); f += m02 * ((m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31) - m13 * m21 * m30 - m10 * m23 * m31 - m11 * m20 * m33); f -= m03 * ((m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31) - m12 * m21 * m30 - m10 * m22 * m31 - m11 * m20 * m32); return f; } /** * Calculate the determinant of a 3x3 matrix * @return result */ private float determinant3x3(float t00, float t01, float t02, float t10, float t11, float t12, float t20, float t21, float t22) { return t00 * (t11 * t22 - t12 * t21) + t01 * (t12 * t20 - t10 * t22) + t02 * (t10 * t21 - t11 * t20); } /** * Invert this matrix * @return this if successful, null otherwise */ public Matrix invert() { float determinant = determinant(); if (determinant != 0) { /* * m00 m01 m02 m03 * m10 m11 m12 m13 * m20 m21 m22 m23 * m30 m31 m32 m33 */ float determinant_inv = 1f/determinant; // first row float t00 = determinant3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33); float t01 = -determinant3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33); float t02 = determinant3x3(m10, m11, m13, m20, m21, m23, m30, m31, m33); float t03 = -determinant3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32); // second row float t10 = -determinant3x3(m01, m02, m03, m21, m22, m23, m31, m32, m33); float t11 = determinant3x3(m00, m02, m03, m20, m22, m23, m30, m32, m33); float t12 = -determinant3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33); float t13 = determinant3x3(m00, m01, m02, m20, m21, m22, m30, m31, m32); // third row float t20 = determinant3x3(m01, m02, m03, m11, m12, m13, m31, m32, m33); float t21 = -determinant3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33); float t22 = determinant3x3(m00, m01, m03, m10, m11, m13, m30, m31, m33); float t23 = -determinant3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32); // fourth row float t30 = -determinant3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23); float t31 = determinant3x3(m00, m02, m03, m10, m12, m13, m20, m22, m23); float t32 = -determinant3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23); float t33 = determinant3x3(m00, m01, m02, m10, m11, m12, m20, m21, m22); // transpose and divide by the determinant m00 = t00*determinant_inv; m11 = t11*determinant_inv; m22 = t22*determinant_inv; m33 = t33*determinant_inv; m01 = t10*determinant_inv; m10 = t01*determinant_inv; m20 = t02*determinant_inv; m02 = t20*determinant_inv; m12 = t21*determinant_inv; m21 = t12*determinant_inv; m03 = t30*determinant_inv; m30 = t03*determinant_inv; m13 = t31*determinant_inv; m31 = t13*determinant_inv; m32 = t23*determinant_inv; m23 = t32*determinant_inv; return this; } else return null; } /** * Negate this matrix * @return this */ public Matrix negate() { m00 = -m00; m01 = -m01; m02 = -m02; m03 = -m03; m10 = -m10; m11 = -m11; m12 = -m12; m13 = -m13; m20 = -m20; m21 = -m21; m22 = -m22; m23 = -m23; m30 = -m30; m31 = -m31; m32 = -m32; m33 = -m33; return this; } /** * Negate this matrix and place the result in a destination matrix. * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public Matrix4f negate(Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m00 = -m00; dest.m01 = -m01; dest.m02 = -m02; dest.m03 = -m03; dest.m10 = -m10; dest.m11 = -m11; dest.m12 = -m12; dest.m13 = -m13; dest.m20 = -m20; dest.m21 = -m21; dest.m22 = -m22; dest.m23 = -m23; dest.m30 = -m30; dest.m31 = -m31; dest.m32 = -m32; dest.m33 = -m33; return dest; } } --- NEW FILE: Vector.java --- /* * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * $Id: Vector.java,v 1.1 2004/04/18 20:01:06 cix_foo Exp $ * * Base class for vectors. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ public abstract class Vector implements Serializable, ReadableVector { /** * Constructor for Vector. */ public Vector() { super(); } /** * @return the length of the vector */ public final float length() { return (float) Math.sqrt(lengthSquared()); } /** * @return the length squared of the vector */ public abstract float lengthSquared(); /** * Load this vector from a FloatBuffer * @param buf The buffer to load it from, at the current position * @return this */ public abstract Vector load(FloatBuffer buf); /** * Negate a vector * @return this */ public abstract Vector negate(); /** * Normalise this vector * @return this */ public final Vector normalise() { float len = length(); if (len != 0.0f) { float l = 1.0f / len; return scale(l); } else { assert false; return this; } } /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ public abstract Vector store(FloatBuffer buf); /** * Scale this vector * @param scale The scale factor * @return this */ public abstract Vector scale(float scale); } --- NEW FILE: ReadableVector2f.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * @author foo */ public interface ReadableVector2f extends ReadableVector { /** * @return x */ public float getX(); /** * @return y */ public float getY(); } --- NEW FILE: Vector3f.java --- /* * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * $Id: Vector3f.java,v 1.1 2004/04/18 20:01:06 cix_foo Exp $ * * Holds a 3-tuple vector. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ public class Vector3f extends Vector implements Serializable, ReadableVector3f { public float x, y, z; /** * Constructor for Vector3f. */ public Vector3f() { super(); } /** * Constructor */ public Vector3f(ReadableVector3f src) { set(src); } /** * Constructor */ public Vector3f(float x, float y, float z) { set(x, y, z); } /** * Set values * @return this */ public Vector3f set(float x, float y, float z) { this.x = x; this.y = y; this.z = z; return this; } /** * Load from another Vector3f * @param src The source vector * @return this */ public Vector3f set(ReadableVector3f src) { x = src.getX(); y = src.getY(); z = src.getZ(); return this; } /** * @return the length squared of the vector */ public float lengthSquared() { return x * x + y * y + z * z; } /** * Translate a vector * @param x The translation in x * @param y the translation in y * @return this */ public Vector3f translate(float x, float y, float z) { this.x += x; this.y += y; this.z += z; return this; } /** * Add a vector to another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return the sum of left and right in dest */ public static Vector3f add(Vector3f left, Vector3f right, Vector3f dest) { if (dest == null) return new Vector3f(left.x + right.x, left.y + right.y, left.z + right.z); else { return dest.set(left.x + right.x, left.y + right.y, left.z + right.z); } } /** * Subtract a vector from another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return left minus right in dest */ public static Vector3f sub(Vector3f left, Vector3f right, Vector3f dest) { if (dest == null) return new Vector3f(left.x - right.x, left.y - right.y, left.z - right.z); else { return dest.set(left.x - right.x, left.y - right.y, left.z - right.z); } } /** * The cross product of two vectors. * * @param left The LHS vector * @param right The RHS vector * @param dest The destination result, or null if a new vector is to be created * @return left cross right */ public static Vector3f cross( Vector3f left, Vector3f right, Vector3f dest) { if (dest == null) dest = new Vector3f(); dest.set( left.y * right.z - left.z * right.y, right.x * left.z - right.z * left.x, left.x * right.y - left.y * right.x ); return dest; } /** * Negate a vector * @return this */ public Vector negate() { x = -x; y = -y; z = -z; return this; } /** * Negate a vector and place the result in a destination vector. * @param dest The destination vector or null if a new vector is to be created * @return the negated vector */ public Vector3f negate(Vector3f dest) { if (dest == null) dest = new Vector3f(); dest.x = -x; dest.y = -y; dest.z = -z; return dest; } /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created * @return the normalised vector */ public Vector3f normalise(Vector3f dest) { float l = length(); if (dest == null) dest = new Vector3f(x / l, y / l, z / l); else dest.set(x / l, y / l, z / l); return dest; } /** * The dot product of two vectors is calculated as * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z * @param left The LHS vector * @param right The RHS vector * @return left dot right */ public static float dot(Vector3f left, Vector3f right) { return left.x * right.x + left.y * right.y + left.z * right.z; } /** * Calculate the angle between two vectors, in degrees * @param a A vector * @param b The other vector * @return the angle between the two vectors, in degrees */ public static float angle(Vector3f a, Vector3f b) { float dls = dot(a, b) / (a.length() * b.length()); if (dls < -1f) dls = -1f; else if (dls > 1.0f) dls = 1.0f; return (float) Math.toDegrees(Math.acos(dls)); } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#load(FloatBuffer) */ public Vector load(FloatBuffer buf) { x = buf.get(); y = buf.get(); z = buf.get(); return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#scale(float) */ public Vector scale(float scale) { x *= scale; y *= scale; z *= scale; return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#store(FloatBuffer) */ public Vector store(FloatBuffer buf) { buf.put(x); buf.put(y); buf.put(z); return this; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { StringBuffer sb = new StringBuffer(64); sb.append("Vector3f["); sb.append(x); sb.append(", "); sb.append(y); sb.append(", "); sb.append(z); sb.append(']'); return sb.toString(); } /** * @return x */ public final float getX() { return x; } /** * @return y */ public final float getY() { return y; } /** * Set X * @param x */ public final void setX(float x) { this.x = x; } /** * Set Y * @param y */ public final void setY(float y) { this.y = y; } /** * Set Z * @param z */ public void setZ(float z) { this.z = z; } /* (Overrides) * @see org.lwjgl.vector.ReadableVector3f#getZ() */ public float getZ() { return z; } } --- NEW FILE: ReadableVector3f.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * @author foo */ public interface ReadableVector3f extends ReadableVector2f { /** * @return z */ public float getZ(); } --- NEW FILE: ReadableVector4f.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * @author foo */ public interface ReadableVector4f extends ReadableVector3f { /** * @return w */ public float getW(); } --- NEW FILE: Matrix3f.java ---... [truncated message content] |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 20:01:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23914/src/java/org/lwjgl/vector Removed Files: ReadableVector4f.java Matrix4f.java Vector2f.java Matrix3f.java Vector3f.java Matrix2f.java ReadableVector.java ReadableVector3f.java Vector.java ReadableVector2f.java Vector4f.java Matrix.java Log Message: --- Vector2f.java DELETED --- --- ReadableVector.java DELETED --- --- Matrix.java DELETED --- --- Matrix2f.java DELETED --- --- Matrix4f.java DELETED --- --- Vector.java DELETED --- --- ReadableVector2f.java DELETED --- --- Vector3f.java DELETED --- --- ReadableVector3f.java DELETED --- --- ReadableVector4f.java DELETED --- --- Matrix3f.java DELETED --- --- Vector4f.java DELETED --- |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 19:59:51
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23879/src/java/org/lwjgl/util/vector Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector added to the repository |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 19:30:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17045/src/java/org/lwjgl/util/model Modified Files: Frame.java Vertex.java Model.java Log Message: Models! Models! Models! Index: Model.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Model.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Model.java 18 Apr 2004 18:59:49 -0000 1.1 +++ Model.java 18 Apr 2004 19:30:32 -0000 1.2 @@ -33,13 +33,16 @@ package org.lwjgl.util.model; import java.io.Serializable; +import java.util.Map; /** * $Id$ * * A simple animated, skinned, boned 3D model, consisting of a single mesh - * with a single material. + * with a single material. The model's internal format is optimised for RAM storage; + * no metadata is held in memory - in other words this is not a good class to use + * for, say, a 3d modelling application. * * @author $Author$ * @version $Revision$ @@ -51,24 +54,25 @@ /** The Mesh */ private final Mesh mesh; - /** The animations */ - private final Frame[] frame; + /** The animations: a Map of string names to Frame[] arrays */ + private final Map animation; /** * C'tor * @param mesh * @param frame */ - public Model(Mesh mesh, Frame[] frame) { + public Model(Mesh mesh, Map animation) { this.mesh = mesh; - this.frame = frame; + this.animation = animation; } /** - * @return the Frames + * @param name The name of the animation + * @return the Frames of an animation (or null, if no such animation exists) */ - public Frame[] getFrame() { - return frame; + public Frame[] getAnimation(String name) { + return (Frame[]) animation.get(name); } /** Index: Vertex.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Vertex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Vertex.java 18 Apr 2004 18:59:49 -0000 1.1 +++ Vertex.java 18 Apr 2004 19:30:32 -0000 1.2 @@ -54,10 +54,10 @@ /** Texture coordinates */ private final float u, v; - /** Bone indices */ + /** Bone indices: these look up into the current Frame's bone array */ private final int[] bone; - /** Bone weights */ + /** Bone weights (always sum to 1.0f) */ private final float[] weight; /** Index: Frame.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/Frame.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Frame.java 18 Apr 2004 18:59:49 -0000 1.1 +++ Frame.java 18 Apr 2004 19:30:32 -0000 1.2 @@ -33,7 +33,7 @@ import java.io.Serializable; -import org.lwjgl.vector.Matrix4f; +import org.lwjgl.util.vector.Matrix4f; /** * A Frame describes a set of new positions for Bones. |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 19:30:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17045/src/java/org/lwjgl/util/model/renderer Added Files: Renderable.java Renderer.java Log Message: Models! Models! Models! --- NEW FILE: Renderable.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model.renderer; /** * $Id: Renderable.java,v 1.1 2004/04/18 19:30:32 cix_foo Exp $ * * Simple interface to things that can be Rendered. * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public interface Renderable { /** * "Render" this thing. This will involve calls to the GL. */ public void render(); } --- NEW FILE: Renderer.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model.renderer; import java.util.HashMap; import java.util.Map; import org.lwjgl.util.model.Model; /** * $Id: Renderer.java,v 1.1 2004/04/18 19:30:32 cix_foo Exp $ * * A simple (and very inefficient) Model renderer. This calculates the model vertices on the fly * and uses GL immediate mode to render the result. This is of course very slow. * <p> * Material lookups are performed by mapping the material name to a Renderable thing. You must * suppy appropriate Renderables - typically something that binds a 2D texture and sets up some * GL state. * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Renderer { /** Material map: String name->Renderable */ private final Map materials = new HashMap(); /** * C'tor */ public Renderer() { } /** * Render a Model * @param model The model to render */ public void render(Model model) { } /** * Add a material * @param name The material's name * @param renderable The renderable object */ public void putMaterial(String name, Renderable renderable) { materials.put(name, renderable); } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 19:30:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17045/src/java/org/lwjgl/util/model/loader Added Files: Loader.java Log Message: Models! Models! Models! --- NEW FILE: Loader.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model.loader; import org.lwjgl.util.model.Model; import org.w3c.dom.Document; /** * $Id: Loader.java,v 1.1 2004/04/18 19:30:32 cix_foo Exp $ * * Loads a Model from an XML document. * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Loader { /** The source document */ private final Document src; /** * C'tor */ public Loader(Document src) { this.src = src; } /** * Load the model from the XML document and return it. * @return Model * @throws Exception */ public Model load() throws Exception { } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 19:30:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16996/src/java/org/lwjgl/util/model/loader Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/loader added to the repository |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 19:30:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16996/src/java/org/lwjgl/util/model/renderer Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model/renderer added to the repository |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 18:59:58
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11009/src/java/org/lwjgl/util/model Added Files: Frame.java Triangle.java Vertex.java Model.java Mesh.java Log Message: A utility Model class --- NEW FILE: Frame.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model; import java.io.Serializable; import org.lwjgl.vector.Matrix4f; /** * A Frame describes a set of new positions for Bones. */ public class Frame implements Serializable { public static final long serialVersionUID = 1L; /** The new transformations for each Bone in the Skeleton */ private final Matrix4f[] bone; /** * C'tor * @param bone[] */ public Frame(Matrix4f[] bone) { this.bone = bone; } /** * @return the Bones */ public Matrix4f[] getBone() { return bone; } } --- NEW FILE: Model.java --- /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model; import java.io.Serializable; /** * $Id: Model.java,v 1.1 2004/04/18 18:59:49 cix_foo Exp $ * * A simple animated, skinned, boned 3D model, consisting of a single mesh * with a single material. * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Model implements Serializable { public static final long serialVersionUID = 1L; /** The Mesh */ private final Mesh mesh; /** The animations */ private final Frame[] frame; /** * C'tor * @param mesh * @param frame */ public Model(Mesh mesh, Frame[] frame) { this.mesh = mesh; this.frame = frame; } /** * @return the Frames */ public Frame[] getFrame() { return frame; } /** * @return the Mesh */ public Mesh getMesh() { return mesh; } } --- NEW FILE: Mesh.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model; import java.io.Serializable; /** * $Id: Mesh.java,v 1.1 2004/04/18 18:59:49 cix_foo Exp $ * * A Mesh is a collection of Triangles that all share the same material (ie. rendering * state). * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Mesh implements Serializable { public static final long serialVersionUID = 1L; /** Material */ private final String material; /** Vertices */ private final Vertex[] vertex; /** Triangles */ private final Triangle[] triangle; /** * C'tor * @param material * @param vertex * @param triangle */ public Mesh(String material, Vertex[] vertex, Triangle[] triangle) { this.material = material; this.vertex = vertex; this.triangle = triangle; } /** * @return Returns the material. */ public String getMaterial() { return material; } /** * @return Returns the triangles. */ public Triangle[] getTriangle() { return triangle; } /** * @return Returns the vertices */ public Vertex[] getVertex() { return vertex; } } --- NEW FILE: Vertex.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model; import java.io.Serializable; /** * $Id: Vertex.java,v 1.1 2004/04/18 18:59:49 cix_foo Exp $ * * A single vertex in a Triangle * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Vertex implements Serializable { public static final long serialVersionUID = 1L; /** Coordinates */ private final float x, y, z; /** Normal */ private final float nx, ny, nz; /** Texture coordinates */ private final float u, v; /** Bone indices */ private final int[] bone; /** Bone weights */ private final float[] weight; /** * C'tor * @param x * @param y * @param z * @param nx * @param ny * @param nz * @param u * @param v * @param bone * @param weight */ public Vertex(float x, float y, float z, float nx, float ny, float nz, float u, float v, int[] bone, float[] weight) { this.x = x; this.y = y; this.z = z; this.nx = nx; this.ny = ny; this.nz = nz; this.u = u; this.v = v; this.bone = bone; this.weight = weight; } } --- NEW FILE: Triangle.java --- /* * Copyright (c) 2003 Shaven Puppy Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Shaven Puppy' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.model; /** * $Id: Triangle.java,v 1.1 2004/04/18 18:59:49 cix_foo Exp $ * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Triangle { public static final long serialVersionUID = 1L; /** Vertex indices: these look up into the parent Mesh's vertex array */ private int a, b, c; /** Adjacency, for stripification */ private int adjacency; /** * C'tor */ public Triangle() { } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 18:59:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10987/src/java/org/lwjgl/util/model Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/model added to the repository |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 16:25:07
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11523/src/java/org/lwjgl/util Added Files: GL.java Log Message: The new utils package! --- NEW FILE: GL.java --- /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * [...3031 lines suppressed...] } /** * @param target * @param access * @param size * @param oldBuffer * @return */ public static ByteBuffer glMapBuffer(int target, int access, int size, ByteBuffer oldBuffer) { return GL15.glMapBuffer(target, access, size, oldBuffer); } /** * @param target * @return */ public static boolean glUnmapBuffer(int target) { return GL15.glUnmapBuffer(target); } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-18 16:24:46
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11473/src/java/org/lwjgl/util Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util added to the repository |
|
From: Brian M. <ma...@us...> - 2004-04-18 03:20:15
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7947 Modified Files: org_lwjgl_opengl_Window.cpp Log Message: missing function found by llewmason Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- org_lwjgl_opengl_Window.cpp 23 Mar 2004 21:23:58 -0000 1.36 +++ org_lwjgl_opengl_Window.cpp 18 Apr 2004 03:20:04 -0000 1.37 @@ -189,6 +189,10 @@ return vsync_enabled; } +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVisible(JNIEnv *env, jclass clazz) { + return JNI_TRUE; +} + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetVSyncEnabled(JNIEnv *env, jclass clazz, jboolean enable) { bool should_enable = enable == JNI_TRUE; if (vsync_enabled != should_enable) { |
|
From: Brian M. <ma...@us...> - 2004-04-17 01:17:43
|
Update of /cvsroot/java-game-lib/LWJGL/www/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20776/images Added Files: javanet_button_90.gif openal_logo.png opengl_logo.png Log Message: logo stuff --- NEW FILE: opengl_logo.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: openal_logo.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: javanet_button_90.gif --- (This appears to be a binary file; contents omitted.) |
|
From: Brian M. <ma...@us...> - 2004-04-17 01:17:43
|
Update of /cvsroot/java-game-lib/LWJGL/www/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20776/include Modified Files: default.php Log Message: logo stuff Index: default.php =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/www/include/default.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- default.php 30 Mar 2004 17:18:40 -0000 1.1 +++ default.php 17 Apr 2004 01:17:33 -0000 1.2 @@ -53,12 +53,20 @@ echo " <!-- icon block -->\n"; echo " <div align=\"center\">\n"; + echo " <!-- opengl -->\n"; + echo " <a href=\"http://opengl.org\" target=\"blank\"><img src=\"images/opengl_logo.png\" width=\"88\" height=\"45\" border=\"0\" alt=\"OpenGL.org logo\" title=\"Using OpenGL technology\"/></a>\n"; + echo " <!-- openal -->\n"; + echo " <br>\n"; + echo " <a href=\"http://openal.org\" target=\"blank\"><img src=\"images/openal_logo.png\" width=\"88\" height=\"47\" border=\"0\" alt=\"OpenAL.org logo\" title=\"Using OpenAL technology\"/></a>\n"; + echo " <!-- java.net -->\n"; + echo " <br><br>\n"; + echo " <a href=\"http://java.net\" target=\"blank\"><img src=\"images/javanet_button_90.gif\" width=\"90\" height=\"25\" border=\"0\" alt=\"java.net logo\" title=\"java.net member\"/></a>\n"; echo " <!-- donation -->\n"; - echo " <p> </p>\n"; - echo " <a href=\"http://sourceforge.net/donate/index.php?group_id=58488\"><img src=\"http://images.sourceforge.net/images/project-support.jpg\" width=\"88\" height=\"32\" border=\"0\" alt=\"Support This Project\" title=\"Donate to LWJGL\"/></a>\n"; + echo " <br><br>\n"; + echo " <a href=\"http://sourceforge.net/donate/index.php?group_id=58488\" target=\"blank\"><img src=\"http://images.sourceforge.net/images/project-support.jpg\" width=\"88\" height=\"32\" border=\"0\" alt=\"Support This Project\" title=\"Donate to LWJGL\"/></a>\n"; echo " <!-- SF icon -->\n"; echo " <br><br>\n"; - echo " <a href=\"http://sourceforge.net\"><img src=\"http://sourceforge.net/sflogo.php?group_id=58488&type=1\" width=\"88\" height=\"31\" border=\"0\" alt=\"SourceForge.net Logo\" title=\"SourceForge.net Logo\"></a>\n"; + echo " <a href=\"http://sourceforge.net\" target=\"blank\"><img src=\"http://sourceforge.net/sflogo.php?group_id=58488&type=1\" width=\"88\" height=\"31\" border=\"0\" alt=\"SourceForge.net Logo\" title=\"SourceForge.net Logo\"/></a>\n"; echo " </div>\n"; echo " <br>\n"; echo "</div>\n\n"; @@ -94,8 +102,6 @@ //////////////////////////////////////////////////////////////////////////////// function printFooter() { echo "<div class=\"footer\">this site and its content is © <a class=\"footer\" href=\"mailto:in...@lw...\">lwjgl.org</a>"; - echo "<!-- java.net icon -->\n"; - echo "<br><br>\n"; echo "</div>\n\n"; echo "</body>"; echo "</html>"; |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-16 10:46:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30746/src/java/org/lwjgl/examples Added Files: Game.java Log Message: First example code checked in! --- NEW FILE: Game.java --- /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.openal.AL; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; /** * $Id: Game.java,v 1.1 2004/04/16 10:46:30 cix_foo Exp $ * * This is a <em>very basic</em> skeleton to init a game and run it. * * @author $Author: cix_foo $ * @version $Revision: 1.1 $ */ public class Game { /** Game title */ public static final String GAME_TITLE = "My Game"; /** Desired frame time */ private static final float FRAMETIME = 1.0f / 60.0f; /** Exit the game */ private static boolean finished; /** * No constructor needed - this class is static */ private Game() {} /** * Application init * @param args Commandline args */ public static void main(String[] args) { try { init(); run(); } catch (Exception e) { e.printStackTrace(System.err); Sys.alert(GAME_TITLE, "An error occured and the game will exit."); } finally { cleanup(); } } /** * Initialise the game * @throws Exception if init fails */ private static void init() throws Exception { // Create a fullscreen window with 1:1 orthographic 2D projection, and with // mouse, keyboard, and gamepad inputs. Window.create(GAME_TITLE); // Enable vsync if we can Window.setVSyncEnabled(true); // Start up the sound system AL.create(); // TODO: Load in your textures etc here } /** * Runs the game (the "main loop") */ private static void run() { while (!finished) { // Always call Window.update(), all the time Window.update(); if (Window.isCloseRequested()) { // Check for O/S close requests finished = true; } else if (Window.isActive()) { // The window is in the foreground, so we should play the game long timeThen = Sys.getTime(); logic(); render(); // Stabilise the framerate if we haven't got vsync if (!Window.isVSyncEnabled()) { long timeNow = Sys.getTime(); while ((float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < FRAMETIME) { // This is a system-friendly way of allowing other stuff to use CPU if it wants to Thread.yield(); timeNow = Sys.getTime(); } } } else { // The window is not in the foreground, so we can allow other stuff to run and // infrequently update try { Thread.sleep(100); } catch (InterruptedException e) { } logic(); if (Window.isVisible() || Window.isDirty()) { // Only bother rendering if the window is visible or dirty render(); } } } } /** * Do any game-specific cleanup */ private static void cleanup() { // TODO: save anything you want to disk here // Stop the sound AL.destroy(); // Close the window Window.destroy(); } /** * Do all calculations, handle input, etc. */ private static void logic() { // Example input handler: we'll check for the ESC key and finish the game instantly when it's pressed if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { finished = true; } // TODO: all your game logic goes here. } /** * Render the current frame */ private static void render() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT); // TODO: all your rendering goes here } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-04-16 10:46:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30715/src/java/org/lwjgl/examples Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples added to the repository |