本文整理汇总了Java中com.badlogic.gdx.graphics.VertexAttribute.ColorPacked方法的典型用法代码示例。如果您正苦于以下问题:Java VertexAttribute.ColorPacked方法的具体用法?Java VertexAttribute.ColorPacked怎么用?Java VertexAttribute.ColorPacked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.VertexAttribute
的用法示例。
在下文中一共展示了VertexAttribute.ColorPacked方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeMesh
import com.badlogic.gdx.graphics.VertexAttribute; //导入方法依赖的package包/类
public void makeMesh() {
int rayon = Math.max(ExterminateGame.rendu, ExterminateGame.MAX_VIEW_DISTANCE)+5;
int nbTriangles=ChunkBuilder.GRIDSIZE*ChunkBuilder.GRIDSIZE*2*rayon*2*rayon*2;
int nbVertex=(ChunkBuilder.GRIDSIZE+1)*(ChunkBuilder.GRIDSIZE+1)*rayon*2*rayon*2;
FloatBuffer vertexL = org.lwjgl.BufferUtils.createFloatBuffer(nbVertex*ChunkBuilder.SOL_VERTICE_SIZE);
IntBuffer indicesL = org.lwjgl.BufferUtils.createIntBuffer(nbTriangles*3);
mesh = new UniMesh(true, true, nbVertex, nbTriangles*3, new VertexAttributes(VertexAttribute.Position(), VertexAttribute.NormalPacked(), VertexAttribute.TexCoords(0), VertexAttribute.ColorPacked()));
mesh.setVertices(vertexL, 0, nbVertex*ChunkBuilder.SOL_VERTICE_SIZE);
mesh.setIndices(indicesL, 0, nbTriangles*3);
mesh.setCapacity(0);
usedSol = new boolean[rayon*2*rayon*2];
forChunk = new Chunk[rayon*2*rayon*2];
for(int i=0;i<rayon*2*rayon*2;i++) {
usedSol[i] = false;
}
UniVertexBufferObject.showMem();
}
示例2: buildMeshes
import com.badlogic.gdx.graphics.VertexAttribute; //导入方法依赖的package包/类
public static void buildMeshes() {
if (indices == null) {
int len = 3 * 6 * 6 / 3;
indices = new short[len];
short j = 0;
for (int i = 0; i < len; i += 6, j += 4) {
indices[i + 0] = (short) (j + 0);
indices[i + 1] = (short) (j + 1);
indices[i + 2] = (short) (j + 2);
indices[i + 3] = (short) (j + 2);
indices[i + 4] = (short) (j + 3);
indices[i + 5] = (short) (j + 0);
}
}
for (Voxel v : voxels.values()) {
v.mesh = new Mesh(true, 24, indices.length, VertexAttribute.Position(), VertexAttribute.Normal(), VertexAttribute.ColorPacked(), VertexAttribute.TexCoords(0), VertexAttribute.TexCoords(1));
v.mesh.setIndices(indices);
verts = new FloatArray();
for (Direction d : Direction.values())
new TextureFace(d, new Vector3(), v.getTextureUV(0, 0, 0, d)).getVertexData(verts);
v.mesh.setVertices(verts.items, 0, verts.size);
}
}
示例3: load
import com.badlogic.gdx.graphics.VertexAttribute; //导入方法依赖的package包/类
public void load() {
if (indices == null) {
int len = SIZE * SIZE * SIZE * 6 * 6 / 3;
indices = new short[len];
short j = 0;
for (int i = 0; i < len; i += 6, j += 4) {
indices[i + 0] = (short) (j + 0);
indices[i + 1] = (short) (j + 1);
indices[i + 2] = (short) (j + 2);
indices[i + 3] = (short) (j + 2);
indices[i + 4] = (short) (j + 3);
indices[i + 5] = (short) (j + 0);
}
}
opaque = new Mesh(true, SIZE * SIZE * SIZE * 6 * 4, SIZE * SIZE * SIZE * 36 / 3, VertexAttribute.Position(), VertexAttribute.Normal(), VertexAttribute.ColorPacked(), VertexAttribute.TexCoords(0), VertexAttribute.TexCoords(1) /*
* how
* many
* faces
* together
* ?
*/);
opaque.setIndices(indices);
transp = new Mesh(true, SIZE * SIZE * SIZE * 6 * 4, SIZE * SIZE * SIZE * 36 / 3, VertexAttribute.Position(), VertexAttribute.Normal(), VertexAttribute.ColorPacked(), VertexAttribute.TexCoords(0), VertexAttribute.TexCoords(1) /*
* how
* many
* faces
* together
* ?
*/);
transp.setIndices(indices);
opaqueMeshData = new FloatArray();
transpMeshData = new FloatArray();
loaded = true;
onceLoaded = true;
drawn = false;
}
示例4: buildModelEau
import com.badlogic.gdx.graphics.VertexAttribute; //导入方法依赖的package包/类
public Mesh buildModelEau() {
makeModelEau();
if (true)
return null;
float hauteurEau = IslandManager.hauteurEau();
hasEau = false;
int wc = GRIDSIZE + 1;
nbVertexL = (GRIDSIZE + 1) * (GRIDSIZE + 1);
nbTrianglesL = GRIDSIZE * GRIDSIZE * 2;
vertexL.clear();
for (int j = 0; j < GRIDSIZE + 1; j++) {
for (int i = 0; i < GRIDSIZE + 1; i++) {
vertexL.put(((i)) + posX);
vertexL.put(hauteurEau);
vertexL.put(((j)) + posZ);
vertexL.put(0);
vertexL.put(1);
vertexL.put(0);
vertexL.put(((i + posX)) / 16f / 4f);
vertexL.put(((j + posZ)) / 16f / 4f);
vertexL.put((float) Math.exp(-Math.max(0f, hauteurEau
- heightmap[i * Chunk.GRIDSIZE1 + j]) * 0.1f));
vertexL.put(0);
vertexL.put(0);
vertexL.put(1);
}
}
indicesL.clear();
int k = 0;
for (int i = 0; i < wc - 1; i++) {
for (int j = 0; j < wc - 1; j++) {
if (heightmap[i * Chunk.GRIDSIZE1 + j] < hauteurEau
|| heightmap[(i + 1) * Chunk.GRIDSIZE1 + j] < hauteurEau
|| heightmap[i * Chunk.GRIDSIZE1 + j + 1] < hauteurEau
|| heightmap[(i + 1) * Chunk.GRIDSIZE1 + j + 1] < hauteurEau) {
indicesL.put((short) (i + 1 + j * wc));
indicesL.put((short) (i + j * wc));
indicesL.put((short) (i + (j + 1) * wc));
k += 3;
indicesL.put((short) (i + 1 + (j + 1) * wc));
indicesL.put((short) (i + 1 + j * wc));
indicesL.put((short) (i + (j + 1) * wc));
k += 3;
hasEau = true;
}
}
}
nbTrianglesL = k / 3;
if (hasEau) {
UniMesh mesh = new UniMesh(true, true, nbVertexL, nbTrianglesL * 3,
new VertexAttributes(VertexAttribute.Position(),
VertexAttribute.NormalPacked(),
VertexAttribute.TexCoordsPacked(0),
VertexAttribute.ColorPacked()));
mesh.setVertices(vertexL, 0, nbVertexL * SOL_VERTICE_SIZE);
mesh.setIndices(indicesL, 0, nbTrianglesL * 3);
return mesh;
} else {
return null;
}
}
示例5: genCube
import com.badlogic.gdx.graphics.VertexAttribute; //导入方法依赖的package包/类
public static Mesh genCube(float size, float texX, float texY, float texSize) {
Mesh mesh = new Mesh(true, 24, 36, VertexAttribute.Position(), VertexAttribute.Normal(), VertexAttribute.ColorPacked(), VertexAttribute.TexCoords(0), VertexAttribute.TexCoords(1) /*
* how
* many
* faces
* together
* ?
*/);
float[] cubeVerts = { 0, 0, 0, 0, 0, size, size, 0, size, size, 0, 0, 0, size, 0, 0, size, size, size, size, size, size, size, 0, 0, 0, 0, 0, size, 0, size, size, 0, size, 0, 0, 0, 0, size, 0, size, size, size, size, size, size, 0, size, 0, 0, 0, 0, 0, size, 0, size, size, 0, size, 0, size, 0, 0, size, 0, size, size, size, size, size, size, 0, };
float[] cubeNormals = { 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, };
float[] cubeTex = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, };
float b = Color.toFloatBits(1f, 1f, 1f, 1f);
float[] vertices = new float[24 * 11];
int pIdx = 0;
int nIdx = 0;
int tIdx = 0;
for (int i = 0; i < vertices.length;) {
vertices[i++] = cubeVerts[pIdx++];
vertices[i++] = cubeVerts[pIdx++];
vertices[i++] = cubeVerts[pIdx++];
vertices[i++] = cubeNormals[nIdx++];
vertices[i++] = cubeNormals[nIdx++];
vertices[i++] = cubeNormals[nIdx++];
vertices[i++] = b;
vertices[i++] = cubeTex[tIdx++] * texSize + texX;
vertices[i++] = cubeTex[tIdx++] * texSize + texY;
vertices[i++] = 1;
vertices[i++] = 1;
}
short[] indices = { 0, 2, 1, 0, 3, 2, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 15, 14, 12, 14, 13, 16, 17, 18, 16, 18, 19, 20, 23, 22, 20, 22, 21 };
mesh.setVertices(vertices);
mesh.setIndices(indices);
return mesh;
}