aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-effects
diff options
context:
space:
mode:
authorrenanse <[email protected]>2013-01-20 00:51:00 -0600
committerrenanse <[email protected]>2013-01-20 00:51:00 -0600
commitbe8f02e0593bf0f0a86082b3bdfc2c5805a57e59 (patch)
tree011383de3e280f1a960b17f818dfad2e012a31c1 /ardor3d-effects
parent8908ac9904c3acc8bd40b4c16b13d0934ca81ee5 (diff)
Switched more code to using more efficient index buffers.
Diffstat (limited to 'ardor3d-effects')
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java
index 9667b81..d23c48a 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java
@@ -11,7 +11,6 @@
package com.ardor3d.extension.effect.water;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
import java.util.Stack;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@@ -33,6 +32,7 @@ import com.ardor3d.math.type.ReadOnlyVector2;
import com.ardor3d.math.type.ReadOnlyVector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
+import com.ardor3d.scenegraph.IndexBufferData;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.util.ExtendedCamera;
import com.ardor3d.util.Timer;
@@ -52,7 +52,6 @@ public class ProjectedGrid extends Mesh {
private FloatBuffer vertBuf;
private final FloatBuffer normBuf;
private final FloatBuffer texs;
- private IntBuffer indexBuffer;
private final ExtendedCamera mainCamera = new ExtendedCamera();
private final Camera projectorCamera = new Camera();
@@ -593,8 +592,8 @@ public class ProjectedGrid extends Mesh {
// set up the indices
final int triangleQuantity = ((sizeX - 1) * (sizeY - 1)) * 2;
- indexBuffer = BufferUtils.createIntBuffer(triangleQuantity * 3);
- _meshData.setIndexBuffer(indexBuffer);
+ final IndexBufferData<?> indices = BufferUtils.createIndexBufferData(triangleQuantity * 3, vertexCount - 1);
+ _meshData.setIndices(indices);
// go through entire array up to the second to last column.
for (int i = 0; i < (sizeX * (sizeY - 1)); i++) {
@@ -606,17 +605,17 @@ public class ProjectedGrid extends Mesh {
// logger.info("i: "+i);
}
// set the top left corner.
- indexBuffer.put(i);
+ indices.put(i);
// set the bottom right corner.
- indexBuffer.put((1 + sizeX) + i);
+ indices.put((1 + sizeX) + i);
// set the top right corner.
- indexBuffer.put(1 + i);
+ indices.put(1 + i);
// set the top left corner
- indexBuffer.put(i);
+ indices.put(i);
// set the bottom left corner
- indexBuffer.put(sizeX + i);
+ indices.put(sizeX + i);
// set the bottom right corner
- indexBuffer.put((1 + sizeX) + i);
+ indices.put((1 + sizeX) + i);
}
}