All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ChunkedBuildingBuilder.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Rendering.h"
6 #include "Types.h"
7 #include "IResourceBuilder.h"
8 #include "CityThemes.h"
9 #include "AsyncTexturing.h"
10 #include "Streaming.h"
11 #include "ChunkedFileFormat.h"
12 #include "Space.h"
13 #include "Collision.h"
14 #include "CollisionBvhFactory.h"
15 #include "LandmarkToRenderableRepository.h"
16 #include "Buildings.h"
17 #include "Config.h"
18 
19 #include <string>
20 #include <vector>
21 
22 namespace Eegeo
23 {
24  namespace Resources
25  {
26  namespace Buildings
27  {
29  {
31  : lowLod(false)
32  , pCollisionBvh(NULL)
33  {
34  }
35 
37 
38  void Clear();
39 
40  bool lowLod;
41 
42  std::vector<RenderableCreationData*> shadowRenderableCreationDatas;
43  std::vector<RenderableCreationData*> buildingRenderableCreationDatas;
44  std::vector<RenderableCreationData*> landmarkRenderableCreationDatas;
45 
46  Eegeo::Collision::CollisionBvh* pCollisionBvh;
47  };
48 
50  {
51  public:
54  Rendering::IMeshUploadService* pMeshUploadService,
57  Eegeo::Collision::CollisionMeshResourceRepository& collisionMeshResourceRepository,
58  bool generateCollision,
59  Rendering::IMaterialProvider& materialProvider,
62  ILandmarkTextureLoader& landmarkTextureLoader,
63  ILandmarkRenderableFactory& landmarkRenderableFactory,
65  const Config::ResourceBuilderConfigSection& resourceBuilderConfig,
68  )
69  : m_packedDiffuseReadMeshFactory(packedDiffuseReadMeshFactory)
70  , m_pMeshUploadService(pMeshUploadService)
71  , m_sceneElementRepository(sceneElementRepository)
72  , m_shadowSceneElementRepository(shadowSceneElementRepository)
73  , m_collisionMeshResourceRepository(collisionMeshResourceRepository)
74  , m_bGenerateCollision(generateCollision)
75  , m_materialProvider(materialProvider)
76  , m_vertexBindingPool(vertexBindingPool)
77  , m_cityThemeService(cityThemeService)
78  , m_landmarkTextureLoader(landmarkTextureLoader)
79  , m_landmarkRenderableFactory(landmarkRenderableFactory)
80  , m_landmarkSceneGraphObserver(landmarkSceneGraphObserver)
81  , m_resourceBuilderConfig(resourceBuilderConfig)
82  , m_pBuildingSceneGraphObserver(pBuildingSceneGraphObserver)
83  , m_qcmsChunkReader(qcmsChunkReader)
84  , m_collisionBvhFactory(Eegeo::Collision::CollisionGroup::Buildings)
85  {
86  }
87 
88  virtual bool Flush(const Streaming::MortonKey& key, void* input, TBuiltResources& result);
89  virtual void DestroyBuiltResource(const Streaming::MortonKey& key, void* input);
90  virtual void* BuildResource(const Streaming::MortonKey& key, const Byte* data, size_t length);
91 
92  virtual bool AcceptsErroredRequests()
93  {
94  return false;
95  }
96 
97  private:
98 
99  bool IsAlpha(const std::string &textureName) const;
100 
101  void BuildFromQuantizedMeshSet(const Space::CubeMap::CubeMapCellInfo& cellInfo, IO::ChunkedFileFormat::ChunkStream& chunkStream, Resources::BinaryParsing::membuf& membuf, int cellModelChunkChildCount, ChunkedBuildingBuilderOutput& builderOutput);
102 
104  Rendering::IMeshUploadService* m_pMeshUploadService;
107  Eegeo::Collision::CollisionMeshResourceRepository& m_collisionMeshResourceRepository;
108  const bool m_bGenerateCollision;
109  Rendering::IMaterialProvider& m_materialProvider;
110  Rendering::VertexLayouts::VertexBindingPool& m_vertexBindingPool;
111  Resources::CityThemes::ICityThemesService& m_cityThemeService;
112  ILandmarkTextureLoader& m_landmarkTextureLoader;
113  ILandmarkRenderableFactory& m_landmarkRenderableFactory;
115  const Config::ResourceBuilderConfigSection& m_resourceBuilderConfig;
118  Collision::CollisionBvhFactory m_collisionBvhFactory;
119  };
120  }
121  }
122 }