本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.IndexBufferObject类的典型用法代码示例。如果您正苦于以下问题:Java IndexBufferObject类的具体用法?Java IndexBufferObject怎么用?Java IndexBufferObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IndexBufferObject类属于com.badlogic.gdx.graphics.glutils包,在下文中一共展示了IndexBufferObject类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformClass
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
@Override
public void transformClass(ClassHolder cls, ClassReaderSource innerSource, Diagnostics diagnostics) {
if (cls.getName().equals(BufferUtils.class.getName())) {
transformBufferUtils(cls, innerSource);
} else if (cls.getName().equals(TextureData.Factory.class.getName())) {
transformTextureData(cls, innerSource);
} else if (cls.getName().equals(FileHandle.class.getName())) {
transformFileHandle(cls);
} else if (cls.getName().equals(Pixmap.class.getName())) {
replaceClass(cls, innerSource.get(PixmapEmulator.class.getName()));
} else if (cls.getName().equals(Matrix4.class.getName())) {
transformMatrix(cls, innerSource);
} else if (cls.getName().equals(VertexArray.class.getName()) ||
cls.getName().equals(VertexBufferObject.class.getName())) {
replaceClass(cls, innerSource.get(VertexArrayEmulator.class.getName()));
} else if (cls.getName().equals(IndexArray.class.getName()) ||
cls.getName().equals(IndexBufferObject.class.getName())) {
replaceClass(cls, innerSource.get(IndexArrayEmulator.class.getName()));
}
}
示例2: create
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
@Override
public void create () {
String vertexShader = "attribute vec4 a_position; \n" + "attribute vec4 a_color;\n" + "attribute vec2 a_texCoords;\n"
+ "varying vec4 v_color;" + "varying vec2 v_texCoords;" + "void main() \n"
+ "{ \n" + " v_color = vec4(a_color.x, a_color.y, a_color.z, 1); \n"
+ " v_texCoords = a_texCoords; \n" + " gl_Position = a_position; \n" + "} \n";
String fragmentShader = "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n" + "varying vec4 v_color;\n"
+ "varying vec2 v_texCoords;\n" + "uniform sampler2D u_texture;\n" + "void main() \n"
+ "{ \n" + " gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n"
+ "}";
shader = new ShaderProgram(vertexShader, fragmentShader);
vbo = new VertexBufferObject(true, 3, new VertexAttribute(VertexAttributes.Usage.Position, 2, "a_position"),
new VertexAttribute(VertexAttributes.Usage.TextureCoordinates, 2, "a_texCoords"), new VertexAttribute(
VertexAttributes.Usage.ColorPacked, 4, "a_color"));
float[] vertices = new float[] {-1, -1, 0, 0, Color.toFloatBits(1f, 0f, 0f, 1f), 0, 1, 0.5f, 1.0f,
Color.toFloatBits(0f, 1f, 0f, 1f), 1, -1, 1, 0, Color.toFloatBits(0f, 0f, 1f, 1f)};
vbo.setVertices(vertices, 0, vertices.length);
ibo = new IndexBufferObject(true, 3);
ibo.setIndices(new short[] {0, 1, 2}, 0, 3);
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
}
示例3: createIndexBuffer
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
private static IndexBufferObject createIndexBuffer(int paramInt)
{
short[] arrayOfShort = new short[paramInt];
int i = 0;
for (int j = 0; i < paramInt; j = (short)(j + 4))
{
arrayOfShort[(i + 0)] = ((short)(j + 0));
arrayOfShort[(i + 1)] = ((short)(j + 1));
arrayOfShort[(i + 2)] = ((short)(j + 2));
arrayOfShort[(i + 3)] = ((short)(j + 2));
arrayOfShort[(i + 4)] = ((short)(j + 3));
arrayOfShort[(i + 5)] = ((short)(j + 0));
i += 6;
}
IndexBufferObject localIndexBufferObject = new IndexBufferObject(true, paramInt);
localIndexBufferObject.setIndices(arrayOfShort, 0, paramInt);
return localIndexBufferObject;
}
示例4: Mesh
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
public Mesh(Mesh.VertexDataType paramVertexDataType, boolean paramBoolean, int paramInt1, int paramInt2, VertexAttribute[] paramArrayOfVertexAttribute)
{
if (paramVertexDataType == Mesh.VertexDataType.VertexBufferObject)
{
this.vertices = new VertexBufferObject(paramBoolean, paramInt1, paramArrayOfVertexAttribute);
this.indices = new IndexBufferObject(paramBoolean, paramInt2);
this.isVertexArray = false;
}
while (true)
{
addManagedMesh(Gdx.app, this);
return;
if (paramVertexDataType == Mesh.VertexDataType.VertexBufferObjectSubData)
{
this.vertices = new VertexBufferObjectSubData(paramBoolean, paramInt1, paramArrayOfVertexAttribute);
this.indices = new IndexBufferObjectSubData(paramBoolean, paramInt2);
this.isVertexArray = false;
}
else
{
this.vertices = new VertexArray(paramInt1, paramArrayOfVertexAttribute);
this.indices = new IndexArray(paramInt2);
this.isVertexArray = true;
}
}
}
示例5: a
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
private void a(int paramInt, boolean paramBoolean)
{
if (paramInt <= 65536);
for (boolean bool = true; ; bool = false)
{
an.a(bool, "Suspiciously large # of indices");
if (this.g < paramInt)
{
short[] arrayOfShort = this.d;
this.g = paramInt;
this.d = new short[paramInt];
this.e = true;
if ((paramBoolean) && (arrayOfShort != null))
System.arraycopy(arrayOfShort, 0, this.d, 0, arrayOfShort.length);
dispose();
this.b = new IndexBufferObject(paramInt);
this.c = new IndexBufferObject(paramInt);
a.add(this);
}
return;
}
}
示例6: Mesh
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
/** Creates a new Mesh with the given attributes.
*
* @param isStatic whether this mesh is static or not. Allows for internal optimizations.
* @param maxVertices the maximum number of vertices this mesh can hold
* @param maxIndices the maximum number of indices this mesh can hold
* @param attributes the {@link VertexAttribute}s. Each vertex attribute defines one property of a vertex such as position,
* normal or texture coordinate */
public Mesh (boolean isStatic, int maxVertices, int maxIndices, VertexAttribute... attributes) {
vertices = new VertexBufferObject(isStatic, maxVertices, attributes);
indices = new IndexBufferObject(isStatic, maxIndices);
isVertexArray = false;
addManagedMesh(Gdx.app, this);
}
示例7: create
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
@Override
public void create () {
//@off
String vertexShader =
"attribute vec4 a_position; \n"
+ "attribute vec4 a_color;\n"
+ "attribute vec2 a_texCoords;\n"
+ "varying vec4 v_color;"
+ "varying vec2 v_texCoords;" + "void main() \n"
+ "{ \n"
+ " v_color = vec4(a_color.x, a_color.y, a_color.z, 1); \n"
+ " v_texCoords = a_texCoords; \n"
+ " gl_Position = a_position; \n"
+ "} \n";
String fragmentShader =
"#ifdef GL_ES\n"
+ "precision mediump float;\n"
+ "#endif\n"
+ "varying vec4 v_color;\n"
+ "varying vec2 v_texCoords;\n"
+ "uniform sampler2D u_texture;\n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n"
+ "}";
//@on
shader = new ShaderProgram(vertexShader, fragmentShader);
vbo = new VertexBufferObject(true, 3, new VertexAttribute(VertexAttributes.Usage.Position, 2, "a_position"),
new VertexAttribute(VertexAttributes.Usage.TextureCoordinates, 2, "a_texCoords"), new VertexAttribute(
VertexAttributes.Usage.ColorPacked, 4, "a_color"));
float[] vertices = new float[] {-1, -1, 0, 0, Color.toFloatBits(1f, 0f, 0f, 1f), 0, 1, 0.5f, 1.0f,
Color.toFloatBits(0f, 1f, 0f, 1f), 1, -1, 1, 0, Color.toFloatBits(0f, 0f, 1f, 1f)};
vbo.setVertices(vertices, 0, vertices.length);
indices = new IndexBufferObject(3);
indices.setIndices(new short[] {0, 1, 2}, 0, 3);
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
}
示例8: am
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
public am(short[] paramArrayOfShort)
{
this.c = paramArrayOfShort.length;
this.b = new IndexBufferObject(true, this.c);
this.b.setIndices(paramArrayOfShort, 0, this.c);
a.add(this);
}
示例9: a
import com.badlogic.gdx.graphics.glutils.IndexBufferObject; //导入依赖的package包/类
private static IndexBufferObject a(short[] paramArrayOfShort)
{
if (paramArrayOfShort == null)
return null;
IndexBufferObject localIndexBufferObject = new IndexBufferObject(paramArrayOfShort.length);
localIndexBufferObject.setIndices(paramArrayOfShort, 0, paramArrayOfShort.length);
return localIndexBufferObject;
}