diff --git a/README.md b/README.md index 5725859..bb2a0dd 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,11 @@ delays can result in transient errors that can be difficult to diagnose when new Draco releases are launched. To avoid the issue pin your sites to a versioned release. +### Version 1.5.2 release +* This is the same as v1.5.1 with the following two bug fixes: + * Fixes DRACO_TRANSCODER_SUPPORTED enabled builds. + * ABI version updated. + ### Version 1.5.1 release * Adds assertion enabled Emscripten builds to the release, and a subset of the assertion enabled builds to GStatic. See the file listing below. diff --git a/cmake/draco_build_definitions.cmake b/cmake/draco_build_definitions.cmake index c00bf83..6c972df 100644 --- a/cmake/draco_build_definitions.cmake +++ b/cmake/draco_build_definitions.cmake @@ -60,7 +60,7 @@ macro(draco_set_build_definitions) # passed to libtool. # # We set DRACO_SOVERSION = [c-a].a.r - set(LT_CURRENT 3) + set(LT_CURRENT 4) set(LT_REVISION 0) set(LT_AGE 0) math(EXPR DRACO_SOVERSION_MAJOR "${LT_CURRENT} - ${LT_AGE}") diff --git a/javascript/npm/draco3d/README.md b/javascript/npm/draco3d/README.md index 139d33e..d535060 100644 --- a/javascript/npm/draco3d/README.md +++ b/javascript/npm/draco3d/README.md @@ -6,7 +6,7 @@ News ======= -Check out the [README](https://github.com/google/draco/blob/1.5.1/README.md) +Check out the [README](https://github.com/google/draco/blob/1.5.2/README.md) file for news about this release. Description diff --git a/javascript/npm/draco3d/package.json b/javascript/npm/draco3d/package.json index 499a5ea..aca7688 100644 --- a/javascript/npm/draco3d/package.json +++ b/javascript/npm/draco3d/package.json @@ -1,6 +1,6 @@ { "name": "draco3d", - "version": "1.5.1", + "version": "1.5.2", "description": "Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.", "main": "draco3d.js", "scripts": { diff --git a/javascript/npm/draco3dgltf/README.md b/javascript/npm/draco3dgltf/README.md index 5ef560f..f290511 100644 --- a/javascript/npm/draco3dgltf/README.md +++ b/javascript/npm/draco3dgltf/README.md @@ -24,7 +24,7 @@ Draco github glTF branch URL: https://github.com/google/draco/tree/gltf_2.0_drac News ======= -Check out the [README](https://github.com/google/draco/blob/1.5.1/README.md) +Check out the [README](https://github.com/google/draco/blob/1.5.2/README.md) file for news about this release. NPM Package diff --git a/javascript/npm/draco3dgltf/package.json b/javascript/npm/draco3dgltf/package.json index eb8790b..8074368 100644 --- a/javascript/npm/draco3dgltf/package.json +++ b/javascript/npm/draco3dgltf/package.json @@ -1,6 +1,6 @@ { "name": "draco3dgltf", - "version": "1.5.1", + "version": "1.5.2", "description": "This package contains a specific version of Draco 3D geometric compression library that is used for glTF Draco mesh compression extension.", "main": "draco3dgltf.js", "scripts": { diff --git a/maya/draco_maya_wrapper_macos.tar.bz b/maya/draco_maya_wrapper_macos.tar.bz index 7f8bde3..94662c1 100644 Binary files a/maya/draco_maya_wrapper_macos.tar.bz and b/maya/draco_maya_wrapper_macos.tar.bz differ diff --git a/maya/draco_maya_wrapper_windows.tar.bz b/maya/draco_maya_wrapper_windows.tar.bz index 53c5bf6..0ae4196 100644 Binary files a/maya/draco_maya_wrapper_windows.tar.bz and b/maya/draco_maya_wrapper_windows.tar.bz differ diff --git a/src/draco/core/draco_version.h b/src/draco/core/draco_version.h index 82e5d6b..5f2676a 100644 --- a/src/draco/core/draco_version.h +++ b/src/draco/core/draco_version.h @@ -18,7 +18,7 @@ namespace draco { // Draco version is comprised of ... -static const char kDracoVersion[] = "1.5.1"; +static const char kDracoVersion[] = "1.5.2"; const char *Version() { return kDracoVersion; } diff --git a/src/draco/texture/texture_utils.cc b/src/draco/texture/texture_utils.cc index 498051c..019af42 100644 --- a/src/draco/texture/texture_utils.cc +++ b/src/draco/texture/texture_utils.cc @@ -99,6 +99,21 @@ std::string TextureUtils::GetExtension(ImageFormat format) { } } +int TextureUtils::ComputeRequiredNumChannels( + const Texture &texture, const MaterialLibrary &material_library) { + // TODO(vytyaz): Consider a case where |texture| is not only used in OMR but + // also in other texture map types. + const auto mr_textures = TextureUtils::FindTextures( + TextureMap::METALLIC_ROUGHNESS, &material_library); + if (std::find(mr_textures.begin(), mr_textures.end(), &texture) == + mr_textures.end()) { + // Occlusion-only texture. + return 1; + } + // Occlusion-metallic-roughness texture. + return 3; +} + std::vector TextureUtils::FindTextures( const TextureMap::Type texture_type, const MaterialLibrary *material_library) { diff --git a/src/draco/texture/texture_utils.h b/src/draco/texture/texture_utils.h index 4b4f8bb..18d2995 100644 --- a/src/draco/texture/texture_utils.h +++ b/src/draco/texture/texture_utils.h @@ -60,6 +60,13 @@ class TextureUtils { // extension is returned when the |format| is NONE. static std::string GetExtension(ImageFormat format); + // Returns the number of channels required for encoding a |texture| from a + // given |material_library|, taking into account texture opacity and assuming + // that occlusion and metallic-roughness texture maps may share a texture. + // TODO(vytyaz): Move this and FindTextures() to MaterialLibrary class. + static int ComputeRequiredNumChannels( + const Texture &texture, const MaterialLibrary &material_library); + static std::vector FindTextures( const TextureMap::Type texture_type, const MaterialLibrary *material_library); diff --git a/testdata/CubeScaledInstances/glTF/buffer0.bin b/testdata/CubeScaledInstances/glTF/buffer0.bin new file mode 100644 index 0000000..0d4f5e9 Binary files /dev/null and b/testdata/CubeScaledInstances/glTF/buffer0.bin differ diff --git a/testdata/CubeScaledInstances/glTF/cube_att.gltf b/testdata/CubeScaledInstances/glTF/cube_att.gltf new file mode 100644 index 0000000..c02f784 --- /dev/null +++ b/testdata/CubeScaledInstances/glTF/cube_att.gltf @@ -0,0 +1,165 @@ +{ + "asset": { + "version": "2.0", + "generator": "draco_decoder" + }, + "scenes": [ + { + "nodes": [ + 0 + ] + } + ], + "scene": 0, + "nodes": [ + { + "children": [1, 2, 3, 4] + }, + { + "children": [5] + }, + { + "translation": [0.0, 2.0, 0.0], + "scale": [4, 4, 4], + "children": [5] + }, + { + "translation": [2.0, 0.0, 0.0], + "scale": [2, 2, 2], + "children": [5] + }, + { + "translation": [-2.0, 0.0, 0.0], + "scale": [3, 3, 3], + "children": [5] + }, + { + "mesh": 0 + } + ], + "meshes": [ + { + "primitives": [ + { + "attributes": { + "NORMAL": 2, + "POSITION": 1, + "TEXCOORD_0": 3 + }, + "indices": 0, + "mode": 4, + "material": 0 + } + ] + } + ], + "materials": [ + { + "pbrMetallicRoughness": { + "baseColorFactor": [ + 0.75, + 0.75, + 0.75, + 1 + ], + "metallicFactor": 0 + } + } + ], + "accessors": [ + { + "bufferView": 0, + "byteOffset": 0, + "componentType": 5121, + "count": 36, + "normalized": false, + "max": [ + 23 + ], + "min": [ + 0 + ], + "type": "SCALAR" + }, + { + "bufferView": 1, + "byteOffset": 0, + "componentType": 5126, + "count": 24, + "normalized": false, + "max": [ + 1, + 1, + 1 + ], + "min": [ + 0, + 0, + 0 + ], + "type": "VEC3" + }, + { + "bufferView": 2, + "byteOffset": 0, + "componentType": 5126, + "count": 24, + "normalized": false, + "max": [ + 1, + 1, + 1 + ], + "min": [ + -1, + -1, + -1 + ], + "type": "VEC3" + }, + { + "bufferView": 3, + "byteOffset": 0, + "componentType": 5126, + "count": 24, + "normalized": false, + "max": [ + 1, + 1 + ], + "min": [ + 0, + 0 + ], + "type": "VEC2" + } + ], + "bufferViews": [ + { + "buffer": 0, + "byteOffset": 0, + "byteLength": 36 + }, + { + "buffer": 0, + "byteOffset": 36, + "byteLength": 288 + }, + { + "buffer": 0, + "byteOffset": 324, + "byteLength": 288 + }, + { + "buffer": 0, + "byteOffset": 612, + "byteLength": 192 + } + ], + "buffers": [ + { + "byteLength": 804, + "uri": "buffer0.bin" + } + ] +} diff --git a/testdata/KhronosSampleModels/DragonAttenuation/glTF/DragonAttenuation.bin b/testdata/KhronosSampleModels/DragonAttenuation/glTF/DragonAttenuation.bin new file mode 100644 index 0000000..79420e9 Binary files /dev/null and b/testdata/KhronosSampleModels/DragonAttenuation/glTF/DragonAttenuation.bin differ diff --git a/testdata/KhronosSampleModels/DragonAttenuation/glTF/DragonAttenuation.gltf b/testdata/KhronosSampleModels/DragonAttenuation/glTF/DragonAttenuation.gltf new file mode 100644 index 0000000..6a3efae --- /dev/null +++ b/testdata/KhronosSampleModels/DragonAttenuation/glTF/DragonAttenuation.gltf @@ -0,0 +1,329 @@ +{ + "asset" : { + "generator" : "Khronos glTF Blender I/O v1.5.17, with hand-edits for newer glTF extensions.", + "version" : "2.0" + }, + "extensionsUsed": [ + "KHR_materials_transmission", + "KHR_materials_volume", + "KHR_materials_variants" + ], + "extensions": { + "KHR_materials_variants": { + "variants": [ + { + "name": "Attenuation" + }, + { + "name": "Surface Color" + } + ] + } + }, + "scene": 0, + "scenes" : [ + { + "name" : "Scene", + "nodes" : [ + 0, + 1 + ] + } + ], + "nodes" : [ + { + "mesh" : 0, + "name" : "Cloth Backdrop", + "scale" : [ + 3.5, + 3.5, + 3.5 + ], + "translation" : [ + -0.15470129251480103, + -0.841584324836731, + -0.1703687310218811 + ] + }, + { + "mesh" : 1, + "name" : "Dragon", + "rotation" : [ + 0.7071068286895752, + 0, + 0, + 0.7071068286895752 + ], + "scale" : [ + 0.25, + 0.25, + 0.25 + ], + "translation" : [ + 0, + -0.7306479811668396, + 0 + ] + } + ], + "materials" : [ + { + "name" : "Cloth Backdrop", + "pbrMetallicRoughness" : { + "baseColorTexture" : { + "index" : 0 + }, + "metallicFactor" : 0, + "roughnessFactor" : 0.4934999942779541 + } + }, + { + "name": "Dragon with Attenuation", + "pbrMetallicRoughness": { + "baseColorFactor": [ + 1, + 1, + 1, + 1 + ], + "metallicFactor": 0, + "roughnessFactor": 0 + }, + "extensions": { + "KHR_materials_transmission": { + "transmissionFactor": 1 + }, + "KHR_materials_volume": { + "attenuationColor": [ + 0.921, + 0.640, + 0.064 + ], + "attenuationDistance": 0.155, + "thicknessFactor": 2.27, + "thicknessTexture": { + "index": 1, + "texCoord": 0 + } + } + } + }, + { + "name": "Dragon with Surface Coloring Only", + "pbrMetallicRoughness": { + "baseColorFactor": [ + 0.921, + 0.640, + 0.064, + 1 + ], + "metallicFactor": 0, + "roughnessFactor": 0 + }, + "extensions": { + "KHR_materials_transmission": { + "transmissionFactor": 1 + }, + "KHR_materials_volume": { + "thicknessFactor": 2.27, + "thicknessTexture": { + "index": 1, + "texCoord": 0 + } + } + } + } + ], + "meshes" : [ + { + "name" : "Cloth Backdrop", + "primitives" : [ + { + "attributes" : { + "POSITION" : 0, + "NORMAL" : 1, + "TEXCOORD_0" : 2 + }, + "indices" : 3, + "material" : 0 + } + ] + }, + { + "name" : "Dragon", + "primitives" : [ + { + "attributes" : { + "POSITION" : 4, + "NORMAL" : 5, + "TEXCOORD_0" : 6 + }, + "indices" : 7, + "material" : 1, + "extensions": { + "KHR_materials_variants": { + "mappings": [ + { + "material": 1, + "variants": [ + 0 + ] + }, + { + "material": 2, + "variants": [ + 1 + ] + } + ] + } + } + } + ] + } + ], + "textures" : [ + { + "sampler" : 0, + "source" : 0 + }, + { + "sampler" : 0, + "source" : 1 + } + ], + "images" : [ + { + "mimeType" : "image/jpeg", + "uri" : "checkerboard.jpg" + }, + { + "mimeType" : "image/jpeg", + "uri" : "Dragon_ThicknessMap.jpg" + } + ], + "accessors" : [ + { + "bufferView" : 0, + "componentType" : 5126, + "count" : 62570, + "max" : [ + 0.9809443354606628, + 1.0221298933029175, + 1.4283748865127563 + ], + "min" : [ + -0.8216659426689148, + 0.0015843699220567942, + -0.46063709259033203 + ], + "type" : "VEC3" + }, + { + "bufferView" : 1, + "componentType" : 5126, + "count" : 62570, + "type" : "VEC3" + }, + { + "bufferView" : 2, + "componentType" : 5126, + "count" : 62570, + "type" : "VEC2" + }, + { + "bufferView" : 3, + "componentType" : 5123, + "count" : 131337, + "type" : "SCALAR" + }, + { + "bufferView" : 4, + "componentType" : 5126, + "count" : 76809, + "max" : [ + 7.0467000007629395, + 3.1512999534606934, + 0 + ], + "min" : [ + -7.0467000007629395, + -3.1512999534606934, + -9.939900398254395 + ], + "type" : "VEC3" + }, + { + "bufferView" : 5, + "componentType" : 5126, + "count" : 76809, + "type" : "VEC3" + }, + { + "bufferView" : 6, + "componentType" : 5126, + "count" : 76809, + "type" : "VEC2" + }, + { + "bufferView" : 7, + "componentType" : 5125, + "count" : 273648, + "type" : "SCALAR" + } + ], + "bufferViews" : [ + { + "buffer" : 0, + "byteLength" : 750840, + "byteOffset" : 0 + }, + { + "buffer" : 0, + "byteLength" : 750840, + "byteOffset" : 750840 + }, + { + "buffer" : 0, + "byteLength" : 500560, + "byteOffset" : 1501680 + }, + { + "buffer" : 0, + "byteLength" : 262674, + "byteOffset" : 2002240 + }, + { + "buffer" : 0, + "byteLength" : 921708, + "byteOffset" : 2264916 + }, + { + "buffer" : 0, + "byteLength" : 921708, + "byteOffset" : 3186624 + }, + { + "buffer" : 0, + "byteLength" : 614472, + "byteOffset" : 4108332 + }, + { + "buffer" : 0, + "byteLength" : 1094592, + "byteOffset" : 4722804 + } + ], + "samplers" : [ + { + "magFilter" : 9729, + "minFilter" : 9987 + } + ], + "buffers" : [ + { + "byteLength" : 5817396, + "uri" : "DragonAttenuation.bin" + } + ] +} diff --git a/testdata/KhronosSampleModels/DragonAttenuation/glTF/Dragon_ThicknessMap.jpg b/testdata/KhronosSampleModels/DragonAttenuation/glTF/Dragon_ThicknessMap.jpg new file mode 100644 index 0000000..337c64a Binary files /dev/null and b/testdata/KhronosSampleModels/DragonAttenuation/glTF/Dragon_ThicknessMap.jpg differ diff --git a/testdata/KhronosSampleModels/DragonAttenuation/glTF/checkerboard.jpg b/testdata/KhronosSampleModels/DragonAttenuation/glTF/checkerboard.jpg new file mode 100644 index 0000000..477384a Binary files /dev/null and b/testdata/KhronosSampleModels/DragonAttenuation/glTF/checkerboard.jpg differ diff --git a/testdata/KhronosSampleModels/DragonAttenuation/glTF_Binary/DragonAttenuation.glb b/testdata/KhronosSampleModels/DragonAttenuation/glTF_Binary/DragonAttenuation.glb new file mode 100644 index 0000000..9efb7db Binary files /dev/null and b/testdata/KhronosSampleModels/DragonAttenuation/glTF_Binary/DragonAttenuation.glb differ diff --git a/testdata/sphere_lights.gltf b/testdata/sphere_lights.gltf new file mode 100644 index 0000000..eabb190 --- /dev/null +++ b/testdata/sphere_lights.gltf @@ -0,0 +1,288 @@ +{ + "asset": { + "version": "2.0", + "generator": "draco_decoder" + }, + "extensionsUsed": [ + "KHR_lights_punctual" + ], + "extensions": { + "KHR_lights_punctual": { + "lights": [ + { + "name": "Blue Lightsaber", + "type": "spot", + "intensity": 3, + "color": [ + 0.72, + 0.71, + 1.00 + ], + "range": 100, + "spot": { + "innerConeAngle": 0.2, + "outerConeAngle": 0.8 + } + }, + { + "name": "The Star of Earendil", + "type": "point", + "intensity": 5.0, + "color": [ + 0.90, + 0.97, + 1.00 + ], + "range": 1000 + }, + { + "name": "Arc Reactor", + "type": "directional", + "color": [ + 0.9, + 0.9, + 0.9 + ], + "range": 200 + }, + { + "type": "spot", + "spot": { + } + } + ] + } + }, + "scenes": [ + { + "nodes": [ + 0, + 1 + ] + } + ], + "scene": 0, + "nodes": [ + { + "mesh": 0 + }, + { + "translation": [ + 0, + 0, + 0 + ], + "rotation": [ + -0.13959079166529637, + -0.6590063691119785, + -0.12632793024247307, + 0.7281938412213848 + ], + "scale": [ + 1, + 1, + 1 + ], + "extensions": { + "KHR_lights_punctual": { + "light": 0 + } + }, + "children": [ + 2, + 3 + ] + }, + { + "extensions": { + "KHR_lights_punctual": { + "light": 2 + } + } + }, + { + "extensions": { + "KHR_lights_punctual": { + "light": 3 + } + }, + "children": [ + 4 + ] + }, + { + "extensions": { + "KHR_lights_punctual": { + "light": 1 + } + } + } + ], + "meshes": [ + { + "primitives": [ + { + "attributes": { + "NORMAL": 2, + "POSITION": 1, + "TANGENT": 4, + "TEXCOORD_0": 3 + }, + "indices": 0, + "mode": 4, + "material": 0 + } + ] + } + ], + "materials": [ + { + "normalTexture": { + "index": 0 + }, + "pbrMetallicRoughness": { + "baseColorTexture": { + "index": 1 + }, + "metallicFactor": 0 + } + } + ], + "textures": [ + { + "source": 0 + }, + { + "source": 1 + } + ], + "images": [ + { + "uri": "sphere_Texture0_Normal.png" + }, + { + "uri": "sphere_Texture1_BaseColor.png" + } + ], + "accessors": [ + { + "bufferView": 0, + "byteOffset": 0, + "componentType": 5121, + "count": 672, + "normalized": false, + "max": [ + 230 + ], + "min": [ + 0 + ], + "type": "SCALAR" + }, + { + "bufferView": 1, + "byteOffset": 0, + "componentType": 5126, + "count": 231, + "normalized": false, + "max": [ + 1, + 1, + 1 + ], + "min": [ + -1, + -1, + -1 + ], + "type": "VEC3" + }, + { + "bufferView": 2, + "byteOffset": 0, + "componentType": 5126, + "count": 231, + "normalized": false, + "max": [ + 1, + 1, + 1 + ], + "min": [ + -1, + -1, + -1 + ], + "type": "VEC3" + }, + { + "bufferView": 3, + "byteOffset": 0, + "componentType": 5126, + "count": 231, + "normalized": false, + "max": [ + 0.920301, + 0.991284 + ], + "min": [ + 0.00871642, + 0.00967127 + ], + "type": "VEC2" + }, + { + "bufferView": 4, + "byteOffset": 0, + "componentType": 5126, + "count": 231, + "normalized": false, + "max": [ + 0.997891, + 0.961565, + 0.962921, + 1 + ], + "min": [ + -0.926271, + -0.9153, + -0.994848, + 1 + ], + "type": "VEC4" + } + ], + "bufferViews": [ + { + "buffer": 0, + "byteOffset": 0, + "byteLength": 672 + }, + { + "buffer": 0, + "byteOffset": 672, + "byteLength": 2772 + }, + { + "buffer": 0, + "byteOffset": 3444, + "byteLength": 2772 + }, + { + "buffer": 0, + "byteOffset": 6216, + "byteLength": 1848 + }, + { + "buffer": 0, + "byteOffset": 8064, + "byteLength": 3696 + } + ], + "buffers": [ + { + "byteLength": 11760, + "uri": "sphere_buffer0.bin" + } + ] +} diff --git a/unity/Plugin/libdracodec_unity_android.tar.bz b/unity/Plugin/libdracodec_unity_android.tar.bz index 16b7705..c6b803b 100644 Binary files a/unity/Plugin/libdracodec_unity_android.tar.bz and b/unity/Plugin/libdracodec_unity_android.tar.bz differ diff --git a/unity/Plugin/libdracodec_unity_ios.tar.bz b/unity/Plugin/libdracodec_unity_ios.tar.bz index c5093fe..4851381 100644 Binary files a/unity/Plugin/libdracodec_unity_ios.tar.bz and b/unity/Plugin/libdracodec_unity_ios.tar.bz differ diff --git a/unity/Plugin/libdracodec_unity_macos.tar.bz b/unity/Plugin/libdracodec_unity_macos.tar.bz index 3180348..01d9384 100644 Binary files a/unity/Plugin/libdracodec_unity_macos.tar.bz and b/unity/Plugin/libdracodec_unity_macos.tar.bz differ diff --git a/unity/Plugin/libdracodec_unity_windows.tar.bz b/unity/Plugin/libdracodec_unity_windows.tar.bz index 36985ef..294a870 100644 Binary files a/unity/Plugin/libdracodec_unity_windows.tar.bz and b/unity/Plugin/libdracodec_unity_windows.tar.bz differ