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


Java Material.set方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.Material.set方法的典型用法代码示例。如果您正苦于以下问题:Java Material.set方法的具体用法?Java Material.set怎么用?Java Material.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.g3d.Material的用法示例。


在下文中一共展示了Material.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GameObject

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public GameObject(ScreenBase context, Model model, BoundingBox bounds) {
super(model);
this.context = context;
this.customBounds = bounds;

      this.bounds = this.customBounds != null ? this.customBounds : new BoundingBox();
      this.center = new Vector3();
      this.enabled = true;
      updateBox();
      
      this.animations = new AnimationController(this);
      this.blending = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
      
      for(Material item : materials){
      	item.set(new DepthTestAttribute(GL20.GL_LEQUAL, 0.01f, 25f, true));
	item.set(FloatAttribute.createAlphaTest(0.01f));
      	item.set(blending);
      }
  }
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:20,代码来源:GameObject.java

示例2: Terrain

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
private Terrain(int vertexResolution) {
    this.transform = new Matrix4();
    this.attribs = MeshBuilder.createAttributes(VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
            | VertexAttributes.Usage.TextureCoordinates);
    this.posPos = attribs.getOffset(VertexAttributes.Usage.Position, -1);
    this.norPos = attribs.getOffset(VertexAttributes.Usage.Normal, -1);
    this.uvPos = attribs.getOffset(VertexAttributes.Usage.TextureCoordinates, -1);
    this.stride = attribs.vertexSize / 4;

    this.vertexResolution = vertexResolution;
    this.heightData = new float[vertexResolution * vertexResolution];

    this.terrainTexture = new TerrainTexture();
    this.terrainTexture.setTerrain(this);
    material = new Material();
    material.set(new TerrainTextureAttribute(TerrainTextureAttribute.ATTRIBUTE_SPLAT0, terrainTexture));
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:18,代码来源:Terrain.java

示例3: AreaDisplayable

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public AreaDisplayable(Model model) {
  instance = new ModelInstance(model);

  animationController = new AnimationController(instance);

  instance.transform.rotate(new Vector3(1, 0, 0), 90);

  for (Material material : instance.materials) {
    TextureAttribute ta
        = (TextureAttribute) material.get(TextureAttribute.Diffuse);

    ta.textureDescription.magFilter = Texture.TextureFilter.Nearest;
    ta.textureDescription.minFilter = Texture.TextureFilter.Nearest;

    material.set(ta);
    material.set(ColorAttribute.createDiffuse(Color.WHITE));

    BlendingAttribute ba = new BlendingAttribute(GL20.GL_SRC_ALPHA,
                                                 GL20.GL_ONE_MINUS_SRC_ALPHA);

    material.set(ba);
  }
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:24,代码来源:AreaDisplayable.java

示例4: createBillboardTest

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void createBillboardTest() {
	ModelBuilder mb = new ModelBuilder();
	mb.begin();

	long attr = Usage.TextureCoordinates | Usage.Position | Usage.Normal;
	TextureRegion region = Assets.getAtlas().findRegion("sprites/test-guy");
	Material mat = new Material(TextureAttribute.createDiffuse(region.getTexture()));
	boolean blended = true;
	float opacity = 1f;
	mat.set(new BlendingAttribute(blended, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, opacity));
	MeshPartBuilder mpb = mb.part("rect", GL20.GL_TRIANGLES, attr, mat);
	mpb.setUVRange(region);
	// the coordinates are offset so that we can easily set the center position to align with the entity's body
	float sz = 2f; // size
	float b = -sz/2; // base
	float max = sz/2; // max
	Vector3 bl = new Vector3(b, b, 0f);
	Vector3 br = new Vector3(b, max, 0f);
	Vector3 tr = new Vector3(max, max, 0f);
	Vector3 tl = new Vector3(max, b, 0f);
	Vector3 norm = new Vector3(0f, 0f, 1f);
	mpb.rect(bl, tl, tr, br, norm);
	billboardTestModel = mb.end();
}
 
开发者ID:jrenner,项目名称:gdx-proto,代码行数:25,代码来源:ModelManager.java

示例5: init

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public static void init() {
	list = new Array<>();
	ModelBuilder mb = new ModelBuilder();
	Vector3 norm = new Vector3(0f, 1f, 0f);
	Texture texture = Assets.manager.get("textures/shadow.png", Texture.class);
	Material material = new Material(TextureAttribute.createDiffuse(texture));
	material.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, 0.7f));
	//material.set(new DepthTestAttribute(0)); // disable depth testing
	long attr = Usage.Position | Usage.TextureCoordinates;
	float s = 1f;
	model = mb.createRect(
			-s, 0f, -s,// bl
			-s, 0f, s, // tl
			s, 0f, s,  // tr
			s, 0f, -s,  // br
			norm.x, norm.y, norm.z,
			material,
			attr
	);
}
 
开发者ID:jrenner,项目名称:gdx-proto,代码行数:21,代码来源:Shadow.java

示例6: loadSync

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
@Override
public Model loadSync(AssetManager manager, String fileName, FileHandle file, P parameters) {
    ModelData data = null;
    synchronized (items) {
        for (int i = 0; i < items.size; i++) {
            if (items.get(i).key.equals(fileName)) {
                data = items.get(i).value;
                items.removeIndex(i);
            }
        }
    }
    if (data == null) return null;
    final Model result = new Model(data, new TextureProvider.AssetTextureProvider(manager));
    // need to remove the textures from the managed disposables, or else ref counting
    // doesn't work!
    Iterator<Disposable> disposables = result.getManagedDisposables().iterator();
    while (disposables.hasNext()) {
        Disposable disposable = disposables.next();
        if (disposable instanceof Texture) {
            disposables.remove();
        }
    }

    // Automatically convert all materials to PBR
    for (Material material : result.materials) {
        TextureAttribute textureAttribute = (TextureAttribute) material.get(TextureAttribute.Diffuse);

        if (textureAttribute != null) {
            material.set(PbrTextureAttribute.createAlbedo(textureAttribute.textureDescription.texture));
        }
    }

    data = null;
    return result;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:36,代码来源:NhgModelLoader.java

示例7: createMaterial

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
Material createMaterial(String materialName){
	Material material=new Material();
	material.set(PBRTextureAttribute.createAlbedo(new Texture("materials/" + materialName + "_Base_Color.png")));
	material.set(PBRTextureAttribute.createMetallic(new Texture("materials/" + materialName + "_Metallic.png")));
	material.set(PBRTextureAttribute.createRoughness(new Texture("materials/" + materialName + "_Roughness.png")));
	material.set(PBRTextureAttribute.createAmbientOcclusion(new Texture("materials/" + materialName + "_Ambient_Occlusion.png")));
	material.set(PBRTextureAttribute.createHeight(new Texture("materials/" + materialName + "_Height.png")));
	material.set(PBRTextureAttribute.createNormal(new Texture("materials/" + materialName + "_Normal.png")));

	return material;
}
 
开发者ID:PWorlds,项目名称:LibGDX-PBR,代码行数:12,代码来源:PBRTestAPP.java

示例8: applyToMaterial

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
/**
 * Applies this material asset to the libGDX material.
 *
 * @param material
 * @return
 */
public Material applyToMaterial(Material material) {
    if (diffuseColor != null) {
        material.set(new ColorAttribute(ColorAttribute.Diffuse, diffuseColor));
    }
    if (diffuseTexture != null) {
        material.set(new TextureAttribute(TextureAttribute.Diffuse, diffuseTexture.getTexture()));
    } else {
        material.remove(TextureAttribute.Diffuse);
    }
    material.set(new FloatAttribute(FloatAttribute.Shininess, shininess));

    return material;
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:20,代码来源:MaterialAsset.java

示例9: createOutlineModel

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public static void createOutlineModel(Model model, Color outlineColor, float fattenAmount) {
	fatten(model, fattenAmount);
	for (Material m : model.materials) {
		m.clear();
		m.set(new IntAttribute(IntAttribute.CullFace, Gdx.gl.GL_FRONT));
		m.set(ColorAttribute.createDiffuse(outlineColor));
	}
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:9,代码来源:ModelFactory.java

示例10: buildBillboardModel

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public static Model buildBillboardModel(Texture texture, float width, float height) {
	TextureRegion textureRegion = new TextureRegion(texture, texture.getWidth(), texture.getHeight());
	Material material = new Material();
	material.set(new TextureAttribute(TextureAttribute.Diffuse, textureRegion));
	material.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE));
	material.set(new BlendingAttribute());
	return ModelFactory.buildPlaneModel(width, height, material, 0, 0, 1, 1);
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:9,代码来源:ModelFactory.java

示例11: replace

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的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

示例12: createMaterial

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public Material createMaterial() {
	Material m = new Material(this.id);
	for (ColorAttribute colorAttribute : colorAttributes) {
		m.set(colorAttribute);
	}
	return m;
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:8,代码来源:GsonMaterial.java

示例13: onLoaded

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
@Override
protected void onLoaded () {
	if (currentlyLoading == null || currentlyLoading.isEmpty()) return;

	instances.clear();
	animationControllers.clear();
	final ModelInstance instance = new ModelInstance(assets.get(currentlyLoading, Model.class));
	for (Material m : instance.materials)
		m.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, 0.8f));
	instances.add(instance);
	if (instance.animations.size > 0) animationControllers.put(instance, new AnimationController(instance));
	currentlyLoading = null;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:14,代码来源:SkeletonTest.java

示例14: initModel

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
private static void initModel() {
    if (mc == null) {
        Texture tex = new Texture(Gdx.files.internal(GlobalConf.TEXTURES_FOLDER + "star.jpg"));
        Texture lut = new Texture(Gdx.files.internal(GlobalConf.TEXTURES_FOLDER + "lut.jpg"));
        tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        Map<String, Object> params = new TreeMap<String, Object>();
        params.put("quality", 120l);
        params.put("diameter", 1d);
        params.put("flip", false);

        Pair<Model, Map<String, Material>> pair = ModelCache.cache.getModel("sphere", params, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
        Model model = pair.getFirst();
        Material mat = pair.getSecond().get("base");
        mat.clear();
        mat.set(new TextureAttribute(TextureAttribute.Diffuse, tex));
        mat.set(new TextureAttribute(TextureAttribute.Normal, lut));
        // Only to activate view vector (camera position)
        mat.set(new TextureAttribute(TextureAttribute.Specular, lut));
        mat.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
        modelTransform = new Matrix4();
        mc = new ModelComponent(false);
        mc.env = new Environment();
        mc.env.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
        mc.env.set(new FloatAttribute(FloatAttribute.Shininess, 0f));
        mc.instance = new ModelInstance(model, modelTransform);
    }
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:29,代码来源:StarGroup.java

示例15: initModel

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public static void initModel() {
    if (mc == null) {
        Texture tex = new Texture(Gdx.files.internal(GlobalConf.TEXTURES_FOLDER + "star.jpg"));
        Texture lut = new Texture(Gdx.files.internal(GlobalConf.TEXTURES_FOLDER + "lut.jpg"));
        tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        Map<String, Object> params = new TreeMap<String, Object>();
        params.put("quality", 120l);
        params.put("diameter", 1d);
        params.put("flip", false);

        Pair<Model, Map<String, Material>> pair = ModelCache.cache.getModel("sphere", params, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
        Model model = pair.getFirst();
        Material mat = pair.getSecond().get("base");
        mat.clear();
        mat.set(new TextureAttribute(TextureAttribute.Diffuse, tex));
        mat.set(new TextureAttribute(TextureAttribute.Normal, lut));
        // Only to activate view vector (camera position)
        mat.set(new TextureAttribute(TextureAttribute.Specular, lut));
        mat.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
        modelTransform = new Matrix4();
        mc = new ModelComponent(false);
        mc.env = new Environment();
        mc.env.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
        mc.env.set(new FloatAttribute(FloatAttribute.Shininess, 0f));
        mc.instance = new ModelInstance(model, modelTransform);
    }
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:29,代码来源:Star.java


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