|
|
@ -332,30 +332,29 @@ public class Uniform extends ShaderVariable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setVector4Length(int length){ |
|
|
|
public void setVector4Length(int length){ |
|
|
|
if (location == -1) |
|
|
|
if (location == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
FloatBuffer fb = (FloatBuffer) value; |
|
|
|
|
|
|
|
if (fb == null || fb.capacity() < length * 4) { |
|
|
|
|
|
|
|
value = BufferUtils.createFloatBuffer(length * 4); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
multiData = BufferUtils.ensureLargeEnough(multiData, length * 4); |
|
|
|
|
|
|
|
value = multiData; |
|
|
|
varType = VarType.Vector4Array; |
|
|
|
varType = VarType.Vector4Array; |
|
|
|
updateNeeded = true; |
|
|
|
updateNeeded = true; |
|
|
|
setByCurrentMaterial = true; |
|
|
|
setByCurrentMaterial = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setVector4InArray(float x, float y, float z, float w, int index){ |
|
|
|
public void setVector4InArray(float x, float y, float z, float w, int index){ |
|
|
|
if (location == -1) |
|
|
|
if (location == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (varType != null && varType != VarType.Vector4Array) |
|
|
|
if (varType != null && varType != VarType.Vector4Array) { |
|
|
|
throw new IllegalArgumentException("Expected a "+varType.name()+" value!"); |
|
|
|
throw new IllegalArgumentException("Expected a " + varType.name() + " value!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FloatBuffer fb = (FloatBuffer) value; |
|
|
|
multiData.position(index * 4); |
|
|
|
fb.position(index * 4); |
|
|
|
multiData.put(x).put(y).put(z).put(w); |
|
|
|
fb.put(x).put(y).put(z).put(w); |
|
|
|
multiData.rewind(); |
|
|
|
fb.rewind(); |
|
|
|
|
|
|
|
updateNeeded = true; |
|
|
|
updateNeeded = true; |
|
|
|
setByCurrentMaterial = true; |
|
|
|
setByCurrentMaterial = true; |
|
|
|
} |
|
|
|
} |
|
|
|