本文整理匯總了Java中com.badlogic.gdx.graphics.VertexAttribute.NormalPacked方法的典型用法代碼示例。如果您正苦於以下問題:Java VertexAttribute.NormalPacked方法的具體用法?Java VertexAttribute.NormalPacked怎麽用?Java VertexAttribute.NormalPacked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.VertexAttribute
的用法示例。
在下文中一共展示了VertexAttribute.NormalPacked方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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;
}
}