set blending material attribute to tile chunk alpha meshes
This commit is contained in:
parent
657d274f93
commit
0d44e5c71d
|
@ -109,8 +109,8 @@ public class TileChunk extends TileContainer implements Disposable {
|
||||||
for (int i = 0; i < numTiles; ++i)
|
for (int i = 0; i < numTiles; ++i)
|
||||||
data[i] = new Tile();
|
data[i] = new Tile();
|
||||||
|
|
||||||
mesh = new TileChunkMesh(this);
|
mesh = new TileChunkMesh(this, false);
|
||||||
alphaMesh = new TileChunkMesh(this);
|
alphaMesh = new TileChunkMesh(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateVertices(ChunkVertexGenerator generator) {
|
public void updateVertices(ChunkVertexGenerator generator) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.blarg.gdx.tilemap3d;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.Mesh;
|
import com.badlogic.gdx.graphics.Mesh;
|
||||||
import com.badlogic.gdx.graphics.g3d.Renderable;
|
import com.badlogic.gdx.graphics.g3d.Renderable;
|
||||||
|
import com.badlogic.gdx.graphics.g3d.materials.BlendingAttribute;
|
||||||
import com.badlogic.gdx.graphics.g3d.materials.Material;
|
import com.badlogic.gdx.graphics.g3d.materials.Material;
|
||||||
import com.badlogic.gdx.graphics.g3d.materials.TextureAttribute;
|
import com.badlogic.gdx.graphics.g3d.materials.TextureAttribute;
|
||||||
import com.badlogic.gdx.math.collision.BoundingBox;
|
import com.badlogic.gdx.math.collision.BoundingBox;
|
||||||
|
@ -12,7 +13,7 @@ import com.blarg.gdx.graphics.TextureAtlas;
|
||||||
public class TileChunkMesh extends Renderable implements Disposable {
|
public class TileChunkMesh extends Renderable implements Disposable {
|
||||||
public final BoundingBox bounds;
|
public final BoundingBox bounds;
|
||||||
|
|
||||||
public TileChunkMesh(TileChunk chunk) {
|
public TileChunkMesh(TileChunk chunk, boolean blending) {
|
||||||
meshPartOffset = 0;
|
meshPartOffset = 0;
|
||||||
meshPartSize = 0;
|
meshPartSize = 0;
|
||||||
primitiveType = GL20.GL_TRIANGLES;
|
primitiveType = GL20.GL_TRIANGLES;
|
||||||
|
@ -20,9 +21,13 @@ public class TileChunkMesh extends Renderable implements Disposable {
|
||||||
lights = null;
|
lights = null;
|
||||||
shader = null;
|
shader = null;
|
||||||
userData = null;
|
userData = null;
|
||||||
|
material = new Material();
|
||||||
|
|
||||||
TextureAtlas tileMapAtlas = chunk.tileMap.tileMeshes.atlas;
|
TextureAtlas tileMapAtlas = chunk.tileMap.tileMeshes.atlas;
|
||||||
material = new Material(TextureAttribute.createDiffuse(tileMapAtlas.texture));
|
material.set(TextureAttribute.createDiffuse(tileMapAtlas.texture));
|
||||||
|
|
||||||
|
if (blending)
|
||||||
|
material.set(new BlendingAttribute());
|
||||||
|
|
||||||
bounds = new BoundingBox();
|
bounds = new BoundingBox();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue