本文整理汇总了C++中Light::GetDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::GetDirection方法的具体用法?C++ Light::GetDirection怎么用?C++ Light::GetDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::GetDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVisibleLights
void World::GetVisibleLights(Node * node, List<Light*> & lights)
{
profile_code();
lights.Clear();
List<Light*>::Iterator iter;
List<Light*>::Iterator end;
iter = mLights.Begin();
end = mLights.End();
Light * light;
while (iter != end)
{
light = *iter;
if (light->IsVisible())
{
LIGHT_TYPE type = light->GetType();
if (type == LT_DIRECTIONAL)
{
lights.PushBack(light);
}
else if (type == LT_POINT)
{
const Sphere & sph = node->GetWorldBoundingSphere();
float len = Math::VecLength(light->GetPosition() - sph.center);
if (len - sph.radius < light->GetRange())
lights.PushBack(light);
}
else if (type == LT_SPOT)
{
Aabb aabb;
Vec3 ltf, lbf, rtf, rbf;
Vec3 ltb, lbb, rtb, rbb;
Vec3 lp;
float sq1, sq2, sq3, sq4;
float sq5, sq6, sq7, sq8;
float rsq;
Vec3 d1, d2, d3, d4;
Vec3 d5, d6, d7, d8;
Vec3 ld;
float dt1, dt2, dt3, dt4;
float dt5, dt6, dt7, dt8;
float mdt;
aabb = node->GetWorldAabb();
ltf = aabb.GetLeftTopFrontPoint();
lbf = aabb.GetLeftBottomFrontPoint();
rtf = aabb.GetRightTopFrontPoint();
rbf = aabb.GetRightBottomFrontPoint();
ltb = aabb.GetLeftTopBackPoint();
lbb = aabb.GetLeftBottomBackPoint();
rtb = aabb.GetRightTopBackPoint();
rbb = aabb.GetRightBottomBackPoint();
lp = light->GetPosition();
rsq = light->GetRange() * light->GetRange();
sq1 = Math::VecDistanceSq(lp, ltf);
sq2 = Math::VecDistanceSq(lp, lbf);
sq3 = Math::VecDistanceSq(lp, rtf);
sq4 = Math::VecDistanceSq(lp, rbf);
sq5 = Math::VecDistanceSq(lp, ltb);
sq6 = Math::VecDistanceSq(lp, lbb);
sq7 = Math::VecDistanceSq(lp, rtb);
sq8 = Math::VecDistanceSq(lp, rbb);
if (sq1 < rsq || sq2 < rsq || sq3 < rsq || sq4 < rsq ||
sq5 < rsq || sq6 < rsq || sq7 < rsq || sq8 < rsq)
{
ld = light->GetDirection();
mdt = light->GetOuter();
d1 = ltf - lp;
d2 = lbf - lp;
d3 = rtf - lp;
d4 = rbf - lp;
d5 = ltb - lp;
d6 = lbb - lp;
d7 = rtb - lp;
d8 = rbb - lp;
Math::VecNormalize(d1, d1);
Math::VecNormalize(d2, d2);
Math::VecNormalize(d3, d3);
Math::VecNormalize(d4, d4);
Math::VecNormalize(d5, d5);
Math::VecNormalize(d6, d6);
Math::VecNormalize(d7, d7);
Math::VecNormalize(d8, d8);
//.........这里部分代码省略.........
示例2: Process
//.........这里部分代码省略.........
RenderManager::Instance()->SetColor(dcColor);
RenderHelper::Instance()->DrawBox(dcBox);
RenderManager::Instance()->SetState(RenderState::DEFAULT_3D_STATE);
RenderManager::Instance()->ResetColor();
RenderManager::Instance()->SetMatrix(RenderManager::MATRIX_MODELVIEW, prevMatrix);
dcBox.GetTransformedBox(transformComponent->GetWorldTransform(), debugBoundigBox);
}
}
// LightNode debug draw
if (debugFlags & DebugRenderComponent::DEBUG_DRAW_LIGHT_NODE)
{
LightComponent *lightComp = (LightComponent *) entity->GetComponent(Component::LIGHT_COMPONENT);
if(NULL != lightComp)
{
Light* light = lightComp->GetLightObject();
if(NULL != light)
{
Vector3 lPosition = light->GetPosition();
RenderManager::Instance()->SetRenderEffect(RenderManager::FLAT_COLOR);
RenderManager::Instance()->SetState(RenderState::STATE_COLORMASK_ALL | RenderState::STATE_DEPTH_WRITE);
RenderManager::Instance()->SetColor(1.0f, 1.0f, 0.0f, 1.0f);
switch (light->GetType())
{
case Light::TYPE_DIRECTIONAL:
{
Vector3 lDirection = light->GetDirection();
RenderHelper::Instance()->DrawArrow(lPosition, lPosition + lDirection * 10, 2.5f);
RenderHelper::Instance()->DrawBox(AABBox3(lPosition, 0.5f), 1.5f);
debugBoundigBox = AABBox3(lPosition, 2.5f);
}
break;
default:
{
AABBox3 lightBox(lPosition, 2.5f);
RenderHelper::Instance()->DrawBox(lightBox, 2.5f);
debugBoundigBox = lightBox;
}
break;
}
RenderManager::Instance()->SetState(RenderState::DEFAULT_3D_STATE);
RenderManager::Instance()->ResetColor();
}
}
}
if ((debugFlags & DebugRenderComponent::DEBUG_DRAW_AABOX_CORNERS))
{
RenderManager::Instance()->SetRenderEffect(RenderManager::FLAT_COLOR);
RenderManager::Instance()->SetState(RenderState::STATE_COLORMASK_ALL | RenderState::STATE_DEPTH_WRITE | RenderState::STATE_DEPTH_TEST);
RenderManager::Instance()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderHelper::Instance()->DrawCornerBox(debugBoundigBox, 1.5f);
RenderManager::Instance()->SetState(RenderState::DEFAULT_3D_STATE);
RenderManager::Instance()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
// RenderManager::Instance()->SetMatrix(RenderManager::MATRIX_MODELVIEW, prevMatrix);