Search in sources :

Example 16 with TIntIntIterator

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();
    }
}
Also used : TIntIntIterator(gnu.trove.iterator.TIntIntIterator)

Example 17 with TIntIntIterator

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();
    }
}
Also used : TIntIntIterator(gnu.trove.iterator.TIntIntIterator)

Example 18 with TIntIntIterator

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);
}
Also used : ShaderProgramFeature(org.terasology.rendering.assets.shader.ShaderProgramFeature) TIntIntIterator(gnu.trove.iterator.TIntIntIterator)

Example 19 with TIntIntIterator

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();
    }
}
Also used : TIntIntIterator(gnu.trove.iterator.TIntIntIterator)

Example 20 with TIntIntIterator

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());
}
Also used : TIntIntIterator(gnu.trove.iterator.TIntIntIterator) GuardedBy(javax.annotation.concurrent.GuardedBy) Nullable(javax.annotation.Nullable)

Aggregations

TIntIntIterator (gnu.trove.iterator.TIntIntIterator)22 TIntIntMap (gnu.trove.map.TIntIntMap)3 TIntIntHashMap (gnu.trove.map.hash.TIntIntHashMap)2 LocalDate (org.joda.time.LocalDate)2 Test (org.junit.Test)2 TaskStatistics (org.opentripplanner.analyst.cluster.TaskStatistics)2 QualifiedModeSet (org.opentripplanner.api.parameter.QualifiedModeSet)2 FakeGraph (org.opentripplanner.graph_builder.module.FakeGraph)2 ProfileRequest (org.opentripplanner.profile.ProfileRequest)2 RaptorWorkerData (org.opentripplanner.profile.RaptorWorkerData)2 RepeatedRaptorProfileRouter (org.opentripplanner.profile.RepeatedRaptorProfileRouter)2 TraverseModeSet (org.opentripplanner.routing.core.TraverseModeSet)2 Graph (org.opentripplanner.routing.graph.Graph)2 DefaultStreetVertexIndexFactory (org.opentripplanner.routing.impl.DefaultStreetVertexIndexFactory)2 CUtils (cc.redberry.pipe.CUtils)1 OutputPort (cc.redberry.pipe.OutputPort)1 Range (com.milaboratory.core.Range)1 com.milaboratory.core.alignment (com.milaboratory.core.alignment)1 MutationsBuilder (com.milaboratory.core.mutations.MutationsBuilder)1 com.milaboratory.core.sequence (com.milaboratory.core.sequence)1