diff options
author | Sven Gothel <[email protected]> | 2012-10-10 15:09:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-10 15:09:09 +0200 |
commit | 6ac1c8c8995458671cf603e46bff89fcaefd8146 (patch) | |
tree | ea20f2d9eaa16919b4a271933b3803a5274d45e9 /src/jogl/classes/com/jogamp/opengl/util | |
parent | 7587cce91c3fda7dcff4e36e1aa0edf53bf34e00 (diff) |
FloatUtil/PMVMatrix/GLUniformData: Move impl. of FloatBuffer matrix toString(..) from PMVMatrix to FloatUtil and make it more generic; GLUniformData toString() also dumps it's matrices.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 686dd3895..70c4d1e1b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -169,55 +169,11 @@ public class PMVMatrix implements GLMatrixFunc { /** * @param sb optional passed StringBuilder instance to be used * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} - * @param row row number - * @param a 4x4 matrix in column major order (OpenGL) - * @return matrix row string representation - */ - public static StringBuilder matrixRowToString(StringBuilder sb, String f, int row, FloatBuffer a) { - if(null == sb) { - sb = new StringBuilder(); - } - final int a0 = a.position(); - sb.append( String.format("[ "+f+" "+f+" "+f+" "+f+" ]", - a.get(a0+row+0*4), a.get(a0+row+1*4), a.get(a0+row+2*4), a.get(a0+row+3*4) ) ); - return sb; - } - - /** - * @param sb optional passed StringBuilder instance to be used - * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a 4x4 matrix in column major order (OpenGL) * @return matrix string representation */ public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a) { - if(null == sb) { - sb = new StringBuilder(); - } - matrixRowToString(sb, f, 0, a).append(Platform.getNewline()); - matrixRowToString(sb, f, 1, a).append(Platform.getNewline()); - matrixRowToString(sb, f, 2, a).append(Platform.getNewline()); - matrixRowToString(sb, f, 3, a).append(Platform.getNewline()); - return sb; - } - - /** - * @param sb optional passed StringBuilder instance to be used - * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} - * @param row row number - * @param a 4x4 matrix in column major order (OpenGL) - * @param b 4x4 matrix in column major order (OpenGL) - * @return matrix row string representation side by side - */ - public static StringBuilder matrixRowToString(StringBuilder sb, String f, int row, FloatBuffer a, FloatBuffer b) { - if(null == sb) { - sb = new StringBuilder(); - } - final int a0 = a.position(); - final int b0 = b.position(); - sb.append( String.format("[ "+f+" "+f+" "+f+" "+f+" =?= "+f+" "+f+" "+f+" "+f+" ]", - a.get(a0+row+0*4), a.get(a0+row+1*4), a.get(a0+row+2*4), a.get(a0+row+3*4), - b.get(b0+row+0*4), b.get(b0+row+1*4), b.get(b0+row+2*4), b.get(b0+row+3*4) ) ); - return sb; + return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false); } /** @@ -228,14 +184,7 @@ public class PMVMatrix implements GLMatrixFunc { * @return side by side representation */ public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a, FloatBuffer b) { - if(null == sb) { - sb = new StringBuilder(); - } - matrixRowToString(sb, f, 0, a, b).append(Platform.getNewline()); - matrixRowToString(sb, f, 1, a, b).append(Platform.getNewline()); - matrixRowToString(sb, f, 2, a, b).append(Platform.getNewline()); - matrixRowToString(sb, f, 3, a, b).append(Platform.getNewline()); - return sb; + return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false); } /** |