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


C++ TextureUnitState::setColourOperationEx方法代码示例

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


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

示例1: init

	void DebugDisplay::init( OverhangTerrainSceneManager * pSceneManager)
	{
		oht_assert_threadmodel(ThrMdl_Main);

		_pSceneManager = pSceneManager;

		MaterialManager & matman = MaterialManager::getSingleton();
		MaterialPtr pMat;
		TextureUnitState * pTexUnit;
		Pass * pPass;

		pMat = matman.create("Debug/Red", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		pPass = pMat->getTechnique(0) ->getPass(0);
		pPass->setPointSize(5.0f);
		pTexUnit = pPass->createTextureUnitState("color");
		pTexUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue::Red);
		_pMaterials[MC_Red] = pMat;

		pMat = matman.create("Debug/Green", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		pPass = pMat->getTechnique(0) ->getPass(0);
		pPass->setPointSize(5.0f);
		pTexUnit = pPass->createTextureUnitState("color");
		pTexUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue::Green);
		_pMaterials[MC_Green] = pMat;

		pMat = matman.create("Debug/Blue", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		pPass = pMat->getTechnique(0) ->getPass(0);
		pPass->setPointSize(5.0f);
		pTexUnit = pPass->createTextureUnitState("color");
		pTexUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue::Blue);
		_pMaterials[MC_Blue] = pMat;

		pMat = matman.create("Debug/Yellow", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		pPass = pMat->getTechnique(0) ->getPass(0);
		pPass->setPointSize(5.0f);
		pTexUnit = pPass->createTextureUnitState("color");
		pTexUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue(1.0f, 1.0f, 0.0f));
		_pMaterials[MC_Yellow] = pMat;

		pMat = matman.create("Debug/Turquoise", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		pPass = pMat->getTechnique(0) ->getPass(0);
		pPass->setPointSize(5.0f);
		pTexUnit = pPass->createTextureUnitState("color");
		pTexUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue(0.0f, 1.0f, 1.0f));
		_pMaterials[MC_Turquoise] = pMat;

		pMat = matman.create("Debug/Magenta", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		pPass = pMat->getTechnique(0) ->getPass(0);
		pPass->setPointSize(5.0f);
		pTexUnit = pPass->createTextureUnitState("color");
		pTexUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue(1.0f, 0.0f, 1.0f));
		_pMaterials[MC_Magenta] = pMat;

		_pScNode = _pSceneManager->getRootSceneNode()->createChildSceneNode("OverhangTerrain::DebugTools");
	}
开发者ID:MadMartian,项目名称:OhTSM,代码行数:55,代码来源:DebugTools.cpp

示例2: setupContent

void PlayPen_testManualBlend::setupContent()
{
	// create material
	MaterialPtr mat = MaterialManager::getSingleton().create("TestMat", 
		TRANSIENT_RESOURCE_GROUP);
	Pass * p = mat->getTechnique(0)->getPass(0);
	p->setLightingEnabled(false);
	p->createTextureUnitState("Dirt.jpg");
	TextureUnitState* t = p->createTextureUnitState("ogrelogo.png");
	t->setColourOperationEx(LBX_BLEND_MANUAL, LBS_TEXTURE, LBS_CURRENT, 
		ColourValue::White, ColourValue::White, 0.75);

	Entity *planeEnt = mSceneMgr->createEntity("Plane", SceneManager::PT_PLANE);
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(planeEnt);
	planeEnt->setMaterialName("TestMat");

	mCamera->setPosition(0,0,600);
	mCamera->lookAt(Vector3::ZERO);
}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:19,代码来源:PlayPenSamples.cpp

示例3: ManualObject

OgreDebugDrawer::OgreDebugDrawer( SceneManager *scm )
{
    mContactPoints = &mContactPoints1;
    mLines = new ManualObject("physics lines");
    ASSERT( mLines );
    mTriangles = new ManualObject("physics triangles");
    ASSERT( mTriangles );
    mLines->setDynamic(true);
    mTriangles->setDynamic(true);
    //mLines->estimateVertexCount( 100000 );
    //mLines->estimateIndexCount( 0 );
 
    scm->getRootSceneNode()->attachObject( mLines );
    scm->getRootSceneNode()->attachObject( mTriangles );
 
    static const char * matName = "OgreBulletCollisionsDebugDefault";
    MaterialPtr mtl = MaterialManager::getSingleton().getDefaultSettings()->clone(matName);
    mtl->setReceiveShadows(false);
    mtl->setSceneBlending( SBT_TRANSPARENT_ALPHA );
    mtl->setDepthBias( 0.1, 0 );
    TextureUnitState * tu = mtl->getTechnique(0)->getPass(0)->createTextureUnitState();
    ASSERT( tu );
    tu->setColourOperationEx( LBX_SOURCE1, LBS_DIFFUSE );
    mtl->getTechnique(0)->setLightingEnabled(false);
    //mtl->getTechnique(0)->setSelfIllumination( ColourValue::White ); 
 
    mLines->begin( matName, RenderOperation::OT_LINE_LIST );
    mLines->position( Vector3::ZERO );
    mLines->colour( ColourValue::Blue );
    mLines->position( Vector3::ZERO );
    mLines->colour( ColourValue::Blue );
 
    mTriangles->begin( matName, RenderOperation::OT_TRIANGLE_LIST );
    mTriangles->position( Vector3::ZERO );
    mTriangles->colour( ColourValue::Blue );
    mTriangles->position( Vector3::ZERO );
    mTriangles->colour( ColourValue::Blue );
    mTriangles->position( Vector3::ZERO );
    mTriangles->colour( ColourValue::Blue );
 
    mDebugModes = (DebugDrawModes) DBG_DrawWireframe;
    Root::getSingleton().addFrameListener(this);
}
开发者ID:pacha64,项目名称:untitled-3d-platformer,代码行数:43,代码来源:DebugDrawer.cpp

示例4: _compileIlluminationPasses

    //-----------------------------------------------------------------------
    void Technique::_compileIlluminationPasses(void)
    {
        clearIlluminationPasses();

		if (!checkManuallyOrganisedIlluminationPasses())
		{
			// Build based on our own heuristics

			Passes::iterator i, iend;
			iend = mPasses.end();
			i = mPasses.begin();

			IlluminationStage iStage = IS_AMBIENT;

			bool haveAmbient = false;
			while (i != iend)
			{
				IlluminationPass* iPass;
				Pass* p = *i;
				switch(iStage)
				{
				case IS_AMBIENT:
					// Keep looking for ambient only
					if (p->isAmbientOnly())
					{
						// Add this pass wholesale
						iPass = OGRE_NEW IlluminationPass();
						iPass->destroyOnShutdown = false;
						iPass->originalPass = iPass->pass = p;
						iPass->stage = iStage;
						mIlluminationPasses.push_back(iPass);
						haveAmbient = true;
						// progress to next pass
						++i;
					}
					else
					{
						// Split off any ambient part
						if (p->getAmbient() != ColourValue::Black ||
							p->getSelfIllumination() != ColourValue::Black ||
							p->getAlphaRejectFunction() != CMPF_ALWAYS_PASS)
						{
							// Copy existing pass
							Pass* newPass = OGRE_NEW Pass(this, p->getIndex(), *p);
							if (newPass->getAlphaRejectFunction() != CMPF_ALWAYS_PASS)
							{
								// Alpha rejection passes must retain their transparency, so
								// we allow the texture units, but override the colour functions
								Pass::TextureUnitStateIterator tusi = newPass->getTextureUnitStateIterator();
								while (tusi.hasMoreElements())
								{
									TextureUnitState* tus = tusi.getNext();
									tus->setColourOperationEx(LBX_SOURCE1, LBS_CURRENT);
								}
							}
							else
							{
								// Remove any texture units
								newPass->removeAllTextureUnitStates();
							}
							// Remove any fragment program
							if (newPass->hasFragmentProgram())
								newPass->setFragmentProgram("");
							// We have to leave vertex program alone (if any) and
							// just trust that the author is using light bindings, which
							// we will ensure there are none in the ambient pass
							newPass->setDiffuse(0, 0, 0, newPass->getDiffuse().a);  // Preserving alpha
							newPass->setSpecular(ColourValue::Black);

							// Calculate hash value for new pass, because we are compiling
							// illumination passes on demand, which will loss hash calculate
							// before it add to render queue first time.
							newPass->_recalculateHash();

							iPass = OGRE_NEW IlluminationPass();
							iPass->destroyOnShutdown = true;
							iPass->originalPass = p;
							iPass->pass = newPass;
							iPass->stage = iStage;

							mIlluminationPasses.push_back(iPass);
							haveAmbient = true;

						}

						if (!haveAmbient)
						{
							// Make up a new basic pass
							Pass* newPass = OGRE_NEW Pass(this, p->getIndex());
							newPass->setAmbient(ColourValue::Black);
							newPass->setDiffuse(ColourValue::Black);

							// Calculate hash value for new pass, because we are compiling
							// illumination passes on demand, which will loss hash calculate
							// before it add to render queue first time.
							newPass->_recalculateHash();

							iPass = OGRE_NEW IlluminationPass();
							iPass->destroyOnShutdown = true;
//.........这里部分代码省略.........
开发者ID:RoboticOxygen,项目名称:extramegablob,代码行数:101,代码来源:OgreTechnique.cpp

示例5: createBackground

// Create the background nebulae
void createBackground(SceneManager *sceneMgr) {
	
	// Get the background image
	String bgImage = ScriptSystem::getSingleton().getScriptString("backgroundImage");
	MaterialPtr mat = MaterialManager::getSingleton().getByName("Background");
	mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(bgImage);

	// Get the nebula textures, and set their colors
	ColourValue col;
	col.r = ScriptSystem::getSingleton().getScriptNumber("nebula1_R");
	col.g = ScriptSystem::getSingleton().getScriptNumber("nebula1_G");
	col.b = ScriptSystem::getSingleton().getScriptNumber("nebula1_B");
	mat = MaterialManager::getSingleton().getByName("BackgroundNebula1");
	TextureUnitState *tu = mat->getTechnique(0)->getPass(0)->getTextureUnitState(1);
	tu->setColourOperationEx(LBX_MODULATE, LBS_CURRENT, LBS_MANUAL, col, col);

	col.r = ScriptSystem::getSingleton().getScriptNumber("nebula2_R");
	col.g = ScriptSystem::getSingleton().getScriptNumber("nebula2_G");
	col.b = ScriptSystem::getSingleton().getScriptNumber("nebula2_B");
	mat = MaterialManager::getSingleton().getByName("BackgroundNebula2");
	tu = mat->getTechnique(0)->getPass(0)->getTextureUnitState(1);
	tu->setColourOperationEx(LBX_MODULATE, LBS_CURRENT, LBS_MANUAL, col, col);

	col.r = ScriptSystem::getSingleton().getScriptNumber("nebula3_R");
	col.g = ScriptSystem::getSingleton().getScriptNumber("nebula3_G");
	col.b = ScriptSystem::getSingleton().getScriptNumber("nebula3_B");
	mat = MaterialManager::getSingleton().getByName("BackgroundNebula3");
	tu = mat->getTechnique(0)->getPass(0)->getTextureUnitState(1);
	tu->setColourOperationEx(LBX_MODULATE, LBS_CURRENT, LBS_MANUAL, col, col);


	// Create background rectangle covering the whole screen
	bgRect = new Rectangle2D(true);
	// Flipping and mirroring
	Real bgx = rand()%100 < 50 ? -1.0f : 1.0f;
	Real bgy = rand()%100 < 50 ? -1.0f : 1.0f;
	bgRect->setCorners(-bgx, bgy, bgx, -bgy);
	bgRect->setMaterial(MaterialManager::getSingleton().getByName("Background"));

	// Render the background before everything else
	bgRect->setRenderQueueGroup(RENDER_QUEUE_SKIES_EARLY);
	AxisAlignedBox box; box.setInfinite();
	bgRect->setBoundingBox(box);

	// Attach background to the scene
	SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("Background");
	node->attachObject(bgRect);


	// Background stars
	int starsCount = (int)ScriptSystem::getSingleton().getScriptNumber("starsCount");
	ManualObject *stars[4];
	for(int ii=0; ii<4; ii++) {
		stars[ii] = sceneMgr->createManualObject("BackgroundStars" + StringConverter::toString(ii+1));
		stars[ii]->begin("BackgroundStars", RenderOperation::OT_POINT_LIST);
		for(int j=0; j<starsCount; j++) {
			Vector3 pos;
			pos.x = Math::RangeRandom(-playfieldWidth, playfieldWidth);
			pos.y = Math::RangeRandom(-playfieldHeight, playfieldHeight);
			pos.z = Math::RangeRandom(-140, -5);
			stars[ii]->position(pos);

			Real c = Math::RangeRandom(0.1f, 1.0f);
			stars[ii]->colour(c, c, c);
			stars[ii]->index(j);
		}
		stars[ii]->end();
		stars[ii]->setRenderQueueGroup(RENDER_QUEUE_1);
		stars[ii]->setCastShadows(false);
	}

	// Create four groups of stars
	SceneNode *starsNode = sceneMgr->getRootSceneNode()->createChildSceneNode("BackgroundStars1");
	starsNode->attachObject(stars[0]);
	starsNode->translate(-playfieldWidth/2, -playfieldHeight/2, 0);

	starsNode = sceneMgr->getRootSceneNode()->createChildSceneNode("BackgroundStars2");
	starsNode->attachObject(stars[1]);
	starsNode->translate(+playfieldWidth/2, -playfieldHeight/2, 0);

	starsNode = sceneMgr->getRootSceneNode()->createChildSceneNode("BackgroundStars3");
	starsNode->attachObject(stars[2]);
	starsNode->translate(+playfieldWidth/2, +playfieldHeight/2, 0);

	starsNode = sceneMgr->getRootSceneNode()->createChildSceneNode("BackgroundStars4");
	starsNode->attachObject(stars[3]);
	starsNode->translate(-playfieldWidth/2, +playfieldHeight/2, 0);


	// Create the nebulae
	nebulaCount = (int)ScriptSystem::getSingleton().getScriptNumber("nebulaCount");
	for(int f=0; f<nebulaCount; f++) {
		Entity *ent = sceneMgr->createEntity("BackgroundNebula" + StringConverter::toString(f), "Plane.mesh");
		ent->setMaterialName("BackgroundNebula" + StringConverter::toString(f%3 + 1));
		ent->setCastShadows(false);
		ent->setRenderQueueGroup(RENDER_QUEUE_SKIES_EARLY);

		Vector3 pos;
		pos.x = Math::RangeRandom(-playfieldWidth, playfieldWidth);
//.........这里部分代码省略.........
开发者ID:fishilico,项目名称:funguloids,代码行数:101,代码来源:bground.cpp

示例6: 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);
//.........这里部分代码省略.........
开发者ID:shanfl,项目名称:ogre_tut_demo,代码行数:101,代码来源:BasicTutorial2.cpp


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