当前位置: 首页>>代码示例>>Java>>正文


Java Attribute类代码示例

本文整理汇总了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;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:14,代码来源:PbrTextureAttribute.java

示例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;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:10,代码来源:IBLAttribute.java

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

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

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

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

示例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;
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:40,代码来源:AttributeTypeAdapter.java

示例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();
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:31,代码来源:MaterialForm.java

示例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);
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:11,代码来源:MaterialForm.java

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

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

}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:14,代码来源:ControllerPlanet.java

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

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

示例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);
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:32,代码来源:AtmosphereShader.java

示例15: copy

import com.badlogic.gdx.graphics.g3d.Attribute; //导入依赖的package包/类
@Override
public Attribute copy() {
    return new PbrTextureAttribute(this);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:5,代码来源:PbrTextureAttribute.java


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