public void CheckTexture( Texture _texture, bool _hasUseOption, REUSE_MODE _reUseMode, string T, string _textureName, int _expectedChannelsCount )
{
if ( _reUseMode != REUSE_MODE.DONT_REUSE )
return; // Don't error when re-using previous channel textures
if ( _texture == null ) {
if ( _hasUseOption ) {
m_errors += T + "• No " + _textureName + " texture!\n";
RaiseErrorLevel( ERROR_LEVEL.DANGEROUS );
}
} else if ( _texture.m_constantColorType == Texture.CONSTANT_COLOR_TYPE.TEXTURE ) {
if ( !_hasUseOption )
m_warnings += T + "• Specifying " + _textureName + " texture whereas option is not set!\n";
// In case of texture, ensure it exists!
if ( !_texture.m_fileName.Exists ) {
m_errors += T + "• " + _textureName + " texture \"" + _texture.m_fileName.FullName + "\" not found on disk!\n";
RaiseErrorLevel( ERROR_LEVEL.DIRTY );
}
else if ( _texture.m_textureFileInfo == null ) {
m_errors += T + "• " + _textureName + " texture \"" + _texture.m_fileName.FullName + "\" not found in collected textures!\n";
RaiseErrorLevel( ERROR_LEVEL.DIRTY );
}
else {
// Ensure we have the proper amount of channels
if ( _texture.m_textureFileInfo.ColorChannelsCount != _expectedChannelsCount ) {
string errorText = T + "• " + _textureName + " texture \"" + _texture.m_fileName.FullName + "\" provides " + _texture.m_textureFileInfo.ColorChannelsCount + " color channels whereas " + _expectedChannelsCount + " are expected!\n";
if ( _texture.m_textureFileInfo.m_usage == TextureFileInfo.USAGE.DIFFUSE && _expectedChannelsCount == 1 ) {
m_warnings = errorText; // If an _d was set instead of a gloss or a metal, only issue a warning
} else {
m_errors += errorText; // Otherwise it's an actual error!
RaiseErrorLevel( ERROR_LEVEL.DANGEROUS );
}
}
}
}
}