Emergency 2017 Dokumentation  v3.0.1
qsf::editor::base::MaterialAssetCompiler Class Reference

Material asset compiler class. More...

#include <MaterialAssetCompiler.h>

Public Member Functions

 MaterialAssetCompiler (const ProgressFunctionBinding &progressFunction=ProgressFunctionBinding())
 Constructor. More...
 
virtual ~MaterialAssetCompiler ()
 Destructor. More...
 
bool compile (const std::string &absoluteSourceFilename, const std::string &absoluteDestinationFilename, BaseCachedAsset &cachedAsset, bool compileTextures) const
 
bool buildLocalizedMaterial (const std::string &absoluteSourceFilename, const std::string &absoluteMaterialDestinationFilename, const std::string &absoluteTextureDestinationPath, const std::string &localization, const BaseCachedAsset &cachedAsset) const
 
virtual const std::string & getClassName () const override
 
virtual const std::string & getFileExtension () const override
 
virtual uint32 getCompilerRevision () const override
 
virtual boost::property_tree::ptree buildDependencyRevisionTree (GlobalAssetId globalAssetId) const override
 
virtual bool canCompile (GlobalAssetId globalAssetId) const override
 
virtual bool compile (const std::string &absoluteSourceFilename, const std::string &absoluteDestinationFilename, BaseCachedAsset &cachedAsset) const override
 Compile an asset. More...
 
- Public Member Functions inherited from qsf::editor::base::AssetCompilerImpl< MaterialAssetCompilerConfig >
virtual ~AssetCompilerImpl ()
 Destructor. More...
 
MaterialAssetCompilerConfiggetConfig ()
 
const MaterialAssetCompilerConfiggetConfig () const
 
virtual float getAssetPriority () const override
 
virtual ObjectgetConfigObject () override
 
virtual const ObjectgetConfigObject () const override
 
virtual AssetCompilerConfigRevision getConfigRevision () const override
 
- Public Member Functions inherited from qsf::editor::base::AssetCompiler
virtual ~AssetCompiler ()
 Destructor. More...
 
const std::string & getTypeName () const
 
void setTypeName (const std::string &typeName)
 

Static Public Member Functions

static void setTextureDownscaleFactor (float textureDownscaleFactor)
 Set texture downscale factor. More...
 

Static Public Attributes

static const std::string CLASS_NAME
 
static const uint32 CLASS_ID
 
static const std::string FILE_EXTENSION
 
static const uint32 COMPILER_REVISION
 

Additional Inherited Members

- Public Types inherited from qsf::editor::base::AssetCompiler
typedef void ProgressBindingSignature(const std::string &message, float progress)
 
typedef boost::function< ProgressBindingSignatureProgressFunctionBinding
 
- Protected Member Functions inherited from qsf::editor::base::AssetCompilerImpl< MaterialAssetCompilerConfig >
 AssetCompilerImpl (const ProgressFunctionBinding &progressFunction)
 Constructor. More...
 
- Protected Member Functions inherited from qsf::editor::base::AssetCompiler
 AssetCompiler (const ProgressFunctionBinding &progressFunction)
 Constructor. More...
 
void emitProgress (const std::string &message, float progress=0.0f) const
 Call this method in order to tell others about the asset compiler progress. More...
 

Detailed Description

Material asset compiler class.

Todo:
  • TODO(co) Currently hard wired with the configuration used for EMERGENCY 5 PC, make it possible to configure the material compiler from the outside

Definition at line 53 of file MaterialAssetCompiler.h.

Constructor & Destructor Documentation

qsf::editor::base::MaterialAssetCompiler::MaterialAssetCompiler ( const ProgressFunctionBinding progressFunction = ProgressFunctionBinding())
inlineexplicit

Constructor.

Parameters
[in]progressFunctionOptional function to call on notable progress

Definition at line 18 of file MaterialAssetCompiler-inl.h.

qsf::editor::base::MaterialAssetCompiler::~MaterialAssetCompiler ( )
inlinevirtual

Destructor.

Definition at line 24 of file MaterialAssetCompiler-inl.h.

Member Function Documentation

virtual boost::property_tree::ptree qsf::editor::base::MaterialAssetCompiler::buildDependencyRevisionTree ( GlobalAssetId  globalAssetId) const
overridevirtual

Returns a boost ptree containing all relevant asset dependencies of the given asset with their source revisions. (default implementation returns an empty ptree)

Reimplemented from qsf::editor::base::AssetCompiler.

bool qsf::editor::base::MaterialAssetCompiler::buildLocalizedMaterial ( const std::string &  absoluteSourceFilename,
const std::string &  absoluteMaterialDestinationFilename,
const std::string &  absoluteTextureDestinationPath,
const std::string &  localization,
const BaseCachedAsset cachedAsset 
) const
virtual bool qsf::editor::base::MaterialAssetCompiler::canCompile ( GlobalAssetId  globalAssetId) const
overridevirtual

Returns true if the asset with given global asset ID can be compiled right now. (default implementation always returns true)

Note
  • This method is meant to delay compilation attempts if asset dependencies are not available yet. Return true here if the reason for the asset not getting successfully compiled is permanent and should be reported to the user.

Reimplemented from qsf::editor::base::AssetCompiler.

bool qsf::editor::base::MaterialAssetCompiler::compile ( const std::string &  absoluteSourceFilename,
const std::string &  absoluteDestinationFilename,
BaseCachedAsset cachedAsset,
bool  compileTextures 
) const
virtual bool qsf::editor::base::MaterialAssetCompiler::compile ( const std::string &  absoluteSourceFilename,
const std::string &  absoluteDestinationFilename,
BaseCachedAsset cachedAsset 
) const
overridevirtual

Compile an asset.

Parameters
[in]absoluteSourceFilenameAbsolute filename of the source asset to compile
[in]absoluteDestinationFilenameAbsolute filename of the compiled asset
[in]globalAssetIdGlobal asset ID of the asset to compile
[in]cachedAssetOptional cached asset instance which might get feed with dynamic asset properties (e.g. a texture compiler might add pixel format information etc. for a texture streamer)
Returns
"true" if all went fine, else "false"

Implements qsf::editor::base::AssetCompiler.

const std::string & qsf::editor::base::MaterialAssetCompiler::getClassName ( ) const
inlineoverridevirtual

Returns the compiler's class name

Implements qsf::editor::base::AssetCompiler.

Definition at line 33 of file MaterialAssetCompiler-inl.h.

uint32 qsf::editor::base::MaterialAssetCompiler::getCompilerRevision ( ) const
inlineoverridevirtual

Returns the compiler revison of this compiler instance

Implements qsf::editor::base::AssetCompiler.

Definition at line 43 of file MaterialAssetCompiler-inl.h.

const std::string & qsf::editor::base::MaterialAssetCompiler::getFileExtension ( ) const
inlineoverridevirtual

Returns the file extension of the cached assets this compiler instance produces

Implements qsf::editor::base::AssetCompiler.

Definition at line 38 of file MaterialAssetCompiler-inl.h.

static void qsf::editor::base::MaterialAssetCompiler::setTextureDownscaleFactor ( float  textureDownscaleFactor)
static

Set texture downscale factor.

Parameters
[in]textureDownscaleFactorTexture downscale factor
Todo:
  • TODO(co) Quick'n'dirty poor mans solution to be at least able to change the texture scale. We need a decent project specific asset compiler configuration.

Member Data Documentation

const uint32 qsf::editor::base::MaterialAssetCompiler::CLASS_ID
static

Definition at line 62 of file MaterialAssetCompiler.h.

const std::string qsf::editor::base::MaterialAssetCompiler::CLASS_NAME
static

Definition at line 61 of file MaterialAssetCompiler.h.

const uint32 qsf::editor::base::MaterialAssetCompiler::COMPILER_REVISION
static

Definition at line 64 of file MaterialAssetCompiler.h.

const std::string qsf::editor::base::MaterialAssetCompiler::FILE_EXTENSION
static

Definition at line 63 of file MaterialAssetCompiler.h.


The documentation for this class was generated from the following files: