Example #1
0
bool mrGeomShaderObject::UpdateDisplay(
	const MaxSDK::Graphics::MaxContext& maxContext, 
	const MaxSDK::Graphics::UpdateDisplayContext& displayContext)
{
	// create a mesh to display (leave it in cache)
	UpdateMesh(displayContext.GetDisplayTime());

	using namespace MaxSDK::Graphics;

	GenerateMeshRenderItemsContext generateRenderItemsContext;
	generateRenderItemsContext.GenerateDefaultContext(displayContext);

	m_mesh.GenerateRenderItems(mRenderItemHandles,generateRenderItemsContext);
	return true;
}
Example #2
0
bool TriPatchObject::UpdateDisplay(
	const MaxSDK::Graphics::MaxContext& maxContext, 
	const MaxSDK::Graphics::UpdateDisplayContext& displayContext)
{
	// create a mesh to display (leave it in cache)
	PrepareMesh(displayContext.GetDisplayTime());
	Mesh& mesh = patch.GetMesh();
	if(mesh.getNumVerts()>0)
	{
		using namespace MaxSDK::Graphics;

		GenerateMeshRenderItemsContext generateRenderItemsContext;
		generateRenderItemsContext.GenerateDefaultContext(displayContext);

		mesh.GenerateRenderItems(mRenderItemHandles,generateRenderItemsContext);
		return true ;
	}

	return false;
}
Example #3
0
bool GPUParticle::PrepareDisplay(const MaxSDK::Graphics::UpdateDisplayContext& displayContext)
{
	if (nullptr == mpParticleItem)
	{
		MaxSDK::Graphics::DeviceCaps caps;
		GetIDisplayManager()->GetDeviceCaps(caps);
		if (caps.FeatureLevel != Level5_0)
		{
			return false;
		}
		mpParticleItem = new ParticleRenderer;
	}

	TimeValue t = displayContext.GetDisplayTime();
	pblock2->GetValue(GPUParticle_radius, t, mRadius, ivalid );
	pblock2->GetValue(GPUParticle_count, t, mCount, ivalid );

	mpParticleItem->Radius(mRadius);
	mpParticleItem->Count(mCount);

	return true;
}
Example #4
0
bool TriPatchObject::PrepareDisplay(const MaxSDK::Graphics::UpdateDisplayContext& prepareDisplayContext)
{
	PrepareMesh(prepareDisplayContext.GetDisplayTime());
	Mesh& mesh = patch.GetMesh();
	if(mesh.getNumVerts()>0)
	{
		using namespace MaxSDK::Graphics;

		mRenderItemHandles.ClearAllRenderItems();		
		IMeshDisplay2* pMeshDisplay = static_cast<IMeshDisplay2*>(mesh.GetInterface(IMesh_DISPLAY2_INTERFACE_ID));
		if (NULL == pMeshDisplay)
		{
			return false;
		}

		GenerateMeshRenderItemsContext generateMeshRenderItemsContext;
		generateMeshRenderItemsContext.GenerateDefaultContext(prepareDisplayContext);
		pMeshDisplay->PrepareDisplay(generateMeshRenderItemsContext);

		return true ;
	}

	return false;
}
bool MaterialHandle::PrepareDisplay(
	const MaxSDK::Graphics::UpdateDisplayContext& prepareDisplayContext)
{
	using namespace MaxSDK::Graphics;
	IMeshDisplay2* pMeshDisplay = 
		static_cast<IMeshDisplay2*>(mesh.GetInterface(IMesh_DISPLAY2_INTERFACE_ID));
	if (NULL == pMeshDisplay)
	{
		return false;
	}	
	GenerateMeshRenderItemsContext generateRenderItemsContext;
	generateRenderItemsContext.GenerateDefaultMeshElementDescriptions(
		prepareDisplayContext.GetRequiredComponents());
	
	if(!mSolidColorMaterialHandle.IsValid())
	{
		mSolidColorMaterialHandle.Initialize();
		mSolidColorMaterialHandle.SetColor(AColor(1.0f,0.2f,0.2f,1.0f));
	}
	
	generateRenderItemsContext.AddRequiredStreams(*mSolidColorMaterialHandle.GetRequiredStreams());
	pMeshDisplay->PrepareDisplay(generateRenderItemsContext);
	return true;
}