Пример #1
0
void gkTextureLoader::loadResource(Ogre::Resource* resource)
{
	Ogre::Texture* texture = static_cast<Ogre::Texture*>(resource);

	if (!m_stream)
	{
		gkPrintf("Warning: Skipping image %s no packed file information is present!", texture->getName().c_str());
		return;
	}

	Ogre::DataStreamPtr stream(OGRE_NEW Ogre::MemoryDataStream(m_stream->ptr(), m_stream->size()));

	Ogre::Image ima;
	ima.load(stream);

	texture->setUsage(Ogre::TU_DEFAULT);
	texture->setTextureType(Ogre::TEX_TYPE_2D);
	texture->setNumMipmaps(gkEngine::getSingleton().getUserDefs().defaultMipMap);
	texture->setWidth(ima.getWidth());
	texture->setHeight(ima.getHeight());
	texture->setDepth(ima.getDepth());
	texture->setFormat(ima.getFormat());

	Ogre::ConstImagePtrList ptrs;
	ptrs.push_back(&ima);
	texture->_loadImages(ptrs);
}
Пример #2
0
 void GlobalMap::loadResource(Ogre::Resource *resource)
 {
     Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
     Ogre::ConstImagePtrList list;
     list.push_back(&mOverlayImage);
     tex->_loadImages(list);
 }
Пример #3
0
void OnePixelMaterialGenerator::loadResource(Ogre::Resource* resource)
{

	Ogre::Texture* texture = static_cast<Ogre::Texture*>(resource);
	static Ogre::uchar data[3] = {0xFF, 0x7F, 0x7F};

	Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(&data, 3, false, true));
	Ogre::Image image;
	image.loadRawData(stream, 1,1,1, Ogre::PF_R8G8B8);
	Ogre::ConstImagePtrList images({&image});

	texture->_loadImages(images);
}