本文整理汇总了C++中Light::Id方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::Id方法的具体用法?C++ Light::Id怎么用?C++ Light::Id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::Id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Light_Id
static duk_ret_t Light_Id(duk_context* ctx)
{
Light* thisObj = GetThisWeakObject<Light>(ctx);
component_id_t ret = thisObj->Id();
duk_push_number(ctx, ret);
return 1;
}
示例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;
}
//.........这里部分代码省略.........