VOXCONVERT: removed --src-palette
parent
c1120a7510
commit
c11729a505
|
@ -25,7 +25,7 @@ Dump the scene graph of the input file.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\--export-palette\fR
|
\fB\--export-palette\fR
|
||||||
Export the used palette data into an image. Use in combination with --src-palette.
|
Export the used palette data into an image.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\--export-layers\fR
|
\fB\--export-layers\fR
|
||||||
|
@ -110,10 +110,6 @@ Apply the given lua script to the output volume.
|
||||||
\fB\--split <x:y:z>\fR
|
\fB\--split <x:y:z>\fR
|
||||||
Slices the volumes into pieces of the given size
|
Slices the volumes into pieces of the given size
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\--src-palette|-p\fR
|
|
||||||
Keep the source palette and don't perform quantization.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\--translate|-t <x:y:z>\fR
|
\fB\--translate|-t <x:y:z>\fR
|
||||||
Translate the volumes by x (right), y (up), z (back).
|
Translate the volumes by x (right), y (up), z (back).
|
||||||
|
@ -286,7 +282,7 @@ The scripting docs are available at https://mgerhardy.github.io/vengi/LUAScript/
|
||||||
.SS Extract palette png
|
.SS Extract palette png
|
||||||
Saves the png in the same dir as the vox file:
|
Saves the png in the same dir as the vox file:
|
||||||
|
|
||||||
\fB@NAME@ --src-palette --export-palette --input infile.vox --output outfile.vox\fP
|
\fB@NAME@ --export-palette --input infile.vox --output outfile.vox\fP
|
||||||
|
|
||||||
There will be an \fBinfile.png\fP now.
|
There will be an \fBinfile.png\fP now.
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ vengi (0.0.20.0-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* VoxConvert:
|
* VoxConvert:
|
||||||
* Extended --dump to also show the key frames and the voxel count
|
* Extended --dump to also show the key frames and the voxel count
|
||||||
|
* Removed --src-palette (src palette is always used)
|
||||||
|
|
||||||
-- Martin Gerhardy <martin.gerhardy@gmail.com> Sun, 27 Mar 2022 11:59:01 +0200
|
-- Martin Gerhardy <martin.gerhardy@gmail.com> Sun, 27 Mar 2022 11:59:01 +0200
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ VoxEdit:
|
||||||
VoxConvert:
|
VoxConvert:
|
||||||
|
|
||||||
- Extended `--dump` to also show the key frames and the voxel count
|
- Extended `--dump` to also show the key frames and the voxel count
|
||||||
|
- Removed `--src-palette` (src palette is always used)
|
||||||
|
|
||||||
## 0.0.19 (2022-03-27)
|
## 0.0.19 (2022-03-27)
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ See the [scripting](../LUAScript.md) documentation for further details.
|
||||||
|
|
||||||
Saves the png in the same dir as the vox file:
|
Saves the png in the same dir as the vox file:
|
||||||
|
|
||||||
`./vengi-voxconvert --src-palette --export-palette --input infile.vox --output outfile.vox`
|
`./vengi-voxconvert --export-palette --input infile.vox --output outfile.vox`
|
||||||
|
|
||||||
There will be an `infile.png` now.
|
There will be an `infile.png` now.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
* `--crop`: reduces the volume sizes to their voxel boundaries.
|
* `--crop`: reduces the volume sizes to their voxel boundaries.
|
||||||
* `--export-layers`: export all the layers of a scene into single files. It is suggested to name the layers properly to get reasonable file names.
|
* `--export-layers`: export all the layers of a scene into single files. It is suggested to name the layers properly to get reasonable file names.
|
||||||
* `--export-palette`: will save the included palette as png next to the source file. Use in combination with `--src-palette`.
|
* `--export-palette`: will save the included palette as png next to the source file.
|
||||||
* `--filter <filter>`: will filter out layers not mentioned in the expression. E.g. `1-2,4` will handle layer 1, 2 and 4. It is the same as `1,2,4`. The first layer is `0`. See the layers note below.
|
* `--filter <filter>`: will filter out layers not mentioned in the expression. E.g. `1-2,4` will handle layer 1, 2 and 4. It is the same as `1,2,4`. The first layer is `0`. See the layers note below.
|
||||||
* `--force`: overwrite existing files
|
* `--force`: overwrite existing files
|
||||||
* `--image-as-heightmap`: import input images as heightmap (default)
|
* `--image-as-heightmap`: import input images as heightmap (default)
|
||||||
|
@ -22,7 +22,6 @@
|
||||||
* `--scale`: perform lod conversion of the input volume (50% scale per call)
|
* `--scale`: perform lod conversion of the input volume (50% scale per call)
|
||||||
* `--script "<script> <args>"`: execute the given script - see [scripting support](../LUAScript.md) for more details
|
* `--script "<script> <args>"`: execute the given script - see [scripting support](../LUAScript.md) for more details
|
||||||
* `--split <x:y:z>`: slices the volumes into pieces of the given size
|
* `--split <x:y:z>`: slices the volumes into pieces of the given size
|
||||||
* `--src-palette`: will use the included [palette](../Palette.md) and doesn't perform any quantization to the default palette
|
|
||||||
* `--translate <x:y:z>`: translates the volumes by x (right), y (up), z (back)
|
* `--translate <x:y:z>`: translates the volumes by x (right), y (up), z (back)
|
||||||
|
|
||||||
Just type `vengi-voxconvert` to get a full list of commands and options.
|
Just type `vengi-voxconvert` to get a full list of commands and options.
|
||||||
|
|
|
@ -51,7 +51,7 @@ app::AppState VoxConvert::onConstruct() {
|
||||||
registerArg("--crop").setDescription("Reduce the volumes to their real voxel sizes");
|
registerArg("--crop").setDescription("Reduce the volumes to their real voxel sizes");
|
||||||
registerArg("--dump").setDescription("Dump the scene graph of the input file");
|
registerArg("--dump").setDescription("Dump the scene graph of the input file");
|
||||||
registerArg("--export-layers").setDescription("Export all the layers of a scene into single files");
|
registerArg("--export-layers").setDescription("Export all the layers of a scene into single files");
|
||||||
registerArg("--export-palette").setDescription("Export the used palette data into an image. Use in combination with --src-palette");
|
registerArg("--export-palette").setDescription("Export the used palette data into an image");
|
||||||
registerArg("--filter").setDescription("Layer filter. For example '1-4,6'");
|
registerArg("--filter").setDescription("Layer filter. For example '1-4,6'");
|
||||||
registerArg("--force").setShort("-f").setDescription("Overwrite existing files");
|
registerArg("--force").setShort("-f").setDescription("Overwrite existing files");
|
||||||
registerArg("--image-as-plane").setDescription("Import given input images as planes");
|
registerArg("--image-as-plane").setDescription("Import given input images as planes");
|
||||||
|
@ -69,7 +69,6 @@ app::AppState VoxConvert::onConstruct() {
|
||||||
registerArg("--scale").setShort("-s").setDescription("Scale layer to 50% of its original size");
|
registerArg("--scale").setShort("-s").setDescription("Scale layer to 50% of its original size");
|
||||||
registerArg("--script").setDefaultValue("script.lua").setDescription("Apply the given lua script to the output volume");
|
registerArg("--script").setDefaultValue("script.lua").setDescription("Apply the given lua script to the output volume");
|
||||||
registerArg("--split").setDescription("Slices the volumes into pieces of the given size <x:y:z>");
|
registerArg("--split").setDescription("Slices the volumes into pieces of the given size <x:y:z>");
|
||||||
registerArg("--src-palette").setShort("-p").setDescription("Keep the source palette and don't perform quantization");
|
|
||||||
registerArg("--translate").setShort("-t").setDescription("Translate the volumes by x (right), y (up), z (back)");
|
registerArg("--translate").setShort("-t").setDescription("Translate the volumes by x (right), y (up), z (back)");
|
||||||
|
|
||||||
_mergeQuads = core::Var::get(cfg::VoxformatMergequads, "true", core::CV_NOPERSIST, "Merge similar quads to optimize the mesh");
|
_mergeQuads = core::Var::get(cfg::VoxformatMergequads, "true", core::CV_NOPERSIST, "Merge similar quads to optimize the mesh");
|
||||||
|
@ -146,39 +145,38 @@ app::AppState VoxConvert::onInit() {
|
||||||
outfile = getArgVal("--output");
|
outfile = getArgVal("--output");
|
||||||
}
|
}
|
||||||
|
|
||||||
_mergeVolumes = hasArg("--merge");
|
_mergeVolumes = hasArg("--merge");
|
||||||
_scaleVolumes = hasArg("--scale");
|
_scaleVolumes = hasArg("--scale");
|
||||||
_mirrorVolumes = hasArg("--mirror");
|
_mirrorVolumes = hasArg("--mirror");
|
||||||
_rotateVolumes = hasArg("--rotate");
|
_rotateVolumes = hasArg("--rotate");
|
||||||
_translateVolumes = hasArg("--translate");
|
_translateVolumes = hasArg("--translate");
|
||||||
_srcPalette = hasArg("--src-palette");
|
_exportPalette = hasArg("--export-palette");
|
||||||
_exportPalette = hasArg("--export-palette");
|
_exportLayers = hasArg("--export-layers");
|
||||||
_exportLayers = hasArg("--export-layers");
|
_changePivot = hasArg("--pivot");
|
||||||
_changePivot = hasArg("--pivot");
|
_cropVolumes = hasArg("--crop");
|
||||||
_cropVolumes = hasArg("--crop");
|
_splitVolumes = hasArg("--split");
|
||||||
_splitVolumes = hasArg("--split");
|
_dumpSceneGraph = hasArg("--dump");
|
||||||
_dumpSceneGraph = hasArg("--dump");
|
_resizeVolumes = hasArg("--resize");
|
||||||
_resizeVolumes = hasArg("--resize");
|
|
||||||
|
|
||||||
Log::info("Options");
|
Log::info("Options");
|
||||||
if (voxelformat::isMeshFormat(outfile)) {
|
if (voxelformat::isMeshFormat(outfile)) {
|
||||||
Log::info("* mergeQuads: - %s", _mergeQuads->strVal().c_str());
|
Log::info("* mergeQuads: - %s", _mergeQuads->strVal().c_str());
|
||||||
Log::info("* reuseVertices: - %s", _reuseVertices->strVal().c_str());
|
Log::info("* reuseVertices: - %s", _reuseVertices->strVal().c_str());
|
||||||
Log::info("* ambientOcclusion: - %s", _ambientOcclusion->strVal().c_str());
|
Log::info("* ambientOcclusion: - %s", _ambientOcclusion->strVal().c_str());
|
||||||
Log::info("* scale: - %s", _scale->strVal().c_str());
|
Log::info("* scale: - %s", _scale->strVal().c_str());
|
||||||
Log::info("* scaleX: - %s", _scaleX->strVal().c_str());
|
Log::info("* scaleX: - %s", _scaleX->strVal().c_str());
|
||||||
Log::info("* scaleY: - %s", _scaleY->strVal().c_str());
|
Log::info("* scaleY: - %s", _scaleY->strVal().c_str());
|
||||||
Log::info("* scaleZ: - %s", _scaleZ->strVal().c_str());
|
Log::info("* scaleZ: - %s", _scaleZ->strVal().c_str());
|
||||||
Log::info("* quads: - %s", _quads->strVal().c_str());
|
Log::info("* quads: - %s", _quads->strVal().c_str());
|
||||||
Log::info("* withColor: - %s", _withColor->strVal().c_str());
|
Log::info("* withColor: - %s", _withColor->strVal().c_str());
|
||||||
Log::info("* withTexCoords: - %s", _withTexCoords->strVal().c_str());
|
Log::info("* withTexCoords: - %s", _withTexCoords->strVal().c_str());
|
||||||
}
|
}
|
||||||
if (!_srcPalette) {
|
if (!_palette->strVal().empty()) {
|
||||||
Log::info("* palette: - %s", _palette->strVal().c_str());
|
Log::info("* palette: - %s", _palette->strVal().c_str());
|
||||||
}
|
}
|
||||||
Log::info("* input files: - %s", infilesstr.c_str());
|
Log::info("* input files: - %s", infilesstr.c_str());
|
||||||
if (!outfile.empty()) {
|
if (!outfile.empty()) {
|
||||||
Log::info("* output files: - %s", outfile.c_str());
|
Log::info("* output files: - %s", outfile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (io::isImage(outfile) && infiles.size() == 1) {
|
if (io::isImage(outfile) && infiles.size() == 1) {
|
||||||
|
@ -198,27 +196,23 @@ app::AppState VoxConvert::onInit() {
|
||||||
core::String scriptParameters;
|
core::String scriptParameters;
|
||||||
if (hasArg("--script")) {
|
if (hasArg("--script")) {
|
||||||
scriptParameters = getArgVal("--script");
|
scriptParameters = getArgVal("--script");
|
||||||
Log::info("* script: - %s", scriptParameters.c_str());
|
Log::info("* script: - %s", scriptParameters.c_str());
|
||||||
}
|
}
|
||||||
Log::info("* dump scene graph: - %s", (_dumpSceneGraph ? "true" : "false"));
|
Log::info("* dump scene graph: - %s", (_dumpSceneGraph ? "true" : "false"));
|
||||||
Log::info("* merge volumes: - %s", (_mergeVolumes ? "true" : "false"));
|
Log::info("* merge volumes: - %s", (_mergeVolumes ? "true" : "false"));
|
||||||
Log::info("* scale volumes: - %s", (_scaleVolumes ? "true" : "false"));
|
Log::info("* scale volumes: - %s", (_scaleVolumes ? "true" : "false"));
|
||||||
Log::info("* crop volumes: - %s", (_cropVolumes ? "true" : "false"));
|
Log::info("* crop volumes: - %s", (_cropVolumes ? "true" : "false"));
|
||||||
Log::info("* split volumes: - %s", (_splitVolumes ? "true" : "false"));
|
Log::info("* split volumes: - %s", (_splitVolumes ? "true" : "false"));
|
||||||
Log::info("* change pivot: - %s", (_changePivot ? "true" : "false"));
|
Log::info("* change pivot: - %s", (_changePivot ? "true" : "false"));
|
||||||
Log::info("* mirror volumes: - %s", (_mirrorVolumes ? "true" : "false"));
|
Log::info("* mirror volumes: - %s", (_mirrorVolumes ? "true" : "false"));
|
||||||
Log::info("* translate volumes: - %s", (_translateVolumes ? "true" : "false"));
|
Log::info("* translate volumes: - %s", (_translateVolumes ? "true" : "false"));
|
||||||
Log::info("* rotate volumes: - %s", (_rotateVolumes ? "true" : "false"));
|
Log::info("* rotate volumes: - %s", (_rotateVolumes ? "true" : "false"));
|
||||||
Log::info("* use source file palette: - %s", (_srcPalette ? "true" : "false"));
|
Log::info("* export palette: - %s", (_exportPalette ? "true" : "false"));
|
||||||
Log::info("* export used palette as image: - %s", (_exportPalette ? "true" : "false"));
|
Log::info("* export layers: - %s", (_exportLayers ? "true" : "false"));
|
||||||
Log::info("* export layers: - %s", (_exportLayers ? "true" : "false"));
|
Log::info("* resize volumes: - %s", (_resizeVolumes ? "true" : "false"));
|
||||||
Log::info("* resize volumes: - %s", (_resizeVolumes ? "true" : "false"));
|
|
||||||
|
|
||||||
if (!_srcPalette) {
|
voxel::Palette palette;
|
||||||
voxel::Palette palette;
|
if (palette.load(_palette->strVal().c_str())) {
|
||||||
if (!palette.load(_palette->strVal().c_str())) {
|
|
||||||
Log::warn("Failed to init material colors");
|
|
||||||
}
|
|
||||||
voxel::initPalette(palette);
|
voxel::initPalette(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,21 +361,6 @@ bool VoxConvert::handleInputFile(const core::String &infile, voxelformat::SceneG
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const bool inputIsImage = inputFile->isAnyOf(io::format::images());
|
const bool inputIsImage = inputFile->isAnyOf(io::format::images());
|
||||||
if (!inputIsImage && _srcPalette) {
|
|
||||||
voxel::Palette palette;
|
|
||||||
io::FileStream palStream(inputFile);
|
|
||||||
Log::info("Load palette from %s", infile.c_str());
|
|
||||||
const size_t numColors = voxelformat::loadPalette(inputFile->name(), palStream, palette);
|
|
||||||
if (numColors == 0) {
|
|
||||||
Log::error("Failed to load palette");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!voxel::initPalette(palette)) {
|
|
||||||
Log::error("Failed to initialize material colors from loaded palette");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inputIsImage) {
|
if (inputIsImage) {
|
||||||
const image::ImagePtr& image = image::loadImage(inputFile, false);
|
const image::ImagePtr& image = image::loadImage(inputFile, false);
|
||||||
if (!image || !image->isLoaded()) {
|
if (!image || !image->isLoaded()) {
|
||||||
|
@ -444,9 +423,6 @@ bool VoxConvert::handleInputFile(const core::String &infile, voxelformat::SceneG
|
||||||
if (_exportPalette) {
|
if (_exportPalette) {
|
||||||
const core::String &paletteFile = core::string::stripExtension(infile) + ".png";
|
const core::String &paletteFile = core::string::stripExtension(infile) + ".png";
|
||||||
sceneGraph.firstPalette().save(paletteFile.c_str());
|
sceneGraph.firstPalette().save(paletteFile.c_str());
|
||||||
if (!_srcPalette) {
|
|
||||||
Log::info(" .. not using the input file palette");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ private:
|
||||||
bool _mirrorVolumes = false;
|
bool _mirrorVolumes = false;
|
||||||
bool _rotateVolumes = false;
|
bool _rotateVolumes = false;
|
||||||
bool _translateVolumes = false;
|
bool _translateVolumes = false;
|
||||||
bool _srcPalette = false;
|
|
||||||
bool _exportPalette = false;
|
bool _exportPalette = false;
|
||||||
bool _exportLayers = false;
|
bool _exportLayers = false;
|
||||||
bool _changePivot = false;
|
bool _changePivot = false;
|
||||||
|
|
Loading…
Reference in New Issue