mirror of
https://github.com/microsoft/UVAtlas
synced 2024-11-09 13:50:05 +00:00
Updates for strongly-typed enum bitmasks in DirectXMesh
This commit is contained in:
parent
f7919a8b76
commit
a47bf11795
@ -63,7 +63,7 @@ namespace
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
DWORD bytes = static_cast<DWORD>(sizeof(wchar_t) * length);
|
||||
auto bytes = static_cast<DWORD>(sizeof(wchar_t) * length);
|
||||
|
||||
if (!WriteFile(hFile, value, bytes, &bytesWritten, nullptr))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -369,7 +369,7 @@ HRESULT Mesh::SetVertexData(_Inout_ DirectX::VBReader& reader, _In_ size_t nVert
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
_Use_decl_annotations_
|
||||
HRESULT Mesh::Validate(DWORD flags, std::wstring* msgs) const
|
||||
HRESULT Mesh::Validate(DirectX::VALIDATE_FLAGS flags, std::wstring* msgs) const
|
||||
{
|
||||
if (!mnFaces || !mIndices || !mnVerts)
|
||||
return E_UNEXPECTED;
|
||||
@ -548,7 +548,7 @@ HRESULT Mesh::GenerateAdjacency(_In_ float epsilon)
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT Mesh::ComputeNormals(_In_ DWORD flags)
|
||||
HRESULT Mesh::ComputeNormals(_In_ DirectX::CNORM_FLAGS flags)
|
||||
{
|
||||
if (!mnFaces || !mIndices || !mnVerts || !mPositions)
|
||||
return E_UNEXPECTED;
|
||||
@ -1188,7 +1188,7 @@ HRESULT Mesh::ExportToVBO(const wchar_t* szFileName) const
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
DWORD vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);
|
||||
auto vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);
|
||||
|
||||
DWORD bytesWritten;
|
||||
if (!WriteFile(hFile.get(), vb.get(), vertSize, &bytesWritten, nullptr))
|
||||
@ -1197,7 +1197,7 @@ HRESULT Mesh::ExportToVBO(const wchar_t* szFileName) const
|
||||
if (bytesWritten != vertSize)
|
||||
return E_FAIL;
|
||||
|
||||
DWORD indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);
|
||||
auto indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);
|
||||
|
||||
if (!WriteFile(hFile.get(), ib.get(), indexSize, &bytesWritten, nullptr))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -1270,7 +1270,7 @@ HRESULT Mesh::CreateFromVBO(const wchar_t* szFileName, std::unique_ptr<Mesh>& re
|
||||
if (!vb || !ib)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
DWORD vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);
|
||||
auto vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);
|
||||
|
||||
if (!ReadFile(hFile.get(), vb.get(), vertSize, &bytesRead, nullptr))
|
||||
{
|
||||
@ -1280,7 +1280,7 @@ HRESULT Mesh::CreateFromVBO(const wchar_t* szFileName, std::unique_ptr<Mesh>& re
|
||||
if (bytesRead != vertSize)
|
||||
return E_FAIL;
|
||||
|
||||
DWORD indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);
|
||||
auto indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);
|
||||
|
||||
if (!ReadFile(hFile.get(), ib.get(), indexSize, &bytesRead, nullptr))
|
||||
{
|
||||
@ -1766,7 +1766,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
DWORD indexSize = static_cast<DWORD>(sizeof(uint16_t) * nIndices);
|
||||
auto indexSize = static_cast<DWORD>(sizeof(uint16_t) * nIndices);
|
||||
|
||||
DWORD bytesWritten;
|
||||
if (!WriteFile(hFile.get(), ib.get(), indexSize, &bytesWritten, nullptr))
|
||||
@ -1786,7 +1786,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
DWORD vertSize = static_cast<DWORD>(sizeof(Vertex) * mnVerts);
|
||||
auto vertSize = static_cast<DWORD>(sizeof(Vertex) * mnVerts);
|
||||
|
||||
if (!WriteFile(hFile.get(), vb.get(), vertSize, &bytesWritten, nullptr))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -1807,7 +1807,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
DWORD skinVertSize = static_cast<DWORD>(sizeof(SkinningVertex) * mnVerts);
|
||||
auto skinVertSize = static_cast<DWORD>(sizeof(SkinningVertex) * mnVerts);
|
||||
|
||||
if (!WriteFile(hFile.get(), vbSkin.get(), skinVertSize, &bytesWritten, nullptr))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -2374,7 +2374,7 @@ HRESULT Mesh::ExportToSDKMESH(const wchar_t* szFileName, size_t nMaterials, cons
|
||||
return hr;
|
||||
|
||||
// Write subsets
|
||||
DWORD bytesToWrite = static_cast<DWORD>(sizeof(SDKMESH_SUBSET) * submeshes.size());
|
||||
auto bytesToWrite = static_cast<DWORD>(sizeof(SDKMESH_SUBSET) * submeshes.size());
|
||||
DWORD bytesWritten;
|
||||
if (!WriteFile(hFile.get(), submeshes.data(), bytesToWrite, &bytesWritten, nullptr))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
|
@ -48,13 +48,13 @@ public:
|
||||
|
||||
HRESULT SetVertexData(_Inout_ DirectX::VBReader& reader, _In_ size_t nVerts);
|
||||
|
||||
HRESULT Validate(_In_ DWORD flags, _In_opt_ std::wstring* msgs) const;
|
||||
HRESULT Validate(_In_ DirectX::VALIDATE_FLAGS flags, _In_opt_ std::wstring* msgs) const;
|
||||
|
||||
HRESULT Clean(_In_ bool breakBowties = false);
|
||||
|
||||
HRESULT GenerateAdjacency(_In_ float epsilon);
|
||||
|
||||
HRESULT ComputeNormals(_In_ DWORD flags);
|
||||
HRESULT ComputeNormals(_In_ DirectX::CNORM_FLAGS flags);
|
||||
|
||||
HRESULT ComputeTangentFrame(_In_ bool bitangents);
|
||||
|
||||
|
@ -842,7 +842,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
if ((dwOptions & (DWORD64(1) << OPT_NORMALS))
|
||||
|| ((dwOptions & ((DWORD64(1) << OPT_TANGENTS) | (DWORD64(1) << OPT_CTF))) && !inMesh->GetNormalBuffer()))
|
||||
{
|
||||
DWORD flags = CNORM_DEFAULT;
|
||||
CNORM_FLAGS flags = CNORM_DEFAULT;
|
||||
|
||||
if (dwOptions & (DWORD64(1) << OPT_WEIGHT_BY_EQUAL))
|
||||
{
|
||||
@ -920,7 +920,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
#endif
|
||||
else
|
||||
{
|
||||
hr = LoadFromWICFile(szTexFile, TEX_FILTER_DEFAULT, nullptr, iimage);
|
||||
hr = LoadFromWICFile(szTexFile, WIC_FLAGS_NONE, nullptr, iimage);
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user