|
|
@ -34,6 +34,7 @@ package com.jme3.shader; |
|
|
|
import com.jme3.math.*; |
|
|
|
import com.jme3.math.*; |
|
|
|
import com.jme3.util.BufferUtils; |
|
|
|
import com.jme3.util.BufferUtils; |
|
|
|
import java.nio.FloatBuffer; |
|
|
|
import java.nio.FloatBuffer; |
|
|
|
|
|
|
|
import java.nio.IntBuffer; |
|
|
|
|
|
|
|
|
|
|
|
public class Uniform extends ShaderVariable { |
|
|
|
public class Uniform extends ShaderVariable { |
|
|
|
|
|
|
|
|
|
|
@ -128,10 +129,10 @@ public class Uniform extends ShaderVariable { |
|
|
|
updateNeeded = true; |
|
|
|
updateNeeded = true; |
|
|
|
|
|
|
|
|
|
|
|
if (multiData != null){ |
|
|
|
if (multiData != null){ |
|
|
|
ZERO_BUF.clear(); |
|
|
|
|
|
|
|
multiData.clear(); |
|
|
|
multiData.clear(); |
|
|
|
|
|
|
|
|
|
|
|
while (multiData.remaining() > 0){ |
|
|
|
while (multiData.remaining() > 0){ |
|
|
|
|
|
|
|
ZERO_BUF.clear(); |
|
|
|
ZERO_BUF.limit( Math.min(multiData.remaining(), 16) ); |
|
|
|
ZERO_BUF.limit( Math.min(multiData.remaining(), 16) ); |
|
|
|
multiData.put(ZERO_BUF); |
|
|
|
multiData.put(ZERO_BUF); |
|
|
|
} |
|
|
|
} |
|
|
@ -202,6 +203,15 @@ public class Uniform extends ShaderVariable { |
|
|
|
m4.fillFloatBuffer(multiData, true); |
|
|
|
m4.fillFloatBuffer(multiData, true); |
|
|
|
multiData.clear(); |
|
|
|
multiData.clear(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case IntArray: |
|
|
|
|
|
|
|
int[] ia = (int[]) value; |
|
|
|
|
|
|
|
if (this.value == null) { |
|
|
|
|
|
|
|
this.value = BufferUtils.createIntBuffer(ia); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.value = BufferUtils.ensureLargeEnough((IntBuffer)this.value, ia.length); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
((IntBuffer)this.value).clear(); |
|
|
|
|
|
|
|
break; |
|
|
|
case FloatArray: |
|
|
|
case FloatArray: |
|
|
|
float[] fa = (float[]) value; |
|
|
|
float[] fa = (float[]) value; |
|
|
|
if (multiData == null) { |
|
|
|
if (multiData == null) { |
|
|
|