void EntityCEGUITexture::createImage(const std::string& imageSetName) { //create a CEGUI texture from our Ogre texture S_LOG_VERBOSE("Creating new CEGUI texture from Ogre texture."); Ogre::TexturePtr texturePtr(mRenderContext->getTexture()); mCeguiTexture = &GUIManager::getSingleton().getGuiRenderer()->createTexture(texturePtr); //we need a imageset in order to create GUI elements from the ceguiTexture S_LOG_VERBOSE("Creating new CEGUI imageset with name " << imageSetName + "_EntityCEGUITextureImageset"); mImageSet = &CEGUI::ImagesetManager::getSingleton().create(imageSetName + "_EntityCEGUITextureImageset", *mCeguiTexture); int width = 1; int height = 1; if (!texturePtr.isNull()) { width = texturePtr->getWidth(); height = texturePtr->getHeight(); } //we only want one element: the whole texture //the width and height of the texture differs from the supplied width of this instance since it will have been adjusted to a power-of-two size mImageSet->defineImage("full_image", CEGUI::Rect(0, 0, width, height), CEGUI::Point(0,0)); //assign our image element to the StaticImage widget mImage = &mImageSet->getImage("full_image"); }
void Model::assimp_material_add_texture(Material &material, aiMaterial &assimp_material, Model_Texture_Type type) { int texIndex = 0; aiString path; aiTextureType assimp_type; switch (type) { case MODEL_TEXTURE_DIFFUSE: assimp_type = aiTextureType_DIFFUSE; break; case MODEL_TEXTURE_NORMAL: assimp_type = aiTextureType_NORMALS; break; case MODEL_TEXTURE_HEIGHT: assimp_type = aiTextureType_HEIGHT; break; case MODEL_TEXTURE_ALPHA: assimp_type = aiTextureType_OPACITY; break; case MODEL_TEXTURE_SPECULAR: assimp_type = aiTextureType_SPECULAR; break; default: break; } aiReturn texFound = assimp_material.GetTexture(assimp_type, texIndex, &path); if (texFound == AI_SUCCESS) { if (texIndex > 0) { std::cout << "Fragmic warning: more then one texture of this type for material" << std::endl; std::cout << "NOT CURRENTLY SUPPORTED!" << std::endl; } //std::cout << "\tTexture file: " << path.data << std::endl; std::unique_ptr<Texture> texturePtr(new Texture()); Texture &texture = *texturePtr; texture.image_load(prefix + std::string(path.data)); switch (type) { case MODEL_TEXTURE_DIFFUSE: material.diffuse = std::move(texturePtr); break; case MODEL_TEXTURE_NORMAL: material.normal = std::move(texturePtr); break; case MODEL_TEXTURE_HEIGHT: material.height = std::move(texturePtr); break; case MODEL_TEXTURE_ALPHA: material.alpha = std::move(texturePtr); break; case MODEL_TEXTURE_SPECULAR: material.specular = std::move(texturePtr); break; default: break; } texIndex++; texFound = assimp_material.GetTexture(assimp_type, texIndex, &path); } }