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


Java BlendingAttribute类代码示例

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


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

示例1: GameObject

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的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: render

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
@Override
	public void render(Renderable renderable, Attributes combinedAttributes)
	{

//		context.setCullFace(GL_BACK);
		// Classic depth test
		context.setDepthTest(GL20.GL_LEQUAL);
		// Deactivate blending on first pass
		context.setBlending(false, GL20.GL_ONE, GL20.GL_ONE);

		context.setDepthMask(true);

		if (!combinedAttributes.has(BlendingAttribute.Type))
			context.setBlending(false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

		super.render(renderable, combinedAttributes);


//		program.begin();
//		super.render(renderable, combinedAttributes);
//		program.end();
	}
 
开发者ID:arksu,项目名称:origin,代码行数:23,代码来源:ShadowShader.java

示例3: buildFaceForChunkWithAssembler

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
private VoxelChunkRenderable buildFaceForChunkWithAssembler(Chunk chunk, VoxelsAssembler assembler, boolean haveTransparency) {
  if (!assembler.isEmpty()) {
    VoxelChunkRenderable renderable   = new VoxelChunkRenderable();
    renderable.primitiveType          = GL30.GL_TRIANGLES;

    if (ForgE.config.getBool(Config.Key.GenerateWireframe))
      renderable.wireframe           = assembler.wireframe();
    renderable.triangleCount         = assembler.getTriangleCount();
    renderable.meshFactory           = assembler.meshFactory(MeshVertexInfo.voxelTypes());

    renderable.worldTransform.idt();
    renderable.material = new Material(new SolidTerrainAttribute());
    if (haveTransparency) {
      renderable.material.set(new BlendingAttribute(true,1f));
    }

    chunk.addFace(renderable);
    return renderable;
  } else {
    return null;
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:23,代码来源:TerrainBuilder.java

示例4: write

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
@Override
public void write(Kryo kryo, Output output, VoxelChunkRenderableFactory object) {
  output.writeInt(object.triangleCount);
  output.writeInt(object.primitiveType);

  output.writeBoolean(object.material.has(SolidTerrainAttribute.Type));
  output.writeBoolean(object.material.has(BlendingAttribute.Type));
  output.writeBoolean(object.material.has(WaterAttribute.Type));

  output.writeInt(object.attributes.length);
  for (MeshVertexInfo.AttributeType attribute : object.attributes) {
    kryo.writeObject(output, attribute);
  }
  output.writeInt(object.meshFactory.verties.length);
  output.writeInt(object.meshFactory.indices.length);

  output.writeFloats(object.meshFactory.verties);
  output.writeShorts(object.meshFactory.indices);
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:20,代码来源:VoxelChunkRenderableFactorySerializer.java

示例5: canRender

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
@Override
public boolean canRender (Renderable renderable) {
	if (renderable.material.has(BlendingAttribute.Type)) {
		if ((materialMask & BlendingAttribute.Type) != BlendingAttribute.Type)
			return false;
		if (renderable.material.has(TextureAttribute.Diffuse) != ((materialMask & TextureAttribute.Diffuse) == TextureAttribute.Diffuse))
			return false;
	}
	final boolean skinned = ((renderable.mesh.getVertexAttributes().getMask() & Usage.BoneWeight) == Usage.BoneWeight);
	if (skinned != (numBones > 0)) return false;
	if (!skinned) return true;
	int w = 0;
	final int n = renderable.mesh.getVertexAttributes().size();
	for (int i = 0; i < n; i++) {
		final VertexAttribute attr = renderable.mesh.getVertexAttributes().get(i);
		if (attr.usage == Usage.BoneWeight) w |= (1 << attr.unit);
	}
	return w == weights;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:20,代码来源:DepthShader.java

示例6: render

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
@Override
public void render (final Renderable renderable) {
	if (renderable.material.has(BlendingAttribute.Type)) {
		final BlendingAttribute blending = (BlendingAttribute)renderable.material.get(BlendingAttribute.Type);
		renderable.material.remove(BlendingAttribute.Type);
		final boolean hasAlphaTest = renderable.material.has(FloatAttribute.AlphaTest);
		if (!hasAlphaTest)
			renderable.material.set(alphaTestAttribute);
		if (blending.opacity >= ((FloatAttribute)renderable.material.get(FloatAttribute.AlphaTest)).value)
			super.render(renderable);
		if (!hasAlphaTest)
			renderable.material.remove(FloatAttribute.AlphaTest);
		renderable.material.set(blending);
	} else
		super.render(renderable);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:DepthShader.java

示例7: TileHighlightDisplayable

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
public TileHighlightDisplayable() {
  ModelBuilder modelBuilder = new ModelBuilder();

  Model model
      = modelBuilder.createRect(0, 0, Z_OFFSET,
                                1, 0, Z_OFFSET,
                                1, 1, Z_OFFSET,
                                0, 1, Z_OFFSET,
                                0, 0, 1,
                                GL20.GL_TRIANGLES,
                                new Material(
                                    new ColorAttribute(
                                        ColorAttribute.createDiffuse(color)),
                                    new BlendingAttribute(
                                        GL20.GL_SRC_ALPHA,
                                        GL20.GL_ONE_MINUS_SRC_ALPHA)),
                                VertexAttributes.Usage.Position |
                                VertexAttributes.Usage.TextureCoordinates);

  instance = new ModelInstance(model);
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:22,代码来源:TileHighlightDisplayable.java

示例8: AreaDisplayable

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

示例9: createFloor

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
public static void createFloor() {

		ModelBuilder modelBuilder = new ModelBuilder();
		modelBuilder.begin();
		MeshPartBuilder mpb = modelBuilder.part("parts", GL20.GL_TRIANGLES,
				Usage.Position | Usage.Normal | Usage.ColorUnpacked, new Material(
						ColorAttribute.createDiffuse(Color.WHITE)));
		mpb.setColor(1f, 1f, 1f, 1f);
//		mpb.box(0, -0.1f, 0, 10, .2f, 10);
		mpb.rect(-10, 0, -10, 
				-10, 0, 10,
				10, 0, 10,
				10, 0, -10, 0, 1, 0);
		floorModel = modelBuilder.end();
		floorInstance = new ModelInstance(floorModel);
		
		// TODO Set only when FBO is active
		floorInstance.materials.get(0).set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
	}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:20,代码来源:Utils3D.java

示例10: LedEntity

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
public LedEntity(Model model) {
  super(model);

  light = new PointLight();
  light.set(new Color(1f,1f, 1f, 1f), Vector3.Zero, 2f);

  for (Material material : instance.materials) {

    if (material.id.contains("Led")) {
      this.colorAttr = (ColorAttribute)material.get(ColorAttribute.Diffuse);
      colorAttr.color.set(Color.WHITE);

      this.blendingAttribute = (BlendingAttribute)material.get(BlendingAttribute.Type);
      blendingAttribute.opacity = 1.0f;
      blendingAttribute.sourceFunction = GL20.GL_ONE;
      blendingAttribute.destFunction = GL20.GL_SRC_ALPHA;

    }
  }
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:21,代码来源:LedEntity.java

示例11: createBillboardTest

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

示例12: init

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

示例13: getPackedTextureSheet

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
private static PackedTextureSheet getPackedTextureSheet(AssetType... assetType) {
	if (Adapter.isDedicatedServer())
		return null;
	TexturePacker texturePacker = new TexturePacker(2048, 2048, 1, true);
	Pixmap pixmap;
	getPacketTextureSheetFor(assetType, texturePacker, pixmap);

	FileHandle fileHandle = assetsFolder.child("packed");
	fileHandle.mkdirs();
	Compatibility.get().nomedia(fileHandle);
	fileHandle = fileHandle.child(assetType[0].name() + ".cim");

	try {
		PixmapIO.writeCIM(fileHandle, texturePacker.getPixmap());
	} catch (GdxRuntimeException e) {
		Log.error("Failed to write packed image", e);
	}

	Texture texture = new Texture(fileHandle);
	texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
	PackedTextureSheet packedTextureSheet = new PackedTextureSheet(
			new Material(TextureAttribute.createDiffuse(texture)));
	packedTextureSheet.getMaterial().set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));

	Map<Asset, TexturePacker.PackRectangle> rectangles = texturePacker.getRectangles();
	int num = 0;
	for (Map.Entry<Asset, TexturePacker.PackRectangle> entry : rectangles.entrySet()) {
		num++;
		TextureRegion textureRegion = new TextureRegion(texture, entry.getValue().x, entry.getValue().y,
				entry.getValue().width, entry.getValue().height);
		entry.getKey().setPackedTextureRegion(textureRegion, packedTextureSheet);
		packedTextureSheet.getPackedTextures().put(entry.getKey().toString(), textureRegion);
	}

	for (AssetType type : assetType) {
		type.setPackedTextureSheet(packedTextureSheet);
	}
	return packedTextureSheet;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:40,代码来源:Assets.java

示例14: render

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的package包/类
@Override
public void render(final Renderable renderable) {
    if (!renderable.material.has(BlendingAttribute.Type)) {
        context.setBlending(false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    }

    bindMaterial(renderable);

    super.render(renderable);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:11,代码来源:ParticleShader.java

示例15: bindMaterial

import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute; //导入依赖的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, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        } 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:MovementSpeed,项目名称:nhglib,代码行数:38,代码来源:ParticleShader.java


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