Exemplo n.º 1
0
HeightMapInterface* AbstractHeightMapManager::getHeightMapOfTile(Tile* tile) {
	if (tileMap.find(tile->getId()) != tileMap.end()) {
		return tileMap[tile->getId()]; //cache hit
	}

	//load and save
	std::string fileName = generateFileName(tile);
	HeightMapInterface* h = loadImpl(fileName);
	if(h) {
		PRINTD(INFO, "found saved heightmap at %s\n",fileName.c_str());
	} else {
		PRINTD(INFO, "creating heightmap for tile %s\n",tile->getName().c_str());
		h = createImpl(tile);
		if(h) { //save to disk
			if(!saveImpl(h, fileName))
				PRINTD(WARNING, "can't save heightmap of tile %s to %s\n",tile->getName().c_str(), fileName.c_str());
		}
	}

	if(h) { //save in cache -> TODO what about locks?
		tileMap[tile->getId()] = h;
		return h;
	} else {
		PRINTD(WARNING, "can't neighter load or create heightmap for tile %s\n",tile->getName().c_str());
		return NULL;
	}
}
Exemplo n.º 2
0
Timer::timer_id Timer::create(uint64_t msFromNow, uint64_t msPeriod,
	std::function<void()>&& handler)
{
	return createImpl(Instance(0,
		Clock::now() + Duration(msFromNow), Duration(msPeriod),
		std::move(handler)));
}
Exemplo n.º 3
0
WString& WString::arg(const WString& value)
{
  createImpl();

  impl_->arguments_.push_back(value);

  return *this;
}
Exemplo n.º 4
0
void ThreadImpl::startImpl(Runnable& target)
{
	if (isRunningImpl())
		throw SystemException("thread already running");

	_pRunnableTarget = &target;

	createImpl(runnableEntry, this);
}
Exemplo n.º 5
0
void ThreadImpl::startImpl(Callable target, void* pData)
{
	if (isRunningImpl())
		throw SystemException("thread already running");

	_callbackTarget.callback = target;
	_callbackTarget.pData = pData;

	createImpl(callableEntry, this);
}
Exemplo n.º 6
0
void HeadlessBackend::activate() {
    active = true;

    if (!impl) {
        createImpl();
    }

    assert(impl);
    impl->activateContext();
}
Exemplo n.º 7
0
WString& WString::arg(const std::wstring& value)
{
  createImpl();

  WString s;
  s.utf8_ = Wt::toUTF8(value);
  impl_->arguments_.push_back(s);

  return *this;
}
Exemplo n.º 8
0
    //---------------------------------------------------------------------------
    ResourcePtr GpuProgramManager::create(const String& name, const String& group, 
        GpuProgramType gptype, const String& syntaxCode, bool isManual, 
        ManualResourceLoader* loader)
    {
        // Call creation implementation
        ResourcePtr ret = ResourcePtr(
            createImpl(name, getNextHandle(), group, isManual, loader, gptype, syntaxCode));

        addImpl(ret);
        // Tell resource group manager
        ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
        return ret;
    }
Exemplo n.º 9
0
WString& WString::arg(const std::string& value, CharEncoding encoding)
{
  createImpl();

  if (realEncoding(encoding) == UTF8)
    impl_->arguments_.push_back(WString::fromUTF8(value, true));
  else {
    WString s;
    s.utf8_ = Wt::toUTF8(value);
    impl_->arguments_.push_back(s);
  }

  return *this;
}
Exemplo n.º 10
0
	//-----------------------------------------------------------------------
    ResourcePtr ResourceManager::create(const String& name, const String& group, 
		bool isManual, ManualResourceLoader* loader, const NameValuePairList* params)
	{
		// Call creation implementation
		ResourcePtr ret = ResourcePtr(
            createImpl(name, getNextHandle(), group, isManual, loader, params));
        if (params)
            ret->setParameterList(*params);

		addImpl(ret);
		// Tell resource group manager
		ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
		return ret;

	}
Exemplo n.º 11
0
	SPtr<RenderWindow> RenderWindowManager::create(RENDER_WINDOW_DESC& desc, SPtr<RenderWindow> parentWindow)
	{
		UINT32 id = ct::RenderWindowManager::instance().mNextWindowId.fetch_add(1, std::memory_order_relaxed);

		SPtr<RenderWindow> renderWindow = createImpl(desc, id, parentWindow);
		renderWindow->_setThisPtr(renderWindow);
		
		{
			Lock lock(mWindowMutex);

			mWindows[renderWindow->mWindowId] = renderWindow.get();
		}

		if (renderWindow->getProperties().isModal)
			mModalWindowStack.push_back(renderWindow.get());

		renderWindow->initialize();
		
		return renderWindow;
	}
Exemplo n.º 12
0
JSFunction* JSFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope)
{
    JSFunction* result = createImpl(vm, executable, scope);
    executable->singletonFunction()->notifyWrite(vm, result, "Allocating a function");
    return result;
}
Exemplo n.º 13
0
std::shared_ptr<IParameterUpdaterHook> IParameterUpdaterHook::create(
    const ParameterConfig& paramConfig, int idx) {
  std::pair<std::string, int> key = {paramConfig.name(), idx};
  return g_hookCache_.get(
      key, [&] { return createImpl(paramConfig.update_hooks(idx)); });
}
Exemplo n.º 14
0
JSGeneratorFunction* JSGeneratorFunction::createWithInvalidatedReallocationWatchpoint(VM& vm, FunctionExecutable* executable, JSScope* scope)
{
    return createImpl(vm, executable, scope);
}
Exemplo n.º 15
0
JSGeneratorFunction* JSGeneratorFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope)
{
    JSGeneratorFunction* generatorFunction = createImpl(vm, executable, scope);
    executable->singletonFunction()->notifyWrite(vm, generatorFunction, "Allocating a generator function");
    return generatorFunction;
}