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


C++ ISceneManager::setTileBasedDeferredShadingCS方法代码示例

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


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

示例1: setupInitialScene

void EditorScene::setupInitialScene()
{
	math::SAxisAlignedBox aabb;
	aabb.Center = XMFLOAT3(0, 0.0f, 0);
	aabb.Extents = XMFLOAT3(3000.0f, 1000.0f, 3000.0f);

	ISceneManager* smgr = mDevice->createSceneManager(aabb);
	mSceneManager = smgr;

	ITextureCube* skyTexture = mTextureManager->loadCubeTexture("skybox1.dds");
	smgr->setSkyDome(skyTexture);
	IMeshNode* skyNode = mSceneManager->getSkyNode();
	if (skyNode)
		skyNode->setMaterialName("skydome_material");

	mTimer = mDevice->getTimer();

	ISimpleMesh* cubeMesh = mMeshManager->createCubeMesh("cube1");

	mSelectedCubeNode = smgr->addMeshNode(cubeMesh, nullptr, nullptr, false);
	mSelectedCubeNode->setMaterialName("selected_cube_material");
	mSelectedCubeNode->setVisible(false);
	mSelectedCubeNode->setTag(WIRE_NODE_TAG);

	mPickingCubeNode = smgr->addMeshNode(cubeMesh, nullptr, nullptr, false);
	mPickingCubeNode->setMaterialName("picking_cube_material");
	mPickingCubeNode->setVisible(false);
	mPickingCubeNode->setTag(WIRE_NODE_TAG);

	ISimpleMesh* sphereMesh = mMeshManager->createSphereMesh("pointlight_mesh", 1.0f, 10, 10);
	
	mPointLightCollectionNode = smgr->addInstanceCollectionNode(sphereMesh, 
		nullptr, 4000, sizeof(XMFLOAT4));
	mPointLightCollectionNode->setMaterialName("multi_wire_material");
	mPointLightCollectionNode->setTag(WIRE_NODE_TAG);
	mPointLightCollectionNode->setVisible(false);

	mSceneManager->update(0);
	

	IVideoDriver* driver = IVideoDriver::getInstance();
	mVideoDriver->setDeferredShading(true);
	driver->setDeferredShadingAlgorithm(EDSA_CS_TILE_BASED_DEFERRED_SHADING);

	IShaderManager* shaderManager = IShaderManager::getInstance();
	mTileBasedDSShader = shaderManager->load(EST_COMPUTE_SHADER, "defer_shader_cs.hlsl", "cs_main");
	smgr->setTileBasedDeferredShadingCS(mTileBasedDSShader);

	if (!CFileParser::ReadScene("main.scene"))
	{
		setupTerrain();

		ILightNode* light = smgr->addDirectionalLight(1, nullptr, XMFLOAT3(3.0f, -2.0f, 1.5f));
		light->setSpecular(XMFLOAT4(1.0f, 1.0f, 1.0f, 32.0f));
		light->setDiffuse(XMFLOAT4(0.8f, 0.8f, 0.8f, 1.0f));
		light->enableShadow(true);
		mDirectionalLightNode = light;

		smgr->setAmbient(XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f));

		mCamera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 30.0f, -4.0f),
			XMFLOAT3(0, 30.0f, 0.0f), XMFLOAT3(0, 1.0f, 0), true);
		mCamera->setShadowRange(300.0f);

		mVideoDriver->setDeferredShading(true);
		mDeferredShading = true;
	}

	UpdateGlobalLighting();
	
	smgr->update();
}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:72,代码来源:EditorScene.cpp


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