BVB Source Codes

CRYENGINE Show CharacterRenderNode.h Source code

Return Download CRYENGINE: download CharacterRenderNode.h Source code - Download CRYENGINE Source code - Type:.h
  1. #pragma once
  2.  
  3. #include "ObjMan.h"
  4.  
  5. struct ICharacterInstance;
  6.  
  7. class CCharacterRenderNode : public ICharacterRenderNode, private Cry3DEngineBase
  8. {
  9.         friend class COctreeNode;
  10.  
  11. public:
  12.         CCharacterRenderNode();
  13.         virtual ~CCharacterRenderNode();
  14.  
  15.         //////////////////////////////////////////////////////////////////////////
  16.         // Implement ICharacterRenderNode
  17.         //////////////////////////////////////////////////////////////////////////
  18.         virtual EERType     GetRenderNodeType() final { return eERType_Character; }
  19.         //! Debug info about object.
  20.         virtual const char* GetName() const final;
  21.         virtual const char* GetEntityClassName() const final          { return "CharacterRenderNode"; };
  22.         virtual string      GetDebugString(char type = 0) const final { return GetName(); }
  23.  
  24.         //! Sets render node transformation matrix.
  25.         virtual void SetMatrix(const Matrix34& transform) final;
  26.  
  27.         //! Gets local bounds of the render node.
  28.         virtual void       GetLocalBounds(AABB& bbox) final           { bbox = m_boundsLocal; }
  29.  
  30.         virtual Vec3       GetPos(bool bWorldOnly = true) const final { return m_matrix.GetTranslation(); };
  31.         virtual const AABB GetBBox() const final                      { return m_boundsWorld; }
  32.         virtual void       FillBBox(AABB& aabb) final                 { aabb = GetBBox(); }
  33.         virtual void       SetBBox(const AABB& WSBBox) final          { m_boundsWorld = WSBBox; };
  34.         virtual void       OffsetPosition(const Vec3& delta) final;
  35.         virtual void       Render(const struct SRendParams& EntDrawParams, const SRenderingPassInfo& passInfo) final;
  36.  
  37.         virtual CLodValue  ComputeLod(int wantedLod, const SRenderingPassInfo& passInfo) final;
  38.         virtual bool       GetLodDistances(const SFrameLodInfo& frameLodInfo, float* distances) const final;
  39.  
  40.         //! Gives access to object components.
  41.         virtual IMaterial*          GetEntitySlotMaterial(unsigned int nPartId, bool bReturnOnlyVisible = false, bool* pbDrawNear = NULL) final { return m_pMaterial; }
  42.         virtual ICharacterInstance* GetEntityCharacter(unsigned int nSlot, Matrix34A* pMatrix = NULL, bool bReturnOnlyVisible = false) final    { return m_pCharacterInstance; }
  43.  
  44.         //! Get physical entity.
  45.         virtual struct IPhysicalEntity* GetPhysics() const final                 { return m_pPhysicsEntity; };
  46.         virtual void                    SetPhysics(IPhysicalEntity* pPhys) final { m_pPhysicsEntity = pPhys; };
  47.         virtual void                    Physicalize(bool bInstant = false) final;
  48.  
  49.         //! Set override material for this instance.
  50.         virtual void SetMaterial(IMaterial* pMat) final { m_pMaterial = pMat; };
  51.  
  52.         //! Queries override material of this instance.
  53.         virtual IMaterial* GetMaterial(Vec3* pHitPos = NULL) const final { return nullptr; };
  54.         virtual IMaterial* GetMaterialOverride() final                   { return m_pMaterial; };
  55.  
  56.         virtual float      GetMaxViewDist() final;
  57.  
  58.         virtual void       OnRenderNodeBecomeVisible(const SRenderingPassInfo& passInfo) override;
  59.         virtual void       OnRenderNodeBecomeInvisible() override;
  60.  
  61.         virtual void       SetCameraSpacePos(Vec3* pCameraSpacePos) final;
  62.  
  63.         virtual void       GetMemoryUsage(ICrySizer* pSizer) const final {};
  64.  
  65.         virtual void       UpdateStreamingPriority(const SUpdateStreamingPriorityContext& streamingContext) final;
  66.         //////////////////////////////////////////////////////////////////////////
  67.  
  68.         //////////////////////////////////////////////////////////////////////////
  69.         // Implement ICharacterRenderNode
  70.         //////////////////////////////////////////////////////////////////////////
  71.         virtual void SetCharacter(ICharacterInstance* pCharacter) final;
  72.         virtual void SetCharacterRenderOffset(const QuatTS& renderOffset) final;
  73.         //////////////////////////////////////////////////////////////////////////
  74.  
  75.         static void PrecacheCharacter(const float fImportance, ICharacterInstance* pCharacter, IMaterial* pSlotMat,
  76.                                       const Matrix34& matParent, const float fEntDistance, const float fScale, int nMaxDepth, bool bFullUpdate, bool bDrawNear, int nLod);
  77.  
  78. private:
  79.         void        CalcNearestTransform(Matrix34& transformMatrix, const SRenderingPassInfo& passInfo);
  80.  
  81.         static void PrecacheCharacterCollect(const float fImportance, ICharacterInstance* pCharacter, IMaterial* pSlotMat,
  82.                                              const Matrix34& matParent, const float fEntDistance, const float fScale, int nMaxDepth, bool bFullUpdate, bool bDrawNear, int nLod,
  83.                                              const int nRoundId, std::vector<std::pair<IMaterial*, float>>& collectedMaterials);
  84.  
  85. private:
  86.         _smart_ptr<ICharacterInstance> m_pCharacterInstance;
  87.         IPhysicalEntity*               m_pPhysicsEntity;
  88.  
  89.         // Override Material used to render node
  90.         _smart_ptr<IMaterial> m_pMaterial;
  91.  
  92.         // World space tranformation
  93.         Matrix34 m_matrix;
  94.         // World space bounding box
  95.         AABB     m_boundsWorld;
  96.         // Local space bounding box
  97.         AABB     m_boundsLocal;
  98.  
  99.         QuatTS   m_renderOffset;
  100.  
  101.         Vec3*    m_pCameraSpacePos = nullptr;
  102. };
  103.  
downloadCharacterRenderNode.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