Made gluProject to use one result FloatBuffer, javadoc corrections
This commit is contained in:
parent
e1e6ea2093
commit
7dc7337396
|
@ -81,18 +81,16 @@ public class GLU implements GLUConstants {
|
|||
* @param modelMatrix
|
||||
* @param projMatrix
|
||||
* @param viewport
|
||||
* @param winx
|
||||
* @param winy
|
||||
* @param winz
|
||||
* @param win_pos
|
||||
* @return
|
||||
*/
|
||||
public static boolean gluProject(float objx, float objy, float objz,
|
||||
FloatBuffer modelMatrix,
|
||||
FloatBuffer projMatrix,
|
||||
IntBuffer viewport,
|
||||
FloatBuffer winx, FloatBuffer winy, FloatBuffer winz)
|
||||
FloatBuffer win_pos)
|
||||
{
|
||||
return Project.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz);
|
||||
return Project.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,8 +142,8 @@ public class GLU implements GLUConstants {
|
|||
|
||||
/**
|
||||
* Method gluCheckExtension.
|
||||
* @param string
|
||||
* @param string1
|
||||
* @param extName
|
||||
* @param extString
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean gluCheckExtension(String extName, String extString) {
|
||||
|
@ -178,14 +176,14 @@ public class GLU implements GLUConstants {
|
|||
/**
|
||||
* Method gluScaleImage.
|
||||
* @param format
|
||||
* @param width
|
||||
* @param height
|
||||
* @param type
|
||||
* @param data
|
||||
* @param w
|
||||
* @param h
|
||||
* @param type1
|
||||
* @param image
|
||||
* @param widthIn
|
||||
* @param heightIn
|
||||
* @param typeIn
|
||||
* @param dataIn
|
||||
* @param widthOut
|
||||
* @param heightOut
|
||||
* @param typeOut
|
||||
* @param dataOut
|
||||
* @return int
|
||||
*/
|
||||
public static int gluScaleImage(
|
||||
|
|
|
@ -123,14 +123,14 @@ public class MipMap extends Util implements GLUConstants {
|
|||
/**
|
||||
* Method gluScaleImage.
|
||||
* @param format
|
||||
* @param width
|
||||
* @param height
|
||||
* @param type
|
||||
* @param data
|
||||
* @param w
|
||||
* @param h
|
||||
* @param type1
|
||||
* @param image
|
||||
* @param widthIn
|
||||
* @param heightIn
|
||||
* @param typein
|
||||
* @param dataIn
|
||||
* @param widthOut
|
||||
* @param heightOut
|
||||
* @param typeOut
|
||||
* @param dataOut
|
||||
* @return int
|
||||
*/
|
||||
public static int gluScaleImage(
|
||||
|
|
|
@ -23,7 +23,7 @@ class PixelStoreState extends Util implements GLUConstants {
|
|||
/**
|
||||
* Constructor for PixelStoreState.
|
||||
*/
|
||||
public PixelStoreState() {
|
||||
PixelStoreState() {
|
||||
super();
|
||||
load();
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ public class Project extends Util implements GLUConstants {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param finalMatrix
|
||||
* @param finalMatrix2
|
||||
* @param src
|
||||
* @param inverse
|
||||
* @return
|
||||
*/
|
||||
private static boolean __gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) {
|
||||
|
@ -129,9 +129,9 @@ public class Project extends Util implements GLUConstants {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param modelMatrix
|
||||
* @param projMatrix
|
||||
* @param finalMatrix
|
||||
* @param a
|
||||
* @param b
|
||||
* @param r
|
||||
*/
|
||||
private static void __gluMultMatricesf(FloatBuffer a, FloatBuffer b, FloatBuffer r) {
|
||||
|
||||
|
@ -199,7 +199,6 @@ public class Project extends Util implements GLUConstants {
|
|||
float upy,
|
||||
float upz) {
|
||||
|
||||
int i;
|
||||
float[] forward = new float[3];
|
||||
float[] side = new float[3];
|
||||
float[] up = new float[3];
|
||||
|
@ -246,16 +245,14 @@ public class Project extends Util implements GLUConstants {
|
|||
* @param modelMatrix
|
||||
* @param projMatrix
|
||||
* @param viewport
|
||||
* @param winx
|
||||
* @param winy
|
||||
* @param winz
|
||||
* @param win_pos
|
||||
* @return
|
||||
*/
|
||||
public static boolean gluProject(float objx, float objy, float objz,
|
||||
FloatBuffer modelMatrix,
|
||||
FloatBuffer projMatrix,
|
||||
IntBuffer viewport,
|
||||
FloatBuffer winx, FloatBuffer winy, FloatBuffer winz)
|
||||
FloatBuffer win_pos)
|
||||
{
|
||||
float[] in = new float[4];
|
||||
float[] out = new float[4];
|
||||
|
@ -279,9 +276,12 @@ public class Project extends Util implements GLUConstants {
|
|||
in[0] = in[0] * viewport.get(2) + viewport.get(0);
|
||||
in[1] = in[1] * viewport.get(3) + viewport.get(1);
|
||||
|
||||
winx.put(0, in[0]);
|
||||
winy.put(0, in[1]);
|
||||
winz.put(0, in[2]);
|
||||
int pos = win_pos.position();
|
||||
|
||||
win_pos.put(pos++, in[0]);
|
||||
win_pos.put(pos++, in[1]);
|
||||
win_pos.put(pos, in[2]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -293,9 +293,7 @@ public class Project extends Util implements GLUConstants {
|
|||
* @param modelMatrix
|
||||
* @param projMatrix
|
||||
* @param viewport
|
||||
* @param objx
|
||||
* @param objy
|
||||
* @param objz
|
||||
* @param obj_pos
|
||||
* @return
|
||||
*/
|
||||
public static boolean gluUnProject(float winx, float winy, float winz,
|
||||
|
@ -329,9 +327,13 @@ public class Project extends Util implements GLUConstants {
|
|||
out[0] /= out[3];
|
||||
out[1] /= out[3];
|
||||
out[2] /= out[3];
|
||||
obj_pos.put(0, out[0]);
|
||||
obj_pos.put(1, out[1]);
|
||||
obj_pos.put(2, out[2]);
|
||||
|
||||
int pos = obj_pos.position();
|
||||
|
||||
obj_pos.put(pos++, out[0]);
|
||||
obj_pos.put(pos++, out[1]);
|
||||
obj_pos.put(pos, out[2]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ public class Registry extends Util implements GLUConstants {
|
|||
* @return boolean true if extName is found otherwise it returns false.
|
||||
*/
|
||||
public static boolean gluCheckExtension(String extName, String extString) {
|
||||
boolean flag = false;
|
||||
|
||||
if (extString == null || extName == null)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -44,11 +44,7 @@ public class Sphere extends Quadric implements GLUConstants {
|
|||
boolean normals;
|
||||
float nsign;
|
||||
|
||||
if (super.normals == GLU_NONE) {
|
||||
normals = false;
|
||||
} else {
|
||||
normals = true;
|
||||
}
|
||||
normals = super.normals != GLU_NONE;
|
||||
|
||||
if (super.orientation == GLU_INSIDE) {
|
||||
nsign = -1.0f;
|
||||
|
@ -125,7 +121,6 @@ public class Sphere extends Quadric implements GLUConstants {
|
|||
GL11.glVertex3f(0.0f, 0.0f, -radius * nsign);
|
||||
rho = PI - drho;
|
||||
s = 1.0f;
|
||||
t = dt;
|
||||
for (j = slices; j >= 0; j--) {
|
||||
theta = (j == slices) ? 0.0f : j * dtheta;
|
||||
x = -sin(theta) * sin(rho);
|
||||
|
|
|
@ -97,7 +97,7 @@ public class Util {
|
|||
* Compute the nearest power of 2 number. This algorithm is a little
|
||||
* strange, but it works quite well.
|
||||
*
|
||||
* @param width
|
||||
* @param value
|
||||
* @return int
|
||||
*/
|
||||
protected static int nearestPower(int value) {
|
||||
|
@ -115,8 +115,8 @@ public class Util {
|
|||
} else if (value == 3) {
|
||||
return i * 4;
|
||||
}
|
||||
value = value >> 1;
|
||||
i *= 2;
|
||||
value >>= 1;
|
||||
i <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue