BVB Source Codes

CRYENGINE Show ObjManFar.cpp Source code

Return Download CRYENGINE: download ObjManFar.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   statobjmanfar.cpp
  5. //  Version:     v1.00
  6. //  Created:     28/5/2001 by Vladimir Kajalin
  7. //  Compilers:   Visual Studio.NET
  8. //  Description: draw far objects as sprites
  9. // -------------------------------------------------------------------------
  10. //  History:
  11. //
  12. ////////////////////////////////////////////////////////////////////////////
  13.  
  14. #include "StdAfx.h"
  15.  
  16. #include "StatObj.h"
  17. #include "ObjMan.h"
  18. #include "3dEngine.h"
  19.  
  20. static PodArray<SVegetationSpriteInfo> arrVegetationSprites[RT_COMMAND_BUF_COUNT][MAX_RECURSION_LEVELS];
  21.  
  22. void CObjManager::UnloadFarObjects()
  23. {
  24.         for (int i = 0; i < RT_COMMAND_BUF_COUNT; ++i)
  25.                 for (int j = 0; j < MAX_RECURSION_LEVELS; ++j)
  26.                         stl::free_container(arrVegetationSprites[i][j]);
  27. }
  28.  
  29. void CObjManager::RenderFarObjects(const SRenderingPassInfo& passInfo)
  30. {
  31.  
  32.         FUNCTION_PROFILER_3DENGINE;
  33.  
  34.         int nCount = 0;
  35.         for (int t = 0; t < nThreadsNum; t++)
  36.                 nCount += m_arrVegetationSprites[passInfo.GetRecursiveLevel()][t].size();
  37.  
  38.         if (!m_REFarTreeSprites)
  39.         {
  40.                 m_REFarTreeSprites = (CREFarTreeSprites*)GetRenderer()->EF_CreateRE(eDATA_FarTreeSprites);
  41.         }
  42.         if (m_REFarTreeSprites && GetCVars()->e_VegetationSprites && nCount && !GetCVars()->e_DefaultMaterial)
  43.         {
  44.                 arrVegetationSprites[passInfo.ThreadID()][passInfo.GetRecursiveLevel()].Clear();
  45.  
  46.                 for (int t = 0; t < nThreadsNum; t++)
  47.                 {
  48.                         CThreadSafeRendererContainer<SVegetationSpriteInfo>& rList = m_arrVegetationSprites[passInfo.GetRecursiveLevel()][t];
  49.                         if (rList.size())
  50.                         {
  51.                                 rList.CoalesceMemory();
  52.                                 for (size_t i = 0; i < rList.size(); ++i)
  53.                                         arrVegetationSprites[passInfo.ThreadID()][passInfo.GetRecursiveLevel()].Add(rList[i]);
  54.                         }
  55.                 }
  56.                 m_REFarTreeSprites->m_arrVegetationSprites[passInfo.ThreadID()][passInfo.GetRecursiveLevel()] = &arrVegetationSprites[passInfo.ThreadID()][passInfo.GetRecursiveLevel()];
  57.                 CRenderObject* pObj = GetRenderer()->EF_GetObject_Temp(passInfo.ThreadID());
  58.                 if (!pObj)
  59.                         return;
  60.                 pObj->m_II.m_Matrix.SetIdentity();
  61.                 SShaderItem shItem(m_p3DEngine->m_pFarTreeSprites);
  62.                 GetRenderer()->EF_AddEf(m_REFarTreeSprites, shItem, pObj, passInfo, EFSLIST_GENERAL, 1);
  63.         }
  64. }
  65. /*
  66.    static inline int Compare(CVegetation *& p1, CVegetation *& p2)
  67.    {
  68.    if(p1->m_fDistance > p2->m_fDistance)
  69.     return 1;
  70.    else
  71.    if(p1->m_fDistance < p2->m_fDistance)
  72.     return -1;
  73.  
  74.    return 0;
  75.    } */
  76.  
  77. void CObjManager::DrawFarObjects(float fMaxViewDist, const SRenderingPassInfo& passInfo)
  78. {
  79.         if (!GetCVars()->e_VegetationSprites)
  80.                 return;
  81.  
  82.         FUNCTION_PROFILER_3DENGINE;
  83.  
  84.         if (passInfo.GetRecursiveLevel() >= MAX_RECURSION_LEVELS)
  85.         {
  86.                 assert(!"Recursion depther than MAX_RECURSION_LEVELS is not supported");
  87.                 return;
  88.         }
  89.  
  90.         //////////////////////////////////////////////////////////////////////////////////////
  91.         //  Draw all far
  92.         //////////////////////////////////////////////////////////////////////////////////////
  93.  
  94.         //PodArray<SVegetationSpriteInfo> * pList = &arrVegetationSprites[m_nRenderStackLevel];
  95.         //if (pList->Count())
  96.         //  GetRenderer()->DrawObjSprites(pList);
  97. }
  98.  
  99. void CObjManager::GenerateFarObjects(float fMaxViewDist, const SRenderingPassInfo& passInfo)
  100. {
  101.         if (!GetCVars()->e_VegetationSprites)
  102.                 return;
  103.  
  104.         FUNCTION_PROFILER_3DENGINE;
  105.  
  106.         if (passInfo.GetRecursiveLevel() >= MAX_RECURSION_LEVELS)
  107.         {
  108.                 assert(!"Recursion depther than MAX_RECURSION_LEVELS is not supported");
  109.                 return;
  110.         }
  111.  
  112.         //////////////////////////////////////////////////////////////////////////////////////
  113.         //  Draw all far
  114.         //////////////////////////////////////////////////////////////////////////////////////
  115.  
  116.         /*arrVegetationSprites[m_nRenderStackLevel].Clear();
  117.  
  118.            for(int t=0; t<nThreadsNum; t++)
  119.            {
  120.            PodArray<SVegetationSpriteInfo> * pList = &m_arrVegetationSprites[m_nRenderStackLevel][t];
  121.            if (pList->Count())
  122.             arrVegetationSprites[m_nRenderStackLevel].AddList(*pList);
  123.            }*/
  124.  
  125.         //PodArray<SVegetationSpriteInfo> * pList = &arrVegetationSprites[m_nRenderStackLevel];
  126.         //if (pList->Count())
  127.         //  GetRenderer()->GenerateObjSprites(pList);
  128. }
  129.  
downloadObjManFar.cpp 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