• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GLTexture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.gdx.graphics.GLTexture的典型用法代码示例。如果您正苦于以下问题:Java GLTexture类的具体用法?Java GLTexture怎么用?Java GLTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GLTexture类属于com.badlogic.gdx.graphics包,在下文中一共展示了GLTexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:DefaultTextureBinder.java


示例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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:28,代码来源:RenderContextAccumulator.java


示例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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:13,代码来源:RenderContextAccumulator.java


示例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));
  }

}
 
开发者ID:macbury,项目名称:ForgE,代码行数:9,代码来源:UniformWaterRefractionDUDVTexture.java


示例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));
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:8,代码来源:UniformDiffuseTerrainTexture.java


示例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));
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:13,代码来源:UniformWaterNormalTexture.java


示例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;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:8,代码来源:WaterEnv.java


示例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;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:8,代码来源:WaterEnv.java


示例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;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:8,代码来源:WaterEnv.java


示例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;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:13,代码来源:DefaultTextureBinder.java


示例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;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:29,代码来源:DefaultTextureBinder.java


示例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;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:14,代码来源:DefaultTextureBinder.java


示例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);
		}
	}

}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:75,代码来源:RenderContextAccumulator.java


示例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();
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:7,代码来源:Quad.java


示例15: getWindDisplacementTexture

import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public GLTexture getWindDisplacementTexture() {
  if (windDisplacementTexture == null) {
    windDisplacementTexture = windDisplacementTextureAsset.get();
  }
  return windDisplacementTexture;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:7,代码来源:LevelEnv.java


示例16: getTerrainTexture

import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public GLTexture getTerrainTexture() {
  loadAtlasAndUvsIfNull();
  return textureAtlas.getTextures().first();
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:5,代码来源:BlocksProvider.java


示例17: consumeCustomData

import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
@Override
public void consumeCustomData (int target) {
	for(int i=0; i < mips.length; ++i){
		GLTexture.uploadImageData(target, mips[i], i);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:7,代码来源:MipMapTextureData.java


示例18: set

import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public final boolean set (final int uniform, final GLTexture texture) {
	if (locations[uniform] < 0) return false;
	program.setUniformi(locations[uniform], context.textureBinder.bind(texture));
	return true;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:BaseShader.java


示例19: bind

import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
@Override
public final int bind (final GLTexture texture) {
	tempDesc.set(texture, null, null, null, null);
	return bindTexture(tempDesc, false);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:DefaultTextureBinder.java


示例20: setColorTexture

import com.badlogic.gdx.graphics.GLTexture; //导入依赖的package包/类
public void setColorTexture(GLTexture colorTexture) {
  this.colorTexture = colorTexture;
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:4,代码来源:FinalCellShadeCompositorStep.java



注:本文中的com.badlogic.gdx.graphics.GLTexture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ControllerButtonControl类代码示例发布时间:2022-05-23
下一篇:
Java JPF类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap