-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BasisImporter: Initial implementation and test
Signed-off-by: Squareys <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,220 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
# This file is part of Magnum. | ||
# | ||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 | ||
# Vladimír Vondruš <[email protected]> | ||
# | ||
# 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. | ||
# | ||
|
||
find_package(Corrade REQUIRED PluginManager) | ||
|
||
# On MSVC remove /W3, as we are replacing it with /W4 | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") | ||
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
endif() | ||
|
||
set_directory_properties(PROPERTIES | ||
CORRADE_CXX_STANDARD 11 | ||
CORRADE_USE_PEDANTIC_FLAGS ON) | ||
|
||
# Emscripten needs special flag to use WebGL 2 | ||
if(CORRADE_TARGET_EMSCRIPTEN AND NOT TARGET_GLES2) | ||
# TODO: give me INTERFACE_LINK_OPTIONS or something, please | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") | ||
endif() | ||
|
||
if(WITH_BASISIMPORTER) | ||
add_library(snippets-BasisImporter STATIC | ||
MagnumPluginsBasisImporter.cpp) | ||
if(BUILD_PLUGINS_STATIC) | ||
target_link_libraries(snippets-BasisImporter PRIVATE BasisImporter) | ||
endif() | ||
target_link_libraries(snippets-BasisImporter PRIVATE Corrade::PluginManager) | ||
set_target_properties(snippets-BasisImporter PROPERTIES FOLDER "Magnum/doc/snippets") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <Corrade/PluginManager/Manager.h> | ||
#include <Corrade/Utility/ConfigurationGroup.h> | ||
|
||
#include <Magnum/Trade/AbstractImporter.h> | ||
|
||
#ifdef __has_include | ||
#if __has_include(<MagnumPlugins/BasisImporter/importStaticPlugin.cpp>) | ||
/* No need to do this if you use CMake */ | ||
#include <MagnumPlugins/BasisImporter/importStaticPlugin.cpp> | ||
#endif | ||
#endif | ||
|
||
using namespace Magnum; | ||
|
||
int main() { | ||
|
||
{ | ||
PluginManager::Manager<Trade::AbstractImporter> manager; | ||
/* [basis-target-format-suffix] */ | ||
/* Choose Etc2 target format */ | ||
Containers::Pointer<Trade::AbstractImporter> importerEtc2 = | ||
manager.instantiate("BasisImporterEtc2"); | ||
|
||
/* Choose Bc5 target format */ | ||
Containers::Pointer<Trade::AbstractImporter> importerBc5 = | ||
manager.instantiate("BasisImporterBc5"); | ||
/* [basis-target-format-suffix] */ | ||
} | ||
|
||
{ | ||
PluginManager::Manager<Trade::AbstractImporter> manager; | ||
/* [basis-target-format-config] */ | ||
/* Chooses default Etc2 target format */ | ||
Containers::Pointer<Trade::AbstractImporter> importer = | ||
manager.instantiate("BasisImporter"); | ||
|
||
/* Change to Bc5 */ | ||
importer->configuration().setValue("format", "Bc5"); | ||
/* [basis-target-format-config] */ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
This file is part of Magnum. | ||
|
||
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 | ||
Vladimír Vondruš <[email protected]> | ||
|
||
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. | ||
*/ | ||
|
||
#define MAGNUM_PLUGINS_IMPORTER_DIR "${MAGNUM_PLUGINS_IMPORTER_DIR}" | ||
#define SNIPPETS_DIR "${SNIPPETS_DIR}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
# This command will not try to find any actual plugin. The plugins are: | ||
# | ||
# AssimpImporter - Assimp importer | ||
# BasisImporter - Basis importer | ||
# DdsImporter - DDS importer | ||
# DevIlImageImporter - Image importer using DevIL | ||
# DrFlacAudioImporter - FLAC audio importer using dr_flac | ||
|
@@ -69,6 +70,7 @@ | |
# | ||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 | ||
# Vladimír Vondruš <[email protected]> | ||
# Copyright © 2019 Jonathan Hale <[email protected]> | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a | ||
# copy of this software and associated documentation files (the "Software"), | ||
|
@@ -121,7 +123,7 @@ mark_as_advanced(MAGNUMPLUGINS_INCLUDE_DIR) | |
# components from other repositories) | ||
set(_MAGNUMPLUGINS_LIBRARY_COMPONENT_LIST OpenDdl) | ||
set(_MAGNUMPLUGINS_PLUGIN_COMPONENT_LIST | ||
AssimpImporter DdsImporter DevIlImageImporter | ||
AssimpImporter BasisImporter DdsImporter DevIlImageImporter | ||
DrFlacAudioImporter DrMp3AudioImporter DrWavAudioImporter Faad2AudioImporter | ||
FreeTypeFont HarfBuzzFont JpegImageConverter JpegImporter | ||
MiniExrImageConverter OpenGexImporter PngImageConverter PngImporter | ||
|
@@ -271,6 +273,12 @@ foreach(_component ${MagnumPlugins_FIND_COMPONENTS}) | |
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY | ||
INTERFACE_LINK_LIBRARIES Assimp::Assimp) | ||
|
||
# BasisImporter plugin dependencies | ||
if(_component STREQUAL BasisImporter) | ||
find_package(BasisUniversal) | ||
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY | ||
INTERFACE_LINK_LIBRARIES BasisUniversal::Transcoder) | ||
|
||
# DdsImporter has no dependencies | ||
|
||
# DevIlImageImporter plugin dependencies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# | ||
# | ||
# This file is part of Magnum. | ||
# | ||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
provides=BasisImporterEtc1 | ||
provides=BasisImporterEtc2 | ||
provides=BasisImporterBc1 | ||
provides=BasisImporterBc3 | ||
provides=BasisImporterBc4 | ||
provides=BasisImporterBc5 | ||
provides=BasisImporterBc7M6OpaqueOnly | ||
provides=BasisImporterPvrtc1_4OpaqueOnly | ||
|
||
# [configuration] | ||
[configuration] | ||
|
||
# No format is specified by default and you have to choose one either | ||
# by changing this value or by loading the plugin under an alias. See | ||
# class documentation for more information. | ||
format= | ||
# [configuration] |
Oops, something went wrong.