Use VS2022 Win10 MSVC solutions in DirectX-related dependencies

This commit is contained in:
2024-05-09 20:30:24 +03:00
parent 84f7fde753
commit 9fedacb404
8 changed files with 385 additions and 212 deletions

View File

@@ -1,9 +1,9 @@
//-------------------------------------------------------------------------------------
// DirectXMesh.h
//
//
// DirectX Mesh Geometry Library
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=324981
@@ -11,51 +11,63 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <stdint.h>
#if !defined(__d3d11_h__) && !defined(__d3d11_x_h__) && !defined(__d3d12_h__) && !defined(__d3d12_x_h__)
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#ifdef _WIN32
#if !defined(__d3d11_h__) && !defined(__d3d11_x_h__) && !defined(__d3d12_h__) && !defined(__d3d12_x_h__) && !defined(__XBOX_D3D12_X__)
#ifdef _GAMING_XBOX_SCARLETT
#include <d3d12_xs.h>
#elif defined(_GAMING_XBOX)
#include <d3d12_x.h>
#elif defined(_XBOX_ONE) && defined(_TITLE)
#error This library no longer supports legacy Xbox One XDK
#else
#include <d3d11_1.h>
#endif
#endif
#else // !WIN32
#include <directx/dxgiformat.h>
#include <wsl/winadapter.h>
#endif
#include <directxmath.h>
#include <DirectXMath.h>
#include <DirectXCollision.h>
#include <DirectXPackedVector.h>
#define DIRECTX_MESH_VERSION 130
#define DIRECTX_MESH_VERSION 166
namespace DirectX
{
//---------------------------------------------------------------------------------
// DXGI Format Utilities
bool __cdecl IsValidVB(_In_ DXGI_FORMAT fmt);
bool __cdecl IsValidIB(_In_ DXGI_FORMAT fmt);
size_t __cdecl BytesPerElement(_In_ DXGI_FORMAT fmt);
bool __cdecl IsValidVB(_In_ DXGI_FORMAT fmt) noexcept;
constexpr bool __cdecl IsValidIB(_In_ DXGI_FORMAT fmt) noexcept;
size_t __cdecl BytesPerElement(_In_ DXGI_FORMAT fmt) noexcept;
//---------------------------------------------------------------------------------
// Input Layout Descriptor Utilities
#if defined(__d3d11_h__) || defined(__d3d11_x_h__)
bool __cdecl IsValid(_In_reads_(nDecl) const D3D11_INPUT_ELEMENT_DESC* vbDecl, _In_ size_t nDecl);
bool __cdecl IsValid(_In_reads_(nDecl) const D3D11_INPUT_ELEMENT_DESC* vbDecl, _In_ size_t nDecl) noexcept;
void __cdecl ComputeInputLayout(
_In_reads_(nDecl) const D3D11_INPUT_ELEMENT_DESC* vbDecl, _In_ size_t nDecl,
_Out_writes_opt_(nDecl) uint32_t* offsets,
_Out_writes_opt_(D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT) uint32_t* strides);
_Out_writes_opt_(D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT) uint32_t* strides) noexcept;
#endif
#if defined(__d3d12_h__) || defined(__d3d12_x_h__)
bool __cdecl IsValid(const D3D12_INPUT_LAYOUT_DESC& vbDecl);
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
bool __cdecl IsValid(const D3D12_INPUT_LAYOUT_DESC& vbDecl) noexcept;
void __cdecl ComputeInputLayout(
const D3D12_INPUT_LAYOUT_DESC& vbDecl,
_Out_writes_opt_(vbDecl.NumElements) uint32_t* offsets,
_Out_writes_opt_(D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT) uint32_t* strides);
_Out_writes_opt_(D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT) uint32_t* strides) noexcept;
#endif
//---------------------------------------------------------------------------------
@@ -80,8 +92,8 @@ namespace DirectX
{
public:
VBReader() noexcept(false);
VBReader(VBReader&& moveFrom) noexcept;
VBReader& operator= (VBReader&& moveFrom) noexcept;
VBReader(VBReader&&) noexcept;
VBReader& operator= (VBReader&&) noexcept;
VBReader(VBReader const&) = delete;
VBReader& operator= (VBReader const&) = delete;
@@ -93,12 +105,12 @@ namespace DirectX
// Does not support VB decls with D3D11_INPUT_PER_INSTANCE_DATA
#endif
#if defined(__d3d12_h__) || defined(__d3d12_x_h__)
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
HRESULT __cdecl Initialize(const D3D12_INPUT_LAYOUT_DESC& vbDecl);
// Does not support VB decls with D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA
#endif
HRESULT __cdecl AddStream(_In_reads_bytes_(stride*nVerts) const void* vb, _In_ size_t nVerts, _In_ size_t inputSlot, _In_ size_t stride = 0);
HRESULT __cdecl AddStream(_In_reads_bytes_(stride*nVerts) const void* vb, _In_ size_t nVerts, _In_ size_t inputSlot, _In_ size_t stride = 0) noexcept;
// Add vertex buffer to reader
HRESULT __cdecl Read(_Out_writes_(count) XMVECTOR* buffer, _In_z_ const char* semanticName, _In_ unsigned int semanticIndex, _In_ size_t count, bool x2bias = false) const;
@@ -110,7 +122,7 @@ namespace DirectX
HRESULT __cdecl Read(_Out_writes_(count) XMFLOAT4* buffer, _In_z_ const char* semanticName, _In_ unsigned int semanticIndex, _In_ size_t count, bool x2bias = false) const;
// Helpers for data extraction
void __cdecl Release();
void __cdecl Release() noexcept;
#if defined(__d3d11_h__) || defined(__d3d11_x_h__)
const D3D11_INPUT_ELEMENT_DESC* GetElement(_In_z_ const char* semanticName, _In_ unsigned int semanticIndex) const
@@ -121,7 +133,7 @@ namespace DirectX
const D3D11_INPUT_ELEMENT_DESC* __cdecl GetElement11(_In_z_ const char* semanticName, _In_ unsigned int semanticIndex) const;
#endif
#if defined(__d3d12_h__) || defined(__d3d12_x_h__)
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
const D3D12_INPUT_ELEMENT_DESC* __cdecl GetElement12(_In_z_ const char* semanticName, _In_ unsigned int semanticIndex) const;
#endif
@@ -136,8 +148,8 @@ namespace DirectX
{
public:
VBWriter() noexcept(false);
VBWriter(VBWriter&& moveFrom) noexcept;
VBWriter& operator= (VBWriter&& moveFrom) noexcept;
VBWriter(VBWriter&&) noexcept;
VBWriter& operator= (VBWriter&&) noexcept;
VBWriter(VBWriter const&) = delete;
VBWriter& operator= (VBWriter const&) = delete;
@@ -149,12 +161,12 @@ namespace DirectX
// Does not support VB decls with D3D11_INPUT_PER_INSTANCE_DATA
#endif
#if defined(__d3d12_h__) || defined(__d3d12_x_h__)
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
HRESULT __cdecl Initialize(const D3D12_INPUT_LAYOUT_DESC& vbDecl);
// Does not support VB decls with D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA
#endif
HRESULT __cdecl AddStream(_Out_writes_bytes_(stride*nVerts) void* vb, _In_ size_t nVerts, _In_ size_t inputSlot, _In_ size_t stride = 0);
HRESULT __cdecl AddStream(_Out_writes_bytes_(stride*nVerts) void* vb, _In_ size_t nVerts, _In_ size_t inputSlot, _In_ size_t stride = 0) noexcept;
// Add vertex buffer to writer
HRESULT __cdecl Write(_In_reads_(count) const XMVECTOR* buffer, _In_z_ const char* semanticName, _In_ unsigned int semanticIndex, _In_ size_t count, bool x2bias = false) const;
@@ -166,7 +178,7 @@ namespace DirectX
HRESULT __cdecl Write(_In_reads_(count) const XMFLOAT4* buffer, _In_z_ const char* semanticName, _In_ unsigned int semanticIndex, _In_ size_t count, bool x2bias = false) const;
// Helpers for data insertion
void __cdecl Release();
void __cdecl Release() noexcept;
#if defined(__d3d11_h__) || defined(__d3d11_x_h__)
const D3D11_INPUT_ELEMENT_DESC* __cdecl GetElement(_In_z_ const char* semanticName, _In_ unsigned int semanticIndex) const
@@ -177,7 +189,7 @@ namespace DirectX
const D3D11_INPUT_ELEMENT_DESC* __cdecl GetElement11(_In_z_ const char* semanticName, _In_ unsigned int semanticIndex) const;
#endif
#if defined(__d3d12_h__) || defined(__d3d12_x_h__)
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
const D3D12_INPUT_ELEMENT_DESC* __cdecl GetElement12(_In_z_ const char* semanticName, _In_ unsigned int semanticIndex) const;
#endif
@@ -221,42 +233,42 @@ namespace DirectX
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const uint32_t* pointRep,
_In_reads_(nFaces * 3) const uint32_t* adjacency, _In_ size_t nVerts,
_Out_writes_(nFaces * 6) uint16_t* indicesAdj);
_Out_writes_(nFaces * 6) uint16_t* indicesAdj) noexcept;
HRESULT __cdecl GenerateGSAdjacency(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const uint32_t* pointRep,
_In_reads_(nFaces * 3) const uint32_t* adjacency, _In_ size_t nVerts,
_Out_writes_(nFaces * 6) uint32_t* indicesAdj);
_Out_writes_(nFaces * 6) uint32_t* indicesAdj) noexcept;
// Generates an IB suitable for Geometry Shader using D3D1x_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ
//---------------------------------------------------------------------------------
// Normals, Tangents, and Bi-Tangents Computation
enum CNORM_FLAGS
enum CNORM_FLAGS : unsigned long
{
CNORM_DEFAULT = 0x0,
// Default is to compute normals using weight-by-angle
CNORM_DEFAULT = 0x0,
// Default is to compute normals using weight-by-angle
CNORM_WEIGHT_BY_AREA = 0x1,
// Computes normals using weight-by-area
CNORM_WEIGHT_BY_AREA = 0x1,
// Computes normals using weight-by-area
CNORM_WEIGHT_EQUAL = 0x2,
// Compute normals with equal weights
CNORM_WEIGHT_EQUAL = 0x2,
// Compute normals with equal weights
CNORM_WIND_CW = 0x4,
// Vertices are clock-wise (defaults to CCW)
CNORM_WIND_CW = 0x4,
// Vertices are clock-wise (defaults to CCW)
};
HRESULT __cdecl ComputeNormals(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_ DWORD flags,
_Out_writes_(nVerts) XMFLOAT3* normals);
_In_ CNORM_FLAGS flags,
_Out_writes_(nVerts) XMFLOAT3* normals) noexcept;
HRESULT __cdecl ComputeNormals(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_ DWORD flags,
_Out_writes_(nVerts) XMFLOAT3* normals);
_In_ CNORM_FLAGS flags,
_Out_writes_(nVerts) XMFLOAT3* normals) noexcept;
// Computes vertex normals
HRESULT __cdecl ComputeTangentFrame(
@@ -265,73 +277,73 @@ namespace DirectX
_In_reads_(nVerts) const XMFLOAT3* normals,
_In_reads_(nVerts) const XMFLOAT2* texcoords, _In_ size_t nVerts,
_Out_writes_opt_(nVerts) XMFLOAT3* tangents,
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents);
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents) noexcept;
HRESULT __cdecl ComputeTangentFrame(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT3* normals,
_In_reads_(nVerts) const XMFLOAT2* texcoords, _In_ size_t nVerts,
_Out_writes_opt_(nVerts) XMFLOAT3* tangents,
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents);
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents) noexcept;
HRESULT __cdecl ComputeTangentFrame(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT3* normals,
_In_reads_(nVerts) const XMFLOAT2* texcoords, _In_ size_t nVerts,
_Out_writes_opt_(nVerts) XMFLOAT4* tangents,
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents);
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents) noexcept;
HRESULT __cdecl ComputeTangentFrame(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT3* normals,
_In_reads_(nVerts) const XMFLOAT2* texcoords, _In_ size_t nVerts,
_Out_writes_opt_(nVerts) XMFLOAT4* tangents,
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents);
_Out_writes_opt_(nVerts) XMFLOAT3* bitangents) noexcept;
HRESULT __cdecl ComputeTangentFrame(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT3* normals,
_In_reads_(nVerts) const XMFLOAT2* texcoords, _In_ size_t nVerts,
_Out_writes_(nVerts) XMFLOAT4* tangents);
_Out_writes_(nVerts) XMFLOAT4* tangents) noexcept;
HRESULT __cdecl ComputeTangentFrame(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT3* normals,
_In_reads_(nVerts) const XMFLOAT2* texcoords, _In_ size_t nVerts,
_Out_writes_(nVerts) XMFLOAT4* tangents);
_Out_writes_(nVerts) XMFLOAT4* tangents) noexcept;
// Computes tangents and/or bi-tangents (optionally with handedness stored in .w)
//---------------------------------------------------------------------------------
// Mesh clean-up and validation
enum VALIDATE_FLAGS
enum VALIDATE_FLAGS : unsigned long
{
VALIDATE_DEFAULT = 0x0,
VALIDATE_DEFAULT = 0x0,
VALIDATE_BACKFACING = 0x1,
// Check for duplicate neighbor from triangle (requires adjacency)
VALIDATE_BACKFACING = 0x1,
// Check for duplicate neighbor from triangle (requires adjacency)
VALIDATE_BOWTIES = 0x2,
// Check for two fans of triangles using the same vertex (requires adjacency)
VALIDATE_BOWTIES = 0x2,
// Check for two fans of triangles using the same vertex (requires adjacency)
VALIDATE_DEGENERATE = 0x4,
// Check for degenerate triangles
VALIDATE_DEGENERATE = 0x4,
// Check for degenerate triangles
VALIDATE_UNUSED = 0x8,
// Check for issues with 'unused' triangles
VALIDATE_UNUSED = 0x8,
// Check for issues with 'unused' triangles
VALIDATE_ASYMMETRIC_ADJ = 0x10,
// Checks that neighbors are symmetric (requires adjacency)
VALIDATE_ASYMMETRIC_ADJ = 0x10,
// Checks that neighbors are symmetric (requires adjacency)
};
HRESULT __cdecl Validate(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_ size_t nVerts, _In_reads_opt_(nFaces * 3) const uint32_t* adjacency,
_In_ DWORD flags, _In_opt_ std::wstring* msgs = nullptr);
_In_ VALIDATE_FLAGS flags, _In_opt_ std::wstring* msgs = nullptr);
HRESULT __cdecl Validate(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_ size_t nVerts, _In_reads_opt_(nFaces * 3) const uint32_t* adjacency,
_In_ DWORD flags, _In_opt_ std::wstring* msgs = nullptr);
_In_ VALIDATE_FLAGS flags, _In_opt_ std::wstring* msgs = nullptr);
// Checks the mesh for common problems, return 'S_OK' if no problems were found
HRESULT __cdecl Clean(
@@ -361,6 +373,15 @@ namespace DirectX
_In_ std::function<bool __cdecl(uint32_t v0, uint32_t v1)> weldTest);
// Welds vertices together based on a test function
HRESULT __cdecl ConcatenateMesh(
_In_ size_t nFaces,
_In_ size_t nVerts,
_Out_writes_(nFaces) uint32_t* faceDestMap,
_Out_writes_(nVerts) uint32_t* vertexDestMap,
_Inout_ size_t& totalFaces,
_Inout_ size_t& totalVerts) noexcept;
// Merge meshes together
//---------------------------------------------------------------------------------
// Mesh Optimization
@@ -369,17 +390,17 @@ namespace DirectX
_Out_writes_(nFaces) uint32_t* faceRemap);
// Reorders faces by attribute id
enum OPTFACES
enum OPTFACES : uint32_t
{
OPTFACES_V_DEFAULT = 12,
OPTFACES_R_DEFAULT = 7,
// Default vertex cache size and restart threshold which is considered 'device independent'
OPTFACES_V_DEFAULT = 12,
OPTFACES_R_DEFAULT = 7,
// Default vertex cache size and restart threshold which is considered 'device independent'
OPTFACES_LRU_DEFAULT = 32,
// Default vertex cache size for the LRU algorithm
OPTFACES_LRU_DEFAULT = 32,
// Default vertex cache size for the LRU algorithm
OPTFACES_V_STRIPORDER = 0,
// Indicates no vertex cache optimization, only reordering into strips
OPTFACES_V_STRIPORDER = 0,
// Indicates no vertex cache optimization, only reordering into strips
};
HRESULT __cdecl OptimizeFaces(
@@ -432,10 +453,10 @@ namespace DirectX
HRESULT __cdecl OptimizeVertices(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces, _In_ size_t nVerts,
_Out_writes_(nVerts) uint32_t* vertexRemap, _Out_opt_ size_t* trailingUnused = nullptr);
_Out_writes_(nVerts) uint32_t* vertexRemap, _Out_opt_ size_t* trailingUnused = nullptr) noexcept;
HRESULT __cdecl OptimizeVertices(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces, _In_ size_t nVerts,
_Out_writes_(nVerts) uint32_t* vertexRemap, _Out_opt_ size_t* trailingUnused = nullptr);
_Out_writes_(nVerts) uint32_t* vertexRemap, _Out_opt_ size_t* trailingUnused = nullptr) noexcept;
// Reorders vertices in order of use
//---------------------------------------------------------------------------------
@@ -444,59 +465,59 @@ namespace DirectX
HRESULT __cdecl ReorderIB(
_In_reads_(nFaces * 3) const uint16_t* ibin, _In_ size_t nFaces,
_In_reads_(nFaces) const uint32_t* faceRemap,
_Out_writes_(nFaces * 3) uint16_t* ibout);
_Out_writes_(nFaces * 3) uint16_t* ibout) noexcept;
HRESULT __cdecl ReorderIB(
_Inout_updates_all_(nFaces * 3) uint16_t* ib, _In_ size_t nFaces,
_In_reads_(nFaces) const uint32_t* faceRemap);
_In_reads_(nFaces) const uint32_t* faceRemap) noexcept;
HRESULT __cdecl ReorderIB(
_In_reads_(nFaces * 3) const uint32_t* ibin, _In_ size_t nFaces,
_In_reads_(nFaces) const uint32_t* faceRemap,
_Out_writes_(nFaces * 3) uint32_t* ibout);
_Out_writes_(nFaces * 3) uint32_t* ibout) noexcept;
HRESULT __cdecl ReorderIB(
_Inout_updates_all_(nFaces * 3) uint32_t* ib, _In_ size_t nFaces,
_In_reads_(nFaces) const uint32_t* faceRemap);
_In_reads_(nFaces) const uint32_t* faceRemap) noexcept;
// Applies a face remap reordering to an index buffer
HRESULT __cdecl ReorderIBAndAdjacency(
_In_reads_(nFaces * 3) const uint16_t* ibin, _In_ size_t nFaces, _In_reads_(nFaces * 3) const uint32_t* adjin,
_In_reads_(nFaces) const uint32_t* faceRemap,
_Out_writes_(nFaces * 3) uint16_t* ibout, _Out_writes_(nFaces * 3) uint32_t* adjout);
_Out_writes_(nFaces * 3) uint16_t* ibout, _Out_writes_(nFaces * 3) uint32_t* adjout) noexcept;
HRESULT __cdecl ReorderIBAndAdjacency(
_Inout_updates_all_(nFaces * 3) uint16_t* ib, _In_ size_t nFaces, _Inout_updates_all_(nFaces * 3) uint32_t* adj,
_In_reads_(nFaces) const uint32_t* faceRemap);
_In_reads_(nFaces) const uint32_t* faceRemap) noexcept;
HRESULT __cdecl ReorderIBAndAdjacency(
_In_reads_(nFaces * 3) const uint32_t* ibin, _In_ size_t nFaces, _In_reads_(nFaces * 3) const uint32_t* adjin,
_In_reads_(nFaces) const uint32_t* faceRemap,
_Out_writes_(nFaces * 3) uint32_t* ibout, _Out_writes_(nFaces * 3) uint32_t* adjout);
_Out_writes_(nFaces * 3) uint32_t* ibout, _Out_writes_(nFaces * 3) uint32_t* adjout) noexcept;
HRESULT __cdecl ReorderIBAndAdjacency(
_Inout_updates_all_(nFaces * 3) uint32_t* ib, _In_ size_t nFaces, _Inout_updates_all_(nFaces * 3) uint32_t* adj,
_In_reads_(nFaces) const uint32_t* faceRemap);
_In_reads_(nFaces) const uint32_t* faceRemap) noexcept;
// Applies a face remap reordering to an index buffer and adjacency
HRESULT __cdecl FinalizeIB(
_In_reads_(nFaces * 3) const uint16_t* ibin, _In_ size_t nFaces,
_In_reads_(nVerts) const uint32_t* vertexRemap, _In_ size_t nVerts,
_Out_writes_(nFaces * 3) uint16_t* ibout);
_Out_writes_(nFaces * 3) uint16_t* ibout) noexcept;
HRESULT __cdecl FinalizeIB(
_Inout_updates_all_(nFaces * 3) uint16_t* ib, _In_ size_t nFaces,
_In_reads_(nVerts) const uint32_t* vertexRemap, _In_ size_t nVerts);
_In_reads_(nVerts) const uint32_t* vertexRemap, _In_ size_t nVerts) noexcept;
HRESULT __cdecl FinalizeIB(
_In_reads_(nFaces * 3) const uint32_t* ibin, _In_ size_t nFaces,
_In_reads_(nVerts) const uint32_t* vertexRemap, _In_ size_t nVerts,
_Out_writes_(nFaces * 3) uint32_t* ibout);
_Out_writes_(nFaces * 3) uint32_t* ibout) noexcept;
HRESULT __cdecl FinalizeIB(
_Inout_updates_all_(nFaces * 3) uint32_t* ib, _In_ size_t nFaces,
_In_reads_(nVerts) const uint32_t* vertexRemap, _In_ size_t nVerts);
_In_reads_(nVerts) const uint32_t* vertexRemap, _In_ size_t nVerts) noexcept;
// Applies a vertex remap reordering to an index buffer
HRESULT __cdecl FinalizeVB(
_In_reads_bytes_(nVerts*stride) const void* vbin, _In_ size_t stride, _In_ size_t nVerts,
_In_reads_opt_(nDupVerts) const uint32_t* dupVerts, _In_ size_t nDupVerts,
_In_reads_opt_(nVerts + nDupVerts) const uint32_t* vertexRemap,
_Out_writes_bytes_((nVerts + nDupVerts)*stride) void* vbout);
_Out_writes_bytes_((nVerts + nDupVerts)*stride) void* vbout) noexcept;
HRESULT __cdecl FinalizeVB(
_Inout_updates_bytes_all_(nVerts*stride) void* vb, _In_ size_t stride, _In_ size_t nVerts,
_In_reads_(nVerts) const uint32_t* vertexRemap);
_In_reads_(nVerts) const uint32_t* vertexRemap) noexcept;
// Applies a vertex remap and/or a vertex duplication set to a vertex buffer
HRESULT __cdecl FinalizeVBAndPointReps(
@@ -505,20 +526,125 @@ namespace DirectX
_In_reads_opt_(nDupVerts) const uint32_t* dupVerts, _In_ size_t nDupVerts,
_In_reads_opt_(nVerts + nDupVerts) const uint32_t* vertexRemap,
_Out_writes_bytes_((nVerts + nDupVerts)*stride) void* vbout,
_Out_writes_(nVerts + nDupVerts) uint32_t* prout);
_Out_writes_(nVerts + nDupVerts) uint32_t* prout) noexcept;
HRESULT __cdecl FinalizeVBAndPointReps(
_Inout_updates_bytes_all_(nVerts*stride) void* vb, _In_ size_t stride, _In_ size_t nVerts,
_Inout_updates_all_(nVerts) uint32_t* pointRep,
_In_reads_(nVerts) const uint32_t* vertexRemap);
_In_reads_(nVerts) const uint32_t* vertexRemap) noexcept;
// Applies a vertex remap and/or a vertex duplication set to a vertex buffer and point representatives
HRESULT __cdecl CompactVB(
_In_reads_bytes_(nVerts*stride) const void* vbin, _In_ size_t stride, _In_ size_t nVerts,
_In_ size_t trailingUnused,
_In_reads_opt_(nVerts) const uint32_t* vertexRemap,
_Out_writes_bytes_((nVerts - trailingUnused)*stride) void* vbout);
_Out_writes_bytes_((nVerts - trailingUnused)*stride) void* vbout) noexcept;
// Applies a vertex remap which contains a known number of unused entries at the end
//---------------------------------------------------------------------------------
// Meshlet Generation
constexpr size_t MESHLET_DEFAULT_MAX_VERTS = 128u;
constexpr size_t MESHLET_DEFAULT_MAX_PRIMS = 128u;
constexpr size_t MESHLET_MINIMUM_SIZE = 32u;
constexpr size_t MESHLET_MAXIMUM_SIZE = 256u;
enum MESHLET_FLAGS : unsigned long
{
MESHLET_DEFAULT = 0x0,
MESHLET_WIND_CW = 0x1,
// Vertices are clock-wise (defaults to CCW)
};
struct Meshlet
{
uint32_t VertCount;
uint32_t VertOffset;
uint32_t PrimCount;
uint32_t PrimOffset;
};
struct MeshletTriangle
{
uint32_t i0 : 10;
uint32_t i1 : 10;
uint32_t i2 : 10;
};
struct CullData
{
DirectX::BoundingSphere BoundingSphere; // xyz = center, w = radius
DirectX::PackedVector::XMUBYTEN4 NormalCone; // xyz = axis, w = -cos(a + 90)
float ApexOffset; // apex = center - axis * offset
};
HRESULT __cdecl ComputeMeshlets(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_reads_opt_(nFaces * 3) const uint32_t* adjacency,
_Inout_ std::vector<Meshlet>& meshlets,
_Inout_ std::vector<uint8_t>& uniqueVertexIB,
_Inout_ std::vector<MeshletTriangle>& primitiveIndices,
_In_ size_t maxVerts = MESHLET_DEFAULT_MAX_VERTS, _In_ size_t maxPrims = MESHLET_DEFAULT_MAX_PRIMS);
HRESULT __cdecl ComputeMeshlets(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_reads_opt_(nFaces * 3) const uint32_t* adjacency,
_Inout_ std::vector<Meshlet>& meshlets,
_Inout_ std::vector<uint8_t>& uniqueVertexIB,
_Inout_ std::vector<MeshletTriangle>& primitiveIndices,
_In_ size_t maxVerts = MESHLET_DEFAULT_MAX_VERTS, _In_ size_t maxPrims = MESHLET_DEFAULT_MAX_PRIMS);
// Generates meshlets for a single subset mesh
HRESULT __cdecl ComputeMeshlets(
_In_reads_(nFaces * 3) const uint16_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_reads_(nSubsets) const std::pair<size_t, size_t>* subsets, _In_ size_t nSubsets,
_In_reads_opt_(nFaces * 3) const uint32_t* adjacency,
_Inout_ std::vector<Meshlet>& meshlets,
_Inout_ std::vector<uint8_t>& uniqueVertexIB,
_Inout_ std::vector<MeshletTriangle>& primitiveIndices,
_Out_writes_(nSubsets) std::pair<size_t, size_t>* meshletSubsets,
_In_ size_t maxVerts = MESHLET_DEFAULT_MAX_VERTS, _In_ size_t maxPrims = MESHLET_DEFAULT_MAX_PRIMS);
HRESULT __cdecl ComputeMeshlets(
_In_reads_(nFaces * 3) const uint32_t* indices, _In_ size_t nFaces,
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_reads_(nSubsets) const std::pair<size_t, size_t>* subsets, _In_ size_t nSubsets,
_In_reads_opt_(nFaces * 3) const uint32_t* adjacency,
_Inout_ std::vector<Meshlet>& meshlets,
_Inout_ std::vector<uint8_t>& uniqueVertexIB,
_Inout_ std::vector<MeshletTriangle>& primitiveIndices,
_Out_writes_(nSubsets) std::pair<size_t, size_t>* meshletSubsets,
_In_ size_t maxVerts = MESHLET_DEFAULT_MAX_VERTS, _In_ size_t maxPrims = MESHLET_DEFAULT_MAX_PRIMS);
// Generates meshlets for a mesh with several face subsets
HRESULT __cdecl ComputeCullData(
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_reads_(nMeshlets) const Meshlet* meshlets, _In_ size_t nMeshlets,
_In_reads_(nVertIndices) const uint16_t* uniqueVertexIndices, _In_ size_t nVertIndices,
_In_reads_(nPrimIndices) const MeshletTriangle* primitiveIndices, _In_ size_t nPrimIndices,
_Out_writes_(nMeshlets) CullData* cullData,
_In_ MESHLET_FLAGS flags = MESHLET_DEFAULT) noexcept;
HRESULT __cdecl ComputeCullData(
_In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
_In_reads_(nMeshlets) const Meshlet* meshlets, _In_ size_t nMeshlets,
_In_reads_(nVertIndices) const uint32_t* uniqueVertexIndices, _In_ size_t nVertIndices,
_In_reads_(nPrimIndices) const MeshletTriangle* primitiveIndices, _In_ size_t nPrimIndices,
_Out_writes_(nMeshlets) CullData* cullData,
_In_ MESHLET_FLAGS flags = MESHLET_DEFAULT) noexcept;
// Computes culling data for each input meshlet
//---------------------------------------------------------------------------------
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
#include "DirectXMesh.inl"
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace

View File

@@ -1,9 +1,9 @@
//-------------------------------------------------------------------------------------
// DirectXMesh.inl
//
//
// DirectX Mesh Geometry Library
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=324981
@@ -11,17 +11,25 @@
#pragma once
//=====================================================================================
// Bitmask flags enumerator operators
//=====================================================================================
DEFINE_ENUM_FLAG_OPERATORS(CNORM_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(VALIDATE_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(MESHLET_FLAGS);
//=====================================================================================
// DXGI Format Utilities
//=====================================================================================
_Use_decl_annotations_
inline bool __cdecl IsValidVB(DXGI_FORMAT fmt)
inline bool __cdecl IsValidVB(DXGI_FORMAT fmt) noexcept
{
return BytesPerElement(fmt) != 0;
}
_Use_decl_annotations_
inline bool __cdecl IsValidIB(DXGI_FORMAT fmt)
constexpr bool __cdecl IsValidIB(DXGI_FORMAT fmt) noexcept
{
return (fmt == DXGI_FORMAT_R32_UINT || fmt == DXGI_FORMAT_R16_UINT) != 0;
}

View File

@@ -1,21 +1,21 @@
The MIT License (MIT)
MIT License
Copyright (c) 2014-2019 Microsoft Corp
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

View File

@@ -1,21 +1,21 @@
The MIT License (MIT)
MIT License
Copyright (c) 2014-2019 Microsoft Corp
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

View File

@@ -1,7 +1,7 @@
//-------------------------------------------------------------------------------------
// UVAtlas
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=512686
@@ -9,21 +9,41 @@
#pragma once
#include <stdint.h>
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#ifdef _WIN32
#ifdef _GAMING_XBOX_SCARLETT
#pragma warning(push)
#pragma warning(disable: 5204 5249)
#include <d3d12_xs.h>
#pragma warning(pop)
#elif defined(_GAMING_XBOX)
#pragma warning(push)
#pragma warning(disable: 5204)
#include <d3d12_x.h>
#pragma warning(pop)
#elif defined(_XBOX_ONE) && defined(_TITLE)
#error This library no longer supports legacy Xbox One XDK
#else
#include <Windows.h>
#ifdef USING_DIRECTX_HEADERS
#include <directx/dxgiformat.h>
#else
#include <windows.h>
#include <dxgiformat.h>
#endif
#endif
#else // !WIN32
#include <directx/dxgiformat.h>
#include <wsl/winadapter.h>
#endif
#include <DirectXMath.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <vector>
#define UVATLAS_VERSION 160
#include <DirectXMath.h>
#define UVATLAS_VERSION 187
namespace DirectX
{
@@ -37,28 +57,28 @@ namespace DirectX
// UVATLAS_IMT_WRAP_U means the texture wraps in the U direction
// UVATLAS_IMT_WRAP_V means the texture wraps in the V direction
// UVATLAS_IMT_WRAP_UV means the texture wraps in both directions
enum UVATLAS_IMT
enum UVATLAS_IMT : unsigned int
{
UVATLAS_IMT_DEFAULT = 0x00,
UVATLAS_IMT_WRAP_U = 0x01,
UVATLAS_IMT_WRAP_V = 0x02,
UVATLAS_IMT_WRAP_UV = 0x03,
UVATLAS_IMT_VALIDBITS = 0x03,
};
// These options are only valid for UVAtlasCreate and UVAtlasPartition
// UVATLAS_DEFAULT - Meshes with more than 25k faces go through fast, meshes with fewer than 25k faces go through quality
// UVATLAS_GEODESIC_FAST - Uses approximations to improve charting speed at the cost of added stretch or more charts.
// UVATLAS_GEODESIC_QUALITY - Provides better quality charts, but requires more time and memory than fast.
enum UVATLAS
enum UVATLAS : unsigned int
{
UVATLAS_DEFAULT = 0x00,
UVATLAS_GEODESIC_FAST = 0x01,
UVATLAS_GEODESIC_QUALITY = 0x02,
UVATLAS_PARTITIONVALIDBITS = 0x03,
UVATLAS_LIMIT_MERGE_STRETCH = 0x04,
UVATLAS_LIMIT_FACE_STRETCH = 0x08,
};
static const float UVATLAS_DEFAULT_CALLBACK_FREQUENCY = 0.0001f;
constexpr float UVATLAS_DEFAULT_CALLBACK_FREQUENCY = 0.0001f;
//============================================================================
//
@@ -94,7 +114,7 @@ namespace DirectX
// integrated metric tensor for that face. This lets you control
// the way this triangle may be stretched in the atlas. The IMT
// passed in will be 3 floats (a,b,c) and specify a symmetric
// matrix (a b) that, given a vector (s,t), specifies the
// matrix (a b) that, given a vector (s,t), specifies the
// (b c)
// distance between a vector v1 and a vector v2 = v1 + (s,t) as
// sqrt((s, t) * M * (s, t)^T).
@@ -129,8 +149,8 @@ namespace DirectX
HRESULT __cdecl UVAtlasCreate(
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_ size_t maxChartNumber,
@@ -138,18 +158,18 @@ namespace DirectX
_In_ size_t width,
_In_ size_t height,
_In_ float gutter,
_In_reads_(nFaces*3) const uint32_t *adjacency,
_In_reads_opt_(nFaces*3) const uint32_t *falseEdgeAdjacency,
_In_reads_opt_(nFaces*3) const float *pIMTArray,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_reads_(nFaces * 3) const uint32_t* adjacency,
_In_reads_opt_(nFaces * 3) const uint32_t* falseEdgeAdjacency,
_In_reads_opt_(nFaces * 3) const float* pIMTArray,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ float callbackFrequency,
_In_ DWORD options,
_In_ UVATLAS options,
_Inout_ std::vector<UVAtlasVertex>& vMeshOutVertexBuffer,
_Inout_ std::vector<uint8_t>& vMeshOutIndexBuffer,
_Inout_opt_ std::vector<uint32_t>* pvFacePartitioning = nullptr,
_Inout_opt_ std::vector<uint32_t>* pvVertexRemapArray = nullptr,
_Out_opt_ float *maxStretchOut = nullptr,
_Out_opt_ size_t *numChartsOut = nullptr);
_Inout_ std::vector<uint8_t>& vMeshOutIndexBuffer,
_Inout_opt_ std::vector<uint32_t>* pvFacePartitioning = nullptr,
_Inout_opt_ std::vector<uint32_t>* pvVertexRemapArray = nullptr,
_Out_opt_ float* maxStretchOut = nullptr,
_Out_opt_ size_t* numChartsOut = nullptr);
// This has the same exact arguments as Create, except that it does not perform the
// final packing step. This method allows one to get a partitioning out, and possibly
@@ -178,25 +198,25 @@ namespace DirectX
HRESULT __cdecl UVAtlasPartition(
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_ size_t maxChartNumber,
_In_ float maxStretch,
_In_reads_(nFaces*3) const uint32_t *adjacency,
_In_reads_opt_(nFaces*3) const uint32_t *falseEdgeAdjacency,
_In_reads_opt_(nFaces*3) const float *pIMTArray,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_reads_(nFaces * 3) const uint32_t* adjacency,
_In_reads_opt_(nFaces * 3) const uint32_t* falseEdgeAdjacency,
_In_reads_opt_(nFaces * 3) const float* pIMTArray,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ float callbackFrequency,
_In_ DWORD options,
_In_ UVATLAS options,
_Inout_ std::vector<UVAtlasVertex>& vMeshOutVertexBuffer,
_Inout_ std::vector<uint8_t>& vMeshOutIndexBuffer,
_Inout_opt_ std::vector<uint32_t>* pvFacePartitioning,
_Inout_opt_ std::vector<uint32_t>* pvVertexRemapArray,
_Inout_ std::vector<uint32_t>& vPartitionResultAdjacency,
_Out_opt_ float *maxStretchOut = nullptr,
_Out_opt_ size_t *numChartsOut = nullptr);
_Out_opt_ float* maxStretchOut = nullptr,
_Out_opt_ size_t* numChartsOut = nullptr);
// This takes the face partitioning result from Partition and packs it into an
// atlas of the given size. pPartitionResultAdjacency should be derived from
@@ -209,7 +229,7 @@ namespace DirectX
_In_ size_t height,
_In_ float gutter,
_In_ const std::vector<uint32_t>& vPartitionResultAdjacency,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ float callbackFrequency);
@@ -244,14 +264,14 @@ namespace DirectX
HRESULT __cdecl UVAtlasComputeIMTFromPerVertexSignal(
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_reads_(signalStride*nVerts) const float *pVertexSignal,
_In_reads_(signalStride* nVerts) const float* pVertexSignal,
_In_ size_t signalDimension,
_In_ size_t signalStride,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
// This function is used to calculate the IMT from data that varies over the
@@ -275,16 +295,16 @@ namespace DirectX
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT2* texcoords,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_ size_t signalDimension,
_In_ float maxUVDistance,
_In_ std::function<HRESULT __cdecl(const DirectX::XMFLOAT2 *uv, size_t primitiveID, size_t signalDimension, void* userData, float* signalOut)>
signalCallback,
_In_opt_ void *userData,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ std::function<HRESULT __cdecl(const DirectX::XMFLOAT2* uv, size_t primitiveID, size_t signalDimension, void* userData, float* signalOut)>
signalCallback,
_In_opt_ void* userData,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
// This function is used to calculate the IMT from texture data. Given a texture
@@ -300,15 +320,15 @@ namespace DirectX
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT2* texcoords,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_reads_(width*height*4) const float* pTexture,
_In_reads_(width* height * 4) const float* pTexture,
_In_ size_t width,
_In_ size_t height,
_In_ DWORD options,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ UVATLAS_IMT options,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
// This function is very similar to UVAtlasComputeIMTFromTexture, but it can
@@ -325,17 +345,17 @@ namespace DirectX
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT2* texcoords,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * 3 * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_reads_(width*height*nComponents) const float *pTexelSignal,
_In_reads_(width* height* nComponents) const float* pTexelSignal,
_In_ size_t width,
_In_ size_t height,
_In_ size_t signalDimension,
_In_ size_t nComponents,
_In_ DWORD options,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ UVATLAS_IMT options,
_In_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
// This function is for applying the a vertex remap array from UVAtlasCreate/UVAtlasPartition to a vertex buffer
@@ -344,10 +364,22 @@ namespace DirectX
// vbout - This is the output vertex buffer and is nNewVerts*stride in size
// nNewVerts - This should be >= nVerts
HRESULT __cdecl UVAtlasApplyRemap(
_In_reads_bytes_(nVerts*stride) const void* vbin,
_In_reads_bytes_(nVerts* stride) const void* vbin,
_In_ size_t stride,
_In_ size_t nVerts,
_In_ size_t nNewVerts,
_In_reads_(nNewVerts) const uint32_t* vertexRemap,
_Out_writes_bytes_(nNewVerts*stride) void* vbout );
}
_Out_writes_bytes_(nNewVerts* stride) void* vbout) noexcept;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
DEFINE_ENUM_FLAG_OPERATORS(UVATLAS_IMT);
DEFINE_ENUM_FLAG_OPERATORS(UVATLAS);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System.IO;
using Flax.Build;
@@ -32,14 +32,14 @@ namespace Flax.Deps.Dependencies
public override void Build(BuildOptions options)
{
var root = options.IntermediateFolder;
var solutionPath = Path.Combine(root, "DirectXMesh_Desktop_2015.sln");
var solutionPath = Path.Combine(root, "DirectXMesh_Desktop_2022_Win10.sln");
var configuration = "Release";
var outputFileNames = new[]
{
"DirectXMesh.lib",
"DirectXMesh.pdb",
};
var binFolder = Path.Combine(root, "DirectXMesh", "Bin", "Desktop_2015");
var binFolder = Path.Combine(root, "DirectXMesh", "Bin", "Desktop_2022_Win10");
// Get the source
CloneGitRepoFast(root, "https://github.com/Microsoft/DirectXMesh.git");
@@ -50,14 +50,15 @@ namespace Flax.Deps.Dependencies
{
case TargetPlatform.Windows:
{
// Build for Win64
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, TargetArchitecture.x64);
foreach (var file in outputFileNames)
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
Utilities.FileCopy(Path.Combine(binFolder, "x64", "Release", file), Path.Combine(depsFolder, file));
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, architecture);
foreach (var file in outputFileNames)
{
Utilities.FileCopy(Path.Combine(binFolder, architecture.ToString(), "Release", file), Path.Combine(depsFolder, file));
}
}
break;
}
}

View File

@@ -52,12 +52,15 @@ namespace Flax.Deps.Dependencies
{
case TargetPlatform.Windows:
{
var solutionPath = Path.Combine(root, "DirectXTex_Desktop_2022.sln");
var binFolder = Path.Combine(root, "DirectXTex", "Bin", "Desktop_2022");
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
foreach (var file in outputFileNames)
Utilities.FileCopy(Path.Combine(binFolder, "x64", configuration, file), Path.Combine(depsFolder, file));
var solutionPath = Path.Combine(root, "DirectXTex_Desktop_2022_Win10.sln");
var binFolder = Path.Combine(root, "DirectXTex", "Bin", "Desktop_2022_Win10");
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in outputFileNames)
Utilities.FileCopy(Path.Combine(binFolder, architecture.ToString(), configuration, file), Path.Combine(depsFolder, file));
}
break;
}
case TargetPlatform.UWP:

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System.Collections.Generic;
using System.IO;
using Flax.Build;
@@ -32,14 +33,14 @@ namespace Flax.Deps.Dependencies
public override void Build(BuildOptions options)
{
var root = options.IntermediateFolder;
var solutionPath = Path.Combine(root, "UVAtlas", "UVAtlas_2015.sln");
var solutionPath = Path.Combine(root, "UVAtlas_2022_Win10.sln");
var configuration = "Release";
var outputFileNames = new[]
{
"UVAtlas.lib",
"UVAtlas.pdb",
};
var binFolder = Path.Combine(root, "UVAtlas", "Bin", "Desktop_2015");
var binFolder = Path.Combine(root, "UVAtlas", "Bin", "Desktop_2022_Win10");
// Get the source
CloneGitRepoFast(root, "https://github.com/Microsoft/UVAtlas.git");
@@ -51,13 +52,15 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Windows:
{
// Build for Win64
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, TargetArchitecture.x64);
foreach (var file in outputFileNames)
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
Utilities.FileCopy(Path.Combine(binFolder, "x64", "Release", file), Path.Combine(depsFolder, file));
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString(), new Dictionary<string, string>() { { "RestorePackagesConfig", "true" } });
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, architecture);
foreach (var file in outputFileNames)
{
Utilities.FileCopy(Path.Combine(binFolder, architecture.ToString(), "Release", file), Path.Combine(depsFolder, file));
}
}
break;
}
}