本文整理汇总了C++中TextureUnitState::setProjectiveTexturing方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::setProjectiveTexturing方法的具体用法?C++ TextureUnitState::setProjectiveTexturing怎么用?C++ TextureUnitState::setProjectiveTexturing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::setProjectiveTexturing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeMaterialReceiveDecal
void FiveApp::makeMaterialReceiveDecal(const String & matName)
{
MaterialPtr mat = (MaterialPtr)MaterialManager::getSingleton().getByName(matName);
Pass *pass = mat->getTechnique(0)->createPass();
pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
pass->setDepthBias(1);
pass->setLightingEnabled(true);
TextureUnitState *texState = pass->createTextureUnitState("decal.png");
texState->setProjectiveTexturing(true,mDecalFrustum);
texState->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
texState->setTextureFiltering(FO_LINEAR,FO_LINEAR,FO_NONE);
texState = pass->createTextureUnitState("decal_filter.png");
texState->setProjectiveTexturing(true,mFilterFrustum);
texState->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
texState->setTextureFiltering(TFO_NONE);
}
示例2: plane
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(0, 0, 0));
//mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja", "ninja.mesh");
entNinja->setCastShadows(true);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane, 1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* entGround = mSceneMgr->createEntity("GroundEntity", "ground");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
entGround->setMaterialName("Examples/Rockwall");
//entGround->setMaterialName("RttMat");
entGround->setCastShadows(false);
Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");
headNode->attachObject(ogreHead);
headNode->setPosition(50,120,0);
Ogre::Light* pointLight = mSceneMgr->createLight("pointLight");
pointLight->setType(Ogre::Light::LT_POINT);
pointLight->setPosition(Ogre::Vector3(0, 150, 250));
pointLight->setDiffuseColour(1.0, 0.0, 0.0);
pointLight->setSpecularColour(1.0, 0.0, 0.0);
Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");
directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
directionalLight->setDiffuseColour(Ogre::ColourValue(.25, .25, 0));
directionalLight->setSpecularColour(Ogre::ColourValue(.25, .25, 0));
directionalLight->setDirection(Ogre::Vector3( 0, -1, 1 ));
Ogre::Light* spotLight = mSceneMgr->createLight("spotLight");
spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
spotLight->setDiffuseColour(0, 0, 1.0);
spotLight->setSpecularColour(0, 0, 1.0);
spotLight->setDirection(-1, -1, 0);
spotLight->setPosition(Ogre::Vector3(300, 300, 0));
spotLight->setSpotlightRange(Ogre::Degree(35), Ogre::Degree(50));
//------------------
using namespace Ogre;
TexturePtr texture = TextureManager::getSingleton().
createManual( "RttTex",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D,512, 512, 0, PF_R8G8B8, TU_RENDERTARGET );
RenderTarget *rttTex = texture->getBuffer()->getRenderTarget();
mReflectCam = mSceneMgr->createCamera("ReflectCam");
mReflectCam->setOrientation(mCamera->getOrientation());
mReflectCam->setPosition(mCamera->getPosition());
mReflectCam->setNearClipDistance(mCamera->getNearClipDistance());
mReflectCam->setFarClipDistance(mCamera->getFarClipDistance());
mReflectCam->setAspectRatio(
(Real)mWindow->getViewport(0)->getActualWidth() /
(Real)mWindow->getViewport(0)->getActualHeight());
Viewport *v = rttTex->addViewport( mReflectCam );
v->setClearEveryFrame( true );
v->setBackgroundColour( ColourValue::Black );
//MaterialPtr mat = MaterialManager::getSingleton().create("RttMat",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
//TextureUnitState* t = mat->getTechnique(0)->getPass(0)->createTextureUnitState("RustedMetal.jpg");
MaterialPtr mat;
TextureUnitState *t = NULL;
Entity *entMaterial = entGround ;
int nCnt = entGround->getNumSubEntities();
for ( int i=0; i<nCnt; i++)
{
SubEntity* _SubEnt = entMaterial->getSubEntity(i);
MaterialPtr _MaterPtr;
Pass * _Pass;
mat = _SubEnt->getMaterial();
break;
}
t = mat->getTechnique(0)->getPass(0)->createTextureUnitState("RttTex");
// Blend with base texture
t->setColourOperationEx(LBX_BLEND_MANUAL, LBS_TEXTURE, LBS_CURRENT,ColourValue::White, ColourValue::White, 0.65);
t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
t->setProjectiveTexturing(true, mReflectCam);
rttTex->addListener(this);
// set up linked reflection
mReflectCam->enableReflection(plane);
//.........这里部分代码省略.........