Browse Source

场景obj模型转换为b3dm

lyhzzz 1 năm trước cách đây
mục cha
commit
0fdbefa54b

+ 9 - 9
src/main/java/com/fdkankan/fusion/common/util/OBJToGLBUtil.java

@@ -36,24 +36,24 @@ public class OBJToGLBUtil {
     }
 
     public static String objToB3dm(String objPath, String glbPath)  {
-        log.info("obj转换glb开始,{}",objPath);
+        log.info("obj转换b3dm开始,{}",objPath);
         if(!checkObj(objPath)){
             throw new BusinessException(-1,"obj文件错误");
         }
-        log.info("obj转换glb开始");
-        String command = "obj2gltf -i " + objPath + " -o " + glbPath;
+        log.info("obj转换b3dm开始");
+        String command = "Obj2Tiles  " + objPath + " ./" + glbPath;
         log.info("执行obj转换glb命令路径-{}", command);
         ShellUtil.execCmd(command);
-        log.info("obj转换glb完毕:" + command);
+        log.info("obj转换b3dm完毕:" + command);
         return glbPath;
     }
     public static void objToB3dm2(String objPath,String glbPath)  {
-        log.info("obj转换glb开始,{}",objPath);
-        log.info("obj转换glb开始");
-        String command = "obj2gltf -i " + objPath + " -o " + glbPath;
-        log.info("执行obj转换glb命令路径-{}", command);
+        log.info("obj转换b3dm开始,{}",objPath);
+        log.info("obj转换b3dm开始");
+        String command = "Obj2Tiles  " + objPath + " ./" + glbPath;
+        log.info("执行obj转换b3dm命令路径-{}", command);
         ShellUtil.execCmd(command);
-        log.info("obj转换glb完毕:" + command);
+        log.info("obj转换b3dm完毕:" + command);
     }
 
     public static boolean checkObj(String objPath) {

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/CaseNumServiceImpl.java

@@ -158,7 +158,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                 toGlB(file,localGlbPath);
             }
             if(file.getName().contains(".obj")){
-               String glbPath =  OBJToGLBUtil.objToGlb(file.getPath(),file.getPath().replace(".obj",".glb") );
+               String glbPath =  OBJToGLBUtil.objToB3dm(file.getPath(),file.getPath().replace(".obj",".glb") );
                localGlbPath.add(glbPath);
             }
         }

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/ThreadService.java

@@ -83,7 +83,7 @@ public class ThreadService {
                 glbOssPath = glbOssPath.replace("mesh.glb",file1.getName().replace(".obj",".glb"));
                 model.setModelDateType("obj");
                 model.setModelType("glb");
-                OBJToGLBUtil.objToGlb2(file1.getPath(), file1.getPath().replace(".obj",".glb"));
+                OBJToGLBUtil.objToB3dm2(file1.getPath(), file1.getPath().replace(".obj",".glb"));
                 redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"65");
                 uploadToOssUtil.uploadOss(file1.getPath().replace(".obj",".glb"),glbOssPath);
                 if(!uploadToOssUtil.existKey(glbOssPath)){