bool DirectxEngine::InitialiseScene(const IScene& scene) { m_data->shadows = std::make_unique<DxQuadMesh>(scene.Shadows(), [this](const D3DXMATRIX& world, int texture){ UpdateShader(world, texture); }); m_data->textures.reserve(scene.Textures().size()); for(const auto& texture : scene.Textures()) { m_data->textures.push_back(std::unique_ptr<DxTexture>( new DxTexture(*texture))); } m_data->shaders.reserve(scene.Shaders().size()); for(const auto& shader : scene.Shaders()) { m_data->shaders.push_back(std::unique_ptr<DxShader>( new DxShader(*shader))); } m_data->meshes.reserve(scene.Meshes().size()); for(const auto& mesh : scene.Meshes()) { m_data->meshes.push_back(std::unique_ptr<DxMesh>(new DxMesh(*mesh, [this](const D3DXMATRIX& world, int texture){ UpdateShader(world, texture); }))); } m_data->terrain.reserve(scene.Terrains().size()); for(const auto& terrain : scene.Terrains()) { m_data->terrain.push_back(std::unique_ptr<DxMesh>(new DxMesh(*terrain, [this](const D3DXMATRIX& world, int texture){ UpdateShader(world, texture); }))); } m_data->waters.reserve(scene.Waters().size()); for(const auto& water : scene.Waters()) { m_data->waters.push_back(std::unique_ptr<DxMesh>(new DxMesh(*water, [this](const D3DXMATRIX& world, int texture){ UpdateShader(world, texture); }))); } m_data->emitters.reserve(scene.Emitters().size()); for(const auto& emitter : scene.Emitters()) { m_data->emitters.push_back(std::unique_ptr<DxEmitter>(new DxEmitter(*emitter, [this](const D3DXMATRIX& world, const Particle& data){ UpdateShader(world, data); }))); } return ReInitialiseScene(); }