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