예제 #1
0
void ResourceLoader::loadMeshWork(const String& name, Mesh::MeshdataPtr mesh, const String& skeletonName, LoadedCallback cb) {
    Ogre::MeshManager& mm = Ogre::MeshManager::getSingleton();
    Ogre::MeshPtr mo = mm.getByName(name);
    if (mo.isNull()) {
        /// FIXME: set bounds, bounding radius here
        Ogre::ManualResourceLoader *reload;
        mo = mm.createManual(name,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,(reload=
#ifdef _WIN32
#ifdef NDEBUG
                OGRE_NEW
#else
                new
#endif
#else
                OGRE_NEW
#endif
                ManualMeshLoader(mesh, name)));
        reload->prepareResource(&*mo);
        reload->loadResource(&*mo);

        if (!skeletonName.empty()) {
            Ogre::SkeletonManager& skel_mgr = Ogre::SkeletonManager::getSingleton();
            Ogre::SkeletonPtr skel = skel_mgr.getByName(skeletonName);
            if (!skel.isNull())
                mo->_notifySkeleton(skel);
        }
    }
    cb();
}
예제 #2
0
void ResourceLoader::loadSkeletonWork(const String& name, Mesh::MeshdataPtr mesh, const std::set<String>& animationList, LoadedCallback cb) {
    Ogre::SkeletonManager& skel_mgr = Ogre::SkeletonManager::getSingleton();
    Ogre::SkeletonPtr skel = skel_mgr.getByName(name);
    if (skel.isNull()) {
        Ogre::ManualResourceLoader *reload;
        Ogre::SkeletonPtr skel = Ogre::SkeletonPtr(skel_mgr.create(name,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true,
                (reload=new ManualSkeletonLoader(mesh, animationList))));
        reload->prepareResource(&*skel);
        reload->loadResource(&*skel);
    }
    cb();
}
예제 #3
0
void ResourceLoader::loadMaterialWork(const String& name, Mesh::MeshdataPtr mesh, const Mesh::MaterialEffectInfo& mat, const Transfer::URI& uri, TextureBindingsMapPtr textureFingerprints, LoadedCallback cb) {
    Ogre::MaterialManager& matm = Ogre::MaterialManager::getSingleton();
    Ogre::MaterialPtr matPtr = matm.getByName(name);
    if (matPtr.isNull()) {
        Ogre::ManualResourceLoader * reload;
        matPtr = matm.create(
            name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true,
            (reload=new ManualMaterialLoader (mesh, name, mat, uri, textureFingerprints))
        );

        reload->prepareResource(&*matPtr);
        reload->loadResource(&*matPtr);
    }
    cb();
}
예제 #4
0
void ResourceLoader::loadBillboardMaterialWork(const String& name, const String& texuri, const Transfer::URI& uri, TextureBindingsMapPtr textureFingerprints, LoadedCallback cb) {
    Ogre::MaterialManager& matm = Ogre::MaterialManager::getSingleton();
    Ogre::MaterialPtr matPtr = matm.getByName(name);
    if (matPtr.isNull()) {
        Ogre::ManualResourceLoader* reload;

        // We need to fill in a MaterialEffectInfo because the loader we're
        // using only knows how to process them for Meshdatas right now
        Mesh::MaterialEffectInfo matinfo;
        matinfo.shininess = 0.0f;
        matinfo.reflectivity = 1.0f;
        matinfo.textures.push_back(Mesh::MaterialEffectInfo::Texture());
        Mesh::MaterialEffectInfo::Texture& tex = matinfo.textures.back();
        tex.uri = texuri;
        tex.color = Vector4f(1.f, 1.f, 1.f, 1.f);
        tex.texCoord = 0;
        tex.affecting = Mesh::MaterialEffectInfo::Texture::AMBIENT;
        tex.samplerType = Mesh::MaterialEffectInfo::Texture::SAMPLER_TYPE_2D;
        tex.minFilter = Mesh::MaterialEffectInfo::Texture::SAMPLER_FILTER_LINEAR_MIPMAP_LINEAR;
        tex.magFilter = Mesh::MaterialEffectInfo::Texture::SAMPLER_FILTER_LINEAR_MIPMAP_LINEAR;
        tex.wrapS = Mesh::MaterialEffectInfo::Texture::WRAP_MODE_NONE;
        tex.wrapT = Mesh::MaterialEffectInfo::Texture::WRAP_MODE_NONE;
        tex.wrapU = Mesh::MaterialEffectInfo::Texture::WRAP_MODE_NONE;
        tex.mipBias = 0.0f;
        tex.maxMipLevel = 20;

        matPtr = matm.create(
            name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true,
            (reload = new ManualMaterialLoader (Mesh::VisualPtr(), name, matinfo, uri, textureFingerprints))
        );

        reload->prepareResource(&*matPtr);
        reload->loadResource(&*matPtr);
    }

    cb();
}
예제 #5
0
//void prepareResource(Resource* resource)
void manualresourceloader_prepare_resource(ManualResourceLoaderHandle handle, coiResourceHandle resource)
{
    Ogre::ManualResourceLoader* loader = static_cast<Ogre::ManualResourceLoader*>(handle);
    Ogre::Resource* res = static_cast<Ogre::Resource*>(resource);
    loader->prepareResource(res);
}