Example usage for com.badlogic.gdx.graphics.g3d.utils MeshPartBuilder setUVRange

List of usage examples for com.badlogic.gdx.graphics.g3d.utils MeshPartBuilder setUVRange

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.utils MeshPartBuilder setUVRange.

Prototype

public void setUVRange(float u1, float v1, float u2, float v2);

Source Link

Document

Set range of texture coordinates used (default is 0,0,1,1).

Usage

From source file:com.mygdx.game.utilities.ModelFactory.java

License:Apache License

public static Model buildPlaneModel(final float width, final float height, final Material material,
        final float u1, final float v1, final float u2, final float v2) {

    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();//from   w  w  w.  j a  va2s . co m
    MeshPartBuilder bPartBuilder = modelBuilder.part("rect", GL20.GL_TRIANGLES, VertexAttributes.Usage.Position
            | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates, material);
    bPartBuilder.setUVRange(u1, v1, u2, v2);
    bPartBuilder.rect(-(width * 0.5f), -(height * 0.5f), 0, (width * 0.5f), -(height * 0.5f), 0, (width * 0.5f),
            (height * 0.5f), 0, -(width * 0.5f), (height * 0.5f), 0, 0, 0, -1);

    return (modelBuilder.end());
}