/**
* 3ds文件的处理,获取3ds文件中的顶点数及面数
* @param filePath
* @return
* @throws CommException
* @throws IOException
*/
@SuppressWarnings("unused")
public List<String> dsFileHandle(String filePath) throws CommException,
IOException {
List<String> dataArr = new ArrayList<String>();
//判断所读取的文件是否是3ds文件
String[] subfileName = filePath.split("/");
String fileFormat = subfileName[1]
.substring(0, subfileName[1].length());
if (PicOperate.getExtendName(fileFormat).equals("3ds")) {
FileInputStream fis = new FileInputStream(filePath);
FileChannel fc = fis.getChannel();
ByteBuffer bb = ByteBuffer.allocate((int) fc.size());
bb = bb.order(ByteOrder.LITTLE_ENDIAN);
bb.clear();
fc.read(bb);
bb.flip();
int numOfTrimesh = 0;
int VerCount = 0;
int faceCount = 0;
while (bb.hasRemaining()) {
int id = bb.getShort() & 0xffff;
int length = bb.getInt();
switch (id) {
case 0x4d4d:
// ---------------文件的头部---------------//
break;
case 0x3d3d:
// ---------------编辑块头部----
3DS文件解析(JAVA版)
最新推荐文章于 2021-02-22 10:28:59 发布