コード例 #1
0
ファイル: Plugin.cpp プロジェクト: PoncinMatthieu/3dNovac
Graphic::GL::Texture    *Plugin::ReadImage(domImageRef lib)
{
    if (lib==NULL || lib->getId()==NULL)
        return NULL;

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

    LOG_DEBUG << "Create new image " << lib->getId() << std::endl;
    domImage *imageElement = (domImage*)(domElement*)lib;
    if (imageElement)
    {
        GL::Texture *texture = &_mapTexture[imageElement->getId()];
        texture->LoadFromFile(cdom::uriToNativePath(imageElement->getInit_from()->getValue().str()));
        return texture;
    }
    return NULL;
}
コード例 #2
0
ファイル: Plugin.cpp プロジェクト: PoncinMatthieu/3dNovac
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;
}