本文整理了Java中org.lwjglb.engine.Utils.listIntToArray()
方法的一些代码示例,展示了Utils.listIntToArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.listIntToArray()
方法的具体详情如下:
包路径:org.lwjglb.engine.Utils
类名称:Utils
方法名:listIntToArray
暂无
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh reorderLists(List<Vector3f> posList, List<Vector2f> textCoordList,
List<Vector3f> normList, List<Face> facesList, int instances) {
List<Integer> indices = new ArrayList();
// Create position array in the order it has been declared
float[] posArr = new float[posList.size() * 3];
int i = 0;
for (Vector3f pos : posList) {
posArr[i * 3] = pos.x;
posArr[i * 3 + 1] = pos.y;
posArr[i * 3 + 2] = pos.z;
i++;
}
float[] textCoordArr = new float[posList.size() * 2];
float[] normArr = new float[posList.size() * 3];
for (Face face : facesList) {
IdxGroup[] faceVertexIndices = face.getFaceVertexIndices();
for (IdxGroup indValue : faceVertexIndices) {
processFaceVertex(indValue, textCoordList, normList,
indices, textCoordArr, normArr);
}
}
int[] indicesArr = Utils.listIntToArray(indices);
Mesh mesh;
if (instances > 1) {
mesh = new InstancedMesh(posArr, textCoordArr, normArr, indicesArr, instances);
} else {
mesh = new Mesh(posArr, textCoordArr, normArr, indicesArr);
}
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh processMesh(AIMesh aiMesh, List<Material> materials, List<Bone> boneList) {
List<Float> vertices = new ArrayList<>();
List<Float> textures = new ArrayList<>();
List<Float> normals = new ArrayList<>();
List<Integer> indices = new ArrayList<>();
List<Integer> boneIds = new ArrayList<>();
List<Float> weights = new ArrayList<>();
processVertices(aiMesh, vertices);
processNormals(aiMesh, normals);
processTextCoords(aiMesh, textures);
processIndices(aiMesh, indices);
processBones(aiMesh, boneList, boneIds, weights);
Mesh mesh = new Mesh(Utils.listToArray(vertices), Utils.listToArray(textures),
Utils.listToArray(normals), Utils.listIntToArray(indices),
Utils.listIntToArray(boneIds), Utils.listToArray(weights));
Material material;
int materialIdx = aiMesh.mMaterialIndex();
if (materialIdx >= 0 && materialIdx < materials.size()) {
material = materials.get(materialIdx);
} else {
material = new Material();
}
mesh.setMaterial(material);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh processMesh(AIMesh aiMesh, List<Material> materials, List<Bone> boneList) {
List<Float> vertices = new ArrayList<>();
List<Float> textures = new ArrayList<>();
List<Float> normals = new ArrayList<>();
List<Integer> indices = new ArrayList<>();
List<Integer> boneIds = new ArrayList<>();
List<Float> weights = new ArrayList<>();
processVertices(aiMesh, vertices);
processNormals(aiMesh, normals);
processTextCoords(aiMesh, textures);
processIndices(aiMesh, indices);
processBones(aiMesh, boneList, boneIds, weights);
Mesh mesh = new Mesh(Utils.listToArray(vertices), Utils.listToArray(textures),
Utils.listToArray(normals), Utils.listIntToArray(indices),
Utils.listIntToArray(boneIds), Utils.listToArray(weights));
Material material;
int materialIdx = aiMesh.mMaterialIndex();
if (materialIdx >= 0 && materialIdx < materials.size()) {
material = materials.get(materialIdx);
} else {
material = new Material();
}
mesh.setMaterial(material);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh processMesh(AIMesh aiMesh, List<Material> materials) {
List<Float> vertices = new ArrayList<>();
List<Float> textures = new ArrayList<>();
List<Float> normals = new ArrayList<>();
List<Integer> indices = new ArrayList();
processVertices(aiMesh, vertices);
processNormals(aiMesh, normals);
processTextCoords(aiMesh, textures);
processIndices(aiMesh, indices);
Mesh mesh = new Mesh(Utils.listToArray(vertices), Utils.listToArray(textures),
Utils.listToArray(normals), Utils.listIntToArray(indices));
Material material;
int materialIdx = aiMesh.mMaterialIndex();
if (materialIdx >= 0 && materialIdx < materials.size()) {
material = materials.get(materialIdx);
} else {
material = new Material();
}
mesh.setMaterial(material);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh processMesh(AIMesh aiMesh, List<Material> materials) {
List<Float> vertices = new ArrayList<>();
List<Float> textures = new ArrayList<>();
List<Float> normals = new ArrayList<>();
List<Integer> indices = new ArrayList();
processVertices(aiMesh, vertices);
processNormals(aiMesh, normals);
processTextCoords(aiMesh, textures);
processIndices(aiMesh, indices);
Mesh mesh = new Mesh(Utils.listToArray(vertices), Utils.listToArray(textures),
Utils.listToArray(normals), Utils.listIntToArray(indices));
Material material;
int materialIdx = aiMesh.mMaterialIndex();
if (materialIdx >= 0 && materialIdx < materials.size()) {
material = materials.get(materialIdx);
} else {
material = new Material();
}
mesh.setMaterial(material);
return mesh;
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private static Mesh processMesh(AIMesh aiMesh, List<Material> materials) {
List<Float> vertices = new ArrayList<>();
List<Float> textures = new ArrayList<>();
List<Float> normals = new ArrayList<>();
List<Integer> indices = new ArrayList();
processVertices(aiMesh, vertices);
processNormals(aiMesh, normals);
processTextCoords(aiMesh, textures);
processIndices(aiMesh, indices);
Mesh mesh = new Mesh(Utils.listToArray(vertices),
Utils.listToArray(textures),
Utils.listToArray(normals),
Utils.listIntToArray(indices)
);
Material material;
int materialIdx = aiMesh.mMaterialIndex();
if (materialIdx >= 0 && materialIdx < materials.size()) {
material = materials.get(materialIdx);
} else {
material = new Material();
}
mesh.setMaterial(material);
return mesh;
}
内容来源于网络,如有侵权,请联系作者删除!