本文整理汇总了Java中com.badlogic.gdx.graphics.GLTexture类的典型用法代码示例。如果您正苦于以下问题:Java GLTexture类的具体用法?Java GLTexture怎么用?Java GLTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLTexture类属于com.badlogic.gdx.graphics包,在下文中一共展示了GLTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindTextureWeighted
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
private final int bindTextureWeighted (final GLTexture texture) {
int result = -1;
int weight = weights[0];
int windex = 0;
for (int i = 0; i < count; i++) {
if (textures[i] == texture) {
result = i;
weights[i] += reuseWeight;
} else if (weights[i] < 0 || --weights[i] < weight) {
weight = weights[i];
windex = i;
}
}
if (result < 0) {
textures[windex] = texture;
weights[windex] = 100;
texture.bind(offset + (result = windex));
} else
reused = true;
return result;
}
示例2: hasPendingChanges
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public boolean hasPendingChanges () {
State pending = this.pending;
State current = this.current;
if (pending.depthMasking != current.depthMasking) return true;
if (pending.depthTesting != current.depthTesting) return true;
if (pending.depthTesting && pending.depthFunc != current.depthFunc) return true;
if (pending.blending != current.blending) return true;
if (pending.blending) {
if (pending.blendSrcFuncColor != current.blendSrcFuncColor || pending.blendDstFuncColor != current.blendDstFuncColor
|| pending.blendSrcFuncAlpha != current.blendSrcFuncAlpha || pending.blendDstFuncAlpha != current.blendDstFuncAlpha)
return true;
if (pending.blendEquationColor != current.blendEquationColor || pending.blendEquationAlpha != current.blendEquationAlpha)
return true;
}
IntMap<GLTexture> actualTextureUnits = current.textureUnits;
for (IntMap.Entry<GLTexture> entry : pending.textureUnits) {
if (actualTextureUnits.get(entry.key) != entry.value) return true;
}
return false;
}
示例3: setTextureUnit
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
/** Sets the texture to be bound to the given texture unit.
* @return Whether the pending texture for the unit was changed. */
public boolean setTextureUnit (GLTexture texture, int unit) {
if (pending.textureUnits.get(unit) != texture) {
if (texture == null)
pending.textureUnits.remove(unit);
else
pending.textureUnits.put(unit, texture);
return true;
}
return false;
}
示例4: bind
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
@Override
public void bind(ShaderProgram shader, LevelEnv env, RenderContext context, Camera camera) {
GLTexture texture = env.water.getWaterDisplacementTexture();
if (texture != null) {
shader.setUniformi(UNIFORM_DUDV_TEXTURE, context.textureBinder.bind(texture));
}
}
示例5: bind
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
@Override
public void bind(ShaderProgram shader, LevelEnv env, RenderContext context, Camera camera) {
GLTexture terrainTexture = ForgE.blocks.getTerrainTexture();
if (terrainTexture != null) {
shader.setUniformi(UNIFORM_DIFFUSE_TEXTURE, context.textureBinder.bind(terrainTexture));
}
}
示例6: bind
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
@Override
public void bind(ShaderProgram shader, LevelEnv env, RenderContext context, Camera camera) {
GLTexture normalTexture = env.water.getWaterNormalMapATexture();
if (normalTexture != null) {
shader.setUniformi(UNIFORM_NORMAL_A_TEXTURE, context.textureBinder.bind(normalTexture));
}
normalTexture = env.water.getWaterNormalMapBTexture();
if (normalTexture != null) {
shader.setUniformi(UNIFORM_NORMAL_B_TEXTURE, context.textureBinder.bind(normalTexture));
}
}
示例7: getWaterDisplacementTexture
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public GLTexture getWaterDisplacementTexture() {
if (waterDisplacementTexture == null && getWaterDisplacementTextureAsset() != null) {
waterDisplacementTexture = getWaterDisplacementTextureAsset().get();
waterDisplacementTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return waterDisplacementTexture;
}
示例8: getWaterNormalMapATexture
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public GLTexture getWaterNormalMapATexture() {
if (waterNormalATexture == null && getWaterNormalMapATextureAsset() != null) {
waterNormalATexture = getWaterNormalMapATextureAsset().get();
waterNormalATexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return waterNormalATexture;
}
示例9: getWaterNormalMapBTexture
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public GLTexture getWaterNormalMapBTexture() {
if (waterNormalBTexture == null && getWaterNormalMapBTextureAsset() != null) {
waterNormalBTexture = getWaterNormalMapBTextureAsset().get();
waterNormalBTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return waterNormalBTexture;
}
示例10: DefaultTextureBinder
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public DefaultTextureBinder (final int method, final int offset, int count, final int reuseWeight) {
final int max = Math.min(getMaxTextureUnits(), MAX_GLES_UNITS);
if (count < 0) count = max - offset;
if (offset < 0 || count < 0 || (offset + count) > max || reuseWeight < 1)
throw new GdxRuntimeException("Illegal arguments");
this.method = method;
this.offset = offset;
this.count = count;
this.textures = new GLTexture[count];
this.reuseWeight = reuseWeight;
this.weights = (method == WEIGHTED) ? new int[count] : null;
}
示例11: bindTexture
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
private final int bindTexture (final TextureDescriptor textureDesc, final boolean rebind) {
final int idx, result;
final GLTexture texture = textureDesc.texture;
reused = false;
switch (method) {
case ROUNDROBIN:
result = offset + (idx = bindTextureRoundRobin(texture));
break;
case WEIGHTED:
result = offset + (idx = bindTextureWeighted(texture));
break;
default:
return -1;
}
if (reused) {
reuseCount++;
if (rebind)
texture.bind(result);
else
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0 + result);
} else
bindCount++;
texture.unsafeSetWrap(textureDesc.uWrap, textureDesc.vWrap);
texture.unsafeSetFilter(textureDesc.minFilter, textureDesc.magFilter);
return result;
}
示例12: bindTextureRoundRobin
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
private final int bindTextureRoundRobin (final GLTexture texture) {
for (int i = 0; i < count; i++) {
final int idx = (currentTexture + i) % count;
if (textures[idx] == texture) {
reused = true;
return idx;
}
}
currentTexture = (currentTexture + 1) % count;
textures[currentTexture] = texture;
texture.bind(offset + currentTexture);
return currentTexture;
}
示例13: executeChanges
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
/** Applies the pending state changes and texture bindings to GL. This must be called in between {@link #begin()} and
* {@link #end()}. */
public void executeChanges () {
State pending = this.pending;
State current = this.current;
if (pending.depthMasking != current.depthMasking) {
Gdx.gl.glDepthMask(pending.depthMasking);
current.depthMasking = pending.depthMasking;
}
if (pending.depthTesting != current.depthTesting) {
if (pending.depthTesting)
Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
else
Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
current.depthTesting = pending.depthTesting;
}
if (pending.depthTesting) {
if (pending.depthFunc != current.depthFunc) {
Gdx.gl.glDepthFunc(pending.depthFunc);
current.depthFunc = pending.depthFunc;
}
if (pending.depthRangeNear != current.depthRangeNear || pending.depthRangeFar != current.depthRangeFar) {
Gdx.gl.glDepthRangef(pending.depthRangeNear, pending.depthRangeFar);
current.depthRangeNear = pending.depthRangeNear;
current.depthRangeFar = pending.depthRangeFar;
}
}
if (pending.blending != current.blending) {
if (pending.blending)
Gdx.gl.glEnable(GL20.GL_BLEND);
else
Gdx.gl.glDisable(GL20.GL_BLEND);
current.blending = pending.blending;
}
if (pending.blending) {
if (pending.blendSrcFuncColor != current.blendSrcFuncColor || pending.blendDstFuncColor != current.blendDstFuncColor
|| pending.blendSrcFuncAlpha != current.blendSrcFuncAlpha || pending.blendDstFuncAlpha != current.blendDstFuncAlpha) {
if (pending.blendSrcFuncColor == pending.blendSrcFuncAlpha
&& pending.blendDstFuncColor == pending.blendDstFuncAlpha) {
Gdx.gl.glBlendFunc(pending.blendSrcFuncColor, pending.blendDstFuncColor);
} else {
Gdx.gl.glBlendFuncSeparate(pending.blendSrcFuncColor, pending.blendDstFuncColor, pending.blendSrcFuncAlpha,
pending.blendDstFuncAlpha);
}
current.blendSrcFuncColor = pending.blendSrcFuncColor;
current.blendDstFuncColor = pending.blendDstFuncColor;
current.blendSrcFuncAlpha = pending.blendSrcFuncAlpha;
current.blendDstFuncAlpha = pending.blendDstFuncAlpha;
}
if (pending.blendEquationColor != current.blendEquationColor
|| pending.blendEquationAlpha != current.blendEquationAlpha) {
if (pending.blendEquationColor == pending.blendEquationAlpha)
Gdx.gl.glBlendEquation(pending.blendEquationColor);
else
Gdx.gl.glBlendEquationSeparate(pending.blendEquationColor, pending.blendEquationAlpha);
}
}
IntMap<GLTexture> currentTextureUnits = current.textureUnits;
for (IntMap.Entry<GLTexture> entry : pending.textureUnits) {
if (currentTextureUnits.get(entry.key) != entry.value) {
entry.value.bind(entry.key);
currentTextureUnits.put(entry.key, entry.value);
}
}
}
示例14: Quad
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
protected Quad () {
textures = new GLTexture[getNumberOfTextures()];
regions = new Region2D[getNumberOfTextures()];
for (int i = 0; i < regions.length; i++)
regions[i] = new Region2D();
}
示例15: getWindDisplacementTexture
import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public GLTexture getWindDisplacementTexture() {
if (windDisplacementTexture == null) {
windDisplacementTexture = windDisplacementTextureAsset.get();
}
return windDisplacementTexture;
}