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


Java MeshBuilder类代码示例

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


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

示例1: renderNorth

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderNorth(int atlasIndex, float x1, float y1, float x2, float y2, float z, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    // POSITIVE Z
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    c00.setPos(x1, y1, z).setNor(0, 0, 1);
    c01.setPos(x1, y2, z).setNor(0, 0, 1);
    c10.setPos(x2, y1, z).setNor(0, 0, 1);
    c11.setPos(x2, y2, z).setNor(0, 0, 1);

    Color c = getColor((int) x1, (int) y1, (int) z - 1);
    if(pcld == null) {
        builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a);
    } else {
        c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a);
        c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a);
        c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a);
        c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a);
    }

    builder.rect(c00, c10, c11, c01);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:25,代码来源:NormalBlockRenderer.java

示例2: renderSouth

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderSouth(int atlasIndex, float x1, float y1, float x2, float y2, float z, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    // NEGATIVE Z
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    c00.setPos(x1, y1, z).setNor(0, 0, -1);
    c01.setPos(x1, y2, z).setNor(0, 0, -1);
    c10.setPos(x2, y1, z).setNor(0, 0, -1);
    c11.setPos(x2, y2, z).setNor(0, 0, -1);

    Color c = getColor((int) x1, (int) y1, (int) z);
    if(pcld == null) {
        builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a);
    } else {
        c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a);
        c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a);
        c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a);
        c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a);
    }

    builder.rect(c01, c11, c10, c00);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:25,代码来源:NormalBlockRenderer.java

示例3: renderWest

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderWest(int atlasIndex, float z1, float y1, float z2, float y2, float x, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    // NEGATIVE X
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    c00.setPos(x, y1, z1).setNor(-1, 0, 0);
    c01.setPos(x, y1, z2).setNor(-1, 0, 0);
    c10.setPos(x, y2, z1).setNor(-1, 0, 0);
    c11.setPos(x, y2, z2).setNor(-1, 0, 0);

    Color c = getColor((int) x, (int) y1, (int) z1);
    if(pcld == null) {
        builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a);
    } else {
        c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a);
        c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a);
        c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a);
        c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a);
    }

    builder.rect(c01, c11, c10, c00);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:25,代码来源:NormalBlockRenderer.java

示例4: renderEast

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderEast(int atlasIndex, float z1, float y1, float z2, float y2, float x, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    // POSITIVE X
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    c00.setPos(x, y1, z1).setNor(1, 0, 0);
    c01.setPos(x, y1, z2).setNor(1, 0, 0);
    c10.setPos(x, y2, z1).setNor(1, 0, 0);
    c11.setPos(x, y2, z2).setNor(1, 0, 0);

    Color c = getColor((int) x - 1, (int) y1, (int) z1);
    if(pcld == null) {
        builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a);
    } else {
        c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a);
        c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a);
        c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a);
        c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a);
    }

    builder.rect(c00, c10, c11, c01);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:25,代码来源:NormalBlockRenderer.java

示例5: renderTop

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderTop(int atlasIndex, float x1, float z1, float x2, float z2, float y, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    // POSITIVE Y
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    c00.setPos(x1, y, z1).setNor(0, 1, 0);
    c01.setPos(x1, y, z2).setNor(0, 1, 0);
    c10.setPos(x2, y, z1).setNor(0, 1, 0);
    c11.setPos(x2, y, z2).setNor(0, 1, 0);

    Color c = getColor((int) x1, (int) y - 1, (int) z1);
    if(pcld == null) {
        builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a);
    } else {
        c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a);
        c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a);
        c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a);
        c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a);
    }

    builder.rect(c01, c11, c10, c00);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:25,代码来源:NormalBlockRenderer.java

示例6: renderBottom

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderBottom(int atlasIndex, float x1, float z1, float x2, float z2, float y, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    // NEGATIVE Y
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    c00.setPos(x1, y, z1).setNor(0, -1, 0);
    c01.setPos(x1, y, z2).setNor(0, -1, 0);
    c10.setPos(x2, y, z1).setNor(0, -1, 0);
    c11.setPos(x2, y, z2).setNor(0, -1, 0);

    Color c = getColor((int) x1, (int) y, (int) z1);
    if(pcld == null) {
        builder.setColor(c.r*lightLevel, c.g*lightLevel, c.b*lightLevel, c.a);
    } else {
        c00.setCol(c.r*pcld.l00, c.g*pcld.l00, c.b*pcld.l00, c.a);
        c01.setCol(c.r*pcld.l01, c.g*pcld.l01, c.b*pcld.l01, c.a);
        c10.setCol(c.r*pcld.l10, c.g*pcld.l10, c.b*pcld.l10, c.a);
        c11.setCol(c.r*pcld.l11, c.g*pcld.l11, c.b*pcld.l11, c.a);
    }

    builder.rect(c00, c10, c11, c01);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:25,代码来源:NormalBlockRenderer.java

示例7: render

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
public void render(MeshBuilder builder) {
    BlockRenderer renderer = block.getRenderer();

    switch (side) {
        case TOP:
            renderer.renderTop(block.getTextureIndex(), x1, y1, x2, y2, z + 1, lightLevel, pcld, builder);
            break;
        case BOTTOM:
            renderer.renderBottom(block.getTextureIndex(), x1, y1, x2, y2, z, lightLevel, pcld, builder);
            break;
        case NORTH:
            renderer.renderNorth(block.getTextureIndex(), x1, y1, x2, y2, z + 1, lightLevel, pcld, builder);
            break;
        case SOUTH:
            renderer.renderSouth(block.getTextureIndex(), x1, y1, x2, y2, z, lightLevel, pcld, builder);
            break;
        case EAST:
            renderer.renderEast(block.getTextureIndex(), x1, y1, x2, y2, z + 1, lightLevel, pcld, builder);
            break;
        case WEST:
            renderer.renderWest(block.getTextureIndex(), x1, y1, x2, y2, z, lightLevel, pcld, builder);
            break;

    }
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:26,代码来源:GreedyMesher.java

示例8: Terrain

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

示例9: createInfiniteWaterPart

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
public static Model createInfiniteWaterPart(TypeInterpreter interpreter, int landscapeIndex, PlanetConfig planetConfig) {
	ModelBuilder modelBuilder = new ModelBuilder();
	MeshBuilder builder = new MeshBuilder();
	float waterHeight = interpreter.it.get(landscapeIndex).endValue;
	builder.begin(PlanetPart.VERTEX_ATTRIBUTES, GL20.GL_TRIANGLES);
	infiniteWaterHeight = waterHeight * planetConfig.landscapeHeight - 1;
	Vector3 corner01 = new Vector3(-INFINITE_WATER_SIZE, -INFINITE_WATER_SIZE, infiniteWaterHeight);
	Vector3 corner02 = new Vector3(INFINITE_WATER_SIZE, -INFINITE_WATER_SIZE, infiniteWaterHeight);
	Vector3 corner03 = new Vector3(INFINITE_WATER_SIZE, INFINITE_WATER_SIZE, infiniteWaterHeight);
	Vector3 corner04 = new Vector3(-INFINITE_WATER_SIZE, INFINITE_WATER_SIZE, infiniteWaterHeight);
	builder.rect(corner01, corner02, corner03, corner04, new Vector3(0, 0, 1));
	Material waterMaterial = planetConfig.layerConfigs.get(landscapeIndex).material;
	Mesh mesh = builder.end();
	modelBuilder.begin();
	modelBuilder.part(PlanetPart.LANDSCAPE_PART_NAME + landscapeIndex, mesh, GL20.GL_TRIANGLES, waterMaterial);
	return modelBuilder.end();
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:18,代码来源:ControllerPlanet.java

示例10: createWaterPart

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
/**
 * Creates a water plane.
 * @param chunk The chunk.
 */
private void createWaterPart(Chunk chunk, int landscapeIndex) {
	MeshBuilder builder = meshBuilders.get(landscapeIndex);
	float WATER_HEIGHT = interpreter.it.get(landscapeIndex).endValue;
	builder.begin(VERTEX_ATTRIBUTES, GL20.GL_TRIANGLES);
	float z = WATER_HEIGHT * planetConfig.landscapeHeight;
	float width = chunk.getWidth() * tileSize;
	float height = chunk.getHeight() * tileSize;

	Vector3 corner01 = new Vector3(0f, 0f, z);
	Vector3 corner02 = new Vector3(width, 0f, z);
	Vector3 corner03 = new Vector3(width, height, z);
	Vector3 corner04 = new Vector3(0f, height, z);

	builder.rect(corner01, corner02, corner03, corner04, new Vector3(0, 0, 1));
	Material waterMaterial = planetConfig.layerConfigs.get(landscapeIndex).material;
	Mesh mesh = builder.end();
	modelBuilder.node().id = LANDSCAPE_NODE_NAME + landscapeIndex;
	modelBuilder.part(LANDSCAPE_PART_NAME + landscapeIndex, mesh, GL20.GL_TRIANGLES, waterMaterial);
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:24,代码来源:PlanetPart.java

示例11: Terrain

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

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

    material = Reference.Defaults.Models.material();
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:14,代码来源:Terrain.java

示例12: build

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
private void build() {
    region = new TextureRegion(assetManager.<Texture>get("img/lena.png"));

    shaderManager.createFrameBuffer("frameBuffer01");

    final MeshBuilder meshBuilder = new MeshBuilder();
    meshBuilder.begin(VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked | VertexAttributes.Usage.TextureCoordinates, GL20.GL_TRIANGLES);
    meshBuilder.rect(
            0f, 200f, 0f,
            200f, 200f, 0f,
            200f, 0f, 0f,
            0f, 0f, 0f,
            0f, 0f, 0f);
    rectangle = meshBuilder.end();
}
 
开发者ID:molp,项目名称:libgdx-shaders,代码行数:16,代码来源:FrameBufferScreen.java

示例13: rerender

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void rerender() {
    if (cleanedUp)
        return;

    boolean neighborSunlightChanging = false;
    for(int x = startPosition.x - 16; x <= startPosition.x + 16; x += 16) {
        for(int z = startPosition.z - 16; z <= startPosition.z + 16; z += 16) {
            IChunk c = getWorld().getChunk(x, z);
            if(c != null && c.waitingOnLightFinish()) {
                neighborSunlightChanging = true;
            }
        }
    }
    if(neighborSunlightChanging)
        return;

    if (!setup) {
        meshBuilder = new MeshBuilder();
        modelBuilder = new ModelBuilder();

        setup = true;
    }

    sunlightChanged = false;

    if(meshing) {
        meshWhenDone = true;
    } else {
        meshing = true;
        parentWorld.addToMeshQueue(this::updateFaces);
    }
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:34,代码来源:Chunk.java

示例14: renderTop

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderTop(int atlasIndex, float x1, float z1, float x2, float z2, float y, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    float u = getU(atlasIndex);
    float v = getV(atlasIndex);
    builder.setUVRange(u, v, u, v);

    MeshPartBuilder.VertexInfo c00 = new MeshPartBuilder.VertexInfo().setPos(x1, y, z1).setNor(0, 1, 0);
    MeshPartBuilder.VertexInfo c01 = new MeshPartBuilder.VertexInfo().setPos(x1, y, z2).setNor(0, 1, 0);
    MeshPartBuilder.VertexInfo c10 = new MeshPartBuilder.VertexInfo().setPos(x2, y, z1).setNor(0, 1, 0);
    MeshPartBuilder.VertexInfo c11 = new MeshPartBuilder.VertexInfo().setPos(x2, y, z2).setNor(0, 1, 0);

    IChunk chunk = RadixClient.getInstance().getWorld().getChunk((int) x1, (int) z1);
    Biome biome;
    if(chunk != null) {
        biome = chunk.getBiome();
    } else {
        biome = RadixAPI.instance.getBiomeByID(0);
    }
    int[] color = biome.getGrassColor((int) y - 1);
    float r = color[0]/255f;
    float g = color[1]/255f;
    float b = color[2]/255f;
    if(pcld == null) {
        builder.setColor(r*lightLevel, g*lightLevel, b*lightLevel, 1);
    } else {
        c00.setCol(r*pcld.l00, g*pcld.l00, b*pcld.l00, 1);
        c01.setCol(r*pcld.l01, g*pcld.l01, b*pcld.l01, 1);
        c10.setCol(r*pcld.l10, g*pcld.l10, b*pcld.l10, 1);
        c11.setCol(r*pcld.l11, g*pcld.l11, b*pcld.l11, 1);
    }

    builder.rect(c01, c11, c10, c00);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:34,代码来源:GrassRenderer.java

示例15: renderNorth

import com.badlogic.gdx.graphics.g3d.utils.MeshBuilder; //导入依赖的package包/类
@Override
public void renderNorth(int atlasIndex, float x1, float y1, float x2, float y2, float z, float lightLevel, PerCornerLightData pcld, MeshBuilder builder) {
    int zi = MathUtils.floor(z - 1);
    int xi = MathUtils.floor(x1);
    int yi = MathUtils.floor(y1);
    IWorld world = RadixClient.getInstance().getWorld();
    IChunk chunk = world.getChunk(xi, zi);
    short meta = 0;
    try {
        meta = chunk.getMeta(xi & (world.getChunkSize() - 1), yi, zi & (world.getChunkSize() - 1));
    } catch (CoordinatesOutOfBoundsException e) {
        e.printStackTrace();
    }
    super.renderNorth(atlasIndex, x1, y1, x2, y1 + getHeight(meta), z, lightLevel, pcld, builder);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:16,代码来源:MetadataHeightRenderer.java


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