Example #1
0
void UpdateEnemysDieStatus(std::vector<std::shared_ptr<VisibleObject> > &objVec,
                           ResourceManager &resMan)
{
    std::shared_ptr<unsigned int> wolfTexture(resMan.GetTexture("wolf.png")),
            bearTexture(resMan.GetTexture("bear.png")),
            snakeTexture(resMan.GetTexture("snake.png"));

    for(auto & enemy : objVec)
    {
        if(*(enemy->GetTexture()) == *bearTexture ||
                *(enemy->GetTexture()) == *wolfTexture ||
                *(enemy->GetTexture()) == *snakeTexture)
        {
            enemy->ChangeCanDie();
        }
    }
}
Example #2
0
void		Bullet::setSprite(ResourceManager &resource, std::string const &name)
{
	if (this->_sprite)
		delete this->_sprite;
	this->_sprite = resource.getSprite(name);
	if (this->_sprite)
		this->_sprite->setRotation(rtod(atan2(_vy, _vx)));
}
Example #3
0
Title::Title(InputDevice *inputDevice)
	:Screen(inputDevice),
	 m_titleSurface(NULL)
{
	ResourceManager *rm = ResourceManager::get_instance();
	m_titleSurface = rm->get_image("title.png");

	System *system = System::get_instance();
	int systemWidth = system->get_width();
	int systemHeight = system->get_height();
	
	int titleWidth = m_titleSurface->get_w();
	int titleHeight = m_titleSurface->get_h();

	m_titleX = (systemWidth - titleWidth) / 2;
	m_titleY = (systemHeight - titleHeight) / 4;
}
TEST(ResourceManager,add)
{
    ResourceManager<TestResource> manager;
    auto handle1 = manager.add(42, std::string("Hello World"));
    ASSERT(handle1.isValid());
    auto pRes1 = manager.request(handle1);
    ASSERT_NEQ(pRes1, nullptr);
    ASSERT_EQ(pRes1->m_int, 42);
    ASSERT_EQ(pRes1->m_string, "Hello World");

    auto handle2 = manager.add(23, "Foo");
    ASSERT(handle2.isValid());
    auto pRes2 = manager.request(handle2);
    ASSERT_NEQ(pRes2, nullptr);
    ASSERT_EQ(pRes2->m_int, 23);
    ASSERT_EQ(pRes2->m_string, "Foo");
}
Example #5
0
CdrLabel::CdrLabel(CdrLabel_t* labelData , XCreateParams* createParam ) :
	mHwnd(HWND_INVALID),
	mHparent(createParam->hParent),
	mId(labelData->id),
	mName(string(labelData->name)),
	mAlign(alCenter),
	mAlignFormat(DT_CENTER |DT_VCENTER |DT_SINGLELINE),
	mTextColor(PIXEL_black)
	//mTextColor(PIXEL_lightwhite)
{
	DWORD dwStyle, dwStyleEx;
	ResourceManager* rm;
	int retval;
	CDR_RECT rect;

	db_msg("CdrLabel Constructor: %s\n", mName.c_str());
	dwStyle = WS_CHILD;		// not visible
	dwStyleEx = WS_EX_NONE;

	dwStyle |= createParam->style;
	dwStyleEx |= createParam->exStyle;

	memset(&mBkgroudBmp, 0, sizeof(BITMAP));

	rm = ResourceManager::getInstance();
	retval = rm->getResRect(mId, rect);
	if(retval < 0) {
		db_error("get %s rect failed\n", mName.c_str());
		return;
	}
	db_msg("%d %d %d %d", rect.x, rect.y, rect.w, rect.h);

	mHwnd = CreateWindowEx(CTRL_STATIC, "",
			dwStyle,
			dwStyleEx,
			mId,
			rect.x, rect.y, rect.w, rect.h,
			mHparent, (DWORD)this);
	if(mHwnd == HWND_INVALID) {
		db_error("create status bar window name failed\n");
		return;
	}

	oldProc = SetWindowCallbackProc(mHwnd, cdrLabelProc);
}
Example #6
0
NAMESPACE_RESOURCES_BEGIN

//-----------------------------------//

void ResourceTaskRun(Task* task)
{
	ResourceLoadOptions* options = (ResourceLoadOptions*) task->userdata;

	Stream* stream = options->stream;
	Resource* resource = options->resource;
	const Path& path = resource->getPath();
	
	ResourceManager* res = GetResourceManager();
	ResourceLoader* loader = res->findLoader( PathGetFileExtension(path) );

	bool decoded = loader->decode(*options);

	if( !decoded )
	{
		resource->setStatus( ResourceStatus::Error );
		LogWarn("Error decoding resource '%s'", path.CString());
		goto cleanup;
	}

	resource->setStatus( ResourceStatus::Loaded );

	LogInfo("Loaded resource '%s'", path.CString());

	if( options->sendLoadEvent )
	{
		ResourceEvent event;
		event.resource = resource;
		res->resourceEvents.push_back(event);
	}

cleanup:

	res->numResourcesQueuedLoad.decrement();
	res->resourceFinishLoad->wakeOne();

	if( !options->keepStreamOpen )
		Deallocate(stream);

	Deallocate(options);
}
Example #7
0
void World::Initialize(GLFWwindow* window)
{
	//-Resources-

	ResourceManager* resources = ResourceManager::GetInstance();

	//Load Shaders
	resources->LoadShader("default.vert", "", "default.frag");
	resources->LoadShader("simple.vert", "", "simple.frag");
	resources->LoadShader("terrain.vert", "", "terrain.frag");
	resources->LoadShader("depth.vert", "", "depth.frag");

	//Load Textures
	resources->LoadTextureTransparent("cursor.png");
	resources->LoadTexture("grass.png");

	//Create Camera
	mCamera = new Camera();

	// Rendering Stuff
	mFbo = new FrameBufferObject(1024);

	mPlanet = new Planet();

	glfwSetMouseButtonCallback(window, World::MouseCallback);
}
Example #8
0
void Gui::logic()
{
    ResourceManager *resman = ResourceManager::getInstance();
    resman->clearScheduled();

    // Fade out mouse cursor after extended inactivity
    if (mMouseInactivityTimer < 100 * 15)
    {
        ++mMouseInactivityTimer;
        mMouseCursorAlpha = std::min(1.0f, mMouseCursorAlpha + 0.05f);
    }
    else
        mMouseCursorAlpha = std::max(0.0f, mMouseCursorAlpha - 0.005f);

    Palette::advanceGradients();

    gcn::Gui::logic();
}
Example #9
0
	void offline(StringId64 id, ResourceManager& rm)
	{
		ResourceId res_id;
		res_id.type = SHADER_TYPE;
		res_id.name = id;

		Shader* shader = (Shader*) rm.get(res_id);
		bgfx::destroyProgram(shader->program);
	}
Example #10
0
 void AdvToneMap( ResourceManager& res,Task* t)
 {
 	PixelBuff* one=(PixelBuff*)GetResource(t,"buffer","AdvToneMap",res,Resource::BUFFER);
 	
 	float grey=ToFloat(GetElement(t,"middleGrey","AdvToneMap",res,true,"0.6"));
 	float white=ToFloat(GetElement(t,"whitePoint","AdvToneMap",res,true,"16"));
 	
 	res.Add(t->name,PostProcess::AdvToneMapping(one,grey,white));
 }
//----------------------------------------------------------------------------------
// TimerEvent: Handle a timer event.
//----------------------------------------------------------------------------------
bool DownloadCtrl::TimerEvent(int tDelta)
{
	Container::TimerEvent(tDelta);
	m_tDownloading += tDelta;

	if (! m_bShownTimeoutWarning)
	{
		CustomInfo* pCustInfo = GetCustomInfo();
		ResourceManager* pResMgr = pCustInfo->GetResourceManager();

		if (m_tDownloading > pCustInfo->GetPatchTimeout())
		{
			m_bShownTimeoutWarning = true;
			MessageBox(GetWindow(), pResMgr->GetFinishedString(Download_NoData_String), pResMgr->GetFinishedString(Global_Warning_String), MD_OK);
		}
	}
	return true;
}
Example #12
0
 void Lerp( ResourceManager& res,Task* t)
 {
 	PixelBuff* one=(PixelBuff*)GetResource(t,"buffer1","Lerp",res,Resource::BUFFER);
 	PixelBuff* two=(PixelBuff*)GetResource(t,"buffer2","Lerp",res,Resource::BUFFER);
 		
 	float value=ToFloat(GetElement(t,"value","Lerp",res,false,"0"));
 	
 	res.Add(t->name,PostProcess::Lerp(one,two,value));	
 }
Example #13
0
int MenuRecordPreview::HandleSubMenuChange(unsigned int menuIndex, int newSel)
{
	ResourceManager* rm;

	rm = ResourceManager::getInstance();

	switch(menuIndex) {
	case MENU_INDEX_VIDEO_RESOLUTION:
	case MENU_INDEX_VIDEO_BITRATE:
	case MENU_INDEX_VTL:
	case MENU_INDEX_WB:	
	case MENU_INDEX_CONTRAST:	
	case MENU_INDEX_EXPOSURE:	
		if(haveSubMenu[menuIndex] != 1) {
			db_error("invalid menuIndex %d\n", menuIndex);
			return -1;
		}
		if(rm->setResIntValue(menuResourceID[menuIndex], INTVAL_SUBMENU_INDEX, newSel) < 0) {
			db_error("set %d to %d failed\n", menuIndex, newSel);	
			return -1;
		}
		break;
	default:
		db_error("invalid menuIndex %d\n", menuIndex);
		return -1;
	}

	MENULISTITEMINFO mlii;

	if(SendMessage(mHwnd, LB_GETITEMDATA, menuIndex, (LPARAM)&mlii) != LB_OKAY) {
		db_error("get item info failed, menuIndex is %d\n", menuIndex);
		return -1;
	}

	if(getFirstValueStrings(&mlii, menuIndex) < 0) {
		db_error("get first value strings failed\n");
		return -1;
	}
	db_msg("xxxxxxxx\n");
	SendMessage(mHwnd, LB_SETITEMDATA, menuIndex, (LPARAM)&mlii);
	db_msg("xxxxxxxx\n");

	return 0;
}
Example #14
0
int MenuRecordPreview::HandleSubMenuChange(unsigned int menuIndex, bool newValue)
{
	ResourceManager* rm;

	db_msg("menuObj %d, set menuIndex %s\n", mMenuObjId, newValue ? "true" : "false");
	rm = ResourceManager::getInstance();
	switch(menuIndex) {
	case MENU_INDEX_POR:
	case MENU_INDEX_TWM:
	case MENU_INDEX_AWMD:
#ifdef APP_VERSION
	case MENU_INDEX_SMARTALGORITHM:
#endif
		if(haveCheckBox[menuIndex] != 1) {
			db_error("invalid menuIndex %d\n", menuIndex);
			return -1;
		}
		if(rm->setResBoolValue(menuResourceID[menuIndex], newValue) < 0) {
			db_error("set %d to %d failed\n", menuIndex, newValue);
			return -1;
		}
		break;
	default:
		db_error("invalid menuIndex %d\n", menuIndex);
		return -1;
	}

	MENULISTITEMINFO mlii;
	memset(&mlii, 0, sizeof(mlii));
	if(SendMessage(mHwnd, LB_GETITEMDATA, menuIndex, (LPARAM)&mlii) != LB_OKAY) {
		db_error("get item info failed, menuIndex is %d\n", menuIndex);
		return -1;
	}
	if(getFirstValueImages(&mlii, menuIndex) < 0) {
		db_error("get first value images failed, menuIndex is %d\n", menuIndex);
		return -1;
	}

	db_msg("xxxxxxxx\n");
	SendMessage(mHwnd, LB_SETITEMDATA, menuIndex, (LPARAM)&mlii);
	db_msg("xxxxxxxx\n");

	return 0;
}
Example #15
0
bool SunJVMLauncher::setupVM(ResourceManager& resource, JVMBase* vm)
{
  //
  // create the properties array
  const vector<JavaProperty>& jprops = resource.getJavaProperties();
  for (int i=0; i<jprops.size(); i++)
    {
      vm->addProperty(jprops[i]);
    }

  if (resource.getProperty("maxheap") != "")
    vm->setMaxHeap( StringUtils::parseInt(resource.getProperty("maxheap") ));
  
  if (resource.getProperty("initialheap") != "")
    vm->setInitialHeap( StringUtils::parseInt(resource.getProperty("initialheap") ));
  
  if (resource.useEmbeddedJar())
    {
      std::string embj = resource.saveJarInTempFile();
      vm->addPathElement(embj);
    }
  
  std::string jnijar = resource.saveJnismoothInTempFile();
  if (jnijar != "")
    vm->addPathElement(jnijar);

  //
  // Define the classpath
  std::vector<std::string> classpath = resource.getNormalizedClassPathVector();
  for (int i=0; i<classpath.size(); i++)
    {
      vm->addPathElement(classpath[i]);
    }

  //
  // Defines the arguments passed to the java application
  //  vm->setArguments(resource.getProperty(ResourceManager::KEY_ARGUMENTS));
  std::vector<std::string> args = resource.getArguments();
  for (int i=0; i<args.size(); i++)
    {
      vm->addArgument(args[i]);
    }

}
Example #16
0
/**
 * Retrieves the model data from the resource manager and rraws the
 * Model to screen using RCBC.
 * @param rm The ResourceManager to use to load the model
 */
void VModel::draw(Interface* interface) {
	if(!interface) {
		return;
	}
	
	if(!isVisible() && interface->getEditMode() == MODE_NONE) {
		return;
	}

	ResourceManager* rm = interface->getResourceManager();
	if(!rm) {
		return;
	}
	Model* model = rm->loadModel(filename_);

	bool selected;
	Object* object = interface->getSelectedObject();
	if(object) {
		Visual* visual = &object->getVisual();
		selected = (this == visual);
		glEnable(GL_COLOR_MATERIAL);
		glColor3f(1.0f, 0.2f, 0.2f);
		//DEBUG_H("Drawing selected. %s", object->getTag().c_str());
		//glEnable
	}

	if(!selected) {
		//DEBUG_H("Drawing selected. %s", object->getTag().c_str());
		glColor3f(1.0f, 1.0f, 1.0f);

		// If we are editing, draw visible objects
		if(!isVisible() && interface->getEditMode() != MODE_NONE) {
			glColor4f(0.5f, 0.5f, 1.0f, 0.5f);
		} else 

		glDisable(GL_COLOR_MATERIAL);
	}

	preDraw(interface);

	RCBC_Render(model);
	postDraw(interface);
}
Example #17
0
ADDetectedGame CGEMetaEngine::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
	ADDetectedGame game = detectGameFilebased(allFiles, fslist, CGE::fileBasedFallback);

	if (!game.desc)
		return ADDetectedGame();

	SearchMan.addDirectory("CGEMetaEngine::fallbackDetect", fslist.begin()->getParent());
	ResourceManager *resman;
	resman = new ResourceManager();
	bool sayFileFound = resman->exist("CGE.SAY");
	delete resman;

	SearchMan.remove("CGEMetaEngine::fallbackDetect");

	if (!sayFileFound)
		return ADDetectedGame();

	return game;
}
LVEDRENDERINGENGINE_API void __stdcall LvEd_Initialize(LogCallbackType logCallback, InvalidateViewsCallbackType invalidateCallback
    , const wchar_t** outEngineInfo)
{    
    // Enable run-time memory check for debug builds.
#if defined(DEBUG) || defined(_DEBUG)
  //   _crtBreakAlloc = 925; //example break on alloc number 1027, change 
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

    if(s_engineData) return;   
    ErrorHandler::ClearError();
    if(logCallback) 
        Logger::SetLogCallback(logCallback);

    Logger::Log(OutputMessageType::Info, L"Initializing Rendering Engine\n");    
    
    
    // note if you using game-engine
    // you don't need to use DeviceManager class.
    // the game-engine should provide
    gD3D11 = new DeviceManager();
    GpuResourceFactory::SetDevice(gD3D11->GetDevice());
    RSCache::InitInstance(gD3D11->GetDevice());
    TextureLib::InitInstance(gD3D11->GetDevice());
    ShapeLibStartup(gD3D11->GetDevice());
    ResourceManager::InitInstance();
    LineRenderer::InitInstance(gD3D11->GetDevice());
    ShadowMaps::InitInstance(gD3D11->GetDevice(),2048);
   
    RenderContext::InitInstance(gD3D11->GetDevice());
    s_engineData = new EngineData( gD3D11->GetDevice() );
    s_engineData->resourceListener.SetCallback(invalidateCallback);
    RenderContext::Inst()->SetContext(gD3D11->GetImmediateContext());

    ShaderLib::InitInstance(gD3D11->GetDevice());
    FontRenderer::InitInstance( gD3D11 );
    

    // Register resource factories...
    ResourceManager * resMan = ResourceManager::Inst();
    AtgiModelFactory * atgiFactory = new AtgiModelFactory(gD3D11->GetDevice());
    ColladaModelFactory * colladaFactory = new ColladaModelFactory(gD3D11->GetDevice());    
    TextureFactory * texFactory = new TextureFactory(gD3D11->GetDevice());
    resMan->RegisterListener(&s_engineData->resourceListener);    
    resMan->RegisterFactory(L".tga", texFactory);
    resMan->RegisterFactory(L".png", texFactory);
    resMan->RegisterFactory(L".jpg", texFactory);
    resMan->RegisterFactory(L".bmp", texFactory);
    resMan->RegisterFactory(L".dds", texFactory);
    resMan->RegisterFactory(L".tif", texFactory);
    resMan->RegisterFactory(L".atgi", atgiFactory);
    resMan->RegisterFactory(L".dae", colladaFactory);

    EngineInfo::InitInstance();
    const wchar_t* info = EngineInfo::Inst()->GetInfo();
    if(outEngineInfo)
        *outEngineInfo = info;
}
AudioStreamResource* AudioStreamResource::createAudioStreamResource (
    const String& fileName, unsigned int buff, unsigned int samples )
{

	// Criamos a mensagem de carregamento
	String str ( "File " + fileName );

	// Instancia de ResourceManager
	ResourceManager* rscMap = ResourceManager::Instance();

	// Verificamos se o Resource ja foi carregado
	AudioStreamResource* rsc =
	    static_cast<AudioStreamResource*> ( rscMap->getResource ( fileName ) );

	if ( rsc == nullptr ) {

		// Criamos o AudioStream
		ALLEGRO_AUDIO_STREAM* stream =
		    al_load_audio_stream ( fileName.c_str(), buff, samples );

		if ( stream == nullptr ) {
			throw Ludic::Exception ( "ERROR: Error to load AudioStreamResource " + fileName );
			return nullptr;
		}

		// Criamos o AudioStreamResource
		rsc = new AudioStreamResource ( fileName, stream, buff, samples );

		// Adicionamos ao mapa
		rscMap->addResource ( fileName, rsc );

		str += " loaded successfully!";

	}
	else {
		str += " already exists!";
	}

	// Imprimims a mensagem de carregamento
	std::cout << str << std::endl;

	return rsc;
}
//----------------------------------------------------------------------------------
// HandleVisitHostButton: Process a click on the Visit Host button.
//----------------------------------------------------------------------------------
bool DownloadCtrl::HandleVisitHostButton(ComponentEvent* pEvent)
{
	if (pEvent->mType != ComponentEvent_ButtonPressed)
		return false;

	ResourceManager* pResMgr = GetCustomInfo()->GetResourceManager();
	CPatchData* pPatch = GetCustomInfo()->GetSelectedPatch();

	// Launch the user's browser (send them to the host's site).
	if (pPatch)
	{
		if (pPatch->GetHostUrl().length())
			Browse(pPatch->GetHostUrl());
		else
			MessageBox(GetWindow(), pResMgr->GetFinishedString(Download_NoHostUrl_String), pResMgr->GetFinishedString(Global_Error_String), MD_OK);
	}

	return true;
}
Example #21
0
void EditorFrame::createEngine()
{
	engine = AllocateThis(Engine);
	engine->init();

	// Setup the input manager.
	input = AllocateThis(InputManager);
	input->createDefaultDevices();
	engine->setInputManager(input);

	// Mount the default assets path.
	ResourceManager* res = engine->getResourceManager();
	
	// Get the mount paths from the editor preferences.
	archive = ArchiveCreateVirtual( GetResourcesAllocator() );
	ArchiveMountDirectories(archive, MediaFolder, GetResourcesAllocator());
	
	res->setArchive(archive);
}
Example #22
0
void GetFriendUin::run( void * ptr)
{
    ResourceManager *res = reinterpret_cast < ResourceManager *>(ptr);
    std::string temp_uin = uin;
    std::string::size_type p = temp_uin.find_last_of('\n');
    if(p != std::string::npos) temp_uin.erase(p);

    HttpClient *request = new HttpClient();
    std::string uri = "http://s.web2.qq.com/api/get_friend_uin2?tuin="+\
                      temp_uin + "&verifysession=&type=1&code=&vfwebqq="+\
                      vfwebqq;

    std::list<std::string> headers;
    headers.push_back("Referer: http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=1");

    request->setHttpHeaders(headers);

    std::string result = request->requestServer(uri);
    res->lock();
    try{

        Json::FastWriter writer;
        Json::Reader jsonReader;
        Json::Value root;
        jsonReader.parse(result, root, false);
        int retcode = root["retcode"].asInt();
        if ( 0 == retcode)
        {
            res->contacts[uin].qqnumber=  QQUtil::trim(writer.write(root["result"]["account"]));
        }
        else
        {
            debug_info("Get friend uin failed with error code %d ... (%s,%d)", retcode, __FILE__, __LINE__);
        }

    }catch(...)
    {
        res->ulock();
        debug_error("Failed to parse json content... (%s,%d)", __FILE__, __LINE__);
    }

    res->ulock();
}
Example #23
0
INT __cdecl xa_rollback (XID *xid, int rmid, long flags) {
    if (flags & TMASYNC)
	return XAER_ASYNC;

    INT rv = XAER_RMFAIL;

    EnterCriticalSection(&rmLock);
    ResourceManager* rmp = findRm(rmid);

    if (rmp == NULL) {
	rv = XAER_INVAL;
    }
    else {
	rv = rmp->rollback(xid);
    }
	
    LeaveCriticalSection(&rmLock);
    return rv;
}
Example #24
0
 void PhongCreator( ResourceManager& res,Task* t)
 {
 	Vector3 color=ToVector3(GetElement(t,"color","Phong",res,false,""));
 	Vector3 spec=ToVector3(GetElement(t,"specColor","Phong",res,true,"1,1,1"));
 	float diff=ToFloat(GetElement(t,"diffuse","Phong",res,false,""));
 	float ref=ToFloat(GetElement(t,"reflectance","Phong",res,false,""));
 	float specPower=ToFloat(GetElement(t,"specPower","Phong",res,true,"100"));
 	
 	res.Add(t->name,new Phong(Color(color),Color(spec),diff,ref,(int)specPower));
 }
Example #25
0
  void PointLightCreator( ResourceManager& res,Task* t)
  {
  	Primitive* prim=NULL;
  	Vector3 color=ToVector3(GetElement(t,"color","PointLight",res,false,""));
  	Vector3 pos=ToVector3(GetElement(t,"position","PointLight",res,false,""));
  	
  	std::string v=GetValue(t,"primitive");
  	if(v=="")
  		Log::AddMessage("PointLight: No primitve specified for point light",Log::NORMAL);
  	else
  	{
  		Resource* resource=res.Get(v);
  		prim=dynamic_cast<Primitive*>(resource);
  		if(prim==NULL)
  			Log::AddMessage("PointLight: Object "+v+" cannot be found. Skipping...",Log::HIGH);
  	}
  	
 	res.Add(t->name,new PointLight(Color(color),pos,prim));
  }
bool ImageAttachment::DoPrepareResources( BufferIndex updateBufferIndex, ResourceManager& resourceManager )
{
  DALI_LOG_TRACE_METHOD_FMT(gImageAttachmentLogFilter, "this:%p", this);
  bool ready = false;

  if( 0 != mTextureId )
  {
    // The metadata is used by IsFullyOpaque(), below.
    mBitmapMetadata = resourceManager.GetBitmapMetadata( mTextureId );

    CompleteStatusManager& completeStatusManager = mSceneController->GetCompleteStatusManager();
    CompleteStatusManager::CompleteState status = completeStatusManager.GetStatus( mTextureId );

    switch( status )
    {
      case CompleteStatusManager::NOT_READY:
      {
        ready = false;

        if( mBitmapMetadata.GetIsFramebuffer() )
        {
          ready = true;
        }
        mFinishedResourceAcquisition = false;
        FollowTracker( mTextureId );
      }
      break;

      case CompleteStatusManager::COMPLETE:
      {
        ready = true;
        mFinishedResourceAcquisition = true;
      }
      break;

      case CompleteStatusManager::NEVER:
      {
        ready = false;
        mFinishedResourceAcquisition = true;
      }
      break;
    }
  }
  else
  {
    // Loading is essentially finished if we don't have a resource ID
    mFinishedResourceAcquisition = true;
  }

  ATTACHMENT_LOG_FMT(Debug::General, " ObjName:%s finished:%s ready:%s \n",
                     DALI_LOG_GET_OBJECT_C_STR(mParent),
                     mFinishedResourceAcquisition?"T":"F", ready?"T":"F");

  return ready;
}
Example #27
0
 void RayTracing( ResourceManager& res,Task* t)
 {
 	Camera* cam=(Camera*)GetResource(t,"camera","RayTracing",res,Resource::CAMERA);
 	Scene* scene=(Scene*)GetResource(t,"scene","RayTracing",res,Resource::SCENE);
 	int trDpt=(int)ToFloat(GetElement(t,"tracingDepth","RayTracing",res,true,"5"));
 	int width=(int)ToFloat(GetElement(t,"width","RayTracing",res,false,""));
 	int height=(int)ToFloat(GetElement(t,"height","RayTracing",res,false,""));
 	
 	Engine engine(scene);
 	res.Add(t->name,engine.Render(cam,width,height,trDpt));
 }
Example #28
0
 void SceneCreator( ResourceManager& res,Task* t)
 {
 	Vector3 size=ToVector3(GetElement(t,"size","Scene",res,false,""));
 	
 	Scene* scene=new Scene(size);
 	std::string v;
 	int i=1;
 	while((v=GetValue(t,"object"+ToString(i++)))!="")
 		scene->AddObject((Object*)GetResource(t,"object"+ToString(i-1),"Scene",res,Resource::OBJECT));
 	res.Add(t->name,scene);
 }
Example #29
0
 void BrightPass( ResourceManager& res,Task* t)
 {
 	PixelBuff* one=(PixelBuff*)GetResource(t,"buffer","BrightPass",res,Resource::BUFFER);
 	
 	float treshold=ToFloat(GetElement(t,"treshold","BrightPass",res,true,"0.5"));
 	float offset=ToFloat(GetElement(t,"offset","BrightPass",res,true,"1"));
 	float grey=ToFloat(GetElement(t,"middleGrey","BrightPass",res,true,"0.6"));
 	float white=ToFloat(GetElement(t,"whitePoint","BrightPass",res,true,"16"));
 	
 	res.Add(t->name,PostProcess::BrightPass(one,grey,white,treshold,offset));
 }
Example #30
0
 void ImageCreator( ResourceManager& res,Task* t)
 {
 	int width,height;
 	width=(int)ToFloat(GetValue(t,"width"));
 	height=(int)ToFloat(GetValue(t,"height"));
 	
 	if(width<=0||height<=0)
 		Log::AddMessage("ImageCreator: Wrong width or size attribute",Log::ERR);
 	
 	res.Add(t->name,new PixelBuff(width,height));
 }