当前位置: 首页>>代码示例>>C++>>正文


C++ TexturePtr::isNull方法代码示例

本文整理汇总了C++中TexturePtr::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::isNull方法的具体用法?C++ TexturePtr::isNull怎么用?C++ TexturePtr::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TexturePtr的用法示例。


在下文中一共展示了TexturePtr::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateIcon

void SurveyMapEntity::updateIcon()
{
	// check if static only icon
	String imageFile = "icon_" + mType + "_" + entityStates[mState] + ".dds";

	if (mIsStatic)
	{
		imageFile = "icon_" + mType + ".dds";
	}

	// set image texture to load it into memory, so TextureManager::getByName will have it loaded if files exist
	mIcon->setImageTexture(imageFile);

	TexturePtr texture = (TexturePtr)(TextureManager::getSingleton().getByName(imageFile));
	if (texture.isNull())
	{
		imageFile = "icon_missing.dds";
		texture = (TexturePtr)(TextureManager::getSingleton().getByName(imageFile));
	}

	if (!texture.isNull())
	{
		mIconSize.width  = (int)texture->getWidth();
		mIconSize.height = (int)texture->getHeight();
		mIcon->setSize(mIconSize);
	}
	
	if (mIconRotating)
	{
		mIconRotating->setCenter(MyGUI::IntPoint(mIcon->getWidth()/2, mIcon->getHeight()/2));
		mIconRotating->setAngle(mRotation);
	}
}
开发者ID:Clever-Boy,项目名称:rigs-of-rods,代码行数:33,代码来源:SurveyMapEntity.cpp

示例2: saveTexture

void TextureToolWindow::saveTexture(String texName, bool usePNG)
{
    try
    {
        TexturePtr tex = TextureManager::getSingleton().getByName(texName);
        if (tex.isNull())
            return;

        Image img;
        tex->convertToImage(img);

        // Save to disk!
        String outname = std::string(App::sys_user_dir.GetActive()) + RoR::PATH_SLASH + texName;
        if (usePNG)
            outname += ".png";

        img.save(outname);

        UTFString msg = _L("saved texture as ") + outname;
        RoR::App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_MSGTYPE_INFO, msg, "information.png");
    }
    catch (Exception& e)
    {
        UTFString str = "Exception while saving image: " + e.getFullDescription();
        RoR::App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_MSGTYPE_INFO, str, "error.png");
    }
}
开发者ID:jirijunek,项目名称:rigs-of-rods,代码行数:27,代码来源:GUI_TextureToolWindow.cpp

示例3: init

bool SurveyMapTextureCreator::init()
{
	TexturePtr texture = TextureManager::getSingleton().createManual(getTextureName(), ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, 2048, 2048, TU_RENDERTARGET, PF_R8G8B8, TU_RENDERTARGET, new ResourceBuffer());
	
	if ( texture.isNull() ) return false;;

	mRttTex = texture->getBuffer()->getRenderTarget();

	if ( !mRttTex ) return false;

	mRttTex->setAutoUpdated(false);

	mCamera = gEnv->sceneManager->createCamera(getCameraName());

	mViewport = mRttTex->addViewport(mCamera);
	mViewport->setBackgroundColour(ColourValue::Black);
	mViewport->setOverlaysEnabled(false);
	mViewport->setShadowsEnabled(false);
	mViewport->setSkiesEnabled(false);

	mMaterial = MaterialManager::getSingleton().create(getMaterialName(), ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

	if ( mMaterial.isNull() ) return false;

	mTextureUnitState = mMaterial->getTechnique(0)->getPass(0)->createTextureUnitState(getTextureName());

	mRttTex->addListener(this);

	mCamera->setFixedYawAxis(false);
	mCamera->setProjectionType(PT_ORTHOGRAPHIC);
	mCamera->setNearClipDistance(1.0f);

	return true;
}
开发者ID:Clever-Boy,项目名称:rigs-of-rods,代码行数:34,代码来源:SurveyMapTextureCreator.cpp

示例4: getTexture

TexturePtr ResourceStorage::getTexture(const std::wstring& path)
{
    TexturePtr texture = getResource<Texture>(path);
    if (texture.isNull()) {
        texture = loadTexture(path);
    }

    return texture;
}
开发者ID:von6yka,项目名称:Arcanoid-3D,代码行数:9,代码来源:ResourceStorage.cpp

示例5: setTexture

	//-----------------------------------------------------------------------------------
	void PbsMaterial::setTexture(SamplerType samplerType, TexturePtr tex, TextureAddressing textureAddr,
		float blendFactor1, float blendFactor2, BlendFunction blendFunc, float intensityFactor)
	{
		SamplerContainer& s = _samplers[samplerType];
		if (s.status == SS_ACTIVE && tex == s.tex && s.blendFunc == blendFunc && s.blendFactor1 == blendFactor1 && s.blendFactor2 == blendFactor2 &&
			s.intensity == intensityFactor && s.textureAddressing == textureAddr)
			return;
		if (s.status == SS_NOT_ACTIVE && tex.isNull())
			return;

		if (!tex.isNull())
		{
			// Ensure that the texture in the shader is in linear space
			tex->setHardwareGammaEnabled(mCanHardwareGamma && s.needsGammaCorrection);

			if (s.status == SS_NOT_ACTIVE) s.status = SS_ADDED;
			else if (s.status == SS_ACTIVE) s.status = SS_UPDATED;
			else if (s.status == SS_UPDATED) s.status = SS_UPDATED;
			else if (s.status == SS_ADDED) s.status = SS_ADDED;
			else if (s.status == SS_REMOVED) s.status = SS_UPDATED;
		}
		else
		{
			if (s.status == SS_NOT_ACTIVE) s.status = SS_NOT_ACTIVE;
			else if (s.status == SS_ACTIVE) s.status = SS_REMOVED;
			else if (s.status == SS_UPDATED) s.status = SS_REMOVED;
			else if (s.status == SS_ADDED) s.status = SS_NOT_ACTIVE;
			else if (s.status == SS_REMOVED) s.status = SS_REMOVED;
		}

		s.tex = tex;
		s.textureAddressing = textureAddr;

		s.blendFunc = blendFunc;
		s.blendFactor1 = blendFactor1;
		s.blendFactor2 = blendFactor2;

		s.intensity = intensityFactor;
		s.mipmapCount = tex.isNull() ? 0.0f : tex->getNumMipmaps();

		_hasSamplerChanged = true;
		_hasSamplerListChanged = s.status == SS_ADDED || s.status == SS_REMOVED;
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:44,代码来源:OgreHlmsPbsMaterial.cpp

示例6:

    //-----------------------------------------------------------------------
    std::pair< size_t, size_t > TextureUnitState::getTextureDimensions( unsigned int frame ) const
    {
		
		TexturePtr tex = _getTexturePtr(frame);
	    if (tex.isNull())
		    OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Could not find texture " + mFrames[ frame ],
		    "TextureUnitState::getTextureDimensions" );

		return std::pair< size_t, size_t >( tex->getWidth(), tex->getHeight() );
    }
开发者ID:Anti-Mage,项目名称:ogre,代码行数:11,代码来源:OgreTextureUnitState.cpp

示例7: setDensityMap

void GrassLayer::setDensityMap(TexturePtr map, MapChannel channel)
{
  if (densityMap) {
    densityMap->unload();
    densityMap = NULL;
  }
  if (map.isNull() == false) {
    densityMap = DensityMap::load(map, channel);
    densityMap->setFilter(densityMapFilter);
  }
}
开发者ID:junrw,项目名称:ember-gsoc2012,代码行数:11,代码来源:GrassLoader.cpp

示例8: setColorMap

void GrassLayer::setColorMap(TexturePtr map, MapChannel channel)
{
  if (colorMap) {
    colorMap->unload();
    colorMap = NULL;
  }
  if (map.isNull() == false) {
    colorMap = ColorMap::load(map, channel);
    colorMap->setFilter(colorMapFilter);
  }
}
开发者ID:junrw,项目名称:ember-gsoc2012,代码行数:11,代码来源:GrassLoader.cpp

示例9: windowResized

void DashBoard::windowResized()
{
    if (!mainWidget) return;
    mainWidget->setPosition(0, 0);
    if (textureLayer)
    {
        // texture layers are independent from the screen size, but rather from the layer texture size
        TexturePtr tex = TextureManager::getSingleton().getByName("RTTTexture1");
        if (!tex.isNull())
            mainWidget->setSize(tex->getWidth(), tex->getHeight());
    } else
    {
        MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
        mainWidget->setSize(screenSize);
    }
}
开发者ID:TheLonetrucker,项目名称:rigs-of-rods,代码行数:16,代码来源:DashBoardManager.cpp

示例10:

//-----------------------------------------------------------------------
void PagingLandScapeTexture_Splatting7::LoadAlphaMap(const String &filename) const
{
    TexturePtr tex = TextureManager::getSingleton().getByName (filename);
    if (tex.isNull())
    {
        Image Imageloader;
        const String group = PagingLandScapeOptions::getSingleton().groupName;
        Imageloader.load (filename, group);
        const size_t psize = PagingLandScapeOptions::getSingleton().PageSize - 1;
        Image ImageConvertertoAlphaFormat;
        ImageConvertertoAlphaFormat.loadDynamicImage(Imageloader.getData(),
                psize, psize, 1, PF_A8, false);

        TextureManager::getSingleton().loadImage (filename,
                group,
                ImageConvertertoAlphaFormat);
    }
}
开发者ID:proton,项目名称:ireon,代码行数:19,代码来源:OgrePagingLandScapeTexture_Splatting7.cpp

示例11: isInputPreviousTarget

//---------------------------------------------------------------------
bool CompositorManager::isInputPreviousTarget(CompositorInstance* inst, TexturePtr tex)
{
    CompositionTechnique::TargetPassIterator tpit = inst->getTechnique()->getTargetPassIterator();
    while(tpit.hasMoreElements())
    {
        CompositionTargetPass* tp = tpit.getNext();
        if (tp->getInputMode() == CompositionTargetPass::IM_PREVIOUS)
        {
            // Don't have to worry about an MRT, because no MRT can be input previous
            TexturePtr t = inst->getTextureInstance(tp->getOutputName(), 0);
            if (!t.isNull() && t.get() == tex.get())
                return true;
        }

    }

    return false;

}
开发者ID:Gerviba,项目名称:MuOnline,代码行数:20,代码来源:OgreCompositorManager.cpp

示例12: isInputToOutputTarget

//---------------------------------------------------------------------()
bool CompositorManager::isInputToOutputTarget(CompositorInstance* inst, TexturePtr tex)
{
    CompositionTargetPass* tp = inst->getTechnique()->getOutputTargetPass();
    CompositionTargetPass::PassIterator pit = tp->getPassIterator();

    while(pit.hasMoreElements())
    {
        CompositionPass* p = pit.getNext();
        for (size_t i = 0; i < p->getNumInputs(); ++i)
        {
            TexturePtr t = inst->getTextureInstance(p->getInput(i).name, 0);
            if (!t.isNull() && t.get() == tex.get())
                return true;
        }
    }

    return false;

}
开发者ID:Gerviba,项目名称:MuOnline,代码行数:20,代码来源:OgreCompositorManager.cpp

示例13: setTexture

	//-----------------------------------------------------------------------
	void TextureUnitState::setTexture( const TexturePtr& texPtr)
	{
		if (texPtr.isNull())
		{
			OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
				"Texture Pointer is empty.",
				"TextureUnitState::setTexture");
		}

		setContentType(CONTENT_NAMED);
		mTextureLoadFailed = false;

		if (texPtr->getTextureType() == TEX_TYPE_CUBE_MAP)
		{
			// delegate to cubic texture implementation
			setCubicTexture(&texPtr, true);
		}
		else
		{
			mFrames.resize(1);
			mFramePtrs.resize(1);
			mFrames[0] = texPtr->getName();
			mFramePtrs[0] = texPtr;
			// defer load until used, so don't grab pointer yet
			mCurrentFrame = 0;
			mCubic = false;
			mTextureType = texPtr->getTextureType();

			// Load immediately ?
			if (isLoaded())
			{
				_load(); // reload
			}
			// Tell parent to recalculate hash
			if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) )
			{
				mParent->_dirtyHash();
			}
		}
	}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:41,代码来源:OgreTextureUnitState.cpp

示例14: LoadTrackEv

void App::LoadTrackEv()
{
	Ogre::Timer ti;
	NewCommon(false);  // full destroy
	iObjCur = -1;

	scn->DestroyRoad();
	scn->DestroyPace();
	

	// load scene
	scn->sc->LoadXml(gcom->TrkDir()+"scene.xml");
	scn->sc->vdr = IsVdrTrack();
	if (scn->sc->vdr)  scn->sc->ter = false;
	
	//  water RTT recreate
	scn->UpdateWaterRTT(mCamera);
	
	BltWorldInit();

	UpdWndTitle();

	scn->CreateFluids();

	scn->CreateWeather();


	//  set sky tex name for water
	sh::MaterialInstance* m = mFactory->getMaterialInstance(scn->sc->skyMtr);
	std::string skyTex = sh::retrieveValue<sh::StringValue>(m->getProperty("texture"), 0).get();
	sh::Factory::getInstance().setTextureAlias("SkyReflection", skyTex);
	sh::Factory::getInstance().setTextureAlias("CubeReflection", "ReflectionCube");


	bNewHmap = false;/**/
	scn->CreateTerrain(bNewHmap, scn->sc->ter);

	if (track)
	if (scn->sc->vdr)  // vdrift track
	{
		if (!LoadTrackVdr(pSet->gui.track))
			LogO("Error during track loading: " + pSet->gui.track);
		
		CreateVdrTrack(pSet->gui.track, track);
		CreateVdrTrackBlt();
	}


	//  road ~
	scn->road = new SplineRoad(this);
	scn->road->Setup("sphere.mesh", pSet->road_sphr, scn->terrain, mSceneMgr, mCamera);
	scn->road->LoadFile(gcom->TrkDir()+"road.xml");
	scn->UpdPSSMMaterials();
	
	//  pace ~ ~
	scn->pace = new PaceNotes(pSet);
	scn->pace->Setup(mSceneMgr, mCamera, scn->terrain, gui->mGui, mWindow);
	
	
	/// HW_Inst Test  * * *
	//inst = new Instanced();
	//inst->Create(mSceneMgr,"sphere_inst.mesh");
	
	
	CreateObjects();

	if (pSet->bTrees && scn->sc->ter)
		scn->CreateTrees();  // trees after objects so they aren't inside them


	//  updates after load
	//--------------------------
	gcom->ReadTrkStats();
	gui->SetGuiFromXmls();  ///
	
	Rnd2TexSetup();
	//UpdVisGui();
	//UpdStartPos();
	UpdEditWnds();  //

	try {
	TexturePtr tex = TextureManager::getSingleton().getByName("waterDepth.png");
	if (!tex.isNull())
		tex->reload();
	} catch(...) {  }

	gui->Status("#{Loaded}", 0.5,0.7,1.0);
	
	if (pSet->check_load)
		gui->WarningsCheck(scn->sc, scn->road);

	LogO(String("::: Time Load Track: ") + fToStr(ti.getMilliseconds(),0,3) + " ms");
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:93,代码来源:SceneInit.cpp

示例15: SaveWaterDepth

///  save water depth map
//-----------------------------------------------------------------------------------------------------------
void App::SaveWaterDepth()
{
	if (scn->sc->fluids.empty())
	{
		gui->Delete(gcom->TrkDir()+"objects/waterDepth.png");  // no tex if no fluids
		return;
	}
	Ogre::Timer ti;

	//  2048 for bigger terrains ?
	int w = 1024, h = w;  float fh = h-1, fw = w-1;
	using Ogre::uint;
	uint *wd = new uint[w*h];   // water depth
	register int x,y,a,i,ia,id;
	register float fa,fd;
	
	///  write to img  -----------
	//  get ter height to fluid height difference for below
	for (y = 0; y < h; ++y) {  a = y*w;
	for (x = 0; x < w; ++x, ++a)
	{
		//  pos 0..1
		float fx = float(y)/fh, fz = float(x)/fw;
		//  pos on ter  -terSize..terSize
		float w = scn->sc->td.fTerWorldSize;
		float wx = (fx-0.5f) * w, wz = -(fz-0.5f) * w;

		fa = 0.f;  // fluid y pos
		for (i=0; i < scn->sc->fluids.size(); ++i)
		{
			const FluidBox& fb = scn->sc->fluids[i];
			const float sizex = fb.size.x*0.5f, sizez = fb.size.z*0.5f;
			//  check rect 2d - no rot !  todo: make 2nd type circle..
			if (wx > fb.pos.x - sizex && wx < fb.pos.x + sizex &&
				wz > fb.pos.z - sizez && wz < fb.pos.z + sizez)
			{
				float f = fb.pos.y - scn->terrain->getHeightAtTerrainPosition(fx,fz);
				if (f > fa)  fa = f;
			}
		}		//par
		fd = fa * 0.4f * 255.f;  // depth far  full at 2.5 m
		fa = fa * 8.f * 255.f;  // alpha near  full at 1/8 m

		ia = std::max(0, std::min(255, (int)fa ));  // clamp
		id = std::max(0, std::min(255, (int)fd ));
		
		wd[a] = 0xFF000000 + /*0x01 */ ia + 0x0100 * id;  // write
	}	}

	Image im;  // save img
	im.loadDynamicImage((uchar*)wd, w,h,1, PF_BYTE_RGBA);
	im.save(gcom->TrkDir()+"objects/waterDepth.png");
	delete[] wd;

	try {
	TexturePtr tex = TextureManager::getSingleton().getByName("waterDepth.png");
	if (!tex.isNull())
		tex->reload();
	else  // 1st fluid after start, refresh matdef ?..
		TextureManager::getSingleton().load("waterDepth.png", rgDef);
	} catch(...) {  }

	LogO(String("::: Time WaterDepth: ") + fToStr(ti.getMilliseconds(),0,3) + " ms");
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:66,代码来源:Render2tex.cpp


注:本文中的TexturePtr::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。