Ver código fonte

Refactoring, dead code elimination, removal of DirectXTex (no texture conversion)

Simon Ferquel 10 anos atrás
pai
commit
c7edc58f37
70 arquivos alterados com 416 adições e 84743 exclusões
  1. 0 1141
      Exporters/FBX/3rdParty/DirectXTex/BC.cpp
  2. 0 892
      Exporters/FBX/3rdParty/DirectXTex/BC.h
  3. 0 548
      Exporters/FBX/3rdParty/DirectXTex/BC4BC5.cpp
  4. 0 2871
      Exporters/FBX/3rdParty/DirectXTex/BC6HBC7.cpp
  5. 0 604
      Exporters/FBX/3rdParty/DirectXTex/BCDirectCompute.cpp
  6. 0 68
      Exporters/FBX/3rdParty/DirectXTex/BCDirectCompute.h
  7. 0 239
      Exporters/FBX/3rdParty/DirectXTex/DDS.h
  8. 0 616
      Exporters/FBX/3rdParty/DirectXTex/DirectXTex.h
  9. 0 352
      Exporters/FBX/3rdParty/DirectXTex/DirectXTex.inl
  10. 0 809
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexCompress.cpp
  11. 0 402
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexCompressGPU.cpp
  12. 0 4515
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexConvert.cpp
  13. 0 875
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexD3D11.cpp
  14. 0 2002
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexDDS.cpp
  15. 0 331
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexFlipRotate.cpp
  16. 0 821
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexImage.cpp
  17. 0 3051
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexMipmaps.cpp
  18. 0 354
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexMisc.cpp
  19. 0 383
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexNormalMaps.cpp
  20. 0 209
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexP.h
  21. 0 229
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexPMAlpha.cpp
  22. 0 1034
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexResize.cpp
  23. 0 1391
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexTGA.cpp
  24. 0 1029
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexUtil.cpp
  25. 0 1128
      Exporters/FBX/3rdParty/DirectXTex/DirectXTexWIC.cpp
  26. 0 432
      Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2012.vcxproj
  27. 0 38
      Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2012.vcxproj.filters
  28. 0 436
      Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2013.vcxproj
  29. 0 38
      Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2013.vcxproj.filters
  30. 0 424
      Exporters/FBX/3rdParty/DirectXTex/Filters.h
  31. 0 2566
      Exporters/FBX/3rdParty/DirectXTex/Shaders/BC6HEncode.hlsl
  32. 0 1907
      Exporters/FBX/3rdParty/DirectXTex/Shaders/BC7Encode.hlsl
  33. 0 37
      Exporters/FBX/3rdParty/DirectXTex/Shaders/CompileShaders.cmd
  34. 0 22215
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc
  35. 0 3375
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC6HEncode_TryModeG10CS.inc
  36. 0 5103
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC6HEncode_TryModeLE10CS.inc
  37. 0 10152
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_EncodeBlockCS.inc
  38. 0 3824
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_TryMode02CS.inc
  39. 0 3962
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_TryMode137CS.inc
  40. 0 3027
      Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_TryMode456CS.inc
  41. 0 34
      Exporters/FBX/3rdParty/DirectXTex/scoped.h
  42. 2 28
      Exporters/FBX/BabylonFBXExporter.sln
  43. 2 0
      Exporters/FBX/BabylonFbxNative/BabylonAbstractMesh.h
  44. 15 31
      Exporters/FBX/BabylonFbxNative/BabylonAnimation.h
  45. 26 0
      Exporters/FBX/BabylonFbxNative/BabylonCamera.cpp
  46. 2 0
      Exporters/FBX/BabylonFbxNative/BabylonCamera.h
  47. 0 11
      Exporters/FBX/BabylonFbxNative/BabylonFbxNative.vcxproj
  48. 0 18
      Exporters/FBX/BabylonFbxNative/BabylonFbxNative.vcxproj.filters
  49. 35 0
      Exporters/FBX/BabylonFbxNative/BabylonLight.cpp
  50. 5 1
      Exporters/FBX/BabylonFbxNative/BabylonLight.h
  51. 52 0
      Exporters/FBX/BabylonFbxNative/BabylonMaterial.cpp
  52. 7 1
      Exporters/FBX/BabylonFbxNative/BabylonMaterial.h
  53. 45 1
      Exporters/FBX/BabylonFbxNative/BabylonMesh.cpp
  54. 7 4
      Exporters/FBX/BabylonFbxNative/BabylonMesh.h
  55. 6 0
      Exporters/FBX/BabylonFbxNative/BabylonNode.cpp
  56. 2 0
      Exporters/FBX/BabylonFbxNative/BabylonNode.h
  57. 160 0
      Exporters/FBX/BabylonFbxNative/BabylonScene.cpp
  58. 6 0
      Exporters/FBX/BabylonFbxNative/BabylonScene.h
  59. 17 1
      Exporters/FBX/BabylonFbxNative/BabylonSkeleton.h
  60. 0 190
      Exporters/FBX/BabylonFbxNative/Export.h
  61. 0 209
      Exporters/FBX/BabylonFbxNative/FbxMaterialHandler.cpp
  62. 0 32
      Exporters/FBX/BabylonFbxNative/FbxMaterialHandler.h
  63. 0 227
      Exporters/FBX/BabylonFbxNative/FbxMeshLoader.h
  64. 2 15
      Exporters/FBX/BabylonFbxNative/FbxSceneLoader.cpp
  65. 0 110
      Exporters/FBX/BabylonFbxNative/FbxVertexKey.cpp
  66. 0 26
      Exporters/FBX/BabylonFbxNative/FbxVertexKey.h
  67. 0 157
      Exporters/FBX/BabylonFbxNative/NodeHelpers.h
  68. 22 0
      Exporters/FBX/BabylonFbxNative/SkinInfo.h
  69. 3 214
      Exporters/FBX/FbxExporter/FbxExporter.cpp
  70. 0 3
      Exporters/FBX/FbxExporter/FbxExporter.vcxproj

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1141
Exporters/FBX/3rdParty/DirectXTex/BC.cpp


+ 0 - 892
Exporters/FBX/3rdParty/DirectXTex/BC.h

@@ -1,892 +0,0 @@
-//-------------------------------------------------------------------------------------
-// BC.h
-//  
-// Block-compression (BC) functionality
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//  
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-#include <assert.h>
-#include <directxmath.h>
-#include <directxpackedvector.h>
-
-namespace DirectX
-{
-
-//-------------------------------------------------------------------------------------
-// Constants
-//-------------------------------------------------------------------------------------
-
-const uint16_t F16S_MASK    = 0x8000;   // f16 sign mask
-const uint16_t F16EM_MASK   = 0x7fff;   // f16 exp & mantissa mask
-const uint16_t F16MAX       = 0x7bff;   // MAXFLT bit pattern for XMHALF
-
-#define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x))
-
-// Because these are used in SAL annotations, they need to remain macros rather than const values
-#define NUM_PIXELS_PER_BLOCK 16
-#define BC6H_MAX_REGIONS 2
-#define BC6H_MAX_INDICES 16
-#define BC7_MAX_REGIONS 3
-#define BC7_MAX_INDICES 16
-
-const size_t BC6H_NUM_CHANNELS = 3;
-const size_t BC6H_MAX_SHAPES = 32;
-
-const size_t BC7_NUM_CHANNELS = 4;
-const size_t BC7_MAX_SHAPES = 64;
-
-const int32_t BC67_WEIGHT_MAX = 64;
-const uint32_t BC67_WEIGHT_SHIFT = 6;
-const int32_t BC67_WEIGHT_ROUND = 32;
-
-extern const int g_aWeights2[4];
-extern const int g_aWeights3[8];
-extern const int g_aWeights4[16];
-
-enum BC_FLAGS
-{
-    BC_FLAGS_NONE       = 0x0,
-    BC_FLAGS_DITHER_RGB = 0x10000,  // Enables dithering for RGB colors for BC1-3
-    BC_FLAGS_DITHER_A   = 0x20000,  // Enables dithering for Alpha channel for BC1-3
-    BC_FLAGS_UNIFORM    = 0x40000,  // By default, uses perceptual weighting for BC1-3; this flag makes it a uniform weighting
-};
-
-//-------------------------------------------------------------------------------------
-// Structures
-//-------------------------------------------------------------------------------------
-class HDRColorA;
-
-class LDRColorA
-{
-public:
-    uint8_t r, g, b, a;
-
-    LDRColorA() {}
-    LDRColorA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {}
-
-    const uint8_t& operator [] (_In_range_(0,3) size_t uElement) const
-    {
-        switch(uElement)
-        {
-        case 0: return r;
-        case 1: return g;
-        case 2: return b;
-        case 3: return a;
-        default: assert(false); return r;
-        }
-    }
-
-    uint8_t& operator [] (_In_range_(0,3) size_t uElement)
-    {
-        switch(uElement)
-        {
-        case 0: return r;
-        case 1: return g;
-        case 2: return b;
-        case 3: return a;
-        default: assert(false); return r;
-        }
-    }
-
-    LDRColorA operator = (_In_ const HDRColorA& c);
-
-    static void InterpolateRGB(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wc, _In_ _In_range_(2, 4) size_t wcprec, _Out_ LDRColorA& out)
-    {
-        const int* aWeights = nullptr;
-        switch(wcprec)
-        {
-        case 2: aWeights = g_aWeights2; assert( wc < 4 ); _Analysis_assume_( wc < 4 ); break;
-        case 3: aWeights = g_aWeights3; assert( wc < 8 ); _Analysis_assume_( wc < 8 ); break;
-        case 4: aWeights = g_aWeights4; assert( wc < 16 ); _Analysis_assume_( wc < 16 ); break;
-        default: assert(false); out.r = out.g = out.b = 0; return;
-        }
-        out.r = uint8_t((uint32_t(c0.r) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.r) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
-        out.g = uint8_t((uint32_t(c0.g) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.g) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
-        out.b = uint8_t((uint32_t(c0.b) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.b) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
-    }
-
-    static void InterpolateA(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wa, _In_range_(2, 4) _In_ size_t waprec, _Out_ LDRColorA& out)
-    {
-        const int* aWeights = nullptr;
-        switch(waprec)
-        {
-        case 2: aWeights = g_aWeights2; assert( wa < 4 ); _Analysis_assume_( wa < 4 ); break;
-        case 3: aWeights = g_aWeights3; assert( wa < 8 ); _Analysis_assume_( wa < 8 ); break;
-        case 4: aWeights = g_aWeights4; assert( wa < 16 ); _Analysis_assume_( wa < 16 ); break;
-        default: assert(false); out.a = 0; return;
-        }
-        out.a = uint8_t((uint32_t(c0.a) * uint32_t(BC67_WEIGHT_MAX - aWeights[wa]) + uint32_t(c1.a) * uint32_t(aWeights[wa]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
-    }
-
-    static void Interpolate(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wc, _In_ size_t wa, _In_ _In_range_(2, 4) size_t wcprec, _In_ _In_range_(2, 4) size_t waprec, _Out_ LDRColorA& out)
-    {
-        InterpolateRGB(c0, c1, wc, wcprec, out);
-        InterpolateA(c0, c1, wa, waprec, out);
-    }
-};
-
-static_assert( sizeof(LDRColorA) == 4, "Unexpected packing");
-
-class HDRColorA
-{
-public:
-    float r, g, b, a;
-
-public:
-    HDRColorA() {}
-    HDRColorA(float _r, float _g, float _b, float _a) : r(_r), g(_g), b(_b), a(_a) {}
-    HDRColorA(const HDRColorA& c) : r(c.r), g(c.g), b(c.b), a(c.a) {}
-    HDRColorA(const LDRColorA& c)
-    {
-        r = float(c.r) * (1.0f/255.0f);
-        g = float(c.g) * (1.0f/255.0f);
-        b = float(c.b) * (1.0f/255.0f);
-        a = float(c.a) * (1.0f/255.0f);
-    }
-
-    // binary operators
-    HDRColorA operator + ( _In_ const HDRColorA& c ) const
-    {
-        return HDRColorA(r + c.r, g + c.g, b + c.b, a + c.a);
-    }
-
-    HDRColorA operator - ( _In_ const HDRColorA& c ) const
-    {
-        return HDRColorA(r - c.r, g - c.g, b - c.b, a - c.a);
-    }
-
-    HDRColorA operator * ( _In_ float f ) const
-    {
-        return HDRColorA(r * f, g * f, b * f, a * f);
-    }
-
-    HDRColorA operator / ( _In_ float f ) const
-    {
-        float fInv = 1.0f / f;
-        return HDRColorA(r * fInv, g * fInv, b * fInv, a * fInv);
-    }
-
-    float operator * ( _In_ const HDRColorA& c ) const
-    {
-        return r * c.r + g * c.g + b * c.b + a * c.a;
-    }
-
-    // assignment operators
-    HDRColorA& operator += ( _In_ const HDRColorA& c )
-    {
-        r += c.r;
-        g += c.g;
-        b += c.b;
-        a += c.a;
-        return *this;
-    }
-    
-    HDRColorA& operator -= ( _In_ const HDRColorA& c )
-    {
-        r -= c.r;
-        g -= c.g;
-        b -= c.b;
-        a -= c.a;
-        return *this;
-    }
-    
-    HDRColorA& operator *= ( _In_ float f )
-    {
-        r *= f;
-        g *= f;
-        b *= f;
-        a *= f;
-        return *this;
-    }
-    
-    HDRColorA& operator /= ( _In_ float f )
-    {
-        float fInv = 1.0f / f;
-        r *= fInv;
-        g *= fInv;
-        b *= fInv;
-        a *= fInv;
-        return *this;
-    }
-
-    HDRColorA& operator = (_In_ const LDRColorA& c)
-    {
-        r = (float) c.r;
-        g = (float) c.g;
-        b = (float) c.b;
-        a = (float) c.a;
-        return *this;
-    }
-
-    HDRColorA& Clamp(_In_ float fMin, _In_ float fMax)
-    {
-        r = std::min<float>(fMax, std::max<float>(fMin, r));
-        g = std::min<float>(fMax, std::max<float>(fMin, g));
-        b = std::min<float>(fMax, std::max<float>(fMin, b));
-        a = std::min<float>(fMax, std::max<float>(fMin, a));
-        return *this;
-    }
-
-    LDRColorA ToLDRColorA() const
-    {
-        return LDRColorA((uint8_t) (r + 0.01f), (uint8_t) (g + 0.01f), (uint8_t) (b + 0.01f), (uint8_t) (a + 0.01f));
-    }
-};
-
-inline LDRColorA LDRColorA::operator = (_In_ const HDRColorA& c)
-{
-    LDRColorA ret;
-    HDRColorA tmp(c);
-    tmp = tmp.Clamp(0.0f, 1.0f) * 255.0f;
-    ret.r = uint8_t(tmp.r + 0.001f);
-    ret.g = uint8_t(tmp.g + 0.001f);
-    ret.b = uint8_t(tmp.b + 0.001f);
-    ret.a = uint8_t(tmp.a + 0.001f);
-    return ret;
-}
-
-struct LDREndPntPair
-{
-    LDRColorA A;
-    LDRColorA B;
-};
-
-struct HDREndPntPair
-{
-    HDRColorA A;
-    HDRColorA B;
-};
-
-inline HDRColorA* HDRColorALerp(_Out_ HDRColorA *pOut, _In_ const HDRColorA *pC1, _In_ const HDRColorA *pC2, _In_ float s)
-{
-    pOut->r = pC1->r + s * (pC2->r - pC1->r);
-    pOut->g = pC1->g + s * (pC2->g - pC1->g);
-    pOut->b = pC1->b + s * (pC2->b - pC1->b);
-    pOut->a = pC1->a + s * (pC2->a - pC1->a);
-    return pOut;
-}
-
-#pragma pack(push,1)
-// BC1/DXT1 compression (4 bits per texel)
-struct D3DX_BC1
-{
-    uint16_t    rgb[2]; // 565 colors
-    uint32_t    bitmap; // 2bpp rgb bitmap
-};
-
-// BC2/DXT2/3 compression (8 bits per texel)
-struct D3DX_BC2
-{
-    uint32_t    bitmap[2];  // 4bpp alpha bitmap
-    D3DX_BC1    bc1;        // BC1 rgb data
-};
-
-// BC3/DXT4/5 compression (8 bits per texel)
-struct D3DX_BC3
-{
-    uint8_t     alpha[2];   // alpha values
-    uint8_t     bitmap[6];  // 3bpp alpha bitmap
-    D3DX_BC1    bc1;        // BC1 rgb data
-};
-#pragma pack(pop)
-
-class INTColor
-{
-public:
-    int r, g, b;
-    int pad;
-
-public:
-    INTColor() {}
-    INTColor(int nr, int ng, int nb) {r = nr; g = ng; b = nb;}
-    INTColor(const INTColor& c) {r = c.r; g = c.g; b = c.b;}
-
-    INTColor operator - ( _In_ const INTColor& c ) const
-    {
-        return INTColor(r - c.r, g - c.g, b - c.b);
-    }
-
-    INTColor& operator += ( _In_ const INTColor& c )
-    {
-        r += c.r;
-        g += c.g;
-        b += c.b;
-        return *this;
-    }
-
-    INTColor& operator -= ( _In_ const INTColor& c )
-    {
-        r -= c.r;
-        g -= c.g;
-        b -= c.b;
-        return *this;
-    }
-
-    INTColor& operator &= ( _In_ const INTColor& c )
-    {
-        r &= c.r;
-        g &= c.g;
-        b &= c.b;
-        return *this;
-    }
-
-    int& operator [] ( _In_ uint8_t i )
-    {
-        assert(i < sizeof(INTColor) / sizeof(int));
-        _Analysis_assume_(i < sizeof(INTColor) / sizeof(int));
-        return ((int*) this)[i];
-    }
-
-    void Set(_In_ const HDRColorA& c, _In_ bool bSigned)
-    {
-        PackedVector::XMHALF4 aF16;
-
-        XMVECTOR v = XMLoadFloat4( (const XMFLOAT4*)& c );
-        XMStoreHalf4( &aF16, v );
-
-        r = F16ToINT(aF16.x, bSigned);
-        g = F16ToINT(aF16.y, bSigned);
-        b = F16ToINT(aF16.z, bSigned);
-    }
-
-    INTColor& Clamp(_In_ int iMin, _In_ int iMax)
-    {
-        r = std::min<int>(iMax, std::max<int>(iMin, r));
-        g = std::min<int>(iMax, std::max<int>(iMin, g));
-        b = std::min<int>(iMax, std::max<int>(iMin, b));
-        return *this;
-    }
-
-    INTColor& SignExtend(_In_ const LDRColorA& Prec)
-    {
-        r = SIGN_EXTEND(r, Prec.r);
-        g = SIGN_EXTEND(g, Prec.g);
-        b = SIGN_EXTEND(b, Prec.b);
-        return *this;
-    }
-
-    void ToF16(_Out_writes_(3) PackedVector::HALF aF16[3], _In_ bool bSigned) const
-    {
-        aF16[0] = INT2F16(r, bSigned);
-        aF16[1] = INT2F16(g, bSigned);
-        aF16[2] = INT2F16(b, bSigned);
-    }
-
-private:
-    static int F16ToINT(_In_ const PackedVector::HALF& f, _In_ bool bSigned)
-    {
-        uint16_t input = *((const uint16_t*) &f);
-        int out, s;
-        if(bSigned)
-        {
-            s = input & F16S_MASK;
-            input &= F16EM_MASK;
-            if(input > F16MAX) out = F16MAX;
-            else out = input;
-            out = s ? -out : out;
-        }
-        else
-        {
-            if(input & F16S_MASK) out = 0;
-            else out = input;
-        }
-        return out;
-    }
-
-    static PackedVector::HALF INT2F16(_In_ int input, _In_ bool bSigned)
-    {
-        PackedVector::HALF h;
-        uint16_t out;
-        if(bSigned)
-        {
-            int s = 0;
-            if(input < 0)
-            {
-                s = F16S_MASK;
-                input = -input;
-            }
-            out = uint16_t(s | input);
-        }
-        else
-        {
-            assert(input >= 0 && input <= F16MAX);
-            out = (uint16_t) input;
-        }
-
-        *((uint16_t*) &h) = out;
-        return h;
-    }
-};
-
-static_assert( sizeof(INTColor) == 16, "Unexpected packing");
-
-struct INTEndPntPair
-{
-    INTColor A;
-    INTColor B;
-};
-
-template< size_t SizeInBytes >
-class CBits
-{
-public:
-    uint8_t GetBit(_Inout_ size_t& uStartBit) const
-    {
-        assert(uStartBit < 128);
-        _Analysis_assume_(uStartBit < 128);
-        size_t uIndex = uStartBit >> 3;
-        uint8_t ret = (m_uBits[uIndex] >> (uStartBit - (uIndex << 3))) & 0x01;
-        uStartBit++;
-        return ret;
-    }
-
-    uint8_t GetBits(_Inout_ size_t& uStartBit, _In_ size_t uNumBits) const
-    {
-        if(uNumBits == 0) return 0;
-        assert(uStartBit + uNumBits <= 128 && uNumBits <= 8);
-        _Analysis_assume_(uStartBit + uNumBits <= 128 && uNumBits <= 8);
-        uint8_t ret;
-        size_t uIndex = uStartBit >> 3;
-        size_t uBase = uStartBit - (uIndex << 3);
-        if(uBase + uNumBits > 8)
-        {
-            size_t uFirstIndexBits = 8 - uBase;
-            size_t uNextIndexBits = uNumBits - uFirstIndexBits;
-            ret = (m_uBits[uIndex] >> uBase) | ((m_uBits[uIndex+1] & ((1 << uNextIndexBits) - 1)) << uFirstIndexBits);
-        }
-        else
-        {
-            ret = (m_uBits[uIndex] >> uBase) & ((1 << uNumBits) - 1);
-        }
-        assert(ret < (1 << uNumBits));
-        uStartBit += uNumBits;
-        return ret;
-    }
-
-    void SetBit(_Inout_ size_t& uStartBit, _In_ uint8_t uValue)
-    {
-        assert(uStartBit < 128 && uValue < 2);
-        _Analysis_assume_(uStartBit < 128 && uValue < 2);
-        size_t uIndex = uStartBit >> 3;
-        size_t uBase = uStartBit - (uIndex << 3);
-        m_uBits[uIndex] &= ~(1 << uBase);
-        m_uBits[uIndex] |= uValue << uBase;
-        uStartBit++;
-    }
-
-    void SetBits(_Inout_ size_t& uStartBit, _In_ size_t uNumBits, _In_ uint8_t uValue)
-    {
-        if(uNumBits == 0)
-            return;
-        assert(uStartBit + uNumBits <= 128 && uNumBits <= 8);
-        _Analysis_assume_(uStartBit + uNumBits <= 128 && uNumBits <= 8);
-        assert(uValue < (1 << uNumBits));
-        size_t uIndex = uStartBit >> 3;
-        size_t uBase = uStartBit - (uIndex << 3);
-        if(uBase + uNumBits > 8)
-        {
-            size_t uFirstIndexBits = 8 - uBase;
-            size_t uNextIndexBits = uNumBits - uFirstIndexBits;
-            m_uBits[uIndex] &= ~(((1 << uFirstIndexBits) - 1) << uBase);
-            m_uBits[uIndex] |= uValue << uBase;
-            m_uBits[uIndex+1] &= ~((1 << uNextIndexBits) - 1);
-            m_uBits[uIndex+1] |= uValue >> uFirstIndexBits;
-        }
-        else
-        {
-            m_uBits[uIndex] &= ~(((1 << uNumBits) - 1) << uBase);
-            m_uBits[uIndex] |= uValue << uBase;
-        }
-        uStartBit += uNumBits;
-    }
-
-private:
-    uint8_t m_uBits[ SizeInBytes ];
-};
-
-// BC6H compression (16 bits per texel)
-class D3DX_BC6H : private CBits< 16 >
-{
-public:
-    void Decode(_In_ bool bSigned, _Out_writes_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut) const;
-    void Encode(_In_ bool bSigned, _In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pIn);
-
-private:
-#pragma warning(push)
-#pragma warning(disable : 4480)
-    enum EField : uint8_t
-    {
-        NA, // N/A
-        M,  // Mode
-        D,  // Shape
-        RW,
-        RX,
-        RY,
-        RZ,
-        GW,
-        GX,
-        GY,
-        GZ,
-        BW,
-        BX,
-        BY,
-        BZ,
-    };
-#pragma warning(pop)
-
-    struct ModeDescriptor
-    {
-        EField m_eField;
-        uint8_t   m_uBit;
-    };
-
-    struct ModeInfo
-    {
-        uint8_t uMode;
-        uint8_t uPartitions;
-        bool bTransformed;
-        uint8_t uIndexPrec;
-        LDRColorA RGBAPrec[BC6H_MAX_REGIONS][2];
-    };
-
-#pragma warning(push)
-#pragma warning(disable : 4512)
-    struct EncodeParams
-    {
-        float fBestErr;
-        const bool bSigned;
-        uint8_t uMode;
-        uint8_t uShape;
-        const HDRColorA* const aHDRPixels;
-        INTEndPntPair aUnqEndPts[BC6H_MAX_SHAPES][BC6H_MAX_REGIONS];
-        INTColor aIPixels[NUM_PIXELS_PER_BLOCK];
-
-        EncodeParams(const HDRColorA* const aOriginal, bool bSignedFormat) :
-            aHDRPixels(aOriginal), fBestErr(FLT_MAX), bSigned(bSignedFormat)
-        {
-            for(size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-            {
-                aIPixels[i].Set(aOriginal[i], bSigned);
-            }
-        }
-    };
-#pragma warning(pop)
-
-    static int Quantize(_In_ int iValue, _In_ int prec, _In_ bool bSigned);
-    static int Unquantize(_In_ int comp, _In_ uint8_t uBitsPerComp, _In_ bool bSigned);
-    static int FinishUnquantize(_In_ int comp, _In_ bool bSigned);
-
-    static bool EndPointsFit(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[]);
-
-    void GeneratePaletteQuantized(_In_ const EncodeParams* pEP, _In_ const INTEndPntPair& endPts,
-                                  _Out_writes_(BC6H_MAX_INDICES) INTColor aPalette[]) const;
-    float MapColorsQuantized(_In_ const EncodeParams* pEP, _In_reads_(np) const INTColor aColors[], _In_ size_t np, _In_ const INTEndPntPair &endPts) const;
-    float PerturbOne(_In_ const EncodeParams* pEP, _In_reads_(np) const INTColor aColors[], _In_ size_t np, _In_ uint8_t ch,
-                     _In_ const INTEndPntPair& oldEndPts, _Out_ INTEndPntPair& newEndPts, _In_ float fOldErr, _In_ int do_b) const;
-    void OptimizeOne(_In_ const EncodeParams* pEP, _In_reads_(np) const INTColor aColors[], _In_ size_t np, _In_ float aOrgErr,
-                     _In_ const INTEndPntPair &aOrgEndPts, _Out_ INTEndPntPair &aOptEndPts) const;
-    void OptimizeEndPoints(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const float aOrgErr[],
-                           _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aOrgEndPts[],
-                           _Inout_updates_all_(BC6H_MAX_REGIONS) INTEndPntPair aOptEndPts[]) const;
-    static void SwapIndices(_In_ const EncodeParams* pEP, _Inout_updates_all_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[],
-                            _In_reads_(NUM_PIXELS_PER_BLOCK) size_t aIndices[]);
-    void AssignIndices(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[],
-                        _Out_writes_(NUM_PIXELS_PER_BLOCK) size_t aIndices[],
-                        _Out_writes_(BC6H_MAX_REGIONS) float aTotErr[]) const;
-    void QuantizeEndPts(_In_ const EncodeParams* pEP, _Out_writes_(BC6H_MAX_REGIONS) INTEndPntPair* qQntEndPts) const;
-    void EmitBlock(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[],
-                   _In_reads_(NUM_PIXELS_PER_BLOCK) const size_t aIndices[]);
-    void Refine(_Inout_ EncodeParams* pEP);
-
-    static void GeneratePaletteUnquantized(_In_ const EncodeParams* pEP, _In_ size_t uRegion, _Out_writes_(BC6H_MAX_INDICES) INTColor aPalette[]);
-    float MapColors(_In_ const EncodeParams* pEP, _In_ size_t uRegion, _In_ size_t np, _In_reads_(np) const size_t* auIndex) const;
-    float RoughMSE(_Inout_ EncodeParams* pEP) const;
-
-private:
-    const static ModeDescriptor ms_aDesc[][82];
-    const static ModeInfo ms_aInfo[];
-    const static int ms_aModeToInfo[];
-};
-
-// BC67 compression (16b bits per texel)
-class D3DX_BC7 : private CBits< 16 >
-{
-public:
-    void Decode(_Out_writes_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut) const;
-    void Encode(_In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pIn);
-
-private:
-    struct ModeInfo
-    {
-        uint8_t uPartitions;
-        uint8_t uPartitionBits;
-        uint8_t uPBits;
-        uint8_t uRotationBits;
-        uint8_t uIndexModeBits;
-        uint8_t uIndexPrec;
-        uint8_t uIndexPrec2;
-        LDRColorA RGBAPrec;
-        LDRColorA RGBAPrecWithP;
-    };
-
-#pragma warning(push)
-#pragma warning(disable : 4512)
-    struct EncodeParams
-    {
-        uint8_t uMode;
-        LDREndPntPair aEndPts[BC7_MAX_SHAPES][BC7_MAX_REGIONS];
-        LDRColorA aLDRPixels[NUM_PIXELS_PER_BLOCK];
-        const HDRColorA* const aHDRPixels;
-
-        EncodeParams(const HDRColorA* const aOriginal) : aHDRPixels(aOriginal) {}
-    };
-#pragma warning(pop)
-
-    static uint8_t Quantize(_In_ uint8_t comp, _In_ uint8_t uPrec)
-    {
-        assert(0 < uPrec && uPrec <= 8);
-        uint8_t rnd = (uint8_t) std::min<uint16_t>(255, uint16_t(comp) + (1 << (7 - uPrec)));
-        return rnd >> (8 - uPrec);
-    }
-
-    static LDRColorA Quantize(_In_ const LDRColorA& c, _In_ const LDRColorA& RGBAPrec)
-    {
-        LDRColorA q;
-        q.r = Quantize(c.r, RGBAPrec.r);
-        q.g = Quantize(c.g, RGBAPrec.g);
-        q.b = Quantize(c.b, RGBAPrec.b);
-        if(RGBAPrec.a)
-            q.a = Quantize(c.a, RGBAPrec.a);
-        else
-            q.a = 255;
-        return q;
-    }
-
-    static uint8_t Unquantize(_In_ uint8_t comp, _In_ size_t uPrec)
-    {
-        assert(0 < uPrec && uPrec <= 8);
-        comp = comp << (8 - uPrec);
-        return comp | (comp >> uPrec);
-    }
-
-    static LDRColorA Unquantize(_In_ const LDRColorA& c, _In_ const LDRColorA& RGBAPrec)
-    {
-        LDRColorA q;
-        q.r = Unquantize(c.r, RGBAPrec.r);
-        q.g = Unquantize(c.g, RGBAPrec.g);
-        q.b = Unquantize(c.b, RGBAPrec.b);
-        q.a = RGBAPrec.a > 0 ? Unquantize(c.a, RGBAPrec.a) : 255;
-        return q;
-    }
-
-    void GeneratePaletteQuantized(_In_ const EncodeParams* pEP, _In_ size_t uIndexMode, _In_ const LDREndPntPair& endpts,
-                                  _Out_writes_(BC7_MAX_INDICES) LDRColorA aPalette[]) const;
-    float PerturbOne(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA colors[], _In_ size_t np, _In_ size_t uIndexMode,
-                     _In_ size_t ch, _In_ const LDREndPntPair &old_endpts,
-                     _Out_ LDREndPntPair &new_endpts, _In_ float old_err, _In_ uint8_t do_b) const;
-    void Exhaustive(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA aColors[], _In_ size_t np, _In_ size_t uIndexMode,
-                    _In_ size_t ch, _Inout_ float& fOrgErr, _Inout_ LDREndPntPair& optEndPt) const;
-    void OptimizeOne(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA colors[], _In_ size_t np, _In_ size_t uIndexMode,
-                     _In_ float orig_err, _In_ const LDREndPntPair &orig_endpts, _Out_ LDREndPntPair &opt_endpts) const;
-    void OptimizeEndPoints(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode,
-                           _In_reads_(BC7_MAX_REGIONS) const float orig_err[],
-                           _In_reads_(BC7_MAX_REGIONS) const LDREndPntPair orig_endpts[],
-                           _Out_writes_(BC7_MAX_REGIONS) LDREndPntPair opt_endpts[]) const;
-    void AssignIndices(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode,
-                       _In_reads_(BC7_MAX_REGIONS) LDREndPntPair endpts[],
-                       _Out_writes_(NUM_PIXELS_PER_BLOCK) size_t aIndices[], _Out_writes_(NUM_PIXELS_PER_BLOCK) size_t aIndices2[],
-                       _Out_writes_(BC7_MAX_REGIONS) float afTotErr[]) const;
-    void EmitBlock(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uRotation, _In_ size_t uIndexMode,
-                   _In_reads_(BC7_MAX_REGIONS) const LDREndPntPair aEndPts[],
-                   _In_reads_(NUM_PIXELS_PER_BLOCK) const size_t aIndex[],
-                   _In_reads_(NUM_PIXELS_PER_BLOCK) const size_t aIndex2[]);
-    float Refine(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uRotation, _In_ size_t uIndexMode);
-
-    float MapColors(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA aColors[], _In_ size_t np, _In_ size_t uIndexMode,
-                    _In_ const LDREndPntPair& endPts, _In_ float fMinErr) const;
-    static float RoughMSE(_Inout_ EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode);
-
-private:
-    const static ModeInfo ms_aInfo[];
-};
-
-//-------------------------------------------------------------------------------------
-#pragma warning(push)
-#pragma warning(disable : 4127)
-template <bool bRange> void OptimizeAlpha(float *pX, float *pY, const float *pPoints, size_t cSteps)
-{
-    static const float pC6[] = { 5.0f/5.0f, 4.0f/5.0f, 3.0f/5.0f, 2.0f/5.0f, 1.0f/5.0f, 0.0f/5.0f };
-    static const float pD6[] = { 0.0f/5.0f, 1.0f/5.0f, 2.0f/5.0f, 3.0f/5.0f, 4.0f/5.0f, 5.0f/5.0f };
-    static const float pC8[] = { 7.0f/7.0f, 6.0f/7.0f, 5.0f/7.0f, 4.0f/7.0f, 3.0f/7.0f, 2.0f/7.0f, 1.0f/7.0f, 0.0f/7.0f };
-    static const float pD8[] = { 0.0f/7.0f, 1.0f/7.0f, 2.0f/7.0f, 3.0f/7.0f, 4.0f/7.0f, 5.0f/7.0f, 6.0f/7.0f, 7.0f/7.0f };
-
-    const float *pC = (6 == cSteps) ? pC6 : pC8;
-    const float *pD = (6 == cSteps) ? pD6 : pD8;
-
-    float MAX_VALUE = 1.0f;
-    float MIN_VALUE;
-    if (bRange)
-    {
-        MIN_VALUE = -1.0f;
-    }
-    else
-    {
-        MIN_VALUE = 0.0f;
-    }
-
-    // Find Min and Max points, as starting point
-    float fX = MAX_VALUE;
-    float fY = MIN_VALUE;
-
-    if(8 == cSteps)
-    {
-        for(size_t iPoint = 0; iPoint < NUM_PIXELS_PER_BLOCK; iPoint++)
-        {
-            if(pPoints[iPoint] < fX)
-                fX = pPoints[iPoint];
-    
-            if(pPoints[iPoint] > fY)
-                fY = pPoints[iPoint];
-        }
-    }
-    else
-    {
-        for(size_t iPoint = 0; iPoint < NUM_PIXELS_PER_BLOCK; iPoint++)
-        {
-            if(pPoints[iPoint] < fX && pPoints[iPoint] > MIN_VALUE)
-                fX = pPoints[iPoint];
-    
-            if(pPoints[iPoint] > fY && pPoints[iPoint] < MAX_VALUE)
-                fY = pPoints[iPoint];
-        }
-
-        if (fX == fY)
-        {
-            fY = MAX_VALUE;
-        }
-    }
-
-    // Use Newton's Method to find local minima of sum-of-squares error.
-    float fSteps = (float) (cSteps - 1);
-
-    for(size_t iIteration = 0; iIteration < 8; iIteration++)
-    {
-        float fScale;
-
-        if((fY - fX) < (1.0f / 256.0f))
-            break;
-        
-        fScale = fSteps / (fY - fX);
-
-        // Calculate new steps
-        float pSteps[8];
-
-        for(size_t iStep = 0; iStep < cSteps; iStep++)
-            pSteps[iStep] = pC[iStep] * fX + pD[iStep] * fY;
-
-        if(6 == cSteps)
-        {
-            pSteps[6] = MIN_VALUE;
-            pSteps[7] = MAX_VALUE;
-        }
-
-        // Evaluate function, and derivatives
-        float dX  = 0.0f;
-        float dY  = 0.0f;
-        float d2X = 0.0f;
-        float d2Y = 0.0f;
-
-        for(size_t iPoint = 0; iPoint < NUM_PIXELS_PER_BLOCK; iPoint++)
-        {
-            float fDot = (pPoints[iPoint] - fX) * fScale;
-
-            size_t iStep;
-
-            if(fDot <= 0.0f)
-                iStep = ((6 == cSteps) && (pPoints[iPoint] <= fX * 0.5f)) ? 6 : 0;
-            else if(fDot >= fSteps)
-                iStep = ((6 == cSteps) && (pPoints[iPoint] >= (fY + 1.0f) * 0.5f)) ? 7 : (cSteps - 1);
-            else
-                iStep = static_cast<int32_t>(fDot + 0.5f);
-
-
-            if(iStep < cSteps)
-            {
-                // D3DX had this computation backwards (pPoints[iPoint] - pSteps[iStep])
-                // this fix improves RMS of the alpha component
-                float fDiff = pSteps[iStep] - pPoints[iPoint];
-
-                dX  += pC[iStep] * fDiff;
-                d2X += pC[iStep] * pC[iStep];
-
-                dY  += pD[iStep] * fDiff; 
-                d2Y += pD[iStep] * pD[iStep];
-            }
-        }
-
-        // Move endpoints
-        if(d2X > 0.0f)
-            fX -= dX / d2X;
-
-        if(d2Y > 0.0f)
-            fY -= dY / d2Y;
-
-        if(fX > fY)
-        {
-            float f = fX; fX = fY; fY = f;
-        }
-
-        if((dX * dX < (1.0f / 64.0f)) && (dY * dY < (1.0f / 64.0f)))
-            break;
-    }
-
-    *pX = (fX < MIN_VALUE) ? MIN_VALUE : (fX > MAX_VALUE) ? MAX_VALUE : fX;
-    *pY = (fY < MIN_VALUE) ? MIN_VALUE : (fY > MAX_VALUE) ? MAX_VALUE : fY;
-}
-#pragma warning(pop)
-
-
-//-------------------------------------------------------------------------------------
-// Functions
-//-------------------------------------------------------------------------------------
-
-typedef void (*BC_DECODE)(XMVECTOR *pColor, const uint8_t *pBC);
-typedef void (*BC_ENCODE)(uint8_t *pDXT, const XMVECTOR *pColor, DWORD flags);
-
-void D3DXDecodeBC1(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(8) const uint8_t *pBC);
-void D3DXDecodeBC2(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-void D3DXDecodeBC3(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-void D3DXDecodeBC4U(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(8) const uint8_t *pBC);
-void D3DXDecodeBC4S(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(8) const uint8_t *pBC);
-void D3DXDecodeBC5U(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-void D3DXDecodeBC5S(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-void D3DXDecodeBC6HU(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-void D3DXDecodeBC6HS(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-void D3DXDecodeBC7(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
-
-void D3DXEncodeBC1(_Out_writes_(8) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ float alphaRef, _In_ DWORD flags);
-    // BC1 requires one additional parameter, so it doesn't match signature of BC_ENCODE above
-
-void D3DXEncodeBC2(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC3(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC4U(_Out_writes_(8) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC4S(_Out_writes_(8) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC5U(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC5S(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC6HU(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC6HS(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-void D3DXEncodeBC7(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
-
-}; // namespace

+ 0 - 548
Exporters/FBX/3rdParty/DirectXTex/BC4BC5.cpp

@@ -1,548 +0,0 @@
-//-------------------------------------------------------------------------------------
-// BC4BC5.cpp
-//  
-// Block-compression (BC) functionality for BC4 and BC5 (DirectX 10 texture compression)
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//  
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-#include "BC.h"
-
-namespace DirectX
-{
-
-//------------------------------------------------------------------------------------
-// Constants
-//------------------------------------------------------------------------------------
-
-// Because these are used in SAL annotations, they need to remain macros rather than const values
-#define BLOCK_LEN 4
-    // length of each block in texel
-
-#define BLOCK_SIZE (BLOCK_LEN * BLOCK_LEN)
-    // total texels in a 4x4 block.
-
-//------------------------------------------------------------------------------------
-// Structures
-//-------------------------------------------------------------------------------------
-
-#pragma warning(push)
-#pragma warning(disable : 4201)
-
-// BC4U/BC5U
-struct BC4_UNORM
-{
-    float R(size_t uOffset) const
-    {
-        size_t uIndex = GetIndex(uOffset);
-        return DecodeFromIndex(uIndex);
-    }
-
-    float DecodeFromIndex(size_t uIndex) const
-    {
-        if (uIndex == 0)
-            return red_0 / 255.0f;
-        if (uIndex == 1)
-            return red_1 / 255.0f;
-        float fred_0 = red_0 / 255.0f;
-        float fred_1 = red_1 / 255.0f;
-        if (red_0 > red_1)
-        {
-            uIndex -= 1;
-            return (fred_0 * (7-uIndex) + fred_1 * uIndex) / 7.0f;
-        }
-        else
-        {
-            if (uIndex == 6)
-                return 0.0f;
-            if (uIndex == 7)
-                return 1.0f;
-            uIndex -= 1;
-            return (fred_0 * (5-uIndex) + fred_1 * uIndex) / 5.0f;
-        }
-    }
-
-    size_t GetIndex(size_t uOffset) const
-    {
-        return (size_t) ((data >> (3*uOffset + 16)) & 0x07);
-    }    
-
-    void SetIndex(size_t uOffset, size_t uIndex)
-    {
-        data &= ~((uint64_t) 0x07 << (3*uOffset + 16));
-        data |= ((uint64_t) uIndex << (3*uOffset + 16));
-    }
-
-    union
-    {
-        struct 
-        {
-            uint8_t red_0;
-            uint8_t red_1;
-            uint8_t indices[6]; 
-        };
-        uint64_t data;
-    };
-};
-
-// BC4S/BC5S
-struct BC4_SNORM
-{
-    float R(size_t uOffset) const
-    {
-        size_t uIndex = GetIndex(uOffset);
-        return DecodeFromIndex(uIndex);
-    }
-
-    float DecodeFromIndex(size_t uIndex) const
-    {
-        int8_t sred_0 = (red_0 == -128)? -127 : red_0;
-        int8_t sred_1 = (red_1 == -128)? -127 : red_1;
-
-        if (uIndex == 0)
-            return sred_0 / 127.0f;
-        if (uIndex == 1)
-            return sred_1 / 127.0f;
-        float fred_0 = sred_0 / 127.0f;
-        float fred_1 = sred_1 / 127.0f;
-        if (red_0 > red_1)
-        {
-            uIndex -= 1;
-            return (fred_0 * (7-uIndex) + fred_1 * uIndex) / 7.0f;
-        }
-        else
-        {
-            if (uIndex == 6)
-                return -1.0f;
-            if (uIndex == 7)
-                return 1.0f;  
-            uIndex -= 1;
-            return (fred_0 * (5-uIndex) + fred_1 * uIndex) / 5.0f;
-        }
-    }
-
-    size_t GetIndex(size_t uOffset) const
-    {
-        return (size_t) ((data >> (3*uOffset + 16)) & 0x07);
-    }    
-
-    void SetIndex(size_t uOffset, size_t uIndex)
-    {
-        data &= ~((uint64_t) 0x07 << (3*uOffset + 16));
-        data |= ((uint64_t) uIndex << (3*uOffset + 16));
-    }
-
-    union
-    {
-        struct 
-        {
-            int8_t red_0;
-            int8_t red_1;
-            uint8_t indices[6]; 
-        };
-        uint64_t data;
-    };
-};
-
-#pragma warning(pop)
-
-//-------------------------------------------------------------------------------------
-// Convert a floating point value to an 8-bit SNORM
-//-------------------------------------------------------------------------------------
-static void inline FloatToSNorm( _In_ float fVal, _Out_ int8_t *piSNorm )
-{
-    const uint32_t dwMostNeg = ( 1 << ( 8 * sizeof( int8_t ) - 1 ) );
-
-    if( _isnan( fVal ) )
-        fVal = 0;
-    else
-        if( fVal > 1 )
-            fVal = 1;    // Clamp to 1
-        else
-            if( fVal < -1 )
-                fVal = -1;    // Clamp to -1
-
-    fVal = fVal * (int8_t) ( dwMostNeg - 1 );
-
-    if( fVal >= 0 )
-        fVal += .5f;
-    else
-        fVal -= .5f;
-
-    *piSNorm = (int8_t) (fVal);
-}
-
-
-//------------------------------------------------------------------------------
-static void FindEndPointsBC4U( _In_reads_(BLOCK_SIZE) const float theTexelsU[], _Out_ uint8_t &endpointU_0, _Out_ uint8_t &endpointU_1)
-{
-    // The boundary of codec for signed/unsigned format
-    float MIN_NORM;
-    float MAX_NORM = 1.0f;
-    int8_t iStart, iEnd;
-    size_t i;
-
-    MIN_NORM = 0.0f;
-
-    // Find max/min of input texels
-    float fBlockMax = theTexelsU[0];
-    float fBlockMin = theTexelsU[0];
-    for (i = 0; i < BLOCK_SIZE; ++i)
-    {    
-        if (theTexelsU[i]<fBlockMin)
-        {
-            fBlockMin = theTexelsU[i];
-        }
-        else if (theTexelsU[i]>fBlockMax)
-        {
-            fBlockMax = theTexelsU[i];
-        }
-    }
-
-    //  If there are boundary values in input texels, Should use 4 block-codec to guarantee
-    //  the exact code of the boundary values.
-    bool bUsing4BlockCodec = ( MIN_NORM == fBlockMin || MAX_NORM == fBlockMax );
-
-    // Using Optimize
-    float fStart, fEnd;
-
-    if (!bUsing4BlockCodec)
-    {   
-        OptimizeAlpha<false>(&fStart, &fEnd, theTexelsU, 8);
-
-        iStart = (uint8_t) (fStart * 255.0f);
-        iEnd   = (uint8_t) (fEnd   * 255.0f);
-
-        endpointU_0 = iEnd;
-        endpointU_1 = iStart;
-    }
-    else
-    {
-        OptimizeAlpha<false>(&fStart, &fEnd, theTexelsU, 6);
-
-        iStart = (uint8_t) (fStart * 255.0f);
-        iEnd   = (uint8_t) (fEnd   * 255.0f);
-
-        endpointU_1 = iEnd;
-        endpointU_0 = iStart;
-    }
-}
-
-static void FindEndPointsBC4S(_In_reads_(BLOCK_SIZE) const float theTexelsU[], _Out_ int8_t &endpointU_0, _Out_ int8_t &endpointU_1)
-{
-    //  The boundary of codec for signed/unsigned format
-    float MIN_NORM;
-    float MAX_NORM = 1.0f;
-    int8_t iStart, iEnd;
-    size_t i;
-
-    MIN_NORM = -1.0f;
-
-    // Find max/min of input texels
-    float fBlockMax = theTexelsU[0];
-    float fBlockMin = theTexelsU[0];
-    for (i = 0; i < BLOCK_SIZE; ++i)
-    {    
-        if (theTexelsU[i]<fBlockMin)
-        {
-            fBlockMin = theTexelsU[i];
-        }
-        else if (theTexelsU[i]>fBlockMax)
-        {
-            fBlockMax = theTexelsU[i];
-        }
-    }
-
-    //  If there are boundary values in input texels, Should use 4 block-codec to guarantee
-    //  the exact code of the boundary values.
-    bool bUsing4BlockCodec = ( MIN_NORM == fBlockMin || MAX_NORM == fBlockMax );
-
-    // Using Optimize
-    float fStart, fEnd;
-
-    if (!bUsing4BlockCodec)
-    {   
-        OptimizeAlpha<true>(&fStart, &fEnd, theTexelsU, 8);
-
-        FloatToSNorm(fStart, &iStart);
-        FloatToSNorm(fEnd, &iEnd);
-
-        endpointU_0 = iEnd;
-        endpointU_1 = iStart;
-    }
-    else
-    {
-        OptimizeAlpha<true>(&fStart, &fEnd, theTexelsU, 6);
-
-        FloatToSNorm(fStart, &iStart);
-        FloatToSNorm(fEnd, &iEnd);
-
-        endpointU_1 = iEnd;
-        endpointU_0 = iStart;
-    }
-}
-
-
-//------------------------------------------------------------------------------
-static inline void FindEndPointsBC5U( _In_reads_(BLOCK_SIZE) const float theTexelsU[], _In_reads_(BLOCK_SIZE) const float theTexelsV[],
-                                      _Out_ uint8_t &endpointU_0, _Out_ uint8_t &endpointU_1, _Out_ uint8_t &endpointV_0, _Out_ uint8_t &endpointV_1)
-{
-    //Encoding the U and V channel by BC4 codec separately.
-    FindEndPointsBC4U( theTexelsU, endpointU_0, endpointU_1);
-    FindEndPointsBC4U( theTexelsV, endpointV_0, endpointV_1);
-}
-
-static inline void FindEndPointsBC5S( _In_reads_(BLOCK_SIZE) const float theTexelsU[], _In_reads_(BLOCK_SIZE) const float theTexelsV[],
-                                      _Out_ int8_t &endpointU_0, _Out_ int8_t &endpointU_1, _Out_ int8_t &endpointV_0, _Out_ int8_t &endpointV_1)
-{
-    //Encoding the U and V channel by BC4 codec separately.
-    FindEndPointsBC4S( theTexelsU, endpointU_0, endpointU_1);
-    FindEndPointsBC4S( theTexelsV, endpointV_0, endpointV_1);
-}
-
-
-//------------------------------------------------------------------------------
-static void FindClosestUNORM(_Inout_ BC4_UNORM* pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const float theTexelsU[])
-{
-    float rGradient[8];
-    int i;
-    for (i = 0; i < 8; ++i)
-    {
-        rGradient[i] = pBC->DecodeFromIndex(i);
-    }
-    for (i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        size_t uBestIndex = 0;
-        float fBestDelta = 100000;
-        for (size_t uIndex = 0; uIndex < 8; uIndex++)
-        {
-            float fCurrentDelta = fabsf(rGradient[uIndex]-theTexelsU[i]);
-            if (fCurrentDelta < fBestDelta)
-            {
-                uBestIndex = uIndex;
-                fBestDelta = fCurrentDelta;
-            }
-        }
-        pBC->SetIndex(i, uBestIndex);
-    }
-}
-
-static void FindClosestSNORM(_Inout_ BC4_SNORM* pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const float theTexelsU[])
-{    
-    float rGradient[8];
-    int i;
-    for (i = 0; i < 8; ++i)
-    {
-        rGradient[i] = pBC->DecodeFromIndex(i);
-    }
-    for (i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        size_t uBestIndex = 0;
-        float fBestDelta = 100000;
-        for (size_t uIndex = 0; uIndex < 8; uIndex++)
-        {
-            float fCurrentDelta = fabsf(rGradient[uIndex]-theTexelsU[i]);
-            if (fCurrentDelta < fBestDelta)
-            {
-                uBestIndex = uIndex;
-                fBestDelta = fCurrentDelta;
-            }
-        }
-        pBC->SetIndex(i, uBestIndex);
-    }
-}
-
-
-//=====================================================================================
-// Entry points
-//=====================================================================================
-
-//-------------------------------------------------------------------------------------
-// BC4 Compression
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-void D3DXDecodeBC4U( XMVECTOR *pColor, const uint8_t *pBC )
-{
-    assert( pColor && pBC );
-    static_assert( sizeof(BC4_UNORM) == 8, "BC4_UNORM should be 8 bytes" );
-
-    auto pBC4 = reinterpret_cast<const BC4_UNORM*>(pBC);
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        #pragma prefast(suppress:22103, "writing blocks in two halves confuses tool")
-        pColor[i] = XMVectorSet( pBC4->R(i), 0, 0, 1.0f);
-    }       
-}
-
-_Use_decl_annotations_
-void D3DXDecodeBC4S(XMVECTOR *pColor, const uint8_t *pBC)
-{
-    assert( pColor && pBC );
-    static_assert( sizeof(BC4_SNORM) == 8, "BC4_SNORM should be 8 bytes" );
-
-    auto pBC4 = reinterpret_cast<const BC4_SNORM*>(pBC);
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        #pragma prefast(suppress:22103, "writing blocks in two halves confuses tool")
-        pColor[i] = XMVectorSet( pBC4->R(i), 0, 0, 1.0f);
-    }       
-}
-
-_Use_decl_annotations_
-void D3DXEncodeBC4U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
-{
-    UNREFERENCED_PARAMETER( flags );
-
-    assert( pBC && pColor );
-    static_assert( sizeof(BC4_UNORM) == 8, "BC4_UNORM should be 8 bytes" );
-
-    memset(pBC, 0, sizeof(BC4_UNORM));
-    auto pBC4 = reinterpret_cast<BC4_UNORM*>(pBC);
-    float theTexelsU[NUM_PIXELS_PER_BLOCK];
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        theTexelsU[i] = XMVectorGetX( pColor[i] );
-    }
-
-    FindEndPointsBC4U(theTexelsU, pBC4->red_0, pBC4->red_1);
-    FindClosestUNORM(pBC4, theTexelsU);
-}
-
-_Use_decl_annotations_
-void D3DXEncodeBC4S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
-{
-    UNREFERENCED_PARAMETER( flags );
-
-    assert( pBC && pColor );
-    static_assert( sizeof(BC4_SNORM) == 8, "BC4_SNORM should be 8 bytes" );
-
-    memset(pBC, 0, sizeof(BC4_UNORM));
-    auto pBC4 = reinterpret_cast<BC4_SNORM*>(pBC);
-    float theTexelsU[NUM_PIXELS_PER_BLOCK];
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        theTexelsU[i] = XMVectorGetX( pColor[i] );
-    }
-
-    FindEndPointsBC4S(theTexelsU, pBC4->red_0, pBC4->red_1);
-    FindClosestSNORM(pBC4, theTexelsU);
-}
-
-
-//-------------------------------------------------------------------------------------
-// BC5 Compression
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-void D3DXDecodeBC5U(XMVECTOR *pColor, const uint8_t *pBC)
-{
-    assert( pColor && pBC );
-    static_assert( sizeof(BC4_UNORM) == 8, "BC4_UNORM should be 8 bytes" );
-
-    auto pBCR = reinterpret_cast<const BC4_UNORM*>(pBC);
-    auto pBCG = reinterpret_cast<const BC4_UNORM*>(pBC+sizeof(BC4_UNORM));
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        #pragma prefast(suppress:22103, "writing blocks in two halves confuses tool")
-        pColor[i] = XMVectorSet(pBCR->R(i), pBCG->R(i), 0, 1.0f);
-    }       
-}
-
-_Use_decl_annotations_
-void D3DXDecodeBC5S(XMVECTOR *pColor, const uint8_t *pBC)
-{
-    assert( pColor && pBC );
-    static_assert( sizeof(BC4_SNORM) == 8, "BC4_SNORM should be 8 bytes" );
-
-    auto pBCR = reinterpret_cast<const BC4_SNORM*>(pBC);
-    auto pBCG = reinterpret_cast<const BC4_SNORM*>(pBC+sizeof(BC4_SNORM));
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        #pragma prefast(suppress:22103, "writing blocks in two halves confuses tool")
-        pColor[i] = XMVectorSet(pBCR->R(i), pBCG->R(i), 0, 1.0f);
-    }       
-}
-
-_Use_decl_annotations_
-void D3DXEncodeBC5U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
-{
-    UNREFERENCED_PARAMETER( flags );
-
-    assert( pBC && pColor );
-    static_assert( sizeof(BC4_UNORM) == 8, "BC4_UNORM should be 8 bytes" );
-
-    memset(pBC, 0, sizeof(BC4_UNORM)*2);
-    auto pBCR = reinterpret_cast<BC4_UNORM*>(pBC);
-    auto pBCG = reinterpret_cast<BC4_UNORM*>(pBC+sizeof(BC4_UNORM));
-    float theTexelsU[NUM_PIXELS_PER_BLOCK];
-    float theTexelsV[NUM_PIXELS_PER_BLOCK];
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {   
-        XMFLOAT4A clr;
-        XMStoreFloat4A( &clr, pColor[i] );
-        theTexelsU[i] = clr.x;
-        theTexelsV[i] = clr.y;
-    }
-
-    FindEndPointsBC5U(
-        theTexelsU,
-        theTexelsV,
-        pBCR->red_0,
-        pBCR->red_1,
-        pBCG->red_0,
-        pBCG->red_1);
-
-    FindClosestUNORM(pBCR, theTexelsU);
-    FindClosestUNORM(pBCG, theTexelsV);
-}
-
-_Use_decl_annotations_
-void D3DXEncodeBC5S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
-{
-    UNREFERENCED_PARAMETER( flags );
-
-    assert( pBC && pColor );
-    static_assert( sizeof(BC4_SNORM) == 8, "BC4_SNORM should be 8 bytes" );
-
-    memset(pBC, 0, sizeof(BC4_UNORM)*2);
-    auto pBCR = reinterpret_cast<BC4_SNORM*>(pBC);
-    auto pBCG = reinterpret_cast<BC4_SNORM*>(pBC+sizeof(BC4_SNORM));
-    float theTexelsU[NUM_PIXELS_PER_BLOCK];
-    float theTexelsV[NUM_PIXELS_PER_BLOCK];
-
-    for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
-    {
-        XMFLOAT4A clr;
-        XMStoreFloat4A( &clr, pColor[i] );
-        theTexelsU[i] = clr.x;
-        theTexelsV[i] = clr.y;
-    }
-
-    FindEndPointsBC5S(
-        theTexelsU,
-        theTexelsV,
-        pBCR->red_0,
-        pBCR->red_1,
-        pBCG->red_0,
-        pBCG->red_1);
-
-    FindClosestSNORM(pBCR, theTexelsU);
-    FindClosestSNORM(pBCG, theTexelsV);
-}
-
-} // namespace

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 2871
Exporters/FBX/3rdParty/DirectXTex/BC6HBC7.cpp


+ 0 - 604
Exporters/FBX/3rdParty/DirectXTex/BCDirectCompute.cpp

@@ -1,604 +0,0 @@
-//-------------------------------------------------------------------------------------
-// BCDirectCompute.cpp
-//  
-// Direct3D 11 Compute Shader BC Compressor
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-#include "BCDirectCompute.h"
-
-#if defined(_DEBUG) || defined(PROFILE)
-#pragma comment(lib,"dxguid.lib")
-#endif
-
-using Microsoft::WRL::ComPtr;
-
-namespace
-{
-    #include "Shaders\Compiled\BC7Encode_EncodeBlockCS.inc"
-    #include "Shaders\Compiled\BC7Encode_TryMode02CS.inc"
-    #include "Shaders\Compiled\BC7Encode_TryMode137CS.inc"
-    #include "Shaders\Compiled\BC7Encode_TryMode456CS.inc"
-    #include "Shaders\Compiled\BC6HEncode_EncodeBlockCS.inc"
-    #include "Shaders\Compiled\BC6HEncode_TryModeG10CS.inc"
-    #include "Shaders\Compiled\BC6HEncode_TryModeLE10CS.inc"
-
-    struct BufferBC6HBC7
-    {
-        UINT color[4];
-    };
-
-    struct ConstantsBC6HBC7
-    {
-        UINT    tex_width;
-        UINT    num_block_x;
-        UINT    format;
-        UINT    mode_id;
-        UINT    start_block_id;
-        UINT    num_total_blocks;
-        float   alpha_weight;
-        UINT    reserved;
-    };
-
-    static_assert( sizeof(ConstantsBC6HBC7) == sizeof(UINT)*8, "Constant buffer size mismatch" );
-
-    inline void RunComputeShader( ID3D11DeviceContext* pContext,
-                                  ID3D11ComputeShader* shader,
-                                  ID3D11ShaderResourceView** pSRVs, 
-                                  UINT srvCount,
-                                  ID3D11Buffer* pCB, 
-                                  ID3D11UnorderedAccessView* pUAV,
-                                  UINT X )
-    {
-        // Force UAV to nullptr before setting SRV since we are swapping buffers
-        ID3D11UnorderedAccessView* nullUAV = nullptr;
-        pContext->CSSetUnorderedAccessViews( 0, 1, &nullUAV, nullptr );
-
-        pContext->CSSetShader( shader, nullptr, 0 );
-        pContext->CSSetShaderResources( 0, srvCount, pSRVs );
-        pContext->CSSetUnorderedAccessViews( 0, 1, &pUAV, nullptr );
-        pContext->CSSetConstantBuffers( 0, 1, &pCB );
-        pContext->Dispatch( X, 1, 1 );
-    }
-
-    inline void ResetContext( ID3D11DeviceContext* pContext )
-    {
-        ID3D11UnorderedAccessView* nullUAV = nullptr;
-        pContext->CSSetUnorderedAccessViews( 0, 1, &nullUAV, nullptr );
-
-        ID3D11ShaderResourceView* nullSRV[3] = { nullptr, nullptr, nullptr };
-        pContext->CSSetShaderResources( 0, 3, nullSRV );
-
-        ID3D11Buffer* nullBuffer[1] = { nullptr };
-        pContext->CSSetConstantBuffers( 0, 1, nullBuffer );
-    }
-};
-
-namespace DirectX
-{
-
-GPUCompressBC::GPUCompressBC() :
-    m_bcformat(DXGI_FORMAT_UNKNOWN),
-    m_srcformat(DXGI_FORMAT_UNKNOWN),
-    m_alphaWeight(1.f),
-    m_width(0),
-    m_height(0)
-{
-}
-
-
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT GPUCompressBC::Initialize( ID3D11Device* pDevice )
-{
-    if ( !pDevice )
-        return E_INVALIDARG;
-
-    // Check for DirectCompute support
-    D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel();
-
-    if ( fl < D3D_FEATURE_LEVEL_10_0 )
-    {
-        // DirectCompute not supported on Feature Level 9.x hardware
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    if ( fl < D3D_FEATURE_LEVEL_11_0 )
-    {
-        // DirectCompute support on Feature Level 10.x hardware is optional, and this function needs it
-        D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS hwopts;
-        HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts) );
-        if ( FAILED(hr) )
-        {
-            memset( &hwopts, 0, sizeof(hwopts) );
-        }
-
-        if ( !hwopts.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x )
-        {
-            return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-        }
-    }
-
-    // Save a device reference and obtain immediate context
-    m_device = pDevice;
-
-    pDevice->GetImmediateContext( m_context.ReleaseAndGetAddressOf() );
-    assert( m_context );
-
-    //--- Create compute shader library: BC6H -----------------------------------------
-
-    // Modes 11-14
-    HRESULT hr = pDevice->CreateComputeShader( BC6HEncode_TryModeG10CS, sizeof(BC6HEncode_TryModeG10CS), nullptr, m_BC6H_tryModeG10CS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Modes 1-10
-    hr = pDevice->CreateComputeShader( BC6HEncode_TryModeLE10CS, sizeof(BC6HEncode_TryModeLE10CS), nullptr, m_BC6H_tryModeLE10CS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Encode
-    hr = pDevice->CreateComputeShader( BC6HEncode_EncodeBlockCS, sizeof(BC6HEncode_EncodeBlockCS), nullptr, m_BC6H_encodeBlockCS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    //--- Create compute shader library: BC7 ------------------------------------------
-
-    // Modes 4, 5, 6
-    hr = pDevice->CreateComputeShader( BC7Encode_TryMode456CS, sizeof(BC7Encode_TryMode456CS), nullptr, m_BC7_tryMode456CS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Modes 1, 3, 7
-    hr = pDevice->CreateComputeShader( BC7Encode_TryMode137CS, sizeof(BC7Encode_TryMode137CS), nullptr, m_BC7_tryMode137CS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Modes 0, 2
-    hr = pDevice->CreateComputeShader( BC7Encode_TryMode02CS, sizeof(BC7Encode_TryMode02CS), nullptr, m_BC7_tryMode02CS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Encode
-    hr = pDevice->CreateComputeShader( BC7Encode_EncodeBlockCS, sizeof(BC7Encode_EncodeBlockCS), nullptr, m_BC7_encodeBlockCS.ReleaseAndGetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT GPUCompressBC::Prepare( size_t width, size_t height, DXGI_FORMAT format, float alphaWeight )
-{
-    if ( !width || !height || alphaWeight < 0.f )
-        return E_INVALIDARG;
-
-#ifdef _M_X64
-    if ( (width > 0xFFFFFFFF) || (height > 0xFFFFFFFF) )
-        return E_INVALIDARG;
-#endif
-
-    m_width = width;
-    m_height = height;
-
-    m_alphaWeight = alphaWeight;
-
-    size_t xblocks = std::max<size_t>( 1, (width + 3) >> 2 );
-    size_t yblocks = std::max<size_t>( 1, (height + 3) >> 2 );
-    size_t num_blocks = xblocks * yblocks;
-
-    switch( format )
-    {
-    // BC6H GPU compressor takes RGBAF32 as input
-    case DXGI_FORMAT_BC6H_TYPELESS:
-    case DXGI_FORMAT_BC6H_UF16:
-    case DXGI_FORMAT_BC6H_SF16:
-        m_srcformat = DXGI_FORMAT_R32G32B32A32_FLOAT;
-        break;
-
-    // BC7 GPU compressor takes RGBA32 as input
-    case DXGI_FORMAT_BC7_TYPELESS:
-    case DXGI_FORMAT_BC7_UNORM:
-        m_srcformat = DXGI_FORMAT_R8G8B8A8_UNORM;
-        break;
-
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        m_srcformat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
-        break;
-
-    default:
-        m_bcformat = m_srcformat = DXGI_FORMAT_UNKNOWN;
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    m_bcformat = format;
-
-    auto pDevice = m_device.Get();
-    if ( !pDevice )
-        return E_POINTER;
-
-    // Create structured buffers
-    size_t bufferSize = num_blocks * sizeof( BufferBC6HBC7 );
-    {
-        D3D11_BUFFER_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;
-        desc.Usage = D3D11_USAGE_DEFAULT;
-        desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
-        desc.StructureByteStride = sizeof( BufferBC6HBC7 );
-        desc.ByteWidth = static_cast<UINT>( bufferSize );
-
-        HRESULT hr = pDevice->CreateBuffer( &desc, nullptr, m_output.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-
-        hr = pDevice->CreateBuffer( &desc, nullptr, m_err1.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-
-        hr = pDevice->CreateBuffer( &desc, nullptr, m_err2.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-
-    // Create staging output buffer
-    {
-        D3D11_BUFFER_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.Usage = D3D11_USAGE_STAGING;
-        desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-        desc.ByteWidth = static_cast<UINT>( bufferSize );
-
-        HRESULT hr = pDevice->CreateBuffer( &desc, nullptr, m_outputCPU.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-
-    // Create constant buffer
-    {
-        D3D11_BUFFER_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-        desc.Usage = D3D11_USAGE_DYNAMIC;
-        desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-        desc.ByteWidth = sizeof( ConstantsBC6HBC7 );
-
-        HRESULT hr = pDevice->CreateBuffer( &desc, nullptr, m_constBuffer.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-
-    // Create shader resource views
-    {
-        D3D11_SHADER_RESOURCE_VIEW_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.Buffer.NumElements = static_cast<UINT>( num_blocks );
-        desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
-
-        HRESULT hr = pDevice->CreateShaderResourceView( m_err1.Get(), &desc, m_err1SRV.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-
-        hr = pDevice->CreateShaderResourceView( m_err2.Get(), &desc, m_err2SRV.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-
-    // Create unordered access views
-    {
-        D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.Buffer.NumElements = static_cast<UINT>( num_blocks );
-        desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
-
-        HRESULT hr = pDevice->CreateUnorderedAccessView( m_output.Get(), &desc, m_outputUAV.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-
-        hr = pDevice->CreateUnorderedAccessView( m_err1.Get(), &desc, m_err1UAV.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-
-        hr = pDevice->CreateUnorderedAccessView( m_err2.Get(), &desc, m_err2UAV.ReleaseAndGetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-    
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT GPUCompressBC::Compress( const Image& srcImage, const Image& destImage )
-{
-    if ( !srcImage.pixels || !destImage.pixels )
-        return E_INVALIDARG;
-
-    if ( srcImage.width != destImage.width
-         || srcImage.height != destImage.height
-         || srcImage.width != m_width
-         || srcImage.height != m_height
-         || srcImage.format != m_srcformat
-         || destImage.format != m_bcformat )
-    {
-        return E_UNEXPECTED;
-    }
-
-    //--- Create input texture --------------------------------------------------------
-    auto pDevice = m_device.Get();
-    if ( !pDevice )
-        return E_POINTER;
-
-    // We need to avoid the hardware doing additional colorspace conversion
-    DXGI_FORMAT inputFormat = ( m_srcformat == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB ) ? DXGI_FORMAT_R8G8B8A8_UNORM : m_srcformat;
-
-    ComPtr<ID3D11Texture2D> sourceTex;
-    {
-        D3D11_TEXTURE2D_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.Width = static_cast<UINT>( srcImage.width );
-        desc.Height = static_cast<UINT>( srcImage.height ); 
-        desc.MipLevels = 1;
-        desc.ArraySize = 1;
-        desc.Format = inputFormat;
-        desc.SampleDesc.Count = 1;
-        desc.Usage = D3D11_USAGE_DEFAULT;
-        desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
-
-        D3D11_SUBRESOURCE_DATA initData;
-        initData.pSysMem = srcImage.pixels;
-        initData.SysMemPitch = static_cast<DWORD>( srcImage.rowPitch );
-        initData.SysMemSlicePitch = static_cast<DWORD>( srcImage.slicePitch );
-
-        HRESULT hr = pDevice->CreateTexture2D( &desc, &initData, sourceTex.GetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-
-    ComPtr<ID3D11ShaderResourceView> sourceSRV;
-    {
-        D3D11_SHADER_RESOURCE_VIEW_DESC desc;
-        memset( &desc, 0, sizeof(desc) );
-        desc.Texture2D.MipLevels = 1;
-        desc.Format = inputFormat;
-        desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
-
-        HRESULT hr = pDevice->CreateShaderResourceView( sourceTex.Get(), &desc, sourceSRV.GetAddressOf() );
-        if ( FAILED(hr) )
-        {
-            return hr;
-        }
-    }
-
-    //--- Compress using DirectCompute ------------------------------------------------
-    bool isbc7 = false;
-    switch( m_bcformat )
-    {
-    case DXGI_FORMAT_BC6H_TYPELESS:
-    case DXGI_FORMAT_BC6H_UF16:
-    case DXGI_FORMAT_BC6H_SF16:
-        break;
-
-    case DXGI_FORMAT_BC7_TYPELESS:
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        isbc7 = true;
-        break;
-
-    default:
-        return E_UNEXPECTED;
-    }
-
-    const UINT MAX_BLOCK_BATCH = 64;
-
-    auto pContext = m_context.Get();
-    if ( !pContext )
-        return E_UNEXPECTED;
-
-    size_t xblocks = std::max<size_t>( 1, (m_width + 3) >> 2 );
-    size_t yblocks = std::max<size_t>( 1, (m_height + 3) >> 2 );
-
-    UINT num_total_blocks = static_cast<UINT>( xblocks * yblocks );
-    UINT num_blocks = num_total_blocks;
-    int start_block_id = 0;
-    while (num_blocks > 0)
-    {
-        UINT n = std::min<UINT>( num_blocks, MAX_BLOCK_BATCH );
-        UINT uThreadGroupCount = n;
-
-        {
-            D3D11_MAPPED_SUBRESOURCE mapped;
-            HRESULT hr = pContext->Map( m_constBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped );
-            if ( FAILED(hr) )
-                return hr;
-
-            ConstantsBC6HBC7 param;
-            param.tex_width = static_cast<UINT>( srcImage.width );
-            param.num_block_x = static_cast<UINT>( xblocks );
-            param.format = m_bcformat;
-            param.mode_id = 0;
-            param.start_block_id = start_block_id;
-            param.num_total_blocks = num_total_blocks;
-            param.alpha_weight = m_alphaWeight;
-            memcpy( mapped.pData, &param, sizeof( param ) );
-
-            pContext->Unmap( m_constBuffer.Get(), 0 );
-        }
-
-        if ( isbc7 )
-        {
-            //--- BC7 -----------------------------------------------------------------
-            ID3D11ShaderResourceView* pSRVs[] = { sourceSRV.Get(), nullptr };
-            RunComputeShader( pContext, m_BC7_tryMode456CS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                              m_err1UAV.Get(), std::max<UINT>( (uThreadGroupCount + 3) / 4, 1) );
-
-            for ( UINT i = 0; i < 3; ++i )
-            {
-                static const UINT modes[] = { 1, 3, 7 };
-                {
-                    D3D11_MAPPED_SUBRESOURCE mapped;
-                    HRESULT hr = pContext->Map( m_constBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped );
-                    if ( FAILED(hr) )
-                    {
-                        ResetContext( pContext );
-                        return hr;
-                    }
-
-                    ConstantsBC6HBC7 param;
-                    param.tex_width = static_cast<UINT>( srcImage.width );
-                    param.num_block_x = static_cast<UINT>( xblocks );
-                    param.format = m_bcformat;
-                    param.mode_id = modes[i];
-                    param.start_block_id = start_block_id;
-                    param.num_total_blocks = num_total_blocks;
-                    param.alpha_weight = m_alphaWeight;
-                    memcpy( mapped.pData, &param, sizeof( param ) );
-                    pContext->Unmap( m_constBuffer.Get(), 0 );
-                }
-
-                pSRVs[1] = (i & 1) ? m_err2SRV.Get() : m_err1SRV.Get();
-                RunComputeShader( pContext, m_BC7_tryMode137CS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                                  (i & 1) ? m_err1UAV.Get() : m_err2UAV.Get(), uThreadGroupCount );
-            }               
-
-            for ( UINT i = 0; i < 2; ++i )
-            {
-                static const UINT modes[] = { 0, 2 };
-                {
-                    D3D11_MAPPED_SUBRESOURCE mapped;
-                    HRESULT hr = pContext->Map( m_constBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped );
-                    if ( FAILED(hr) )
-                    {
-                        ResetContext( pContext );
-                        return hr;
-                    }
-
-                    ConstantsBC6HBC7 param;
-                    param.tex_width = static_cast<UINT>( srcImage.width );
-                    param.num_block_x = static_cast<UINT>( xblocks );
-                    param.format = m_bcformat;
-                    param.mode_id = modes[i];
-                    param.start_block_id = start_block_id;
-                    param.num_total_blocks = num_total_blocks;
-                    param.alpha_weight = m_alphaWeight;
-                    memcpy( mapped.pData, &param, sizeof( param ) );
-                    pContext->Unmap( m_constBuffer.Get(), 0 );
-                }
-
-                pSRVs[1] = (i & 1) ? m_err1SRV.Get() : m_err2SRV.Get();
-                RunComputeShader( pContext, m_BC7_tryMode02CS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                                  (i & 1) ? m_err2UAV.Get() : m_err1UAV.Get(), uThreadGroupCount );
-            }
-
-            pSRVs[1] = m_err2SRV.Get();
-            RunComputeShader( pContext, m_BC7_encodeBlockCS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                              m_outputUAV.Get(), std::max<UINT>( (uThreadGroupCount + 3) / 4, 1) );
-        }
-        else
-        {
-            //--- BC6H ----------------------------------------------------------------
-            ID3D11ShaderResourceView* pSRVs[] = { sourceSRV.Get(), nullptr };
-            RunComputeShader( pContext, m_BC6H_tryModeG10CS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                              m_err1UAV.Get(), std::max<UINT>( (uThreadGroupCount + 3) / 4, 1) );
-
-            for ( UINT i = 0; i < 10; ++i )
-            {
-                {
-                    D3D11_MAPPED_SUBRESOURCE mapped;
-                    HRESULT hr = pContext->Map( m_constBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped );
-                    if ( FAILED(hr) )
-                    {
-                        ResetContext( pContext );
-                        return hr;
-                    }
-
-                    ConstantsBC6HBC7 param;
-                    param.tex_width = static_cast<UINT>( srcImage.width );
-                    param.num_block_x = static_cast<UINT>( xblocks );
-                    param.format = m_bcformat;
-                    param.mode_id = i;
-                    param.start_block_id = start_block_id;
-                    param.num_total_blocks = num_total_blocks;
-                    memcpy( mapped.pData, &param, sizeof( param ) );
-                    pContext->Unmap( m_constBuffer.Get(), 0 );
-                }
-
-                pSRVs[1] = (i & 1) ? m_err2SRV.Get() : m_err1SRV.Get();
-                RunComputeShader( pContext, m_BC6H_tryModeLE10CS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                                  (i & 1) ? m_err1UAV.Get() : m_err2UAV.Get(), std::max<UINT>( (uThreadGroupCount + 1) / 2, 1) );
-            }               
-
-            pSRVs[1] = m_err1SRV.Get();
-            RunComputeShader( pContext, m_BC6H_encodeBlockCS.Get(), pSRVs, 2, m_constBuffer.Get(),
-                              m_outputUAV.Get(), std::max<UINT>( (uThreadGroupCount + 1) / 2, 1) );
-        }
-
-        start_block_id += n;
-        num_blocks -= n;
-    }
-
-    ResetContext( pContext );
-
-    //--- Copy output texture back to CPU ---------------------------------------------
-
-    pContext->CopyResource( m_outputCPU.Get(), m_output.Get() );
-
-    D3D11_MAPPED_SUBRESOURCE mapped;
-    HRESULT hr = pContext->Map( m_outputCPU.Get(), 0, D3D11_MAP_READ, 0, &mapped );
-    if ( SUCCEEDED(hr) )
-    {
-        const uint8_t *pSrc = reinterpret_cast<const uint8_t *>( mapped.pData );
-        uint8_t *pDest = destImage.pixels;
-
-        size_t pitch = xblocks * sizeof( BufferBC6HBC7 );
-
-        size_t rows = std::max<size_t>( 1, ( destImage.height + 3 ) >> 2 );
-
-        for( size_t h = 0; h < rows; ++h )
-        {
-            memcpy( pDest, pSrc, destImage.rowPitch );
-
-            pSrc += pitch;
-            pDest += destImage.rowPitch;
-        }
-
-        pContext->Unmap( m_outputCPU.Get(), 0 );
-    }
-
-    return hr;
-}
-
-}; // namespace

+ 0 - 68
Exporters/FBX/3rdParty/DirectXTex/BCDirectCompute.h

@@ -1,68 +0,0 @@
-//-------------------------------------------------------------------------------------
-// BCDirectCompute.h
-//  
-// Direct3D 11 Compute Shader BC Compressor
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-namespace DirectX
-{
-
-class GPUCompressBC
-{
-public:
-    GPUCompressBC();
-
-    HRESULT Initialize( _In_ ID3D11Device* pDevice );
-
-    HRESULT Prepare( _In_ size_t width, _In_ size_t height, _In_ DXGI_FORMAT format, _In_ float alphaWeight = 1.f );
-
-    HRESULT Compress( _In_ const Image& srcImage, _In_ const Image& destImage );
-
-    DXGI_FORMAT GetSourceFormat() const { return m_srcformat; }
-
-private:
-    DXGI_FORMAT                                         m_bcformat;
-    DXGI_FORMAT                                         m_srcformat;
-    float                                               m_alphaWeight;
-    size_t                                              m_width;
-    size_t                                              m_height;
-
-    Microsoft::WRL::ComPtr<ID3D11Device>                m_device;
-    Microsoft::WRL::ComPtr<ID3D11DeviceContext>         m_context;
-
-    Microsoft::WRL::ComPtr<ID3D11Buffer>                m_err1;
-    Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView>   m_err1UAV;
-    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView>    m_err1SRV;
-
-    Microsoft::WRL::ComPtr<ID3D11Buffer>                m_err2;
-    Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView>   m_err2UAV;
-    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView>    m_err2SRV;
-
-    Microsoft::WRL::ComPtr<ID3D11Buffer>                m_output;
-    Microsoft::WRL::ComPtr<ID3D11Buffer>                m_outputCPU;
-    Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView>   m_outputUAV;
-    Microsoft::WRL::ComPtr<ID3D11Buffer>                m_constBuffer;
-    
-    // Compute shader library
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC6H_tryModeG10CS;
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC6H_tryModeLE10CS;
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC6H_encodeBlockCS;
-
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC7_tryMode456CS;
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC7_tryMode137CS;
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC7_tryMode02CS;
-    Microsoft::WRL::ComPtr<ID3D11ComputeShader>         m_BC7_encodeBlockCS;    
-};
-
-}; // namespace

+ 0 - 239
Exporters/FBX/3rdParty/DirectXTex/DDS.h

@@ -1,239 +0,0 @@
-//--------------------------------------------------------------------------------------
-// dds.h
-//
-// This header defines constants and structures that are useful when parsing 
-// DDS files.  DDS files were originally designed to use several structures
-// and constants that are native to DirectDraw and are defined in ddraw.h,
-// such as DDSURFACEDESC2 and DDSCAPS2.  This file defines similar 
-// (compatible) constants and structures so that one can use DDS files 
-// without needing to include ddraw.h.
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//--------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
-#include <d3d11_x.h>
-#else
-#include <dxgiformat.h>
-#endif
-
-// VS 2010's stdint.h conflicts with intsafe.h
-#pragma warning(push)
-#pragma warning(disable : 4005)
-#include <stdint.h>
-#pragma warning(pop)
-
-namespace DirectX
-{
-
-#pragma pack(push,1)
-
-const uint32_t DDS_MAGIC = 0x20534444; // "DDS "
-
-struct DDS_PIXELFORMAT
-{
-    uint32_t    dwSize;
-    uint32_t    dwFlags;
-    uint32_t    dwFourCC;
-    uint32_t    dwRGBBitCount;
-    uint32_t    dwRBitMask;
-    uint32_t    dwGBitMask;
-    uint32_t    dwBBitMask;
-    uint32_t    dwABitMask;
-};
-
-#define DDS_FOURCC      0x00000004  // DDPF_FOURCC
-#define DDS_RGB         0x00000040  // DDPF_RGB
-#define DDS_RGBA        0x00000041  // DDPF_RGB | DDPF_ALPHAPIXELS
-#define DDS_LUMINANCE   0x00020000  // DDPF_LUMINANCE
-#define DDS_LUMINANCEA  0x00020001  // DDPF_LUMINANCE | DDPF_ALPHAPIXELS
-#define DDS_ALPHA       0x00000002  // DDPF_ALPHA
-#define DDS_PAL8        0x00000020  // DDPF_PALETTEINDEXED8
-
-#ifndef MAKEFOURCC
-    #define MAKEFOURCC(ch0, ch1, ch2, ch3)                              \
-                ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) |       \
-                ((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
-#endif /* defined(MAKEFOURCC) */
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT1 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT2 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT3 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT4 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT5 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_UNORM =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','U'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_SNORM =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','S'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_UNORM =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','U'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_SNORM =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','S'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8_B8G8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G8R8_G8B8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_YUY2 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8R8G8B8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGB,  0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8B8G8R8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8B8G8R8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGB,  0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G16R16 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGB,  0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R5G6B5 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8B8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0,  8, 0xff, 0x00, 0x00, 0x00 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L16 =
-    { sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0x0000, 0x0000, 0x0000 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0x0000, 0x0000, 0xff00 };
-
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8 =
-    { sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0x00, 0x00, 0x00, 0xff };
-
-// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue
-
-// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat)
-extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DX10 =
-    { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','1','0'), 0, 0, 0, 0, 0 };
-
-#define DDS_HEADER_FLAGS_TEXTURE        0x00001007  // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT 
-#define DDS_HEADER_FLAGS_MIPMAP         0x00020000  // DDSD_MIPMAPCOUNT
-#define DDS_HEADER_FLAGS_VOLUME         0x00800000  // DDSD_DEPTH
-#define DDS_HEADER_FLAGS_PITCH          0x00000008  // DDSD_PITCH
-#define DDS_HEADER_FLAGS_LINEARSIZE     0x00080000  // DDSD_LINEARSIZE
-
-#define DDS_HEIGHT 0x00000002 // DDSD_HEIGHT
-#define DDS_WIDTH  0x00000004 // DDSD_WIDTH
-
-#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE
-#define DDS_SURFACE_FLAGS_MIPMAP  0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
-#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX
-
-#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
-#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
-#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
-#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
-#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
-#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
-
-#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\
-                               DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\
-                               DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ )
-
-#define DDS_CUBEMAP 0x00000200 // DDSCAPS2_CUBEMAP
-
-#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME
-
-// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION
-enum DDS_RESOURCE_DIMENSION
-{
-    DDS_DIMENSION_TEXTURE1D	= 2,
-    DDS_DIMENSION_TEXTURE2D	= 3,
-    DDS_DIMENSION_TEXTURE3D	= 4,
-};
-
-// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG
-enum DDS_RESOURCE_MISC_FLAG
-{
-    DDS_RESOURCE_MISC_TEXTURECUBE = 0x4L,
-};
-
-enum DDS_MISC_FLAGS2
-{
-    DDS_MISC_FLAGS2_ALPHA_MODE_MASK = 0x7L,
-};
-
-enum DDS_ALPHA_MODE
-{
-    DDS_ALPHA_MODE_UNKNOWN       = 0,
-    DDS_ALPHA_MODE_STRAIGHT      = 1,
-    DDS_ALPHA_MODE_PREMULTIPLIED = 2,
-    DDS_ALPHA_MODE_OPAQUE        = 3,
-    DDS_ALPHA_MODE_CUSTOM        = 4,
-};
-
-struct DDS_HEADER
-{
-    uint32_t    dwSize;
-    uint32_t    dwFlags;
-    uint32_t    dwHeight;
-    uint32_t    dwWidth;
-    uint32_t    dwPitchOrLinearSize;
-    uint32_t    dwDepth; // only if DDS_HEADER_FLAGS_VOLUME is set in dwFlags
-    uint32_t    dwMipMapCount;
-    uint32_t    dwReserved1[11];
-    DDS_PIXELFORMAT ddspf;
-    uint32_t    dwCaps;
-    uint32_t    dwCaps2;
-    uint32_t    dwCaps3;
-    uint32_t    dwCaps4;
-    uint32_t    dwReserved2;
-};
-
-struct DDS_HEADER_DXT10
-{
-    DXGI_FORMAT dxgiFormat;
-    uint32_t    resourceDimension;
-    uint32_t    miscFlag; // see DDS_RESOURCE_MISC_FLAG
-    uint32_t    arraySize;
-    uint32_t    miscFlags2; // see DDS_MISC_FLAGS2
-};
-
-#pragma pack(pop)
-
-static_assert( sizeof(DDS_HEADER) == 124, "DDS Header size mismatch" );
-static_assert( sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch");
-
-}; // namespace

+ 0 - 616
Exporters/FBX/3rdParty/DirectXTex/DirectXTex.h

@@ -1,616 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTex.h
-//  
-// DirectX Texture Library
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (_WIN32_WINNT <= _WIN32_WINNT_WIN8)
-#error WIC is not supported on Windows Phone 8.0
-#endif
-
-// VS 2010's stdint.h conflicts with intsafe.h
-#pragma warning(push)
-#pragma warning(disable : 4005)
-#include <stdint.h>
-#pragma warning(pop)
-
-#include <algorithm>
-#include <functional>
-
-#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
-#include <d3d11_x.h>
-#define DCOMMON_H_INCLUDED
-#else
-#include <d3d11_1.h>
-#endif
-
-#include <ocidl.h>
-
-#define DIRECTX_TEX_VERSION 130
-
-namespace DirectX
-{
-
-    //---------------------------------------------------------------------------------
-    // DXGI Format Utilities
-    bool IsValid( _In_ DXGI_FORMAT fmt );
-    bool IsCompressed( _In_ DXGI_FORMAT fmt );
-    bool IsPacked( _In_ DXGI_FORMAT fmt );
-    bool IsVideo( _In_ DXGI_FORMAT fmt );
-    bool IsPlanar( _In_ DXGI_FORMAT fmt );
-    bool IsPalettized( _In_ DXGI_FORMAT fmt );
-    bool IsDepthStencil(_In_ DXGI_FORMAT fmt );
-    bool IsSRGB( _In_ DXGI_FORMAT fmt );
-    bool IsTypeless( _In_ DXGI_FORMAT fmt, _In_ bool partialTypeless = true );
-
-    bool HasAlpha( _In_ DXGI_FORMAT fmt );
-
-    size_t BitsPerPixel( _In_ DXGI_FORMAT fmt );
-
-    size_t BitsPerColor( _In_ DXGI_FORMAT fmt );
-
-    enum CP_FLAGS
-    {
-        CP_FLAGS_NONE               = 0x0,      // Normal operation
-        CP_FLAGS_LEGACY_DWORD       = 0x1,      // Assume pitch is DWORD aligned instead of BYTE aligned
-        CP_FLAGS_PARAGRAPH          = 0x2,      // Assume pitch is 16-byte aligned instead of BYTE aligned
-        CP_FLAGS_24BPP              = 0x10000,  // Override with a legacy 24 bits-per-pixel format size
-        CP_FLAGS_16BPP              = 0x20000,  // Override with a legacy 16 bits-per-pixel format size
-        CP_FLAGS_8BPP               = 0x40000,  // Override with a legacy 8 bits-per-pixel format size
-    };
-
-    void ComputePitch( _In_ DXGI_FORMAT fmt, _In_ size_t width, _In_ size_t height,
-                       _Out_ size_t& rowPitch, _Out_ size_t& slicePitch, _In_ DWORD flags = CP_FLAGS_NONE );
-
-    size_t ComputeScanlines( _In_ DXGI_FORMAT fmt, _In_ size_t height );
-
-    DXGI_FORMAT MakeSRGB( _In_ DXGI_FORMAT fmt );
-    DXGI_FORMAT MakeTypeless( _In_ DXGI_FORMAT fmt );
-    DXGI_FORMAT MakeTypelessUNORM( _In_ DXGI_FORMAT fmt );
-    DXGI_FORMAT MakeTypelessFLOAT( _In_ DXGI_FORMAT fmt );
-
-    //---------------------------------------------------------------------------------
-    // Texture metadata
-    enum TEX_DIMENSION
-        // Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION
-    {
-        TEX_DIMENSION_TEXTURE1D    = 2,
-        TEX_DIMENSION_TEXTURE2D    = 3,
-        TEX_DIMENSION_TEXTURE3D    = 4,
-    };
-
-    enum TEX_MISC_FLAG
-        // Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG
-    {
-        TEX_MISC_TEXTURECUBE = 0x4L,
-    };
-
-    enum TEX_MISC_FLAG2
-    {
-        TEX_MISC2_ALPHA_MODE_MASK = 0x7L,
-    };
-
-    enum TEX_ALPHA_MODE
-        // Matches DDS_ALPHA_MODE, encoded in MISC_FLAGS2
-    {
-        TEX_ALPHA_MODE_UNKNOWN       = 0,
-        TEX_ALPHA_MODE_STRAIGHT      = 1,
-        TEX_ALPHA_MODE_PREMULTIPLIED = 2,
-        TEX_ALPHA_MODE_OPAQUE        = 3,
-        TEX_ALPHA_MODE_CUSTOM        = 4,
-    };
-
-    struct TexMetadata
-    {
-        size_t          width;
-        size_t          height;     // Should be 1 for 1D textures
-        size_t          depth;      // Should be 1 for 1D or 2D textures
-        size_t          arraySize;  // For cubemap, this is a multiple of 6
-        size_t          mipLevels;
-        uint32_t        miscFlags;
-        uint32_t        miscFlags2;
-        DXGI_FORMAT     format;
-        TEX_DIMENSION   dimension;
-
-        size_t ComputeIndex( _In_ size_t mip, _In_ size_t item, _In_ size_t slice ) const;
-            // Returns size_t(-1) to indicate an out-of-range error
-
-        bool IsCubemap() const { return (miscFlags & TEX_MISC_TEXTURECUBE) != 0; }
-            // Helper for miscFlags
-
-        bool IsPMAlpha() const { return ((miscFlags2 & TEX_MISC2_ALPHA_MODE_MASK) == TEX_ALPHA_MODE_PREMULTIPLIED) != 0; }
-        void SetAlphaMode( TEX_ALPHA_MODE mode ) { miscFlags2 = (miscFlags2 & ~TEX_MISC2_ALPHA_MODE_MASK) | static_cast<uint32_t>(mode); }
-            // Helpers for miscFlags2
-
-        bool IsVolumemap() const { return (dimension == TEX_DIMENSION_TEXTURE3D); }
-            // Helper for dimension
-    };
-
-    enum DDS_FLAGS
-    {
-        DDS_FLAGS_NONE                  = 0x0,
-
-        DDS_FLAGS_LEGACY_DWORD          = 0x1,
-            // Assume pitch is DWORD aligned instead of BYTE aligned (used by some legacy DDS files)
-
-        DDS_FLAGS_NO_LEGACY_EXPANSION   = 0x2,
-            // Do not implicitly convert legacy formats that result in larger pixel sizes (24 bpp, 3:3:2, A8L8, A4L4, P8, A8P8) 
-
-        DDS_FLAGS_NO_R10B10G10A2_FIXUP  = 0x4,
-            // Do not use work-around for long-standing D3DX DDS file format issue which reversed the 10:10:10:2 color order masks
-
-        DDS_FLAGS_FORCE_RGB             = 0x8,
-            // Convert DXGI 1.1 BGR formats to DXGI_FORMAT_R8G8B8A8_UNORM to avoid use of optional WDDM 1.1 formats
-
-        DDS_FLAGS_NO_16BPP              = 0x10,
-            // Conversions avoid use of 565, 5551, and 4444 formats and instead expand to 8888 to avoid use of optional WDDM 1.2 formats
-
-        DDS_FLAGS_EXPAND_LUMINANCE      = 0x20,
-            // When loading legacy luminance formats expand replicating the color channels rather than leaving them packed (L8, L16, A8L8)
-
-        DDS_FLAGS_FORCE_DX10_EXT        = 0x10000,
-            // Always use the 'DX10' header extension for DDS writer (i.e. don't try to write DX9 compatible DDS files)
-
-        DDS_FLAGS_FORCE_DX10_EXT_MISC2  = 0x20000,
-            // DDS_FLAGS_FORCE_DX10_EXT including miscFlags2 information (result may not be compatible with D3DX10 or D3DX11)
-    };
-
-    enum WIC_FLAGS
-    {
-        WIC_FLAGS_NONE                  = 0x0,
-
-        WIC_FLAGS_FORCE_RGB             = 0x1,
-            // Loads DXGI 1.1 BGR formats as DXGI_FORMAT_R8G8B8A8_UNORM to avoid use of optional WDDM 1.1 formats
-
-        WIC_FLAGS_NO_X2_BIAS            = 0x2,
-            // Loads DXGI 1.1 X2 10:10:10:2 format as DXGI_FORMAT_R10G10B10A2_UNORM
-
-        WIC_FLAGS_NO_16BPP              = 0x4,
-            // Loads 565, 5551, and 4444 formats as 8888 to avoid use of optional WDDM 1.2 formats
-
-        WIC_FLAGS_ALLOW_MONO            = 0x8,
-            // Loads 1-bit monochrome (black & white) as R1_UNORM rather than 8-bit grayscale
-
-        WIC_FLAGS_ALL_FRAMES            = 0x10,
-            // Loads all images in a multi-frame file, converting/resizing to match the first frame as needed, defaults to 0th frame otherwise
-
-        WIC_FLAGS_IGNORE_SRGB           = 0x20,
-            // Ignores sRGB metadata if present in the file
-
-        WIC_FLAGS_DITHER                = 0x10000,
-            // Use ordered 4x4 dithering for any required conversions
-
-        WIC_FLAGS_DITHER_DIFFUSION      = 0x20000,
-            // Use error-diffusion dithering for any required conversions
-
-        WIC_FLAGS_FILTER_POINT          = 0x100000,
-        WIC_FLAGS_FILTER_LINEAR         = 0x200000,
-        WIC_FLAGS_FILTER_CUBIC          = 0x300000,
-        WIC_FLAGS_FILTER_FANT           = 0x400000, // Combination of Linear and Box filter
-            // Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant)
-    };
-
-    HRESULT GetMetadataFromDDSMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
-                                      _Out_ TexMetadata& metadata );
-    HRESULT GetMetadataFromDDSFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
-                                    _Out_ TexMetadata& metadata );
-
-    HRESULT GetMetadataFromTGAMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size,
-                                      _Out_ TexMetadata& metadata );
-    HRESULT GetMetadataFromTGAFile( _In_z_ LPCWSTR szFile,
-                                    _Out_ TexMetadata& metadata );
-
-    HRESULT GetMetadataFromWICMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
-                                      _Out_ TexMetadata& metadata );
-    HRESULT GetMetadataFromWICFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
-                                    _Out_ TexMetadata& metadata );
-
-    //---------------------------------------------------------------------------------
-    // Bitmap image container
-    struct Image
-    {
-        size_t      width;
-        size_t      height;
-        DXGI_FORMAT format;
-        size_t      rowPitch;
-        size_t      slicePitch;
-        uint8_t*    pixels;
-    };
-
-    class ScratchImage
-    {
-    public:
-        ScratchImage()
-            : _nimages(0), _size(0), _image(nullptr), _memory(nullptr) {}
-        ScratchImage(ScratchImage&& moveFrom)
-            : _nimages(0), _size(0), _image(nullptr), _memory(nullptr) { *this = std::move(moveFrom); }
-        ~ScratchImage() { Release(); }
-
-        ScratchImage& operator= (ScratchImage&& moveFrom);
-
-        HRESULT Initialize( _In_ const TexMetadata& mdata, _In_ DWORD flags = CP_FLAGS_NONE );
-
-        HRESULT Initialize1D( _In_ DXGI_FORMAT fmt, _In_ size_t length, _In_ size_t arraySize, _In_ size_t mipLevels, _In_ DWORD flags = CP_FLAGS_NONE );
-        HRESULT Initialize2D( _In_ DXGI_FORMAT fmt, _In_ size_t width, _In_ size_t height, _In_ size_t arraySize, _In_ size_t mipLevels, _In_ DWORD flags = CP_FLAGS_NONE );
-        HRESULT Initialize3D( _In_ DXGI_FORMAT fmt, _In_ size_t width, _In_ size_t height, _In_ size_t depth, _In_ size_t mipLevels, _In_ DWORD flags = CP_FLAGS_NONE );
-        HRESULT InitializeCube( _In_ DXGI_FORMAT fmt, _In_ size_t width, _In_ size_t height, _In_ size_t nCubes, _In_ size_t mipLevels, _In_ DWORD flags = CP_FLAGS_NONE );
-
-        HRESULT InitializeFromImage( _In_ const Image& srcImage, _In_ bool allow1D = false, _In_ DWORD flags = CP_FLAGS_NONE );
-        HRESULT InitializeArrayFromImages( _In_reads_(nImages) const Image* images, _In_ size_t nImages, _In_ bool allow1D = false, _In_ DWORD flags = CP_FLAGS_NONE ); 
-        HRESULT InitializeCubeFromImages( _In_reads_(nImages) const Image* images, _In_ size_t nImages, _In_ DWORD flags = CP_FLAGS_NONE );
-        HRESULT Initialize3DFromImages( _In_reads_(depth) const Image* images, _In_ size_t depth, _In_ DWORD flags = CP_FLAGS_NONE );
-
-        void Release();
-
-        bool OverrideFormat( _In_ DXGI_FORMAT f );
-
-        const TexMetadata& GetMetadata() const { return _metadata; }
-        const Image* GetImage(_In_ size_t mip, _In_ size_t item, _In_ size_t slice) const;
-
-        const Image* GetImages() const { return _image; }
-        size_t GetImageCount() const { return _nimages; }
-
-        uint8_t* GetPixels() const { return _memory; }
-        size_t GetPixelsSize() const { return _size; }
-
-        bool IsAlphaAllOpaque() const;
-
-    private:
-        size_t      _nimages;
-        size_t      _size;
-        TexMetadata _metadata;
-        Image*      _image;
-        uint8_t*    _memory;
-
-        // Hide copy constructor and assignment operator
-        ScratchImage( const ScratchImage& );
-        ScratchImage& operator=( const ScratchImage& );
-    };
-
-    //---------------------------------------------------------------------------------
-    // Memory blob (allocated buffer pointer is always 16-byte aligned)
-    class Blob
-    {
-    public:
-        Blob() : _buffer(nullptr), _size(0) {}
-        Blob(Blob&& moveFrom) : _buffer(nullptr), _size(0) { *this = std::move(moveFrom); }
-        ~Blob() { Release(); }
-
-        Blob& operator= (Blob&& moveFrom);
-
-        HRESULT Initialize( _In_ size_t size );
-
-        void Release();
-
-        void *GetBufferPointer() const { return _buffer; }
-        size_t GetBufferSize() const { return _size; }
-
-    private:
-        void*   _buffer;
-        size_t  _size;
-
-        // Hide copy constructor and assignment operator
-        Blob( const Blob& );
-        Blob& operator=( const Blob& );
-    };
-
-    //---------------------------------------------------------------------------------
-    // Image I/O
-
-    // DDS operations
-    HRESULT LoadFromDDSMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
-                               _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
-    HRESULT LoadFromDDSFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
-                             _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
-
-    HRESULT SaveToDDSMemory( _In_ const Image& image, _In_ DWORD flags,
-                             _Out_ Blob& blob );
-    HRESULT SaveToDDSMemory( _In_reads_(nimages) const Image* images, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags,
-                             _Out_ Blob& blob );
-
-    HRESULT SaveToDDSFile( _In_ const Image& image, _In_ DWORD flags, _In_z_ LPCWSTR szFile );
-    HRESULT SaveToDDSFile( _In_reads_(nimages) const Image* images, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags, _In_z_ LPCWSTR szFile );
-
-    // TGA operations
-    HRESULT LoadFromTGAMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size,
-                               _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
-    HRESULT LoadFromTGAFile( _In_z_ LPCWSTR szFile,
-                             _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
-
-    HRESULT SaveToTGAMemory( _In_ const Image& image, _Out_ Blob& blob );
-    HRESULT SaveToTGAFile( _In_ const Image& image, _In_z_ LPCWSTR szFile );
-
-    // WIC operations
-    HRESULT LoadFromWICMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
-                               _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
-    HRESULT LoadFromWICFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
-                             _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
-
-    HRESULT SaveToWICMemory( _In_ const Image& image, _In_ DWORD flags, _In_ REFGUID guidContainerFormat,
-                             _Out_ Blob& blob, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
-    HRESULT SaveToWICMemory( _In_count_(nimages) const Image* images, _In_ size_t nimages, _In_ DWORD flags, _In_ REFGUID guidContainerFormat,
-                             _Out_ Blob& blob, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
-
-    HRESULT SaveToWICFile( _In_ const Image& image, _In_ DWORD flags, _In_ REFGUID guidContainerFormat,
-                           _In_z_ LPCWSTR szFile, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
-    HRESULT SaveToWICFile( _In_count_(nimages) const Image* images, _In_ size_t nimages, _In_ DWORD flags, _In_ REFGUID guidContainerFormat,
-                           _In_z_ LPCWSTR szFile, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
-
-    enum WICCodecs
-    {
-        WIC_CODEC_BMP       =1,     // Windows Bitmap (.bmp)
-        WIC_CODEC_JPEG,             // Joint Photographic Experts Group (.jpg, .jpeg)
-        WIC_CODEC_PNG,              // Portable Network Graphics (.png)
-        WIC_CODEC_TIFF,             // Tagged Image File Format  (.tif, .tiff)
-        WIC_CODEC_GIF,              // Graphics Interchange Format  (.gif)
-        WIC_CODEC_WMP,              // Windows Media Photo / HD Photo / JPEG XR (.hdp, .jxr, .wdp)
-        WIC_CODEC_ICO,              // Windows Icon (.ico)
-    };
-
-    REFGUID GetWICCodec( _In_ WICCodecs codec );
-
-    //---------------------------------------------------------------------------------
-    // Texture conversion, resizing, mipmap generation, and block compression
-
-    enum TEX_FR_FLAGS
-    {
-        TEX_FR_ROTATE0          = 0x0,
-        TEX_FR_ROTATE90         = 0x1,
-        TEX_FR_ROTATE180        = 0x2,
-        TEX_FR_ROTATE270        = 0x3,
-        TEX_FR_FLIP_HORIZONTAL  = 0x08,
-        TEX_FR_FLIP_VERTICAL    = 0x10,
-    };
-
-    HRESULT FlipRotate( _In_ const Image& srcImage, _In_ DWORD flags, _Out_ ScratchImage& image );
-    HRESULT FlipRotate( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                        _In_ DWORD flags, _Out_ ScratchImage& result );
-        // Flip and/or rotate image
-
-    enum TEX_FILTER_FLAGS
-    {
-        TEX_FILTER_DEFAULT          = 0,
-
-        TEX_FILTER_WRAP_U           = 0x1,
-        TEX_FILTER_WRAP_V           = 0x2,
-        TEX_FILTER_WRAP_W           = 0x4,
-        TEX_FILTER_WRAP             = ( TEX_FILTER_WRAP_U | TEX_FILTER_WRAP_V | TEX_FILTER_WRAP_W ),
-        TEX_FILTER_MIRROR_U         = 0x10,
-        TEX_FILTER_MIRROR_V         = 0x20,
-        TEX_FILTER_MIRROR_W         = 0x40,
-        TEX_FILTER_MIRROR          = ( TEX_FILTER_MIRROR_U | TEX_FILTER_MIRROR_V | TEX_FILTER_MIRROR_W ),
-            // Wrap vs. Mirror vs. Clamp filtering options
-
-        TEX_FILTER_SEPARATE_ALPHA   = 0x100,
-            // Resize color and alpha channel independently
-
-        TEX_FILTER_RGB_COPY_RED     = 0x1000,
-        TEX_FILTER_RGB_COPY_GREEN   = 0x2000,
-        TEX_FILTER_RGB_COPY_BLUE    = 0x4000,
-            // When converting RGB to R, defaults to using grayscale. These flags indicate copying a specific channel instead
-            // When converting RGB to RG, defaults to copying RED | GREEN. These flags control which channels are selected instead.
-
-        TEX_FILTER_DITHER           = 0x10000,
-            // Use ordered 4x4 dithering for any required conversions
-        TEX_FILTER_DITHER_DIFFUSION = 0x20000,
-            // Use error-diffusion dithering for any required conversions
-
-        TEX_FILTER_POINT            = 0x100000,
-        TEX_FILTER_LINEAR           = 0x200000,
-        TEX_FILTER_CUBIC            = 0x300000,
-        TEX_FILTER_BOX              = 0x400000,
-        TEX_FILTER_FANT             = 0x400000, // Equiv to Box filtering for mipmap generation
-        TEX_FILTER_TRIANGLE         = 0x500000,
-            // Filtering mode to use for any required image resizing
-
-        TEX_FILTER_SRGB_IN          = 0x1000000,
-        TEX_FILTER_SRGB_OUT         = 0x2000000,
-        TEX_FILTER_SRGB             = ( TEX_FILTER_SRGB_IN | TEX_FILTER_SRGB_OUT ),
-            // sRGB <-> RGB for use in conversion operations
-            // if the input format type is IsSRGB(), then SRGB_IN is on by default
-            // if the output format type is IsSRGB(), then SRGB_OUT is on by default
-
-        TEX_FILTER_FORCE_NON_WIC    = 0x10000000,
-            // Forces use of the non-WIC path when both are an option
-
-        TEX_FILTER_FORCE_WIC        = 0x20000000,
-            // Forces use of the WIC path even when logic would have picked a non-WIC path when both are an option
-    };
-
-    HRESULT Resize( _In_ const Image& srcImage, _In_ size_t width, _In_ size_t height, _In_ DWORD filter,
-                    _Out_ ScratchImage& image );
-    HRESULT Resize( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                    _In_ size_t width, _In_ size_t height, _In_ DWORD filter, _Out_ ScratchImage& result );
-        // Resize the image to width x height. Defaults to Fant filtering.
-        // Note for a complex resize, the result will always have mipLevels == 1
-
-    HRESULT Convert( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD filter, _In_ float threshold,
-                     _Out_ ScratchImage& image );
-    HRESULT Convert( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                     _In_ DXGI_FORMAT format, _In_ DWORD filter, _In_ float threshold, _Out_ ScratchImage& result );
-        // Convert the image to a new format
-    
-    HRESULT ConvertToSinglePlane( _In_ const Image& srcImage, _Out_ ScratchImage& image );
-    HRESULT ConvertToSinglePlane( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                                  _Out_ ScratchImage& image );
-        // Converts the image from a planar format to an equivalent non-planar format
-
-    HRESULT GenerateMipMaps( _In_ const Image& baseImage, _In_ DWORD filter, _In_ size_t levels,
-                             _Inout_ ScratchImage& mipChain, _In_ bool allow1D = false );
-    HRESULT GenerateMipMaps( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                             _In_ DWORD filter, _In_ size_t levels, _Inout_ ScratchImage& mipChain );
-        // levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base image)
-        // Defaults to Fant filtering which is equivalent to a box filter
-
-    HRESULT GenerateMipMaps3D( _In_reads_(depth) const Image* baseImages, _In_ size_t depth, _In_ DWORD filter, _In_ size_t levels,
-                               _Out_ ScratchImage& mipChain );
-    HRESULT GenerateMipMaps3D( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                               _In_ DWORD filter, _In_ size_t levels, _Out_ ScratchImage& mipChain );
-        // levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base image)
-        // Defaults to Fant filtering which is equivalent to a box filter
-
-    enum TEX_PMALPHA_FLAGS
-    {
-        TEX_PMALPHA_DEFAULT         = 0,
-
-        TEX_PMALPHA_IGNORE_SRGB     = 0x1,
-            // ignores sRGB colorspace conversions
-
-        TEX_PMALPHA_SRGB_IN         = 0x1000000,
-        TEX_PMALPHA_SRGB_OUT        = 0x2000000,
-        TEX_PMALPHA_SRGB            = ( TEX_PMALPHA_SRGB_IN | TEX_PMALPHA_SRGB_OUT ),
-            // if the input format type is IsSRGB(), then SRGB_IN is on by default
-            // if the output format type is IsSRGB(), then SRGB_OUT is on by default
-    };
-
-    HRESULT PremultiplyAlpha( _In_ const Image& srcImage, _In_ DWORD flags, _Out_ ScratchImage& image );
-    HRESULT PremultiplyAlpha( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags, _Out_ ScratchImage& result );
-        // Converts to a premultiplied alpha version of the texture
-
-    enum TEX_COMPRESS_FLAGS
-    {
-        TEX_COMPRESS_DEFAULT        = 0,
-
-        TEX_COMPRESS_RGB_DITHER     = 0x10000,
-            // Enables dithering RGB colors for BC1-3 compression
-
-        TEX_COMPRESS_A_DITHER       = 0x20000,
-            // Enables dithering alpha for BC1-3 compression
-
-        TEX_COMPRESS_DITHER         = 0x30000,
-            // Enables both RGB and alpha dithering for BC1-3 compression
-
-        TEX_COMPRESS_UNIFORM        = 0x40000,
-            // Uniform color weighting for BC1-3 compression; by default uses perceptual weighting
-
-        TEX_COMPRESS_SRGB_IN        = 0x1000000,
-        TEX_COMPRESS_SRGB_OUT       = 0x2000000,
-        TEX_COMPRESS_SRGB           = ( TEX_COMPRESS_SRGB_IN | TEX_COMPRESS_SRGB_OUT ),
-            // if the input format type is IsSRGB(), then SRGB_IN is on by default
-            // if the output format type is IsSRGB(), then SRGB_OUT is on by default
-
-        TEX_COMPRESS_PARALLEL       = 0x10000000,
-            // Compress is free to use multithreading to improve performance (by default it does not use multithreading)
-    };
-
-    HRESULT Compress( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaRef,
-                      _Out_ ScratchImage& cImage );
-    HRESULT Compress( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                      _In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaRef, _Out_ ScratchImage& cImages );
-        // Note that alphaRef is only used by BC1. 0.5f is a typical value to use
-
-    HRESULT Compress( _In_ ID3D11Device* pDevice, _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD compress,
-                      _In_ float alphaWeight, _Out_ ScratchImage& image );
-    HRESULT Compress( _In_ ID3D11Device* pDevice, _In_ const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                      _In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaWeight, _Out_ ScratchImage& cImages );
-        // DirectCompute-based compression (alphaWeight is only used by BC7. 1.0 is the typical value to use)
-
-    HRESULT Decompress( _In_ const Image& cImage, _In_ DXGI_FORMAT format, _Out_ ScratchImage& image );
-    HRESULT Decompress( _In_reads_(nimages) const Image* cImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                        _In_ DXGI_FORMAT format, _Out_ ScratchImage& images );
-
-    //---------------------------------------------------------------------------------
-    // Normal map operations
-
-    enum CNMAP_FLAGS
-    {
-        CNMAP_DEFAULT           = 0,
-
-        CNMAP_CHANNEL_RED       = 0x1,
-        CNMAP_CHANNEL_GREEN     = 0x2,
-        CNMAP_CHANNEL_BLUE      = 0x3,
-        CNMAP_CHANNEL_ALPHA     = 0x4,
-        CNMAP_CHANNEL_LUMINANCE = 0x5,
-            // Channel selection when evaluting color value for height
-            // Luminance is a combination of red, green, and blue
-
-        CNMAP_MIRROR_U          = 0x1000,
-        CNMAP_MIRROR_V          = 0x2000,
-        CNMAP_MIRROR            = 0x3000,
-            // Use mirror semantics for scanline references (defaults to wrap)
-
-        CNMAP_INVERT_SIGN       = 0x4000,
-            // Inverts normal sign
-
-        CNMAP_COMPUTE_OCCLUSION = 0x8000,
-            // Computes a crude occlusion term stored in the alpha channel
-    };
-
-    HRESULT ComputeNormalMap( _In_ const Image& srcImage, _In_ DWORD flags, _In_ float amplitude,
-                              _In_ DXGI_FORMAT format, _Out_ ScratchImage& normalMap );
-    HRESULT ComputeNormalMap( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                              _In_ DWORD flags, _In_ float amplitude, _In_ DXGI_FORMAT format, _Out_ ScratchImage& normalMaps );
-
-    //---------------------------------------------------------------------------------
-    // Misc image operations
-    struct Rect
-    {
-        size_t x;
-        size_t y;
-        size_t w;
-        size_t h;
-
-        Rect() {}
-        Rect( size_t _x, size_t _y, size_t _w, size_t _h ) : x(_x), y(_y), w(_w), h(_h) {}
-    };
-
-    HRESULT CopyRectangle( _In_ const Image& srcImage, _In_ const Rect& srcRect, _In_ const Image& dstImage,
-                           _In_ DWORD filter, _In_ size_t xOffset, _In_ size_t yOffset );
-
-    enum CMSE_FLAGS
-    {
-        CMSE_DEFAULT                = 0,
-
-        CMSE_IMAGE1_SRGB            = 0x1,
-        CMSE_IMAGE2_SRGB            = 0x2,
-            // Indicates that image needs gamma correction before comparision
-
-        CMSE_IGNORE_RED             = 0x10,
-        CMSE_IGNORE_GREEN           = 0x20,
-        CMSE_IGNORE_BLUE            = 0x40,
-        CMSE_IGNORE_ALPHA           = 0x80,
-            // Ignore the channel when computing MSE
-
-        CMSE_IMAGE1_X2_BIAS         = 0x100,
-        CMSE_IMAGE2_X2_BIAS         = 0x200,
-            // Indicates that image should be scaled and biased before comparison (i.e. UNORM -> SNORM)
-    };
-
-    HRESULT ComputeMSE( _In_ const Image& image1, _In_ const Image& image2, _Out_ float& mse, _Out_writes_opt_(4) float* mseV, _In_ DWORD flags = 0 );
-
-    //---------------------------------------------------------------------------------
-    // Direct3D 11 functions
-    bool IsSupportedTexture( _In_ ID3D11Device* pDevice, _In_ const TexMetadata& metadata );
-
-    HRESULT CreateTexture( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                           _Outptr_ ID3D11Resource** ppResource );
-
-    HRESULT CreateShaderResourceView( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                                      _Outptr_ ID3D11ShaderResourceView** ppSRV );
-
-    HRESULT CreateTextureEx( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                             _In_ D3D11_USAGE usage, _In_ unsigned int bindFlags, _In_ unsigned int cpuAccessFlags, _In_ unsigned int miscFlags, _In_ bool forceSRGB,
-                             _Outptr_ ID3D11Resource** ppResource );
-
-    HRESULT CreateShaderResourceViewEx( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                                        _In_ D3D11_USAGE usage, _In_ unsigned int bindFlags, _In_ unsigned int cpuAccessFlags, _In_ unsigned int miscFlags, _In_ bool forceSRGB,
-                                        _Outptr_ ID3D11ShaderResourceView** ppSRV );
-
-    HRESULT CaptureTexture( _In_ ID3D11Device* pDevice, _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _Out_ ScratchImage& result );
-
-#include "DirectXTex.inl"
-
-}; // namespace

+ 0 - 352
Exporters/FBX/3rdParty/DirectXTex/DirectXTex.inl

@@ -1,352 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTex.inl
-//  
-// DirectX Texture Library
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-//=====================================================================================
-// DXGI Format Utilities
-//=====================================================================================
-
-_Use_decl_annotations_
-inline bool IsValid( DXGI_FORMAT fmt )
-{
-    return ( static_cast<size_t>(fmt) >= 1 && static_cast<size_t>(fmt) <= 120 );
-}
-
-_Use_decl_annotations_
-inline bool IsCompressed( DXGI_FORMAT fmt )
-{
-    switch ( fmt )
-    {
-    case DXGI_FORMAT_BC1_TYPELESS:
-    case DXGI_FORMAT_BC1_UNORM:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:
-    case DXGI_FORMAT_BC2_TYPELESS:
-    case DXGI_FORMAT_BC2_UNORM:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:
-    case DXGI_FORMAT_BC3_TYPELESS:
-    case DXGI_FORMAT_BC3_UNORM:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:
-    case DXGI_FORMAT_BC4_TYPELESS:
-    case DXGI_FORMAT_BC4_UNORM:
-    case DXGI_FORMAT_BC4_SNORM:
-    case DXGI_FORMAT_BC5_TYPELESS:
-    case DXGI_FORMAT_BC5_UNORM:
-    case DXGI_FORMAT_BC5_SNORM:
-    case DXGI_FORMAT_BC6H_TYPELESS:
-    case DXGI_FORMAT_BC6H_UF16:
-    case DXGI_FORMAT_BC6H_SF16:
-    case DXGI_FORMAT_BC7_TYPELESS:
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsPacked( DXGI_FORMAT fmt )
-{
-    switch( fmt )
-    {
-    case DXGI_FORMAT_R8G8_B8G8_UNORM:
-    case DXGI_FORMAT_G8R8_G8B8_UNORM:
-    case DXGI_FORMAT_YUY2: // 4:2:2 8-bit
-    case DXGI_FORMAT_Y210: // 4:2:2 10-bit
-    case DXGI_FORMAT_Y216: // 4:2:2 16-bit
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsPlanar( DXGI_FORMAT fmt )
-{
-    switch ( static_cast<int>(fmt) )
-    {
-    case DXGI_FORMAT_NV12:      // 4:2:0 8-bit
-    case DXGI_FORMAT_P010:      // 4:2:0 10-bit
-    case DXGI_FORMAT_P016:      // 4:2:0 16-bit
-    case DXGI_FORMAT_420_OPAQUE:// 4:2:0 8-bit
-    case DXGI_FORMAT_NV11:      // 4:1:1 8-bit
-        return true;
-
-    case 118 /* DXGI_FORMAT_D16_UNORM_S8_UINT */:
-    case 119 /* DXGI_FORMAT_R16_UNORM_X8_TYPELESS */:
-    case 120 /* DXGI_FORMAT_X16_TYPELESS_G8_UINT */:
-        // These are Xbox One platform specific types
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsPalettized( DXGI_FORMAT fmt )
-{
-    switch( fmt )
-    {
-    case DXGI_FORMAT_AI44:
-    case DXGI_FORMAT_IA44:
-    case DXGI_FORMAT_P8:
-    case DXGI_FORMAT_A8P8:
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsVideo( DXGI_FORMAT fmt )
-{
-    switch ( fmt )
-    {
-    case DXGI_FORMAT_AYUV:
-    case DXGI_FORMAT_Y410:
-    case DXGI_FORMAT_Y416:
-    case DXGI_FORMAT_NV12:
-    case DXGI_FORMAT_P010:
-    case DXGI_FORMAT_P016:
-    case DXGI_FORMAT_YUY2:
-    case DXGI_FORMAT_Y210:
-    case DXGI_FORMAT_Y216:
-    case DXGI_FORMAT_NV11:
-        // These video formats can be used with the 3D pipeline through special view mappings
-
-    case DXGI_FORMAT_420_OPAQUE:
-    case DXGI_FORMAT_AI44:
-    case DXGI_FORMAT_IA44:
-    case DXGI_FORMAT_P8:
-    case DXGI_FORMAT_A8P8:
-        // These are limited use video formats not usable in any way by the 3D pipeline
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsDepthStencil( DXGI_FORMAT fmt )
-{
-    switch( static_cast<int>(fmt) )
-    {
-    case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
-    case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
-    case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
-    case DXGI_FORMAT_D32_FLOAT:
-    case DXGI_FORMAT_D24_UNORM_S8_UINT:
-    case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
-    case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
-    case DXGI_FORMAT_D16_UNORM:
-    case 118 /* DXGI_FORMAT_D16_UNORM_S8_UINT */:
-    case 119 /* DXGI_FORMAT_R16_UNORM_X8_TYPELESS */:
-    case 120 /* DXGI_FORMAT_X16_TYPELESS_G8_UINT */:
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsSRGB( DXGI_FORMAT fmt )
-{
-    switch( fmt )
-    {
-    case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:
-    case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
-    case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool IsTypeless( DXGI_FORMAT fmt, bool partialTypeless )
-{
-    switch( static_cast<int>(fmt) )
-    {
-    case DXGI_FORMAT_R32G32B32A32_TYPELESS:
-    case DXGI_FORMAT_R32G32B32_TYPELESS:
-    case DXGI_FORMAT_R16G16B16A16_TYPELESS:
-    case DXGI_FORMAT_R32G32_TYPELESS:
-    case DXGI_FORMAT_R32G8X24_TYPELESS:
-    case DXGI_FORMAT_R10G10B10A2_TYPELESS:
-    case DXGI_FORMAT_R8G8B8A8_TYPELESS:
-    case DXGI_FORMAT_R16G16_TYPELESS:
-    case DXGI_FORMAT_R32_TYPELESS:
-    case DXGI_FORMAT_R24G8_TYPELESS:
-    case DXGI_FORMAT_R8G8_TYPELESS:
-    case DXGI_FORMAT_R16_TYPELESS:
-    case DXGI_FORMAT_R8_TYPELESS:
-    case DXGI_FORMAT_BC1_TYPELESS:
-    case DXGI_FORMAT_BC2_TYPELESS:
-    case DXGI_FORMAT_BC3_TYPELESS:
-    case DXGI_FORMAT_BC4_TYPELESS:
-    case DXGI_FORMAT_BC5_TYPELESS:
-    case DXGI_FORMAT_B8G8R8A8_TYPELESS:
-    case DXGI_FORMAT_B8G8R8X8_TYPELESS:
-    case DXGI_FORMAT_BC6H_TYPELESS:
-    case DXGI_FORMAT_BC7_TYPELESS:
-        return true;
-
-    case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
-    case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
-    case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
-    case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
-        return partialTypeless;
-
-    case 119 /* DXGI_FORMAT_R16_UNORM_X8_TYPELESS */:
-    case 120 /* DXGI_FORMAT_X16_TYPELESS_G8_UINT */:
-        // These are Xbox One platform specific types
-        return partialTypeless;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline bool HasAlpha( DXGI_FORMAT fmt )
-{
-    switch( static_cast<int>(fmt) )
-    {
-    case DXGI_FORMAT_R32G32B32A32_TYPELESS:
-    case DXGI_FORMAT_R32G32B32A32_FLOAT:
-    case DXGI_FORMAT_R32G32B32A32_UINT:
-    case DXGI_FORMAT_R32G32B32A32_SINT:
-    case DXGI_FORMAT_R16G16B16A16_TYPELESS:
-    case DXGI_FORMAT_R16G16B16A16_FLOAT:
-    case DXGI_FORMAT_R16G16B16A16_UNORM:
-    case DXGI_FORMAT_R16G16B16A16_UINT:
-    case DXGI_FORMAT_R16G16B16A16_SNORM:
-    case DXGI_FORMAT_R16G16B16A16_SINT:
-    case DXGI_FORMAT_R10G10B10A2_TYPELESS:
-    case DXGI_FORMAT_R10G10B10A2_UNORM:
-    case DXGI_FORMAT_R10G10B10A2_UINT:
-    case DXGI_FORMAT_R8G8B8A8_TYPELESS:
-    case DXGI_FORMAT_R8G8B8A8_UNORM:
-    case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
-    case DXGI_FORMAT_R8G8B8A8_UINT:
-    case DXGI_FORMAT_R8G8B8A8_SNORM:
-    case DXGI_FORMAT_R8G8B8A8_SINT:
-    case DXGI_FORMAT_A8_UNORM:
-    case DXGI_FORMAT_BC1_TYPELESS:
-    case DXGI_FORMAT_BC1_UNORM:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:
-    case DXGI_FORMAT_BC2_TYPELESS:
-    case DXGI_FORMAT_BC2_UNORM:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:
-    case DXGI_FORMAT_BC3_TYPELESS:
-    case DXGI_FORMAT_BC3_UNORM:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:
-    case DXGI_FORMAT_B5G5R5A1_UNORM:
-    case DXGI_FORMAT_B8G8R8A8_UNORM:
-    case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
-    case DXGI_FORMAT_B8G8R8A8_TYPELESS:
-    case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
-    case DXGI_FORMAT_BC7_TYPELESS:
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-    case DXGI_FORMAT_AYUV:
-    case DXGI_FORMAT_Y410:
-    case DXGI_FORMAT_Y416:
-    case DXGI_FORMAT_AI44:
-    case DXGI_FORMAT_IA44:
-    case DXGI_FORMAT_A8P8:
-    case DXGI_FORMAT_B4G4R4A4_UNORM:
-        return true;
-
-    case 116 /* DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT */:
-    case 117 /* DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT */:
-        // These are Xbox One platform specific types
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-_Use_decl_annotations_
-inline size_t ComputeScanlines( DXGI_FORMAT fmt, size_t height )
-{
-    if ( IsCompressed(fmt) )
-    {
-        return std::max<size_t>( 1, (height + 3) / 4 );
-    }
-    else if ( fmt == DXGI_FORMAT_NV11 )
-    {
-        // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data
-        return height * 2;
-    }
-    else if ( IsPlanar(fmt) )
-    {
-        return height + ( ( height + 1 ) >> 1 );
-    }
-    else
-    {
-        return height;
-    }
-}
-
-//=====================================================================================
-// Image I/O
-//=====================================================================================
-_Use_decl_annotations_
-inline HRESULT SaveToDDSMemory( const Image& image, DWORD flags, Blob& blob )
-{
-    TexMetadata mdata;
-    memset( &mdata, 0, sizeof(mdata) );
-    mdata.width = image.width;
-    mdata.height = image.height;
-    mdata.depth = 1;
-    mdata.arraySize = 1;
-    mdata.mipLevels = 1;
-    mdata.format = image.format;
-    mdata.dimension = TEX_DIMENSION_TEXTURE2D;
-
-    return SaveToDDSMemory( &image, 1, mdata, flags, blob );
-}
-
-_Use_decl_annotations_
-inline HRESULT SaveToDDSFile( const Image& image, DWORD flags, LPCWSTR szFile )
-{
-    TexMetadata mdata;
-    memset( &mdata, 0, sizeof(mdata) );
-    mdata.width = image.width;
-    mdata.height = image.height;
-    mdata.depth = 1;
-    mdata.arraySize = 1;
-    mdata.mipLevels = 1;
-    mdata.format = image.format;
-    mdata.dimension = TEX_DIMENSION_TEXTURE2D;
-
-    return SaveToDDSFile( &image, 1, mdata, flags, szFile );
-}

+ 0 - 809
Exporters/FBX/3rdParty/DirectXTex/DirectXTexCompress.cpp

@@ -1,809 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexCompress.cpp
-//  
-// DirectX Texture Library - Texture compression
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-#ifdef _OPENMP
-#include <omp.h>
-#pragma warning(disable : 4616 6993)
-#endif
-
-#include "bc.h"
-
-
-namespace DirectX
-{
-
-inline static DWORD _GetBCFlags( _In_ DWORD compress )
-{
-    static_assert( TEX_COMPRESS_RGB_DITHER == BC_FLAGS_DITHER_RGB, "TEX_COMPRESS_* flags should match BC_FLAGS_*" );
-    static_assert( TEX_COMPRESS_A_DITHER == BC_FLAGS_DITHER_A, "TEX_COMPRESS_* flags should match BC_FLAGS_*"  );
-    static_assert( TEX_COMPRESS_DITHER == (BC_FLAGS_DITHER_RGB | BC_FLAGS_DITHER_A), "TEX_COMPRESS_* flags should match BC_FLAGS_*"  );
-    static_assert( TEX_COMPRESS_UNIFORM == BC_FLAGS_UNIFORM, "TEX_COMPRESS_* flags should match BC_FLAGS_*"  );
-    return ( compress & (BC_FLAGS_DITHER_RGB|BC_FLAGS_DITHER_A|BC_FLAGS_UNIFORM) );
-}
-
-inline static DWORD _GetSRGBFlags( _In_ DWORD compress )
-{
-    static_assert( TEX_COMPRESS_SRGB_IN == TEX_FILTER_SRGB_IN, "TEX_COMPRESS_SRGB* should match TEX_FILTER_SRGB*" );
-    static_assert( TEX_COMPRESS_SRGB_OUT == TEX_FILTER_SRGB_OUT, "TEX_COMPRESS_SRGB* should match TEX_FILTER_SRGB*" );
-    static_assert( TEX_COMPRESS_SRGB == TEX_FILTER_SRGB, "TEX_COMPRESS_SRGB* should match TEX_FILTER_SRGB*" );
-    return ( compress & TEX_COMPRESS_SRGB );
-}
-
-inline static bool _DetermineEncoderSettings( _In_ DXGI_FORMAT format, _Out_ BC_ENCODE& pfEncode, _Out_ size_t& blocksize, _Out_ DWORD& cflags )
-{
-    switch(format)
-    {
-    case DXGI_FORMAT_BC1_UNORM:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:    pfEncode = nullptr;         blocksize = 8;   cflags = 0; break;
-    case DXGI_FORMAT_BC2_UNORM:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:    pfEncode = D3DXEncodeBC2;   blocksize = 16;  cflags = 0; break;
-    case DXGI_FORMAT_BC3_UNORM:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:    pfEncode = D3DXEncodeBC3;   blocksize = 16;  cflags = 0; break;
-    case DXGI_FORMAT_BC4_UNORM:         pfEncode = D3DXEncodeBC4U;  blocksize = 8;   cflags = TEX_FILTER_RGB_COPY_RED; break;
-    case DXGI_FORMAT_BC4_SNORM:         pfEncode = D3DXEncodeBC4S;  blocksize = 8;   cflags = TEX_FILTER_RGB_COPY_RED; break;
-    case DXGI_FORMAT_BC5_UNORM:         pfEncode = D3DXEncodeBC5U;  blocksize = 16;  cflags = TEX_FILTER_RGB_COPY_RED | TEX_FILTER_RGB_COPY_GREEN; break;
-    case DXGI_FORMAT_BC5_SNORM:         pfEncode = D3DXEncodeBC5S;  blocksize = 16;  cflags = TEX_FILTER_RGB_COPY_RED | TEX_FILTER_RGB_COPY_GREEN; break;
-    case DXGI_FORMAT_BC6H_UF16:         pfEncode = D3DXEncodeBC6HU; blocksize = 16;  cflags = 0; break;
-    case DXGI_FORMAT_BC6H_SF16:         pfEncode = D3DXEncodeBC6HS; blocksize = 16;  cflags = 0; break;
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:    pfEncode = D3DXEncodeBC7;   blocksize = 16;  cflags = 0; break;
-    default:                            pfEncode = nullptr;         blocksize = 0;   cflags = 0; return false;
-    }
-
-    return true;
-}
-
-
-//-------------------------------------------------------------------------------------
-static HRESULT _CompressBC( _In_ const Image& image, _In_ const Image& result, _In_ DWORD bcflags,
-                            _In_ DWORD srgb, _In_ float alphaRef )
-{
-    if ( !image.pixels || !result.pixels )
-        return E_POINTER;
-
-    assert( image.width == result.width );
-    assert( image.height == result.height );
-
-    const DXGI_FORMAT format = image.format;
-    size_t sbpp = BitsPerPixel( format );
-    if ( !sbpp )
-        return E_FAIL;
-
-    if ( sbpp < 8 )
-    {
-        // We don't support compressing from monochrome (DXGI_FORMAT_R1_UNORM)
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    // Round to bytes
-    sbpp = ( sbpp + 7 ) / 8;
-
-    uint8_t *pDest = result.pixels;
-
-    // Determine BC format encoder
-    BC_ENCODE pfEncode;
-    size_t blocksize;
-    DWORD cflags;
-    if ( !_DetermineEncoderSettings( result.format, pfEncode, blocksize, cflags ) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    XMVECTOR temp[16];
-    const uint8_t *pSrc = image.pixels;
-    const size_t rowPitch = image.rowPitch;
-    for( size_t h=0; h < image.height; h += 4 )
-    {
-        const uint8_t *sptr = pSrc;
-        uint8_t* dptr = pDest;
-        size_t ph = std::min<size_t>( 4, image.height - h );
-        size_t w = 0;
-        for( size_t count = 0; count < rowPitch; count += sbpp*4, w += 4 )
-        {
-            size_t pw = std::min<size_t>( 4, image.width - w );
-            assert( pw > 0 && ph > 0 );
-
-            if ( !_LoadScanline( &temp[0], pw, sptr, rowPitch, format ) )
-                return E_FAIL;
-
-            if ( ph > 1 )
-            {
-                if ( !_LoadScanline( &temp[4], pw, sptr + rowPitch, rowPitch, format ) )
-                    return E_FAIL;
-
-                if ( ph > 2 )
-                {
-                    if ( !_LoadScanline( &temp[8], pw, sptr + rowPitch*2, rowPitch, format ) )
-                        return E_FAIL;
-
-                    if ( ph > 3 )
-                    {
-                        if ( !_LoadScanline( &temp[12], pw, sptr + rowPitch*3, rowPitch, format ) )
-                            return E_FAIL;
-                    }
-                }
-            }
-
-            if ( pw != 4 || ph != 4 )
-            {
-                // Replicate pixels for partial block
-                static const size_t uSrc[] = { 0, 0, 0, 1 };
-
-                if ( pw < 4 )
-                {
-                    for( size_t t = 0; t < ph && t < 4; ++t )
-                    {
-                        for( size_t s = pw; s < 4; ++s )
-                        {
-#pragma prefast(suppress: 26000, "PREFAST false positive")
-                            temp[ (t << 2) | s ] = temp[ (t << 2) | uSrc[s] ]; 
-                        }
-                    }
-                }
-
-                if ( ph < 4 )
-                {
-                    for( size_t t = ph; t < 4; ++t )
-                    {
-                        for( size_t s = 0; s < 4; ++s )
-                        {
-#pragma prefast(suppress: 26000, "PREFAST false positive")
-                            temp[ (t << 2) | s ] = temp[ (uSrc[t] << 2) | s ]; 
-                        }
-                    }
-                }
-            }
-
-            _ConvertScanline( temp, 16, result.format, format, cflags | srgb );
-            
-            if ( pfEncode )
-                pfEncode( dptr, temp, bcflags );
-            else
-                D3DXEncodeBC1( dptr, temp, alphaRef, bcflags );
-
-            sptr += sbpp*4;
-            dptr += blocksize;
-        }
-
-        pSrc += rowPitch*4;
-        pDest += result.rowPitch;
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-#ifdef _OPENMP
-static HRESULT _CompressBC_Parallel( _In_ const Image& image, _In_ const Image& result, _In_ DWORD bcflags,
-                                     _In_ DWORD srgb, _In_ float alphaRef )
-{
-    if ( !image.pixels || !result.pixels )
-        return E_POINTER;
-
-    assert( image.width == result.width );
-    assert( image.height == result.height );
-
-    const DXGI_FORMAT format = image.format;
-    size_t sbpp = BitsPerPixel( format );
-    if ( !sbpp )
-        return E_FAIL;
-
-    if ( sbpp < 8 )
-    {
-        // We don't support compressing from monochrome (DXGI_FORMAT_R1_UNORM)
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    // Round to bytes
-    sbpp = ( sbpp + 7 ) / 8;
-
-    // Determine BC format encoder
-    BC_ENCODE pfEncode;
-    size_t blocksize;
-    DWORD cflags;
-    if ( !_DetermineEncoderSettings( result.format, pfEncode, blocksize, cflags ) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    // Refactored version of loop to support parallel independance
-    const size_t nBlocks = std::max<size_t>(1, (image.width + 3) / 4 ) * std::max<size_t>(1, (image.height + 3) / 4 );
-
-    bool fail = false;
-
-#pragma omp parallel for
-    for( int nb=0; nb < static_cast<int>( nBlocks ); ++nb )
-    {
-        const size_t nbWidth = std::max<size_t>(1, (image.width + 3) / 4 );
-
-        const size_t y = nb / nbWidth;
-        const size_t x = nb - (y*nbWidth);
-
-        assert( x < image.width && y < image.height );
-
-        size_t rowPitch = image.rowPitch;
-        const uint8_t *pSrc = image.pixels + (y*4*rowPitch) + (x*4*sbpp);
-
-        uint8_t *pDest = result.pixels + (nb*blocksize);
-
-        size_t ph = std::min<size_t>( 4, image.height - y );
-        size_t pw = std::min<size_t>( 4, image.width - x );
-        assert( pw > 0 && ph > 0 );
-
-        XMVECTOR temp[16];
-        if ( !_LoadScanline( &temp[0], pw, pSrc, rowPitch, format ) )
-            fail = true;
-
-        if ( ph > 1 )
-        {
-            if ( !_LoadScanline( &temp[4], pw, pSrc + rowPitch, rowPitch, format ) )
-                fail = true;
-
-            if ( ph > 2 )
-            {
-                if ( !_LoadScanline( &temp[8], pw, pSrc + rowPitch*2, rowPitch, format ) )
-                    fail = true;
-
-                if ( ph > 3 )
-                {
-                    if ( !_LoadScanline( &temp[12], pw, pSrc + rowPitch*3, rowPitch, format ) )
-                        fail = true;
-                }
-            }
-        }
-
-        if ( pw != 4 || ph != 4 )
-        {
-            // Replicate pixels for partial block
-            static const size_t uSrc[] = { 0, 0, 0, 1 };
-
-            if ( pw < 4 )
-            {
-                for( size_t t = 0; t < ph && t < 4; ++t )
-                {
-                    for( size_t s = pw; s < 4; ++s )
-                    {
-                        temp[ (t << 2) | s ] = temp[ (t << 2) | uSrc[s] ]; 
-                    }
-                }
-            }
-
-            if ( ph < 4 )
-            {
-                for( size_t t = ph; t < 4; ++t )
-                {
-                    for( size_t s = 0; s < 4; ++s )
-                    {
-                        temp[ (t << 2) | s ] = temp[ (uSrc[t] << 2) | s ]; 
-                    }
-                }
-            }
-        }
-
-        _ConvertScanline( temp, 16, result.format, format, cflags | srgb );
-            
-        if ( pfEncode )
-            pfEncode( pDest, temp, bcflags );
-        else
-            D3DXEncodeBC1( pDest, temp, alphaRef, bcflags );
-    }
-
-    return (fail) ? E_FAIL : S_OK;
-}
-
-#endif // _OPENMP
-
-
-//-------------------------------------------------------------------------------------
-static DXGI_FORMAT _DefaultDecompress( _In_ DXGI_FORMAT format )
-{
-    switch( format )
-    {
-    case DXGI_FORMAT_BC1_TYPELESS:
-    case DXGI_FORMAT_BC1_UNORM:
-    case DXGI_FORMAT_BC2_TYPELESS:
-    case DXGI_FORMAT_BC2_UNORM:
-    case DXGI_FORMAT_BC3_TYPELESS:
-    case DXGI_FORMAT_BC3_UNORM:
-    case DXGI_FORMAT_BC7_TYPELESS:
-    case DXGI_FORMAT_BC7_UNORM:
-        return DXGI_FORMAT_R8G8B8A8_UNORM;
-
-    case DXGI_FORMAT_BC1_UNORM_SRGB:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
-
-    case DXGI_FORMAT_BC4_TYPELESS:
-    case DXGI_FORMAT_BC4_UNORM:
-        return DXGI_FORMAT_R8_UNORM;
-
-    case DXGI_FORMAT_BC4_SNORM:
-        return DXGI_FORMAT_R8_SNORM;
-
-    case DXGI_FORMAT_BC5_TYPELESS:
-    case DXGI_FORMAT_BC5_UNORM:
-        return DXGI_FORMAT_R8G8_UNORM;
-
-    case DXGI_FORMAT_BC5_SNORM:
-        return DXGI_FORMAT_R8G8_SNORM;
-
-    case DXGI_FORMAT_BC6H_TYPELESS:
-    case DXGI_FORMAT_BC6H_UF16:
-    case DXGI_FORMAT_BC6H_SF16:
-        // We could use DXGI_FORMAT_R32G32B32_FLOAT here since BC6H is always Alpha 1.0,
-        // but this format is more supported by viewers
-        return DXGI_FORMAT_R32G32B32A32_FLOAT;
-
-    default:
-        return DXGI_FORMAT_UNKNOWN;
-    }
-}
-
-
-//-------------------------------------------------------------------------------------
-static HRESULT _DecompressBC( _In_ const Image& cImage, _In_ const Image& result )
-{
-    if ( !cImage.pixels || !result.pixels )
-        return E_POINTER;
-
-    assert( cImage.width == result.width );
-    assert( cImage.height == result.height );
-
-    const DXGI_FORMAT format = result.format;
-    size_t dbpp = BitsPerPixel( format );
-    if ( !dbpp )
-        return E_FAIL;
-
-    if ( dbpp < 8 )
-    {
-        // We don't support decompressing to monochrome (DXGI_FORMAT_R1_UNORM)
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    // Round to bytes
-    dbpp = ( dbpp + 7 ) / 8;
-
-    uint8_t *pDest = result.pixels;
-    if ( !pDest )
-        return E_POINTER;
-
-    // Promote "typeless" BC formats
-    DXGI_FORMAT cformat;
-    switch( cImage.format )
-    {
-    case DXGI_FORMAT_BC1_TYPELESS:  cformat = DXGI_FORMAT_BC1_UNORM; break;
-    case DXGI_FORMAT_BC2_TYPELESS:  cformat = DXGI_FORMAT_BC2_UNORM; break;
-    case DXGI_FORMAT_BC3_TYPELESS:  cformat = DXGI_FORMAT_BC3_UNORM; break;
-    case DXGI_FORMAT_BC4_TYPELESS:  cformat = DXGI_FORMAT_BC4_UNORM; break;
-    case DXGI_FORMAT_BC5_TYPELESS:  cformat = DXGI_FORMAT_BC5_UNORM; break;
-    case DXGI_FORMAT_BC6H_TYPELESS: cformat = DXGI_FORMAT_BC6H_UF16; break;
-    case DXGI_FORMAT_BC7_TYPELESS:  cformat = DXGI_FORMAT_BC7_UNORM; break;
-    default:                        cformat = cImage.format;         break;
-    }
-
-    // Determine BC format decoder
-    BC_DECODE pfDecode;
-    size_t sbpp;
-    switch(cformat)
-    {
-    case DXGI_FORMAT_BC1_UNORM:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:    pfDecode = D3DXDecodeBC1;   sbpp = 8;   break;
-    case DXGI_FORMAT_BC2_UNORM:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:    pfDecode = D3DXDecodeBC2;   sbpp = 16;  break;
-    case DXGI_FORMAT_BC3_UNORM:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:    pfDecode = D3DXDecodeBC3;   sbpp = 16;  break;
-    case DXGI_FORMAT_BC4_UNORM:         pfDecode = D3DXDecodeBC4U;  sbpp = 8;   break;
-    case DXGI_FORMAT_BC4_SNORM:         pfDecode = D3DXDecodeBC4S;  sbpp = 8;   break;
-    case DXGI_FORMAT_BC5_UNORM:         pfDecode = D3DXDecodeBC5U;  sbpp = 16;  break;
-    case DXGI_FORMAT_BC5_SNORM:         pfDecode = D3DXDecodeBC5S;  sbpp = 16;  break;
-    case DXGI_FORMAT_BC6H_UF16:         pfDecode = D3DXDecodeBC6HU; sbpp = 16;  break;
-    case DXGI_FORMAT_BC6H_SF16:         pfDecode = D3DXDecodeBC6HS; sbpp = 16;  break;
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:    pfDecode = D3DXDecodeBC7;   sbpp = 16;  break;
-    default:
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    XMVECTOR temp[16];
-    const uint8_t *pSrc = cImage.pixels;
-    const size_t rowPitch = result.rowPitch;
-    for( size_t h=0; h < cImage.height; h += 4 )
-    {
-        const uint8_t *sptr = pSrc;
-        uint8_t* dptr = pDest;
-        size_t ph = std::min<size_t>( 4, cImage.height - h );
-        size_t w = 0;
-        for( size_t count = 0; count < cImage.rowPitch; count += sbpp, w += 4 )
-        {
-            pfDecode( temp, sptr );
-            _ConvertScanline( temp, 16, format, cformat, 0 );
-
-            size_t pw = std::min<size_t>( 4, cImage.width - w );
-            assert( pw > 0 && ph > 0 );
-
-            if ( !_StoreScanline( dptr, rowPitch, format, &temp[0], pw ) )
-                return E_FAIL;
-
-            if ( ph > 1 )
-            {
-                if ( !_StoreScanline( dptr + rowPitch, rowPitch, format, &temp[4], pw ) )
-                    return E_FAIL;
-
-                if ( ph > 2 )
-                {
-                    if ( !_StoreScanline( dptr + rowPitch*2, rowPitch, format, &temp[8], pw ) )
-                        return E_FAIL;
-
-                    if ( ph > 3 )
-                    {
-                        if ( !_StoreScanline( dptr + rowPitch*3, rowPitch, format, &temp[12], pw ) )
-                            return E_FAIL;
-                    }
-                }
-            }
-
-            sptr += sbpp;
-            dptr += dbpp*4;
-        }
-
-        pSrc += cImage.rowPitch;
-        pDest += rowPitch*4;
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-bool _IsAlphaAllOpaqueBC( _In_ const Image& cImage )
-{
-    if ( !cImage.pixels )
-        return false;
-
-    // Promote "typeless" BC formats
-    DXGI_FORMAT cformat;
-    switch( cImage.format )
-    {
-    case DXGI_FORMAT_BC1_TYPELESS:  cformat = DXGI_FORMAT_BC1_UNORM; break;
-    case DXGI_FORMAT_BC2_TYPELESS:  cformat = DXGI_FORMAT_BC2_UNORM; break;
-    case DXGI_FORMAT_BC3_TYPELESS:  cformat = DXGI_FORMAT_BC3_UNORM; break;
-    case DXGI_FORMAT_BC7_TYPELESS:  cformat = DXGI_FORMAT_BC7_UNORM; break;
-    default:                        cformat = cImage.format;         break;
-    }
-
-    // Determine BC format decoder
-    BC_DECODE pfDecode;
-    size_t sbpp;
-    switch(cformat)
-    {
-    case DXGI_FORMAT_BC1_UNORM:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:    pfDecode = D3DXDecodeBC1;   sbpp = 8;   break;
-    case DXGI_FORMAT_BC2_UNORM:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:    pfDecode = D3DXDecodeBC2;   sbpp = 16;  break;
-    case DXGI_FORMAT_BC3_UNORM:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:    pfDecode = D3DXDecodeBC3;   sbpp = 16;  break;
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:    pfDecode = D3DXDecodeBC7;   sbpp = 16;  break;
-    default:
-        // BC4, BC5, and BC6 don't have alpha channels
-        return false;
-    }
-
-    // Scan blocks for non-opaque alpha
-    static const XMVECTORF32 threshold = { 0.99f, 0.99f, 0.99f, 0.99f };
-
-    XMVECTOR temp[16];
-    const uint8_t *pPixels = cImage.pixels;
-    for( size_t h = 0; h < cImage.height; h += 4 )
-    {
-        const uint8_t *ptr = pPixels;
-        size_t ph = std::min<size_t>( 4, cImage.height - h );
-        size_t w = 0;
-        for( size_t count = 0; count < cImage.rowPitch; count += sbpp, w += 4 )
-        {
-            pfDecode( temp, ptr );
-
-            size_t pw = std::min<size_t>( 4, cImage.width - w );
-            assert( pw > 0 && ph > 0 );
-
-            if ( pw == 4 && ph == 4 )
-            {
-                // Full blocks
-                for( size_t j = 0; j < 16; ++j )
-                {
-                    XMVECTOR alpha = XMVectorSplatW( temp[j] );
-                    if ( XMVector4Less( alpha, threshold ) )
-                        return false;
-                }
-            }
-            else
-            {
-                // Handle partial blocks
-                for( size_t y = 0; y < ph; ++y )
-                {
-                    for( size_t x = 0; x < pw; ++x )
-                    {
-                        XMVECTOR alpha = XMVectorSplatW( temp[ y * 4 + x ] );
-                        if ( XMVector4Less( alpha, threshold ) )
-                            return false;
-                    }
-                }
-            }
-
-            ptr += sbpp;
-        }
-
-        pPixels += cImage.rowPitch;
-    }
-
-    return true;
-}
-
-
-//=====================================================================================
-// Entry-points
-//=====================================================================================
-
-//-------------------------------------------------------------------------------------
-// Compression
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT Compress( const Image& srcImage, DXGI_FORMAT format, DWORD compress, float alphaRef, ScratchImage& image )
-{
-    if ( IsCompressed(srcImage.format) || !IsCompressed(format) )
-        return E_INVALIDARG;
-
-    if ( IsTypeless(format)
-         || IsTypeless(srcImage.format) || IsPlanar(srcImage.format) || IsPalettized(srcImage.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    // Create compressed image
-    HRESULT hr = image.Initialize2D( format, srcImage.width, srcImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *img = image.GetImage( 0, 0, 0 );
-    if ( !img )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    // Compress single image
-    if (compress & TEX_COMPRESS_PARALLEL)
-    {
-#ifndef _OPENMP
-        return E_NOTIMPL;
-#else
-        hr = _CompressBC_Parallel( srcImage, *img, _GetBCFlags( compress ), _GetSRGBFlags( compress ), alphaRef );
-#endif // _OPENMP
-    }
-    else
-    {
-        hr = _CompressBC( srcImage, *img, _GetBCFlags( compress ), _GetSRGBFlags( compress ), alphaRef );
-    }
-
-    if ( FAILED(hr) )
-        image.Release();
-
-    return hr;
-}
-
-_Use_decl_annotations_
-HRESULT Compress( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                  DXGI_FORMAT format, DWORD compress, float alphaRef, ScratchImage& cImages )
-{
-    if ( !srcImages || !nimages )
-        return E_INVALIDARG;
-
-    if ( IsCompressed(metadata.format) || !IsCompressed(format) )
-        return E_INVALIDARG;
-
-    if ( IsTypeless(format)
-         || IsTypeless(metadata.format) || IsPlanar(metadata.format) || IsPalettized(metadata.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    cImages.Release();
-
-    TexMetadata mdata2 = metadata;
-    mdata2.format = format;
-    HRESULT hr = cImages.Initialize( mdata2 );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( nimages != cImages.GetImageCount() )
-    {
-        cImages.Release();
-        return E_FAIL;
-    }
-
-    const Image* dest = cImages.GetImages();
-    if ( !dest  )
-    {
-        cImages.Release();
-        return E_POINTER;
-    }
-
-    for( size_t index=0; index < nimages; ++index )
-    {
-        assert( dest[ index ].format == format );
-
-        const Image& src = srcImages[ index ];
-
-        if ( src.width != dest[ index ].width || src.height != dest[ index ].height )
-        {
-            cImages.Release();
-            return E_FAIL;
-        }
-
-        if ( (compress & TEX_COMPRESS_PARALLEL) )
-        {
-#ifndef _OPENMP
-            return E_NOTIMPL;
-#else
-            if ( compress & TEX_COMPRESS_PARALLEL )
-            {
-                hr = _CompressBC_Parallel( src, dest[ index ], _GetBCFlags( compress ), _GetSRGBFlags( compress ), alphaRef );
-                if ( FAILED(hr) )
-                {
-                    cImages.Release();
-                    return  hr;
-                }
-            }
-#endif // _OPENMP
-        }
-        else
-        {
-            hr = _CompressBC( src, dest[ index ], _GetBCFlags( compress ), _GetSRGBFlags( compress ), alphaRef );
-            if ( FAILED(hr) )
-            {
-                cImages.Release();
-                return hr;
-            }
-        }
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Decompression
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT Decompress( const Image& cImage, DXGI_FORMAT format, ScratchImage& image )
-{
-    if ( !IsCompressed(cImage.format) || IsCompressed(format) )
-        return E_INVALIDARG;
-
-    if ( format == DXGI_FORMAT_UNKNOWN )
-    {
-        // Pick a default decompressed format based on BC input format
-        format = _DefaultDecompress( cImage.format );
-        if ( format == DXGI_FORMAT_UNKNOWN )
-        {
-            // Input is not a compressed format
-            return E_INVALIDARG;
-        }
-    }
-    else
-    {
-        if ( !IsValid(format) )
-            return E_INVALIDARG;
-
-        if ( IsTypeless(format) || IsPlanar(format) || IsPalettized(format) )
-            return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    // Create decompressed image
-    HRESULT hr = image.Initialize2D( format, cImage.width, cImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *img = image.GetImage( 0, 0, 0 );
-    if ( !img )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    // Decompress single image
-    hr = _DecompressBC( cImage, *img );
-    if ( FAILED(hr) )
-        image.Release();
-
-    return hr;
-}
-
-_Use_decl_annotations_
-HRESULT Decompress( const Image* cImages, size_t nimages, const TexMetadata& metadata,
-                    DXGI_FORMAT format, ScratchImage& images )
-{
-    if ( !cImages || !nimages )
-        return E_INVALIDARG;
-
-    if ( !IsCompressed(metadata.format) || IsCompressed(format) )
-        return E_INVALIDARG;
-
-    if ( format == DXGI_FORMAT_UNKNOWN )
-    {
-        // Pick a default decompressed format based on BC input format
-        format = _DefaultDecompress( cImages[0].format );
-        if ( format == DXGI_FORMAT_UNKNOWN )
-        {
-            // Input is not a compressed format
-            return E_FAIL;
-        }
-    }
-    else
-    {
-        if ( !IsValid(format) )
-            return E_INVALIDARG;
-
-        if ( IsTypeless(format) || IsPlanar(format) || IsPalettized(format) )
-            HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    images.Release();
-
-    TexMetadata mdata2 = metadata;
-    mdata2.format = format;
-    HRESULT hr = images.Initialize( mdata2 );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( nimages != images.GetImageCount() )
-    {
-        images.Release();
-        return E_FAIL;
-    }
-
-    const Image* dest = images.GetImages();
-    if ( !dest )
-    {
-        images.Release();
-        return E_POINTER;
-    }
-
-    for( size_t index=0; index < nimages; ++index )
-    {
-        assert( dest[ index ].format == format );
-
-        const Image& src = cImages[ index ];
-        if ( !IsCompressed( src.format ) )
-        {
-            images.Release();
-            return E_FAIL;
-        }
-
-        if ( src.width != dest[ index ].width || src.height != dest[ index ].height )
-        {
-            images.Release();
-            return E_FAIL;
-        }
-
-        hr = _DecompressBC( src, dest[ index ] );
-        if ( FAILED(hr) )
-        {
-            images.Release();
-            return hr;
-        }
-    }
-
-    return S_OK;
-}
-
-}; // namespace

+ 0 - 402
Exporters/FBX/3rdParty/DirectXTex/DirectXTexCompressGPU.cpp

@@ -1,402 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexCompressGPU.cpp
-//  
-// DirectX Texture Library - DirectCompute-based texture compression
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-#include "bcdirectcompute.h"
-
-namespace DirectX
-{
-
-inline static DWORD _GetSRGBFlags( _In_ DWORD compress )
-{
-    static_assert( TEX_COMPRESS_SRGB_IN == TEX_FILTER_SRGB_IN, "TEX_COMPRESS_SRGB* should match TEX_FILTER_SRGB*" );
-    static_assert( TEX_COMPRESS_SRGB_OUT == TEX_FILTER_SRGB_OUT, "TEX_COMPRESS_SRGB* should match TEX_FILTER_SRGB*" );
-    static_assert( TEX_COMPRESS_SRGB == TEX_FILTER_SRGB, "TEX_COMPRESS_SRGB* should match TEX_FILTER_SRGB*" );
-    return ( compress & TEX_COMPRESS_SRGB );
-}
-
-
-//-------------------------------------------------------------------------------------
-// Converts to R8G8B8A8_UNORM or R8G8B8A8_UNORM_SRGB doing any conversion logic needed
-//-------------------------------------------------------------------------------------
-static HRESULT _ConvertToRGBA32( _In_ const Image& srcImage, _In_ ScratchImage& image, bool srgb, _In_ DWORD filter )
-{
-    if ( !srcImage.pixels )
-        return E_POINTER;
-
-    DXGI_FORMAT format = srgb ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : DXGI_FORMAT_R8G8B8A8_UNORM;
-
-    HRESULT hr = image.Initialize2D( format, srcImage.width, srcImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *img = image.GetImage( 0, 0, 0 );
-    if ( !img )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    uint8_t* pDest = img->pixels;
-    if ( !pDest )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( ( sizeof(XMVECTOR) * srcImage.width ), 16 ) ) );
-    if ( !scanline )
-    {
-        image.Release();
-        return E_OUTOFMEMORY;
-    }
-
-    const uint8_t *pSrc = srcImage.pixels;
-    for( size_t h = 0; h < srcImage.height; ++h )
-    {
-        if ( !_LoadScanline( scanline.get(), srcImage.width, pSrc, srcImage.rowPitch, srcImage.format ) )
-        {
-            image.Release();
-            return E_FAIL;
-        }
-
-        _ConvertScanline( scanline.get(), srcImage.width, format, srcImage.format, filter );
-
-        if ( !_StoreScanline( pDest, img->rowPitch, format, scanline.get(), srcImage.width ) )
-        {
-            image.Release();
-            return E_FAIL;
-        }
-
-        pSrc += srcImage.rowPitch;
-        pDest += img->rowPitch;
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Converts to DXGI_FORMAT_R32G32B32A32_FLOAT doing any conversion logic needed
-//-------------------------------------------------------------------------------------
-static HRESULT _ConvertToRGBAF32( const Image& srcImage, ScratchImage& image, _In_ DWORD filter )
-{
-    if ( !srcImage.pixels )
-        return E_POINTER;
-
-    HRESULT hr = image.Initialize2D( DXGI_FORMAT_R32G32B32A32_FLOAT, srcImage.width, srcImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *img = image.GetImage( 0, 0, 0 );
-    if ( !img )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    uint8_t* pDest = img->pixels;
-    if ( !pDest )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    const uint8_t *pSrc = srcImage.pixels;
-    for( size_t h = 0; h < srcImage.height; ++h )
-    {
-        if ( !_LoadScanline( reinterpret_cast<XMVECTOR*>(pDest), srcImage.width, pSrc, srcImage.rowPitch, srcImage.format ) )
-        {
-            image.Release();
-            return E_FAIL;
-        }
-
-        _ConvertScanline( reinterpret_cast<XMVECTOR*>(pDest), srcImage.width, DXGI_FORMAT_R32G32B32A32_FLOAT, srcImage.format, filter );
-
-        pSrc += srcImage.rowPitch;
-        pDest += img->rowPitch;
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Compress using GPU, converting to the proper input format for the shader if needed
-//-------------------------------------------------------------------------------------
-inline static HRESULT _GPUCompress( _In_ GPUCompressBC* gpubc, _In_ const Image& srcImage, _In_ const Image& destImage, _In_ DWORD compress )
-{
-    if ( !gpubc )
-        return E_POINTER;
-
-    assert( srcImage.pixels && destImage.pixels );
-
-    DXGI_FORMAT format = gpubc->GetSourceFormat();
-
-    if ( srcImage.format == format )
-    {
-        // Input is already in our required source format
-        return gpubc->Compress( srcImage, destImage );
-    }
-    else
-    {
-        // Convert format and then use as the source image
-        ScratchImage image;
-        HRESULT hr;
-
-        DWORD srgb = _GetSRGBFlags( compress );
-
-        switch( format )
-        {
-        case DXGI_FORMAT_R8G8B8A8_UNORM:
-            hr = _ConvertToRGBA32( srcImage, image, false, srgb );
-            break;
-
-        case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
-            hr = _ConvertToRGBA32( srcImage, image, true, srgb );
-            break;
-
-        case DXGI_FORMAT_R32G32B32A32_FLOAT:
-            hr = _ConvertToRGBAF32( srcImage, image, srgb );
-            break;
-
-        default:
-            hr = E_UNEXPECTED;
-            break;
-        }
-
-        if ( FAILED(hr) )
-            return hr;
-
-        const Image *img = image.GetImage( 0, 0, 0 );
-        if ( !img )
-            return E_POINTER;
-
-        return gpubc->Compress( *img, destImage );
-    }
-}
-
-
-//=====================================================================================
-// Entry-points
-//=====================================================================================
-
-//-------------------------------------------------------------------------------------
-// Compression
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT Compress( ID3D11Device* pDevice, const Image& srcImage, DXGI_FORMAT format, DWORD compress, float alphaWeight, ScratchImage& image )
-{
-    if ( !pDevice || IsCompressed(srcImage.format) || !IsCompressed(format) )
-        return E_INVALIDARG;
-
-    if ( IsTypeless(format)
-         || IsTypeless(srcImage.format) || IsPlanar(srcImage.format) || IsPalettized(srcImage.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    // Setup GPU compressor
-    std::unique_ptr<GPUCompressBC> gpubc( new (std::nothrow) GPUCompressBC );
-    if ( !gpubc )
-        return E_OUTOFMEMORY;
-
-    HRESULT hr = gpubc->Initialize( pDevice );
-    if ( FAILED(hr) )
-        return hr;
-
-    hr = gpubc->Prepare( srcImage.width, srcImage.height, format, alphaWeight );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Create workspace for result
-    hr = image.Initialize2D( format, srcImage.width, srcImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *img = image.GetImage( 0, 0, 0 );
-    if ( !img )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    hr = _GPUCompress( gpubc.get(), srcImage, *img, compress );
-    if ( FAILED(hr) )
-        image.Release();
-
-    return hr;
-}
-
-_Use_decl_annotations_
-HRESULT Compress( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                  DXGI_FORMAT format, DWORD compress, float alphaWeight, ScratchImage& cImages )
-{
-    if ( !pDevice || !srcImages || !nimages )
-        return E_INVALIDARG;
-
-    if ( IsCompressed(metadata.format) || !IsCompressed(format) )
-        return E_INVALIDARG;
-
-    if ( IsTypeless(format)
-         || IsTypeless(metadata.format) || IsPlanar(metadata.format) || IsPalettized(metadata.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    cImages.Release();
-
-    // Setup GPU compressor
-    std::unique_ptr<GPUCompressBC> gpubc( new (std::nothrow) GPUCompressBC );
-    if ( !gpubc )
-        return E_OUTOFMEMORY;
-
-    HRESULT hr = gpubc->Initialize( pDevice );
-    if ( FAILED(hr) )
-        return hr;
-
-    // Create workspace for result
-    TexMetadata mdata2 = metadata;
-    mdata2.format = format;
-    hr = cImages.Initialize( mdata2 );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( nimages != cImages.GetImageCount() )
-    {
-        cImages.Release();
-        return E_FAIL;
-    }
-
-    const Image* dest = cImages.GetImages();
-    if ( !dest  )
-    {
-        cImages.Release();
-        return E_POINTER;
-    }
-
-    // Process images (ordered by size)
-    switch( metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-    case TEX_DIMENSION_TEXTURE2D:
-        {
-            size_t w = metadata.width;
-            size_t h = metadata.height;
-
-            for( size_t level=0; level < metadata.mipLevels; ++level )
-            {
-                hr = gpubc->Prepare( w, h, format, alphaWeight );
-                if ( FAILED(hr) )
-                {
-                    cImages.Release();
-                    return hr;
-                }
-
-                for( size_t item = 0; item < metadata.arraySize; ++item )
-                {
-                    size_t index = metadata.ComputeIndex( level, item, 0 );
-                    if ( index >= nimages )
-                    {
-                        cImages.Release();
-                        return E_FAIL;
-                    }
-
-                    assert( dest[ index ].format == format );
-
-                    const Image& src = srcImages[ index ];
-
-                    if ( src.width != dest[ index ].width || src.height != dest[ index ].height )
-                    {
-                        cImages.Release();
-                        return E_FAIL;
-                    }
-
-                    hr = _GPUCompress( gpubc.get(), src, dest[ index ], compress );
-                    if ( FAILED(hr) )
-                    {
-                        cImages.Release();
-                        return hr;
-                    }
-                }
-
-                if ( h > 1 )
-                    h >>= 1;
-
-                if ( w > 1 )
-                    w >>= 1;
-            }
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        {
-            size_t w = metadata.width;
-            size_t h = metadata.height;
-            size_t d = metadata.depth;
-
-            for( size_t level=0; level < metadata.mipLevels; ++level )
-            {
-                hr = gpubc->Prepare( w, h, format, alphaWeight );
-                if ( FAILED(hr) )
-                {
-                    cImages.Release();
-                    return hr;
-                }
-
-                for( size_t slice=0; slice < d; ++slice )
-                {
-                    size_t index = metadata.ComputeIndex( level, 0, slice );
-                    if ( index >= nimages )
-                    {
-                        cImages.Release();
-                        return E_FAIL;
-                    }
-
-                    assert( dest[ index ].format == format );
-
-                    const Image& src = srcImages[ index ];
-
-                    if ( src.width != dest[ index ].width || src.height != dest[ index ].height )
-                    {
-                        cImages.Release();
-                        return E_FAIL;
-                    }
-
-                    hr = _GPUCompress( gpubc.get(), src, dest[ index ], compress );
-                    if ( FAILED(hr) )
-                    {
-                        cImages.Release();
-                        return hr;
-                    }
-                }
-
-                if ( h > 1 )
-                    h >>= 1;
-
-                if ( w > 1 )
-                    w >>= 1;
-
-                if ( d > 1 )
-                    d >>= 1;
-            }
-        }
-        break;
-
-    default:
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    return S_OK;
-}
-
-}; // namespace

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 4515
Exporters/FBX/3rdParty/DirectXTex/DirectXTexConvert.cpp


+ 0 - 875
Exporters/FBX/3rdParty/DirectXTex/DirectXTexD3D11.cpp

@@ -1,875 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexD3D11.cpp
-//  
-// DirectX Texture Library - Direct3D 11 helpers
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-#if !defined(_XBOX_ONE) || !defined(_TITLE) || !MONOLITHIC
-#include <d3d10.h>
-#endif
-
-using Microsoft::WRL::ComPtr;
-
-namespace DirectX
-{
-
-static HRESULT _Capture( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _In_ const TexMetadata& metadata,
-                         _In_ const ScratchImage& result )
-{
-    if ( !pContext || !pSource || !result.GetPixels() )
-        return E_POINTER;
-
-    if ( metadata.IsVolumemap() )
-    {
-        //--- Volume texture ----------------------------------------------------------
-        assert( metadata.arraySize == 1 );
-
-        size_t height = metadata.height;
-        size_t depth = metadata.depth;
-
-        for( size_t level = 0; level < metadata.mipLevels; ++level )
-        {
-            UINT dindex = D3D11CalcSubresource( static_cast<UINT>( level ), 0, static_cast<UINT>( metadata.mipLevels ) );
-
-            D3D11_MAPPED_SUBRESOURCE mapped;
-            HRESULT hr = pContext->Map( pSource, dindex, D3D11_MAP_READ, 0, &mapped );
-            if ( FAILED(hr) )
-                return hr;
-
-            auto pslice = reinterpret_cast<const uint8_t*>( mapped.pData );
-            if ( !pslice )
-            {
-                pContext->Unmap( pSource, dindex );
-                return E_POINTER;
-            }
-
-            size_t lines = ComputeScanlines( metadata.format, height );
-            if ( !lines )
-            {
-                pContext->Unmap( pSource, dindex );
-                return E_UNEXPECTED;
-            }
-
-            for( size_t slice = 0; slice < depth; ++slice )
-            {
-                const Image* img = result.GetImage( level, 0, slice );
-                if ( !img )
-                {
-                    pContext->Unmap( pSource, dindex );
-                    return E_FAIL;
-                }
-
-                if ( !img->pixels )
-                {
-                    pContext->Unmap( pSource, dindex );
-                    return E_POINTER;
-                }
-
-                const uint8_t* sptr = pslice;
-                uint8_t* dptr = img->pixels;
-                for( size_t h = 0; h < lines; ++h )
-                {
-                    size_t msize = std::min<size_t>( img->rowPitch, mapped.RowPitch );
-                    memcpy_s( dptr, img->rowPitch, sptr, msize );
-                    sptr += mapped.RowPitch;
-                    dptr += img->rowPitch;
-                }
-
-                pslice += mapped.DepthPitch;
-            }
-
-            pContext->Unmap( pSource, dindex );
-
-            if ( height > 1 )
-                height >>= 1;
-            if ( depth > 1 )
-                depth >>= 1;
-        }
-    }
-    else
-    {
-        //--- 1D or 2D texture --------------------------------------------------------
-        assert( metadata.depth == 1 );
-
-        for( size_t item = 0; item < metadata.arraySize; ++item )
-        {
-            size_t height = metadata.height;
-
-            for( size_t level = 0; level < metadata.mipLevels; ++level )
-            {
-                UINT dindex = D3D11CalcSubresource( static_cast<UINT>( level ), static_cast<UINT>( item ), static_cast<UINT>( metadata.mipLevels ) );
-
-                D3D11_MAPPED_SUBRESOURCE mapped;
-                HRESULT hr = pContext->Map( pSource, dindex, D3D11_MAP_READ, 0, &mapped );
-                if ( FAILED(hr) )
-                    return hr;
-
-                const Image* img = result.GetImage( level, item, 0 );
-                if ( !img )
-                {
-                    pContext->Unmap( pSource, dindex );
-                    return E_FAIL;
-                }
-
-                if ( !img->pixels )
-                {
-                    pContext->Unmap( pSource, dindex );
-                    return E_POINTER;
-                }
-
-                size_t lines = ComputeScanlines( metadata.format, height );
-                if ( !lines )
-                {
-                    pContext->Unmap( pSource, dindex );
-                    return E_UNEXPECTED;
-                }
-
-                auto sptr = reinterpret_cast<const uint8_t*>( mapped.pData );
-                uint8_t* dptr = img->pixels;
-                for( size_t h = 0; h < lines; ++h )
-                {
-                    size_t msize = std::min<size_t>( img->rowPitch, mapped.RowPitch );
-                    memcpy_s( dptr, img->rowPitch, sptr, msize );
-                    sptr += mapped.RowPitch;
-                    dptr += img->rowPitch;
-                }
-
-                pContext->Unmap( pSource, dindex );
-
-                if ( height > 1 )
-                    height >>= 1;
-            }
-        }
-    }
-
-    return S_OK;
-}
-
-
-//=====================================================================================
-// Entry-points
-//=====================================================================================
-
-//-------------------------------------------------------------------------------------
-// Determine if given texture metadata is supported on the given device
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-bool IsSupportedTexture( ID3D11Device* pDevice, const TexMetadata& metadata )
-{
-    if ( !pDevice )
-        return false;
-
-    D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel();
-
-    // Validate format
-    DXGI_FORMAT fmt = metadata.format;
-
-    if ( !IsValid( fmt ) )
-        return false;
-
-    switch( fmt )
-    {
-    case DXGI_FORMAT_BC4_TYPELESS:
-    case DXGI_FORMAT_BC4_UNORM:
-    case DXGI_FORMAT_BC4_SNORM:
-    case DXGI_FORMAT_BC5_TYPELESS:
-    case DXGI_FORMAT_BC5_UNORM:
-    case DXGI_FORMAT_BC5_SNORM:
-        if ( fl < D3D_FEATURE_LEVEL_10_0 )
-            return false;
-        break;
-
-    case DXGI_FORMAT_BC6H_TYPELESS:
-    case DXGI_FORMAT_BC6H_UF16:
-    case DXGI_FORMAT_BC6H_SF16:
-    case DXGI_FORMAT_BC7_TYPELESS:
-    case DXGI_FORMAT_BC7_UNORM:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        if ( fl < D3D_FEATURE_LEVEL_11_0 )
-            return false;
-        break;
-    }
-
-    // Validate miplevel count
-    if ( metadata.mipLevels > D3D11_REQ_MIP_LEVELS )
-        return false;
-       
-    // Validate array size, dimension, and width/height
-    size_t arraySize = metadata.arraySize;
-    size_t iWidth = metadata.width;
-    size_t iHeight = metadata.height;
-    size_t iDepth = metadata.depth;
-
-    // Most cases are known apriori based on feature level, but we use this for robustness to handle the few optional cases
-    UINT formatSupport = 0;
-    HRESULT hr = pDevice->CheckFormatSupport( fmt, &formatSupport );
-    if ( FAILED(hr) )
-    {
-        formatSupport = 0;
-    }
-
-    switch ( metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-        if ( !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE1D) )
-            return false;
-
-        if ( (arraySize > D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION)
-             || (iWidth > D3D11_REQ_TEXTURE1D_U_DIMENSION) )
-            return false;
-
-        if ( fl < D3D_FEATURE_LEVEL_11_0 )
-        {
-            if ( (arraySize > D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION)
-                 || (iWidth > D3D10_REQ_TEXTURE1D_U_DIMENSION) )
-                return false;
-
-            if ( fl < D3D_FEATURE_LEVEL_10_0 )
-            {
-                if ( (arraySize > 1) || (iWidth > D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION) )
-                    return false;
-
-                if ( (fl < D3D_FEATURE_LEVEL_9_3) && (iWidth > D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION ) )
-                    return false;
-            }
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE2D:
-        if ( metadata.IsCubemap() )
-        {
-            if ( !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURECUBE) )
-                return false;
-
-            if ( (arraySize > D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION)
-                 || (iWidth > D3D11_REQ_TEXTURECUBE_DIMENSION) 
-                 || (iHeight > D3D11_REQ_TEXTURECUBE_DIMENSION))
-                return false;
-
-            if ( fl < D3D_FEATURE_LEVEL_11_0 )
-            {
-                if ( (arraySize > D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION)
-                     || (iWidth > D3D10_REQ_TEXTURECUBE_DIMENSION) 
-                     || (iHeight > D3D10_REQ_TEXTURECUBE_DIMENSION))
-                    return false;
-
-                if ( (fl < D3D_FEATURE_LEVEL_10_1) && (arraySize != 6) )
-                    return false;
-
-                if ( fl < D3D_FEATURE_LEVEL_10_0 )
-                {
-                    if ( (iWidth > D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION )
-                         || (iHeight > D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION ) )
-                        return false;
-
-                    if ( (fl < D3D_FEATURE_LEVEL_9_3)
-                         && ( (iWidth > D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION)
-                              || (iHeight > D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION) ) )
-                        return false;
-                }
-            }
-        }
-        else // Not a cube map
-        {
-            if ( !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) )
-                return false;
-
-            if ( (arraySize > D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION)
-                 || (iWidth > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION) 
-                 || (iHeight > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION))
-                return false;
-
-            if ( fl < D3D_FEATURE_LEVEL_11_0 )
-            {
-                if ( (arraySize > D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION)
-                     || (iWidth > D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION) 
-                     || (iHeight > D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION))
-                    return false;
-
-                if ( fl < D3D_FEATURE_LEVEL_10_0 )
-                {
-                    if ( (arraySize > 1)
-                         || (iWidth > D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION)
-                         || (iHeight > D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION) )
-                        return false;
-
-                    if ( (fl < D3D_FEATURE_LEVEL_9_3)
-                         && ( (iWidth > D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION)
-                              || (iHeight > D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION) ) )
-                        return false;
-                }
-            }
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        if ( !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE3D) )
-            return false;
-
-        if ( (arraySize > 1)
-             || (iWidth > D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) 
-             || (iHeight > D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION)
-             || (iDepth > D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) )
-            return false;
-
-        if ( fl < D3D_FEATURE_LEVEL_11_0 )
-        {
-            if ( (iWidth > D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) 
-                 || (iHeight > D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION)
-                 || (iDepth > D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) )
-                return false;
-
-            if ( fl < D3D_FEATURE_LEVEL_10_0 )
-            {
-                if ( (iWidth > D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION)
-                     || (iHeight > D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION)
-                     || (iDepth > D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) )
-                    return false;
-            }
-        }
-        break;
-
-    default:
-        // Not a supported dimension
-        return false;
-    }
-
-    return true;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Create a texture resource
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT CreateTexture( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                       ID3D11Resource** ppResource )
-{
-    return CreateTextureEx( pDevice, srcImages, nimages, metadata,
-                            D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false,
-                            ppResource );
-}
-
-_Use_decl_annotations_
-HRESULT CreateTextureEx( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                         D3D11_USAGE usage, unsigned int bindFlags, unsigned int cpuAccessFlags, unsigned int miscFlags, bool forceSRGB,
-                         ID3D11Resource** ppResource )
-{
-    if ( !pDevice || !srcImages || !nimages || !ppResource )
-        return E_INVALIDARG;
-
-    *ppResource = nullptr;
-
-    if ( !metadata.mipLevels || !metadata.arraySize )
-        return E_INVALIDARG;
-
-#ifdef _M_X64
-    if ( (metadata.width > 0xFFFFFFFF) || (metadata.height > 0xFFFFFFFF)
-         || (metadata.mipLevels > 0xFFFFFFFF) || (metadata.arraySize > 0xFFFFFFFF) )
-        return E_INVALIDARG;
-#endif
-
-    std::unique_ptr<D3D11_SUBRESOURCE_DATA[]> initData( new (std::nothrow) D3D11_SUBRESOURCE_DATA[ metadata.mipLevels * metadata.arraySize ] );
-    if ( !initData )
-        return E_OUTOFMEMORY;
-
-    // Fill out subresource array
-    if ( metadata.IsVolumemap() )
-    {
-        //--- Volume case -------------------------------------------------------------
-        if ( !metadata.depth )
-            return E_INVALIDARG;
-
-#ifdef _M_X64
-        if ( metadata.depth > 0xFFFFFFFF )
-            return E_INVALIDARG;
-#endif
-
-        if ( metadata.arraySize > 1 )
-            // Direct3D 11 doesn't support arrays of 3D textures
-            return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-        size_t depth = metadata.depth;
-
-        size_t idx = 0;
-        for( size_t level = 0; level < metadata.mipLevels; ++level )
-        {
-            size_t index = metadata.ComputeIndex( level, 0, 0 );
-            if ( index >= nimages )
-                return E_FAIL;
-
-            const Image& img = srcImages[ index ];
-
-            if ( img.format != metadata.format )
-                return E_FAIL;
-
-            if ( !img.pixels )
-                return E_POINTER;
-
-            // Verify pixels in image 1 .. (depth-1) are exactly image->slicePitch apart
-            // For 3D textures, this relies on all slices of the same miplevel being continous in memory
-            // (this is how ScratchImage lays them out), which is why we just give the 0th slice to Direct3D 11
-            const uint8_t* pSlice = img.pixels + img.slicePitch;
-            for( size_t slice = 1; slice < depth; ++slice )
-            {
-                size_t tindex = metadata.ComputeIndex( level, 0, slice );
-                if ( tindex >= nimages )
-                    return E_FAIL;
-
-                const Image& timg = srcImages[ tindex ];
-
-                if ( !timg.pixels )
-                    return E_POINTER;
-
-                if ( timg.pixels != pSlice
-                     || timg.format != metadata.format
-                     || timg.rowPitch != img.rowPitch
-                     || timg.slicePitch != img.slicePitch )
-                    return E_FAIL;
-
-                pSlice = timg.pixels + img.slicePitch;
-            }
-
-            assert( idx < (metadata.mipLevels * metadata.arraySize) );
-
-            initData[idx].pSysMem = img.pixels;
-            initData[idx].SysMemPitch = static_cast<DWORD>( img.rowPitch );
-            initData[idx].SysMemSlicePitch = static_cast<DWORD>( img.slicePitch );
-            ++idx;
-
-            if ( depth > 1 )
-                depth >>= 1;
-        }
-    }
-    else
-    {
-        //--- 1D or 2D texture case ---------------------------------------------------
-        size_t idx = 0;
-        for( size_t item = 0; item < metadata.arraySize; ++item )
-        {
-            for( size_t level = 0; level < metadata.mipLevels; ++level )
-            {
-                size_t index = metadata.ComputeIndex( level, item, 0 );
-                if ( index >= nimages )
-                    return E_FAIL;
-
-                const Image& img = srcImages[ index ];
-
-                if ( img.format != metadata.format )
-                    return E_FAIL;
-
-                if ( !img.pixels )
-                    return E_POINTER;
-
-                assert( idx < (metadata.mipLevels * metadata.arraySize) );
-
-                initData[idx].pSysMem = img.pixels;
-                initData[idx].SysMemPitch = static_cast<DWORD>( img.rowPitch );
-                initData[idx].SysMemSlicePitch = static_cast<DWORD>( img.slicePitch );
-                ++idx;
-            }
-        }
-    }
-
-    // Create texture using static initialization data
-    HRESULT hr = E_FAIL;
-
-    DXGI_FORMAT tformat = ( forceSRGB ) ? MakeSRGB( metadata.format ) : metadata.format;
-
-    switch ( metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-        {
-            D3D11_TEXTURE1D_DESC desc;
-            desc.Width = static_cast<UINT>( metadata.width );
-            desc.MipLevels = static_cast<UINT>( metadata.mipLevels );
-            desc.ArraySize = static_cast<UINT>( metadata.arraySize );
-            desc.Format = tformat;
-            desc.Usage = usage;
-            desc.BindFlags = bindFlags;
-            desc.CPUAccessFlags = cpuAccessFlags;
-            desc.MiscFlags = miscFlags & ~D3D11_RESOURCE_MISC_TEXTURECUBE;
-
-            hr = pDevice->CreateTexture1D( &desc, initData.get(), reinterpret_cast<ID3D11Texture1D**>(ppResource) );
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE2D:
-        {
-            D3D11_TEXTURE2D_DESC desc;
-            desc.Width = static_cast<UINT>( metadata.width );
-            desc.Height = static_cast<UINT>( metadata.height ); 
-            desc.MipLevels = static_cast<UINT>( metadata.mipLevels );
-            desc.ArraySize = static_cast<UINT>( metadata.arraySize );
-            desc.Format = tformat;
-            desc.SampleDesc.Count = 1;
-            desc.SampleDesc.Quality = 0;
-            desc.Usage = usage;
-            desc.BindFlags = bindFlags;
-            desc.CPUAccessFlags = cpuAccessFlags;
-            if ( metadata.IsCubemap() )
-                desc.MiscFlags =  miscFlags | D3D11_RESOURCE_MISC_TEXTURECUBE;
-            else
-                desc.MiscFlags =  miscFlags & ~D3D11_RESOURCE_MISC_TEXTURECUBE;
-
-            hr = pDevice->CreateTexture2D( &desc, initData.get(), reinterpret_cast<ID3D11Texture2D**>(ppResource) );
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        {
-            D3D11_TEXTURE3D_DESC desc;
-            desc.Width = static_cast<UINT>( metadata.width );
-            desc.Height = static_cast<UINT>( metadata.height );
-            desc.Depth = static_cast<UINT>( metadata.depth );
-            desc.MipLevels = static_cast<UINT>( metadata.mipLevels );
-            desc.Format = tformat;
-            desc.Usage = usage;
-            desc.BindFlags = bindFlags;
-            desc.CPUAccessFlags = cpuAccessFlags;
-            desc.MiscFlags = miscFlags & ~D3D11_RESOURCE_MISC_TEXTURECUBE;
-
-            hr = pDevice->CreateTexture3D( &desc, initData.get(), reinterpret_cast<ID3D11Texture3D**>(ppResource) );
-        }
-        break;
-    }
-
-    return hr;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Create a shader resource view and associated texture
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT CreateShaderResourceView( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                                  ID3D11ShaderResourceView** ppSRV )
-{
-    return CreateShaderResourceViewEx( pDevice, srcImages, nimages, metadata,
-                                       D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false,
-                                       ppSRV );
-}
-
-_Use_decl_annotations_
-HRESULT CreateShaderResourceViewEx( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                                    D3D11_USAGE usage, unsigned int bindFlags, unsigned int cpuAccessFlags, unsigned int miscFlags, bool forceSRGB,
-                                    ID3D11ShaderResourceView** ppSRV )
-{
-    if ( !ppSRV )
-        return E_INVALIDARG;
-
-    *ppSRV = nullptr;
-
-    ComPtr<ID3D11Resource> resource;
-    HRESULT hr = CreateTextureEx( pDevice, srcImages, nimages, metadata,
-                                  usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
-                                  resource.GetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    assert( resource );
-
-    D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
-    memset( &SRVDesc, 0, sizeof(SRVDesc) );
-    if ( forceSRGB )
-        SRVDesc.Format = MakeSRGB( metadata.format );
-    else
-        SRVDesc.Format = metadata.format;
-
-    switch ( metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-        if ( metadata.arraySize > 1 )
-        {
-            SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE1DARRAY;
-            SRVDesc.Texture1DArray.MipLevels = static_cast<UINT>( metadata.mipLevels );
-            SRVDesc.Texture1DArray.ArraySize = static_cast<UINT>( metadata.arraySize );
-        }
-        else
-        {
-            SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE1D;
-            SRVDesc.Texture1D.MipLevels = static_cast<UINT>( metadata.mipLevels );
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE2D:
-        if ( metadata.IsCubemap() )
-        {
-            if (metadata.arraySize > 6)
-            {
-                assert( (metadata.arraySize % 6) == 0 );
-                SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURECUBEARRAY;
-                SRVDesc.TextureCubeArray.MipLevels = static_cast<UINT>( metadata.mipLevels );
-                SRVDesc.TextureCubeArray.NumCubes = static_cast<UINT>( metadata.arraySize / 6 );
-            }
-            else
-            {
-                SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURECUBE;
-                SRVDesc.TextureCube.MipLevels = static_cast<UINT>( metadata.mipLevels );
-            }
-        }
-        else if ( metadata.arraySize > 1 )
-        {
-            SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2DARRAY;
-            SRVDesc.Texture2DArray.MipLevels = static_cast<UINT>( metadata.mipLevels );
-            SRVDesc.Texture2DArray.ArraySize = static_cast<UINT>( metadata.arraySize );
-        }
-        else
-        {
-            SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D;
-            SRVDesc.Texture2D.MipLevels = static_cast<UINT>( metadata.mipLevels );
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        assert( metadata.arraySize == 1 );
-        SRVDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE3D;
-        SRVDesc.Texture3D.MipLevels = static_cast<UINT>( metadata.mipLevels );
-        break;
-
-    default:
-        return E_FAIL;
-    }
-
-    hr = pDevice->CreateShaderResourceView( resource.Get(), &SRVDesc, ppSRV );
-    if ( FAILED(hr) )
-        return hr;
-
-    assert( *ppSRV );
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Save a texture resource to a DDS file in memory/on disk
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT CaptureTexture( ID3D11Device* pDevice, ID3D11DeviceContext* pContext, ID3D11Resource* pSource, ScratchImage& result )
-{
-    if ( !pDevice || !pContext || !pSource )
-        return E_INVALIDARG;
-
-    D3D11_RESOURCE_DIMENSION resType = D3D11_RESOURCE_DIMENSION_UNKNOWN;
-    pSource->GetType( &resType );
-
-    HRESULT hr;
-
-    switch( resType )
-    {
-    case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
-        {
-            ComPtr<ID3D11Texture1D> pTexture;
-            hr = pSource->QueryInterface( __uuidof(ID3D11Texture1D), reinterpret_cast<void**>( pTexture.GetAddressOf() ) );
-            if ( FAILED(hr) )
-                break;
-
-            assert( pTexture );
-
-            D3D11_TEXTURE1D_DESC desc;
-            pTexture->GetDesc( &desc );
-
-            desc.BindFlags = 0;
-            desc.MiscFlags = 0;
-            desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-            desc.Usage = D3D11_USAGE_STAGING;
-
-            ComPtr<ID3D11Texture1D> pStaging;
-            hr = pDevice->CreateTexture1D( &desc, 0, pStaging.GetAddressOf() );
-            if ( FAILED(hr) )
-                break;
-
-            assert( pStaging );
-
-            pContext->CopyResource( pStaging.Get(), pSource );
-
-            TexMetadata mdata;
-            mdata.width = desc.Width;
-            mdata.height = mdata.depth = 1;
-            mdata.arraySize = desc.ArraySize;
-            mdata.mipLevels = desc.MipLevels;
-            mdata.miscFlags = 0;
-            mdata.miscFlags2 = 0;
-            mdata.format = desc.Format;
-            mdata.dimension = TEX_DIMENSION_TEXTURE1D;
-
-            hr = result.Initialize( mdata );
-            if ( FAILED(hr) )
-                break;
-
-            hr = _Capture( pContext, pStaging.Get(), mdata, result );
-        }
-        break;
-
-    case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
-        {
-            ComPtr<ID3D11Texture2D> pTexture;
-            hr = pSource->QueryInterface( __uuidof(ID3D11Texture2D), reinterpret_cast<void**>( pTexture.GetAddressOf() ) );
-            if ( FAILED(hr) )
-                break;
-
-            assert( pTexture );
-
-            D3D11_TEXTURE2D_DESC desc;
-            pTexture->GetDesc( &desc );
-
-            ComPtr<ID3D11Texture2D> pStaging;
-            if ( desc.SampleDesc.Count > 1 )
-            {
-                desc.SampleDesc.Count = 1;
-                desc.SampleDesc.Quality = 0;
-
-                ComPtr<ID3D11Texture2D> pTemp;
-                hr = pDevice->CreateTexture2D( &desc, 0, pTemp.GetAddressOf() );
-                if ( FAILED(hr) )
-                    break;
-
-                assert( pTemp );
-
-                DXGI_FORMAT fmt = desc.Format;
-                if ( IsTypeless(fmt) )
-                {
-                    // Assume a UNORM if it exists otherwise use FLOAT
-                    fmt = MakeTypelessUNORM( fmt );
-                    fmt = MakeTypelessFLOAT( fmt );
-                }
-
-                UINT support = 0;
-                hr = pDevice->CheckFormatSupport( fmt, &support );
-                if ( FAILED(hr) )
-                    break;
-
-                if ( !(support & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE) )
-                {
-                    hr = E_FAIL;
-                    break;
-                }
-
-                for( UINT item = 0; item < desc.ArraySize; ++item )
-                {
-                    for( UINT level = 0; level < desc.MipLevels; ++level )
-                    {
-                        UINT index = D3D11CalcSubresource( level, item, desc.MipLevels );
-                        pContext->ResolveSubresource( pTemp.Get(), index, pSource, index, fmt );
-                    }
-                }
-
-                desc.BindFlags = 0;
-                desc.MiscFlags &= D3D11_RESOURCE_MISC_TEXTURECUBE;
-                desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-                desc.Usage = D3D11_USAGE_STAGING;
-
-                hr = pDevice->CreateTexture2D( &desc, 0, pStaging.GetAddressOf() );
-                if ( FAILED(hr) )
-                    break;
-
-                assert( pStaging );
-
-                pContext->CopyResource( pStaging.Get(), pTemp.Get() );
-            }
-            else
-            {
-                desc.BindFlags = 0;
-                desc.MiscFlags &= D3D11_RESOURCE_MISC_TEXTURECUBE;
-                desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-                desc.Usage = D3D11_USAGE_STAGING;
-
-                hr = pDevice->CreateTexture2D( &desc, 0, &pStaging );
-                if ( FAILED(hr) )
-                    break;
-
-                assert( pStaging );
-
-                pContext->CopyResource( pStaging.Get(), pSource );
-            }
-
-            TexMetadata mdata;
-            mdata.width = desc.Width;
-            mdata.height = desc.Height;
-            mdata.depth = 1;
-            mdata.arraySize = desc.ArraySize;
-            mdata.mipLevels = desc.MipLevels;
-            mdata.miscFlags = (desc.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE) ? TEX_MISC_TEXTURECUBE : 0;
-            mdata.miscFlags2 = 0;
-            mdata.format = desc.Format;
-            mdata.dimension = TEX_DIMENSION_TEXTURE2D;
-
-            hr = result.Initialize( mdata );
-            if ( FAILED(hr) )
-                break;
-
-            hr = _Capture( pContext, pStaging.Get(), mdata, result );
-        }
-        break;
-
-    case D3D11_RESOURCE_DIMENSION_TEXTURE3D:
-        {
-            ComPtr<ID3D11Texture3D> pTexture;
-            hr = pSource->QueryInterface( __uuidof(ID3D11Texture3D), reinterpret_cast<void**>( pTexture.GetAddressOf() ) );
-            if ( FAILED(hr) )
-                break;
-
-            assert( pTexture );
-
-            D3D11_TEXTURE3D_DESC desc;
-            pTexture->GetDesc( &desc );
-
-            desc.BindFlags = 0;
-            desc.MiscFlags = 0;
-            desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-            desc.Usage = D3D11_USAGE_STAGING;
-
-            ComPtr<ID3D11Texture3D> pStaging;
-            hr = pDevice->CreateTexture3D( &desc, 0, pStaging.GetAddressOf() );
-            if ( FAILED(hr) )
-                break;
-
-            assert( pStaging );
-
-            pContext->CopyResource( pStaging.Get(), pSource );
-
-            TexMetadata mdata;
-            mdata.width = desc.Width;
-            mdata.height = desc.Height;
-            mdata.depth = desc.Depth;
-            mdata.arraySize = 1;
-            mdata.mipLevels = desc.MipLevels;
-            mdata.miscFlags = 0;
-            mdata.miscFlags2 = 0;
-            mdata.format = desc.Format;
-            mdata.dimension = TEX_DIMENSION_TEXTURE3D;
-
-            hr = result.Initialize( mdata );
-            if ( FAILED(hr) )
-                break;
-
-            hr = _Capture( pContext, pStaging.Get(), mdata, result );
-        }
-        break;
-
-    default:
-        hr = E_FAIL;
-        break;
-    }
-
-    if ( FAILED(hr) )
-    {
-        result.Release();
-        return hr;
-    }
-
-    return S_OK;
-}
-
-}; // namespace

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 2002
Exporters/FBX/3rdParty/DirectXTex/DirectXTexDDS.cpp


+ 0 - 331
Exporters/FBX/3rdParty/DirectXTex/DirectXTexFlipRotate.cpp

@@ -1,331 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexFlipRotate.cpp
-//  
-// DirectX Texture Library - Image flip/rotate operations
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-using Microsoft::WRL::ComPtr;
-
-namespace DirectX
-{
-
-//-------------------------------------------------------------------------------------
-// Do flip/rotate operation using WIC
-//-------------------------------------------------------------------------------------
-static HRESULT _PerformFlipRotateUsingWIC( _In_ const Image& srcImage, _In_ DWORD flags,
-                                           _In_ const WICPixelFormatGUID& pfGUID, _In_ const Image& destImage )
-{
-    if ( !srcImage.pixels || !destImage.pixels )
-        return E_POINTER;
-
-    assert( srcImage.format == destImage.format );
-
-    IWICImagingFactory* pWIC = _GetWIC();
-    if ( !pWIC )
-        return E_NOINTERFACE;
-
-    ComPtr<IWICBitmap> source;
-    HRESULT hr = pWIC->CreateBitmapFromMemory( static_cast<UINT>( srcImage.width ), static_cast<UINT>( srcImage.height ), pfGUID,
-                                               static_cast<UINT>( srcImage.rowPitch ), static_cast<UINT>( srcImage.slicePitch ),
-                                               srcImage.pixels, source.GetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    ComPtr<IWICBitmapFlipRotator> FR;
-    hr = pWIC->CreateBitmapFlipRotator( FR.GetAddressOf() );
-    if ( FAILED(hr) )
-        return hr;
-
-    hr = FR->Initialize( source.Get(), static_cast<WICBitmapTransformOptions>( flags ) );
-    if ( FAILED(hr) )
-        return hr;
-
-    WICPixelFormatGUID pfFR;
-    hr = FR->GetPixelFormat( &pfFR );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( memcmp( &pfFR, &pfGUID, sizeof(GUID) ) != 0 )
-    {
-        // Flip/rotate should return the same format as the source...
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    UINT nwidth, nheight;
-    hr = FR->GetSize( &nwidth, &nheight );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( destImage.width != nwidth || destImage.height != nheight )
-        return E_FAIL;
-
-    hr = FR->CopyPixels( 0, static_cast<UINT>( destImage.rowPitch ), static_cast<UINT>( destImage.slicePitch ), destImage.pixels );
-    if ( FAILED(hr) )
-        return hr;
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Do conversion, flip/rotate using WIC, conversion cycle
-//-------------------------------------------------------------------------------------
-static HRESULT _PerformFlipRotateViaF32( _In_ const Image& srcImage, _In_ DWORD flags, _In_ const Image& destImage )
-{
-    if ( !srcImage.pixels || !destImage.pixels )
-        return E_POINTER;
-
-    assert( srcImage.format != DXGI_FORMAT_R32G32B32A32_FLOAT );
-    assert( srcImage.format == destImage.format );
-
-    ScratchImage temp;
-    HRESULT hr = _ConvertToR32G32B32A32( srcImage, temp );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *tsrc = temp.GetImage( 0, 0, 0 );
-    if ( !tsrc )
-        return E_POINTER;
-
-    ScratchImage rtemp;
-    hr = rtemp.Initialize2D( DXGI_FORMAT_R32G32B32A32_FLOAT, destImage.width, destImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *tdest = rtemp.GetImage( 0, 0, 0 );
-    if ( !tdest )
-        return E_POINTER;
-
-    hr = _PerformFlipRotateUsingWIC( *tsrc, flags, GUID_WICPixelFormat128bppRGBAFloat, *tdest );
-    if ( FAILED(hr) )
-        return hr;
-
-    temp.Release();
-
-    hr = _ConvertFromR32G32B32A32( *tdest, destImage );
-    if ( FAILED(hr) )
-        return hr;
-
-    return S_OK;
-}
-
-
-//=====================================================================================
-// Entry-points
-//=====================================================================================
-
-//-------------------------------------------------------------------------------------
-// Flip/rotate image
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT FlipRotate( const Image& srcImage, DWORD flags, ScratchImage& image )
-{
-    if ( !srcImage.pixels )
-        return E_POINTER;
-
-    if ( !flags )
-        return E_INVALIDARG;
-
-#ifdef _M_X64
-    if ( (srcImage.width > 0xFFFFFFFF) || (srcImage.height > 0xFFFFFFFF) )
-        return E_INVALIDARG;
-#endif
-
-    if ( IsCompressed( srcImage.format ) )
-    {
-        // We don't support flip/rotate operations on compressed images
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    static_assert( TEX_FR_ROTATE0 == WICBitmapTransformRotate0, "TEX_FR_ROTATE0 no longer matches WIC" );
-    static_assert( TEX_FR_ROTATE90 == WICBitmapTransformRotate90, "TEX_FR_ROTATE90 no longer matches WIC" );
-    static_assert( TEX_FR_ROTATE180 == WICBitmapTransformRotate180, "TEX_FR_ROTATE180 no longer matches WIC" );
-    static_assert( TEX_FR_ROTATE270 == WICBitmapTransformRotate270, "TEX_FR_ROTATE270 no longer matches WIC" );
-    static_assert( TEX_FR_FLIP_HORIZONTAL == WICBitmapTransformFlipHorizontal, "TEX_FR_FLIP_HORIZONTAL no longer matches WIC" );
-    static_assert( TEX_FR_FLIP_VERTICAL == WICBitmapTransformFlipVertical, "TEX_FR_FLIP_VERTICAL no longer matches WIC" );
-
-    // Only supports 90, 180, 270, or no rotation flags... not a combination of rotation flags
-    switch ( flags & (TEX_FR_ROTATE90|TEX_FR_ROTATE180|TEX_FR_ROTATE270) )
-    {
-    case 0:
-    case TEX_FR_ROTATE90:
-    case TEX_FR_ROTATE180:
-    case TEX_FR_ROTATE270:
-        break;
-
-    default:
-        return E_INVALIDARG;
-    }
-
-    size_t nwidth = srcImage.width;
-    size_t nheight = srcImage.height;
-
-    if (flags & (TEX_FR_ROTATE90|TEX_FR_ROTATE270))
-    {
-        nwidth = srcImage.height;
-        nheight = srcImage.width;
-    }
-
-    HRESULT hr = image.Initialize2D( srcImage.format, nwidth, nheight, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-   
-    const Image *rimage = image.GetImage( 0, 0, 0 );
-    if ( !rimage )
-        return E_POINTER;
-
-    WICPixelFormatGUID pfGUID;
-    if ( _DXGIToWIC( srcImage.format, pfGUID ) )
-    {
-        // Case 1: Source format is supported by Windows Imaging Component
-        hr = _PerformFlipRotateUsingWIC( srcImage, flags, pfGUID, *rimage );
-    }
-    else
-    {
-        // Case 2: Source format is not supported by WIC, so we have to convert, flip/rotate, and convert back
-        hr = _PerformFlipRotateViaF32( srcImage, flags, *rimage );
-    }
-
-    if ( FAILED(hr) )
-    {
-        image.Release();
-        return hr;
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Flip/rotate image (complex)
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT FlipRotate( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                    DWORD flags, ScratchImage& result )
-{
-    if ( !srcImages || !nimages )
-        return E_INVALIDARG;
-
-    if ( IsCompressed( metadata.format ) )
-    {
-        // We don't support flip/rotate operations on compressed images
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    static_assert( TEX_FR_ROTATE0 == WICBitmapTransformRotate0, "TEX_FR_ROTATE0 no longer matches WIC" );
-    static_assert( TEX_FR_ROTATE90 == WICBitmapTransformRotate90, "TEX_FR_ROTATE90 no longer matches WIC" );
-    static_assert( TEX_FR_ROTATE180 == WICBitmapTransformRotate180, "TEX_FR_ROTATE180 no longer matches WIC" );
-    static_assert( TEX_FR_ROTATE270 == WICBitmapTransformRotate270, "TEX_FR_ROTATE270 no longer matches WIC" );
-    static_assert( TEX_FR_FLIP_HORIZONTAL == WICBitmapTransformFlipHorizontal, "TEX_FR_FLIP_HORIZONTAL no longer matches WIC" );
-    static_assert( TEX_FR_FLIP_VERTICAL == WICBitmapTransformFlipVertical, "TEX_FR_FLIP_VERTICAL no longer matches WIC" );
-
-    // Only supports 90, 180, 270, or no rotation flags... not a combination of rotation flags
-    switch ( flags & (TEX_FR_ROTATE90|TEX_FR_ROTATE180|TEX_FR_ROTATE270) )
-    {
-    case 0:
-    case TEX_FR_ROTATE90:
-    case TEX_FR_ROTATE180:
-    case TEX_FR_ROTATE270:
-        break;
-
-    default:
-        return E_INVALIDARG;
-    }
-
-    TexMetadata mdata2 = metadata;
-
-    bool flipwh = false;
-    if (flags & (TEX_FR_ROTATE90|TEX_FR_ROTATE270))
-    {
-        flipwh = true;
-        mdata2.width = metadata.height;
-        mdata2.height = metadata.width;
-    }
-
-    HRESULT hr = result.Initialize( mdata2 );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( nimages != result.GetImageCount() )
-    {
-        result.Release();
-        return E_FAIL;
-    }
-
-    const Image* dest = result.GetImages();
-    if ( !dest )
-    {
-        result.Release();
-        return E_POINTER;
-    }
-
-    WICPixelFormatGUID pfGUID;
-    bool wicpf = _DXGIToWIC( metadata.format, pfGUID );
-
-    for( size_t index=0; index < nimages; ++index )
-    {
-        const Image& src = srcImages[ index ];
-        if ( src.format != metadata.format )
-        {
-            result.Release();
-            return E_FAIL;
-        }
-
-#ifdef _M_X64
-        if ( (src.width > 0xFFFFFFFF) || (src.height > 0xFFFFFFFF) )
-            return E_FAIL;
-#endif
-
-        const Image& dst = dest[ index ];
-        assert( dst.format == metadata.format );
-
-        if ( flipwh )
-        {
-            if ( src.width != dst.height || src.height != dst.width )
-            {
-                result.Release();
-                return E_FAIL;
-            }
-        }
-        else
-        {
-            if ( src.width != dst.width || src.height != dst.height )
-            {
-                result.Release();
-                return E_FAIL;
-            }
-        }
-
-        if (wicpf)
-        {
-            // Case 1: Source format is supported by Windows Imaging Component
-            hr = _PerformFlipRotateUsingWIC( src, flags, pfGUID, dst );
-        }
-        else
-        {
-            // Case 2: Source format is not supported by WIC, so we have to convert, flip/rotate, and convert back
-            hr = _PerformFlipRotateViaF32( src, flags, dst );
-        }
-
-        if ( FAILED(hr) )
-        {
-            result.Release();
-            return hr;
-        }
-    }
-
-    return S_OK;
-}
-
-}; // namespace

+ 0 - 821
Exporters/FBX/3rdParty/DirectXTex/DirectXTexImage.cpp

@@ -1,821 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexImage.cpp
-//  
-// DirectX Texture Library - Image container
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-namespace DirectX
-{
-
-extern bool _CalculateMipLevels( _In_ size_t width, _In_ size_t height, _Inout_ size_t& mipLevels );
-extern bool _CalculateMipLevels3D( _In_ size_t width, _In_ size_t height, _In_ size_t depth, _Inout_ size_t& mipLevels );
-extern bool _IsAlphaAllOpaqueBC( _In_ const Image& cImage );
-
-//-------------------------------------------------------------------------------------
-// Determines number of image array entries and pixel size
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-void _DetermineImageArray( const TexMetadata& metadata, DWORD cpFlags,
-                           size_t& nImages, size_t& pixelSize )
-{
-    assert( metadata.width > 0 && metadata.height > 0 && metadata.depth > 0 );
-    assert( metadata.arraySize > 0 );
-    assert( metadata.mipLevels > 0 );
-
-    size_t _pixelSize = 0;
-    size_t _nimages = 0;
-
-    switch( metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-    case TEX_DIMENSION_TEXTURE2D:
-        for( size_t item = 0; item < metadata.arraySize; ++item )
-        {
-            size_t w = metadata.width;
-            size_t h = metadata.height;
-
-            for( size_t level=0; level < metadata.mipLevels; ++level )
-            {
-                size_t rowPitch, slicePitch;
-                ComputePitch( metadata.format, w, h, rowPitch, slicePitch, cpFlags );
-
-                _pixelSize += slicePitch;
-                ++_nimages;
-
-                if ( h > 1 )
-                    h >>= 1;
-
-                if ( w > 1 )
-                    w >>= 1;
-            }
-        }
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        {
-            size_t w = metadata.width;
-            size_t h = metadata.height;
-            size_t d = metadata.depth;
-
-            for( size_t level=0; level < metadata.mipLevels; ++level )
-            {
-                size_t rowPitch, slicePitch;
-                ComputePitch( metadata.format, w, h, rowPitch, slicePitch, cpFlags );
-
-                for( size_t slice=0; slice < d; ++slice )
-                {
-                    _pixelSize += slicePitch;
-                    ++_nimages;
-                }
-
-                if ( h > 1 )
-                    h >>= 1;
-
-                if ( w > 1 )
-                    w >>= 1;
-
-                if ( d > 1 )
-                    d >>= 1;
-            }
-        }
-        break;
-
-    default:
-        assert( false );
-        break;
-    }
-
-    nImages = _nimages;
-    pixelSize = _pixelSize;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Fills in the image array entries
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-bool _SetupImageArray( uint8_t *pMemory, size_t pixelSize,
-                       const TexMetadata& metadata, DWORD cpFlags,
-                       Image* images, size_t nImages )
-{
-    assert( pMemory );
-    assert( pixelSize > 0 );
-    assert( nImages > 0 );
-
-    if ( !images )
-        return false;
-
-    size_t index = 0;
-    uint8_t* pixels = pMemory;
-    const uint8_t* pEndBits = pMemory + pixelSize;
-
-    switch( metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-    case TEX_DIMENSION_TEXTURE2D:
-        if (metadata.arraySize == 0 || metadata.mipLevels == 0)
-        {
-            return false;
-        }
-
-        for( size_t item = 0; item < metadata.arraySize; ++item )
-        {
-            size_t w = metadata.width;
-            size_t h = metadata.height;
-
-            for( size_t level=0; level < metadata.mipLevels; ++level )
-            {
-                if ( index >= nImages )
-                {
-                    return false;
-                }
-
-                size_t rowPitch, slicePitch;
-                ComputePitch( metadata.format, w, h, rowPitch, slicePitch, cpFlags );
-
-                images[index].width = w;
-                images[index].height = h;
-                images[index].format = metadata.format;
-                images[index].rowPitch = rowPitch;
-                images[index].slicePitch = slicePitch;
-                images[index].pixels = pixels;
-                ++index;
-
-                pixels += slicePitch;
-                if ( pixels > pEndBits )
-                {
-                    return false;
-                }
-            
-                if ( h > 1 )
-                    h >>= 1;
-
-                if ( w > 1 )
-                    w >>= 1;
-            }
-        }
-        return true;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        {
-            if (metadata.mipLevels == 0 || metadata.depth == 0)
-            {
-                return false;
-            }
-
-            size_t w = metadata.width;
-            size_t h = metadata.height;
-            size_t d = metadata.depth;
-
-            for( size_t level=0; level < metadata.mipLevels; ++level )
-            {
-                size_t rowPitch, slicePitch;
-                ComputePitch( metadata.format, w, h, rowPitch, slicePitch, cpFlags );
-
-                for( size_t slice=0; slice < d; ++slice )
-                {
-                    if ( index >= nImages )
-                    {
-                        return false;
-                    }
-
-                    // We use the same memory organization that Direct3D 11 needs for D3D11_SUBRESOURCE_DATA
-                    // with all slices of a given miplevel being continuous in memory
-                    images[index].width = w;
-                    images[index].height = h;
-                    images[index].format = metadata.format;
-                    images[index].rowPitch = rowPitch;
-                    images[index].slicePitch = slicePitch;
-                    images[index].pixels = pixels;
-                    ++index;
-
-                    pixels += slicePitch;
-                    if ( pixels > pEndBits )
-                    {
-                        return false;
-                    }
-                }
-            
-                if ( h > 1 )
-                    h >>= 1;
-
-                if ( w > 1 )
-                    w >>= 1;
-
-                if ( d > 1 )
-                    d >>= 1;
-            }
-        }
-        return true;
-
-    default:
-        return false;
-    }
-}
-
-
-//=====================================================================================
-// ScratchImage - Bitmap image container
-//=====================================================================================
-
-ScratchImage& ScratchImage::operator= (ScratchImage&& moveFrom)
-{
-    if ( this != &moveFrom )
-    {
-        Release();
-
-        _nimages = moveFrom._nimages;
-        _size = moveFrom._size;
-        _metadata = moveFrom._metadata;
-        _image = moveFrom._image;
-        _memory = moveFrom._memory;
-
-        moveFrom._nimages = 0;
-        moveFrom._size = 0;
-        moveFrom._image = nullptr;
-        moveFrom._memory = nullptr;
-    }
-    return *this;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Methods
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT ScratchImage::Initialize( const TexMetadata& mdata, DWORD flags )
-{
-    if ( !IsValid(mdata.format) )
-        return E_INVALIDARG;
-
-    if ( IsPalettized(mdata.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    size_t mipLevels = mdata.mipLevels;
-
-    switch( mdata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-        if ( !mdata.width || mdata.height != 1 || mdata.depth != 1 || !mdata.arraySize )
-            return E_INVALIDARG;
-
-        if ( IsVideo(mdata.format) )
-            return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-        if ( !_CalculateMipLevels(mdata.width,1,mipLevels) )
-            return E_INVALIDARG;
-        break;
-
-    case TEX_DIMENSION_TEXTURE2D:
-        if ( !mdata.width || !mdata.height || mdata.depth != 1 || !mdata.arraySize )
-            return E_INVALIDARG;
-
-        if ( mdata.IsCubemap() )
-        {
-            if ( (mdata.arraySize % 6) != 0 )
-                return E_INVALIDARG;
-
-            if ( IsVideo(mdata.format) )
-                return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-        }
-
-        if ( !_CalculateMipLevels(mdata.width,mdata.height,mipLevels) )
-            return E_INVALIDARG;
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        if ( !mdata.width || !mdata.height || !mdata.depth || mdata.arraySize != 1 )
-            return E_INVALIDARG;
-        
-        if ( IsVideo(mdata.format) || IsPlanar(mdata.format) || IsDepthStencil(mdata.format) )
-            return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-        if ( !_CalculateMipLevels3D(mdata.width,mdata.height,mdata.depth,mipLevels) )
-            return E_INVALIDARG;
-        break;
-
-    default:
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    Release();
-
-    _metadata.width = mdata.width;
-    _metadata.height = mdata.height;
-    _metadata.depth = mdata.depth;
-    _metadata.arraySize = mdata.arraySize;
-    _metadata.mipLevels = mipLevels;
-    _metadata.miscFlags = mdata.miscFlags;
-    _metadata.miscFlags2 = mdata.miscFlags2;
-    _metadata.format = mdata.format;
-    _metadata.dimension = mdata.dimension;
-
-    size_t pixelSize, nimages;
-    _DetermineImageArray( _metadata, flags, nimages, pixelSize );
-
-    _image = new (std::nothrow) Image[ nimages ];
-    if ( !_image )
-        return E_OUTOFMEMORY;
-
-    _nimages = nimages;
-    memset( _image, 0, sizeof(Image) * nimages );
-
-    _memory = reinterpret_cast<uint8_t*>( _aligned_malloc( pixelSize, 16 ) );
-    if ( !_memory )
-    {
-        Release();
-        return E_OUTOFMEMORY;
-    }
-    _size = pixelSize;
-    if ( !_SetupImageArray( _memory, pixelSize, _metadata, flags, _image, nimages ) )
-    {
-        Release();
-        return E_FAIL;
-    }
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::Initialize1D( DXGI_FORMAT fmt, size_t length, size_t arraySize, size_t mipLevels, DWORD flags )
-{
-    if ( !length || !arraySize )
-        return E_INVALIDARG;
-
-    if ( IsVideo(fmt) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    // 1D is a special case of the 2D case
-    HRESULT hr = Initialize2D( fmt, length, 1, arraySize, mipLevels, flags );
-    if ( FAILED(hr) )
-        return hr;
-
-    _metadata.dimension = TEX_DIMENSION_TEXTURE1D;
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::Initialize2D( DXGI_FORMAT fmt, size_t width, size_t height, size_t arraySize, size_t mipLevels, DWORD flags )
-{
-    if ( !IsValid(fmt) || !width || !height || !arraySize )
-        return E_INVALIDARG;
-
-    if ( IsPalettized(fmt) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    if ( !_CalculateMipLevels(width,height,mipLevels) )
-        return E_INVALIDARG;
-
-    Release();
-
-    _metadata.width = width;
-    _metadata.height = height;
-    _metadata.depth = 1;
-    _metadata.arraySize = arraySize;
-    _metadata.mipLevels = mipLevels;
-    _metadata.miscFlags = 0;
-    _metadata.miscFlags2 = 0;
-    _metadata.format = fmt;
-    _metadata.dimension = TEX_DIMENSION_TEXTURE2D;
-
-    size_t pixelSize, nimages;
-    _DetermineImageArray( _metadata, flags, nimages, pixelSize );
-
-    _image = new (std::nothrow) Image[ nimages ];
-    if ( !_image )
-        return E_OUTOFMEMORY;
-
-    _nimages = nimages;
-    memset( _image, 0, sizeof(Image) * nimages );
-
-    _memory = reinterpret_cast<uint8_t*>( _aligned_malloc( pixelSize, 16 ) );
-    if ( !_memory )
-    {
-        Release();
-        return E_OUTOFMEMORY;
-    }
-    _size = pixelSize;
-    if ( !_SetupImageArray( _memory, pixelSize, _metadata, flags, _image, nimages ) )
-    {
-        Release();
-        return E_FAIL;
-    }
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::Initialize3D( DXGI_FORMAT fmt, size_t width, size_t height, size_t depth, size_t mipLevels, DWORD flags )
-{
-    if ( !IsValid(fmt) || !width || !height || !depth )
-        return E_INVALIDARG;
-
-    if ( IsVideo(fmt) || IsPlanar(fmt) || IsDepthStencil(fmt) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    if ( !_CalculateMipLevels3D(width,height,depth,mipLevels) )
-        return E_INVALIDARG;
-
-    Release();
-
-    _metadata.width = width;
-    _metadata.height = height;
-    _metadata.depth = depth;
-    _metadata.arraySize = 1;    // Direct3D 10.x/11 does not support arrays of 3D textures
-    _metadata.mipLevels = mipLevels;
-    _metadata.miscFlags = 0;
-    _metadata.miscFlags2 = 0;
-    _metadata.format = fmt;
-    _metadata.dimension = TEX_DIMENSION_TEXTURE3D;
-
-    size_t pixelSize, nimages;
-    _DetermineImageArray( _metadata, flags, nimages, pixelSize );
-
-    _image = new (std::nothrow) Image[ nimages ];
-    if ( !_image )
-    {
-        Release();
-        return E_OUTOFMEMORY;
-    }
-    _nimages = nimages;
-    memset( _image, 0, sizeof(Image) * nimages );
-
-    _memory = reinterpret_cast<uint8_t*>( _aligned_malloc( pixelSize, 16 ) );
-    if ( !_memory )
-    {
-        Release();
-        return E_OUTOFMEMORY;
-    }
-    _size = pixelSize;
-
-    if ( !_SetupImageArray( _memory, pixelSize, _metadata, flags, _image, nimages ) )
-    {
-        Release();
-        return E_FAIL;
-    }
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::InitializeCube( DXGI_FORMAT fmt, size_t width, size_t height, size_t nCubes, size_t mipLevels, DWORD flags )
-{
-    if ( !width || !height || !nCubes )
-        return E_INVALIDARG;
-
-    if ( IsVideo(fmt) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    
-    // A DirectX11 cubemap is just a 2D texture array that is a multiple of 6 for each cube
-    HRESULT hr = Initialize2D( fmt, width, height, nCubes * 6, mipLevels, flags );
-    if ( FAILED(hr) )
-        return hr;
-
-    _metadata.miscFlags |= TEX_MISC_TEXTURECUBE;
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::InitializeFromImage( const Image& srcImage, bool allow1D, DWORD flags )
-{
-    HRESULT hr = ( srcImage.height > 1 || !allow1D )
-                 ? Initialize2D( srcImage.format, srcImage.width, srcImage.height, 1, 1, flags )
-                 : Initialize1D( srcImage.format, srcImage.width, 1, 1, flags );
-
-    if ( FAILED(hr) )
-        return hr;
-
-    size_t rowCount = ComputeScanlines( srcImage.format, srcImage.height );
-    if ( !rowCount )
-        return E_UNEXPECTED;
-
-    const uint8_t* sptr = reinterpret_cast<const uint8_t*>( srcImage.pixels );
-    if ( !sptr )
-        return E_POINTER;
-
-    auto dptr = reinterpret_cast<uint8_t*>( _image[0].pixels );
-    if ( !dptr )
-        return E_POINTER;
-
-    size_t spitch = srcImage.rowPitch;
-    size_t dpitch = _image[0].rowPitch;
-
-    size_t size = std::min<size_t>( dpitch, spitch );
-
-    for( size_t y = 0; y < rowCount; ++y )
-    {
-        memcpy_s( dptr, dpitch, sptr, size );
-        sptr += spitch;
-        dptr += dpitch;
-    }
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::InitializeArrayFromImages( const Image* images, size_t nImages, bool allow1D, DWORD flags )
-{
-    if ( !images || !nImages )
-        return E_INVALIDARG;
-
-    DXGI_FORMAT format = images[0].format;
-    size_t width = images[0].width;
-    size_t height = images[0].height;
-
-    for( size_t index=0; index < nImages; ++index )
-    {
-        if ( !images[index].pixels )
-            return E_POINTER;
-
-        if ( images[index].format != format || images[index].width != width || images[index].height != height )
-        {
-            // All images must be the same format, width, and height
-            return E_FAIL;
-        }
-    }
-
-    HRESULT hr = ( height > 1 || !allow1D )
-                 ? Initialize2D( format, width, height, nImages, 1, flags )
-                 : Initialize1D( format, width, nImages, 1, flags );
-
-    if ( FAILED(hr) )
-        return hr;
-
-    size_t rowCount = ComputeScanlines( format, height );
-    if ( !rowCount )
-        return E_UNEXPECTED;
-
-    for( size_t index=0; index < nImages; ++index )
-    {
-        auto sptr = reinterpret_cast<const uint8_t*>( images[index].pixels );
-        if ( !sptr )
-            return E_POINTER;
-
-        assert( index < _nimages );
-        auto dptr = reinterpret_cast<uint8_t*>( _image[index].pixels );
-        if ( !dptr )
-            return E_POINTER;
-
-        size_t spitch = images[index].rowPitch;
-        size_t dpitch = _image[index].rowPitch;
-
-        size_t size = std::min<size_t>( dpitch, spitch );
-
-        for( size_t y = 0; y < rowCount; ++y )
-        {
-            memcpy_s( dptr, dpitch, sptr, size );
-            sptr += spitch;
-            dptr += dpitch;
-        }
-    }
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::InitializeCubeFromImages( const Image* images, size_t nImages, DWORD flags )
-{
-    if ( !images || !nImages )
-        return E_INVALIDARG;
-
-    // A DirectX11 cubemap is just a 2D texture array that is a multiple of 6 for each cube
-    if ( ( nImages % 6 ) != 0 )
-        return E_INVALIDARG;
-
-    if ( IsVideo(images[0].format) || IsPalettized(images[0].format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    HRESULT hr = InitializeArrayFromImages( images, nImages, false, flags );
-    if ( FAILED(hr) )
-        return hr;
-
-    _metadata.miscFlags |= TEX_MISC_TEXTURECUBE;
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ScratchImage::Initialize3DFromImages( const Image* images, size_t depth, DWORD flags )
-{
-    if ( !images || !depth )
-        return E_INVALIDARG;
-
-    DXGI_FORMAT format = images[0].format;
-    size_t width = images[0].width;
-    size_t height = images[0].height;
-
-    for( size_t slice=0; slice < depth; ++slice )
-    {
-        if ( !images[slice].pixels )
-            return E_POINTER;
-
-        if ( images[slice].format != format || images[slice].width != width || images[slice].height != height )
-        {
-            // All images must be the same format, width, and height
-            return E_FAIL;
-        }
-    }
-
-    HRESULT hr = Initialize3D( format, width, height, depth, 1, flags );
-    if ( FAILED(hr) )
-        return hr;
-
-    size_t rowCount = ComputeScanlines( format, height );
-    if ( !rowCount )
-        return E_UNEXPECTED;
-
-    for( size_t slice=0; slice < depth; ++slice )
-    {
-        auto sptr = reinterpret_cast<const uint8_t*>( images[slice].pixels );
-        if ( !sptr )
-            return E_POINTER;
-
-        assert( slice < _nimages );
-        auto dptr = reinterpret_cast<uint8_t*>( _image[slice].pixels );
-        if ( !dptr )
-            return E_POINTER;
-
-        size_t spitch = images[slice].rowPitch;
-        size_t dpitch = _image[slice].rowPitch;
-
-        size_t size = std::min<size_t>( dpitch, spitch );
-
-        for( size_t y = 0; y < rowCount; ++y )
-        {
-            memcpy_s( dptr, dpitch, sptr, size );
-            sptr += spitch;
-            dptr += dpitch;
-        }
-    }
-
-    return S_OK;
-}
-
-void ScratchImage::Release()
-{
-    _nimages = 0;
-    _size = 0;
-
-    if ( _image )
-    {
-        delete [] _image;
-        _image = 0;
-    }
-
-    if ( _memory )
-    {
-        _aligned_free( _memory );
-        _memory = 0;
-    }
-    
-    memset(&_metadata, 0, sizeof(_metadata));
-}
-
-_Use_decl_annotations_
-bool ScratchImage::OverrideFormat( DXGI_FORMAT f )
-{
-    if ( !_image )
-        return false;
-
-    if ( !IsValid( f ) || IsPlanar( f ) || IsPalettized( f ) )
-        return false;
-
-    if ( ( BitsPerPixel( f ) != BitsPerPixel( _metadata.format ) )
-         || ( IsCompressed( f ) != IsCompressed( _metadata.format ) )
-         || ( IsPacked( f ) != IsPacked( _metadata.format ) )
-         || ( IsVideo( f ) != IsVideo( _metadata.format ) ) )
-    {
-         // Can't change the effective pitch of the format this way
-         return false;
-    }
-
-    for( size_t index = 0; index < _nimages; ++index )
-    {
-        _image[ index ].format = f;
-    }
-
-    _metadata.format = f;
-
-    return true;
-}
-
-_Use_decl_annotations_
-const Image* ScratchImage::GetImage(size_t mip, size_t item, size_t slice) const
-{
-    if ( mip >= _metadata.mipLevels )
-        return nullptr;
-
-    size_t index = 0;
-
-    switch( _metadata.dimension )
-    {
-    case TEX_DIMENSION_TEXTURE1D:
-    case TEX_DIMENSION_TEXTURE2D:
-        if ( slice > 0 )
-            return nullptr;
-
-        if ( item >= _metadata.arraySize )
-            return nullptr;
-
-        index = item*( _metadata.mipLevels ) + mip;
-        break;
-
-    case TEX_DIMENSION_TEXTURE3D:
-        if ( item > 0 )
-        {
-            // No support for arrays of volumes
-            return nullptr;
-        }
-        else
-        {
-            size_t d = _metadata.depth;
-
-            for( size_t level = 0; level < mip; ++level )
-            {
-                index += d;
-                if ( d > 1 )
-                    d >>= 1;
-            }
-
-            if ( slice >= d )
-                return nullptr;
-
-            index += slice;
-        }
-        break;
-
-    default:
-        return nullptr;
-    }
- 
-    return &_image[index];
-}
-
-bool ScratchImage::IsAlphaAllOpaque() const
-{
-    if ( !_image )
-        return false;
-
-    if ( !HasAlpha( _metadata.format ) )
-        return true;
-
-    if ( IsCompressed( _metadata.format ) )
-    {
-        for( size_t index = 0; index < _nimages; ++index )
-        {
-            if ( !_IsAlphaAllOpaqueBC( _image[ index ] ) )
-                return false;
-        }
-    }
-    else
-    {
-        ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( (sizeof(XMVECTOR)*_metadata.width), 16 ) ) );
-        if ( !scanline )
-            return false;
-
-        static const XMVECTORF32 threshold = { 0.99f, 0.99f, 0.99f, 0.99f };
-
-        for( size_t index = 0; index < _nimages; ++index )
-        {
-#pragma warning( suppress : 6011 )
-            const Image& img = _image[ index ];
-
-            const uint8_t *pPixels = img.pixels;
-            assert( pPixels );
-
-            for( size_t h = 0; h < img.height; ++h )
-            {
-                if ( !_LoadScanline( scanline.get(), img.width, pPixels, img.rowPitch, img.format ) )
-                    return false;
-
-                XMVECTOR* ptr = scanline.get();
-                for( size_t w = 0; w < img.width; ++w )
-                {
-                    XMVECTOR alpha = XMVectorSplatW( *ptr );
-                    if ( XMVector4Less( alpha, threshold ) )
-                        return false;
-                    ++ptr;
-                }
-
-                pPixels += img.rowPitch;
-            }
-        }
-    }
-
-    return true;
-}
-
-}; // namespace

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 3051
Exporters/FBX/3rdParty/DirectXTex/DirectXTexMipmaps.cpp


+ 0 - 354
Exporters/FBX/3rdParty/DirectXTex/DirectXTexMisc.cpp

@@ -1,354 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexMisc.cpp
-//  
-// DirectX Texture Library - Misc image operations
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-namespace DirectX
-{
-static const XMVECTORF32 g_Gamma22 = { 2.2f, 2.2f, 2.2f, 1.f };
-
-//-------------------------------------------------------------------------------------
-static HRESULT _ComputeMSE( _In_ const Image& image1, _In_ const Image& image2,
-                            _Out_ float& mse, _Out_writes_opt_(4) float* mseV,
-                            _In_ DWORD flags )
-{
-    if ( !image1.pixels || !image2.pixels )
-        return E_POINTER;
-
-    assert( image1.width == image2.width && image1.height == image2.height );
-    assert( !IsCompressed( image1.format ) && !IsCompressed( image2.format )  );
-
-    const size_t width = image1.width;
-
-    ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( (sizeof(XMVECTOR)*width)*2, 16 ) ) );
-    if ( !scanline )
-        return E_OUTOFMEMORY;
-
-    // Flags implied from image formats
-    switch( image1.format )
-    {
-    case DXGI_FORMAT_B8G8R8X8_UNORM:
-        flags |= CMSE_IGNORE_ALPHA;
-        break;
-
-    case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
-        flags |= CMSE_IMAGE1_SRGB | CMSE_IGNORE_ALPHA;
-        break;
-
-    case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:
-    case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        flags |= CMSE_IMAGE1_SRGB;
-        break;
-    }
-
-    switch( image2.format )
-    {
-    case DXGI_FORMAT_B8G8R8X8_UNORM:
-        flags |= CMSE_IGNORE_ALPHA;
-        break;
-
-    case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
-        flags |= CMSE_IMAGE2_SRGB | CMSE_IGNORE_ALPHA;
-        break;
-
-    case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
-    case DXGI_FORMAT_BC1_UNORM_SRGB:
-    case DXGI_FORMAT_BC2_UNORM_SRGB:
-    case DXGI_FORMAT_BC3_UNORM_SRGB:
-    case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
-    case DXGI_FORMAT_BC7_UNORM_SRGB:
-        flags |= CMSE_IMAGE2_SRGB;
-        break;
-    }
-
-    const uint8_t *pSrc1 = image1.pixels;
-    const size_t rowPitch1 = image1.rowPitch;
-
-    const uint8_t *pSrc2 = image2.pixels;
-    const size_t rowPitch2 = image2.rowPitch;
-
-    XMVECTOR acc = g_XMZero;
-    static XMVECTORF32 two = { 2.0f, 2.0f, 2.0f, 2.0f };
-
-    for( size_t h = 0; h < image1.height; ++h )
-    {
-        XMVECTOR* ptr1 = scanline.get();
-        if ( !_LoadScanline( ptr1, width, pSrc1, rowPitch1, image1.format ) )
-            return E_FAIL;
-
-        XMVECTOR* ptr2 = scanline.get() + width;
-        if ( !_LoadScanline( ptr2, width, pSrc2, rowPitch2, image2.format ) )
-            return E_FAIL;
-
-        for( size_t i = 0; i < width; ++i )
-        {
-            XMVECTOR v1 = *(ptr1++);
-            if ( flags & CMSE_IMAGE1_SRGB )
-            {
-                v1 = XMVectorPow( v1, g_Gamma22 );
-            }
-            if ( flags & CMSE_IMAGE1_X2_BIAS )
-            {
-                v1 = XMVectorMultiplyAdd( v1, two, g_XMNegativeOne );
-            }
-
-            XMVECTOR v2 = *(ptr2++);
-            if ( flags & CMSE_IMAGE2_SRGB )
-            {
-                v2 = XMVectorPow( v2, g_Gamma22 );
-            }
-            if ( flags & CMSE_IMAGE2_X2_BIAS )
-            {
-                v1 = XMVectorMultiplyAdd( v2, two, g_XMNegativeOne );
-            }
-
-            // sum[ (I1 - I2)^2 ]
-            XMVECTOR v = XMVectorSubtract( v1, v2 );
-            if ( flags & CMSE_IGNORE_RED )
-            {
-                v = XMVectorSelect( v, g_XMZero, g_XMMaskX );
-            }
-            if ( flags & CMSE_IGNORE_GREEN )
-            {
-                v = XMVectorSelect( v, g_XMZero, g_XMMaskY );
-            }
-            if ( flags & CMSE_IGNORE_BLUE )
-            {
-                v = XMVectorSelect( v, g_XMZero, g_XMMaskZ );
-            }
-            if ( flags & CMSE_IGNORE_ALPHA )
-            {
-                v = XMVectorSelect( v, g_XMZero, g_XMMaskW );
-            }
-
-            acc = XMVectorMultiplyAdd( v, v, acc );
-        }
-
-        pSrc1 += rowPitch1;
-        pSrc2 += rowPitch2;
-    }
-
-    // MSE = sum[ (I1 - I2)^2 ] / w*h
-    XMVECTOR d = XMVectorReplicate( float(image1.width * image1.height) );
-    XMVECTOR v = XMVectorDivide( acc, d );
-    if ( mseV )
-    {
-        XMStoreFloat4( reinterpret_cast<XMFLOAT4*>( mseV ), v );
-        mse = mseV[0] + mseV[1] + mseV[2] + mseV[3];
-    }
-    else
-    {
-        XMFLOAT4 _mseV;
-        XMStoreFloat4( &_mseV, v );
-        mse = _mseV.x + _mseV.y + _mseV.z + _mseV.w;
-    }
-
-    return S_OK; 
-}
-
-
-//=====================================================================================
-// Entry points
-//=====================================================================================
-        
-//-------------------------------------------------------------------------------------
-// Copies a rectangle from one image into another
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT CopyRectangle( const Image& srcImage, const Rect& srcRect, const Image& dstImage, DWORD filter, size_t xOffset, size_t yOffset )
-{
-    if ( !srcImage.pixels || !dstImage.pixels )
-        return E_POINTER;
-
-    if ( IsCompressed( srcImage.format ) || IsCompressed( dstImage.format )
-         || IsPlanar( srcImage.format ) || IsPlanar( dstImage.format )
-         || IsPalettized( srcImage.format ) || IsPalettized( dstImage.format ) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    // Validate rectangle/offset
-    if ( !srcRect.w || !srcRect.h || ( (srcRect.x + srcRect.w) > srcImage.width ) || ( (srcRect.y + srcRect.h) > srcImage.height ) )
-    {
-        return E_INVALIDARG;
-    }
-
-    if ( ( (xOffset + srcRect.w) > dstImage.width ) || ( (yOffset + srcRect.h) > dstImage.height ) )
-    {
-        return E_INVALIDARG;
-    }
-
-    // Compute source bytes-per-pixel
-    size_t sbpp = BitsPerPixel( srcImage.format );
-    if ( !sbpp )
-        return E_FAIL;
-
-    if ( sbpp < 8 )
-    {
-        // We don't support monochrome (DXGI_FORMAT_R1_UNORM)
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    const uint8_t* pEndSrc = srcImage.pixels + srcImage.rowPitch*srcImage.height;
-    const uint8_t* pEndDest = dstImage.pixels + dstImage.rowPitch*dstImage.height;
-
-    // Round to bytes
-    sbpp = ( sbpp + 7 ) / 8;
-
-    const uint8_t* pSrc = srcImage.pixels + (srcRect.y * srcImage.rowPitch) + (srcRect.x * sbpp);
-
-    if ( srcImage.format == dstImage.format )
-    {
-        // Direct copy case (avoid intermediate conversions)
-        uint8_t* pDest = dstImage.pixels + (yOffset * dstImage.rowPitch) + (xOffset * sbpp);
-        const size_t copyW = srcRect.w * sbpp;
-        for( size_t h=0; h < srcRect.h; ++h )
-        {
-            if ( ( (pSrc+copyW) > pEndSrc ) || (pDest > pEndDest) )
-                return E_FAIL;
-
-            memcpy_s( pDest, pEndDest - pDest, pSrc, copyW );
-
-            pSrc += srcImage.rowPitch;
-            pDest += dstImage.rowPitch;
-        }
-
-        return S_OK;
-    }
-
-    // Compute destination bytes-per-pixel (not the same format as source)
-    size_t dbpp = BitsPerPixel( dstImage.format );
-    if ( !dbpp )
-        return E_FAIL;
-
-    if ( dbpp < 8 )
-    {
-        // We don't support monochrome (DXGI_FORMAT_R1_UNORM)
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-    }
-
-    // Round to bytes
-    dbpp = ( dbpp + 7 ) / 8;
-
-    uint8_t* pDest = dstImage.pixels + (yOffset * dstImage.rowPitch) + (xOffset * dbpp);
-
-    ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( (sizeof(XMVECTOR)*srcRect.w), 16 ) ) );
-    if ( !scanline )
-        return E_OUTOFMEMORY;
-
-    const size_t copyS = srcRect.w * sbpp;
-    const size_t copyD = srcRect.w * dbpp;
-
-    for( size_t h=0; h < srcRect.h; ++h )
-    {
-        if ( ( (pSrc+copyS) > pEndSrc) || ((pDest+copyD) > pEndDest) )
-            return E_FAIL;
-
-        if ( !_LoadScanline( scanline.get(), srcRect.w, pSrc, copyS, srcImage.format ) )
-            return E_FAIL;
-
-        _ConvertScanline( scanline.get(), srcRect.w, dstImage.format, srcImage.format, filter );
-
-        if ( !_StoreScanline( pDest, copyD, dstImage.format, scanline.get(), srcRect.w ) )
-            return E_FAIL;
-
-        pSrc += srcImage.rowPitch;
-        pDest += dstImage.rowPitch;
-    }
-
-    return S_OK;
-}
-
-    
-//-------------------------------------------------------------------------------------
-// Computes the Mean-Squared-Error (MSE) between two images
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT ComputeMSE( const Image& image1, const Image& image2, float& mse, float* mseV, DWORD flags )
-{
-    if ( !image1.pixels || !image2.pixels )
-        return E_POINTER;
-
-    if ( image1.width != image2.width || image1.height != image2.height )
-        return E_INVALIDARG;
-
-    if ( IsPlanar( image1.format ) || IsPlanar( image2.format )
-         || IsPalettized( image1.format ) || IsPalettized( image2.format ) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    if ( IsCompressed(image1.format) )
-    {
-        if ( IsCompressed(image2.format) )
-        {
-            // Case 1: both images are compressed, expand to RGBA32F
-            ScratchImage temp1;
-            HRESULT hr = Decompress( image1, DXGI_FORMAT_R32G32B32A32_FLOAT, temp1 );
-            if ( FAILED(hr) )
-                return hr;
-
-            ScratchImage temp2;
-            hr = Decompress(  image2, DXGI_FORMAT_R32G32B32A32_FLOAT, temp2 );
-            if ( FAILED(hr) )
-                return hr;
-
-            const Image* img1 = temp1.GetImage(0,0,0);
-            const Image* img2 = temp2.GetImage(0,0,0);
-            if ( !img1 || !img2 )
-                return E_POINTER;
-
-            return _ComputeMSE( *img1, *img2, mse, mseV, flags );
-        }
-        else
-        {
-            // Case 2: image1 is compressed, expand to RGBA32F
-            ScratchImage temp;
-            HRESULT hr = Decompress( image1, DXGI_FORMAT_R32G32B32A32_FLOAT, temp );
-            if ( FAILED(hr) )
-                return hr;
-
-            const Image* img = temp.GetImage(0,0,0);
-            if ( !img )
-                return E_POINTER;
-
-            return _ComputeMSE( *img, image2, mse, mseV, flags );
-        }
-    }
-    else
-    {
-        if ( IsCompressed(image2.format) )
-        {
-            // Case 3: image2 is compressed, expand to RGBA32F
-            ScratchImage temp;
-            HRESULT hr = Decompress( image2, DXGI_FORMAT_R32G32B32A32_FLOAT, temp );
-            if ( FAILED(hr) )
-                return hr;
-
-            const Image* img = temp.GetImage(0,0,0);
-            if ( !img )
-                return E_POINTER;
-
-            return _ComputeMSE( image1, *img, mse, mseV, flags );
-        }
-        else
-        {
-            // Case 4: neither image is compressed
-            return _ComputeMSE( image1, image2, mse, mseV, flags );
-        }
-    }
-}
-
-}; // namespace

+ 0 - 383
Exporters/FBX/3rdParty/DirectXTex/DirectXTexNormalMaps.cpp

@@ -1,383 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexNormalMaps.cpp
-//  
-// DirectX Texture Library - Normal map operations
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-namespace DirectX
-{
-
-#pragma prefast(suppress : 25000, "FXMVECTOR is 16 bytes")
-static inline float _EvaluateColor( _In_ FXMVECTOR val, _In_ DWORD flags )
-{
-    XMFLOAT4A f;
-
-    static XMVECTORF32 lScale = { 0.2125f, 0.7154f, 0.0721f, 1.f };
-
-    static_assert( CNMAP_CHANNEL_RED == 0x1, "CNMAP_CHANNEL_ flag values don't match mask" );
-    switch( flags & 0xf )
-    {
-    case 0:
-    case CNMAP_CHANNEL_RED:     return XMVectorGetX( val );
-    case CNMAP_CHANNEL_GREEN:   return XMVectorGetY( val );
-    case CNMAP_CHANNEL_BLUE:    return XMVectorGetZ( val );
-    case CNMAP_CHANNEL_ALPHA:   return XMVectorGetW( val );
-
-    case CNMAP_CHANNEL_LUMINANCE:
-        {
-            XMVECTOR v = XMVectorMultiply( val, lScale );
-            XMStoreFloat4A( &f, v );
-            return f.x + f.y + f.z;
-        }
-        break;
-
-    default:
-        assert(false);
-        return 0.f;
-    }
-}
-
-static void _EvaluateRow( _In_reads_(width) const XMVECTOR* pSource, _Out_writes_(width+2) float* pDest,
-                          _In_ size_t width, _In_ DWORD flags )
-{
-    assert( pSource && pDest );
-    assert( width > 0 );
-
-    for( size_t x = 0; x < width; ++x )
-    {
-        pDest[x+1] = _EvaluateColor( pSource[x], flags );
-    }
-
-    if ( flags & CNMAP_MIRROR_U )
-    {
-        // Mirror in U
-        pDest[0] = _EvaluateColor( pSource[0], flags );
-        pDest[width+1] = _EvaluateColor( pSource[width-1], flags );
-    }
-    else
-    {
-        // Wrap in U
-        pDest[0] = _EvaluateColor( pSource[width-1], flags );
-        pDest[width+1] = _EvaluateColor( pSource[0], flags );
-    }
-}
-
-static HRESULT _ComputeNMap( _In_ const Image& srcImage, _In_ DWORD flags, _In_ float amplitude,
-                             _In_ DXGI_FORMAT format, _In_ const Image& normalMap )
-{
-    if ( !srcImage.pixels || !normalMap.pixels )
-        return E_INVALIDARG;
-
-    const DWORD convFlags = _GetConvertFlags( format );
-    if ( !convFlags )
-        return E_FAIL;
-
-    if ( !( convFlags & (CONVF_UNORM | CONVF_SNORM | CONVF_FLOAT) ) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    const size_t width = srcImage.width;
-    const size_t height = srcImage.height;
-    if ( width != normalMap.width || height != normalMap.height )
-        return E_FAIL;
-
-    // Allocate temporary space (4 scanlines and 3 evaluated rows)
-    ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( (sizeof(XMVECTOR)*width*4), 16 ) ) );
-    if ( !scanline )
-        return E_OUTOFMEMORY;
-
-    ScopedAlignedArrayFloat buffer( reinterpret_cast<float*>( _aligned_malloc( ( ( sizeof(float) * ( width + 2 ) ) * 3 ), 16 ) ) );
-    if ( !buffer )
-        return E_OUTOFMEMORY;
-
-    uint8_t* pDest = normalMap.pixels;
-    if ( !pDest )
-        return E_POINTER;
-
-    XMVECTOR* row0 = scanline.get();
-    XMVECTOR* row1 = row0 + width;
-    XMVECTOR* row2 = row1 + width;
-    XMVECTOR* target = row2 + width;
-
-    float* val0 = buffer.get();
-    float* val1 = val0 + width + 2;
-    float* val2 = val1 + width + 2;
-
-    const size_t rowPitch = srcImage.rowPitch;
-    const uint8_t* pSrc = srcImage.pixels;
-
-    // Read first scanline row into 'row1'
-    if ( !_LoadScanline( row1, width, pSrc, rowPitch, srcImage.format ) )
-        return E_FAIL;
-
-    // Setup 'row0'
-    if ( flags & CNMAP_MIRROR_V )
-    {
-        // Mirror first row
-        memcpy_s( row0, rowPitch, row1, rowPitch );
-    }
-    else
-    {
-        // Read last row (Wrap V)
-        if ( !_LoadScanline( row0, width, pSrc + (rowPitch * (height-1)), rowPitch, srcImage.format ) )
-            return E_FAIL;
-    }
-
-    // Evaluate the initial rows
-    _EvaluateRow( row0, val0, width, flags );
-    _EvaluateRow( row1, val1, width, flags );
-
-    pSrc += rowPitch;
-
-    for( size_t y = 0; y < height; ++y )
-    {
-        // Load next scanline of source image
-        if ( y < (height-1) )
-        {
-            if ( !_LoadScanline( row2, width, pSrc, rowPitch, srcImage.format ) )
-                return E_FAIL;
-        }
-        else
-        {
-            if ( flags & CNMAP_MIRROR_V )
-            {
-                // Use last row of source image
-                if ( !_LoadScanline( row2, width, srcImage.pixels + (rowPitch * (height-1)), rowPitch, srcImage.format ) )
-                    return E_FAIL;
-            }
-            else
-            {
-                // Use first row of source image (Wrap V)
-                if ( !_LoadScanline( row2, width, srcImage.pixels, rowPitch, srcImage.format ) )
-                    return E_FAIL;
-            }
-        }
-
-        // Evaluate row
-        _EvaluateRow( row2, val2, width, flags );
-
-        // Generate target scanline
-        XMVECTOR *dptr = target;
-        for( size_t x = 0; x < width; ++x )
-        {
-            // Compute normal via central differencing
-            float totDelta = ( val0[x] - val0[x+2] ) + ( val1[x] - val1[x+2] ) + ( val2[x] - val2[x+2] );
-            float deltaZX = totDelta * amplitude / 6.f;
-
-            totDelta = ( val0[x] - val2[x] ) + ( val0[x+1] - val2[x+1] ) + ( val0[x+2] - val2[x+2] );
-            float deltaZY = totDelta * amplitude / 6.f;
-
-            XMVECTOR vx = XMVectorSetZ( g_XMNegIdentityR0, deltaZX );   // (-1.0f, 0.0f, deltaZX)
-            XMVECTOR vy = XMVectorSetZ( g_XMNegIdentityR1, deltaZY );   // (0.0f, -1.0f, deltaZY)
-
-            XMVECTOR normal = XMVector3Normalize( XMVector3Cross( vx, vy ) );
-
-            // Compute alpha (1.0 or an occlusion term)
-            float alpha = 1.f;
-
-            if ( flags & CNMAP_COMPUTE_OCCLUSION )
-            {
-                float delta = 0.f;
-                float c = val1[x+1];
-
-                float t = val0[x] - c;  if ( t > 0.f ) delta += t;
-                t = val0[x+1]   - c;    if ( t > 0.f ) delta += t;
-                t = val0[x+2]   - c;    if ( t > 0.f ) delta += t;
-                t = val1[x]     - c;    if ( t > 0.f ) delta += t;
-                // Skip current pixel
-                t = val1[x+2]   - c;    if ( t > 0.f ) delta += t;
-                t = val2[x]     - c;    if ( t > 0.f ) delta += t;
-                t = val2[x+1]   - c;    if ( t > 0.f ) delta += t;
-                t = val2[x+2]   - c;    if ( t > 0.f ) delta += t;
-
-                // Average delta (divide by 8, scale by amplitude factor)
-                delta *= 0.125f * amplitude;
-                if ( delta > 0.f )
-                {
-                    // If < 0, then no occlusion
-                    float r = sqrtf( 1.f + delta*delta );
-                    alpha = (r - delta) / r;
-                }
-            }
-
-            // Encode based on target format
-            if ( convFlags & CONVF_UNORM )
-            {
-                // 0.5f*normal + 0.5f -or- invert sign case: -0.5f*normal + 0.5f
-                XMVECTOR n1 = XMVectorMultiplyAdd( (flags & CNMAP_INVERT_SIGN) ? g_XMNegativeOneHalf : g_XMOneHalf, normal, g_XMOneHalf ); 
-                *dptr++ = XMVectorSetW( n1, alpha );
-            }
-            else if ( flags & CNMAP_INVERT_SIGN )
-            {
-                *dptr++ = XMVectorSetW( XMVectorNegate( normal ), alpha );
-            }
-            else
-            {
-                *dptr++ = XMVectorSetW( normal, alpha );
-            }
-        }
-
-        if ( !_StoreScanline( pDest, normalMap.rowPitch, format, target, width ) )
-            return E_FAIL;
-
-        // Cycle buffers
-        float* temp = val0;
-        val0 = val1;
-        val1 = val2;
-        val2 = temp;
-
-        pSrc += rowPitch;
-        pDest += normalMap.rowPitch;
-    }
-
-    return S_OK;
-}
-
-
-//=====================================================================================
-// Entry points
-//=====================================================================================
-        
-//-------------------------------------------------------------------------------------
-// Generates a normal map from a height-map
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT ComputeNormalMap( const Image& srcImage, DWORD flags, float amplitude,
-                          DXGI_FORMAT format, ScratchImage& normalMap )
-{
-    if ( !srcImage.pixels || !IsValid(format) )
-        return E_INVALIDARG;
-
-    static_assert( CNMAP_CHANNEL_RED == 0x1, "CNMAP_CHANNEL_ flag values don't match mask" );
-    switch( flags & 0xf )
-    {
-    case 0:
-    case CNMAP_CHANNEL_RED:
-    case CNMAP_CHANNEL_GREEN:
-    case CNMAP_CHANNEL_BLUE:
-    case CNMAP_CHANNEL_ALPHA:
-    case CNMAP_CHANNEL_LUMINANCE:
-        break;
-
-    default:
-        return E_INVALIDARG;
-    }
-
-    if ( IsCompressed(format) || IsCompressed(srcImage.format)
-         || IsTypeless(format) || IsTypeless(srcImage.format) 
-         || IsPlanar(format) || IsPlanar(srcImage.format) 
-         || IsPalettized(format) || IsPalettized(srcImage.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    // Setup target image
-    normalMap.Release();
-
-    HRESULT hr = normalMap.Initialize2D( format, srcImage.width, srcImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-
-    const Image *img = normalMap.GetImage( 0, 0, 0 );
-    if ( !img )
-    {
-        normalMap.Release();
-        return E_POINTER;
-    }
-
-    hr = _ComputeNMap( srcImage, flags, amplitude, format, *img );
-    if ( FAILED(hr) )
-    {
-        normalMap.Release();
-        return hr;
-    }
-
-    return S_OK;
-}
-
-_Use_decl_annotations_
-HRESULT ComputeNormalMap( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
-                          DWORD flags, float amplitude, DXGI_FORMAT format, ScratchImage& normalMaps )
-{
-    if ( !srcImages || !nimages || !IsValid(format) )
-        return E_INVALIDARG;
-
-    if ( IsCompressed(format) || IsCompressed(metadata.format)
-         || IsTypeless(format) || IsTypeless(metadata.format) 
-         || IsPlanar(format) || IsPlanar(metadata.format) 
-         || IsPalettized(format) || IsPalettized(metadata.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-    static_assert( CNMAP_CHANNEL_RED == 0x1, "CNMAP_CHANNEL_ flag values don't match mask" );
-    switch( flags & 0xf )
-    {
-    case 0:
-    case CNMAP_CHANNEL_RED:
-    case CNMAP_CHANNEL_GREEN:
-    case CNMAP_CHANNEL_BLUE:
-    case CNMAP_CHANNEL_ALPHA:
-    case CNMAP_CHANNEL_LUMINANCE:
-        break;
-
-    default:
-        return E_INVALIDARG;
-    }
-
-    normalMaps.Release();
-
-    TexMetadata mdata2 = metadata;
-    mdata2.format = format;
-    HRESULT hr = normalMaps.Initialize( mdata2 );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( nimages != normalMaps.GetImageCount() )
-    {
-        normalMaps.Release();
-        return E_FAIL;
-    }
-
-    const Image* dest = normalMaps.GetImages();
-    if ( !dest )
-    {
-        normalMaps.Release();
-        return E_POINTER;
-    }
-
-    for( size_t index=0; index < nimages; ++index )
-    {
-        assert( dest[ index ].format == format );
-
-        const Image& src = srcImages[ index ];
-        if ( IsCompressed( src.format ) || IsTypeless( src.format ) )
-        {
-            normalMaps.Release();
-            return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-        }
-
-        if ( src.width != dest[ index ].width || src.height != dest[ index ].height )
-        {
-            normalMaps.Release();
-            return E_FAIL;
-        }
-
-        hr = _ComputeNMap( src, flags, amplitude, format, dest[ index ] );
-        if ( FAILED(hr) )
-        {
-            normalMaps.Release();
-            return hr;
-        }
-    }
-
-    return S_OK;
-}
-
-}; // namespace

+ 0 - 209
Exporters/FBX/3rdParty/DirectXTex/DirectXTexP.h

@@ -1,209 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexp.h
-//  
-// DirectX Texture Library - Private header
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-#define NOMINMAX
-#include <windows.h>
-#include <directxmath.h>
-#include <directxpackedvector.h>
-#include <assert.h>
-
-#include <malloc.h>
-#include <memory>
-
-#include <vector>
-
-#include <stdlib.h>
-#include <search.h>
-
-#include <ole2.h>
-
-#include "directxtex.h"
-
-// VS 2010's stdint.h conflicts with intsafe.h
-#pragma warning(push)
-#pragma warning(disable : 4005)
-#include <wincodec.h>
-#include <wrl.h>
-#pragma warning(pop)
-
-#include "scoped.h"
-
-struct IWICImagingFactory;
-
-#define TEX_FILTER_MASK 0xF00000
-
-namespace DirectX
-{
-    //---------------------------------------------------------------------------------
-    // WIC helper functions
-    DXGI_FORMAT _WICToDXGI( _In_ const GUID& guid );
-    bool _DXGIToWIC( _In_ DXGI_FORMAT format, _Out_ GUID& guid, _In_ bool ignoreRGBvsBGR = false );
-
-    DWORD _CheckWICColorSpace( _In_ const GUID& sourceGUID, _In_ const GUID& targetGUID );
-
-    IWICImagingFactory* _GetWIC();
-
-    bool _IsWIC2();
-
-    inline WICBitmapDitherType _GetWICDither( _In_ DWORD flags )
-    {
-        static_assert( TEX_FILTER_DITHER == 0x10000, "TEX_FILTER_DITHER* flag values don't match mask" );
-
-        static_assert( TEX_FILTER_DITHER == WIC_FLAGS_DITHER, "TEX_FILTER_DITHER* should match WIC_FLAGS_DITHER*" );
-        static_assert( TEX_FILTER_DITHER_DIFFUSION == WIC_FLAGS_DITHER_DIFFUSION, "TEX_FILTER_DITHER* should match WIC_FLAGS_DITHER*" );
-
-        switch( flags & 0xF0000 )
-        {
-        case TEX_FILTER_DITHER:
-            return WICBitmapDitherTypeOrdered4x4;
-
-        case TEX_FILTER_DITHER_DIFFUSION:
-            return WICBitmapDitherTypeErrorDiffusion;
-
-        default:
-            return WICBitmapDitherTypeNone;
-        }
-    }
-
-    inline WICBitmapInterpolationMode _GetWICInterp( _In_ DWORD flags )
-    {
-        static_assert( TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK" );
-
-        static_assert( TEX_FILTER_POINT == WIC_FLAGS_FILTER_POINT, "TEX_FILTER_* flags should match WIC_FLAGS_FILTER_*" );
-        static_assert( TEX_FILTER_LINEAR == WIC_FLAGS_FILTER_LINEAR, "TEX_FILTER_* flags should match WIC_FLAGS_FILTER_*"  );
-        static_assert( TEX_FILTER_CUBIC == WIC_FLAGS_FILTER_CUBIC, "TEX_FILTER_* flags should match WIC_FLAGS_FILTER_*"  );
-        static_assert( TEX_FILTER_FANT == WIC_FLAGS_FILTER_FANT, "TEX_FILTER_* flags should match WIC_FLAGS_FILTER_*"  );
-
-        switch( flags & TEX_FILTER_MASK )
-        {
-        case TEX_FILTER_POINT:
-            return WICBitmapInterpolationModeNearestNeighbor;
-
-        case TEX_FILTER_LINEAR:
-            return WICBitmapInterpolationModeLinear;
-
-        case TEX_FILTER_CUBIC:
-            return WICBitmapInterpolationModeCubic;
-
-        case TEX_FILTER_FANT:
-        default:
-            return WICBitmapInterpolationModeFant;
-        }
-    }
-
-    //---------------------------------------------------------------------------------
-    // Image helper functions
-    void _DetermineImageArray( _In_ const TexMetadata& metadata, _In_ DWORD cpFlags,
-                               _Out_ size_t& nImages, _Out_ size_t& pixelSize );
-
-    _Success_(return != false)
-    bool _SetupImageArray( _In_reads_bytes_(pixelSize) uint8_t *pMemory, _In_ size_t pixelSize,
-                           _In_ const TexMetadata& metadata, _In_ DWORD cpFlags,
-                           _Out_writes_(nImages) Image* images, _In_ size_t nImages );
-
-    //---------------------------------------------------------------------------------
-    // Conversion helper functions
-
-    enum TEXP_SCANLINE_FLAGS
-    {
-        TEXP_SCANLINE_NONE          = 0,
-        TEXP_SCANLINE_SETALPHA      = 0x1,  // Set alpha channel to known opaque value
-        TEXP_SCANLINE_LEGACY        = 0x2,  // Enables specific legacy format conversion cases
-    };
-
-    enum CONVERT_FLAGS
-    {
-        CONVF_FLOAT     = 0x1,
-        CONVF_UNORM     = 0x2,
-        CONVF_UINT      = 0x4,
-        CONVF_SNORM     = 0x8, 
-        CONVF_SINT      = 0x10,
-        CONVF_DEPTH     = 0x20,
-        CONVF_STENCIL   = 0x40,
-        CONVF_SHAREDEXP = 0x80,
-        CONVF_BGR       = 0x100,
-        CONVF_XR        = 0x200,
-        CONVF_PACKED    = 0x400,
-        CONVF_BC        = 0x800,
-        CONVF_YUV       = 0x1000,
-        CONVF_R         = 0x10000,
-        CONVF_G         = 0x20000,
-        CONVF_B         = 0x40000,
-        CONVF_A         = 0x80000,
-        CONVF_RGB_MASK  = 0x70000,
-        CONVF_RGBA_MASK = 0xF0000,
-    };
-
-    DWORD _GetConvertFlags( _In_ DXGI_FORMAT format );
-
-    void _CopyScanline( _When_(pDestination == pSource, _Inout_updates_bytes_(outSize))
-                        _When_(pDestination != pSource, _Out_writes_bytes_(outSize))
-                        LPVOID pDestination, _In_ size_t outSize, 
-                        _In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
-                        _In_ DXGI_FORMAT format, _In_ DWORD flags );
-
-    void _SwizzleScanline( _When_(pDestination == pSource, _In_)
-                           _When_(pDestination != pSource, _Out_writes_bytes_(outSize))
-                           LPVOID pDestination, _In_ size_t outSize, 
-                           _In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
-                           _In_ DXGI_FORMAT format, _In_ DWORD flags );
-
-    _Success_(return != false)
-    bool _ExpandScanline( _Out_writes_bytes_(outSize) LPVOID pDestination, _In_ size_t outSize,
-                          _In_ DXGI_FORMAT outFormat, 
-                          _In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
-                          _In_ DXGI_FORMAT inFormat, _In_ DWORD flags );
-
-    _Success_(return != false)
-    bool _LoadScanline( _Out_writes_(count) XMVECTOR* pDestination, _In_ size_t count,
-                        _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DXGI_FORMAT format );
-
-    _Success_(return != false)
-    bool _LoadScanlineLinear( _Out_writes_(count) XMVECTOR* pDestination, _In_ size_t count,
-                             _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DXGI_FORMAT format, _In_ DWORD flags  );
-
-    _Success_(return != false)
-    bool _StoreScanline( LPVOID pDestination, _In_ size_t size, _In_ DXGI_FORMAT format,
-                         _In_reads_(count) const XMVECTOR* pSource, _In_ size_t count, _In_ float threshold = 0 );
-
-    _Success_(return != false)
-    bool _StoreScanlineLinear( LPVOID pDestination, _In_ size_t size, _In_ DXGI_FORMAT format,
-                               _Inout_updates_all_(count) XMVECTOR* pSource, _In_ size_t count, _In_ DWORD flags );
-
-    _Success_(return != false)
-    bool _StoreScanlineDither( LPVOID pDestination, _In_ size_t size, _In_ DXGI_FORMAT format,
-                               _Inout_updates_all_(count) XMVECTOR* pSource, _In_ size_t count, _In_ float threshold, size_t y, size_t z,
-                               _Inout_updates_all_opt_(count+2) XMVECTOR* pDiffusionErrors );
-
-    HRESULT _ConvertToR32G32B32A32( _In_ const Image& srcImage, _Inout_ ScratchImage& image );
-
-    HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ const Image& destImage );
-    HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _Inout_ ScratchImage& image );
-    HRESULT _ConvertFromR32G32B32A32( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
-                                      _In_ DXGI_FORMAT format, _Out_ ScratchImage& result );
-
-    void _ConvertScanline( _Inout_updates_all_(count) XMVECTOR* pBuffer, _In_ size_t count,
-                           _In_ DXGI_FORMAT outFormat, _In_ DXGI_FORMAT inFormat, _In_ DWORD flags );
-
-    //---------------------------------------------------------------------------------
-    // DDS helper functions
-    HRESULT _EncodeDDSHeader( _In_ const TexMetadata& metadata, DWORD flags,
-                              _Out_writes_bytes_to_opt_(maxsize, required) LPVOID pDestination, _In_ size_t maxsize, _Out_ size_t& required );
-
-}; // namespace

+ 0 - 229
Exporters/FBX/3rdParty/DirectXTex/DirectXTexPMAlpha.cpp

@@ -1,229 +0,0 @@
-//-------------------------------------------------------------------------------------
-// DirectXTexPMAlpha.cpp
-//  
-// DirectX Texture Library - Premultiplied alpha operations
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// http://go.microsoft.com/fwlink/?LinkId=248926
-//-------------------------------------------------------------------------------------
-
-#include "directxtexp.h"
-
-namespace DirectX
-{
-
-static HRESULT _PremultiplyAlpha( _In_ const Image& srcImage, _In_ const Image& destImage )
-{
-    assert( srcImage.width == destImage.width );
-    assert( srcImage.height == destImage.height );
-
-    ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( (sizeof(XMVECTOR)*srcImage.width), 16 ) ) );
-    if ( !scanline )
-        return E_OUTOFMEMORY;
-
-    const uint8_t *pSrc = srcImage.pixels;
-    uint8_t *pDest = destImage.pixels;
-    if ( !pSrc || !pDest )
-        return E_POINTER;
-
-    for( size_t h = 0; h < srcImage.height; ++h )
-    {
-        if ( !_LoadScanline( scanline.get(), srcImage.width, pSrc, srcImage.rowPitch, srcImage.format ) )
-            return E_FAIL;
-
-        XMVECTOR* ptr = scanline.get();
-        for( size_t w = 0; w < srcImage.width; ++w )
-        {
-            XMVECTOR v = *ptr;
-            XMVECTOR alpha = XMVectorSplatW( *ptr );
-            alpha = XMVectorMultiply( v, alpha );
-            *(ptr++) = XMVectorSelect( v, alpha, g_XMSelect1110 );
-        }
-
-        if ( !_StoreScanline( pDest, destImage.rowPitch, destImage.format, scanline.get(), srcImage.width ) )
-            return E_FAIL;
-
-        pSrc += srcImage.rowPitch;
-        pDest += destImage.rowPitch;
-    }
-
-    return S_OK;
-}
-
-static HRESULT _PremultiplyAlphaLinear( _In_ const Image& srcImage, _In_ DWORD flags, _In_ const Image& destImage )
-{
-    assert( srcImage.width == destImage.width );
-    assert( srcImage.height == destImage.height );
-
-    static_assert( TEX_PMALPHA_SRGB_IN == TEX_FILTER_SRGB_IN, "TEX_PMALHPA_SRGB* should match TEX_FILTER_SRGB*" );
-    static_assert( TEX_PMALPHA_SRGB_OUT == TEX_FILTER_SRGB_OUT, "TEX_PMALHPA_SRGB* should match TEX_FILTER_SRGB*" );
-    static_assert( TEX_PMALPHA_SRGB == TEX_FILTER_SRGB, "TEX_PMALHPA_SRGB* should match TEX_FILTER_SRGB*" );
-    flags &= TEX_PMALPHA_SRGB;
-
-    ScopedAlignedArrayXMVECTOR scanline( reinterpret_cast<XMVECTOR*>( _aligned_malloc( (sizeof(XMVECTOR)*srcImage.width), 16 ) ) );
-    if ( !scanline )
-        return E_OUTOFMEMORY;
-
-    const uint8_t *pSrc = srcImage.pixels;
-    uint8_t *pDest = destImage.pixels;
-    if ( !pSrc || !pDest )
-        return E_POINTER;
-
-    for( size_t h = 0; h < srcImage.height; ++h )
-    {
-        if ( !_LoadScanlineLinear( scanline.get(), srcImage.width, pSrc, srcImage.rowPitch, srcImage.format, flags ) )
-            return E_FAIL;
-
-        XMVECTOR* ptr = scanline.get();
-        for( size_t w = 0; w < srcImage.width; ++w )
-        {
-            XMVECTOR v = *ptr;
-            XMVECTOR alpha = XMVectorSplatW( *ptr );
-            alpha = XMVectorMultiply( v, alpha );
-            *(ptr++) = XMVectorSelect( v, alpha, g_XMSelect1110 );
-        }
-
-        if ( !_StoreScanlineLinear( pDest, destImage.rowPitch, destImage.format, scanline.get(), srcImage.width, flags ) )
-            return E_FAIL;
-
-        pSrc += srcImage.rowPitch;
-        pDest += destImage.rowPitch;
-    }
-
-    return S_OK;
-}
-
-
-//=====================================================================================
-// Entry-points
-//=====================================================================================
-
-//-------------------------------------------------------------------------------------
-// Converts to a premultiplied alpha version of the texture
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT PremultiplyAlpha( const Image& srcImage, DWORD flags, ScratchImage& image )
-{
-    if ( !srcImage.pixels )
-        return E_POINTER;
-
-    if ( IsCompressed(srcImage.format)
-         || IsPlanar(srcImage.format)
-         || IsPalettized(srcImage.format)
-         || IsTypeless(srcImage.format)
-         || !HasAlpha(srcImage.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-#ifdef _M_X64
-    if ( (srcImage.width > 0xFFFFFFFF) || (srcImage.height > 0xFFFFFFFF) )
-        return E_INVALIDARG;
-#endif
-
-    HRESULT hr = image.Initialize2D( srcImage.format, srcImage.width, srcImage.height, 1, 1 );
-    if ( FAILED(hr) )
-        return hr;
-   
-    const Image *rimage = image.GetImage( 0, 0, 0 );
-    if ( !rimage )
-    {
-        image.Release();
-        return E_POINTER;
-    }
-
-    hr = ( flags & TEX_PMALPHA_IGNORE_SRGB ) ? _PremultiplyAlpha( srcImage, *rimage ) : _PremultiplyAlphaLinear( srcImage, flags, *rimage );
-    if ( FAILED(hr) )
-    {
-        image.Release();
-        return hr;
-    }
-
-    return S_OK;
-}
-
-
-//-------------------------------------------------------------------------------------
-// Converts to a premultiplied alpha version of the texture (complex)
-//-------------------------------------------------------------------------------------
-_Use_decl_annotations_
-HRESULT PremultiplyAlpha( const Image* srcImages, size_t nimages, const TexMetadata& metadata, DWORD flags, ScratchImage& result )
-{
-    if ( !srcImages || !nimages )
-        return E_INVALIDARG;
-
-    if ( IsCompressed(metadata.format)
-         || IsPlanar(metadata.format)
-         || IsPalettized(metadata.format)
-         || IsTypeless(metadata.format)
-         || !HasAlpha(metadata.format) )
-        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
-
-#ifdef _M_X64
-    if ( (metadata.width > 0xFFFFFFFF) || (metadata.height > 0xFFFFFFFF) )
-        return E_INVALIDARG;
-#endif
-
-    if ( metadata.IsPMAlpha() )
-    {
-        // Already premultiplied
-        return E_FAIL;
-    }
-
-    TexMetadata mdata2 = metadata;
-    mdata2.SetAlphaMode(TEX_ALPHA_MODE_PREMULTIPLIED);
-    HRESULT hr = result.Initialize( mdata2 );
-    if ( FAILED(hr) )
-        return hr;
-
-    if ( nimages != result.GetImageCount() )
-    {
-        result.Release();
-        return E_FAIL;
-    }
-
-    const Image* dest = result.GetImages();
-    if ( !dest )
-    {
-        result.Release();
-        return E_POINTER;
-    }
-
-    for( size_t index=0; index < nimages; ++index )
-    {
-        const Image& src = srcImages[ index ];
-        if ( src.format != metadata.format )
-        {
-            result.Release();
-            return E_FAIL;
-        }
-
-#ifdef _M_X64
-        if ( (src.width > 0xFFFFFFFF) || (src.height > 0xFFFFFFFF) )
-            return E_FAIL;
-#endif
-        const Image& dst = dest[ index ];
-        assert( dst.format == metadata.format );
-
-        if ( src.width != dst.width || src.height != dst.height )
-        {
-            result.Release();
-            return E_FAIL;
-        }
-
-        hr = ( flags & TEX_PMALPHA_IGNORE_SRGB ) ? _PremultiplyAlpha( src, dst ) : _PremultiplyAlphaLinear( src, flags, dst );
-        if ( FAILED(hr) )
-        {
-            result.Release();
-            return hr;
-        }
-    }
-
-    return S_OK;
-}
-
-}; // namespace

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1034
Exporters/FBX/3rdParty/DirectXTex/DirectXTexResize.cpp


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1391
Exporters/FBX/3rdParty/DirectXTex/DirectXTexTGA.cpp


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1029
Exporters/FBX/3rdParty/DirectXTex/DirectXTexUtil.cpp


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1128
Exporters/FBX/3rdParty/DirectXTex/DirectXTexWIC.cpp


+ 0 - 432
Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2012.vcxproj

@@ -1,432 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Profile|Win32">
-      <Configuration>Profile</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Profile|x64">
-      <Configuration>Profile</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectName>DirectXTex</ProjectName>
-    <ProjectGuid>{371B9FA9-4C90-4AC6-A123-ACED756D6C77}</ProjectGuid>
-    <RootNamespace>DirectXTex</RootNamespace>
-    <Keyword>Win32Proj</Keyword>
-    <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings" />
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>true</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
-    <OutDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>true</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
-    <OutDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
-    <OutDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
-    <OutDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2012\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <CLInclude Include="BC.h" />
-    <ClCompile Include="BC.cpp" />
-    <ClCompile Include="BC4BC5.cpp" />
-    <ClCompile Include="BC6HBC7.cpp" />
-    <ClInclude Include="BCDirectCompute.h" />
-    <CLInclude Include="DDS.h" />
-    <ClInclude Include="filters.h" />
-    <CLInclude Include="scoped.h" />
-    <CLInclude Include="DirectXTex.h" />
-    <CLInclude Include="DirectXTexp.h" />
-    <CLInclude Include="DirectXTex.inl" />
-    <ClCompile Include="BCDirectCompute.cpp" />
-    <ClCompile Include="DirectXTexCompress.cpp" />
-    <ClCompile Include="DirectXTexCompressGPU.cpp" />
-    <ClCompile Include="DirectXTexConvert.cpp" />
-    <ClCompile Include="DirectXTexD3D11.cpp" />
-    <ClCompile Include="DirectXTexDDS.cpp" />
-    <ClCompile Include="DirectXTexFlipRotate.cpp" />
-    <ClCompile Include="DirectXTexImage.cpp" />
-    <ClCompile Include="DirectXTexMipMaps.cpp" />
-    <ClCompile Include="DirectXTexMisc.cpp" />
-    <ClCompile Include="DirectXTexNormalMaps.cpp" />
-    <ClCompile Include="DirectXTexPMAlpha.cpp" />
-    <ClCompile Include="DirectXTexResize.cpp" />
-    <ClCompile Include="DirectXTexTGA.cpp" />
-    <ClCompile Include="DirectXTexUtil.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="DirectXTexWIC.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets" />
-</Project>

+ 0 - 38
Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2012.vcxproj.filters

@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns:atg="http://atg.xbox.com" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{8e114980-c1a3-4ada-ad7c-83caadf5daeb}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <CLInclude Include="BC.h" />
-    <ClCompile Include="BC.cpp" />
-    <ClCompile Include="BC4BC5.cpp" />
-    <ClCompile Include="BC6HBC7.cpp" />
-    <CLInclude Include="DDS.h" />
-    <ClInclude Include="filters.h" />
-    <CLInclude Include="scoped.h" />
-    <CLInclude Include="DirectXTex.h" />
-    <CLInclude Include="DirectXTexp.h" />
-    <CLInclude Include="DirectXTex.inl" />
-    <ClCompile Include="DirectXTexCompress.cpp" />
-    <ClCompile Include="DirectXTexConvert.cpp" />
-    <ClCompile Include="DirectXTexD3D11.cpp" />
-    <ClCompile Include="DirectXTexDDS.cpp" />
-    <ClCompile Include="DirectXTexFlipRotate.cpp" />
-    <ClCompile Include="DirectXTexImage.cpp" />
-    <ClCompile Include="DirectXTexMipMaps.cpp" />
-    <ClCompile Include="DirectXTexMisc.cpp" />
-    <ClCompile Include="DirectXTexNormalMaps.cpp" />
-    <ClCompile Include="DirectXTexPMAlpha.cpp" />
-    <ClCompile Include="DirectXTexResize.cpp" />
-    <ClCompile Include="DirectXTexTGA.cpp" />
-    <ClCompile Include="DirectXTexUtil.cpp" />
-    <ClCompile Include="DirectXTexWIC.cpp" />
-    <ClInclude Include="BCDirectCompute.h" />
-    <ClCompile Include="BCDirectCompute.cpp" />
-    <ClCompile Include="DirectXTexCompressGPU.cpp" />
-  </ItemGroup>
-</Project>

+ 0 - 436
Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2013.vcxproj

@@ -1,436 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Profile|Win32">
-      <Configuration>Profile</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Profile|x64">
-      <Configuration>Profile</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectName>DirectXTex</ProjectName>
-    <ProjectGuid>{371B9FA9-4C90-4AC6-A123-ACED756D6C77}</ProjectGuid>
-    <RootNamespace>DirectXTex</RootNamespace>
-    <Keyword>Win32Proj</Keyword>
-    <SccProjectName>SAK</SccProjectName>
-    <SccAuxPath>SAK</SccAuxPath>
-    <SccLocalPath>SAK</SccLocalPath>
-    <SccProvider>SAK</SccProvider>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings" />
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>true</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
-    <OutDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>true</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
-    <OutDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
-    <OutDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
-    <OutDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>Bin\Desktop_2013\$(Platform)\$(Configuration)\</IntDir>
-    <TargetName>DirectXTex</TargetName>
-    <LinkIncremental>false</LinkIncremental>
-    <GenerateManifest>true</GenerateManifest>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <OpenMPSupport>true</OpenMPSupport>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FloatingPointModel>Fast</FloatingPointModel>
-      <ExceptionHandling>Sync</ExceptionHandling>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
-      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
-    </ClCompile>
-    <Link>
-      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <LargeAddressAware>true</LargeAddressAware>
-      <RandomizedBaseAddress>true</RandomizedBaseAddress>
-      <DataExecutionPrevention>true</DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-      <UACExecutionLevel>AsInvoker</UACExecutionLevel>
-      <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
-    </Link>
-    <Manifest>
-      <EnableDPIAwareness>false</EnableDPIAwareness>
-    </Manifest>
-    <PreBuildEvent>
-      <Command>
-      </Command>
-    </PreBuildEvent>
-    <PostBuildEvent>
-      <Command>
-      </Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemGroup />
-  <ItemGroup>
-    <CLInclude Include="BC.h" />
-    <ClCompile Include="BC.cpp" />
-    <ClCompile Include="BC4BC5.cpp" />
-    <ClCompile Include="BC6HBC7.cpp" />
-    <ClInclude Include="BCDirectCompute.h" />
-    <CLInclude Include="DDS.h" />
-    <ClInclude Include="filters.h" />
-    <CLInclude Include="scoped.h" />
-    <CLInclude Include="DirectXTex.h" />
-    <CLInclude Include="DirectXTexp.h" />
-    <CLInclude Include="DirectXTex.inl" />
-    <ClCompile Include="BCDirectCompute.cpp" />
-    <ClCompile Include="DirectXTexCompress.cpp" />
-    <ClCompile Include="DirectXTexCompressGPU.cpp" />
-    <ClCompile Include="DirectXTexConvert.cpp" />
-    <ClCompile Include="DirectXTexD3D11.cpp" />
-    <ClCompile Include="DirectXTexDDS.cpp" />
-    <ClCompile Include="DirectXTexFlipRotate.cpp" />
-    <ClCompile Include="DirectXTexImage.cpp" />
-    <ClCompile Include="DirectXTexMipMaps.cpp" />
-    <ClCompile Include="DirectXTexMisc.cpp" />
-    <ClCompile Include="DirectXTexNormalMaps.cpp" />
-    <ClCompile Include="DirectXTexPMAlpha.cpp" />
-    <ClCompile Include="DirectXTexResize.cpp" />
-    <ClCompile Include="DirectXTexTGA.cpp" />
-    <ClCompile Include="DirectXTexUtil.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="DirectXTexWIC.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <ItemGroup>
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets" />
-</Project>

+ 0 - 38
Exporters/FBX/3rdParty/DirectXTex/DirectXTex_Desktop_2013.vcxproj.filters

@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns:atg="http://atg.xbox.com" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{8e114980-c1a3-4ada-ad7c-83caadf5daeb}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <CLInclude Include="BC.h" />
-    <ClCompile Include="BC.cpp" />
-    <ClCompile Include="BC4BC5.cpp" />
-    <ClCompile Include="BC6HBC7.cpp" />
-    <CLInclude Include="DDS.h" />
-    <ClInclude Include="filters.h" />
-    <CLInclude Include="scoped.h" />
-    <CLInclude Include="DirectXTex.h" />
-    <CLInclude Include="DirectXTexp.h" />
-    <CLInclude Include="DirectXTex.inl" />
-    <ClCompile Include="DirectXTexCompress.cpp" />
-    <ClCompile Include="DirectXTexConvert.cpp" />
-    <ClCompile Include="DirectXTexD3D11.cpp" />
-    <ClCompile Include="DirectXTexDDS.cpp" />
-    <ClCompile Include="DirectXTexFlipRotate.cpp" />
-    <ClCompile Include="DirectXTexImage.cpp" />
-    <ClCompile Include="DirectXTexMipMaps.cpp" />
-    <ClCompile Include="DirectXTexMisc.cpp" />
-    <ClCompile Include="DirectXTexNormalMaps.cpp" />
-    <ClCompile Include="DirectXTexPMAlpha.cpp" />
-    <ClCompile Include="DirectXTexResize.cpp" />
-    <ClCompile Include="DirectXTexTGA.cpp" />
-    <ClCompile Include="DirectXTexUtil.cpp" />
-    <ClCompile Include="DirectXTexWIC.cpp" />
-    <ClInclude Include="BCDirectCompute.h" />
-    <ClCompile Include="BCDirectCompute.cpp" />
-    <ClCompile Include="DirectXTexCompressGPU.cpp" />
-  </ItemGroup>
-</Project>

+ 0 - 424
Exporters/FBX/3rdParty/DirectXTex/Filters.h

@@ -1,424 +0,0 @@
-//-------------------------------------------------------------------------------------
-// filters.h
-//  
-// Utility header with helpers for implementing image filters
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-#include <directxmath.h>
-#include <directxpackedvector.h>
-
-#include <memory>
-
-#include "scoped.h"
-
-namespace DirectX
-{
-
-//-------------------------------------------------------------------------------------
-// Box filtering helpers
-//-------------------------------------------------------------------------------------
-
-XMGLOBALCONST XMVECTORF32 g_boxScale = { 0.25f, 0.25f, 0.25f, 0.25f };
-XMGLOBALCONST XMVECTORF32 g_boxScale3D = { 0.125f, 0.125f, 0.125f, 0.125f };
-
-#define AVERAGE4( res, p0, p1, p2, p3 ) \
-{ \
-    XMVECTOR v = XMVectorAdd( (p0), (p1) ); \
-    v = XMVectorAdd( v, (p2) ); \
-    v = XMVectorAdd( v, (p3) ); \
-    res = XMVectorMultiply( v, g_boxScale ); \
-}
-
-#define AVERAGE8( res, p0, p1, p2, p3, p4, p5, p6, p7) \
-{ \
-    XMVECTOR v = XMVectorAdd( (p0), (p1) ); \
-    v = XMVectorAdd( v, (p2) ); \
-    v = XMVectorAdd( v, (p3) ); \
-    v = XMVectorAdd( v, (p4) ); \
-    v = XMVectorAdd( v, (p5) ); \
-    v = XMVectorAdd( v, (p6) ); \
-    v = XMVectorAdd( v, (p7) ); \
-    res = XMVectorMultiply( v, g_boxScale3D ); \
-}
-
-
-//-------------------------------------------------------------------------------------
-// Linear filtering helpers
-//-------------------------------------------------------------------------------------
-
-struct LinearFilter
-{
-    size_t  u0;
-    float   weight0;
-    size_t  u1;
-    float   weight1;
-};
-
-inline void _CreateLinearFilter( _In_ size_t source, _In_ size_t dest, _In_ bool wrap, _Out_writes_(dest) LinearFilter* lf )
-{
-    assert( source > 0 );
-    assert( dest > 0 );
-    assert( lf != 0 );
-
-    float scale = float(source) / float(dest);
-
-    // Mirror is the same case as clamp for linear
-
-    for( size_t u = 0; u < dest; ++u )
-    {
-        float srcB = ( float(u) + 0.5f ) * scale + 0.5f;
-
-        ptrdiff_t isrcB = ptrdiff_t(srcB);
-        ptrdiff_t isrcA = isrcB - 1;
-        
-        if ( isrcA < 0 )
-        {
-            isrcA = ( wrap ) ? ( source - 1) : 0;
-        }
-
-        if ( size_t(isrcB) >= source )
-        {
-            isrcB = ( wrap ) ? 0 : ( source - 1);
-        }
-
-        float weight = 1.0f + float(isrcB) - srcB;
-
-        auto& entry = lf[ u ];
-        entry.u0 = size_t(isrcA);
-        entry.weight0 = weight;
-
-        entry.u1 = size_t(isrcB);
-        entry.weight1 = 1.0f - weight;
-    }
-}
-
-#define BILINEAR_INTERPOLATE( res, x, y, r0, r1 ) \
-    res = ( y.weight0 * ( (r0)[ x.u0 ] * x.weight0 + (r0)[ x.u1 ] * x.weight1 ) ) \
-          + ( y.weight1 * ( (r1)[ x.u0 ] * x.weight0 + (r1)[ x.u1 ] * x.weight1 ) )
-
-#define TRILINEAR_INTERPOLATE( res, x, y, z, r0, r1, r2, r3 ) \
-    res = ( z.weight0 * ( ( y.weight0 * ( (r0)[ x.u0 ] * x.weight0 + (r0)[ x.u1 ] * x.weight1 ) ) \
-                          + ( y.weight1 * ( (r1)[ x.u0 ] * x.weight0 + (r1)[ x.u1 ] * x.weight1 ) ) ) ) \
-          + ( z.weight1 * ( ( y.weight0 * ( (r2)[ x.u0 ] * x.weight0 + (r2)[ x.u1 ] * x.weight1 ) ) \
-                             + ( y.weight1 * ( (r3)[ x.u0 ] * x.weight0 + (r3)[ x.u1 ] * x.weight1 ) ) ) )
-
-
-//-------------------------------------------------------------------------------------
-// Cubic filtering helpers
-//-------------------------------------------------------------------------------------
-
-XMGLOBALCONST XMVECTORF32 g_cubicThird = { 1.f/3.f, 1.f/3.f, 1.f/3.f, 1.f/3.f }; 
-XMGLOBALCONST XMVECTORF32 g_cubicSixth = { 1.f/6.f, 1.f/6.f, 1.f/6.f, 1.f/6.f }; 
-XMGLOBALCONST XMVECTORF32 g_cubicHalf = { 1.f/2.f, 1.f/2.f, 1.f/2.f, 1.f/2.f };
-
-inline ptrdiff_t bounduvw( ptrdiff_t u, ptrdiff_t maxu, bool wrap, bool mirror )
-{
-    if ( wrap )
-    {
-        if ( u < 0 )
-        {
-            u = maxu + u + 1;
-        }
-        else if ( u > maxu )
-        {
-            u = u - maxu - 1;
-        }
-    }
-    else if ( mirror )
-    {
-        if ( u < 0 )
-        {
-            u = ( -u ) - 1;
-        }
-        else if ( u > maxu )
-        {
-            u = maxu - (u - maxu - 1);
-        }
-    }
-
-    // Handles clamp, but also a safety factor for degenerate images for wrap/mirror
-    u = std::min<ptrdiff_t>( u, maxu );
-    u = std::max<ptrdiff_t>( u, 0 );
-
-    return u;
-}
-
-struct CubicFilter
-{
-    size_t  u0;
-    size_t  u1;
-    size_t  u2;
-    size_t  u3;
-    float   x;
-};
-
-inline void _CreateCubicFilter( _In_ size_t source, _In_ size_t dest, _In_ bool wrap, _In_ bool mirror, _Out_writes_(dest) CubicFilter* cf )
-{
-    assert( source > 0 );
-    assert( dest > 0 );
-    assert( cf != 0 );
-
-    float scale = float(source) / float(dest);
-
-    for( size_t u = 0; u < dest; ++u )
-    {
-        float srcB = ( float(u) + 0.5f ) * scale - 0.5f;
-
-        ptrdiff_t isrcB = bounduvw( ptrdiff_t(srcB), source - 1, wrap, mirror );
-        ptrdiff_t isrcA = bounduvw( isrcB - 1, source - 1, wrap, mirror );
-        ptrdiff_t isrcC = bounduvw( isrcB + 1, source - 1, wrap, mirror );
-        ptrdiff_t isrcD = bounduvw( isrcB + 2, source - 1, wrap, mirror );
-
-        auto& entry = cf[ u ];
-        entry.u0 = size_t(isrcA);
-        entry.u1 = size_t(isrcB);
-        entry.u2 = size_t(isrcC);
-        entry.u3 = size_t(isrcD);
-
-        float x = srcB - float(isrcB);
-        entry.x = x;
-    }
-}
-
-#define CUBIC_INTERPOLATE( res, dx, p0, p1, p2, p3 ) \
-{ \
-    XMVECTOR a0 = (p1); \
-    XMVECTOR d0 = (p0) - a0; \
-    XMVECTOR d2 = (p2) - a0; \
-    XMVECTOR d3 = (p3) - a0; \
-    XMVECTOR a1 = d2 - g_cubicThird*d0 - g_cubicSixth*d3; \
-    XMVECTOR a2 = g_cubicHalf*d0 + g_cubicHalf*d2; \
-    XMVECTOR a3 = g_cubicSixth*d3 - g_cubicSixth*d0 - g_cubicHalf*d2;  \
-    XMVECTOR vdx = XMVectorReplicate( dx ); \
-    XMVECTOR vdx2 = vdx * vdx; \
-    XMVECTOR vdx3 = vdx2 * vdx; \
-    res = a0 + a1*vdx + a2*vdx2 + a3*vdx3; \
-}
-
-
-//-------------------------------------------------------------------------------------
-// Triangle filtering helpers
-//-------------------------------------------------------------------------------------
-
-namespace TriangleFilter
-{
-    struct FilterTo
-    {
-        size_t      u;
-        float       weight;
-    };
-
-    struct FilterFrom
-    {
-        size_t      count;
-        size_t      sizeInBytes;
-        FilterTo    to[1]; // variable-sized array
-    };
-
-    struct Filter
-    {
-        size_t      sizeInBytes;
-        size_t      totalSize;
-        FilterFrom  from[1]; // variable-sized array
-    };
-
-    struct TriangleRow
-    {
-        size_t                      remaining;
-        TriangleRow*                next;
-        ScopedAlignedArrayXMVECTOR  scanline;
-
-        TriangleRow() : remaining(0), next(nullptr) {}
-    };
-
-    static const size_t TF_FILTER_SIZE = sizeof(Filter) - sizeof(FilterFrom);
-    static const size_t TF_FROM_SIZE = sizeof(FilterFrom) - sizeof(FilterTo);
-    static const size_t TF_TO_SIZE = sizeof(FilterTo);
-
-    static const float TF_EPSILON = 0.00001f;
-
-    inline HRESULT _Create( _In_ size_t source, _In_ size_t dest, _In_ bool wrap, _Inout_ std::unique_ptr<Filter>& tf )
-    {
-        assert( source > 0 );
-        assert( dest > 0 );
-
-        float scale = float(dest) / float(source);
-        float scaleInv = 0.5f / scale;
-
-        // Determine storage required for filter and allocate memory if needed
-        size_t totalSize = TF_FILTER_SIZE + TF_FROM_SIZE + TF_TO_SIZE;
-        float repeat = (wrap) ? 1.f : 0.f;
-
-        for( size_t u = 0; u < source; ++u )
-        {
-            float src = float(u) - 0.5f;
-            float destMin = src * scale;
-            float destMax = destMin + scale;
-
-            totalSize += TF_FROM_SIZE + TF_TO_SIZE + size_t( destMax - destMin + repeat + 1.f ) * TF_TO_SIZE * 2;
-        }
-
-        uint8_t* pFilter = nullptr;
-
-        if ( tf )
-        {
-            // See if existing filter memory block is large enough to reuse
-            if ( tf->totalSize >= totalSize )
-            {
-                pFilter = reinterpret_cast<uint8_t*>( tf.get() );
-            }
-            else
-            {
-                // Need to reallocate filter memory block
-                tf.reset( nullptr );
-            }
-        }
-
-        if ( !tf )
-        {
-            // Allocate filter memory block
-            pFilter = new (std::nothrow) uint8_t[ totalSize ];
-            if ( !pFilter )
-                return E_OUTOFMEMORY;
-
-            tf.reset( reinterpret_cast<Filter*>( pFilter ) );
-            tf->totalSize = totalSize;
-        }
-
-        assert( pFilter != 0 );
-
-        // Filter setup
-        size_t sizeInBytes = TF_FILTER_SIZE;
-        size_t accumU = 0;
-        float accumWeight = 0.f;
-
-        for( size_t u = 0; u < source; ++u )
-        {
-            // Setup from entry
-            size_t sizeFrom = sizeInBytes;
-            auto pFrom = reinterpret_cast<FilterFrom*>( pFilter + sizeInBytes );
-            sizeInBytes += TF_FROM_SIZE;
-
-            if ( sizeInBytes > totalSize )
-                return E_FAIL;
-
-            size_t toCount = 0;
-
-            // Perform two passes to capture the influences from both sides
-            for( size_t j = 0; j < 2; ++j )
-            {
-                float src = float( u + j ) - 0.5f;
-
-                float destMin = src * scale;
-                float destMax = destMin + scale;
-
-                if ( !wrap )
-                {
-                    // Clamp
-                    if ( destMin < 0.f )
-                        destMin = 0.f;
-                    if ( destMax > float(dest) )
-                        destMax = float(dest);
-                }
-
-                for( auto k = static_cast<ptrdiff_t>( floorf( destMin ) ); float(k) < destMax; ++k )
-                {
-                    float d0 = float(k);
-                    float d1 = d0 + 1.f;
-
-                    size_t u0;
-                    if ( k < 0 )
-                    {
-                        // Handle wrap
-                        u0 = size_t( k + ptrdiff_t(dest) );
-                    }
-                    else if ( k >= ptrdiff_t(dest) )
-                    {
-                        // Handle wrap
-                        u0 = size_t( k - ptrdiff_t(dest) );
-                    }
-                    else
-                    {
-                        u0 = size_t( k );
-                    }
-
-                    // Save previous accumulated weight (if any)
-                    if ( u0 != accumU )
-                    {
-                        if ( accumWeight > TF_EPSILON )
-                        {
-                            auto pTo = reinterpret_cast<FilterTo*>( pFilter + sizeInBytes );
-                            sizeInBytes += TF_TO_SIZE;
-                            ++toCount;
-
-                            if ( sizeInBytes > totalSize )
-                                return E_FAIL;
-
-                            pTo->u = accumU;
-                            pTo->weight = accumWeight;
-                        }
-
-                        accumWeight = 0.f;
-                        accumU = u0;
-                    }
-
-                    // Clip destination
-                    if ( d0 < destMin )
-                        d0 = destMin;
-                    if ( d1 > destMax )
-                        d1 = destMax;
-
-                    // Calculate average weight over destination pixel
-
-                    float weight;
-                    if ( !wrap && src < 0.f )
-                        weight = 1.f;
-                    else if ( !wrap && ( ( src + 1.f ) >= float(source) ) )
-                        weight = 0.f;
-                    else
-                        weight = (d0 + d1) * scaleInv - src;
-
-                    accumWeight += (d1 - d0) * ( j ? (1.f - weight) : weight );
-                }
-            }
-
-            // Store accumulated weight
-            if ( accumWeight > TF_EPSILON )
-            {
-                auto pTo = reinterpret_cast<FilterTo*>( pFilter + sizeInBytes );
-                sizeInBytes += TF_TO_SIZE;
-                ++toCount;
-
-                if ( sizeInBytes > totalSize )
-                    return E_FAIL;
-
-                pTo->u = accumU;
-                pTo->weight = accumWeight;
-            }
-
-            accumWeight = 0.f;
-
-            // Finalize from entry
-            pFrom->count = toCount;
-            pFrom->sizeInBytes = sizeInBytes - sizeFrom;
-        }
-
-        tf->sizeInBytes = sizeInBytes;
-
-        return S_OK;
-    }
-
-}; // namespace
-
-}; // namespace

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 2566
Exporters/FBX/3rdParty/DirectXTex/Shaders/BC6HEncode.hlsl


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1907
Exporters/FBX/3rdParty/DirectXTex/Shaders/BC7Encode.hlsl


+ 0 - 37
Exporters/FBX/3rdParty/DirectXTex/Shaders/CompileShaders.cmd

@@ -1,37 +0,0 @@
-@echo off
-rem THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-rem ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-rem THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-rem PARTICULAR PURPOSE.
-rem
-rem Copyright (c) Microsoft Corporation. All rights reserved.
-
-setlocal
-set error=0
-
-call :CompileShader BC7Encode TryMode456CS
-call :CompileShader BC7Encode TryMode137CS
-call :CompileShader BC7Encode TryMode02CS
-call :CompileShader BC7Encode EncodeBlockCS
-
-call :CompileShader BC6HEncode TryModeG10CS
-call :CompileShader BC6HEncode TryModeLE10CS
-call :CompileShader BC6HEncode EncodeBlockCS
-
-echo.
-
-if %error% == 0 (
-    echo Shaders compiled ok
-) else (
-    echo There were shader compilation errors!
-)
-
-endlocal
-exit /b
-
-:CompileShader
-set fxc=fxc /nologo %1.hlsl /Tcs_4_0 /Zpc /Qstrip_reflect /Qstrip_debug /E%2 /FhCompiled\%1_%2.inc /Vn%1_%2
-echo.
-echo %fxc%
-%fxc% || set error=1
-exit /b

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 22215
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 3375
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC6HEncode_TryModeG10CS.inc


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 5103
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC6HEncode_TryModeLE10CS.inc


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 10152
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_EncodeBlockCS.inc


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 3824
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_TryMode02CS.inc


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 3962
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_TryMode137CS.inc


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 3027
Exporters/FBX/3rdParty/DirectXTex/Shaders/Compiled/BC7Encode_TryMode456CS.inc


+ 0 - 34
Exporters/FBX/3rdParty/DirectXTex/scoped.h

@@ -1,34 +0,0 @@
-//-------------------------------------------------------------------------------------
-// scoped.h
-//  
-// Utility header with helper classes for exception-safe handling of resources
-//
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-// PARTICULAR PURPOSE.
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-------------------------------------------------------------------------------------
-
-#if defined(_MSC_VER) && (_MSC_VER > 1000)
-#pragma once
-#endif
-
-#include <assert.h>
-#include <memory>
-#include <malloc.h>
-
-//---------------------------------------------------------------------------------
-struct aligned_deleter { void operator()(void* p) { _aligned_free(p); } };
-
-typedef std::unique_ptr<float, aligned_deleter> ScopedAlignedArrayFloat;
-
-typedef std::unique_ptr<DirectX::XMVECTOR, aligned_deleter> ScopedAlignedArrayXMVECTOR;
-
-//---------------------------------------------------------------------------------
-struct handle_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
-
-typedef public std::unique_ptr<void, handle_closer> ScopedHandle;
-
-inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; }

+ 2 - 28
Exporters/FBX/BabylonFBXExporter.sln

@@ -1,14 +1,12 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
+# Visual Studio 14
+VisualStudioVersion = 14.0.22823.1
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BabylonFbxNative", "BabylonFbxNative\BabylonFbxNative.vcxproj", "{6C145CFB-31AC-4B28-8B74-26680D26A6E3}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FbxExporter", "FbxExporter\FbxExporter.vcxproj", "{DF8C65DD-1E5C-44BE-8FD2-457C72AA46FC}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "3rdParty\DirectXTex\DirectXTex_Desktop_2013.vcxproj", "{371B9FA9-4C90-4AC6-A123-ACED756D6C77}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FbxRerouteSkeleton", "FbxRerouteSkeleton\FbxRerouteSkeleton.vcxproj", "{C4B4FC3F-B13B-4919-A412-15CF0C2A1E5C}"
 EndProject
 Global
@@ -75,30 +73,6 @@ Global
 		{DF8C65DD-1E5C-44BE-8FD2-457C72AA46FC}.Release|x64.Build.0 = Release|x64
 		{DF8C65DD-1E5C-44BE-8FD2-457C72AA46FC}.Release|x86.ActiveCfg = Release|Win32
 		{DF8C65DD-1E5C-44BE-8FD2-457C72AA46FC}.Release|x86.Build.0 = Release|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Mixed Platforms.Build.0 = Debug|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.ActiveCfg = Debug|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.Build.0 = Debug|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.ActiveCfg = Debug|x64
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.Build.0 = Debug|x64
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x86.ActiveCfg = Debug|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x86.Build.0 = Debug|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Mixed Platforms.ActiveCfg = Profile|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Mixed Platforms.Build.0 = Profile|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.ActiveCfg = Profile|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.Build.0 = Profile|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.ActiveCfg = Profile|x64
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.Build.0 = Profile|x64
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x86.ActiveCfg = Profile|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x86.Build.0 = Profile|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Mixed Platforms.ActiveCfg = Release|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Mixed Platforms.Build.0 = Release|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.ActiveCfg = Release|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.Build.0 = Release|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.ActiveCfg = Release|x64
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.Build.0 = Release|x64
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x86.ActiveCfg = Release|Win32
-		{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x86.Build.0 = Release|Win32
 		{C4B4FC3F-B13B-4919-A412-15CF0C2A1E5C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
 		{C4B4FC3F-B13B-4919-A412-15CF0C2A1E5C}.Debug|Mixed Platforms.Build.0 = Debug|Win32
 		{C4B4FC3F-B13B-4919-A412-15CF0C2A1E5C}.Debug|Win32.ActiveCfg = Debug|Win32

+ 2 - 0
Exporters/FBX/BabylonFbxNative/BabylonAbstractMesh.h

@@ -4,6 +4,7 @@
 #include "BabylonVertex.h"
 #include "BabylonNode.h"
 
+// base class for meshes and mesh instances (instances not implemented yet)
 class BabylonAbstractMesh
 {
 private:
@@ -39,6 +40,7 @@ public:
 	BabylonAbstractMesh();
 
 	BabylonAbstractMesh(BabylonNode* node);
+	BabylonAbstractMesh(const BabylonAbstractMesh& ) = default;
 
 	virtual web::json::value toJson() ;
 	virtual ~BabylonAbstractMesh();

+ 15 - 31
Exporters/FBX/BabylonFbxNative/BabylonAnimation.h

@@ -3,22 +3,12 @@
 #include <vector>
 #include "BabylonVertex.h"
 #include <cpprest\json.h>
+
+// base class representing babylon animations
 class BabylonAnimationBase
 {
 public:
-	/*
-	"dataType": int (0 = float, 1 = vector3, 2 = quaternion, 3 = matrix),
-    "framePerSecond": int,
-    "loopBehavior": int (0 = relative, 1 = cycle, 2 = constant),
-    "name": string,
-    "property": string,
-    "keys": array of AnimationKeys (see below),
-    "autoAnimate": boolean,
-    "autoAnimateFrom": int,
-    "autoAnimateTo": int,
-    "autoAnimateLoop": boolean
-
-	*/
+
 	static const int dataType_Float = 0;
 	static const int dataType_Vector3 = 1;
 	static const int dataType_Quaternion = 2;
@@ -44,21 +34,22 @@ public:
 	virtual web::json::value toJson() const = 0;
 };
 
+// key frame data
 template<typename T>
 struct babylon_animation_key{
-	/*
-	"frame": int,
-    "values": array of float (depending of animated value)
-	*/
 	int frame;
 	T values;
 };
 
+// traits for animated babylon data types (must contain : 
+// static const int dataType
+// static web::json::value jsonify(const T& value)
 template<typename T>
 struct bab_anim_traits{
 
 };
 
+// specialization for vectors 3D
 template<>
 struct bab_anim_traits < babylon_vector3 >
 {
@@ -73,6 +64,7 @@ struct bab_anim_traits < babylon_vector3 >
 	}
 };
 
+// specialization for quaternions
 template<>
 struct bab_anim_traits < babylon_vector4 >
 {
@@ -88,6 +80,7 @@ struct bab_anim_traits < babylon_vector4 >
 	}
 };
 
+// specialization for matrices
 template<>
 struct bab_anim_traits < FbxMatrix >
 {
@@ -103,6 +96,8 @@ struct bab_anim_traits < FbxMatrix >
 		return jmat;
 	}
 };
+
+// specialization for scalar floats
 template<>
 struct bab_anim_traits < float >
 {
@@ -115,6 +110,7 @@ struct bab_anim_traits < float >
 	}
 };
 
+// used for interpolation simplification
 template<typename T>
 bool isNear(const T& lhs, const T& rhs);
 
@@ -153,7 +149,8 @@ bool isLinearInterpolation(const babylon_animation_key<T>& key0, const babylon_a
 	auto testVal = lerp(key0.values, key2.values, static_cast<float>(key1.frame - key0.frame) / static_cast<float>(key2.frame - key0.frame));
 	return isNear(testVal, key1.values);
 }
-
+// typed babylon animation.
+// requires bab_anim_traits<T>, isNear<T> and basic arithmetic operators
 template<typename T>
 class BabylonAnimation : public BabylonAnimationBase
 {
@@ -205,19 +202,6 @@ public:
 	virtual web::json::value toJson() const override {
 		auto jobj = web::json::value::object();
 
-		/*
-		"dataType": int (0 = float, 1 = vector3, 2 = quaternion, 3 = matrix),
-		"framePerSecond": int,
-		"loopBehavior": int (0 = relative, 1 = cycle, 2 = constant),
-		"name": string,
-		"property": string,
-		"keys": array of AnimationKeys (see below),
-		"autoAnimate": boolean,
-		"autoAnimateFrom": int,
-		"autoAnimateTo": int,
-		"autoAnimateLoop": boolean
-
-		*/
 
 		jobj[L"dataType"] = web::json::value::number(dataType);
 		jobj[L"framePerSecond"] = web::json::value::number(framePerSecond);

+ 26 - 0
Exporters/FBX/BabylonFbxNative/BabylonCamera.cpp

@@ -169,6 +169,32 @@ BabylonCamera::BabylonCamera(BabylonNode& babnode)
 }
 
 
+BabylonCamera::BabylonCamera(BabylonCamera && moved) : 
+	name(std::move(moved.name)),
+	id(std::move(moved.id)),
+	parentId(std::move(moved.parentId)),
+	lockedTargetId(std::move(moved.lockedTargetId)),
+	type(std::move(moved.type)),
+	position(std::move(moved.position)),
+	rotationQuaternion(std::move(moved.rotationQuaternion)),
+	target(std::move(moved.target)),
+	fov(std::move(moved.fov)),
+	minZ(std::move(moved.minZ)),
+	maxZ(std::move(moved.maxZ)),
+	speed(std::move(moved.speed)),
+	inertia(std::move(moved.inertia)),
+	checkCollisions(std::move(moved.checkCollisions)),
+	applyGravity(std::move(moved.applyGravity)),
+	ellipsoid(std::move(moved.ellipsoid)),
+	autoAnimate(std::move(moved.autoAnimate)),
+	autoAnimateFrom(std::move(moved.autoAnimateFrom)),
+	autoAnimateTo(std::move(moved.autoAnimateTo)),
+	autoAnimateLoop(std::move(moved.autoAnimateLoop)),
+	animations(std::move(moved.animations)),
+	quatAnimations(std::move(moved.quatAnimations))
+{
+}
+
 BabylonCamera::~BabylonCamera()
 {
 }

+ 2 - 0
Exporters/FBX/BabylonFbxNative/BabylonCamera.h

@@ -77,6 +77,8 @@ public:
 
 	BabylonCamera();
 	BabylonCamera(BabylonNode& babnode);
+	BabylonCamera(const BabylonCamera& ) = default;
+	BabylonCamera(BabylonCamera&& moved);
 	~BabylonCamera();
 };
 

+ 0 - 11
Exporters/FBX/BabylonFbxNative/BabylonFbxNative.vcxproj

@@ -181,13 +181,9 @@
     <ClInclude Include="BabylonScene.h" />
     <ClInclude Include="BabylonSkeleton.h" />
     <ClInclude Include="BabylonVertex.h" />
-    <ClInclude Include="Export.h" />
     <ClInclude Include="FbxDeleter.h" />
     <ClInclude Include="FbxLoadException.h" />
-    <ClInclude Include="FbxMaterialHandler.h" />
-    <ClInclude Include="FbxMeshLoader.h" />
     <ClInclude Include="FbxSceneLoader.h" />
-    <ClInclude Include="FbxVertexKey.h" />
     <ClInclude Include="GlobalSettings.h" />
     <ClInclude Include="MatrixDecomposition.h" />
     <ClInclude Include="NodeHelpers.h" />
@@ -207,9 +203,7 @@
     <ClCompile Include="BabylonSkeleton.cpp" />
     <ClCompile Include="babylon_boundingbox.cpp" />
     <ClCompile Include="FbxLoadException.cpp" />
-    <ClCompile Include="FbxMaterialHandler.cpp" />
     <ClCompile Include="FbxSceneLoader.cpp" />
-    <ClCompile Include="FbxVertexKey.cpp" />
     <ClCompile Include="GlobalSettings.cpp" />
     <ClCompile Include="SkinInfo.cpp" />
     <ClCompile Include="stdafx.cpp">
@@ -220,11 +214,6 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\3rdParty\DirectXTex\DirectXTex_Desktop_2013.vcxproj">
-      <Project>{371b9fa9-4c90-4ac6-a123-aced756d6c77}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 0 - 18
Exporters/FBX/BabylonFbxNative/BabylonFbxNative.vcxproj.filters

@@ -33,21 +33,9 @@
     <ClInclude Include="FbxSceneLoader.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="FbxVertexKey.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="BabylonVertex.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="FbxMaterialHandler.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="FbxMeshLoader.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Export.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="BabylonNode.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -98,12 +86,6 @@
     <ClCompile Include="FbxSceneLoader.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="FbxVertexKey.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="FbxMaterialHandler.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="babylon_boundingbox.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>

+ 35 - 0
Exporters/FBX/BabylonFbxNative/BabylonLight.cpp

@@ -174,6 +174,28 @@ BabylonLight::BabylonLight(BabylonNode & babnode) :
 }
 
 
+BabylonLight::BabylonLight(BabylonLight && moved)  : 
+name(std::move(moved.name)),
+id(std::move(moved.id)),
+parentId(std::move(moved.parentId)),
+position(std::move(moved.position)),
+direction(std::move(moved.direction)),
+type(std::move(moved.type)),
+diffuse(std::move(moved.diffuse)),
+specular(std::move(moved.specular)),
+intensity(std::move(moved.intensity)),
+range(std::move(moved.range)),
+exponent(std::move(moved.exponent)),
+angle(std::move(moved.angle)),
+groundColor(std::move(moved.groundColor)),
+castShadows(std::move(moved.castShadows)),
+includedOnlyMeshesIds(std::move(moved.includedOnlyMeshesIds)),
+excludedMeshesIds(std::move(moved.excludedMeshesIds)),
+shadowGenerator(std::move(moved.shadowGenerator)),
+animations(std::move(moved.animations))
+{
+}
+
 BabylonLight::~BabylonLight()
 {
 }
@@ -200,6 +222,19 @@ BabylonShadowGenerator::BabylonShadowGenerator(FbxNode * lightNode)
 
 }
 
+BabylonShadowGenerator::BabylonShadowGenerator(BabylonShadowGenerator && moved) : 
+	mapSize(std::move(moved.mapSize)),
+	bias(std::move(moved.bias)),
+	lightId(std::move(moved.lightId)),
+	useVarianceShadowMap(std::move(moved.useVarianceShadowMap)),
+	usePoissonSampling(std::move(moved.usePoissonSampling)),
+	useBlurVarianceShadowMap(std::move(moved.useBlurVarianceShadowMap)),
+	blurScale(std::move(moved.blurScale)),
+	blurBoxOffset(std::move(moved.blurBoxOffset)),
+	renderList(std::move(moved.renderList))
+{
+}
+
 web::json::value BabylonShadowGenerator::toJson()
 {
 	auto jobj =web::json::value::object();

+ 5 - 1
Exporters/FBX/BabylonFbxNative/BabylonLight.h

@@ -38,6 +38,8 @@ public:
 	std::vector<std::wstring> renderList;
 
 	BabylonShadowGenerator(FbxNode* lightNode);
+	BabylonShadowGenerator(const BabylonShadowGenerator&) = default;
+	BabylonShadowGenerator(BabylonShadowGenerator&& moved);
 	web::json::value toJson();
 
 };
@@ -97,12 +99,14 @@ public:
 
 		
 	std::shared_ptr<BabylonShadowGenerator> shadowGenerator;
+	std::vector<std::shared_ptr < BabylonAnimation<babylon_vector3>>> animations;
 
 	web::json::value toJson() const;
 
 	BabylonLight();
 	BabylonLight(BabylonNode& babnode);
-	std::vector<std::shared_ptr < BabylonAnimation<babylon_vector3>>> animations;
+	BabylonLight(const BabylonLight&) = default;
+	BabylonLight(BabylonLight&& moved);
 	~BabylonLight();
 };
 

+ 52 - 0
Exporters/FBX/BabylonFbxNative/BabylonMaterial.cpp

@@ -213,10 +213,38 @@ alpha(1){
 }
 
 
+BabylonMaterial::BabylonMaterial(BabylonMaterial && moved) : 
+	name(std::move(moved.name)),
+	id(std::move(moved.id)),
+	backFaceCulling(std::move(moved.backFaceCulling)),
+	wireframe(std::move(moved.wireframe)),
+	ambient(std::move(moved.ambient)),
+	diffuse(std::move(moved.diffuse)),
+	specular(std::move(moved.specular)),
+	emissive(std::move(moved.emissive)),
+	specularPower(std::move(moved.specularPower)),
+	alpha(std::move(moved.alpha)),
+	diffuseTexture(std::move(moved.diffuseTexture)),
+	ambientTexture(std::move(moved.ambientTexture)),
+	opacityTexture(std::move(moved.opacityTexture)),
+	reflectionTexture(std::move(moved.reflectionTexture)),
+	emissiveTexture(std::move(moved.emissiveTexture)),
+	specularTexture(std::move(moved.specularTexture)),
+	bumpTexture(std::move(moved.bumpTexture))
+{
+}
+
 BabylonMaterial::~BabylonMaterial()
 {
 }
 
+BabylonMultiMaterial::BabylonMultiMaterial(BabylonMultiMaterial && moved) :
+	name(std::move(moved.name)),
+	id(std::move(moved.id)),
+	materials(std::move(moved.materials))
+{
+}
+
 web::json::value BabylonMultiMaterial::toJson() const
 {
 	auto jobj = web::json::value::object();
@@ -232,6 +260,30 @@ web::json::value BabylonMultiMaterial::toJson() const
 }
 
 
+BabylonTexture::BabylonTexture(BabylonTexture && moved) : 
+	name(std::move(moved.name)),
+	fullPath(std::move(moved.fullPath)),
+	uvset(std::move(moved.uvset)),
+	level(std::move(moved.level)),
+	hasAlpha(std::move(moved.hasAlpha)),
+	getAlphaFromRGB(std::move(moved.getAlphaFromRGB)),
+	coordinatesMode(std::move(moved.coordinatesMode)),
+	isCube(std::move(moved.isCube)),
+	uOffset(std::move(moved.uOffset)),
+	vOffset(std::move(moved.vOffset)),
+	uScale(std::move(moved.uScale)),
+	vScale(std::move(moved.vScale)),
+	uAng(std::move(moved.uAng)),
+	vAng(std::move(moved.vAng)),
+	wAng(std::move(moved.wAng)),
+	wrapU(std::move(moved.wrapU)),
+	wrapV(std::move(moved.wrapV)),
+	coordinatesIndex(std::move(moved.coordinatesIndex)),
+	isRenderTarget(std::move(moved.isRenderTarget)),
+	animations(std::move(moved.animations))
+{
+}
+
 web::json::value BabylonTexture::toJson(){
 	auto jobj = web::json::value::object();
 	jobj[L"name"] = web::json::value::string(name);

+ 7 - 1
Exporters/FBX/BabylonFbxNative/BabylonMaterial.h

@@ -65,6 +65,8 @@ public:
 
 	 BabylonTexture(FbxFileTexture* texture);
 
+	 BabylonTexture(const BabylonTexture&) = default;
+	 BabylonTexture(BabylonTexture&&);
 
 	 web::json::value toJson();
 	
@@ -107,6 +109,8 @@ public:
 	web::json::value toJson() const;
 	BabylonMaterial();
 	BabylonMaterial(FbxSurfaceMaterial* mat);
+	BabylonMaterial(const BabylonMaterial&) = default;
+	BabylonMaterial(BabylonMaterial&& moved);
 	~BabylonMaterial();
 };
 
@@ -115,6 +119,8 @@ public:
 	std::wstring name;
 	std::wstring id;
 	std::vector<std::wstring> materials;
-
+	BabylonMultiMaterial() = default;
+	BabylonMultiMaterial(const BabylonMultiMaterial&) = default;
+	BabylonMultiMaterial(BabylonMultiMaterial&& moved) ;
 	web::json::value toJson() const;
 };

+ 45 - 1
Exporters/FBX/BabylonFbxNative/BabylonMesh.cpp

@@ -757,7 +757,7 @@ BabylonMesh::BabylonMesh(BabylonNode* node) :
 			submesh.indices.push_back(t.indices[2]);
 		}
 		else {
-			std::cout << "duplicate triangle found" << std::endl;
+			std::cout << "duplicate triangle found (and eliminated) in " << fbxNode->GetName() << std::endl;
 		}
 
 	}
@@ -823,6 +823,50 @@ BabylonMesh::BabylonMesh(BabylonNode* node) :
 }
 
 
+BabylonMesh::BabylonMesh(BabylonMesh && moved) : 
+	BabylonAbstractMesh(moved),
+	_id(std::move(moved._id)),
+	_parentId(std::move(moved._parentId)),
+	_materialId(std::move(moved._materialId)),
+	_isEnabled(std::move(moved._isEnabled)),
+	_isVisible(std::move(moved._isVisible)),
+	_pickable(std::move(moved._pickable)),
+	_positions(std::move(moved._positions)),
+	_normals(std::move(moved._normals)),
+	_uvs(std::move(moved._uvs)),
+	_uvs2(std::move(moved._uvs2)),
+	_uvs3(std::move(moved._uvs3)),
+	_uvs4(std::move(moved._uvs4)),
+	_uvs5(std::move(moved._uvs5)),
+	_uvs6(std::move(moved._uvs6)),
+	_colors(std::move(moved._colors)),
+	_hasVertexAlpha(std::move(moved._hasVertexAlpha)),
+	_boneIndices(std::move(moved._boneIndices)),
+	_boneWeights(std::move(moved._boneWeights)),
+	_indices(std::move(moved._indices)),
+	_checkCollision(std::move(moved._checkCollision)),
+	_receiveShadows(std::move(moved._receiveShadows)),
+	_infiniteDistance(std::move(moved._infiniteDistance)),
+	_billboardMode(std::move(moved._billboardMode)),
+	_visibility(std::move(moved._visibility)),
+	_submeshes(std::move(moved._submeshes)),
+	_instances(std::move(moved._instances)),
+	_skeletonId(std::move(moved._skeletonId)),
+	_autoAnimate(std::move(moved._autoAnimate)),
+	_autoAnimateFrom(std::move(moved._autoAnimateFrom)),
+	_autoAnimateTo(std::move(moved._autoAnimateTo)),
+	_autoAnimateLoop(std::move(moved._autoAnimateLoop)),
+	_showBoundingBox(std::move(moved._showBoundingBox)),
+	_showSubMeshesBoundingBox(std::move(moved._showSubMeshesBoundingBox)),
+	_applyFog(std::move(moved._applyFog)),
+	_alphaIndex(std::move(moved._alphaIndex)),
+	uvsets(std::move(moved.uvsets)),
+	associatedSkeleton(std::move(moved.associatedSkeleton)),
+	animations(std::move(moved.animations)),
+	pivotMatrix(std::move(moved.pivotMatrix))
+{
+}
+
 BabylonMesh::~BabylonMesh()
 {
 }

+ 7 - 4
Exporters/FBX/BabylonFbxNative/BabylonMesh.h

@@ -56,6 +56,10 @@ private:
 	bool _applyFog;
 	int _alphaIndex;
 public:
+	std::shared_ptr<BabylonSkeleton> associatedSkeleton;
+
+	std::vector<std::shared_ptr < BabylonAnimationBase>> animations;
+	FbxMatrix pivotMatrix;
 	std::vector<std::string> uvsets;
 	const std::wstring& id(){ return _id; }
 	const std::wstring& parentId(){ return _parentId; }
@@ -112,14 +116,13 @@ public:
 	void alphaIndex(int value){ _alphaIndex = value; }
 
 
-	std::shared_ptr<BabylonSkeleton> associatedSkeleton;
-
-	std::vector<std::shared_ptr < BabylonAnimationBase>> animations;
-	FbxMatrix pivotMatrix;
+	
 
 	virtual web::json::value toJson() override;
 	BabylonMesh();
 	BabylonMesh(BabylonNode* node);
+	BabylonMesh(const BabylonMesh&) = default;
+	BabylonMesh(BabylonMesh&& moved);
 	virtual ~BabylonMesh();
 };
 

+ 6 - 0
Exporters/FBX/BabylonFbxNative/BabylonNode.cpp

@@ -9,6 +9,12 @@ BabylonNode::BabylonNode(FbxNode* fbxNode) : _node(fbxNode){
 	}
 }
 
+BabylonNode::BabylonNode(BabylonNode && moved) :
+	 _node(moved._node),
+	_children(std::move(moved._children))
+{
+}
+
 BabylonNodeType BabylonNode::nodeType(){
 	if (_node->GetMesh()){
 		return BabylonNodeType::Mesh;

+ 2 - 0
Exporters/FBX/BabylonFbxNative/BabylonNode.h

@@ -24,6 +24,8 @@ public:
 
 
 	explicit BabylonNode(FbxNode* fbxNode);
+	BabylonNode(const BabylonNode&) = default;
+	BabylonNode(BabylonNode&& moved);
 
 	std::vector<BabylonNode>& children(){
 		return _children;

+ 160 - 0
Exporters/FBX/BabylonFbxNative/BabylonScene.cpp

@@ -70,7 +70,167 @@ _gravity(0,0,-.9f)
 {
 }
 
+BabylonScene::BabylonScene(BabylonNode & rootNode, bool skipEmptyNodes) :
+	_autoClear(true),
+	_clearColor(.2f, .2f, .3f),
+	_ambientColor(0, 0, 0),
+	_gravity(0, 0, -.9f)
+{
+	exploreNodes(rootNode, skipEmptyNodes);
+	if (_cameras.size() == 0) {
+		babylon_boundingbox bbox(rootNode.fbxNode()->GetScene());
+		auto cam = buildCameraFromBoundingBox(bbox);
+		_activeCameraID = cam.id;
+		_cameras.push_back(std::move(cam));
+	}
+	if (_lights.size() == 0) {
+		BabylonLight light;
+		light.diffuse = babylon_vector3(1, 1, 1);
+		light.specular = babylon_vector3(1, 1, 1);
+		light.position = babylon_vector3(0, 0, 0);
+		light.parentId = _activeCameraID;
+		light.type = 0;
+		light.id = L"default_light";
+		light.name = L"default_light";
+		light.intensity = 1;
+		_lights.push_back(std::move(light));
+	}
+}
+
+
+BabylonScene::BabylonScene(BabylonScene && moved) : 
+	_autoClear(std::move(moved._autoClear)),
+	_clearColor(std::move(moved._clearColor)),
+	_ambientColor(std::move(moved._ambientColor)),
+	_fogMode(std::move(moved._fogMode)),
+	_fogColor(std::move(moved._fogColor)),
+	_fogStart(std::move(moved._fogStart)),
+	_fogEnd(std::move(moved._fogEnd)),
+	_fogDensity(std::move(moved._fogDensity)),
+	_gravity(std::move(moved._gravity)),
+	_cameras(std::move(moved._cameras)),
+	_activeCameraID(std::move(moved._activeCameraID)),
+	_meshes(std::move(moved._meshes)),
+	_materials(std::move(moved._materials)),
+	_multiMaterials(std::move(moved._multiMaterials)),
+	_lights(std::move(moved._lights)),
+	_shadowGenerators(std::move(moved._shadowGenerators)),
+	_skeletons(std::move(moved._skeletons))
+{
+}
 
 BabylonScene::~BabylonScene()
 {
 }
+
+
+void fixupTextureCoordinateIndices(BabylonMaterial& mat, BabylonMesh& mesh) {
+	std::vector<std::shared_ptr<BabylonTexture>> textures;
+	if (mat.ambientTexture) {
+		textures.push_back(mat.ambientTexture);
+	}
+	if (mat.diffuseTexture) {
+		textures.push_back(mat.diffuseTexture);
+	}
+	if (mat.specularTexture) {
+		textures.push_back(mat.specularTexture);
+	}
+	if (mat.emissiveTexture) {
+		textures.push_back(mat.emissiveTexture);
+	}
+	if (mat.reflectionTexture) {
+		textures.push_back(mat.reflectionTexture);
+	}
+	if (mat.bumpTexture) {
+		textures.push_back(mat.bumpTexture);
+	}
+	for (auto& tex : textures) {
+		auto found = std::find(mesh.uvsets.begin(), mesh.uvsets.end(), tex->uvset);
+		if (found != mesh.uvsets.end()) {
+			tex->coordinatesIndex = static_cast<int>(found - mesh.uvsets.begin());
+		}
+	}
+}
+
+void BabylonScene::exploreNodes(BabylonNode & node, bool skipEmptyNodes)
+{
+	if (node.nodeType() == BabylonNodeType::Skeleton && node.hasOnlySkeletonDescendants()) {
+		return;
+	}
+	if (skipEmptyNodes && node.isEmptySkeletonOrEmptyMeshRecursive()) {
+		return;
+	}
+	// append mesh
+	switch (node.nodeType())
+	{
+	case BabylonNodeType::Empty:
+	case BabylonNodeType::Mesh:
+	case BabylonNodeType::Skeleton:
+	{
+
+		BabylonMesh mesh(&node);
+
+		auto matCount = node.fbxNode()->GetMaterialCount();
+		BabylonMultiMaterial multiMat;
+		for (auto i = 0; i < matCount; ++i) {
+			auto mat = node.fbxNode()->GetMaterial(i);
+			if (mat) {
+
+				auto id = getMaterialId(mat);
+				auto existing = std::find_if(_materials.begin(), _materials.end(), [id](const BabylonMaterial& e) {
+					return e.id == id;
+				});
+				if (existing == _materials.end()) {
+					auto babMat = BabylonMaterial(mat);
+					fixupTextureCoordinateIndices(babMat, mesh);
+					_materials.push_back(std::move(babMat));
+				}
+
+				multiMat.materials.push_back(id);
+
+			}
+		}
+
+		if (mesh.associatedSkeleton) {
+			mesh.associatedSkeleton->id = static_cast<int>(_skeletons.size() + 1);
+			mesh.skeletonId(static_cast<int>(_skeletons.size() + 1));
+			_skeletons.push_back(mesh.associatedSkeleton);
+		}
+		if (multiMat.materials.size() > 0) {
+
+			multiMat.id = mesh.id();
+			multiMat.name = mesh.name();
+			mesh.materialId(multiMat.id);
+			_multiMaterials.push_back(std::move(multiMat));
+		}
+
+		_meshes.push_back(std::move(mesh));
+	}
+	break;
+	case BabylonNodeType::Camera:
+	{
+		_cameras.emplace_back(node);
+		if (_cameras.size() == 1) {
+			activeCameraID(_cameras[0].id);
+		}
+	}
+	break;
+	case BabylonNodeType::Light:
+	{
+		_lights.emplace_back(node);
+		auto& l = _lights[_lights.size() - 1];
+		if (l.shadowGenerator) {
+			_shadowGenerators.push_back(l.shadowGenerator);
+		}
+	}
+	break;
+	default:
+		break;
+	}
+
+
+	for (auto& child : node.children()) {
+		exploreNodes(child, skipEmptyNodes);
+	}
+
+}

+ 6 - 0
Exporters/FBX/BabylonFbxNative/BabylonScene.h

@@ -7,6 +7,7 @@
 #include "BabylonLight.h"
 #include "BabylonSkeleton.h"
 #include <memory>
+#include "BabylonNode.h"
 
 class BabylonScene
 {
@@ -83,6 +84,11 @@ public:
 	web::json::value toJson() ;
 
 	BabylonScene();
+	BabylonScene(BabylonNode& rootNode, bool skipEmptyNodes);
+	BabylonScene(const BabylonScene&) = default;
+	BabylonScene(BabylonScene&& moved);
 	~BabylonScene();
+private:
+	void exploreNodes(BabylonNode& node, bool skipEmptyNodes);
 };
 

+ 17 - 1
Exporters/FBX/BabylonFbxNative/BabylonSkeleton.h

@@ -14,7 +14,15 @@ public:
 	FbxMatrix matrix;
 	std::shared_ptr<BabylonAnimation<FbxMatrix>> animation;
 	web::json::value toJson();
-
+	BabylonBone() = default;
+	BabylonBone(const BabylonBone&) = default;
+	BabylonBone(BabylonBone&& moved) :
+		name(std::move(moved.name)),
+		index(std::move(moved.index)),
+		parentBoneIndex(std::move(moved.parentBoneIndex)),
+		matrix(std::move(moved.matrix)),
+		animation(std::move(moved.animation))
+	{}
 	//public BabylonAnimation animation{ get; set; }
 };
 class BabylonSkeleton
@@ -28,5 +36,13 @@ public:
 
 	web::json::value toJson();
 	BabylonSkeleton();
+	BabylonSkeleton(const BabylonSkeleton&) = default;
+	BabylonSkeleton(BabylonSkeleton&& moved) :
+		id(std::move(moved.id)),
+		name(std::move(moved.name)),
+		bones(std::move(moved.bones))
+	{
+
+	}
 };
 

+ 0 - 190
Exporters/FBX/BabylonFbxNative/Export.h

@@ -1,190 +0,0 @@
-//#pragma once
-//#include "BabylonVertex.h"
-//#include <cpprest\json.h>
-//#include <exception>
-//
-//
-//web::json::value exportTexture(const babylon_texture& texture){
-//
-//	web::json::value obj = web::json::value::object();
-//	obj[L"name"] = web::json::value(std::wstring(texture.name.begin(), texture.name.end()));
-//	obj[L"level"] = web::json::value(1);
-//	obj[L"hasAlpha"] = web::json::value(texture.hasAlpha);
-//	obj[L"coordinatesMode"] = web::json::value(0);
-//	obj[L"isCube"] = web::json::value::boolean(false);
-//	obj[L"uOffset"] = web::json::value(0);
-//	obj[L"vOffset"] = web::json::value(0);
-//	obj[L"uScale"] = web::json::value(1);
-//	obj[L"vScale"] = web::json::value(1);
-//	obj[L"uAng"] = web::json::value(0);
-//	obj[L"vAng"] = web::json::value(0);
-//	obj[L"wAng"] = web::json::value(0);
-//	obj[L"wrapU"] = web::json::value(1);
-//	obj[L"wrapV"] = web::json::value(1);
-//	obj[L"coordinatesIndex"] = web::json::value(0);
-//	obj[L"isRenderTarget"] = web::json::value::boolean(false);
-//	obj[L"renderTargetSize"] = web::json::value(0);
-//	return obj;
-//}
-//web::json::value exportCamera(const babylon_camera& camera){
-//
-//	web::json::value obj = web::json::value::object();
-//	obj[L"name"] = web::json::value(std::wstring(camera.name.begin(), camera.name.end()));
-//	obj[L"id"] = web::json::value(std::wstring(camera.id.begin(), camera.id.end()));
-//	writeVector3(obj, L"position", camera.position);
-//	writeVector3(obj, L"target", camera.target);
-//	writeVector3(obj, L"rotation", camera.rotation);
-//	obj[L"fov"] = web::json::value(camera.fov);
-//	obj[L"minZ"] = web::json::value(camera.minZ);
-//	obj[L"maxZ"] = web::json::value(camera.maxZ);
-//	obj[L"speed"] = web::json::value(camera.speed);
-//	obj[L"inertia"] = web::json::value(camera.inertia);
-//	obj[L"checkCollisions"] = web::json::value(camera.checkCollisions);
-//	obj[L"applyGravity"] = web::json::value(camera.applyGravity);
-//	writeVector3(obj, L"ellipsoid", camera.ellipsoid);
-//	return obj;
-//}
-//web::json::value exportMaterial(const babylon_material& material){
-//	web::json::value obj = web::json::value::object();
-//	obj[L"name"] = web::json::value(std::wstring(material.name.begin(), material.name.end()));
-//	obj[L"id"] = web::json::value(std::wstring(material.id.begin(), material.id.end()));
-//	obj[L"backFaceCulling"] = web::json::value::boolean(material.backFaceCulling);
-//	writeVector3(obj, L"ambient", material.ambient);
-//	writeVector3(obj, L"diffuse", material.diffuse);
-//	writeVector3(obj, L"specular", material.specular);
-//	writeVector3(obj, L"emissive", material.emissive);
-//	obj[L"specularPower"] = web::json::value(material.specularPower);
-//	obj[L"alpha"] = web::json::value(material.alpha);
-//	if (material.diffuseTexture){
-//		obj[L"diffuseTexture"] = exportTexture(*material.diffuseTexture);
-//	}
-//	if (material.ambientTexture){
-//		obj[L"ambientTexture"] = exportTexture(*material.ambientTexture);
-//	}
-//	if (material.opacityTexture){
-//		obj[L"opacityTexture"] = exportTexture(*material.opacityTexture);
-//	}
-//	if (material.reflectionTexture){
-//		obj[L"reflectionTexture"] = exportTexture(*material.reflectionTexture);
-//	}
-//	if (material.emissiveTexture){
-//		obj[L"emissiveTexture"] = exportTexture(*material.emissiveTexture);
-//	}
-//	if (material.specularTexture){
-//		obj[L"specularTexture"] = exportTexture(*material.specularTexture);
-//	}
-//	if (material.bumpTexture){
-//		obj[L"bumpTexture"] = exportTexture(*material.bumpTexture);
-//	}
-//	return obj;
-//}
-//web::json::value exportScene(const babylon_global_settings& globalSettings, const std::vector<babylon_material>& materials, const std::vector<babylon_mesh<babylon_vertex_normal_uv_color>>& meshes, bool reorderIndices = true){
-//	
-//	std::vector<babylon_boundingbox> boxes;
-//	for (auto& m : meshes){
-//		boxes.push_back(m.getBoundingBox());
-//	}
-//
-//	babylon_boundingbox bbox = mergeBoundingBoxes(boxes);
-//	babylon_camera camera = buildCameraFromBoundingBox(bbox);
-//	
-//	auto result = web::json::value::object();
-//	result[L"autoClear"] = web::json::value::boolean(globalSettings.autoClear);
-//	writeVector3(result, L"clearColor", globalSettings.clearColor);
-//	writeVector3(result, L"ambientColor", globalSettings.ambientColor);
-//	result[L"fogMode"] = globalSettings.fogMode;
-//	writeVector3(result, L"fogColor", globalSettings.fogColor);
-//	result[L"fogStart"] = globalSettings.fogStart;
-//	result[L"fogEnd"] = globalSettings.fogEnd;
-//	result[L"fogDensity"] = globalSettings.fogDensity;
-//	writeVector3(result, L"gravity", globalSettings.gravity);
-//	result[L"multiMaterials"] = web::json::value::array();
-//	result[L"materials"] = web::json::value::array();
-//	result[L"lights"] = web::json::value::array();
-//	web::json::value defaultLight = web::json::value::object();
-//	writeVector3(defaultLight, L"diffuse", babylon_vector3(1, 1, 1));
-//	writeVector3(defaultLight, L"specular", babylon_vector3(1, 1, 1));
-//	writeVector3(defaultLight, L"position", babylon_vector3(bbox.getMinX()*2, bbox.getMaxY()*2, bbox.getMinZ()*2));
-//	defaultLight[L"type"] = web::json::value(0);
-//	defaultLight[L"direction"] = web::json::value::null();
-//	defaultLight[L"id"] = web::json::value(L"default light");
-//	defaultLight[L"name"] = web::json::value(L"default light");
-//	defaultLight[L"intensity"] = web::json::value(1);
-//	result[L"lights"][0] = defaultLight;
-//	result[L"cameras"] = web::json::value::array();
-//	result[L"cameras"][0] = exportCamera(camera);
-//	result[L"activeCamera"] = web::json::value(std::wstring(camera.id.begin(), camera.id.end()));
-//	for (auto&& mat : materials){
-//		result[L"materials"][result[L"materials"].size()] = exportMaterial(mat);
-//	}
-//	result[L"meshes"] = web::json::value::array();
-//	int meshesAdded = 0;
-//	for (auto&& mesh : meshes){
-//		auto meshObj = web::json::value::object();
-//		meshObj[L"name"] = web::json::value(std::wstring(mesh.getName().begin(), mesh.getName().end()));
-//		std::wstring id(std::to_wstring(meshesAdded));
-//		id.append(L"-");
-//		id.append(mesh.getName().begin(), mesh.getName().end());
-//		meshObj[L"id"] = web::json::value(id);
-//		auto positions = web::json::value::array();
-//		auto normals =  web::json::value::array();
-//		auto uvs = web::json::value::array();
-//		for (auto&& vertex : mesh.getVertices()){
-//			writeVector3IntoStream(positions, babylon_vector3(vertex.pos_x, vertex.pos_y, vertex.pos_z));
-//			writeVector3IntoStream(normals, babylon_vector3(vertex.normal_x, vertex.normal_y, vertex.normal_z));
-//			writeVector2IntoStream(uvs, vertex.uv_x, vertex.uv_y);
-//		}
-//		meshObj[L"positions"] = positions;
-//		meshObj[L"normals"] = normals;
-//		meshObj[L"uvs"] = uvs;
-//
-//		auto indices = web::json::value::array();
-//		if (!reorderIndices){
-//			for (auto&& index : mesh.getIndices()){
-//				indices[indices.size()] = index;
-//			}
-//		}
-//		else{
-//			for (int i = 0; i < mesh.getIndices().size(); i += 3){
-//				indices[i] = mesh.getIndices()[i];
-//				indices[i+1] = mesh.getIndices()[i+2];
-//				indices[i+2] = mesh.getIndices()[i+1];
-//			}
-//		}
-//		
-//		meshObj[L"indices"] = indices;
-//		std::wstring materialId(id);
-//		materialId.append(L"_material");
-//		meshObj[L"materialId"] = web::json::value(materialId);
-//		meshObj[L"isEnabled"] = web::json::value::boolean(true);
-//		meshObj[L"isVisible"] = web::json::value::boolean(true);
-//		meshObj[L"billboardMode"] = web::json::value(0);
-//		FbxVector4 translation = mesh.getTransform().GetT();
-//		FbxVector4 rotation = mesh.getTransform().GetR();
-//		FbxVector4 scaling = mesh.getTransform().GetS();
-//		double sign;
-//		writeVector3(meshObj, L"position", babylon_vector3((float)translation[0], (float)translation[1], (float)translation[2]));
-//		writeVector3(meshObj, L"rotation", babylon_vector3((float) rotation[0], (float) rotation[1], (float) rotation[2]));
-//		writeVector3(meshObj, L"scaling", babylon_vector3((float) scaling[0], (float) scaling[1], (float) scaling[2]));
-//		//writeMatrix(meshObj, L"localMatrix", mesh.getTransform());
-//		auto multiMaterial = web::json::value::object();
-//		multiMaterial[L"id"] = web::json::value(materialId);
-//		multiMaterial[L"name"] = web::json::value(materialId);
-//		multiMaterial[L"materials"] = web::json::value::array();
-//		meshObj[L"subMeshes"] = web::json::value::array();
-//		for (int i = 0; i < mesh.getSubmeshes().size(); ++i){
-//			auto& submesh = mesh.getSubmeshes().at(i);
-//			multiMaterial[L"materials"][i] = web::json::value(std::wstring(submesh.material_id.begin(), submesh.material_id.end()));
-//			meshObj[L"subMeshes"][i] = web::json::value::object();
-//			meshObj[L"subMeshes"][i][L"materialIndex"] = web::json::value(i);
-//			meshObj[L"subMeshes"][i][L"indexStart"] = web::json::value(submesh.index_start);
-//			meshObj[L"subMeshes"][i][L"indexCount"] = web::json::value(submesh.index_count);
-//			meshObj[L"subMeshes"][i][L"verticesCount"] = web::json::value(mesh.getUniqueIndexCount(submesh));
-//		}
-//		result[L"multiMaterials"][result[L"multiMaterials"].size()] = multiMaterial;
-//
-//		result[L"meshes"][meshesAdded] = meshObj;
-//		meshesAdded++;
-//	}
-//	return result;
-//}

+ 0 - 209
Exporters/FBX/BabylonFbxNative/FbxMaterialHandler.cpp

@@ -1,209 +0,0 @@
-#include "stdafx.h"
-#include "FbxMaterialHandler.h"
-#include "..\3rdParty\DirectXTex\DirectXTex.h"
-#include <Windows.h>
-
-
-FbxMaterialStore::FbxMaterialStore(const std::wstring& inputFolder, const std::wstring& outputFolder, TextureFormat textureFormat) : _inputFolder(inputFolder), _outputFolder(outputFolder), _textureFormat(textureFormat)
-{
-	CoInitialize(nullptr);
-}
-
-
-FbxMaterialStore::~FbxMaterialStore()
-{
-}
-
-TextureFormat getTextureFormatFromFileName(const std::string& lowerCaseFileName){
-	if (lowerCaseFileName.compare(lowerCaseFileName.size() - 4, 4, ".jpg") == 0 || lowerCaseFileName.compare(lowerCaseFileName.size() - 5, 5, ".jpeg") == 0){
-		return TextureFormat::Jpg;
-	}
-	if (lowerCaseFileName.compare(lowerCaseFileName.size() - 4, 4, ".png") == 0){
-		return TextureFormat::Png;
-	}
-	if (lowerCaseFileName.compare(lowerCaseFileName.size() - 4, 4, ".dds") == 0){
-		return TextureFormat::Dds;
-	}
-	if (lowerCaseFileName.compare(lowerCaseFileName.size() - 4, 4, ".tga") == 0){
-		return TextureFormat::Tga;
-	}
-	return TextureFormat::Unkwown;
-}
-
-void changeFileNameForFormat(std::string& fileName, TextureFormat format){
-	auto indexOfDot = fileName.find_last_of('.');
-	fileName.erase(indexOfDot + 1);
-	switch (format)
-	{
-	case TextureFormat::Jpg:
-		fileName.append("jpg");
-		break;
-	case TextureFormat::Png:
-		fileName.append("png");
-		break;
-	case TextureFormat::Dds:
-		fileName.append("dds");
-		break;
-	
-	default:
-		break;
-	}
-}
-
-void convertTexture(const std::wstring& source, const std::wstring& dest, TextureFormat sourceFormat, TextureFormat destFormat, bool alpha){
-	DirectX::ScratchImage srcImg;
-	DirectX::TexMetadata srcMetadata;
-	switch (sourceFormat)
-	{	
-	case TextureFormat::Dds:
-		DirectX::LoadFromDDSFile(source.c_str(), 0, &srcMetadata, srcImg);
-		break;
-	case TextureFormat::Tga:
-		DirectX::LoadFromTGAFile(source.c_str(), &srcMetadata, srcImg);
-		break;
-	default:
-		DirectX::LoadFromWICFile(source.c_str(), 0, &srcMetadata, srcImg);
-		break;
-	}
-
-	switch (destFormat)
-	{
-	case TextureFormat::Jpg:
-		DirectX::SaveToWICFile(*srcImg.GetImage(0, 0, 0), 0, DirectX::GetWICCodec(DirectX::WICCodecs::WIC_CODEC_JPEG), dest.c_str());
-		break;
-	case TextureFormat::Png:
-		DirectX::SaveToWICFile(*srcImg.GetImage(0, 0, 0), 0, DirectX::GetWICCodec(DirectX::WICCodecs::WIC_CODEC_PNG), dest.c_str());
-		break;
-	case TextureFormat::Dds:
-	{
-		DirectX::ScratchImage imgWithMipMaps;
-		auto hr = DirectX::GenerateMipMaps(*srcImg.GetImage(0, 0, 0), DirectX::TEX_FILTER_FLAGS::TEX_FILTER_CUBIC, 0, imgWithMipMaps);
-
-		DirectX::ScratchImage imgInBC2;
-		//hr = DirectX::Convert(imgWithMipMaps.GetImages(), imgWithMipMaps.GetImageCount(), srcMetadata, DXGI_FORMAT_BC2_UNORM, DirectX::TEX_FILTER_FLAGS::TEX_FILTER_CUBIC, 0.5f, imgInBC2);
-		hr = DirectX::Compress(imgWithMipMaps.GetImages(), imgWithMipMaps.GetImageCount(), imgWithMipMaps.GetMetadata(), alpha ? DXGI_FORMAT_BC3_UNORM : DXGI_FORMAT_BC1_UNORM, DirectX::TEX_COMPRESS_FLAGS::TEX_COMPRESS_DEFAULT | DirectX::TEX_COMPRESS_PARALLEL, 0.5f, imgInBC2);
-		
-		hr = DirectX::SaveToDDSFile(imgInBC2.GetImages(), imgInBC2.GetImageCount(), imgInBC2.GetMetadata(), 0, dest.c_str());
-	}
-		break;
-	default:
-		break;
-	}
-}
-
-babylon_vector3 extractColorAndTexture(const FbxPropertyT<FbxDouble3>& colorRGB, const FbxPropertyT<FbxDouble>& factorProp, std::shared_ptr<babylon_texture>& oTexture, TextureFormat desiredTextureFormat, const std::wstring& srcDir, const std::wstring& outdir){
-	babylon_vector3 color(0,0,0);
-	if (colorRGB.IsValid()){
-		auto ambient = colorRGB.Get();
-		float factor = 1;
-		if (factorProp.IsValid()){
-			factor = (float) factorProp.Get();
-		}
-		color.x = (float) (ambient[0] * factor);
-		color.y = (float) (ambient[1] * factor);
-		color.z = (float) (ambient[2] * factor);
-		auto texture = colorRGB.GetSrcObject<FbxFileTexture>();
-		if (texture){
-			std::string relativeFileName(texture->GetRelativeFileName());
-			std::wstring wsourceFile(srcDir);
-			if (*wsourceFile.rbegin() != L'\\'){
-				wsourceFile.push_back(L'\\');
-			}
-			wsourceFile.append(std::begin(relativeFileName), std::end(relativeFileName));
-			// check if file exists
-			DWORD attrib = GetFileAttributes(wsourceFile.c_str());
-			if (attrib != 0xFFFFFFFF)
-			{
-				oTexture.reset(new babylon_texture());
-				std::transform(relativeFileName.begin(), relativeFileName.end(), relativeFileName.begin(), [](char c){return (char) tolower(c); });
-				oTexture->name = relativeFileName;
-				oTexture->hasAlpha = texture->GetAlphaSource() != FbxTexture::eNone;
-				TextureFormat sourceTextureFormat = getTextureFormatFromFileName(relativeFileName);
-
-
-
-				if (sourceTextureFormat == desiredTextureFormat){
-					std::wstring wdestFile(outdir);
-					if (*wdestFile.rbegin() != L'\\'){
-						wdestFile.push_back(L'\\');
-					}
-					wdestFile.append(std::wstring(relativeFileName.begin(), relativeFileName.end()));
-					CopyFile(wsourceFile.c_str(), wdestFile.c_str(), true);
-				}
-				else{
-					changeFileNameForFormat(relativeFileName, desiredTextureFormat);
-					oTexture->name = relativeFileName;
-					std::wstring wdestFile(outdir);
-					if (*wdestFile.rbegin() != L'\\'){
-						wdestFile.push_back(L'\\');
-					}
-					wdestFile.append(std::wstring(relativeFileName.begin(), relativeFileName.end()));
-					convertTexture(wsourceFile, wdestFile, sourceTextureFormat, desiredTextureFormat, oTexture->hasAlpha);
-				}
-			}
-
-			
-		}
-	}
-	return color;
-}
-
-const char* FbxMaterialStore::RegisterMaterial(FbxSurfaceMaterial* material){
-	auto found = _materials.find(material);
-	if (found != _materials.end()){
-		return found->second.id.c_str();
-	}
-
-
-
-	babylon_material result;
-	if (material){
-		result.id = std::to_string(_materials.size());
-		result.id.append(material->GetName());
-		result.name = result.id;
-		result.ambient = extractColorAndTexture(material->FindProperty(FbxSurfaceMaterial::sAmbient), material->FindProperty(FbxSurfaceMaterial::sAmbientFactor), result.ambientTexture, _textureFormat, _inputFolder, _outputFolder);
-		result.diffuse = extractColorAndTexture(material->FindProperty(FbxSurfaceMaterial::sDiffuse), material->FindProperty(FbxSurfaceMaterial::sDiffuseFactor), result.diffuseTexture, _textureFormat, _inputFolder, _outputFolder);
-		result.emissive = extractColorAndTexture(material->FindProperty(FbxSurfaceMaterial::sEmissive), material->FindProperty(FbxSurfaceMaterial::sEmissiveFactor), result.emissiveTexture, _textureFormat, _inputFolder, _outputFolder);
-		if (material->FindProperty(FbxSurfaceMaterial::sNormalMap).IsValid()){
-			auto texture = material->FindProperty(FbxSurfaceMaterial::sNormalMap).GetSrcObject<FbxFileTexture>();
-			if (texture){
-				result.bumpTexture.reset(new babylon_texture());
-				result.bumpTexture->name = texture->GetRelativeFileName();
-				result.bumpTexture->hasAlpha = texture->GetAlphaSource() != FbxTexture::eNone;
-			}
-		}
-		result.alpha = 1;
-		result.backFaceCulling = true;
-
-
-		result.specular.x = 0;
-		result.specular.y = 0;
-		result.specular.z = 0;
-		result.specularPower = 0;
-		result.specular = extractColorAndTexture(material->FindProperty(FbxSurfaceMaterial::sSpecular), material->FindProperty(FbxSurfaceMaterial::sSpecularFactor), result.specularTexture, _textureFormat, _inputFolder, _outputFolder);
-		if (material->FindProperty(FbxSurfaceMaterial::sShininess).IsValid()){
-			result.specularPower = (float) material->FindProperty(FbxSurfaceMaterial::sShininess).Get<FbxDouble>();
-		}
-	}
-	else{
-		result.name = "default material";
-		result.id = std::to_string(_materials.size());
-		result.id.append(result.name);
-		result.ambient = babylon_vector3(0.05f, 0.05f, 0.05f);
-		result.diffuse = babylon_vector3(0.8f, 0.8f, 0.8f);
-		result.emissive = babylon_vector3(0.0f, 0.0f, 0.0f);
-		
-		result.alpha = 1;
-		result.backFaceCulling = true;
-
-
-		result.specular.x = 1;
-		result.specular.y = 1;
-		result.specular.z = 1;
-		result.specularPower = 8;
-		
-	}
-
-	return _materials.insert(std::pair<FbxSurfaceMaterial*, babylon_material>(material, result)).first->second.id.c_str();
-
-}

+ 0 - 32
Exporters/FBX/BabylonFbxNative/FbxMaterialHandler.h

@@ -1,32 +0,0 @@
-#pragma once
-#include "BabylonVertex.h"
-#include <map>
-
-enum class TextureFormat{
-	Jpg,
-	Png,
-	Dds,
-	Tga,
-	Unkwown
-};
-class FbxMaterialStore
-{
-
-private:
-	TextureFormat _textureFormat;
-	std::wstring _inputFolder;
-	std::wstring _outputFolder;
-	std::map<FbxSurfaceMaterial*, babylon_material> _materials;
-public:
-	const char* RegisterMaterial(FbxSurfaceMaterial* material);
-	FbxMaterialStore(const std::wstring& inputFolder,const std::wstring& outputFolder, TextureFormat textureFormat = TextureFormat::Jpg);
-	~FbxMaterialStore();
-	std::vector<babylon_material> buildMaterialVector(){
-		std::vector<babylon_material> result;
-		for (auto&& pair : _materials){
-			result.push_back(pair.second);
-		}
-		return result;
-	}
-};
-

+ 0 - 227
Exporters/FBX/BabylonFbxNative/FbxMeshLoader.h

@@ -1,227 +0,0 @@
-#pragma once
-#include <fbxsdk.h>
-#include "FbxLoadException.h"
-#include <map>
-#include <vector>
-#include "FbxVertexKey.h"
-#include "FbxMaterialHandler.h"
-
-template<typename T>
-T extractElementValue(FbxLayerElementTemplate<T>* element, int polygon, int edge, int vertexIndex, int controlPointIndex){
-	auto mappingMode = element->GetMappingMode();
-	auto referenceMode = element->GetReferenceMode();
-	int index = 0;
-	switch (mappingMode){
-	case FbxLayerElementTemplate<T>::eAllSame:
-		index = 0;
-		break;
-	case FbxLayerElementTemplate<T>::eByControlPoint:
-		index = controlPointIndex;
-		break;
-	case FbxLayerElementTemplate<T>::eByPolygon:
-		index = polygon;
-		break;
-	case FbxLayerElementTemplate<T>::eByPolygonVertex:
-		index = vertexIndex;
-		break;
-	case FbxLayerElementTemplate<T>::eByEdge:
-		index = edge;
-		break;
-	}
-	if (referenceMode == FbxLayerElementTemplate<T>::eIndex || referenceMode == FbxLayerElementTemplate<T>::eIndexToDirect){
-		index = element->GetIndexArray().GetAt(index);
-	}
-
-	return element->GetDirectArray().GetAt(index);
-}
-
-template<typename VertexType>
-babylon_mesh<VertexType> loadStaticMesh(FbxMesh* mesh, FbxScene* scene, FbxMaterialStore& materialHandler){
-	throw UnknownVertexTypeException("unknown vertex type");
-}
-
-
-template<typename VertexType>
-struct Submesh{
-	std::string materialId;
-	std::map<FbxVertexKey, int> resolvedVertices;
-	std::vector<VertexType> vertices;
-	std::vector<int> indices;
-};
-
-
-FbxAMatrix ComputeTotalMatrix(FbxNode* Node)
-{
-	FbxAMatrix Geometry;
-	FbxVector4 Translation, Rotation, Scaling;
-	Translation = Node->GetGeometricTranslation(FbxNode::eSourcePivot);
-	Rotation = Node->GetGeometricRotation(FbxNode::eSourcePivot);
-	Scaling = Node->GetGeometricScaling(FbxNode::eSourcePivot);
-	Geometry.SetT(Translation);
-	Geometry.SetR(Rotation);
-	Geometry.SetS(Scaling);
-
-	//For Single Matrix situation, obtain transfrom matrix from eDESTINATION_SET, which include pivot offsets and pre/post rotations.
-	FbxAMatrix& GlobalTransform = Node->GetAnimationEvaluator()->GetNodeGlobalTransform(Node);
-
-	FbxAMatrix TotalMatrix;
-	TotalMatrix = GlobalTransform * Geometry;
-
-	return TotalMatrix;
-}
-
-bool IsOddNegativeScale(FbxAMatrix& TotalMatrix)
-{
-	FbxVector4 Scale = TotalMatrix.GetS();
-	int32_t NegativeNum = 0;
-
-	if (Scale[0] < 0) NegativeNum++;
-	if (Scale[1] < 0) NegativeNum++;
-	if (Scale[2] < 0) NegativeNum++;
-
-	return NegativeNum == 1 || NegativeNum == 3;
-}
-
-
-template<>
-babylon_mesh<babylon_vertex_normal_uv_color> loadStaticMesh<babylon_vertex_normal_uv_color>(FbxMesh* mesh, FbxScene* scene, FbxMaterialStore& materialHandler){
-	auto node = mesh->GetNode();
-	std::map<FbxSurfaceMaterial*, Submesh<babylon_vertex_normal_uv_color>> submeshes;
-	mesh->RemoveBadPolygons();
-	// ensure mesh has normals
-	mesh->GenerateNormals();
-
-	FbxGeometryConverter geometryConverter(mesh->GetFbxManager());
-	geometryConverter.ComputePolygonSmoothingFromEdgeSmoothing(mesh);
-	if (!mesh->IsTriangleMesh()){
-		// triangulate
-		mesh = (FbxMesh*)geometryConverter.Triangulate(mesh, false);
-	}
-
-	FbxStringList uvSetNameList;
-	mesh->GetUVSetNames(uvSetNameList);
-	int uvCount = uvSetNameList.GetCount();
-	bool hasUv = uvCount > 0;
-	char* uvSetName = nullptr;
-	// consider Max 1 uv coordiantes
-	if (hasUv){
-		uvSetName = uvSetNameList.GetStringAt(0);
-	}
-	using namespace std;
-
-	auto normals = mesh->GetElementNormal();
-	FbxGeometryElementUV* uvs = nullptr;
-	if (hasUv){
-		uvs = mesh->GetElementUV(uvSetName);
-	}
-	auto colors = mesh->GetElementVertexColor();
-	auto materials = mesh->GetElementMaterial();
-
-	FbxAMatrix totalMatrix;
-	FbxAMatrix totalMatrixForNormal;
-	totalMatrix = ComputeTotalMatrix(node);
-	totalMatrixForNormal = totalMatrix.Inverse();
-	totalMatrixForNormal = totalMatrixForNormal.Transpose();
-
-	// polygons have been triangulated. so we do not bother with polygon sizes;
-	for (int i = 0; i < mesh->GetPolygonVertexCount(); ++i){
-		auto polygonIndex = i / 3;
-		auto indexInPolygon = i % 3;
-
-		
-		
-		auto controlPointIndex = mesh->GetPolygonVertex(polygonIndex, indexInPolygon);
-		auto edgeIndex = mesh->GetMeshEdgeIndexForPolygon(polygonIndex, indexInPolygon);
-		FbxVertexKey vertexKey(12);
-		FbxVector4 normal(0, 0, 0, 0);
-		FbxColor color(0, 0, 0, 1);
-		FbxVector2 uv(0, 0);
-		if (normals){
-			normal = extractElementValue(normals, polygonIndex, edgeIndex, i, controlPointIndex);
-			normal.Normalize();
-		}
-		if (colors){
-			color = extractElementValue(colors, polygonIndex, edgeIndex, i, controlPointIndex);
-		}
-
-		if (hasUv){
-			uv = extractElementValue(uvs, polygonIndex, edgeIndex, i, controlPointIndex);
-		}
-		FbxSurfaceMaterial* material = nullptr;
-		if (materials){
-			material = extractElementValue(materials, polygonIndex, edgeIndex, i, controlPointIndex);
-		}
-		auto submeshNode = submeshes.find(material);
-		
-		if (submeshNode == submeshes.end()){
-			submeshNode = submeshes.insert(std::pair<FbxSurfaceMaterial*, Submesh<babylon_vertex_normal_uv_color>>(material, Submesh<babylon_vertex_normal_uv_color>())).first;
-		}
-
-		auto& submesh = submeshNode->second;
-
-		vertexKey.push(totalMatrix.MultT(mesh->GetControlPointAt(controlPointIndex)), 3);
-		vertexKey.push(totalMatrixForNormal.MultT(normal), 3);
-		vertexKey.push(uv, 2);
-		vertexKey.push((double*)&color, 4);
-
-		auto found = submesh.resolvedVertices.find(vertexKey);
-		if (found != submesh.resolvedVertices.end()){
-			submesh.indices.push_back(found->second);
-		}
-		else{
-			int index = static_cast<int>(submesh.resolvedVertices.size());
-			babylon_vertex_normal_uv_color babVertex;
-			auto& elements = vertexKey.getKeyMembers();
-			babVertex.pos_x = (float) elements.at(0);
-			babVertex.pos_y = (float) elements.at(1);
-			babVertex.pos_z = (float) elements.at(2);
-			babVertex.normal_x = (float) elements.at(3);
-			babVertex.normal_y = (float) elements.at(4);
-			babVertex.normal_z = (float) elements.at(5);
-			babVertex.uv_x = (float) elements.at(6);
-			babVertex.uv_y = (float) elements.at(7);
-			babVertex.color_r = (float) elements.at(8);
-			babVertex.color_g = (float) elements.at(9);
-			babVertex.color_b = (float) elements.at(10);
-			babVertex.color_a = (float) elements.at(11);
-			submesh.vertices.push_back(babVertex);
-			submesh.indices.push_back(index);
-			submesh.resolvedVertices.insert(std::pair<FbxVertexKey, int>(std::move(vertexKey), index));
-		}
-	}
-	int totalVertices = 0;
-	int totalIndices = 0;
-	for (auto&& submesh : submeshes){
-		totalVertices += static_cast<int>(submesh.second.vertices.size());
-		totalIndices += static_cast<int>(submesh.second.indices.size());
-	}
-	std::vector<babylon_vertex_normal_uv_color>vertices(totalVertices);
-	std::vector<int> indices(totalIndices);
-	std::vector<babylon_submesh> finalSubmeshes;
-	int verticesFilled=0;
-	int indicesFilled=0;
-	for (auto&& submesh : submeshes){
-		// use C based arrays for efficiency
-		babylon_vertex_normal_uv_color* vertexOutput = &vertices[verticesFilled];
-		int* indexOutput = &indices[indicesFilled];
-
-		babylon_vertex_normal_uv_color* vertexInput = &submesh.second.vertices[0];
-		int* indexInput = &submesh.second.indices[0];
-
-		memcpy_s(vertexOutput, sizeof(babylon_vertex_normal_uv_color) * (totalVertices - verticesFilled), vertexInput, sizeof(babylon_vertex_normal_uv_color) *submesh.second.vertices.size());
-		memcpy_s(indexOutput, sizeof(int) * (totalIndices - indicesFilled), indexInput, sizeof(int) *submesh.second.indices.size());
-		// reoffseting indices (webGL does not support "base vertex")
-		// perf: this loop should be autoparallelized / autovectorized
-		for (int i = 0; i < submesh.second.indices.size(); ++i){
-			indexOutput[i] += verticesFilled;
-		}
-		babylon_submesh babSubmesh;
-		babSubmesh.material_id = materialHandler.RegisterMaterial(submesh.first);
-		babSubmesh.index_start = indicesFilled;
-		babSubmesh.index_count = static_cast<int>(submesh.second.indices.size());
-		finalSubmeshes.push_back(babSubmesh);
-		verticesFilled += static_cast<int>(submesh.second.vertices.size());
-		indicesFilled += static_cast<int>(submesh.second.indices.size());
-	}
-	return babylon_mesh<babylon_vertex_normal_uv_color>(mesh->GetName(), std::move(vertices), std::move(indices), std::move(finalSubmeshes), node->GetAnimationEvaluator()->GetNodeGlobalTransform(node));
-}

+ 2 - 15
Exporters/FBX/BabylonFbxNative/FbxSceneLoader.cpp

@@ -2,8 +2,6 @@
 #include "FbxSceneLoader.h"
 #include "FbxLoadException.h"
 #include <vector>
-#include "FbxVertexKey.h"
-#include "FbxMaterialHandler.h"
 
 
 void MapNodes(std::map<std::uint64_t, BabylonNode*> map, BabylonNode* node){
@@ -37,16 +35,7 @@ FbxSceneLoader::FbxSceneLoader(const std::string& filePath) :_scene(nullptr), _f
 	importer->Import(_scene);
 
 	
-	//auto srcSystem = _scene->GetGlobalSettings().GetAxisSystem();
-	////FbxAxisSystem::OpenGL.ConvertScene(_scene);
-	////FbxAxisSystem::DirectX.ConvertChildren(_scene->GetRootNode(), srcSystem);
-	//auto scale = _scene->GetRootNode()->LclScaling.Get();
-	//scale[0] = -scale[0];
-	//auto rot = _scene->GetRootNode()->LclRotation.Get();
-	//rot[0] -= 90;
-
-	//_scene->GetRootNode()->LclScaling.Set(scale);
-	//_scene->GetRootNode()->LclRotation.Set(rot);
+	
 	_rootNode = std::make_unique<BabylonNode>(_scene->GetRootNode());
 	MapNodes(_nodesMap, _rootNode.get());
 }
@@ -62,8 +51,6 @@ FbxSceneLoader::~FbxSceneLoader()
 babylon_global_settings FbxSceneLoader::getGlobalSettings(){
 	babylon_global_settings result;
 	auto& settings = _scene->GetGlobalSettings();
-	/*auto color = settings.GetAmbientColor();
-
-	result.ambientColor = babylon_vector3( (float) color.mRed, (float) color.mGreen, (float) color.mBlue );*/
+	
 	return result;
 }

+ 0 - 110
Exporters/FBX/BabylonFbxNative/FbxVertexKey.cpp

@@ -1,110 +0,0 @@
-#include "stdafx.h"
-#include "FbxVertexKey.h"
-
-FbxVertexKey::FbxVertexKey()
-{
-
-}
-FbxVertexKey::FbxVertexKey(int expectedCapacity)
-{
-	_keymembers.reserve(expectedCapacity);
-}
-
-FbxVertexKey::FbxVertexKey(const FbxVertexKey& copy):
-_keymembers(copy._keymembers)
-{
-
-}
-FbxVertexKey::FbxVertexKey(FbxVertexKey&& moved):
-_keymembers(std::move(moved._keymembers)){
-
-}
-
-void FbxVertexKey::push(double dbl){
-	_keymembers.push_back(dbl);
-}
-void FbxVertexKey::push(const double* dbls, int length){
-	for (int i = 0; i < length; ++i){
-		_keymembers.push_back(dbls[i]);
-	}
-}
-
-FbxVertexKey& FbxVertexKey::operator = (const FbxVertexKey& copy){
-	if (this != &copy){
-		this->_keymembers = copy._keymembers;
-	}
-	return *this;
-}
-FbxVertexKey& FbxVertexKey::operator = (FbxVertexKey&& moved){
-	if (this != &moved){
-		this->_keymembers = std::move(moved._keymembers);
-	}
-	return *this;
-}
-
-FbxVertexKey::~FbxVertexKey()
-{
-}
-
-bool FbxVertexKey::operator == (const FbxVertexKey& other)const {
-	if (_keymembers.size() != other._keymembers.size()){
-		return false;
-	}
-
-	for (size_t i = 0; i < _keymembers.size(); ++i){
-		if (abs(_keymembers.at(i) - other._keymembers.at(i))>DBL_EPSILON){
-			return false;
-		}
-	}
-	return true;
-}
-bool FbxVertexKey::operator != (const FbxVertexKey& other)const {
-	return !(*this == other);
-}
-//bool is_less(const FbxVector4& lhs, const FbxVector4& rhs){
-//	for (int i = 0; i < 4; i++){
-//		if (lhs[i] < rhs[i] - DBL_EPSILON){
-//			return true;
-//		}
-//		else if (rhs[i] < lhs[i] - DBL_EPSILON){
-//			return false;
-//		}
-//	}
-//
-//	return false;
-//}
-//bool is_less(const FbxVector2& lhs, const FbxVector2& rhs){
-//	for (int i = 0; i < 2; i++){
-//		if (lhs[i] < rhs[i] - DBL_EPSILON){
-//			return true;
-//		}
-//		else if (rhs[i] < lhs[i] - DBL_EPSILON){
-//			return false;
-//		}
-//	}
-//
-//	return false;
-//}
-bool FbxVertexKey::operator < (const FbxVertexKey& rhs)const {
-	if (_keymembers.size() < rhs._keymembers.size()){
-		return true;
-	}
-	else if (rhs._keymembers.size() < _keymembers.size()){
-		return false;
-	}
-
-	for (size_t i = 0; i < _keymembers.size(); ++i){
-		if (_keymembers.at(i) < rhs._keymembers.at(i) - DBL_EPSILON){
-			return true;
-		}
-		else if (rhs._keymembers.at(i) < _keymembers.at(i) - DBL_EPSILON){
-			return false;
-		}
-	}
-
-
-	return false;
-}
-const std::vector<double>& FbxVertexKey::getKeyMembers() const{
-	return _keymembers;
-}

+ 0 - 26
Exporters/FBX/BabylonFbxNative/FbxVertexKey.h

@@ -1,26 +0,0 @@
-#pragma once
-#include "BabylonVertex.h"
-class FbxVertexKey
-{
-private:
-	std::vector<double> _keymembers;
-	
-public:
-	FbxVertexKey();
-	FbxVertexKey(int expectedCapacity);
-	FbxVertexKey(const FbxVertexKey& copy);
-	FbxVertexKey(FbxVertexKey&& moved);
-	FbxVertexKey& operator=(const FbxVertexKey& copy);
-	FbxVertexKey& operator=(FbxVertexKey&& moved);
-	~FbxVertexKey();
-
-	void push(double dbl);
-	void push(const double* dbl, int length);
-
-	bool operator==(const FbxVertexKey& other) const;
-	bool operator!=(const FbxVertexKey& other) const;
-	bool operator<(const FbxVertexKey& other) const;
-
-	const std::vector<double>& getKeyMembers() const;
-};
-

+ 0 - 157
Exporters/FBX/BabylonFbxNative/NodeHelpers.h

@@ -43,160 +43,3 @@ inline FbxMatrix ConvertToBabylonCoordinateSystem(const FbxMatrix& origin){
 	rot[1] = -rot[1];
 	return FbxMatrix (trans, rot, scaling);
 }
-//
-//inline FbxAMatrix CalculateGlobalTransform(FbxNode* pNode, const FbxTime& time = FBXSDK_TIME_INFINITE)
-//{
-//	FbxAMatrix lTranlationM, lScalingM, lScalingPivotM, lScalingOffsetM, lRotationOffsetM, lRotationPivotM, \
-//		lPreRotationM, lRotationM, lPostRotationM, lTransform;
-//
-//	FbxAMatrix lParentGX, lGlobalT, lGlobalRS;
-//
-//	if (!pNode)
-//	{
-//		lTransform.SetIdentity();
-//		return lTransform;
-//	}
-//
-//	// Construct translation matrix
-//	FbxVector4 lTranslation = pNode->LclTranslation.EvaluateValue(time);
-//	lTranlationM.SetT(lTranslation);
-//
-//	// Construct rotation matrices
-//	FbxVector4 lRotation = pNode->LclRotation.EvaluateValue(time);
-//	FbxVector4 lPreRotation = pNode->PreRotation.EvaluateValue(time);
-//	FbxVector4 lPostRotation = pNode->PostRotation.EvaluateValue(time);
-//	lRotationM.SetR(lRotation);
-//	lPreRotationM.SetR(lPreRotation);
-//	lPostRotationM.SetR(lPostRotation);
-//
-//	// Construct scaling matrix
-//	FbxVector4 lScaling = pNode->LclScaling.EvaluateValue(time);
-//	lScalingM.SetS(lScaling);
-//
-//	// Construct offset and pivot matrices
-//	FbxVector4 lScalingOffset = pNode->ScalingOffset.EvaluateValue(time);
-//	FbxVector4 lScalingPivot = pNode->ScalingPivot.EvaluateValue(time);
-//	FbxVector4 lRotationOffset = pNode->RotationOffset.EvaluateValue(time);
-//	FbxVector4 lRotationPivot = pNode->RotationPivot.EvaluateValue(time);
-//	lScalingOffsetM.SetT(lScalingOffset);
-//	lScalingPivotM.SetT(lScalingPivot);
-//	lRotationOffsetM.SetT(lRotationOffset);
-//	lRotationPivotM.SetT(lRotationPivot);
-//
-//	// Calculate the global transform matrix of the parent node
-//	FbxNode* lParentNode = pNode->GetParent();
-//	if (lParentNode)
-//	{
-//		lParentGX = CalculateGlobalTransform(lParentNode);
-//	}
-//	else
-//	{
-//		lParentGX.SetIdentity();
-//	}
-//
-//	//Construct Global Rotation
-//	FbxAMatrix lLRM, lParentGRM;
-//	FbxVector4 lParentGR = lParentGX.GetR();
-//	lParentGRM.SetR(lParentGR);
-//	lLRM = lPreRotationM * lRotationM * lPostRotationM;
-//
-//	//Construct Global Shear*Scaling
-//	//FBX SDK does not support shear, to patch this, we use:
-//	//Shear*Scaling = RotationMatrix.Inverse * TranslationMatrix.Inverse * WholeTranformMatrix
-//	FbxAMatrix lLSM, lParentGSM, lParentGRSM, lParentTM;
-//	FbxVector4 lParentGT = lParentGX.GetT();
-//	lParentTM.SetT(lParentGT);
-//	lParentGRSM = lParentTM.Inverse() * lParentGX;
-//	lParentGSM = lParentGRM.Inverse() * lParentGRSM;
-//	lLSM = lScalingM;
-//
-//	//Do not consider translation now
-//	FbxTransform::EInheritType lInheritType = pNode->InheritType.EvaluateValue(time);
-//	if (lInheritType == FbxTransform::eInheritRrSs)
-//	{
-//		lGlobalRS = lParentGRM * lLRM * lParentGSM * lLSM;
-//	}
-//	else if (lInheritType == FbxTransform::eInheritRSrs)
-//	{
-//		lGlobalRS = lParentGRM * lParentGSM * lLRM * lLSM;
-//	}
-//	else if (lInheritType == FbxTransform::eInheritRrs)
-//	{
-//		FbxAMatrix lParentLSM;
-//		FbxVector4 lParentLS = lParentNode->LclScaling.EvaluateValue(time);
-//		lParentLSM.SetS(lParentLS);
-//
-//		FbxAMatrix lParentGSM_noLocal = lParentGSM * lParentLSM.Inverse();
-//		lGlobalRS = lParentGRM * lLRM * lParentGSM_noLocal * lLSM;
-//	}
-//	else
-//	{
-//		FBXSDK_printf("error, unknown inherit type! \n");
-//	}
-//
-//	// Construct translation matrix
-//	// Calculate the local transform matrix
-//	lTransform = lTranlationM * lRotationOffsetM * lRotationPivotM * lPreRotationM * lRotationM * lPostRotationM * lRotationPivotM.Inverse()\
-//		* lScalingOffsetM * lScalingPivotM * lScalingM * lScalingPivotM.Inverse();
-//	FbxVector4 lLocalTWithAllPivotAndOffsetInfo = lTransform.GetT();
-//	// Calculate global translation vector according to: 
-//	// GlobalTranslation = ParentGlobalTransform * LocalTranslationWithPivotAndOffsetInfo
-//	FbxVector4 lGlobalTranslation = lParentGX.MultT(lLocalTWithAllPivotAndOffsetInfo);
-//	lGlobalT.SetT(lGlobalTranslation);
-//
-//	//Construct the whole global transform
-//	lTransform = lGlobalT * lGlobalRS;
-//
-//	return lTransform;
-//}
-
-//
-//inline FbxAMatrix CalculateLocalTransform(FbxNode* pNode, const FbxTime& time = FBXSDK_TIME_INFINITE)
-//{
-//	FbxAMatrix lTranlationM, lScalingM, lScalingPivotM, lScalingOffsetM, lRotationOffsetM, lRotationPivotM, \
-//		lPreRotationM, lRotationM, lPostRotationM, lTransform;
-//
-//
-//	if (!pNode)
-//	{
-//		lTransform.SetIdentity();
-//		return lTransform;
-//	}
-//
-//	// Construct translation matrix
-//	FbxVector4 lTranslation = pNode->LclTranslation.EvaluateValue(time);
-//	lTranlationM.SetT(lTranslation);
-//
-//	// Construct rotation matrices
-//	FbxVector4 lRotation = pNode->LclRotation.EvaluateValue(time);
-//	FbxVector4 lPreRotation = pNode->PreRotation.EvaluateValue(time);
-//	FbxVector4 lPostRotation = pNode->PostRotation.EvaluateValue(time);
-//	lRotationM.SetR(lRotation);
-//	lPreRotationM.SetR(lPreRotation);
-//	lPostRotationM.SetR(lPostRotation);
-//
-//	// Construct scaling matrix
-//	FbxVector4 lScaling = pNode->LclScaling.EvaluateValue(time);
-//	lScalingM.SetS(lScaling);
-//
-//	// Construct offset and pivot matrices
-//	FbxVector4 lScalingOffset = pNode->ScalingOffset.EvaluateValue(time);
-//	FbxVector4 lScalingPivot = pNode->ScalingPivot.EvaluateValue(time);
-//	FbxVector4 lRotationOffset = pNode->RotationOffset.EvaluateValue(time);
-//	FbxVector4 lRotationPivot = pNode->RotationPivot.EvaluateValue(time);
-//	lScalingOffsetM.SetT(lScalingOffset);
-//	lScalingPivotM.SetT(lScalingPivot);
-//	lRotationOffsetM.SetT(lRotationOffset);
-//	lRotationPivotM.SetT(lRotationPivot);
-//
-//	
-//	
-//
-//	// Construct translation matrix
-//	// Calculate the local transform matrix
-//	lTransform = lTranlationM * lRotationOffsetM * lRotationPivotM * lPreRotationM * lRotationM * lPostRotationM * lRotationPivotM.Inverse()\
-//		* lScalingOffsetM * lScalingPivotM * lScalingM * lScalingPivotM.Inverse();
-//	
-//
-//	return lTransform;
-//}

+ 22 - 0
Exporters/FBX/BabylonFbxNative/SkinInfo.h

@@ -21,6 +21,19 @@ struct BoneInfo{
 	FbxMatrix matrixGlobalBindPose;
 	FbxMatrix matrixLocalBindPose;
 	std::vector<BoneAnimKeyFrame> keyFrames;
+	BoneInfo(const BoneInfo&) = default;
+	BoneInfo(BoneInfo&& moved) :
+		linkNode(std::move(moved.linkNode)),
+		cluster(std::move(moved.cluster)),
+		FbxClusterIndex(std::move(moved.FbxClusterIndex)),
+		parentBoneIndex(std::move(moved.parentBoneIndex)),
+		name(std::move(moved.name)),
+		matrixGlobalBindPose(std::move(moved.matrixGlobalBindPose)),
+		matrixLocalBindPose(std::move(moved.matrixLocalBindPose)),
+		keyFrames(std::move(moved.keyFrames))
+	{
+	}
+	BoneInfo() = default;
 };
 
 struct BoneIndexAndWeight{
@@ -41,6 +54,15 @@ private:
 public:
 	SkinInfo(FbxNode* meshNode);
 
+	SkinInfo(const SkinInfo&) = default;
+	SkinInfo(SkinInfo&& moved) : 
+		_node(std::move(moved._node)),
+		_mesh(std::move(moved._mesh)),
+		_skin(std::move(moved._skin)),
+		_bones(std::move(moved._bones)),
+		_fbxClusterIndexToBoneIndex(std::move(moved._fbxClusterIndexToBoneIndex)),
+		_controlPointToBoneIndicesAndWeights(std::move(moved._controlPointToBoneIndicesAndWeights))
+	{}
 	bool hasSkin() const{
 		return _skin != nullptr;
 	}

+ 3 - 214
Exporters/FBX/FbxExporter/FbxExporter.cpp

@@ -3,8 +3,6 @@
 
 #include "stdafx.h"
 #include "..\BabylonFbxNative\FbxSceneLoader.h"
-#include "..\BabylonFbxNative\FbxMeshLoader.h"
-#include "..\BabylonFbxNative\Export.h"
 #include <iostream>
 #include <fstream>
 #include <Windows.h>
@@ -13,36 +11,6 @@
 #include "..\BabylonFbxNative\BabylonScene.h"
 #include "..\BabylonFbxNative\GlobalSettings.h"
 
-std::string toString(BabylonNodeType type) {
-	switch (type)
-	{
-	case BabylonNodeType::Camera:
-		return "camera";
-		break;
-	case BabylonNodeType::Mesh:
-		return "mesh";
-		break;
-	case BabylonNodeType::Skeleton:
-		return "skeleton";
-		break;
-	case BabylonNodeType::Light:
-		return "light";
-		break;
-	case BabylonNodeType::Empty:
-		return "<empty>";
-		break;
-	default:
-		return "unknown";
-		break;
-	}
-}
-
-std::string toString(FbxDouble3 value) {
-	std::stringstream s;
-	s << "(" << value[0] << "," << value[1] << "," << value[2] << ")";
-	return s.str();
-}
-
 
 std::string wstringToUtf8(const std::wstring& src){
 	auto size = WideCharToMultiByte(CP_UTF8, 0, src.c_str(), static_cast<int>( src.size()), nullptr, 0, nullptr, nullptr);
@@ -52,139 +20,7 @@ std::string wstringToUtf8(const std::wstring& src){
 	return result;
 }
 
-void fixupTextureCoordinateIndices(BabylonMaterial& mat, BabylonMesh& mesh) {
-	std::vector<std::shared_ptr<BabylonTexture>> textures;
-	if (mat.ambientTexture) {
-		textures.push_back(mat.ambientTexture);
-	}
-	if (mat.diffuseTexture) {
-		textures.push_back(mat.diffuseTexture);
-	}
-	if (mat.specularTexture) {
-		textures.push_back(mat.specularTexture);
-	}
-	if (mat.emissiveTexture) {
-		textures.push_back(mat.emissiveTexture);
-	}
-	if (mat.reflectionTexture) {
-		textures.push_back(mat.reflectionTexture);
-	}
-	if (mat.bumpTexture) {
-		textures.push_back(mat.bumpTexture);
-	}
-	for (auto& tex : textures) {
-		auto found = std::find(mesh.uvsets.begin(), mesh.uvsets.end(), tex->uvset);
-		if (found != mesh.uvsets.end()) {
-			tex->coordinatesIndex = static_cast<int>(found - mesh.uvsets.begin());
-		}
-	}
-}
-void exploreMeshes(BabylonScene& scene, BabylonNode& node, bool skipEmptyNodes) {
-	if (node.nodeType() == BabylonNodeType::Skeleton && node.hasOnlySkeletonDescendants()) {
-		return;
-	}
-	if (skipEmptyNodes && node.isEmptySkeletonOrEmptyMeshRecursive()) {
-		return;
-	}
-	// append mesh
-	switch (node.nodeType())
-	{
-	case BabylonNodeType::Empty:
-	case BabylonNodeType::Mesh:
-	case BabylonNodeType::Skeleton:
-	{
-
-		scene.meshes().emplace_back(&node);
-		auto& mesh = scene.meshes()[scene.meshes().size() - 1];
-		auto matCount = node.fbxNode()->GetMaterialCount();
-		BabylonMultiMaterial multiMat;
-		for (auto i = 0; i < matCount; ++i) {
-			auto mat = node.fbxNode()->GetMaterial(i);
-			if (mat) {
 
-				auto id = getMaterialId(mat);
-				auto existing = std::find_if(scene.materials().begin(), scene.materials().end(), [id](const BabylonMaterial& e) {
-					return e.id == id;
-				});
-				if (existing == scene.materials().end()) {
-					auto babMat = BabylonMaterial(mat);
-					fixupTextureCoordinateIndices(babMat, mesh);
-					scene.materials().push_back(babMat);
-				}
-
-				multiMat.materials.push_back(id);
-				
-			}
-		}
-
-		if (mesh.associatedSkeleton){
-			mesh.associatedSkeleton->id = static_cast<int>(scene.skeletons().size()+1);
-			mesh.skeletonId(static_cast<int>(scene.skeletons().size()+1));
-			scene.skeletons().push_back(mesh.associatedSkeleton);
-		}
-		if (multiMat.materials.size() > 0) {
-			auto& mesh = scene.meshes()[scene.meshes().size() - 1];
-			/*if (multiMat.materials.size() == 1) {
-				mesh.materialId(multiMat.materials[0]);
-			}
-			else {*/
-				multiMat.id = mesh.id();
-				multiMat.name = mesh.name();
-				mesh.materialId(multiMat.id);
-				scene.multiMaterials().push_back(multiMat);
-			//}
-		}
-	}
-	break;
-	case BabylonNodeType::Camera:
-	{
-		scene.cameras().emplace_back(node);
-		if (scene.cameras().size() == 1) {
-			scene.activeCameraID(scene.cameras()[0].id);
-		}
-	}
-	break;
-	case BabylonNodeType::Light:
-	{
-		scene.lights().emplace_back(node);
-		auto& l = scene.lights()[scene.lights().size() - 1];
-		if (l.shadowGenerator) {
-			scene.shadowGenerators().push_back(l.shadowGenerator);
-		}
-	}
-	break;
-	default:
-		break;
-	}
-
-
-	for (auto& child : node.children()) {
-		exploreMeshes(scene, child, skipEmptyNodes);
-	}
-
-
-
-}
-
-TextureFormat getInputFormat(const std::wstring& fileName){
-	std::wstring ext = fileName.substr(fileName.find_last_of(L'.') + 1);
-	std::wstring extLower;
-	extLower.reserve(ext.size());
-	std::transform(ext.begin(), ext.end(), std::back_inserter(extLower), towlower);
-	if (extLower == L"png"){
-		return TextureFormat::Png;
-	}
-	else if (extLower == L"jpg"){
-		return TextureFormat::Jpg;
-	}
-	else if (extLower == L"tga"){
-		return TextureFormat::Tga;
-	}
-	else if (extLower == L"dds"){
-		return TextureFormat::Dds;
-	}
-	return TextureFormat::Unkwown;
-}
 
 void exportTexture(const std::shared_ptr<BabylonTexture>& tex, const std::wstring& wOutputPath){
 	if (!tex){
@@ -198,7 +34,6 @@ void exportTexture(const std::shared_ptr<BabylonTexture>& tex, const std::wstrin
 		}
 		fullPath[indexOfSlash] = L'\\';
 	}
-	auto inputFormat = getInputFormat(tex->fullPath);
 	auto outputPath = tex->name;
 	for (;;){
 		auto indexOfSlash = outputPath.find(L'/');
@@ -277,8 +112,7 @@ int _tmain(int argc, _TCHAR* argv[])
 	FbxSceneLoader sceneLoader(wstringToUtf8(wInputPath));
 	auto root = sceneLoader.rootNode();
 
-	BabylonScene babScene;
-	exploreMeshes(babScene, *root, skipEmptyNodes);
+	BabylonScene babScene(*root, skipEmptyNodes);
 
 	for (auto& mat : babScene.materials()){
 		exportTexture(mat.ambientTexture, wOutputPath);
@@ -289,53 +123,8 @@ int _tmain(int argc, _TCHAR* argv[])
 		exportTexture(mat.bumpTexture, wOutputPath);
 		
 	}
-	if (babScene.cameras().size() == 0){
-		babylon_boundingbox bbox(sceneLoader.getScene());
-		auto cam = buildCameraFromBoundingBox(bbox);
-		babScene.cameras().push_back(cam);
-		babScene.activeCameraID(cam.id);
-	}
-	if (babScene.lights().size() == 0){
-		babylon_boundingbox bbox(sceneLoader.getScene());
-		BabylonLight light;
-		light.diffuse = babylon_vector3(1, 1, 1);
-		light.specular = babylon_vector3(1, 1, 1);
-		light.position = babylon_vector3(0,0,0);
-		light.parentId = babScene.activeCameraID();
-		light.type = 0;
-		light.id = L"default_light";
-		light.name = L"default_light";
-		light.intensity = 1;
-		babScene.lights().push_back(light);
-		//	web::json::value defaultLight = web::json::value::object();
-		//	writeVector3(defaultLight, L"diffuse", babylon_vector3(1, 1, 1));
-		//	writeVector3(defaultLight, L"specular", babylon_vector3(1, 1, 1));
-		//	writeVector3(defaultLight, L"position", babylon_vector3(bbox.getMinX()*2, bbox.getMaxY()*2, bbox.getMinZ()*2));
-		//	defaultLight[L"type"] = web::json::value(0);
-		//	defaultLight[L"direction"] = web::json::value::null();
-		//	defaultLight[L"id"] = web::json::value(L"default light");
-		//	defaultLight[L"name"] = web::json::value(L"default light");
-		//	defaultLight[L"intensity"] = web::json::value(1);
-	}
-	/*auto camera = sceneLoader.GetDefaultCamera();
-	auto spaceshipSettings = sceneLoader.getGlobalSettings();
-	FbxMaterialStore materials(wInputDir, wOutputPath, texFormat);
-	for (int i = 0; i < sceneLoader.getMeshCount(); ++i){
-		meshes.push_back(loadStaticMesh<babylon_vertex_normal_uv_color>(sceneLoader.getFbxMesh(i), sceneLoader.getScene(), materials));
-	}
-	auto json = exportScene(spaceshipSettings, materials.buildMaterialVector(), meshes);
-	if ('\\' != *wOutputPath.cend()){
-		wOutputPath.append(L"\\");
-	}
-	wOutputPath.append(wInputFileName);
-
-	auto lastDot = wOutputPath.find_last_of(L'.');
-	wOutputPath.erase(lastDot);
-	wOutputPath.append(L".babylon");
-	DeleteFile(wOutputPath.c_str());
-	std::wofstream stream(wOutputPath);
-	json.serialize(stream);
-	stream.flush();*/
+	
+	
 
 	auto json = babScene.toJson();
 	if (L'\\' != *wOutputPath.crbegin()) {

+ 0 - 3
Exporters/FBX/FbxExporter/FbxExporter.vcxproj

@@ -184,9 +184,6 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\3rdParty\DirectXTex\DirectXTex_Desktop_2013.vcxproj">
-      <Project>{371b9fa9-4c90-4ac6-a123-aced756d6c77}</Project>
-    </ProjectReference>
     <ProjectReference Include="..\BabylonFbxNative\BabylonFbxNative.vcxproj">
       <Project>{6c145cfb-31ac-4b28-8b74-26680d26a6e3}</Project>
     </ProjectReference>