BVB Source Codes

CRYENGINE Show VolumeObjectDataCreate.h Source code

Return Download CRYENGINE: download VolumeObjectDataCreate.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef _VOLUMEOBJECTDATACCREATE_
  4. #define _VOLUMEOBJECTDATACCREATE_
  5.  
  6. #pragma once
  7.  
  8. const int VOLUME_SIZE(64);
  9. const int VOLUME_SHADOW_SIZE(32);
  10.  
  11. template<typename T>
  12. struct SVolumeDataSrc
  13. {
  14.         typedef T VoxelElementType;
  15.  
  16.         unsigned int      m_width;
  17.         unsigned int      m_height;
  18.         unsigned int      m_depth;
  19.         unsigned int      m_slice;
  20.         VoxelElementType* m_pData;
  21.  
  22.         SVolumeDataSrc(unsigned int width, unsigned int height, unsigned int depth)
  23.                 : m_width(width)
  24.                 , m_height(height)
  25.                 , m_depth(depth)
  26.                 , m_slice(width * depth)
  27.                 , m_pData(0)
  28.         {
  29.                 m_pData = new VoxelElementType[m_width * m_height * m_depth];
  30.         }
  31.  
  32.         ~SVolumeDataSrc()
  33.         {
  34.                 SAFE_DELETE_ARRAY(m_pData)
  35.         }
  36.  
  37.         size_t size() const
  38.         {
  39.                 return m_width * m_height * m_depth;
  40.         }
  41.  
  42.         size_t Idx(unsigned int x, unsigned int y, unsigned int z) const
  43.         {
  44.                 //return z * m_width * m_height + y * m_width + x;
  45.                 return (z * m_height + y) * m_width + x;
  46.         }
  47.  
  48.         T& operator[](size_t idx)
  49.         {
  50.                 return m_pData[idx];
  51.         }
  52.  
  53.         const T& operator[](size_t idx) const
  54.         {
  55.                 return m_pData[idx];
  56.         }
  57. };
  58.  
  59. typedef SVolumeDataSrc<uint8> SVolumeDataSrcB;
  60. typedef SVolumeDataSrc<float> SVolumeDataSrcF;
  61.  
  62. bool CreateVolumeObject(const char* filePath, SVolumeDataSrcB& trg, AABB& tightBounds, float& scale);
  63. bool CreateVolumeShadow(const Vec3& lightDir, float shadowStrength, const SVolumeDataSrcB& density, SVolumeDataSrcB& shadows);
  64. bool CreateDownscaledVolumeObject(const SVolumeDataSrcB& src, SVolumeDataSrcB& trg);
  65.  
  66. struct SVolumeDataHull
  67. {
  68.         SVolumeDataHull()
  69.                 : m_numPts(0)
  70.                 , m_numTris(0)
  71.                 , m_pPts(0)
  72.                 , m_pIdx(0)
  73.         {
  74.         }
  75.  
  76.         ~SVolumeDataHull()
  77.         {
  78.                 SAFE_DELETE_ARRAY(m_pPts);
  79.                 SAFE_DELETE_ARRAY(m_pIdx);
  80.         }
  81.  
  82.         size_t           m_numPts;
  83.         size_t           m_numTris;
  84.         SVF_P3F_C4B_T2F* m_pPts;
  85.         vtx_idx*         m_pIdx;
  86. };
  87.  
  88. bool CreateVolumeDataHull(const SVolumeDataSrcB& src, SVolumeDataHull& hull);
  89.  
  90. #endif // #ifndef _VOLUMEOBJECTDATACCREATE_
  91.  
downloadVolumeObjectDataCreate.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