diff --git a/engine/src/core/com/jme3/material/Technique.java b/engine/src/core/com/jme3/material/Technique.java index 945db95d9..82c87313a 100644 --- a/engine/src/core/com/jme3/material/Technique.java +++ b/engine/src/core/com/jme3/material/Technique.java @@ -222,9 +222,7 @@ public class Technique /* implements Savable */ { for (UniformBinding binding : def.getWorldBindings()) { Uniform uniform = shader.getUniform("g_" + binding.name()); uniform.setBinding(binding); - if (uniform != null) { - worldBindUniforms.add(uniform); - } + worldBindUniforms.add(uniform); } } needReload = false; diff --git a/engine/src/core/com/jme3/scene/VertexBuffer.java b/engine/src/core/com/jme3/scene/VertexBuffer.java index 2ea6ab871..59bb66411 100644 --- a/engine/src/core/com/jme3/scene/VertexBuffer.java +++ b/engine/src/core/com/jme3/scene/VertexBuffer.java @@ -351,6 +351,14 @@ public class VertexBuffer extends NativeObject implements Savable, Cloneable { if (data == null) { throw new AssertionError(); } + // Position must be 0. + if (data.position() != 0) { + throw new AssertionError(); + } + // Is the size of the VB == 0? + if (data.limit() == 0) { + throw new AssertionError(); + } // Does offset exceed buffer limit or negative? if (offset > data.limit() || offset < 0) { throw new AssertionError(); diff --git a/engine/src/core/com/jme3/shader/Uniform.java b/engine/src/core/com/jme3/shader/Uniform.java index 454fe1bab..5d5fd2fe3 100644 --- a/engine/src/core/com/jme3/shader/Uniform.java +++ b/engine/src/core/com/jme3/shader/Uniform.java @@ -33,6 +33,7 @@ package com.jme3.shader; import com.jme3.math.*; import com.jme3.util.BufferUtils; +import java.nio.Buffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; @@ -347,4 +348,10 @@ public class Uniform extends ShaderVariable { updateNeeded = true; } + public void deleteNativeBuffers() { + if (value instanceof Buffer) { + BufferUtils.destroyDirectBuffer((Buffer)value); + value = null; // ???? + } + } }