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


C++ DiCullNode::SetVisible方法代码示例

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


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

示例1: SetVisible

    void DiCullNode::SetVisible( bool vis, bool cascade /*= true*/ )
    {
        for (auto oi = mObjects.begin(); oi != mObjects.end(); ++oi)
        {
            (*oi)->SetVisible(vis);
        }

        if (cascade)
        {
            for (size_t i = 0; i < mChildren.size(); ++i)
            {
                DiCullNode* sceneChild = static_cast<DiCullNode*>(mChildren[i]);
                sceneChild->SetVisible(vis, cascade);
            }
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:16,代码来源:CullNode.cpp

示例2: SetVisible

    void DiCullNode::SetVisible( bool vis, bool cascade /*= true*/ )
    {
        ObjectMap::iterator oi, oiend;
        oiend = mObjectsByName.end();
        for (oi = mObjectsByName.begin(); oi != oiend; ++oi)
        {
            oi->second->SetVisible(vis);
        }

        if (cascade)
        {
            for (size_t i = 0; i < mChildren.size(); ++i)
            {
                DiCullNode* sceneChild = static_cast<DiCullNode*>(mChildren[i]);
                sceneChild->SetVisible(vis, cascade);
            }
        }
    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:18,代码来源:CullNode.cpp

示例3: SetupWater

void SetupWater(DiSceneManager* sm)
{
    // Render targets
    auto reflectMap = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiTexture>("reflect_rt");
    reflectMap->SetDimensions(512, 512);
    reflectMap->SetFormat(PF_A8R8G8B8);
    reflectMap->SetUsage(TU_RENDER_TARGET);
    reflectMap->SetAutoMipmap(false);
    reflectMap->SetAddressing(AM_CLAMP);
    reflectMap->CreateTexture();
    auto reflectRT = reflectMap->GetRenderTarget();

    auto refractMap = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiTexture>("refract_rt");
    refractMap->SetDimensions(512, 512);
    refractMap->SetFormat(PF_A8R8G8B8);
    refractMap->SetUsage(TU_RENDER_TARGET);
    refractMap->SetAutoMipmap(false);
    refractMap->SetAddressing(AM_CLAMP);
    refractMap->CreateTexture();
    auto refractRT = refractMap->GetRenderTarget();
    
    // Water plane 
    DiCullNode* nodePlane = sm->GetRootNode()->CreateChild();
    DiSimpleShapePtr model = make_shared<DiSimpleShape>();
    model->CreatePlane(100);

    auto waterMat = DiMaterial::QuickCreate("pool_fresnel_v", "pool_fresnel_p");
    auto shaderParam = waterMat->GetShaderParameter();

    shaderParam->WriteFloat("scale", 1.0f);
    shaderParam->WriteFloat("scroll", 0.05f);
    shaderParam->WriteFloat("fresnelBias", -0.1f);
    shaderParam->WriteFloat("fresnelScale", 1.8f);
    shaderParam->WriteFloat("fresnelPower", 8.0f);
    shaderParam->WriteFloat("noiseScale", 0.05f);
    shaderParam->WriteFloat4("tintColour", DiVec4(0, 0.05f, 0.05f, 1));
    shaderParam->WriteTexture2D("noiseMap", "waves2.dds");
    shaderParam->WriteTexture2D("reflectMap", "reflect_rt");
    shaderParam->WriteTexture2D("refractMap", "refract_rt");

    model->SetMaterial(waterMat);
    nodePlane->AttachObject(model);
    nodePlane->SetScale(7, 1, 13);

    // Add to scene manager with the callbacks
    DiCamera* cam = sm->GetCamera();
    cam->MoveRelative(DiVec3(0, 0, 700));
    
    sm->AddExtraRenderTarget(refractRT, cam,
        [nodePlane](DiRenderTarget*) {
            nodePlane->SetVisible(false);
        },
        [nodePlane](DiRenderTarget*) {
            nodePlane->SetVisible(true);
        }
    );

    sm->AddExtraRenderTarget(reflectRT, cam,
        [nodePlane, cam](DiRenderTarget*) {
            nodePlane->SetVisible(false);
            cam->EnableReflection(DiPlane(DiVec3::UNIT_Y, 0));
        },
        [nodePlane, cam](DiRenderTarget*) {
            nodePlane->SetVisible(true);
            cam->DisableReflection();
        }
    );
    
    DiPostEffectManager* peMgr = DiBase::Driver->GetMainRenderWindow()->GetPostEffectManager();
	DiPostEffect* bloom = peMgr->GetEffect("Bloom");
    if (bloom)
		bloom->SetEnable(false);
}
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:73,代码来源:Pool.cpp


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