@@ -586,8 +586,8 @@ interface astcParams { // **
586
586
587
587
attribute boolean verbose;
588
588
attribute long threadCount;
589
- attribute AstcBlockDimension blockDimension;
590
- attribute AstcMode mode;
589
+ attribute astc_block_dimension blockDimension;
590
+ attribute pack_astc_encoder_mode mode;
591
591
attribute long qualityLevel;
592
592
attribute boolean normalMap;
593
593
attribute DOMString inputSwizzle;
@@ -617,7 +617,7 @@ interface basisParams { // **
617
617
618
618
// UASTC parameters.
619
619
620
- attribute UastcFlags uastcFlags,
620
+ attribute pack_uastc_flag_bits uastcFlags,
621
621
attribute boolean uastcRDO,
622
622
attribute float uastcRDOQualityScalar,
623
623
attribute long uastcRDODictSize,
@@ -632,20 +632,20 @@ interface texture {
632
632
constructor(textureCreateInfo createInfo, // **
633
633
CreateStorageEnum? storage);
634
634
635
- ErrorCode compressAstc(ktxAstcParams params); // **
636
- ErrorCode compressBasis(ktxBasisParams params); // **
635
+ error_code compressAstc(ktxAstcParams params); // **
636
+ error_code compressBasis(ktxBasisParams params); // **
637
637
texture createCopy(); // **
638
- ErrorCode defateZLIB(); // **
639
- ErrorCode deflateZstd(); // **
638
+ error_code defateZLIB(); // **
639
+ error_code deflateZstd(); // **
640
640
ArrayBufferView getImage(long level, long layer, long faceSlice);
641
641
UploadResult glUpload();
642
- ErrorCode setImageFromMemory(long level, long layer, long faceSlice,
642
+ error_code setImageFromMemory(long level, long layer, long faceSlice,
643
643
ArrayBufferView imageData); // **
644
- ErrorCode transcodeBasis(TranscodeTarget ? target, TranscodeFlagBits
644
+ error_code transcodeBasis(texture_transcode_fmt ? target, transcode_flag_bits
645
645
decodeFlags);
646
646
ArrayBufferView writeToMemory(); // **
647
- ErrorCode addKVPairString(DOMString key, DOMString value); // **
648
- ErrorCode addKVPairByte(DOMString key, ArrayBuffewView value); // **
647
+ error_code addKVPairString(DOMString key, DOMString value); // **
648
+ error_code addKVPairByte(DOMString key, ArrayBuffewView value); // **
649
649
deleteKVPair(DOMString key); // **
650
650
DOMString? findKeyValue(DOMString key);
651
651
@@ -659,11 +659,11 @@ interface texture {
659
659
readonly attribute SupercmpScheme supercompressionScheme;
660
660
readonly attribute ktxOrientation orientation;
661
661
662
- attribute dfTransfer OETF; // Setting available only in libktx.js.
663
- attribute dfPrimaries primaries; // Setting available only in libktx.js.
662
+ attribute khr_df_transfer OETF; // Setting available only in libktx.js.
663
+ attribute khr_df_primaries primaries; // Setting available only in libktx.js.
664
664
};
665
665
666
- enum ErrorCode = {
666
+ enum error_code = {
667
667
"SUCCESS",
668
668
"FILE_DATA_ERROR",
669
669
"FILE_ISPIPE",
@@ -692,7 +692,7 @@ enum CreateStorageEnum = {
692
692
693
693
// Some targets may not be available depending on options used when compiling
694
694
// the web assembly. ktxTexture.transcodeBasis will report this.
695
- enum TranscodeTarget = {
695
+ enum texture_transcode_fmt = {
696
696
"ETC1_RGB",
697
697
"BC1_RGB",
698
698
"BC4_R",
@@ -715,7 +715,7 @@ enum TranscodeTarget = {
715
715
"EAC_RG11"
716
716
};
717
717
718
- enum TranscodeFlagBits {
718
+ enum transcode_flag_bits {
719
719
"TRANSCODE_ALPHA_DATA_TO_OPAQUE_FORMATS"
720
720
};
721
721
@@ -739,15 +739,15 @@ enum SupercmpScheme {
739
739
"ZLIB"
740
740
};
741
741
742
- enum dfPrimaries = {
742
+ enum khr_df_primaries = {
743
743
// These are the values needed for KTX with HTML5/WebGL.
744
744
"UNSPECIFIED",
745
745
"BT709",
746
746
"SRGB"
747
747
"DISPLAYP3"
748
748
};
749
749
750
- enum dfTransfer = {
750
+ enum khr_df_transfer = {
751
751
// These are the values needed for KTX with HTML5/WebGL.
752
752
"UNSPECIFIED",
753
753
"LINEAR",
@@ -762,15 +762,15 @@ enum VkFormat = {
762
762
// purpose of this IDL. Any VkFormat valid for KTX can be used. As shown
763
763
// here, omit the VK_FORMAT_ prefix and enclose in quotes.
764
764
765
- enum AstcQualityLevel = { // **
765
+ enum astc_quality_levels = { // **
766
766
"FASTEST",
767
767
"FAST",
768
768
"MEDIUM",
769
769
"THOROUGH",
770
770
"EXHAUSTIVE",
771
771
};
772
772
773
- enum AstcBlockDimension = { // **
773
+ enum astc_block_dimension = { // **
774
774
// 2D formats
775
775
"d4x4",
776
776
"d5x4",
@@ -799,26 +799,27 @@ enum AstcBlockDimension = { // **
799
799
"d6x6x6"
800
800
};
801
801
802
- enum AstcMode = { // **
802
+ enum pack_astc_encoder_mode = { // **
803
803
"DEFAULT",
804
804
"LDR",
805
805
"HDR"
806
806
};
807
807
808
- enum UastcFlags = { // **
808
+ enum pack_uastc_flag_bits = { // **
809
809
"LEVEL_FASTEST",
810
810
"LEVEL_FASTER",
811
811
"LEVEL_DEFAULT",
812
812
"LEVEL_SLOWER",
813
813
"LEVEL_VERYSLOW",
814
814
};
815
815
816
- const DOMString AnimDataKey = "KTXanimData";
817
- const DOMString OrientationKey = "KTXorientation";
818
- const DOMString SwizzleKey = "KTXswizzle";
819
- const DOMString WriterKey = "KTXwriter";
820
- const unsigned long FaceSliceWholeLevel = UINT_MAX;
821
- const unsigned long Etc1SDefaultCompressionLevel = 2;
816
+ const DOMString ANIMDATA_KEY = "KTXanimData";
817
+ const DOMStringORIENTATION_KEY = "KTXorientation";
818
+ const DOMString SWIZZLE_KEY = "KTXswizzle";
819
+ const DOMString WRITER_KEY = "KTXwriter";
820
+ const DOMString WRITER_SCPARAMS_KEY = "KTXwriterScParams";
821
+ const unsigned long FACESLICE_WHOLE_lEVEL = UINT_MAX;
822
+ const unsigned long ETC1S_DEFAULT_COMPRESSION_LEVEL = 2;
822
823
@endcode
823
824
824
825
# How to use
@@ -955,28 +956,28 @@ returns the created WebGL texture object and matching texture target.
955
956
956
957
@code{.js}
957
958
function uploadTextureToGl(gl, ktexture) {
958
- const { TranscodeTarget } = ktx;
959
+ const { texture_transcode_fmt } = ktx;
959
960
var formatString;
960
961
961
962
if (ktexture.needsTranscoding) {
962
963
var format;
963
964
if (astcSupported) {
964
965
formatString = 'ASTC';
965
- format = TranscodeTarget .ASTC_4x4_RGBA;
966
+ format = texture_transcode_fmt .ASTC_4x4_RGBA;
966
967
} else if (dxtSupported) {
967
968
formatString = ktexture.numComponents == 4 ? 'BC3' : 'BC1';
968
- format = TranscodeTarget .BC1_OR_3;
969
+ format = texture_transcode_fmt .BC1_OR_3;
969
970
} else if (pvrtcSupported) {
970
971
formatString = 'PVRTC1';
971
- format = TranscodeTarget .PVRTC1_4_RGBA;
972
+ format = texture_transcode_fmt .PVRTC1_4_RGBA;
972
973
} else if (etcSupported) {
973
974
formatString = 'ETC';
974
- format = TranscodeTarget .ETC;
975
+ format = texture_transcode_fmt .ETC;
975
976
} else {
976
977
formatString = 'RGBA4444';
977
- format = TranscodeTarget .RGBA4444;
978
+ format = texture_transcode_fmt .RGBA4444;
978
979
}
979
- if (ktexture.transcodeBasis(format, 0) != ktx.ErrorCode .SUCCESS) {
980
+ if (ktexture.transcodeBasis(format, 0) != ktx.error_code .SUCCESS) {
980
981
alert('Texture transcode failed. See console for details.');
981
982
return undefined;
982
983
}
@@ -1114,7 +1115,7 @@ Step 3 is to create the KTX texture object as shonw here:
1114
1115
const ktexture = new ktx.texture(createInfo, ktx.CreateStorageEnum.ALLOC_STORAGE);
1115
1116
if (ktexture != null) {
1116
1117
if (displayP3) {
1117
- ktexture.primaries = ktx.dfPrimaries .DISPLAYP3;
1118
+ ktexture.primaries = ktx.khr_df_primaries .DISPLAYP3;
1118
1119
}
1119
1120
result = ktexture.setImageFromMemory(0, 0, 0, imageData.data);
1120
1121
}
@@ -1136,10 +1137,10 @@ like the following.
1136
1137
basisu_options.noSSE = true;
1137
1138
basisu_options.verbose = false;
1138
1139
basisu_options.qualityLevel = 200;
1139
- basisu_options.compressionLevel = ktx.Etc1SDefaultCompressionLevel ;
1140
+ basisu_options.compressionLevel = ktx.ETC1S_DEFAULT_COMPRESSION_LEVEL ;
1140
1141
1141
1142
var result = ktexture.compressBasis(basisu_options);
1142
- // Check result for ktx.ErrorCode .SUCCESS.
1143
+ // Check result for ktx.error_code .SUCCESS.
1143
1144
}
1144
1145
@endcode
1145
1146
@@ -1157,7 +1158,7 @@ a local file or upload it to a server.
1157
1158
1158
1159
EMSCRIPTEN_BINDINGS (ktx)
1159
1160
{
1160
- enum_<ktx_error_code_e>(" ErrorCode " )
1161
+ enum_<ktx_error_code_e>(" error_code " )
1161
1162
.value (" SUCCESS" , KTX_SUCCESS)
1162
1163
.value (" FILE_DATA_ERROR" , KTX_FILE_DATA_ERROR)
1163
1164
.value (" FILE_ISPIPE" , KTX_FILE_ISPIPE)
@@ -1181,7 +1182,7 @@ EMSCRIPTEN_BINDINGS(ktx)
1181
1182
.value (" DECOMPRESS_CHECKSUM_ERROR" , KTX_DECOMPRESS_CHECKSUM_ERROR)
1182
1183
;
1183
1184
1184
- enum_<ktx_texture_transcode_fmt_e>(" TranscodeTarget " )
1185
+ enum_<ktx_texture_transcode_fmt_e>(" texture_transcode_fmt " )
1185
1186
.value (" ETC1_RGB" , KTX_TTF_ETC1_RGB)
1186
1187
.value (" BC1_RGB" , KTX_TTF_BC1_RGB)
1187
1188
.value (" BC4_R" , KTX_TTF_BC4_R)
@@ -1205,7 +1206,7 @@ EMSCRIPTEN_BINDINGS(ktx)
1205
1206
.value (" EAC_RG11" , KTX_TTF_ETC2_EAC_RG11)
1206
1207
;
1207
1208
1208
- enum_<ktx_transcode_flag_bits_e>(" TranscodeFlagBits " )
1209
+ enum_<ktx_transcode_flag_bits_e>(" transcode_flag_bits " )
1209
1210
.value (" TRANSCODE_ALPHA_DATA_TO_OPAQUE_FORMATS" ,
1210
1211
KTX_TF_TRANSCODE_ALPHA_DATA_TO_OPAQUE_FORMATS)
1211
1212
;
@@ -1238,15 +1239,15 @@ EMSCRIPTEN_BINDINGS(ktx)
1238
1239
.field (" z" , &ktxOrientation::z)
1239
1240
;
1240
1241
1241
- enum_<khr_df_primaries_e>(" dfPrimaries " )
1242
+ enum_<khr_df_primaries_e>(" khr_df_primaries " )
1242
1243
// These are the values needed with HTML5/WebGL.
1243
1244
.value (" UNSPECIFIED" , KHR_DF_PRIMARIES_UNSPECIFIED)
1244
1245
.value (" BT709" , KHR_DF_PRIMARIES_BT709)
1245
1246
.value (" SRGB" , KHR_DF_PRIMARIES_SRGB)
1246
1247
.value (" DISPLAYP3" , KHR_DF_PRIMARIES_DISPLAYP3)
1247
1248
;
1248
1249
1249
- enum_<khr_df_transfer_e>(" dfTransfer " )
1250
+ enum_<khr_df_transfer_e>(" khr_df_transfer " )
1250
1251
// These are the values needed for KTX with HTML5/WebGL.
1251
1252
.value (" UNSPECIFIED" , KHR_DF_TRANSFER_UNSPECIFIED)
1252
1253
.value (" LINEAR" , KHR_DF_TRANSFER_LINEAR)
@@ -1303,7 +1304,7 @@ EMSCRIPTEN_BINDINGS(ktx)
1303
1304
;
1304
1305
1305
1306
#if KTX_FEATURE_WRITE
1306
- enum_<ktxTextureCreateStorageEnum>(" CreateStorageEnum " )
1307
+ enum_<ktxTextureCreateStorageEnum>(" TextureCreateStorageEnum " )
1307
1308
.value (" NO_STORAGE" , KTX_TEXTURE_CREATE_NO_STORAGE)
1308
1309
.value (" ALLOC_STORAGE" , KTX_TEXTURE_CREATE_ALLOC_STORAGE)
1309
1310
;
@@ -1336,15 +1337,15 @@ EMSCRIPTEN_BINDINGS(ktx)
1336
1337
.property (" generateMipmaps" , &ktxTextureCreateInfo::generateMipmaps)
1337
1338
;
1338
1339
1339
- enum_<ktx_pack_astc_quality_levels_e>(" AstcQualityLevel " )
1340
+ enum_<ktx_pack_astc_quality_levels_e>(" astc_quality_levels " )
1340
1341
.value (" FASTEST" , KTX_PACK_ASTC_QUALITY_LEVEL_FASTEST)
1341
1342
.value (" FAST" , KTX_PACK_ASTC_QUALITY_LEVEL_FAST)
1342
1343
.value (" MEDIUM" , KTX_PACK_ASTC_QUALITY_LEVEL_MEDIUM)
1343
1344
.value (" THOROUGH" , KTX_PACK_ASTC_QUALITY_LEVEL_THOROUGH)
1344
1345
.value (" EXHAUSTIVE" , KTX_PACK_ASTC_QUALITY_LEVEL_EXHAUSTIVE)
1345
1346
;
1346
1347
1347
- enum_<ktx_pack_astc_block_dimension_e>(" AstcBlockDimension " )
1348
+ enum_<ktx_pack_astc_block_dimension_e>(" astc_block_dimension " )
1348
1349
// 2D formats
1349
1350
.value (" d4x4" , KTX_PACK_ASTC_BLOCK_DIMENSION_4x4) // : 8.00 bpp
1350
1351
.value (" d5x4" , KTX_PACK_ASTC_BLOCK_DIMENSION_5x4) // : 6.40 bpp
@@ -1373,7 +1374,7 @@ EMSCRIPTEN_BINDINGS(ktx)
1373
1374
.value (" d6x6x6" , KTX_PACK_ASTC_BLOCK_DIMENSION_6x6x6) // : 0.59 bpp
1374
1375
;
1375
1376
1376
- enum_<ktx_pack_astc_encoder_mode_e>(" AstcMode " )
1377
+ enum_<ktx_pack_astc_encoder_mode_e>(" pack_astc_encoder_mode " )
1377
1378
.value (" DEFAULT" , KTX_PACK_ASTC_ENCODER_MODE_DEFAULT)
1378
1379
.value (" LDR" , KTX_PACK_ASTC_ENCODER_MODE_LDR)
1379
1380
.value (" HDR" , KTX_PACK_ASTC_ENCODER_MODE_HDR)
@@ -1414,7 +1415,7 @@ EMSCRIPTEN_BINDINGS(ktx)
1414
1415
})
1415
1416
;
1416
1417
1417
- enum_<ktx_pack_uastc_flag_bits_e>(" UastcFlags " )
1418
+ enum_<ktx_pack_uastc_flag_bits_e>(" pack_uastc_flag_bits " )
1418
1419
.value (" LEVEL_FASTEST" , KTX_PACK_UASTC_LEVEL_FASTEST)
1419
1420
.value (" LEVEL_FASTER" , KTX_PACK_UASTC_LEVEL_FASTER)
1420
1421
.value (" LEVEL_DEFAULT" , KTX_PACK_UASTC_LEVEL_DEFAULT)
@@ -1468,11 +1469,12 @@ EMSCRIPTEN_BINDINGS(ktx)
1468
1469
.property (" uastcRDONoMultithreading" , &ktxBasisParams::uastcRDONoMultithreading);
1469
1470
;
1470
1471
1471
- constant (" AnimDataKey" , std::string (KTX_ANIMDATA_KEY));
1472
- constant (" OrientationKey" , std::string (KTX_ORIENTATION_KEY));
1473
- constant (" SwizzleKey" , std::string (KTX_SWIZZLE_KEY));
1474
- constant (" WriterKey" , std::string (KTX_WRITER_KEY));
1475
- constant (" FaceSliceWholeLevel" , KTX_FACESLICE_WHOLE_LEVEL);
1476
- constant (" Etc1SDefaultCompressionLevel" , KTX_ETC1S_DEFAULT_COMPRESSION_LEVEL);
1472
+ constant (" ANIMDATA_KEY" , std::string (KTX_ANIMDATA_KEY));
1473
+ constant (" ORIENTATION_KEY" , std::string (KTX_ORIENTATION_KEY));
1474
+ constant (" SWIZZLE_KEY" , std::string (KTX_SWIZZLE_KEY));
1475
+ constant (" WRITER_KEY" , std::string (KTX_WRITER_KEY));
1476
+ constant (" WRITER_SCPARAMS_KEY" , std::string (KTX_WRITER_SCPARAMS_KEY));
1477
+ constant (" FACESLICE_WHOLE_lEVEL" , KTX_FACESLICE_WHOLE_LEVEL);
1478
+ constant (" ETC1S_DEFAULT_COMPRESSION_LEVEL" , KTX_ETC1S_DEFAULT_COMPRESSION_LEVEL);
1477
1479
#endif
1478
1480
}
0 commit comments