public void LoadVOXData(byte[] data, bool asIndividualVoxels, byte[] alphaMaskData = null) { ClearVoxMeshes(); MVVoxelChunk alphaMask = null; if (alphaMaskData != null) { MVMainChunk mc = MVImporter.LoadVOXFromData(alphaMaskData, generateFaces: false); if (mc != null) { alphaMask = mc.voxelChunk; } } MVMainChunk v = MVImporter.LoadVOXFromData(data, alphaMask); if (v != null) { Material mat = (this.voxMaterial != null) ? this.voxMaterial : MVImporter.DefaultMaterial; if (!asIndividualVoxels) { MVImporter.CreateVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } else { MVImporter.CreateIndividualVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } this.vox = v; } }
public void LoadVOXData(byte[] data, bool asIndividualVoxels) { ClearVoxMeshes(); MVMainChunk v = MVImporter.LoadVOXFromData(data); if (v != null) { Material mat = (this.voxMaterial != null) ? this.voxMaterial : MVImporter.DefaultMaterial; if (paletteToTex) { mat.mainTexture = v.PaletteToTexture(); } if (!asIndividualVoxels) { MVImporter.CreateVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } else { MVImporter.CreateIndividualVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } this.vox = v; } }
public void LoadVOXFile(string path, string alphaMaskPath, bool asIndividualVoxels) { ClearVoxMeshes(); if (path != null && path.Length > 0) { MVVoxelChunk alphaChunk = null; if (!string.IsNullOrEmpty(alphaMaskPath)) { MVMainChunk mc = MVImporter.LoadVOX(alphaMaskPath, generateFaces: false); if (mc != null) { alphaChunk = mc.voxelChunk; } } MVMainChunk v = MVImporter.LoadVOX(path, alphaChunk); if (v != null) { Material mat = (this.voxMaterial != null) ? this.voxMaterial : MVImporter.DefaultMaterial; if (!asIndividualVoxels) { if (meshOrigin != null) { MVImporter.CreateVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox, meshOrigin.localPosition); } else { MVImporter.CreateVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } } else { if (meshOrigin != null) { MVImporter.CreateIndividualVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox, meshOrigin.localPosition); } else { MVImporter.CreateIndividualVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } } this.vox = v; } } else { Debug.LogError("[MVVoxModel] Invalid file path"); } }
public void LoadVOXFile(string path, bool asIndividualVoxels) { ClearVoxMeshes(); if (path != null && path.Length > 0) { MVMainChunk v = MVImporter.LoadVOX(path); if (v != null) { Material mat = (this.voxMaterial != null) ? this.voxMaterial : MVImporter.DefaultMaterial; if (paletteToTex) { mat.mainTexture = v.PaletteToTexture(); } if (!asIndividualVoxels) { if (meshOrigin != null) { MVImporter.CreateVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox, meshOrigin.localPosition); } else { MVImporter.CreateVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } } else { if (meshOrigin != null) { MVImporter.CreateIndividualVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox, meshOrigin.localPosition); } else { MVImporter.CreateIndividualVoxelGameObjects(v, this.gameObject.transform, mat, sizePerVox); } } this.vox = v; } } else { Debug.LogError("[MVVoxModel] Invalid file path"); } }