本文整理汇总了C++中Entity::GetOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetOrientation方法的具体用法?C++ Entity::GetOrientation怎么用?C++ Entity::GetOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetOrientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseDown
void OnMouseDown(UINT button, int x, int y)
{
XOrientation camOrient;
cameraEntity->GetOrientation(&camOrient);
if (button == 0)
cameraControl = true;
//shoot a cube
else if (button == 1)
{
Entity* pCube = g_pScene->CreateEntity();
g_pSelectedEntity = pCube;
pCube->SetPosition(cameraEntity->GetPosition() + camOrient.z);
pCube->SetVelocity(0.1f * camOrient.z);
//pCube->SetMaxLifeTime(5.0f);
MeshComponent* pMesh = new MeshComponent(pCube);
pMesh->SetMeshResource("cube.nfm");
BodyComponent* pBody = new BodyComponent(pCube);
pBody->SetMass(10.0f);
pBody->EnablePhysics((CollisionShape*)EngineGetResource(ResourceType::COLLISION_SHAPE,
"shape_box"));
OmniLightDesc lightDesc;
lightDesc.radius = 4.0f;
lightDesc.shadowFadeStart = 20.0;
lightDesc.shadowFadeEnd = 30.0;
Entity* pLightEntity = g_pScene->CreateEntity();
pCube->Attach(pLightEntity);
//pLightEntity->SetLocalPosition(Vector(0.0f, 1.0f, 0.0f));
LightComponent* pLight = new LightComponent(pLightEntity);
pLight->SetOmniLight(&lightDesc);
pLight->SetColor(Float3(1.0f, 1.0f, 10.0f));
pLight->SetShadowMap(0);
}
else
{
Entity* pBarrel = g_pScene->CreateEntity();
g_pSelectedEntity = pBarrel;
pBarrel->SetPosition(cameraEntity->GetPosition() + camOrient.z);
pBarrel->SetVelocity(30.0f * camOrient.z);
MeshComponent* pMesh = new MeshComponent(pBarrel);
pMesh->SetMeshResource("barrel.nfm");
BodyComponent* pBody = new BodyComponent(pBarrel);
pBody->SetMass(20.0f);
pBody->EnablePhysics((CollisionShape*)EngineGetResource(ResourceType::COLLISION_SHAPE,
"shape_barrel"));
}
}
示例2: OnKeyPress
void OnKeyPress(int key)
{
if (key == VK_F1)
{
BOOL fullscreen = getFullscreenMode();
setFullscreenMode(!fullscreen);
}
XOrientation orient;
//place spot light
if (key == 'T')
{
Entity* pLightEntity = g_pScene->CreateEntity();
cameraEntity->GetOrientation(&orient);
pLightEntity->SetOrientation(&orient);
pLightEntity->SetPosition(cameraEntity->GetPosition());
LightComponent* pLight = new LightComponent(pLightEntity);
SpotLightDesc lightDesc;
lightDesc.nearDist = 0.1f;
lightDesc.farDist = 500.0f;
lightDesc.cutoff = NFE_MATH_PI / 4.0f;
lightDesc.maxShadowDistance = 60.0;
pLight->SetSpotLight(&lightDesc);
pLight->SetColor(Float3(600, 200, 50));
pLight->SetLightMap("flashlight.jpg");
pLight->SetShadowMap(1024);
g_pSelectedEntity = pLightEntity;
}
//place omni light
if (key == 'O')
{
OmniLightDesc lightDesc;
lightDesc.radius = 10.0f;
lightDesc.shadowFadeStart = 20.0;
lightDesc.shadowFadeEnd = 30.0;
Entity* pLightEntity = g_pScene->CreateEntity();
pLightEntity->SetPosition(cameraEntity->GetPosition());
LightComponent* pLight = new LightComponent(pLightEntity);
pLight->SetOmniLight(&lightDesc);
pLight->SetColor(Float3(600, 600, 600));
pLight->SetShadowMap(512);
g_pSelectedEntity = pLightEntity;
}
}