Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added public API for Material module
Now the wadmapconverter and dehread plugins compile and link successfully.
- Loading branch information
Showing
13 changed files
with
87 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef DOOMSDAY_API_MATERIAL_H | ||
#define DOOMSDAY_API_MATERIAL_H | ||
|
||
#include "api_base.h" | ||
#include "api_uri.h" | ||
|
||
/** | ||
* @defgroup material Materials | ||
* @ingroup resource | ||
*/ | ||
///@{ | ||
|
||
DENG_API_TYPEDEF(Material) | ||
{ | ||
de_api_t api; | ||
|
||
materialid_t (*IdForTextureUri)(Uri const *textureUri); | ||
Uri *(*ComposeUri)(materialid_t materialId); | ||
} | ||
DENG_API_T(Material); | ||
|
||
#ifndef DENG_NO_API_MACROS_MATERIALS | ||
#define DD_MaterialForTextureUri _api_Material.IdForTextureUri | ||
#define Materials_ComposeUri _api_Material.ComposeUri | ||
#endif | ||
|
||
#ifdef __DOOMSDAY__ | ||
DENG_USING_API(Material); | ||
#endif | ||
|
||
///@} | ||
|
||
#endif // DOOMSDAY_API_MATERIAL_H |
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,36 @@ | ||
#define DENG_NO_API_MACROS_MATERIALS | ||
|
||
#include "de_base.h" | ||
#include "de_resource.h" | ||
#include "api_material.h" | ||
|
||
materialid_t DD_MaterialForTextureUri(uri_s const *_textureUri) | ||
{ | ||
if(!_textureUri) return NOMATERIALID; | ||
|
||
try | ||
{ | ||
de::Uri uri = App_Textures()->find(reinterpret_cast<de::Uri const &>(*_textureUri)).composeUri(); | ||
uri.setScheme(DD_MaterialSchemeNameForTextureScheme(uri.scheme())); | ||
return App_Materials()->resolveUri2(uri, true/*quiet please*/); | ||
} | ||
catch(de::Textures::UnknownSchemeError const &er) | ||
{ | ||
// Log but otherwise ignore this error. | ||
LOG_WARNING(er.asText() + ", ignoring."); | ||
} | ||
catch(de::Textures::NotFoundError const &) | ||
{} // Ignore this error. | ||
|
||
return NOMATERIALID; | ||
} | ||
|
||
// materials.cpp | ||
DENG_EXTERN_C struct uri_s *Materials_ComposeUri(materialid_t materialId); | ||
|
||
DENG_DECLARE_API(Material) = | ||
{ | ||
{ DE_API_MATERIALS_v1 }, | ||
DD_MaterialForTextureUri, | ||
Materials_ComposeUri | ||
}; |
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