use of gnu.trove.iterator.TIntIntIterator in project Terasology by MovingBlocks.
the class GLSLMaterial method setInt.
@Override
public void setInt(String desc, int i, boolean currentOnly) {
if (isDisposed()) {
return;
}
if (currentOnly) {
enable();
int id = getUniformLocation(getActiveShaderProgramId(), desc);
GL20.glUniform1i(id, i);
} else {
TIntIntIterator it = disposalAction.shaderPrograms.iterator();
while (it.hasNext()) {
it.advance();
GL20.glUseProgram(it.value());
int id = getUniformLocation(it.value(), desc);
GL20.glUniform1i(id, i);
}
restoreStateAfterUniformsSet();
}
}
use of gnu.trove.iterator.TIntIntIterator in project Terasology by MovingBlocks.
the class GLSLMaterial method setMatrix3.
@Override
public void setMatrix3(String desc, Matrix3f value, boolean currentOnly) {
if (isDisposed()) {
return;
}
if (currentOnly) {
enable();
int id = getUniformLocation(getActiveShaderProgramId(), desc);
GL20.glUniformMatrix3(id, false, MatrixUtils.matrixToFloatBuffer(value));
} else {
TIntIntIterator it = disposalAction.shaderPrograms.iterator();
while (it.hasNext()) {
it.advance();
GL20.glUseProgram(it.value());
int id = getUniformLocation(it.value(), desc);
GL20.glUniformMatrix3(id, false, MatrixUtils.matrixToFloatBuffer(value));
}
restoreStateAfterUniformsSet();
}
}
use of gnu.trove.iterator.TIntIntIterator in project Terasology by MovingBlocks.
the class GLSLMaterial method recompile.
@Override
public void recompile() {
TIntIntIterator it = disposalAction.shaderPrograms.iterator();
while (it.hasNext()) {
it.advance();
GL20.glDeleteProgram(it.value());
}
disposalAction.shaderPrograms.clear();
uniformLocationMap.clear();
bindMap.clear();
disposalAction.shaderPrograms.put(0, shader.linkShaderProgram(0));
for (Set<ShaderProgramFeature> permutation : Sets.powerSet(shader.getAvailableFeatures())) {
int featureMask = ShaderProgramFeature.getBitset(permutation);
disposalAction.shaderPrograms.put(featureMask, shader.linkShaderProgram(featureMask));
}
// resolves #966
// Some of the uniforms are not updated constantly between frames
// this function will rebind any uniforms that are not bound
rebindVariables(materialData);
}
use of gnu.trove.iterator.TIntIntIterator in project Terasology by MovingBlocks.
the class GLSLMaterial method setMatrix4.
@Override
public void setMatrix4(String desc, FloatBuffer value, boolean currentOnly) {
if (isDisposed()) {
return;
}
if (currentOnly) {
enable();
int id = getUniformLocation(getActiveShaderProgramId(), desc);
GL20.glUniformMatrix4(id, false, value);
} else {
TIntIntIterator it = disposalAction.shaderPrograms.iterator();
while (it.hasNext()) {
it.advance();
GL20.glUseProgram(it.value());
int id = getUniformLocation(it.value(), desc);
GL20.glUniformMatrix4(id, false, value);
}
restoreStateAfterUniformsSet();
}
}
use of gnu.trove.iterator.TIntIntIterator in project atlasdb by palantir.
the class LockServerSync method getLockHolder.
// Returns null if there is no lock holder. Note: There
// may be no lock holder even if tryAcquire or tryAcquireShared
// failed because those methods may fail in order to prevent
// barging.
@GuardedBy("this")
@Nullable
LockClient getLockHolder() {
if (getState() > 0) {
return clients.fromIndex(writeLockHolder);
}
if (!isReadLockHeld()) {
return null;
}
TIntIntIterator iter = readLockHolders.iterator();
Preconditions.checkState(iter.hasNext());
iter.advance();
return clients.fromIndex(iter.key());
}
Aggregations