Example #1
0
 public void AddObjMesh(string name, ObjMesh mesh)
 {
     if (CacheMeshDict.ContainsKey(name))
     {
         CacheMeshDict[name] = mesh;
     }
     else
     {
         CacheMeshDict.Add(name, mesh);
     }
 }
Example #2
0
        void ReadFiles(object objPath)
        {
            ReadFileCore(FileType.OBJ, (string)objPath);
            string objtext = System.Text.Encoding.Default.GetString(FileDict[FileType.OBJ]);

            objInstace = Nxr.Internal.NxrSDKApi.Instance.GetObjMesh((string)objPath);
            if (objInstace == null)
            {
                objInstace = new ObjMesh();
                objInstace = objInstace.LoadFromObj(objtext);
                Nxr.Internal.NxrSDKApi.Instance.AddObjMesh((string)objPath, objInstace);
                Debug.Log("Create ObjMesh : " + (string)objPath);
            }
            else
            {
                Debug.Log("Use Cache ObjMesh : " + (string)objPath);
            }

            FileDict[FileType.OBJ] = null;
            ReadFileCore(FileType.MTL, ((string)objPath).Replace("obj", "mtl"));
            ReadFileCore(FileType.PNG, ((string)objPath).Replace("obj", "png"));
        }