本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java TextureDescriptor类的具体用法?Java TextureDescriptor怎么用?Java TextureDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextureDescriptor类属于com.badlogic.gdx.graphics.g3d.utils包,在下文中一共展示了TextureDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
@Override
public TextureDescriptor<Texture> read(JsonReader in) throws IOException {
TextureDescriptor<Texture> descriptor = new TextureDescriptor<>();
String[] refs = new String[5];
in.beginObject();
while(in.hasNext()) {
switch(in.nextName()) {
case "textureRef": refs[0] = in.nextString(); break;
case "minFilter": refs[1] = in.nextString(); break;
case "magFilter": refs[2] = in.nextString(); break;
case "uWrap": refs[3] = in.nextString(); break;
case "vWrap": refs[4] = in.nextString(); break;
}
}
in.endObject();
descriptor.texture = Argent.content.get(refs[0], Texture.class);
descriptor.minFilter = Texture.TextureFilter.valueOf(refs[1]);
descriptor.magFilter = Texture.TextureFilter.valueOf(refs[2]);
descriptor.uWrap = Texture.TextureWrap.valueOf(refs[3]);
descriptor.vWrap = Texture.TextureWrap.valueOf(refs[4]);
return descriptor;
}
示例2: PbrTextureAttribute
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
public <T extends Texture> PbrTextureAttribute(final long type, final TextureDescriptor<T> textureDescription, float offsetU,
float offsetV, float scaleU, float scaleV, int uvIndex) {
this(type, textureDescription);
this.offsetU = offsetU;
this.offsetV = offsetV;
this.scaleU = scaleU;
this.scaleV = scaleV;
this.uvIndex = uvIndex;
}
示例3: PBRTextureAttribute
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
public <T extends Texture> PBRTextureAttribute (final long type, final TextureDescriptor<T> textureDescription, float offsetU,
float offsetV, float scaleU, float scaleV, int uvIndex) {
this(type, textureDescription);
this.offsetU = offsetU;
this.offsetV = offsetV;
this.scaleU = scaleU;
this.scaleV = scaleV;
this.uvIndex = uvIndex;
}
示例4: JSONSerializer
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
private JSONSerializer() {
GsonBuilder gb = new GsonBuilder();
// TextureDescriptor
gb.registerTypeAdapter(TextureDescriptor.class, new TextureDescriptorTypeAdapter());
gb.registerTypeAdapterFactory(new TextureDescriptorTypeAdapterFactory());
// Material
gb.registerTypeAdapter(Material.class, new MaterialTypeAdapter());
gb.registerTypeAdapterFactory(new MaterialTypeAdapterFactory());
// gb.registerTypeAdapter(DynamicShader.Info.class, new DynamicShaderInfoTypeAdapter());
gb.setPrettyPrinting();
gson = gb.create();
}
示例5: buildDescriptor
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
private TextureDescriptor<Texture> buildDescriptor(LinkedTreeMap map) {
TextureDescriptor<Texture> desc = new TextureDescriptor<>();
if(map.containsKey("textureRef")) desc.texture = Argent.content.get(map.get("textureRef").toString(), Texture.class);
if(map.containsKey("minFilter")) desc.minFilter = Texture.TextureFilter.valueOf(map.get("minFilter").toString());
if(map.containsKey("magFilter")) desc.magFilter = Texture.TextureFilter.valueOf(map.get("magFilter").toString());
if(map.containsKey("uWrap")) desc.uWrap = Texture.TextureWrap.valueOf(map.get("uWrap").toString());
if(map.containsKey("vWrap")) desc.vWrap = Texture.TextureWrap.valueOf(map.get("vWrap").toString());
return desc;
}
示例6: read
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
@Override
public Attribute read(JsonReader in) throws IOException {
Attribute attr = null;
long type = -1;
String alias = "";
in.beginObject();
while(in.hasNext()) {
switch(in.nextName()) {
case "type": type = in.nextLong(); break;
case "alias": alias = in.nextString(); break;
case "attrData":
attr = buildFromAlias(alias);
if(attr == null) break;
in.beginObject();
while(in.hasNext()) {
switch(in.nextName()) {
case "offsetU":
((TextureAttribute)attr).offsetU = (float) in.nextDouble(); break;
case "offsetV":
((TextureAttribute)attr).offsetV = (float) in.nextDouble(); break;
case "scaleU":
((TextureAttribute)attr).scaleU = (float) in.nextDouble(); break;
case "scaleV":
((TextureAttribute)attr).scaleV = (float) in.nextDouble(); break;
case "textureDescriptor":
((TextureAttribute)attr).textureDescription.set(JSONSerializer.instance().deserialize(in.nextString(), TextureDescriptor.class)); break;
case "colour":
((ColorAttribute)attr).color.set(Color.valueOf(in.nextString())); break;
case "alpha":
((BlendingAttribute)attr).opacity = (float) in.nextDouble(); break;
}
}
in.endObject();
break;
}
}
in.endObject();
return attr;
}
示例7: write
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
@Override
public void write(JsonWriter out, TextureDescriptor<Texture> value) throws IOException {
if(value == null) { out.nullValue(); return; }
assertTextureDescriptor(value);
out.beginObject();
out.name("textureRef").value(Argent.content.getRef(value.texture));
// out.name("textureRef").value(value.texture.toString());
out.name("minFilter").value(value.minFilter.name());
out.name("magFilter").value(value.magFilter.name());
out.name("uWrap").value(value.uWrap.name());
out.name("vWrap").value(value.vWrap.name());
out.endObject();
}
示例8: assertTextureDescriptor
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
private void assertTextureDescriptor(TextureDescriptor<Texture> value) {
if(value.texture == null) value.texture = SpriteCache.pixel();
if(value.minFilter == null) value.minFilter = Texture.TextureFilter.Linear;
if(value.magFilter == null) value.magFilter = Texture.TextureFilter.Linear;
if(value.uWrap == null) value.uWrap = Texture.TextureWrap.ClampToEdge;
if(value.vWrap == null) value.vWrap = Texture.TextureWrap.ClampToEdge;
}
示例9: TextureAttribute
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
public <T extends Texture> TextureAttribute (final long type, final TextureDescriptor<T> textureDescription, float offsetU,
float offsetV, float scaleU, float scaleV, int uvIndex) {
this(type, textureDescription);
this.offsetU = offsetU;
this.offsetV = offsetV;
this.scaleU = scaleU;
this.scaleV = scaleV;
this.uvIndex = uvIndex;
}
示例10: DirectionalShadowLight
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
/** @deprecated Experimental, likely to change, do not use! */
public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight,
float shadowNear, float shadowFar) {
fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true);
cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight);
cam.near = shadowNear;
cam.far = shadowFar;
halfHeight = shadowViewportHeight * 0.5f;
halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear);
textureDesc = new TextureDescriptor();
textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest;
textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge;
}
示例11: IBLAttribute
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
public IBLAttribute(final long type) {
super(type);
if (!is(type)) throw new GdxRuntimeException("Invalid type specified");
textureDescription = new TextureDescriptor<>();
}
示例12: create
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if(!TextureDescriptor.class.isAssignableFrom(type.getRawType()))
return null;
return (TypeAdapter<T>) new TextureDescriptorTypeAdapter();
}
示例13: set
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
public final boolean set (final int uniform, final TextureDescriptor textureDesc) {
if (locations[uniform] < 0) return false;
program.setUniformi(locations[uniform], context.textureBinder.bind(textureDesc));
return true;
}
示例14: CubemapAttribute
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
public CubemapAttribute (final long type) {
super(type);
if (!is(type)) throw new GdxRuntimeException("Invalid type specified");
textureDescription = new TextureDescriptor<Cubemap>();
}
示例15: convertMaterial
import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor; //导入依赖的package包/类
private Material convertMaterial (ModelMaterial mtl, TextureProvider textureProvider) {
Material result = new Material();
result.id = mtl.id;
if (mtl.ambient != null) result.set(new ColorAttribute(ColorAttribute.Ambient, mtl.ambient));
if (mtl.diffuse != null) result.set(new ColorAttribute(ColorAttribute.Diffuse, mtl.diffuse));
if (mtl.specular != null) result.set(new ColorAttribute(ColorAttribute.Specular, mtl.specular));
if (mtl.emissive != null) result.set(new ColorAttribute(ColorAttribute.Emissive, mtl.emissive));
if (mtl.reflection != null) result.set(new ColorAttribute(ColorAttribute.Reflection, mtl.reflection));
if (mtl.shininess > 0f) result.set(new FloatAttribute(FloatAttribute.Shininess, mtl.shininess));
if (mtl.opacity != 1.f) result.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, mtl.opacity));
ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>();
// FIXME uvScaling/uvTranslation totally ignored
if (mtl.textures != null) {
for (ModelTexture tex : mtl.textures) {
Texture texture;
if (textures.containsKey(tex.fileName)) {
texture = textures.get(tex.fileName);
} else {
texture = textureProvider.load(tex.fileName);
textures.put(tex.fileName, texture);
disposables.add(texture);
}
TextureDescriptor descriptor = new TextureDescriptor(texture);
descriptor.minFilter = texture.getMinFilter();
descriptor.magFilter = texture.getMagFilter();
descriptor.uWrap = texture.getUWrap();
descriptor.vWrap = texture.getVWrap();
float offsetU = tex.uvTranslation == null ? 0f : tex.uvTranslation.x;
float offsetV = tex.uvTranslation == null ? 0f : tex.uvTranslation.y;
float scaleU = tex.uvScaling == null ? 1f : tex.uvScaling.x;
float scaleV = tex.uvScaling == null ? 1f : tex.uvScaling.y;
switch (tex.usage) {
case ModelTexture.USAGE_DIFFUSE:
result.set(new TextureAttribute(TextureAttribute.Diffuse, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
case ModelTexture.USAGE_SPECULAR:
result.set(new TextureAttribute(TextureAttribute.Specular, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
case ModelTexture.USAGE_BUMP:
result.set(new TextureAttribute(TextureAttribute.Bump, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
case ModelTexture.USAGE_NORMAL:
result.set(new TextureAttribute(TextureAttribute.Normal, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
case ModelTexture.USAGE_AMBIENT:
result.set(new TextureAttribute(TextureAttribute.Ambient, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
case ModelTexture.USAGE_EMISSIVE:
result.set(new TextureAttribute(TextureAttribute.Emissive, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
case ModelTexture.USAGE_REFLECTION:
result.set(new TextureAttribute(TextureAttribute.Reflection, descriptor, offsetU, offsetV, scaleU, scaleV));
break;
}
}
}
return result;
}