本文整理汇总了C++中PNode::isDrawable方法的典型用法代码示例。如果您正苦于以下问题:C++ PNode::isDrawable方法的具体用法?C++ PNode::isDrawable怎么用?C++ PNode::isDrawable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNode
的用法示例。
在下文中一共展示了PNode::isDrawable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ni
PShadowPass::PShadowPass(const pchar *name, PScene *scene)
: PRenderPass(name, scene)
{
PResourceManager *resMgr = m_scene->context()->module<PResourceManager>("resource-manager");
const puint32 *r = m_scene->context()->rect();
puint32 bufferWidth;
puint32 bufferHeight;
switch (scene->shadowQuality())
{
case PScene::SHADOWQUALITY_HIGH:
bufferWidth = r[2];
bufferHeight = r[3];
break;
case PScene::SHADOWQUALITY_NORMAL:
bufferWidth = r[2] / 2;
bufferHeight = r[3] / 2;
break;
case PScene::SHADOWQUALITY_LOW:
bufferWidth = r[2] / 4;
bufferHeight = r[3] / 4;
break;
}
m_framebuffer = P_NULL;
PNode::iterator ni(m_scene->root());
PNode *n = *ni;
n = *(++ni);
puint32 numDrawables = 0;
while (n != P_NULL)
{
// Put opaque drawables which cast shadows into the render queue.
if (n->isDrawable())
{
PDrawable *drawable = reinterpret_cast<PDrawable *>(n);
PASSERT(drawable != P_NULL);
if (drawable->castShadow())
{
PMaterial *material = drawable->material();
if ((material != P_NULL && !drawable->material()->isTransparent()) ||
material == P_NULL)
{
m_renderQueue->addNode(drawable);
numDrawables++;
}
}
}
else
{
// The first directional light that cast shadow will be the
// shadow light source.
PAbstractLight *light = dynamic_cast<PAbstractLight *>(n);
if (light != P_NULL &&
light->type() == P_LIGHT_DIRECTIONAL)
{
if (((PDirectionalLight *)light)->castShadow())
{
m_camera = PNEW(PCamera("shadow-camera", m_scene));
m_camera->fromLight((PDirectionalLight *)light, scene->bbox());
m_camera->setFixed(true);
}
}
}
n = *(++ni);
}
if (m_camera != P_NULL && numDrawables)
{
m_framebuffer = resMgr->createFrameBuffer(P_NULL,
bufferWidth,
bufferHeight,
P_GLTEXTURE_FORMAT_RGBA8888,
P_GLTEXTURE_FORMAT_DEPTH_COMPONENT16);
}
if (numDrawables == 0)
{
PDELETE(m_camera);
}
}