aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-10 15:09:09 +0200
committerSven Gothel <[email protected]>2012-10-10 15:09:09 +0200
commit6ac1c8c8995458671cf603e46bff89fcaefd8146 (patch)
treeea20f2d9eaa16919b4a271933b3803a5274d45e9 /src/jogl/classes/javax
parent7587cce91c3fda7dcff4e36e1aa0edf53bf34e00 (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/javax')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLUniformData.java36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java
index 475ff4546..095115ff8 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java
@@ -3,6 +3,9 @@ package javax.media.opengl;
import java.nio.*;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.FloatUtil;
+
public class GLUniformData {
/**
@@ -69,14 +72,33 @@ public class GLUniformData {
public IntBuffer intBufferValue() { return (IntBuffer)data; };
public FloatBuffer floatBufferValue() { return (FloatBuffer)data; };
+ public StringBuilder toString(StringBuilder sb) {
+ if(null == sb) {
+ sb = new StringBuilder();
+ }
+ sb.append("GLUniformData[name ").append(name).
+ append(", location ").append(location).
+ append(", size ").append(rows).append("x").append(columns).
+ append(", count ").append(count).
+ append(", data ");
+ if(isMatrix() && data instanceof FloatBuffer) {
+ sb.append("\n");
+ final FloatBuffer fb = (FloatBuffer)getBuffer();
+ for(int i=0; i<count; i++) {
+ FloatUtil.matrixToString(sb, i+": ", "%10.5f", fb, 0, rows, columns, false);
+ sb.append(",\n");
+ }
+ } else if(isBuffer()) {
+ Buffers.toString(sb, getBuffer());
+ } else {
+ sb.append(data);
+ }
+ sb.append("]");
+ return sb;
+ }
+
public String toString() {
- return "GLUniformData[name "+name+
- ", location "+location+
- ", size "+rows+"*"+columns+
- ", count "+count+
- ", matrix "+isMatrix+
- ", data "+data+
- "]";
+ return toString(null).toString();
}
private void init(String name, int rows, int columns, Object data) {