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


C++ Renderable::GetMaterialInstance方法代码示例

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


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

示例1: Draw

//----------------------------------------------------------------------------
void LinearDepth_Material::Draw(Renderer* renderer,
	const VisibleSet& visibleSet)
{
	EnvirParamController *curEnvirParam = PX2_GR.GetCurEnvirParamController();

	mOverRideOffsetProperty->FillEnabled = true;
	mOverRideOffsetProperty->Scale = curEnvirParam->GetShadowMap_OffsetPropertyScale();
	mOverRideOffsetProperty->Bias = curEnvirParam->GetShadowMap_OffsetPropertyBias();
	renderer->SetOverrideOffsetProperty(mOverRideOffsetProperty);

	const int numVisible = visibleSet.GetNumVisible();
	for (int j = 0; j < numVisible; ++j)
	{
		Renderable *renderable = visibleSet.GetVisible(j);
		MaterialInstancePtr save = renderable->GetMaterialInstance();
		const std::string &mtlName = save->GetMaterial()->GetName();

		if ("std" == mtlName)
		{
			mInstanceStd->SetPixelTexture(0, "SampleBase", save->GetPixelTexture(0, "SampleBase"));

			renderable->SetMaterialInstance(mInstanceStd);
			renderer->Draw(renderable);

			renderable->SetMaterialInstance(save);
			save->Update(0.0f, 0.0f);
		}
		else if ("skinskeleton" == mtlName)
		{
			//mInstanceSkinSkeleton->SetPixelTexture(0, "SampleBase", save->GetPixelTexture(0, "SampleBase"));

			//renderable->SetMaterialInstance(mInstanceSkinSkeleton);
			renderer->Draw(renderable);

			//renderable->SetMaterialInstance(save);
			//save->Update(0.0f, 0.0f);
		}
		else if ("terrain" == mtlName)
		{
			renderable->SetMaterialInstance(mInstanceTerrain);
			renderer->Draw(renderable);

			renderable->SetMaterialInstance(save);
			save->Update(0.0f, 0.0f);
		}
	}

	renderer->SetOverrideOffsetProperty(0);
}
开发者ID:PhoenixSteam,项目名称:Phoenix3D,代码行数:50,代码来源:PX2LinearDepthMaterial.cpp

示例2: SetTreeLevel


//.........这里部分代码省略.........
		{
			addMaterial = true;
		}
	}
	else if (PTL_DETAIL == mTreeLevel)
	{
		if (!scene && !proj && mov)
		{
			addCtrl = true;
		}

		if (!scene && !proj && node)
		{
			addNode = true;
		}

		if (renderable)
		{
			addMaterial = true;
		}
	}

	if (addCtrl)
	{
		int numCtrls = mov->GetNumControllers();
		for (int i = 0; i < numCtrls; i++)
		{
			Controller *ctrl = mov->GetController(i);

			AddChild(ctrl, mIconID, mTreeLevel, mIsShowHelpNode);
		}
	}

	if (addMaterial)
	{
		MaterialInstance *mtlInst = renderable->GetMaterialInstance();
		Material *mtl = mtlInst->GetMaterial();
		AddChild(mtl, mIconID, mTreeLevel, mIsShowHelpNode);
	}
	if (mtl)
	{
		int numTechniques = mtl->GetNumTechniques();
		for (int i = 0; i < numTechniques; i++)
		{
			MaterialTechnique *mtlTechnique = mtl->GetTechnique(i);
			AddChild(mtlTechnique, mIconID, mTreeLevel, isShowHelpNode);
		}
	}
	if (mtlTechnique)
	{
		int numPasses = mtlTechnique->GetNumPasses();
		for (int i = 0; i < numPasses; i++)
		{
			MaterialPass *mtlPass = mtlTechnique->GetPass(i);
			AddChild(mtlPass, mIconID, mTreeLevel, isShowHelpNode);
		}
	}
	if (mtlPass)
	{
		AddChild(mtlPass->GetVertexShader(), mIconID, mTreeLevel, isShowHelpNode);
		AddChild(mtlPass->GetPixelShader(), mIconID, mTreeLevel, isShowHelpNode);

		AddChild(mtlPass->GetAlphaProperty(), mIconID, mTreeLevel, isShowHelpNode);
		AddChild(mtlPass->GetCullProperty(), mIconID, mTreeLevel, isShowHelpNode);
		AddChild(mtlPass->GetDepthProperty(), mIconID, mTreeLevel, isShowHelpNode);
		AddChild(mtlPass->GetOffsetProperty(), mIconID, mTreeLevel, isShowHelpNode);
		AddChild(mtlPass->GetStencilProperty(), mIconID, mTreeLevel, isShowHelpNode);
		AddChild(mtlPass->GetWireProperty(), mIconID, mTreeLevel, isShowHelpNode);
	}

	if (addModule)
	{
		int numModules = effectableCtrl->GetNumModules();
		for (int i = 0; i < numModules; i++)
		{
			EffectModule *module = effectableCtrl->GetModule(i);
			AddChild(module, mIconID, mTreeLevel, mIsShowHelpNode);
		}
	}

	if (addNode)
	{
		int numChildren = node->GetNumChildren();
		for (int i = 0; i < numChildren; i++)
		{
			Movable *child = node->GetChild(i);
			if (child)
			{
				bool ingore = false;
				if (!isShowHelpNode && ("HelpNode" == child->GetName()))
					ingore = true;

				if (!ingore)
				{
					AddChild(child, mIconID, mTreeLevel, mIsShowHelpNode);
				}
			}
		}
	}
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:101,代码来源:PX2E_ProjTreeItem.cpp


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