Example #1
0
Graphic::GL::Texture    *Plugin::ReadNormalMap(domImageRef lib)
{
    if (lib==NULL || lib->getId()==NULL)
        return NULL;

    MapTexture::iterator it = _mapNormalMap.find(lib->getID());
    if (it != _mapNormalMap.end()) // if already exist
        return &it->second;

    domImage *imageElement = (domImage*)(domElement*)lib;
    if (imageElement)
    {
        Utils::FileName f = cdom::uriToNativePath(imageElement->getInit_from()->getValue().str());
        f.SetShortFilename(f.ShortFilename() + "Normal");
        if (!f.IsReadable())
            return NULL;
        LOG_DEBUG << "Create new NormalMap " << f << std::endl;
        GL::Texture *texture = &_mapNormalMap[imageElement->getId()];
        texture->LoadFromFile(f);
        return texture;
    }
    return NULL;
}