Ticket #1411: CCmpVisualActor.cpp.patch

File CCmpVisualActor.cpp.patch, 1.6 KB (added by Kareem Ergawy, 11 years ago)

Applying modifications suggested by leper

  • CCmpVisualActor.cpp

     
    153153                        "</element>"
    154154                    "</choice>"
    155155                "</element>"
    156             "</optional>";
     156            "</optional>"
     157            "<element name='VisibleInAtlasOnly'>"
     158                "<data type='boolean'/>"
     159            "</element>";
    157160    }
    158161
    159162    virtual void Init(const CParamNode& paramNode)
     
    501504    /// Necessary because the visibility update runs on simulation update,
    502505    /// which may not occur immediately if the game starts paused.
    503506    bool m_PreviouslyRendered;
    504 
     507    bool m_VisibleInAtlasOnly;
    505508    /// Helper function shared by component init and actor reloading
    506509    void InitModel(const CParamNode& paramNode);
    507510
     
    539542                if (paramNode.GetChild("SilhouetteOccluder").ToBool())
    540543                    modelFlags |= MODELFLAG_SILHOUETTE_OCCLUDER;
    541544
     545                const CParamNode& visibleInAtlasNode = paramNode.GetChild("VisibleInAtlasOnly");
     546
     547                m_VisibleInAtlasOnly = visibleInAtlasNode.ToBool();
     548
    542549                CmpPtr<ICmpVision> cmpVision(GetSimContext(), GetEntityId());
    543550                if (cmpVision && cmpVision->GetAlwaysVisible())
    544551                    modelFlags |= MODELFLAG_IGNORE_LOS;
     
    831838    if (culling && !frustum.IsBoxVisible(CVector3D(0, 0, 0), model.GetWorldBoundsRec()))
    832839        return;
    833840
     841    // If we are not currently in Atlas, don't submit the model for rendering since the MODELFLAG_VISIBLE_IN_ATLAS_ONLY
     842    // is set to true.
     843    if(!g_AtlasGameLoop->running && m_VisibleInAtlasOnly)
     844    {
     845        return;
     846    }
     847
    834848    collector.SubmitRecursive(&model);
    835849}