BVB Source Codes

CRYENGINE Show Brush.h Source code

Return Download CRYENGINE: download Brush.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef _3DENGINE_BRUSH_H_
  4. #define _3DENGINE_BRUSH_H_
  5.  
  6. #include "ObjMan.h"
  7. #include "DeformableNode.h"
  8.  
  9. #if CRY_PLATFORM_LINUX || CRY_PLATFORM_ANDROID
  10.         #include <CryCore/Platform/platform.h>
  11. #endif
  12.  
  13. class CBrush
  14.         : public IBrush
  15.           , public Cry3DEngineBase
  16. {
  17.         friend class COctreeNode;
  18.  
  19. public:
  20.         CBrush();
  21.         virtual ~CBrush();
  22.  
  23.         virtual const char*         GetEntityClassName() const final;
  24.         virtual Vec3                GetPos(bool bWorldOnly = true) const final;
  25.         virtual float               GetScale() const;
  26.         virtual const char*         GetName() const final;
  27.         virtual bool                HasChanged();
  28.         virtual void                Render(const struct SRendParams& EntDrawParams, const SRenderingPassInfo& passInfo) final;
  29.         virtual CLodValue           ComputeLod(int wantedLod, const SRenderingPassInfo& passInfo) final;
  30.         void                        Render(const CLodValue& lodValue, const SRenderingPassInfo& passInfo, SSectorTextureSet* pTerrainTexInfo, PodArray<CDLight*>* pAffectingLights);
  31.  
  32.         virtual struct IStatObj*    GetEntityStatObj(unsigned int nPartId = 0, unsigned int nSubPartId = 0, Matrix34A* pMatrix = NULL, bool bReturnOnlyVisible = false) final;
  33.  
  34.         virtual bool                GetLodDistances(const SFrameLodInfo& frameLodInfo, float* distances) const final;
  35.  
  36.         virtual void                SetEntityStatObj(unsigned int nSlot, IStatObj* pStatObj, const Matrix34A* pMatrix = NULL) final;
  37.  
  38.         virtual IRenderNode*        Clone() const final;
  39.  
  40.         virtual void                SetCollisionClassIndex(int tableIndex) final { m_collisionClassIdx = tableIndex; }
  41.  
  42.         virtual void                SetLayerId(uint16 nLayerId) final;
  43.         virtual uint16              GetLayerId() final                           { return m_nLayerId; }
  44.         virtual struct IRenderMesh* GetRenderMesh(int nLod) final;
  45.  
  46.         virtual IPhysicalEntity*    GetPhysics() const final;
  47.         virtual void                SetPhysics(IPhysicalEntity* pPhys) final;
  48.         static bool                 IsMatrixValid(const Matrix34& mat);
  49.         virtual void                Dephysicalize(bool bKeepIfReferenced = false) final;
  50.         virtual void                Physicalize(bool bInstant = false) final;
  51.         void                        PhysicalizeOnHeap(IGeneralMemoryHeap* pHeap, bool bInstant = false);
  52.         virtual bool                PhysicalizeFoliage(bool bPhysicalize = true, int iSource = 0, int nSlot = 0) final;
  53.         virtual IPhysicalEntity*    GetBranchPhys(int idx, int nSlot = 0) final { IFoliage* pFoliage = GetFoliage(nSlot); return pFoliage ? pFoliage->GetBranchPhysics(idx) : 0; }
  54.         virtual struct IFoliage*    GetFoliage(int nSlot = 0) final;
  55.  
  56.         //! Assign final material to this entity.
  57.         virtual void       SetMaterial(IMaterial* pMat) final;
  58.         virtual IMaterial* GetMaterial(Vec3* pHitPos = NULL) const final;
  59.         virtual IMaterial* GetMaterialOverride() final { return m_pMaterial; };
  60.         virtual void       CheckPhysicalized() final;
  61.  
  62.         virtual float      GetMaxViewDist() final;
  63.  
  64.         virtual EERType    GetRenderNodeType() final;
  65.  
  66.         void               SetStatObj(IStatObj* pStatObj);
  67.  
  68.         void               SetMatrix(const Matrix34& mat) final;
  69.         const Matrix34& GetMatrix() const final        { return m_Matrix; }
  70.         virtual void    SetDrawLast(bool enable) final { m_bDrawLast = enable; }
  71.         bool            GetDrawLast() const            { return m_bDrawLast; }
  72.  
  73.         void            Dematerialize() final;
  74.         virtual void    GetMemoryUsage(ICrySizer* pSizer) const final;
  75.         static PodArray<SExportedBrushMaterial> m_lstSExportedBrushMaterials;
  76.  
  77.         virtual const AABB GetBBox() const final;
  78.         virtual void       SetBBox(const AABB& WSBBox) final { m_WSBBox = WSBBox; }
  79.         virtual void       FillBBox(AABB& aabb) final;
  80.         virtual void       OffsetPosition(const Vec3& delta) final;
  81.  
  82.         virtual void SetCameraSpacePos( Vec3* pCameraSpacePos ) final;
  83.         virtual void SetSubObjectHideMask( hidemask subObjHideMask ) final;
  84.  
  85.         virtual bool       CanExecuteRenderAsJob() final;
  86.        
  87.         virtual void       DisablePhysicalization(bool bDisable) final;
  88.  
  89.         //private:
  90.         void CalcBBox();
  91.         void UpdatePhysicalMaterials(int bThreadSafe = 0);
  92.  
  93.         void OnRenderNodeBecomeVisible(const SRenderingPassInfo& passInfo) final;
  94.         void OnRenderNodeBecomeInvisible() final;
  95.  
  96.         bool HasDeformableData() const { return m_pDeform != NULL; }
  97.  
  98.  
  99. private:
  100.         void CalcNearestTransform( Matrix34 &transformMatrix,const SRenderingPassInfo& passInfo );
  101.         void InvalidatePermanentRenderObjectMatrix();
  102.  
  103. public:
  104.         // Transformation Matrix
  105.         Matrix34         m_Matrix;
  106.  
  107.         // Physical Entity, when this node is physicalized.
  108.         IPhysicalEntity* m_pPhysEnt = nullptr;
  109.  
  110.         //! Override material, will override default material assigned to the Geometry.
  111.         _smart_ptr<IMaterial> m_pMaterial;
  112.  
  113.         uint16                m_collisionClassIdx = 0;
  114.         uint16                m_nLayerId = 0;
  115.  
  116.         // Geometry referenced and rendered by this node.
  117.         _smart_ptr<CStatObj>  m_pStatObj;
  118.  
  119.         CDeformableNode*      m_pDeform = nullptr;
  120.         IFoliage*             m_pFoliage = nullptr;
  121.  
  122.         uint32 m_bVehicleOnlyPhysics : 1;
  123.         uint32 m_bDrawLast : 1;
  124.         uint32 m_bNoPhysicalize : 1;
  125.  
  126.         // World space bounding box for this node.
  127.         AABB m_WSBBox;
  128.  
  129.         // Last frame this object moved
  130.         uint32 m_lastMoveFrameId = 0;
  131.         // Hide mask disable individual sub-objects rendering in the compound static objects
  132.         hidemask m_nSubObjHideMask;
  133.  
  134.         Vec3*    m_pCameraSpacePos = nullptr;
  135. };
  136.  
  137. ///////////////////////////////////////////////////////////////////////////////
  138. inline const AABB CBrush::GetBBox() const
  139. {
  140.         return m_WSBBox;
  141. }
  142.  
  143. #endif // _3DENGINE_BRUSH_H_
  144.  
downloadBrush.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top