本文整理汇总了Java中com.jme3.texture.Texture.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.getType方法的具体用法?Java Texture.getType怎么用?Java Texture.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.texture.Texture
的用法示例。
在下文中一共展示了Texture.getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupTextureParams
import com.jme3.texture.Texture; //导入方法依赖的package包/类
private void setupTextureParams(Texture tex) {
int target = convertTextureType(tex.getType());
// filter things
int minFilter = convertMinFilter(tex.getMinFilter());
int magFilter = convertMagFilter(tex.getMagFilter());
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter);
// repeat modes
switch (tex.getType()) {
// case ThreeDimensional:
// case CubeMap:
// glTexParameteri(target, GL_TEXTURE_WRAP_R, convertWrapMode(tex.getWrap(WrapAxis.R)));
case TwoDimensional:
glTexParameteri(target, GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T)));
// fall down here is intentional..
// case OneDimensional:
glTexParameteri(target, GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S)));
break;
default:
throw new UnsupportedOperationException("Unknown texture type: " + tex.getType());
}
}
示例2: setTexture
import com.jme3.texture.Texture; //导入方法依赖的package包/类
/**
* Pass a texture to the material shader.
*
* @param name the name of the texture defined in the material definition
* (j3md) (for example Texture for Lighting.j3md)
* @param value the Texture object previously loaded by the asset manager
*/
public void setTexture(String name, Texture value) {
if (value == null) {
// clear it
clearTextureParam(name);
return;
}
VarType paramType = null;
switch (value.getType()) {
case TwoDimensional:
paramType = VarType.Texture2D;
break;
case TwoDimensionalArray:
paramType = VarType.TextureArray;
break;
case ThreeDimensional:
paramType = VarType.Texture3D;
break;
case CubeMap:
paramType = VarType.TextureCubeMap;
break;
default:
throw new UnsupportedOperationException("Unknown texture type: " + value.getType());
}
setTextureParam(name, paramType, value);
}
示例3: setupTextureParams
import com.jme3.texture.Texture; //导入方法依赖的package包/类
@SuppressWarnings("fallthrough")
private void setupTextureParams(Texture tex) {
Image image = tex.getImage();
int target = convertTextureType(tex.getType(), image != null ? image.getMultiSamples() : 1);
// filter things
int minFilter = convertMinFilter(tex.getMinFilter());
int magFilter = convertMagFilter(tex.getMagFilter());
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter);
if (tex.getAnisotropicFilter() > 1) {
if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
glTexParameterf(target,
EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
tex.getAnisotropicFilter());
}
}
if (context.pointSprite) {
return; // Attempt to fix glTexParameter crash for some ATI GPUs
}
// repeat modes
switch (tex.getType()) {
case ThreeDimensional:
case CubeMap: // cubemaps use 3D coords
glTexParameteri(target, GL_TEXTURE_WRAP_R, convertWrapMode(tex.getWrap(WrapAxis.R)));
case TwoDimensional:
case TwoDimensionalArray:
glTexParameteri(target, GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T)));
// fall down here is intentional..
// case OneDimensional:
glTexParameteri(target, GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S)));
break;
default:
throw new UnsupportedOperationException("Unknown texture type: " + tex.getType());
}
// R to Texture compare mode
if (tex.getShadowCompareMode() != Texture.ShadowCompareMode.Off) {
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY);
if (tex.getShadowCompareMode() == Texture.ShadowCompareMode.GreaterOrEqual) {
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_GEQUAL);
} else {
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
}
}
}