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


C++ RenderObject::GetStates方法代码示例

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


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

示例1: Insert

//----------------------------------------------------------------------------
void CullerSorting::Insert(Object* pObject, Transformation* pTransformation,
	const Vector3F& rPosition)
{
	WIRE_ASSERT(mVisibleSets.GetQuantity() >= 2);

	RenderObject* pRenderObject = DynamicCast<RenderObject>(pObject);
	if (!pRenderObject)
	{
		GetVisibleSet(0)->Insert(pObject, NULL);
		GetVisibleSet(1)->Insert(pObject, NULL);
		return;
	}

	UInt64 key = GetKey(pRenderObject, pTransformation, rPosition);
	StateAlpha* pAlpha = StaticCast<StateAlpha>(pRenderObject->GetStates()[
		State::ALPHA]);
	if (pAlpha)
	{
		if (pAlpha->BlendEnabled)
		{
			GetVisibleSet(1)->Insert(pObject, pTransformation, key);
		}
		else
		{
			GetVisibleSet(0)->Insert(pObject, pTransformation, key);
		}
	}
	else
	{
		GetVisibleSet(0)->Insert(pObject, pTransformation, key);
	}
}
开发者ID:rrath,项目名称:Wire3D,代码行数:33,代码来源:WireCullerSorting.cpp

示例2: CreateTexture

//----------------------------------------------------------------------------
RenderObject* Sample5::CreatePlane()
{
	const UInt tileXCount = 30;
	const UInt tileYCount = 20;
	const Float xSizeTotal = 12.0F;
	const Float ySizeTotal = 8.0F;
	RenderObject* pPlane = StandardMesh::CreatePlane(tileXCount, tileYCount,
		xSizeTotal, ySizeTotal, 0, 1, true);
	pPlane->GetMesh()->GenerateNormals();

	Texture2D* pTexture = CreateTexture();
	pTexture->SetWrapType(0, Texture2D::WT_REPEAT);
	pTexture->SetWrapType(1, Texture2D::WT_REPEAT);
	Material* pMaterial = WIRE_NEW Material;
	pMaterial->AddTexture(pTexture, Material::BM_MODULATE);
	pPlane->SetMaterial(pMaterial);

	// attach a material state and a light to the plane geometry directly
	StateMaterial* pStateMaterial = WIRE_NEW StateMaterial;
	pStateMaterial->Ambient = ColorRGBA(1, 1, 1, 1);
	pPlane->GetStates()[State::MATERIAL] = pStateMaterial;

	mspSpotLight = WIRE_NEW Light(Light::LT_SPOT);
	mspSpotLight->Position = Vector3F(0, 0, 10);
	mspSpotLight->Direction = Vector3F(0, 0, -1);
	mspSpotLight->Angle = 0.5F;
	mspSpotLight->Ambient = ColorRGB(0.2F, 0.2F, 0.2F);
	return pPlane;
}
开发者ID:alanhaugen,项目名称:wire3d,代码行数:30,代码来源:Sample5.cpp


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