Mainly Javadoc fixes and Math stuff
This commit is contained in:
parent
a5615938c9
commit
0f2936e709
|
@ -83,7 +83,7 @@ public final class Display {
|
||||||
* @param displayMode a display mode to choose
|
* @param displayMode a display mode to choose
|
||||||
* @param fullscreen whether to create the display fullscreen
|
* @param fullscreen whether to create the display fullscreen
|
||||||
* @throws Exception if the display mode could not be set
|
* @throws Exception if the display mode could not be set
|
||||||
* @see destroy()
|
* @see #destroy()
|
||||||
*/
|
*/
|
||||||
public static void create(
|
public static void create(
|
||||||
DisplayMode displayMode,
|
DisplayMode displayMode,
|
||||||
|
@ -108,7 +108,7 @@ public final class Display {
|
||||||
* Native method to create the display. This will set the handle if it is
|
* Native method to create the display. This will set the handle if it is
|
||||||
* successful.
|
* successful.
|
||||||
* @return true if the display was successfully created
|
* @return true if the display was successfully created
|
||||||
* @see create()
|
* @see #create(org.lwjgl.DisplayMode, boolean)
|
||||||
*/
|
*/
|
||||||
private static native boolean nCreate(
|
private static native boolean nCreate(
|
||||||
int width,
|
int width,
|
||||||
|
|
|
@ -43,18 +43,18 @@ package org.lwjgl;
|
||||||
|
|
||||||
public final class DisplayMode {
|
public final class DisplayMode {
|
||||||
|
|
||||||
public final int width, height, freq, bpp;
|
public final int width, height, bpp, freq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a display mode.
|
* Construct a display mode.
|
||||||
*
|
*
|
||||||
* @see Display
|
* @see Display
|
||||||
*/
|
*/
|
||||||
public DisplayMode(int width, int height, int freq, int bpp) {
|
public DisplayMode(int width, int height, int bpp, int freq) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.freq = freq;
|
|
||||||
this.bpp = bpp;
|
this.bpp = bpp;
|
||||||
|
this.freq = freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ public final class Math {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Straight copy */
|
/** Straight copy */
|
||||||
public static final class MatrixOpCopy extends UnaryMatrixOperation {
|
private static final class MatrixOpCopy extends UnaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpCopy() {
|
MatrixOpCopy() {
|
||||||
super(0, "copy");
|
super(0, "copy");
|
||||||
|
@ -183,7 +183,7 @@ public final class Math {
|
||||||
public static final MatrixOpCopy MATRIXOP_COPY = new MatrixOpCopy();
|
public static final MatrixOpCopy MATRIXOP_COPY = new MatrixOpCopy();
|
||||||
|
|
||||||
/** Negate the vector */
|
/** Negate the vector */
|
||||||
public static final class MatrixOpNegate extends UnaryMatrixOperation {
|
private static final class MatrixOpNegate extends UnaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpNegate() {
|
MatrixOpNegate() {
|
||||||
super(1, "negate");
|
super(1, "negate");
|
||||||
|
@ -247,7 +247,7 @@ public final class Math {
|
||||||
public static final MatrixOpNegate MATRIXOP_NEGATE = new MatrixOpNegate();
|
public static final MatrixOpNegate MATRIXOP_NEGATE = new MatrixOpNegate();
|
||||||
|
|
||||||
/** Normalise the vector (set to length 1) */
|
/** Normalise the vector (set to length 1) */
|
||||||
public static final class MatrixOpNormalise extends UnaryMatrixOperation {
|
private static final class MatrixOpNormalise extends UnaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpNormalise() {
|
MatrixOpNormalise() {
|
||||||
super(2, "normalise");
|
super(2, "normalise");
|
||||||
|
@ -311,7 +311,7 @@ public final class Math {
|
||||||
public static final MatrixOpNormalise MATRIXOP_NORMALISE = new MatrixOpNormalise();
|
public static final MatrixOpNormalise MATRIXOP_NORMALISE = new MatrixOpNormalise();
|
||||||
|
|
||||||
/** Compute the inverse matrix */
|
/** Compute the inverse matrix */
|
||||||
public static final class MatrixOpInvert extends UnaryMatrixOperation {
|
private static final class MatrixOpInvert extends UnaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpInvert() {
|
MatrixOpInvert() {
|
||||||
super(3, "invert");
|
super(3, "invert");
|
||||||
|
@ -392,10 +392,11 @@ public final class Math {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the compatibility of a binary matrix operation.
|
* Check the compatibility of a binary matrix operation.
|
||||||
|
* @return the miniumum stride, in bytes
|
||||||
* @throws IllegalArgumentException if the source and destinations are not
|
* @throws IllegalArgumentException if the source and destinations are not
|
||||||
* compatible
|
* compatible
|
||||||
*/
|
*/
|
||||||
abstract void checkCompatibility(
|
abstract int checkCompatibility(
|
||||||
int leftSourceWidth,
|
int leftSourceWidth,
|
||||||
int leftSourceHeight,
|
int leftSourceHeight,
|
||||||
boolean transposeLeftSource,
|
boolean transposeLeftSource,
|
||||||
|
@ -410,13 +411,13 @@ public final class Math {
|
||||||
|
|
||||||
|
|
||||||
/** Multiply left source by right source */
|
/** Multiply left source by right source */
|
||||||
public static final class MatrixOpMultiply extends BinaryMatrixOperation {
|
private static final class MatrixOpMultiply extends BinaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpMultiply() {
|
MatrixOpMultiply() {
|
||||||
super(0, "multiply");
|
super(0, "multiply");
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCompatibility(
|
int checkCompatibility(
|
||||||
int leftSourceWidth,
|
int leftSourceWidth,
|
||||||
int leftSourceHeight,
|
int leftSourceHeight,
|
||||||
boolean transposeLeftSource,
|
boolean transposeLeftSource,
|
||||||
|
@ -430,6 +431,9 @@ public final class Math {
|
||||||
int rightHeight = transposeRightSource ? rightSourceWidth : rightSourceHeight;
|
int rightHeight = transposeRightSource ? rightSourceWidth : rightSourceHeight;
|
||||||
if (leftWidth != rightHeight)
|
if (leftWidth != rightHeight)
|
||||||
throw new IllegalArgumentException("Left and right matrices are not compatible.");
|
throw new IllegalArgumentException("Left and right matrices are not compatible.");
|
||||||
|
int leftHeight = transposeLeftSource ? leftSourceWidth : leftSourceHeight;
|
||||||
|
int rightWidth = transposeRightSource ? rightSourceHeight : rightSourceWidth;
|
||||||
|
return (rightWidth * leftHeight) << 2;
|
||||||
}
|
}
|
||||||
MatrixOpClassification classify() {
|
MatrixOpClassification classify() {
|
||||||
return MATRIXOP_NONE;
|
return MATRIXOP_NONE;
|
||||||
|
@ -502,13 +506,13 @@ public final class Math {
|
||||||
public static final MatrixOpMultiply MATRIXOP_MULTIPLY = new MatrixOpMultiply();
|
public static final MatrixOpMultiply MATRIXOP_MULTIPLY = new MatrixOpMultiply();
|
||||||
|
|
||||||
/** Add right source to left source */
|
/** Add right source to left source */
|
||||||
public static final class MatrixOpAdd extends BinaryMatrixOperation {
|
private static final class MatrixOpAdd extends BinaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpAdd() {
|
MatrixOpAdd() {
|
||||||
super(1, "add");
|
super(1, "add");
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCompatibility(
|
int checkCompatibility(
|
||||||
int leftSourceWidth,
|
int leftSourceWidth,
|
||||||
int leftSourceHeight,
|
int leftSourceHeight,
|
||||||
boolean transposeLeftSource,
|
boolean transposeLeftSource,
|
||||||
|
@ -526,6 +530,7 @@ public final class Math {
|
||||||
if (leftSourceWidth != rightSourceHeight || leftSourceHeight != rightSourceWidth)
|
if (leftSourceWidth != rightSourceHeight || leftSourceHeight != rightSourceWidth)
|
||||||
throw new IllegalArgumentException("Left and right matrices are not the same size.");
|
throw new IllegalArgumentException("Left and right matrices are not the same size.");
|
||||||
}
|
}
|
||||||
|
return (leftSourceWidth * leftSourceHeight) << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixOpClassification classify() {
|
MatrixOpClassification classify() {
|
||||||
|
@ -599,13 +604,13 @@ public final class Math {
|
||||||
public static final MatrixOpAdd MATRIXOP_ADD = new MatrixOpAdd();
|
public static final MatrixOpAdd MATRIXOP_ADD = new MatrixOpAdd();
|
||||||
|
|
||||||
/** Subtract right source from left source */
|
/** Subtract right source from left source */
|
||||||
public static final class MatrixOpSubtract extends BinaryMatrixOperation {
|
private static final class MatrixOpSubtract extends BinaryMatrixOperation {
|
||||||
|
|
||||||
MatrixOpSubtract() {
|
MatrixOpSubtract() {
|
||||||
super(2, "subtract");
|
super(2, "subtract");
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCompatibility(
|
int checkCompatibility(
|
||||||
int leftSourceWidth,
|
int leftSourceWidth,
|
||||||
int leftSourceHeight,
|
int leftSourceHeight,
|
||||||
boolean transposeLeftSource,
|
boolean transposeLeftSource,
|
||||||
|
@ -615,7 +620,7 @@ public final class Math {
|
||||||
boolean transposeDest)
|
boolean transposeDest)
|
||||||
{
|
{
|
||||||
// Same as for add, obviously...
|
// Same as for add, obviously...
|
||||||
MATRIXOP_ADD.checkCompatibility(
|
return MATRIXOP_ADD.checkCompatibility(
|
||||||
leftSourceWidth,
|
leftSourceWidth,
|
||||||
leftSourceHeight,
|
leftSourceHeight,
|
||||||
transposeLeftSource,
|
transposeLeftSource,
|
||||||
|
@ -994,7 +999,7 @@ public final class Math {
|
||||||
rightSourceStride = rightSourceWidth * rightSourceHeight;
|
rightSourceStride = rightSourceWidth * rightSourceHeight;
|
||||||
|
|
||||||
// Ensure the source and destination matrices are compatible
|
// Ensure the source and destination matrices are compatible
|
||||||
operation.checkCompatibility(
|
int minStride = operation.checkCompatibility(
|
||||||
leftSourceWidth,
|
leftSourceWidth,
|
||||||
leftSourceHeight,
|
leftSourceHeight,
|
||||||
transposeLeftSource,
|
transposeLeftSource,
|
||||||
|
@ -1003,10 +1008,8 @@ public final class Math {
|
||||||
transposeRightSource,
|
transposeRightSource,
|
||||||
transposeDest);
|
transposeDest);
|
||||||
|
|
||||||
if (destStride == 0) {
|
if (destStride == 0)
|
||||||
// Calculate the destination stride from the input matrix sizes
|
destStride = minStride;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check unary matrix operation type
|
// Check unary matrix operation type
|
||||||
MatrixOpClassification op = operation.classify().check(leftSourceAddress, leftSourceStride, leftElements, destAddress, destStride);
|
MatrixOpClassification op = operation.classify().check(leftSourceAddress, leftSourceStride, leftElements, destAddress, destStride);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public final class Sys {
|
||||||
* inside a process which is already a different priority then this will not
|
* inside a process which is already a different priority then this will not
|
||||||
* be the initial priority.
|
* be the initial priority.
|
||||||
*
|
*
|
||||||
* @see #setProcessPriority()
|
* @see #setProcessPriority(int)
|
||||||
*/
|
*/
|
||||||
public static final int NORMAL_PRIORITY = 0;
|
public static final int NORMAL_PRIORITY = 0;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public final class Sys {
|
||||||
*
|
*
|
||||||
* This priority is <strong>not</strong> recommended for gaming applications.
|
* This priority is <strong>not</strong> recommended for gaming applications.
|
||||||
*
|
*
|
||||||
* @see #setProcessPriority()
|
* @see #setProcessPriority(int)
|
||||||
*/
|
*/
|
||||||
public static final int REALTIME_PRIORITY = 2;
|
public static final int REALTIME_PRIORITY = 2;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ abstract class BaseGL {
|
||||||
* @param alphaBits the number of alpha bits (eg. 0 or 8)
|
* @param alphaBits the number of alpha bits (eg. 0 or 8)
|
||||||
* @param depthBits the number of depth bits (eg. 16 or 24)
|
* @param depthBits the number of depth bits (eg. 16 or 24)
|
||||||
* @param stencilBits the number of stencil bits (eg. 0 or 8)
|
* @param stencilBits the number of stencil bits (eg. 0 or 8)
|
||||||
* @see create()
|
* @see #create()
|
||||||
*/
|
*/
|
||||||
public BaseGL(int colorBits, int alphaBits, int depthBits, int stencilBits) {
|
public BaseGL(int colorBits, int alphaBits, int depthBits, int stencilBits) {
|
||||||
this.colorBits = colorBits;
|
this.colorBits = colorBits;
|
||||||
|
@ -125,7 +125,7 @@ abstract class BaseGL {
|
||||||
* created by calling its setDisplayMode() method.
|
* created by calling its setDisplayMode() method.
|
||||||
*
|
*
|
||||||
* @return true if the GL was created successfully
|
* @return true if the GL was created successfully
|
||||||
* @see org.lwjgl.Display#create()
|
* @see org.lwjgl.Display#create(org.lwjgl.DisplayMode, boolean)
|
||||||
*/
|
*/
|
||||||
private native boolean nCreate(int colorBits, int alphaBits, int depthBits, int stencilBits);
|
private native boolean nCreate(int colorBits, int alphaBits, int depthBits, int stencilBits);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ abstract class BaseGL {
|
||||||
* Finalizer, marked final. To perform specialized cleanup override the
|
* Finalizer, marked final. To perform specialized cleanup override the
|
||||||
* cleanup() method.
|
* cleanup() method.
|
||||||
*
|
*
|
||||||
* @see cleanup()
|
* @see #cleanup()
|
||||||
*/
|
*/
|
||||||
public final void finalize() throws Throwable {
|
public final void finalize() throws Throwable {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
|
|
Loading…
Reference in New Issue