當前位置: 首頁>>代碼示例>>C++>>正文


C++ Technique類代碼示例

本文整理匯總了C++中Technique的典型用法代碼示例。如果您正苦於以下問題:C++ Technique類的具體用法?C++ Technique怎麽用?C++ Technique使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Technique類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: lua_Technique_removeParameter

int lua_Technique_removeParameter(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 2:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
            {
                // Get parameter 1 off the stack.
                const char* param1 = gameplay::ScriptUtil::getString(2, false);

                Technique* instance = getInstance(state);
                instance->removeParameter(param1);
                
                return 0;
            }

            lua_pushstring(state, "lua_Technique_removeParameter - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 2).");
            lua_error(state);
            break;
        }
    }
    return 0;
}
開發者ID:faustgames-ru,項目名稱:AndroidWallpapers,代碼行數:35,代碼來源:lua_Technique.cpp

示例2: while

void MaterialFactory::setShadowsEnabled(bool bEnable)
{
	for (std::vector<MaterialDefinition*>::iterator it=mDefinitions.begin();
		it!=mDefinitions.end(); ++it)
	{
		MaterialPtr mat = MaterialManager::getSingleton().getByName( (*it)->getName() );
			
		if (mat.isNull()) continue;
		
		Material::TechniqueIterator techIt = mat->getTechniqueIterator();
		while (techIt.hasMoreElements())
		{
			Technique* tech = techIt.getNext();
			Technique::PassIterator passIt = tech->getPassIterator();
			while (passIt.hasMoreElements())
			{
				Pass* pass = passIt.getNext();
									
				if (pass->hasFragmentProgram())
				{
					if ( pass->getFragmentProgramParameters()->_findNamedConstantDefinition("enableShadows", false))
						pass->getFragmentProgramParameters()->setNamedConstant("enableShadows", Real(bEnable));
				}
			}
		}
		
	}
}
開發者ID:sureandrew,項目名稱:stuntrally,代碼行數:28,代碼來源:MaterialFactory.cpp

示例3: while

void CarModel::ChangeClr()
{
	int i = iColor;
	float c_h = pSet->gui.car_hue[i], c_s = pSet->gui.car_sat[i],
	      c_v = pSet->gui.car_val[i], gloss = pSet->gui.car_gloss[i], refl = pSet->gui.car_refl[i];
	color.setHSB(1-c_h, c_s, c_v);  //set, mini pos clr

	MaterialPtr mtr = MaterialManager::getSingleton().getByName(sMtr[Mtr_CarBody]);
	if (!mtr.isNull())
	{	Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
		while (techIt.hasMoreElements())
		{	Technique* tech = techIt.getNext();
			Technique::PassIterator passIt = tech->getPassIterator();
			while (passIt.hasMoreElements())
			{	Pass* pass = passIt.getNext();
				if (pass->hasFragmentProgram())
				{
					GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
					params->setNamedConstant("carColour", color);
					params->setNamedConstant("glossiness", 1 - gloss);
					params->setNamedConstant("reflectiveness", refl);
	}	}	}	}

	if (pNickTxt)
		pNickTxt->setTextColour(MyGUI::Colour(color.r,color.g,color.b));
	
	// opp list text and mini pos colors - auto in hud update
}
開發者ID:Mixone-FinallyHere,項目名稱:stuntrally,代碼行數:28,代碼來源:CarModel_Update.cpp

示例4: while

void BatchPage::build()
{
	batch->build();

	BatchedGeometry::SubBatchIterator it = batch->getSubBatchIterator();
	while (it.hasMoreElements()){
		BatchedGeometry::SubBatch *subBatch = it.getNext();
		MaterialPtr mat = subBatch->getMaterial();

		//Disable specular unless a custom shader is being used.
		//This is done because the default shader applied by BatchPage
		//doesn't support specular, and fixed-function needs to look
		//the same as the shader (for computers with no shader support)
		for (int t = 0; t < mat->getNumTechniques(); ++t){
			Technique *tech = mat->getTechnique(t);
			for (int p = 0; p < tech->getNumPasses(); ++p){
				Pass *pass = tech->getPass(p);
				if (pass->getVertexProgramName() == "")
					pass->setSpecular(0, 0, 0, 1);
			}
		}

		//Store the original materials
		unfadedMaterials.push_back(subBatch->getMaterial());
	}

	_updateShaders();
}
開發者ID:Chimangoo,項目名稱:ember,代碼行數:28,代碼來源:BatchPage.cpp

示例5: getSafeTextureUnitState

int GameScript::getSafeTextureUnitState(TextureUnitState **tu, const String materialName, int techniqueNum, int passNum, int textureUnitNum)
{
	try
	{
		MaterialPtr m = MaterialManager::getSingleton().getByName(materialName);
		if (m.isNull()) return 1;

		// verify technique
		if (techniqueNum < 0 || techniqueNum > m->getNumTechniques()) return 2;
		Technique *t = m->getTechnique(techniqueNum);
		if (!t) return 2;

		//verify pass
		if (passNum < 0 || passNum > t->getNumPasses()) return 3;
		Pass *p = t->getPass(passNum);
		if (!p) return 3;

		//verify texture unit
		if (textureUnitNum < 0 || textureUnitNum > p->getNumTextureUnitStates()) return 4;
		TextureUnitState *tut = p->getTextureUnitState(textureUnitNum);
		if (!tut) return 4;

		*tu = tut;
		return 0;
	} catch(Exception e)
	{
		SLOG("Exception in getSafeTextureUnitState(): " + e.getFullDescription());
	}
	return 1;
}
開發者ID:Bob-Z,項目名稱:rigs-of-rods,代碼行數:30,代碼來源:GameScript.cpp

示例6: while

//-----------------------------------------------------------------------------
///
void BatchPage::build()
{
	m_pBatchGeom->build();
	BatchedGeometry::TSubBatchIterator it = m_pBatchGeom->getSubBatchIterator();

	while (it.hasMoreElements())
   {
		BatchedGeometry::SubBatch *subBatch = it.getNext();
		const MaterialPtr &ptrMat = subBatch->getMaterial();

		//Disable specular unless a custom shader is being used.
		//This is done because the default shader applied by BatchPage
		//doesn't support specular, and fixed-function needs to look
		//the same as the shader (for computers with no shader support)
		for (unsigned short t = 0, tCnt = ptrMat->getNumTechniques(); t < tCnt; ++t)
      {
			Technique *tech = ptrMat->getTechnique(t);
			for (unsigned short p = 0, pCnt = tech->getNumPasses(); p < pCnt; ++p)
         {
				Pass *pass = tech->getPass(p);
				//if (pass->getVertexProgramName() == "")
				//	pass->setSpecular(0, 0, 0, 1);
            if (!pass->hasVertexProgram())
               pass->setSpecular(0.f, 0.f, 0.f, 1.f);
			}
		}

		//Store the original materials
		m_vecUnfadedMaterials.push_back(subBatch->getMaterial());
	}

	_updateShaders();
}
開發者ID:drwbns,項目名稱:ogre-paged-latest,代碼行數:35,代碼來源:BatchPage.cpp

示例7: GP_ASSERT

void Model::setMaterialNodeBinding(Material *material)
{
    GP_ASSERT(material);

    if (_node)
    {
        material->setNodeBinding(_node);

        unsigned int techniqueCount = material->getTechniqueCount();
        for (unsigned int i = 0; i < techniqueCount; ++i)
        {
            Technique* technique = material->getTechniqueByIndex(i);
            GP_ASSERT(technique);
            
            technique->setNodeBinding(_node);

            unsigned int passCount = technique->getPassCount();
            for (unsigned int j = 0; j < passCount; ++j)
            {
                Pass* pass = technique->getPassByIndex(j);
                GP_ASSERT(pass);

                pass->setNodeBinding(_node);
            }
        }
    }
}
開發者ID:5guo,項目名稱:GamePlay,代碼行數:27,代碼來源:Model.cpp

示例8: lua_Technique_addRef

static int lua_Technique_addRef(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Technique* instance = getInstance(state);
                instance->addRef();
                
                return 0;
            }

            lua_pushstring(state, "lua_Technique_addRef - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}
開發者ID:03050903,項目名稱:GamePlay,代碼行數:31,代碼來源:lua_Technique.cpp

示例9: lua_Technique_getPassCount

static int lua_Technique_getPassCount(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Technique* instance = getInstance(state);
                unsigned int result = instance->getPassCount();

                // Push the return value onto the stack.
                lua_pushunsigned(state, result);

                return 1;
            }

            lua_pushstring(state, "lua_Technique_getPassCount - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}
開發者ID:03050903,項目名稱:GamePlay,代碼行數:34,代碼來源:lua_Technique.cpp

示例10: Draw

	void SpriteShape::Draw(IGraphicsDevice *device, RenderState &state)
	{
		IGraphicsContext *context = device->GetContext();
		
		Effect *effect = context->GetEffect("Sprite");
		if(mHasBackgroundImage) {
			effect->SetActiveTechnique("SpriteTexture");
		} else {
			effect->SetActiveTechnique("SpriteColor");
		}

		glm::mat4 wvp = state.GetWorldViewProjection();

		state.SetShaderData(mWVPIndex, &wvp);
		state.SetShaderData(mFrameIndex, &mFrame);
		state.SetShaderData(mTextureFrameIndex, &mTexFrame);
		state.SetShaderData(mBackgroundColorIndex, &mBackgroundColor);

		if(mBackgroundImage) {
			state.SetShaderData(mBackgroundImageIndex, mBackgroundImage);
		}

		state.SetShaderData(mBorderWidthIndex, &mBorderWidth);
		state.SetShaderData(mBorderColorIndex, &mBorderColor);

		if(sSpriteVertexBuffer) {
			Technique *technique = effect->GetActiveTechnique();
			technique->Begin();
			while(technique->HasNextPass()) {
				sSpriteVertexBuffer->Activate();
				technique->ProcessNextPass(device, state);
				device->Draw(PrimitiveTypeTriangleStrip, 4, 0);
			}
		}
	}
開發者ID:metsfan,項目名稱:challenge-engine,代碼行數:35,代碼來源:SpriteShape.cpp

示例11: getQueueGroup

    //-----------------------------------------------------------------------
    void RenderQueue::addRenderable(Renderable* pRend, uint8 groupID, ushort priority)
    {
        // Find group
        RenderQueueGroup* pGroup = getQueueGroup(groupID);


		Technique* pTech;

		// tell material it's been used
		if (!pRend->getMaterial().isNull())
			pRend->getMaterial()->touch();

		// Check material & technique supplied (the former since the default implementation
        // of getTechnique is based on it for backwards compatibility
        if(pRend->getMaterial().isNull() || !(pTech = pRend->getTechnique()))
        {
            // Use default base white
			MaterialPtr baseWhite = MaterialManager::getSingleton().getByName("BaseWhite");
            pTech = baseWhite->getTechnique(0);
        }

		if (mRenderableListener)
		{
			// Allow listener to override technique and to abort
			if (!mRenderableListener->renderableQueued(pRend, groupID, priority, 
				&pTech, this))
				return; // rejected

			// tell material it's been used (incase changed)
			pTech->getParent()->touch();
		}
		
        pGroup->addRenderable(pRend, pTech, priority);

    }
開發者ID:masonh,項目名稱:marblemax,代碼行數:36,代碼來源:OgreRenderQueue.cpp

示例12: materialCreated

void App::materialCreated(sh::MaterialInstance* m, const std::string& configuration, unsigned short lodIndex)
{
	Technique* t = static_cast<sh::OgreMaterial*>(m->getMaterial())->getOgreTechniqueForConfiguration (configuration, lodIndex);

	if (pSet->shadow_type == Sh_None)
	{
		t->setShadowCasterMaterial("");
		return;
	}

	/*if (m->hasProperty("transparent") && m->hasProperty("cull_hardware") &&
		sh::retrieveValue<sh::StringValue>(m->getProperty("cull_hardware"), 0).get() == "none")
	{
		// Crash !?
		assert(!MaterialManager::getSingleton().getByName("PSSM/shadow_caster_nocull").isNull ());
		t->setShadowCasterMaterial("shadowcaster_nocull");
	}*/

	if (m->hasProperty("instancing") && sh::retrieveValue<sh::StringValue>(m->getProperty("instancing"), 0).get() == "true")
	{
		t->setShadowCasterMaterial("shadowcaster_instancing");
	}

	if (!m->hasProperty("transparent") || !sh::retrieveValue<sh::BooleanValue>(m->getProperty("transparent"), 0).get())
	{
		t->setShadowCasterMaterial("shadowcaster_noalpha");
	}
}
開發者ID:Mixone-FinallyHere,項目名稱:stuntrally,代碼行數:28,代碼來源:CGame.cpp

示例13: visit

		void visit(Renderable* rend, ushort lodIndex, bool isDebug, 
			Any* pAny = 0)
		{
			Technique* tech = rend->getTechnique();
			bool techReceivesShadows = tech && tech->getParent()->getReceiveShadows();
			anyReceiveShadows = anyReceiveShadows || 
				techReceivesShadows || !tech;
		}
開發者ID:jjiezheng,項目名稱:pap_full,代碼行數:8,代碼來源:OgreMovableObject.cpp

示例14: ReleaseShaders

void Material::ReleaseShaders()
{
    for (unsigned i = 0; i < techniques_.Size(); ++i)
    {
        Technique* tech = techniques_[i].technique_;
        if (tech)
            tech->ReleaseShaders();
    }
}
開發者ID:SkunkWorks99,項目名稱:Urho3D,代碼行數:9,代碼來源:Material.cpp

示例15: injectTechnique

//-----------------------------------------------------------------------
void DeferredLightRenderOperation::execute(SceneManager *sm, RenderSystem *rs)
{
    Ogre::Camera* cam = mViewport->getCamera();

	mAmbientLight->updateFromCamera(cam);
    Technique* tech = mAmbientLight->getMaterial()->getBestTechnique();
	injectTechnique(sm, tech, mAmbientLight, 0);

	const LightList& lightList = sm->_getLightsAffectingFrustum();
    for (LightList::const_iterator it = lightList.begin(); it != lightList.end(); it++) 
	{
        Light* light = *it;
		Ogre::LightList ll;
		ll.push_back(light);

		//if (++i != 2) continue;
        //if (light->getType() != Light::LT_DIRECTIONAL) continue;
		//if (light->getDiffuseColour() != ColourValue::Red) continue;

		LightsMap::iterator dLightIt = mLights.find(light);
		DLight* dLight = 0;
		if (dLightIt == mLights.end()) 
		{
			dLight = createDLight(light);
		}
		else 
		{
			dLight = dLightIt->second;
			dLight->updateFromParent();
		}
		dLight->updateFromCamera(cam);
		tech = dLight->getMaterial()->getBestTechnique();

		//Update shadow texture
		if (dLight->getCastChadows())
		{
			SceneManager::RenderContext* context = sm->_pauseRendering();

			sm->prepareShadowTextures(cam, mViewport, &ll);
			sm->_resumeRendering(context);
			
			Pass* pass = tech->getPass(0);
			TextureUnitState* tus = pass->getTextureUnitState("ShadowMap");
			assert(tus);
			const TexturePtr& shadowTex = sm->getShadowTexture(0);
			if (tus->_getTexturePtr() != shadowTex)
			{
				tus->_setTexturePtr(shadowTex);
			}
			
		}
		
        injectTechnique(sm, tech, dLight, &ll);
	}
}
開發者ID:Strongc,項目名稱:game-ui-solution,代碼行數:56,代碼來源:DeferredLightCP.cpp


注:本文中的Technique類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。