All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SceneModelFactory.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Rendering.h"
6 #include "AsyncTexturing.h"
7 #include "Lighting.h"
8 #include "POD.h"
9 #include "Types.h"
10 #include "VectorMathDecl.h"
11 #include "SceneModelResourceRepository.h"
12 #include "SceneModelTextureResource.h"
13 #include "SceneModelMaterialResource.h"
14 #include "SceneModelMeshResource.h"
15 #include "SceneModelTriStripMeshResource.h"
16 #include "Helpers.h"
17 #include <string>
18 #include <vector>
19 
20 namespace Eegeo
21 {
22  namespace Rendering
23  {
24  namespace SceneModels
25  {
26  static const std::string PlaceholderTexturePath = "placeholder";
27 
29  {
30  public:
31 
36 
38  VertexLayouts::VertexBindingPool& vertexBindingPool,
39  Rendering::Shaders::ShaderIdGenerator& shaderIdGenerator,
40  Rendering::Materials::MaterialIdGenerator& materialIdGenerator,
41  Lighting::GlobalLighting& globalLighting,
42  Lighting::GlobalFogging& globalFogging,
43  AsyncTexturing::IAsyncTextureRequestor& asyncTextureLoader,
44  TTextureRepo& textureRepo,
45  TMaterialRepo& materialRepo,
46  TMeshRepo& meshRepo,
47  TTriStripMeshRepo& triStripMeshRepo);
48 
50 
51  void PreloadResourcesFromPodScene(const IO::POD::PODScene& podScene,
52  TTextureRepo& textureRepo,
53  TMaterialRepo& materialRepo,
54  TMeshRepo& meshRepo,
55  TTriStripMeshRepo& triStripMeshRepo,
56  const std::string& filename,
57  const std::string& texturePath);
58  void PreloadTexturesFromPodScene(const IO::POD::PODScene& podScene, TTextureRepo& textureRepo, const std::string& texturePath);
59  void PreloadMaterialsFromPodScene(const IO::POD::PODScene& podScene,
60  TMaterialRepo& materialRepo,
61  TTextureRepo& textureRepo,
62  const std::string& filename,
63  const std::string& texturePath );
64  void PreloadMeshesFromPodScene(const IO::POD::PODScene& podScene, TMeshRepo& meshRepo, TTriStripMeshRepo& triStripMeshRepo, const std::string& filename);
65 
66  SceneModel* CreateSceneModelFromPodScene(const IO::POD::PODScene& podScene, const std::string& name, const std::string& texturePath);
67  SceneModel* CreateSceneModelFromPodScene(const IO::POD::PODScene& podScene,
71  const std::string& name);
72 
73  SceneModelRenderableNode* CreateSceneModelNodeFromMesh(const std::string& name, SceneModelMeshResource& meshResource, SceneModelMaterialResource& materialResource);
74 
75  private:
76 
77  ISceneModelNodeAnimation* GetAnimationDataForNode(const IO::POD::PODNode& podNode, uint frameCount);
78  void GetNonIndexedAnimationData(const IO::POD::PODNode& podNode, std::vector<v3>& out_positions, std::vector<Quaternion>& out_rotations, std::vector<v3>& out_scales);
79  void GetIndexedAnimationData(const IO::POD::PODNode& podNode,
80  u32 frameCount,
81  std::vector<u32>& out_positionIndices,
82  std::vector<u32>& out_rotationIndices,
83  std::vector<u32>& out_scaleIndices);
84 
85 
87  VertexLayouts::VertexBindingPool& m_vertexBindingPool;
88  Rendering::Shaders::ShaderIdGenerator& m_shaderIdGenerator;
89  Rendering::Materials::MaterialIdGenerator& m_materialIdGenerator;
90  Lighting::GlobalLighting& m_globalLighting;
91  Lighting::GlobalFogging& m_globalFogging;
92  AsyncTexturing::IAsyncTextureRequestor& m_asyncTextureLoader;
93 
94  Shaders::ModelShader* m_pShader;
95 
96  TTextureRepo& m_textureRepo;
97  TMaterialRepo& m_materialRepo;
98  TMeshRepo& m_meshRepo;
99  TTriStripMeshRepo& m_triStripMeshRepo;
100  };
101  }
102  }
103 }