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


C++ Terrain::Id方法代码示例

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


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

示例1: Terrain_Id

static duk_ret_t Terrain_Id(duk_context* ctx)
{
    Terrain* thisObj = GetThisWeakObject<Terrain>(ctx);
    component_id_t ret = thisObj->Id();
    duk_push_number(ctx, ret);
    return 1;
}
开发者ID:realXtend,项目名称:tundra-urho3d,代码行数:7,代码来源:TerrainBindings.cpp

示例2: InitializeGraph

bool SceneGraph::InitializeGraph()
{
	// Create objects
	// Add the objects into the actor map	
	// Once an object is in the SceneGraph, object destruction is responsibility of the SceneGraph
	using AntiMatter::AppLog;
	using std::string;
	using std::vector;
	using glm::mat4;
	using glm::vec3;
	using glm::translate;
	using glm::rotate;

	// just calling to test the WavefrontObj parser
	// WavefrontObj j( g_Cfg.AssetsDir() + string("obj\\house\\house.obj") );
		

	// Initialize the SceneLights collection (lights need access to the SceneGraph in order to initialize)
	// because of this, light initialization can't be done through plain old RAII
	if( ! m_lights.Initialize(this) )
	{
		AppLog::Ref().LogMsg("SceneGraph lights failed to initialize");
		return false;
	}


	// add lights to the scene graph
	typedef vector<Light*>::const_iterator CItr;
	const vector<Light*> lights = m_lights.Lights();

	for( CItr n = lights.begin(); n != lights.end(); n ++ )
	{
		Light* pLight = (*n);
		m_map.insert( ActorIdPair( pLight->Id(), pLight ) );
	}

	mat4 tr;
	mat4 mW(1.0);


	// Terrain
	Terrain* pTerrain = new (std::nothrow) Terrain(
		this, 
		&m_RootNode, 
		string("terrain"), 
		g_Cfg.AssetsDir() + string("heightfield4.bmp"),			// height map
		g_Cfg.AssetsDir() + string("grassC.jpg"),				// texture map (1 of n ?)
		g_Cfg.AssetsDir() + string("256-circle-alphamap.bmp"),	// alphamap
		128,128,
		4.0f, 4.0f, 0.1f 
	);

	if( ! pTerrain || !  pTerrain->Initialized() )
	{
		AppLog::Ref().LogMsg("SceneGraph failed to initialize Terrain");
		return false;
	}

	m_map.insert( ActorIdPair( pTerrain->Id(), pTerrain) );
	tr = translate( mat4(1.0), vec3(0, -275, 0) );
	pTerrain->GetNodeData().W()	*= tr;	
	
	
	// Globe
	Globe* pGlobe = new (std::nothrow) Globe(  
		this, 
		&m_RootNode, 
		std::string("globe"), 
		350.0f, 30, 30, 
		string(""), 
		glm::vec4(1.0, 1.0, 1.0, 0.8) 
	);

	// position the globe
	if( ! pGlobe || ! pGlobe->Initialized() )
	{
		AppLog::Ref().LogMsg("SceneGraph failed to intialize the Globe");
		return false;
	}
		
	tr = translate( glm::mat4(1.0), vec3(0, 0, 0) );
	pGlobe->GetNodeData().W() *= tr;
	m_map.insert( ActorIdPair( pGlobe->Id(), pGlobe) );



	// snow
	Snow* pSnow = new (std::nothrow) Snow(
		this,
		&m_RootNode,
		pGlobe,
		string("snowfall"),
		g_Cfg.SnowCfg()
	);

	if( ! pSnow || ! pSnow->Initialized() )
	{
		AppLog::Ref().LogMsg("SceneGraph failed to allocate heap for snow");
		return false;
	}
//.........这里部分代码省略.........
开发者ID:gwgrisk,项目名称:msc-hull-snowglobe,代码行数:101,代码来源:SceneGraph.cpp


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