Skip to content

Commit

Permalink
Various updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jun 12, 2024
1 parent 45461b6 commit d7c3216
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "buildscripts"]
path = buildscripts
url = https://github.com/MonoGame/MonoGame.Library.BuildScripts.git
[submodule "basis_universal"]
path = basis_universal
url = https://github.com/BinomialLLC/basis_universal.git
[submodule "buildscripts"]
path = buildscripts
url = https://github.com/MonoGame/MonoGame.Tool.BuildScripts.git
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
# MonoGame.Tool.BasisUniversal
MonoGame tooling build for basis_universal

This tool can be used to compress an image into various texture compression
formats. Examples are BC1-7, PVRTC, ETC1, ETC2, ASTC and ATC.

To use we must first create a "basis" file, this is an intermediate file containing
the image data. From this file ALL over texture formats can be created. It is probably
worth caching this "basis" file between builds.

```dotnetcli
basisu -file foo.png -ktx2
```

Adding a `-uastc` might give better results for some compression types.

Once you have the "basis" file you can then transform that into specific formats
by using the `-unpack` command. PRoviding the `-format_only` flag will produce
ONLY that format. Omitting this flag will result in ALL supported formats being
produced.

```dotnetcli
basisu -unpack foo.ktx2 -no_ktx -linear -format_only 2
```

The output file(s) are listed in the output. There may be many output files. They will be stored in a .png files, but the internal image data will be compressed. We can use libraries like StbImageSharp to read the .png data.

```csharp
using (var fs = File.OpenRead(filename))
{
ImageResult result = ImageResult.FromStream(fs, StbImageSharp.ColorComponents.Default);
return result.Data;
}
```

If mipmap's are enabled, you will get one .png per mipmap level.
2 changes: 0 additions & 2 deletions build/BuildMacOSTask.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Runtime.InteropServices;

namespace BuildScripts;

[TaskName("Build macOS")]
Expand Down
2 changes: 1 addition & 1 deletion buildscripts

0 comments on commit d7c3216

Please sign in to comment.