HTexture TextureMgr :: GetTexture( const char* name ) { // insert/find NameIndexInsertRc rc = m_NameIndex.insert( std::make_pair( Filesystem::GetFullPath(name), HTexture() ) ); if ( rc.second ) { // this is a new insertion Graphics::OGL::Texture* tex = m_HandleMgr.Acquire( rc.first->second ); if ( !tex->Create( rc.first->first, true ) ) { m_HandleMgr.Release( rc.first->second ); m_NameIndex.erase( rc.first ); //assert (false); return HTexture(); } } Lock(rc.first->second); if (IsHandleValid(rc.first->second)) return ( rc.first->second ); else { assert (false); return HTexture(); } }
void ScriptGUIResourceField::internal_setValueRef(ScriptGUIResourceField* nativeInstance, MonoObject* value) { GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement()); if (value == nullptr) resourceField->setValue(HTexture()); else { ScriptResourceRef* scriptTexture = ScriptResourceRef::toNative(value); resourceField->setValueWeak(static_resource_cast<Texture>(scriptTexture->getHandle())); } }
SPtr<SpriteTexture> SpriteTexture::createEmpty() { SPtr<SpriteTexture> texturePtr = bs_core_ptr<SpriteTexture> (new (bs_alloc<SpriteTexture>()) SpriteTexture(Vector2(0.0f, 0.0f), Vector2(1.0f, 1.0f), HTexture())); texturePtr->_setThisPtr(texturePtr); texturePtr->initialize(); return texturePtr; }