本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.Attribute类的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Attribute类属于com.badlogic.gdx.graphics.g3d包,在下文中一共展示了Attribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTo
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public int compareTo(Attribute o) {
if (type != o.type) return type < o.type ? -1 : 1;
PbrTextureAttribute other = (PbrTextureAttribute) o;
final int c = textureDescription.compareTo(other.textureDescription);
if (c != 0) return c;
if (uvIndex != other.uvIndex) return uvIndex - other.uvIndex;
if (!MathUtils.isEqual(scaleU, other.scaleU)) return scaleU > other.scaleU ? 1 : -1;
if (!MathUtils.isEqual(scaleV, other.scaleV)) return scaleV > other.scaleV ? 1 : -1;
if (!MathUtils.isEqual(offsetU, other.offsetU)) return offsetU > other.offsetU ? 1 : -1;
if (!MathUtils.isEqual(offsetV, other.offsetV)) return offsetV > other.offsetV ? 1 : -1;
return 0;
}
示例2: compareTo
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public int compareTo(Attribute o) {
if (type != o.type) return type < o.type ? -1 : 1;
IBLAttribute other = (IBLAttribute) o;
final int c = textureDescription.compareTo(other.textureDescription);
if (c != 0) return c;
if (uvIndex != other.uvIndex) return uvIndex - other.uvIndex;
return 0;
}
示例3: compareTo
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public int compareTo (Attribute o) {
if (type != o.type) return type < o.type ? -1 : 1;
TextureAttribute other = (TextureAttribute)o;
final int c = textureDescription.compareTo(other.textureDescription);
if (c != 0) return c;
if (uvIndex != other.uvIndex) return uvIndex - other.uvIndex;
if (!MathUtils.isEqual(scaleU, other.scaleU)) return scaleU > other.scaleU ? 1 : -1;
if (!MathUtils.isEqual(scaleV, other.scaleV)) return scaleV > other.scaleV ? 1 : -1;
if (!MathUtils.isEqual(offsetU, other.offsetU)) return offsetU > other.offsetU ? 1 : -1;
if (!MathUtils.isEqual(offsetV, other.offsetV)) return offsetV > other.offsetV ? 1 : -1;
return 0;
}
示例4: getAttribute
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
private <T extends Attribute> T getAttribute(long type, Class<T> cls) {
String alias = TextureAttribute.getAttributeAlias(type);
Attribute attr = mtl.get(type);
if(attr == null)
return null;
return cls.cast(attr);
}
示例5: write
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public void write(final JsonWriter out, final Material value) throws IOException {
if(value == null) { out.nullValue(); return; }
out.beginObject();
out.name("id").value(value.id);
ArrayList<Attribute> attrList = new ArrayList<>();
value.iterator().forEachRemaining(attrList::add);
out.name("attributes").value(JSONSerializer.instance().serialize(attrList));
out.endObject();
}
示例6: write
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public void write(JsonWriter out, Attribute value) throws IOException {
if(value == null) {
out.nullValue();
return;
}
out.beginObject();
String alias = value.getClass().getSimpleName();
out.name("type").value(value.type);
alias += "::" + value.getAttributeAlias(value.type);
out.name("alias").value(alias);
out.name("attrData").beginObject();
if(value instanceof TextureAttribute) {
out.name("offsetU").value(((TextureAttribute) value).offsetU);
out.name("offsetV").value(((TextureAttribute) value).offsetV);
out.name("scaleU").value(((TextureAttribute) value).scaleU);
out.name("scaleV").value(((TextureAttribute) value).scaleV);
out.name("textureDescriptor").value(JSONSerializer.instance().serialize(((TextureAttribute) value).textureDescription));
}else if(value instanceof ColorAttribute) {
out.name("colour").value(((ColorAttribute) value).color.toString());
}else if(value instanceof BlendingAttribute) {
out.name("alpha").value(((BlendingAttribute) value).opacity);
}
out.endObject();
out.endObject();
}
示例7: read
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的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;
}
示例8: addAttributeForm
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
private void addAttributeForm(Attribute attribute, final Material material) {
if (attribute instanceof ColorAttribute) {
final ColorAttribute colorAttribute = (ColorAttribute) attribute;
String type = ColorAttribute.getAttributeAlias(colorAttribute.type);
ColorForm.ColorChangeListener colorChangeListener = new ColorForm.ColorChangeListener() {
@Override
public void onColorChange(float r, float g, float b) {
//replace(material, colorAttribute, attribute);
listener.onMaterialChange(material);
}
};
final ColorForm colorAttributeForm = new ColorForm(
getSkin(), "ColorAttribute " + type, colorAttribute.color, colorChangeListener, new RemoveTableListener() {
@Override
public void onRemove(Table table) {
material.remove(colorAttribute.type);
listener.onMaterialChange(material);
removeActor(table);
pack();
listener.onMaterialChange(material);
}
});
add(colorAttributeForm).colspan(2).left().fill();
row();
}
pack();
}
示例9: replace
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
private void replace(Material m, Attribute oldAttribute, Attribute newAttribute) {
Iterator<Attribute> iterator = m.iterator();
while (iterator.hasNext()) {
Attribute next = iterator.next();
if (next.equals(oldAttribute)) {
iterator.remove();
}
}
m.set(newAttribute);
}
示例10: GsonMaterial
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
public GsonMaterial(Material material) {
Iterator<Attribute> iterator = material.iterator();
while (iterator.hasNext()) {
Attribute next = iterator.next();
if (next instanceof ColorAttribute) {
colorAttributes.add((ColorAttribute) next);
}
}
this.id = material.id;
}
示例11: loadSphere
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
private void loadSphere(String planetId) {
ModelLoader loader = new ObjLoader();
sphereModel = loader.loadModel(Gdx.files.internal("models/sphere01.obj"),
new SphereTextureProvider(planetId));
environmentSphere = new ModelInstance(sphereModel);
Attribute attribute = environmentSphere.materials.get(0).get(
ColorAttribute.getAttributeType(ColorAttribute.DiffuseAlias));
((ColorAttribute) attribute).color.r = 1;
((ColorAttribute) attribute).color.g = 1;
((ColorAttribute) attribute).color.b = 1;
}
示例12: bindMaterial
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
protected void bindMaterial (final Renderable renderable) {
if (currentMaterial == renderable.material) return;
int cullFace = config.defaultCullFace == -1 ? defaultCullFace : config.defaultCullFace;
int depthFunc = config.defaultDepthFunc == -1 ? defaultDepthFunc : config.defaultDepthFunc;
float depthRangeNear = 0f;
float depthRangeFar = 1f;
boolean depthMask = true;
currentMaterial = renderable.material;
for (final Attribute attr : currentMaterial) {
final long t = attr.type;
if (BlendingAttribute.is(t)) {
context.setBlending(true, ((BlendingAttribute)attr).sourceFunction, ((BlendingAttribute)attr).destFunction);
set(u_opacity, ((BlendingAttribute)attr).opacity);
} else if ((t & IntAttribute.CullFace) == IntAttribute.CullFace)
cullFace = ((IntAttribute)attr).value;
else if ((t & FloatAttribute.AlphaTest) == FloatAttribute.AlphaTest)
set(u_alphaTest, ((FloatAttribute)attr).value);
else if ((t & DepthTestAttribute.Type) == DepthTestAttribute.Type) {
DepthTestAttribute dta = (DepthTestAttribute)attr;
depthFunc = dta.depthFunc;
depthRangeNear = dta.depthRangeNear;
depthRangeFar = dta.depthRangeFar;
depthMask = dta.depthMask;
} else if (!config.ignoreUnimplemented) throw new GdxRuntimeException("Unknown material attribute: " + attr.toString());
}
context.setCullFace(cullFace);
context.setDepthTest(depthFunc, depthRangeNear, depthRangeFar);
context.setDepthMask(depthMask);
}
示例13: bindMaterial
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
protected void bindMaterial(final Renderable renderable) {
if (currentMaterial == renderable.material)
return;
int cullFace = config.defaultCullFace == -1 ? GL20.GL_BACK : config.defaultCullFace;
int depthFunc = config.defaultDepthFunc == -1 ? GL20.GL_LEQUAL : config.defaultDepthFunc;
float depthRangeNear = 0f;
float depthRangeFar = 1f;
boolean depthMask = true;
currentMaterial = renderable.material;
for (final Attribute attr : currentMaterial) {
final long t = attr.type;
if (BlendingAttribute.is(t)) {
context.setBlending(true, ((BlendingAttribute)attr).sourceFunction, ((BlendingAttribute)attr).destFunction);
}
else if ((t & DepthTestAttribute.Type) == DepthTestAttribute.Type) {
DepthTestAttribute dta = (DepthTestAttribute)attr;
depthFunc = dta.depthFunc;
depthRangeNear = dta.depthRangeNear;
depthRangeFar = dta.depthRangeFar;
depthMask = dta.depthMask;
}
else if(!config.ignoreUnimplemented)
throw new GdxRuntimeException("Unknown material attribute: "+attr.toString());
}
context.setCullFace(cullFace);
context.setDepthTest(depthFunc, depthRangeNear, depthRangeFar);
context.setDepthMask(depthMask);
}
示例14: bindMaterial
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
protected void bindMaterial(final Renderable renderable) {
if (currentMaterial == renderable.material)
return;
int cullFace = config.defaultCullFace == -1 ? defaultCullFace : config.defaultCullFace;
int depthFunc = config.defaultDepthFunc == -1 ? defaultDepthFunc : config.defaultDepthFunc;
float depthRangeNear = 0f;
float depthRangeFar = 1f;
boolean depthMask = true;
currentMaterial = renderable.material;
for (final Attribute attr : currentMaterial) {
final long t = attr.type;
if (BlendingAttribute.is(t)) {
context.setBlending(true, ((BlendingAttribute) attr).sourceFunction, ((BlendingAttribute) attr).destFunction);
} else if ((t & IntAttribute.CullFace) == IntAttribute.CullFace)
cullFace = ((IntAttribute) attr).value;
else if ((t & DepthTestAttribute.Type) == DepthTestAttribute.Type) {
DepthTestAttribute dta = (DepthTestAttribute) attr;
depthFunc = dta.depthFunc;
depthRangeNear = dta.depthRangeNear;
depthRangeFar = dta.depthRangeFar;
depthMask = dta.depthMask;
} else if (!config.ignoreUnimplemented)
throw new GdxRuntimeException("Unknown material attribute: " + attr.toString());
}
context.setCullFace(cullFace);
context.setDepthTest(depthFunc, depthRangeNear, depthRangeFar);
context.setDepthMask(depthMask);
}
示例15: copy
import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public Attribute copy() {
return new PbrTextureAttribute(this);
}