BVB Source Codes

CRYENGINE Show RenderMeshUtils.h Source code

Return Download CRYENGINE: download RenderMeshUtils.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   RenderMeshUtils.h
  5. //  Created:     14/11/2006 by Timur.
  6. //  Description:
  7. // -------------------------------------------------------------------------
  8. //  History:
  9. //
  10. ////////////////////////////////////////////////////////////////////////////
  11.  
  12. #ifndef __RenderMeshUtils_h__
  13. #define __RenderMeshUtils_h__
  14. #pragma once
  15.  
  16. struct SIntersectionData;
  17.  
  18. //////////////////////////////////////////////////////////////////////////
  19. // RenderMesh utilities.
  20. //////////////////////////////////////////////////////////////////////////
  21. class CRenderMeshUtils : public Cry3DEngineBase
  22. {
  23. public:
  24.         // Do a render-mesh vs Ray intersection, return true for intersection.
  25.         static bool RayIntersection(IRenderMesh* pRenderMesh, SRayHitInfo& hitInfo, IMaterial* pMtl = 0);
  26.         static bool RayIntersectionFast(IRenderMesh* pRenderMesh, SRayHitInfo& hitInfo, IMaterial* pCustomMtl = 0);
  27.  
  28.         // async versions, aren't using the cache, and are used by the deferredrayintersection class
  29.         static void RayIntersectionAsync(SIntersectionData* pIntersectionRMData);
  30.  
  31.         static void ClearHitCache();
  32.  
  33.         //////////////////////////////////////////////////////////////////////////
  34.         //void FindCollisionWithRenderMesh( IRenderMesh *pRenderMesh, SRayHitInfo &hitInfo );
  35.         //      void FindCollisionWithRenderMesh( IPhysiIRenderMesh2 *pRenderMesh, SRayHitInfo &hitInfo );
  36. private:
  37.         // functions implementing the logic for RayIntersection
  38.         static bool RayIntersectionImpl(SIntersectionData* pIntersectionRMData, SRayHitInfo* phitInfo, IMaterial* pCustomMtl, bool bAsync);
  39.         static bool RayIntersectionFastImpl(SIntersectionData& rIntersectionRMData, SRayHitInfo& hitInfo, IMaterial* pCustomMtl, bool bAsync);
  40.         static bool ProcessBoxIntersection(Ray& inRay, SRayHitInfo& hitInfo, SIntersectionData& rIntersectionRMData, IMaterial* pMtl, vtx_idx* pInds, int nVerts, uint8* pPos, int nPosStride, uint8* pUV, int nUVStride, uint8* pCol, int nColStride, int nInds, bool& bAnyHit, float& fBestDist, Vec3& vHitPos, Vec3* tri);
  41. };
  42.  
  43. // struct to collect parameters for the wrapped RayInterseciton functions
  44. struct SIntersectionData
  45. {
  46.         SIntersectionData() :
  47.                 pRenderMesh(NULL), nVerts(0), nInds(0),
  48.                 nPosStride(0), pPos(NULL), pInds(NULL),
  49.                 nUVStride(0), pUV(NULL),
  50.                 nColStride(0), pCol(NULL),
  51.                 nTangsStride(0), pTangs(NULL),
  52.                 bResult(false), bNeedFallback(false),
  53.                 fDecalPlacementTestMaxSize(1000.f), bDecalPlacementTestRequested(false),
  54.                 pHitInfo(0), pMtl(0)
  55.         {
  56.         }
  57.  
  58.         bool Init(IRenderMesh* pRenderMesh, SRayHitInfo* _pHitInfo, IMaterial* _pMtl, bool _bRequestDecalPlacementTest = false);
  59.  
  60.         IRenderMesh* pRenderMesh;
  61.         SRayHitInfo* pHitInfo;
  62.         IMaterial*   pMtl;
  63.         bool         bDecalPlacementTestRequested;
  64.  
  65.         int          nVerts;
  66.         int          nInds;
  67.  
  68.         int          nPosStride;
  69.         uint8*       pPos;
  70.         vtx_idx*     pInds;
  71.  
  72.         int          nUVStride;
  73.         uint8*       pUV;
  74.  
  75.         int          nColStride;
  76.         uint8*       pCol;
  77.  
  78.         int          nTangsStride;
  79.         byte*        pTangs;
  80.  
  81.         bool         bResult;
  82.         float        fDecalPlacementTestMaxSize; // decal will look acceptable in this place
  83.         bool         bNeedFallback;
  84. };
  85.  
  86. #endif // __RenderMeshUtils_h__
  87.  
downloadRenderMeshUtils.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