diff --git a/GlitchyEditor/src/Assets/Importers/DdsImporter.bf b/GlitchyEditor/src/Assets/Importers/DdsImporter.bf index ec7716e..53efeed 100644 --- a/GlitchyEditor/src/Assets/Importers/DdsImporter.bf +++ b/GlitchyEditor/src/Assets/Importers/DdsImporter.bf @@ -728,6 +728,11 @@ static class DdsImporter { height = 1; } + + if (depth == 0) + { + depth = 1; + } offset += numBytes; } diff --git a/GlitchyEditor/src/Assets/Importers/TextureImporter.bf b/GlitchyEditor/src/Assets/Importers/TextureImporter.bf index 9973585..d3bb422 100644 --- a/GlitchyEditor/src/Assets/Importers/TextureImporter.bf +++ b/GlitchyEditor/src/Assets/Importers/TextureImporter.bf @@ -359,14 +359,18 @@ class ProcessedTexture : ProcessedResource public void SetSurfaceCount(int arraySize, int mipMapCount) { + ArraySize = arraySize; + + if (IsCubeMap) + ArraySize *= 6; + Log.EngineLogger.AssertDebug(Surfaces == null || arraySize > Surfaces.GetLength(0)); Log.EngineLogger.AssertDebug(Surfaces == null ||mipMapCount > Surfaces.GetLength(1)); - ArraySize = arraySize; MipMapCount = mipMapCount; TextureSurface[,] oldSurfaces = Surfaces; - Surfaces = new TextureSurface[arraySize, mipMapCount]; + Surfaces = new TextureSurface[ArraySize, MipMapCount]; if (oldSurfaces != null) { @@ -415,7 +419,8 @@ class TextureProcessor : IAssetProcessor { ProcessedTexture.TextureSurface surface = new .(loadedSurface.Width, loadedSurface.Height, loadedSurface.Depth, loadedSurface.Data, loadedSurface.MipLevel, loadedSurface.ArrayIndex, loadedSurface.Pitch, loadedSurface.SlicePitch); - processedTexture.Surfaces[loadedSurface.ArrayIndex, loadedSurface.MipLevel] = surface; + + processedTexture.Surfaces[loadedSurface.ArrayIndex * (processedTexture.IsCubeMap ? 6 : 1) + loadedSurface.CubeFace, loadedSurface.MipLevel] = surface; } if (!(config.GenerateMipMaps case .No))