CUDA (Проект)/Описание DDS формата — различия между версиями
Материал из Wiki
ANA (обсуждение | вклад) (Новая страница: «{{CUDA (Проект) TOC}} == Ссылки == * [http://www.gamedev.ru/community/toolcorner/articles/ddsUtil Работа с nVidia DDS Utilities (SDK)] * [htt…») |
ANA (обсуждение | вклад) м (→Формат Glew) |
||
(не показаны 15 промежуточных версий 1 участника) | |||
Строка 3: | Строка 3: | ||
== Ссылки == | == Ссылки == | ||
+ | DDS | ||
* [http://www.gamedev.ru/community/toolcorner/articles/ddsUtil Работа с nVidia DDS Utilities (SDK)] | * [http://www.gamedev.ru/community/toolcorner/articles/ddsUtil Работа с nVidia DDS Utilities (SDK)] | ||
* [http://www.gamedev.ru/code/articles/DDS_DXT1_DXT3_DXT5 Графические файлы DDS. Что лучше: DXT1, DXT3, DXT5?] | * [http://www.gamedev.ru/code/articles/DDS_DXT1_DXT3_DXT5 Графические файлы DDS. Что лучше: DXT1, DXT3, DXT5?] | ||
+ | * [http://www.gamedev.ru/code/articles/?id=4171 Работа с расширениями OpenGL с использованием NVIDIA OpenGL SDK 5.1. (Часть 7)] | ||
+ | ** [http://www.gamedev.ru/code/articles/?id=4171&page=3 Загрузка сжатых текстур из файлов формата DDS] | ||
+ | * [http://www.nvidia.com/object/real-time-ycocg-dxt-compression.html Real-Time YCoCg-DXT Compression] ([http://developer.download.nvidia.com/whitepapers/2007/Real-Time-YCoCg-DXT-Compression/Real-Time%20YCoCg-DXT%20Compression.pdf pdf]) | ||
+ | * [https://developer.nvidia.com/legacy-texture-tools Legacy Texture Tools] | ||
+ | |||
+ | === BMP === | ||
+ | * [http://ziggi.org/chtenie-bmp-v-cpp/ Чтение bmp в C++] | ||
+ | * [http://easybmp.sourceforge.net/download.html#Documentation Библиотека для работы с bmp] | ||
+ | |||
+ | ==== Преобразование BMP файлов ==== | ||
+ | |||
+ | Скрипт для преобразования формата BMP файла из формата с палитрой в BMP формат RGB (24 бита на пиксел) | ||
+ | |||
+ | {{Файл|bmp2bmp24.sh|<big> | ||
+ | <source lang="bash"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | name=`basename $1 .bmp` | ||
+ | bmptopnm ./$1 | ppmtobmp -bpp 24 - > ./${name}_.bmp | ||
+ | </source> | ||
+ | </big>}} | ||
+ | |||
+ | Скрипт для преобразования формата BMP в DDS. Программа convert из пакета ImageMagic. | ||
+ | |||
+ | {{Файл|dds2bmp.sh|<big> | ||
+ | <source lang="bash"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | for fname in $@ | ||
+ | do | ||
+ | echo Converting ${fname}... | ||
+ | FILENAME=`basename -s .bmp ${fname}` | ||
+ | convert ${fname} ./${FILENAME}.tga | ||
+ | nvcompress -bc1 ./${FILENAME}.tga ./${FILENAME}.dds | ||
+ | rm ./${FILENAME}.tga | ||
+ | done | ||
+ | </source> | ||
+ | </big>}} | ||
+ | |||
+ | Скрипт для преобразования формата DDS в BMP. Программа tgatoppm из пакета Netpbm | ||
+ | |||
+ | {{Файл|bmp2dds.sh|<big> | ||
+ | <source lang="bash"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | for fname in $@ | ||
+ | do | ||
+ | echo Converting ${fname}... | ||
+ | FILENAME=`basename -s .dds ${fname}` | ||
+ | nvdecompress ${fname} | ||
+ | tgatoppm ./${FILENAME}.tga | ppmtobmp -bpp 24 - > ./${FILENAME}.bmp | ||
+ | rm ./${FILENAME}.tga | ||
+ | done | ||
+ | </source> | ||
+ | </big>}} | ||
+ | |||
+ | == NVIDIA Texture Tools == | ||
+ | |||
+ | Утилиты, входящие в пакет: | ||
+ | * /usr/bin/nvzoom | ||
+ | * /usr/bin/nvdecompress – преобразование сжатого изображения (DDS) в TGA. | ||
+ | * /usr/bin/nvddsinfo - вывод информации о DDS | ||
+ | * /usr/bin/nvimgdiff – сравнение изображений | ||
+ | * /usr/bin/nvcompress – кодирует различные форматы в DDS | ||
+ | * /usr/bin/nvassemble | ||
+ | |||
+ | |||
+ | === nvcompress === | ||
+ | |||
+ | * Преобразует из форматов .tga, .bmp, .gif, .ppm, .jpg, .tif, .cel, .dds, .png и .psd в формат DDS с заданием ряда параметров для сохранения. | ||
+ | |||
+ | <big><source lang="text"> | ||
+ | NVIDIA Texture Tools 2.0 - Copyright NVIDIA Corporation 2007 | ||
+ | |||
+ | usage: nvcompress [options] infile [outfile] | ||
+ | |||
+ | Input options: | ||
+ | -color The input image is a color map (default). | ||
+ | -alpha The input image has an alpha channel used for transparency. | ||
+ | -normal The input image is a normal map. | ||
+ | -tonormal Convert input to normal map. | ||
+ | -clamp Clamp wrapping mode (default). | ||
+ | -repeat Repeat wrapping mode. | ||
+ | -nomips Disable mipmap generation. | ||
+ | |||
+ | Compression options: | ||
+ | -fast Fast compression. | ||
+ | -nocuda Do not use cuda compressor. | ||
+ | -rgb RGBA format | ||
+ | -bc1 BC1 format (DXT1) | ||
+ | -bc1n BC1 normal map format (DXT1nm) | ||
+ | -bc1a BC1 format with binary alpha (DXT1a) | ||
+ | -bc2 BC2 format (DXT3) | ||
+ | -bc3 BC3 format (DXT5) | ||
+ | -bc3n BC3 normal map format (DXT5nm) | ||
+ | -bc4 BC4 format (ATI1) | ||
+ | -bc5 BC5 format (3Dc/ATI2) | ||
+ | </source> | ||
+ | </big> | ||
+ | |||
+ | |||
+ | === nvdecompress === | ||
+ | |||
+ | * декодирование DDS в TGA | ||
+ | |||
+ | '''usage:''' nvdecompress 'ddsfile' | ||
+ | |||
+ | Пример: | ||
+ | |||
+ | nvdecompress N1R001C001.dds | ||
+ | tgatoppm N1R001C001.tga > N1R001C001.ppm | ||
+ | |||
+ | * *.tga - нет программы для просмотра этого формата | ||
+ | * но есть программа tgatoppm из пакета media-libs/netpbm для преобразования TGA в PPM (а pnm уже можно смотреть) | ||
+ | |||
+ | === nvimgdiff === | ||
+ | |||
+ | '''usage:''' nvimgdiff [options] original_file updated_file [output] | ||
+ | |||
+ | Diff options: | ||
+ | -normal Compare images as if they were normal maps. | ||
+ | -alpha Compare alpha weighted images. | ||
+ | |||
+ | |||
+ | === nvassemble === | ||
+ | |||
+ | '''usage:''' nvassemble [-cube|-volume|-array] 'file0' 'file1' ... | ||
+ | |||
+ | |||
+ | === nvzoom === | ||
+ | |||
+ | '''usage:''' nvzoom [options] input [output] | ||
+ | |||
+ | Options: | ||
+ | -s scale Scale factor (default = 0.5) | ||
+ | -g gamma Gamma correction (default = 2.2) | ||
+ | -f filter One of the following: (default = 'box') | ||
+ | * box | ||
+ | * triangle | ||
+ | * quadratic | ||
+ | * bspline | ||
+ | * mitchell | ||
+ | * lanczos | ||
+ | * kaiser | ||
+ | -w mode One of the following: (default = 'mirror') | ||
+ | * mirror | ||
+ | * repeat | ||
+ | * clamp | ||
+ | |||
+ | |||
+ | === nvddsinfo === | ||
+ | |||
+ | * вывод информации о DDS файле | ||
+ | |||
+ | '''usage:''' nvddsinfo ddsfile | ||
+ | |||
+ | Пример работы: | ||
+ | |||
+ | nvddsinfo N1R001C027.dds | ||
+ | |||
+ | <big><source lang="text"> | ||
+ | Flags: 0x000A1007 | ||
+ | DDSD_CAPS | ||
+ | DDSD_PIXELFORMAT | ||
+ | DDSD_WIDTH | ||
+ | DDSD_HEIGHT | ||
+ | DDSD_LINEARSIZE | ||
+ | DDSD_MIPMAPCOUNT | ||
+ | Height: 768 | ||
+ | Width: 1024 | ||
+ | Depth: 0 | ||
+ | Linear size: 393216 | ||
+ | Mipmap count: 11 | ||
+ | Pixel Format: | ||
+ | Flags: 0x00000004 | ||
+ | DDPF_FOURCC | ||
+ | FourCC: 'DXT1' | ||
+ | Bit count: 0 | ||
+ | Red mask: 0x00000000 | ||
+ | Green mask: 0x00000000 | ||
+ | Blue mask: 0x00000000 | ||
+ | Alpha mask: 0x00000000 | ||
+ | Caps: | ||
+ | Caps 1: 0x00401008 | ||
+ | DDSCAPS_COMPLEX | ||
+ | DDSCAPS_TEXTURE | ||
+ | DDSCAPS_MIPMAP | ||
+ | Caps 2: 0x00000000 | ||
+ | Caps 3: 0x00000000 | ||
+ | Caps 4: 0x00000000 | ||
+ | Version: | ||
+ | NVIDIA Texture Tools 2.0.8 | ||
+ | </source></big> | ||
+ | |||
+ | == Формат Photopreview == | ||
+ | |||
+ | {{Hider|Фрагмент файла m1c.ctw для Photopreview}} | ||
+ | <source lang="text"> | ||
+ | 9 | ||
+ | 0 0 | ||
+ | LAYER | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | 495.30785 503.98224 | ||
+ | ENDLAYER | ||
+ | 9 86 -35 1CR01C01 | ||
+ | 9 1035 -36 1CR01C02 | ||
+ | 9 1980 -36 1CR01C03 | ||
+ | 9 2928 -35 1CR01C04 | ||
+ | 9 3874 -34 1CR01C05 | ||
+ | 9 4823 -35 1CR01C06 | ||
+ | 9 5772 -35 1CR01C07 | ||
+ | 9 6720 -34 1CR01C08 | ||
+ | 9 7667 -33 1CR01C09 | ||
+ | 9 8615 -35 1CR01C10 | ||
+ | ... | ||
+ | 9 58728 -32 1CR01C63 | ||
+ | 9 59669 -29 1CR01C64 | ||
+ | 9 60605 -28 1CR01C65 | ||
+ | 9 61538 -27 1CR01C66 | ||
+ | 9 62476 -24 1CR01C67 | ||
+ | 9 88 -777 1CR02C01 | ||
+ | 9 1036 -780 1CR02C02 | ||
+ | 9 1982 -780 1CR02C03 | ||
+ | 9 2929 -779 1CR02C04 | ||
+ | 9 3876 -778 1CR02C05 | ||
+ | 9 4825 -779 1CR02C06 | ||
+ | 9 5771 -777 1CR02C07 | ||
+ | 9 6722 -777 1CR02C08 | ||
+ | ... | ||
+ | 9 8636 -13275 1CR19C10 | ||
+ | 9 9583 -13275 1CR19C11 | ||
+ | 9 10530 -13272 1CR19C12 | ||
+ | 9 11476 -13273 1CR19C13 | ||
+ | 9 12423 -13273 1CR19C14 | ||
+ | 9 13369 -13273 1CR19C15 | ||
+ | 9 14316 -13273 1CR19C16 | ||
+ | 9 15263 -13272 1CR19C17 | ||
+ | 9 16209 -13270 1CR19C18 | ||
+ | 9 17154 -13271 1CR19C19 | ||
+ | </source>{{Hider|end}} | ||
+ | |||
+ | |||
+ | == Формат Glew == | ||
+ | === Скрипт для построения списка имён изображений === | ||
+ | |||
+ | {{Hider|Листинг файла create_img_list.sh}} | ||
+ | |||
+ | {{Файл|create_img_list.sh|<big><big><source lang="verilog"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | SRC_DIR=${1?"Project DIR not set!"} | ||
+ | TYPE=${2:-bmp} | ||
+ | |||
+ | if [ $TYPE = "bmp" ] ; then | ||
+ | EXT="[bB][mM][pP]" | ||
+ | elif [ TYPE = "dds" ] ; then | ||
+ | EXT="[dD][dD][sS]" | ||
+ | else | ||
+ | EXT=$TYPE | ||
+ | fi | ||
+ | |||
+ | SUBDIR_LIST=$(ls $SRC_DIR) | ||
+ | |||
+ | #echo $SUBDIR_LIST | ||
+ | |||
+ | for layer in $SUBDIR_LIST | ||
+ | do | ||
+ | if [ -d "$SRC_DIR/$layer" ] ; then | ||
+ | echo $layer | ||
+ | layer_list=$SRC_DIR/${layer}_NAMES.txt | ||
+ | ls $SRC_DIR/$layer/*.${EXT} | sed 's/.[bB][mM][pP]//g' | sed "s/$SRC_DIR\/$layer\///g" > $layer_list | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | |||
+ | exit 1</source></big></big>}}{{Hider|end}} | ||
+ | |||
+ | == Преобразование направления перечисления имён == | ||
+ | |||
+ | convert_list.py Columns Rows [Type] InputFileName [OutputFileName] | ||
+ | Type: | ||
+ | 0 (по умолчанию) — слева направо, сверху вниз; | ||
+ | 1 — слева направо, снизу вверх; | ||
+ | 2 — сверху вниз, слева направо; | ||
+ | 3 — снизу вверх, слева направо" | ||
+ | |||
+ | |||
+ | {{Hider|Листинг программы преобразования convert_list.py}} | ||
+ | {{Файл|convert_list.py|<big><big><source lang="python"> | ||
+ | #!/usr/bin/python | ||
+ | # -*- coding: UTF-8 -*- | ||
+ | |||
+ | import sys | ||
+ | import os | ||
+ | #import pickle | ||
+ | |||
+ | if __name__ == "__main__": | ||
+ | if len (sys.argv) > 1: | ||
+ | if len (sys.argv) == 4: | ||
+ | X = int(sys.argv[1]); | ||
+ | Y = int(sys.argv[2]); | ||
+ | InFile = sys.argv[3]; | ||
+ | if len (sys.argv) == 5: | ||
+ | X = int(sys.argv[1]); | ||
+ | Y = int(sys.argv[2]); | ||
+ | Type = int(sys.argv[3]); | ||
+ | InFile = sys.argv[4]; | ||
+ | OutFile = sys.argv[4] + ".txt"; | ||
+ | if len (sys.argv) == 6: | ||
+ | X = int(sys.argv[1]); | ||
+ | Y = int(sys.argv[2]); | ||
+ | Type = int(sys.argv[3]); | ||
+ | InFile = sys.argv[4]; | ||
+ | OutFile = sys.argv[5]; | ||
+ | else: | ||
+ | print ("{} Columns Rows [Type] InputFileName [OutputFileName]".format(sys.argv[0])) | ||
+ | print ("Type: \n" | ||
+ | " 0 (по умолчанию) — слева направо, сверху вниз;\n" | ||
+ | " 1 — слева направо, снизу вверх;\n" | ||
+ | " 2 — сверху вниз, слева направо;\n" | ||
+ | " 3 — снизу вверх, слева направо") | ||
+ | sys.exit() | ||
+ | |||
+ | #print X, Y, Type, InFile | ||
+ | |||
+ | if (int(Type) > 3) or (int(Type) < 0): | ||
+ | print ("Type is wrong") | ||
+ | sys.exit() | ||
+ | |||
+ | if (int(X) > 1000) or (int(X) < 0): | ||
+ | print ("Numper of columns is wrong") | ||
+ | sys.exit() | ||
+ | |||
+ | if (int(Y) > 1000) or (int(X) < 0): | ||
+ | print ("Number of rows is wrong") | ||
+ | sys.exit() | ||
+ | |||
+ | if os.path.isfile(InFile) : | ||
+ | fi = open( InFile, 'r') | ||
+ | else: | ||
+ | print ("File " + InFile + "is not exist!") | ||
+ | sys.exit() | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | sstr = fi.readlines() | ||
+ | |||
+ | if (X * Y) != len(sstr) : | ||
+ | print ("Col (%d) * Row (%d) != Lines number (%d) in File " % (X, Y, len(sstr)) + InFile + "!") | ||
+ | sys.exit() | ||
+ | |||
+ | row_s = 0 | ||
+ | row_e = Y | ||
+ | row_d = 1 | ||
+ | col_s = 0 | ||
+ | col_e = X | ||
+ | col_d = 1 | ||
+ | |||
+ | |||
+ | if Type == 1 : | ||
+ | row_s = Y-1 | ||
+ | row_e = -1 | ||
+ | row_d = -1 | ||
+ | col_s = 0 | ||
+ | col_e = X | ||
+ | col_d = 1 | ||
+ | elif Type == 2 : | ||
+ | row_s = 0 | ||
+ | row_e = Y | ||
+ | row_d = 1 | ||
+ | col_s = 0 | ||
+ | col_e = X | ||
+ | col_d = 1 | ||
+ | elif Type == 3 : | ||
+ | row_s = Y-1 | ||
+ | row_e = -1 | ||
+ | row_d = -1 | ||
+ | col_s = 0 | ||
+ | col_e = X | ||
+ | col_d = 1 | ||
+ | |||
+ | |||
+ | fo = open( OutFile, 'w') | ||
+ | |||
+ | # Create matrix | ||
+ | m = [[] for i in range(2010)] | ||
+ | for i in range(Y): | ||
+ | for j in range(X): | ||
+ | m[i].append(-1) | ||
+ | |||
+ | # Init matrix | ||
+ | if (Type == 0) or (Type == 1) : | ||
+ | row = row_s | ||
+ | i=0 | ||
+ | while row != row_e: | ||
+ | col = col_s | ||
+ | while col != col_e: | ||
+ | print(row, col, sstr[i]) | ||
+ | m[row][col] = sstr[i] | ||
+ | i = i + 1 | ||
+ | col = col + col_d | ||
+ | row = row + row_d | ||
+ | |||
+ | if (Type == 2) or (Type == 3) : | ||
+ | col = col_s | ||
+ | i=0 | ||
+ | while col != col_e: | ||
+ | row = row_s | ||
+ | while row != row_e: | ||
+ | print(row, col, sstr[i]) | ||
+ | m[row][col] = sstr[i] | ||
+ | i = i + 1 | ||
+ | row = row + row_d | ||
+ | col = col + col_d | ||
+ | |||
+ | # Write matrix to file | ||
+ | for yy in range (Y) : | ||
+ | for xx in range(X) : | ||
+ | fo.write(m[yy][xx]) | ||
+ | |||
+ | # Test print | ||
+ | for yy in range (Y): | ||
+ | print m[yy] | ||
+ | |||
+ | fo.close() | ||
+ | fi.close() | ||
+ | </source></big></big>}}{{Hider|end}} | ||
+ | |||
+ | == NEW == |
Текущая версия на 12:48, 9 сентября 2014
Содержание |
Ссылки
DDS
- Работа с nVidia DDS Utilities (SDK)
- Графические файлы DDS. Что лучше: DXT1, DXT3, DXT5?
- Работа с расширениями OpenGL с использованием NVIDIA OpenGL SDK 5.1. (Часть 7)
- Real-Time YCoCg-DXT Compression (pdf)
- Legacy Texture Tools
BMP
Преобразование BMP файлов
Скрипт для преобразования формата BMP файла из формата с палитрой в BMP формат RGB (24 бита на пиксел)
Файл: bmp2bmp24.sh |
#!/bin/bash name=`basename $1 .bmp` bmptopnm ./$1 | ppmtobmp -bpp 24 - > ./${name}_.bmp |
Скрипт для преобразования формата BMP в DDS. Программа convert из пакета ImageMagic.
Файл: dds2bmp.sh |
#!/bin/bash for fname in $@ do echo Converting ${fname}... FILENAME=`basename -s .bmp ${fname}` convert ${fname} ./${FILENAME}.tga nvcompress -bc1 ./${FILENAME}.tga ./${FILENAME}.dds rm ./${FILENAME}.tga done |
Скрипт для преобразования формата DDS в BMP. Программа tgatoppm из пакета Netpbm
Файл: bmp2dds.sh |
#!/bin/bash for fname in $@ do echo Converting ${fname}... FILENAME=`basename -s .dds ${fname}` nvdecompress ${fname} tgatoppm ./${FILENAME}.tga | ppmtobmp -bpp 24 - > ./${FILENAME}.bmp rm ./${FILENAME}.tga done |
NVIDIA Texture Tools
Утилиты, входящие в пакет:
- /usr/bin/nvzoom
- /usr/bin/nvdecompress – преобразование сжатого изображения (DDS) в TGA.
- /usr/bin/nvddsinfo - вывод информации о DDS
- /usr/bin/nvimgdiff – сравнение изображений
- /usr/bin/nvcompress – кодирует различные форматы в DDS
- /usr/bin/nvassemble
nvcompress
- Преобразует из форматов .tga, .bmp, .gif, .ppm, .jpg, .tif, .cel, .dds, .png и .psd в формат DDS с заданием ряда параметров для сохранения.
NVIDIA Texture Tools 2.0 - Copyright NVIDIA Corporation 2007 usage: nvcompress [options] infile [outfile] Input options: -color The input image is a color map (default). -alpha The input image has an alpha channel used for transparency. -normal The input image is a normal map. -tonormal Convert input to normal map. -clamp Clamp wrapping mode (default). -repeat Repeat wrapping mode. -nomips Disable mipmap generation. Compression options: -fast Fast compression. -nocuda Do not use cuda compressor. -rgb RGBA format -bc1 BC1 format (DXT1) -bc1n BC1 normal map format (DXT1nm) -bc1a BC1 format with binary alpha (DXT1a) -bc2 BC2 format (DXT3) -bc3 BC3 format (DXT5) -bc3n BC3 normal map format (DXT5nm) -bc4 BC4 format (ATI1) -bc5 BC5 format (3Dc/ATI2)
nvdecompress
- декодирование DDS в TGA
usage: nvdecompress 'ddsfile'
Пример:
nvdecompress N1R001C001.dds tgatoppm N1R001C001.tga > N1R001C001.ppm
- *.tga - нет программы для просмотра этого формата
- но есть программа tgatoppm из пакета media-libs/netpbm для преобразования TGA в PPM (а pnm уже можно смотреть)
nvimgdiff
usage: nvimgdiff [options] original_file updated_file [output] Diff options: -normal Compare images as if they were normal maps. -alpha Compare alpha weighted images.
nvassemble
usage: nvassemble [-cube|-volume|-array] 'file0' 'file1' ...
nvzoom
usage: nvzoom [options] input [output] Options: -s scale Scale factor (default = 0.5) -g gamma Gamma correction (default = 2.2) -f filter One of the following: (default = 'box') * box * triangle * quadratic * bspline * mitchell * lanczos * kaiser -w mode One of the following: (default = 'mirror') * mirror * repeat * clamp
nvddsinfo
- вывод информации о DDS файле
usage: nvddsinfo ddsfile
Пример работы:
nvddsinfo N1R001C027.dds
Flags: 0x000A1007 DDSD_CAPS DDSD_PIXELFORMAT DDSD_WIDTH DDSD_HEIGHT DDSD_LINEARSIZE DDSD_MIPMAPCOUNT Height: 768 Width: 1024 Depth: 0 Linear size: 393216 Mipmap count: 11 Pixel Format: Flags: 0x00000004 DDPF_FOURCC FourCC: 'DXT1' Bit count: 0 Red mask: 0x00000000 Green mask: 0x00000000 Blue mask: 0x00000000 Alpha mask: 0x00000000 Caps: Caps 1: 0x00401008 DDSCAPS_COMPLEX DDSCAPS_TEXTURE DDSCAPS_MIPMAP Caps 2: 0x00000000 Caps 3: 0x00000000 Caps 4: 0x00000000 Version: NVIDIA Texture Tools 2.0.8
Формат Photopreview
Фрагмент файла m1c.ctw для Photopreview
9 0 0 LAYER 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 495.30785 503.98224 ENDLAYER 9 86 -35 1CR01C01 9 1035 -36 1CR01C02 9 1980 -36 1CR01C03 9 2928 -35 1CR01C04 9 3874 -34 1CR01C05 9 4823 -35 1CR01C06 9 5772 -35 1CR01C07 9 6720 -34 1CR01C08 9 7667 -33 1CR01C09 9 8615 -35 1CR01C10 ... 9 58728 -32 1CR01C63 9 59669 -29 1CR01C64 9 60605 -28 1CR01C65 9 61538 -27 1CR01C66 9 62476 -24 1CR01C67 9 88 -777 1CR02C01 9 1036 -780 1CR02C02 9 1982 -780 1CR02C03 9 2929 -779 1CR02C04 9 3876 -778 1CR02C05 9 4825 -779 1CR02C06 9 5771 -777 1CR02C07 9 6722 -777 1CR02C08 ... 9 8636 -13275 1CR19C10 9 9583 -13275 1CR19C11 9 10530 -13272 1CR19C12 9 11476 -13273 1CR19C13 9 12423 -13273 1CR19C14 9 13369 -13273 1CR19C15 9 14316 -13273 1CR19C16 9 15263 -13272 1CR19C17 9 16209 -13270 1CR19C18 9 17154 -13271 1CR19C19
Формат Glew
Скрипт для построения списка имён изображений
Листинг файла create_img_list.sh
Файл: create_img_list.sh |
#!/bin/bash SRC_DIR=${1?"Project DIR not set!"} TYPE=${2:-bmp} if [ $TYPE = "bmp" ] ; then EXT="[bB][mM][pP]" elif [ TYPE = "dds" ] ; then EXT="[dD][dD][sS]" else EXT=$TYPE fi SUBDIR_LIST=$(ls $SRC_DIR) #echo $SUBDIR_LIST for layer in $SUBDIR_LIST do if [ -d "$SRC_DIR/$layer" ] ; then echo $layer layer_list=$SRC_DIR/${layer}_NAMES.txt ls $SRC_DIR/$layer/*.${EXT} | sed 's/.[bB][mM][pP]//g' | sed "s/$SRC_DIR\/$layer\///g" > $layer_list fi done exit 1 |
Преобразование направления перечисления имён
convert_list.py Columns Rows [Type] InputFileName [OutputFileName] Type: 0 (по умолчанию) — слева направо, сверху вниз; 1 — слева направо, снизу вверх; 2 — сверху вниз, слева направо; 3 — снизу вверх, слева направо"
Листинг программы преобразования convert_list.py
Файл: convert_list.py |
#!/usr/bin/python # -*- coding: UTF-8 -*- import sys import os #import pickle if __name__ == "__main__": if len (sys.argv) > 1: if len (sys.argv) == 4: X = int(sys.argv[1]); Y = int(sys.argv[2]); InFile = sys.argv[3]; if len (sys.argv) == 5: X = int(sys.argv[1]); Y = int(sys.argv[2]); Type = int(sys.argv[3]); InFile = sys.argv[4]; OutFile = sys.argv[4] + ".txt"; if len (sys.argv) == 6: X = int(sys.argv[1]); Y = int(sys.argv[2]); Type = int(sys.argv[3]); InFile = sys.argv[4]; OutFile = sys.argv[5]; else: print ("{} Columns Rows [Type] InputFileName [OutputFileName]".format(sys.argv[0])) print ("Type: \n" " 0 (по умолчанию) — слева направо, сверху вниз;\n" " 1 — слева направо, снизу вверх;\n" " 2 — сверху вниз, слева направо;\n" " 3 — снизу вверх, слева направо") sys.exit() #print X, Y, Type, InFile if (int(Type) > 3) or (int(Type) < 0): print ("Type is wrong") sys.exit() if (int(X) > 1000) or (int(X) < 0): print ("Numper of columns is wrong") sys.exit() if (int(Y) > 1000) or (int(X) < 0): print ("Number of rows is wrong") sys.exit() if os.path.isfile(InFile) : fi = open( InFile, 'r') else: print ("File " + InFile + "is not exist!") sys.exit() sstr = fi.readlines() if (X * Y) != len(sstr) : print ("Col (%d) * Row (%d) != Lines number (%d) in File " % (X, Y, len(sstr)) + InFile + "!") sys.exit() row_s = 0 row_e = Y row_d = 1 col_s = 0 col_e = X col_d = 1 if Type == 1 : row_s = Y-1 row_e = -1 row_d = -1 col_s = 0 col_e = X col_d = 1 elif Type == 2 : row_s = 0 row_e = Y row_d = 1 col_s = 0 col_e = X col_d = 1 elif Type == 3 : row_s = Y-1 row_e = -1 row_d = -1 col_s = 0 col_e = X col_d = 1 fo = open( OutFile, 'w') # Create matrix m = [[] for i in range(2010)] for i in range(Y): for j in range(X): m[i].append(-1) # Init matrix if (Type == 0) or (Type == 1) : row = row_s i=0 while row != row_e: col = col_s while col != col_e: print(row, col, sstr[i]) m[row][col] = sstr[i] i = i + 1 col = col + col_d row = row + row_d if (Type == 2) or (Type == 3) : col = col_s i=0 while col != col_e: row = row_s while row != row_e: print(row, col, sstr[i]) m[row][col] = sstr[i] i = i + 1 row = row + row_d col = col + col_d # Write matrix to file for yy in range (Y) : for xx in range(X) : fo.write(m[yy][xx]) # Test print for yy in range (Y): print m[yy] fo.close() fi.close() |