MCPcopy Create free account
hub / github.com/TomClabault/HIPRT-Path-Tracer / dispatch_texture_loading

Method dispatch_texture_loading

src/Scene/SceneParser.cpp:373–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void SceneParser::dispatch_texture_loading(Scene& parsed_scene, const std::string& scene_path, int nb_threads, const std::vector<std::pair<aiTextureType, std::string>>& texture_paths, const std::vector<int>& material_indices)
374{
375 if (nb_threads == -1)
376 // As many threads as there are textures if -1 was given
377 nb_threads = texture_paths.size();
378
379 // Creating a state to keep the data that the threads need alive
380 std::shared_ptr<TextureLoadingThreadState> texture_threads_state = std::make_shared<TextureLoadingThreadState>();
381 texture_threads_state->scene_filepath = scene_path;
382 texture_threads_state->texture_paths = texture_paths;
383 texture_threads_state->material_indices = material_indices;
384
385 ThreadManager::set_thread_data(ThreadManager::SCENE_TEXTURES_LOADING_THREAD_KEY, texture_threads_state);
386
387 for (int i = 0; i < nb_threads; i++)
388 ThreadManager::start_thread(ThreadManager::SCENE_TEXTURES_LOADING_THREAD_KEY, ThreadFunctions::load_scene_texture, std::ref(parsed_scene), texture_threads_state->scene_filepath, std::ref(texture_threads_state->texture_paths), std::ref(texture_threads_state->material_indices), i, nb_threads);
389}
390
391void SceneParser::read_material_properties(aiMaterial* mesh_material, CPUMaterial& renderer_material)
392{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected