Skip to content

Commit

Permalink
removed unused fileextensions, added tests for the lib
Browse files Browse the repository at this point in the history
  • Loading branch information
drzhn committed Apr 28, 2023
1 parent 85ca309 commit 86536ad
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 25 deletions.
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
*.ilk
*.VC.db
*.nupkg
*.obj
*.pdb
*.ipdb
*.idb
*.iobj
*.txt
*.recipe
*.res
.vs
[Bb]in
packages
Expand All @@ -25,14 +33,10 @@ packages
/DirectXTex/Shaders/Compiled/*.inc
/DirectXTex/Shaders/Compiled/*.pdb
/ipch
Debug
Durango
Gaming.Xbox.XboxOne.x64
Gaming.Xbox.Scarlett.x64
Gaming.Desktop.x64
Profile
Release
x64
/Tests
/wiki
/out
Expand Down
3 changes: 0 additions & 3 deletions Texconv/Texconv_Desktop_2022_Win10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,6 @@
<ClCompile Include="PortablePixMap.cpp" />
<ClCompile Include="Texconv.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Texconv.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DirectXTex\DirectXTex_Desktop_2022_Win10.vcxproj">
<Project>{371b9fa9-4c90-4ac6-a123-aced756d6c77}</Project>
Expand Down
11 changes: 0 additions & 11 deletions Texconv/Texconv_Desktop_2022_Win10.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<?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>
<ClCompile Include="Texconv.cpp" />
<ClCompile Include="PortablePixMap.cpp" />
<ClCompile Include="ExtendedBMP.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Texconv.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\Texconv.h" />
</ItemGroup>
Expand Down
12 changes: 8 additions & 4 deletions Texconv/texconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ namespace
namespace TextureConversion
{

int Convert(TexconvConversionParams* params)
int Convert(TexconvConversionParams* params, uint64_t options, const char* filePath)
{
if (!params)
{
Expand Down Expand Up @@ -1341,13 +1341,18 @@ int Convert(TexconvConversionParams* params)
}

// Process command line
uint64_t dwOptions = 0;
uint64_t dwOptions = options;
std::list<SConversion> conversion;

SConversion conv = {};
std::filesystem::path path(filePath);
wcscpy_s(conv.szSrc, path.make_preferred().c_str());
conversion.push_back(conv);

//bool allowOpts = true;
//for (int iArg = 1; iArg < argc; iArg++)
//{
// PWSTR pArg = argv[iArg];

// if (allowOpts
// && ('-' == pArg[0]) && ('-' == pArg[1]))
// {
Expand Down Expand Up @@ -1377,7 +1382,6 @@ int Convert(TexconvConversionParams* params)
// {
// pArg++;
// PWSTR pValue;

// for (pValue = pArg; *pValue && (':' != *pValue); pValue++);

// if (*pValue)
Expand Down
14 changes: 12 additions & 2 deletions TexconvTests/tests.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#include "Texconv.h"

int main ()
int main()
{
TextureConversion::Convert(nullptr);
TextureConversion::TexconvConversionParams params;

params.format = DXGI_FORMAT_BC1_UNORM;

uint64_t options =
(1 << OPT_MIPLEVELS) |
(1 << OPT_FORMAT) |
(1 << OPT_FIT_POWEROF2) |
(1 << OPT_OVERWRITE);

TextureConversion::Convert(&params, options, "pngTexture.png");
return 0;
}
2 changes: 1 addition & 1 deletion include/Texconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,6 @@ namespace TextureConversion
};


int Convert(TexconvConversionParams* params);
int Convert(TexconvConversionParams* params, uint64_t options, const char* filePath);
}
#endif // TEXCONV_H
Binary file added lib/x64/Release/texconv.lib
Binary file not shown.

0 comments on commit 86536ad

Please sign in to comment.