diff --git a/library/phx/rendering/components/resource_component.cpp b/library/phx/rendering/components/resource_component.cpp deleted file mode 100644 index 507c1974795be55a4fd7c7f64e3b20e1ad656710..0000000000000000000000000000000000000000 --- a/library/phx/rendering/components/resource_component.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// Project Phoenix -// -// Copyright (c) 2017-2018 RWTH Aachen University, Germany, -// Virtual Reality & Immersive Visualization Group. -//------------------------------------------------------------------------------ -// License -// -// Licensed under the 3-Clause BSD License (the "License"); -// you may not use this file except in compliance with the License. -// See the file LICENSE for the full text. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/BSD-3-Clause -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//------------------------------------------------------------------------------ - -#include "phx/rendering/components/resource_component.hpp" - -#include <string> - -namespace phx { - - -} // namespace phx diff --git a/library/phx/rendering/render_passes/geometry_pass.hpp b/library/phx/rendering/render_passes/geometry_pass.hpp index 8490d26f6411d99a9b2ecb797cfb8f19a3a756bf..28450ed30182157428211bbdb10e2592bb60f7a0 100644 --- a/library/phx/rendering/render_passes/geometry_pass.hpp +++ b/library/phx/rendering/render_passes/geometry_pass.hpp @@ -29,7 +29,6 @@ #include <utility> #include <vector> -#include "phx/resources/types/material.hpp" #include "phx/suppress_warnings.hpp" SUPPRESS_WARNINGS_BEGIN @@ -45,6 +44,7 @@ SUPPRESS_WARNINGS_END #include "phx/rendering/components/projection.hpp" #include "phx/rendering/components/transform.hpp" #include "phx/rendering/render_passes/render_pass.hpp" +#include "phx/resources/types/material.hpp" #include "phx/resources/types/mesh.hpp" namespace phx { diff --git a/library/phx/rendering/rendering_system.cpp b/library/phx/rendering/rendering_system.cpp index 5558d9f9434b0fd0da2ca8eea949b53e6e840d49..a642caa62e7739f05f5ae5a228e964d0d005fa7d 100644 --- a/library/phx/rendering/rendering_system.cpp +++ b/library/phx/rendering/rendering_system.cpp @@ -82,66 +82,54 @@ void RenderingSystem::Update(const FrameTimer::TimeInfo&) { for (auto& entity : GetEngine()->GetEntities()) { auto light = entity->GetFirstComponent<Light>(); auto transform = entity->GetFirstComponent<Transform>(); -<<<<<<< HEAD + const auto material = entity->GetFirstComponent<ResourceComponent<Material>>(); const auto mesh = entity->GetFirstComponent<ResourceComponent<Mesh>>(); + const auto mesh_render_settings = + entity->GetFirstComponent<MeshRenderSettings>(); if (transform != nullptr) { if (mesh != nullptr) { rendering_instances.push_back( {mesh->GetResourcePointer().Get(), (material != nullptr ? material->GetResourcePointer().Get() : nullptr), - transform}); - == == == = auto material_handle = - entity->GetFirstComponent<MaterialHandle>(); - Material* material = nullptr; - if (material_handle != nullptr) - material = material_handle->GetMaterial().Get(); - auto mesh_render_settings = - entity->GetFirstComponent<MeshRenderSettings>(); - - if (transform != nullptr) { - if (mesh_handle != nullptr) { - rendering_instances.push_back({mesh_handle->GetMesh().Get(), - material, transform, - mesh_render_settings}); ->>>>>>> master - } else if (light != nullptr) { - light_transform_pairs.push_back( - std::pair<Light*, Transform*>(light, transform)); - } - } - if (entity->GetFirstComponent<Skybox>() != nullptr) { - skybox = entity->GetFirstComponent<Skybox>(); - } - } + transform, mesh_render_settings}); - auto skybox_passes = frame_graph_->GetRenderPasses<SkyboxPass>(); - for (auto skybox_pass : skybox_passes) { - skybox_pass->SetSkyboxComponent(skybox); + } else if (light != nullptr) { + light_transform_pairs.push_back( + std::pair<Light*, Transform*>(light, transform)); } + } + if (entity->GetFirstComponent<Skybox>() != nullptr) { + skybox = entity->GetFirstComponent<Skybox>(); + } + } - auto geometry_passes = frame_graph_->GetRenderPasses<GeometryPass>(); - for (auto geometry_pass : geometry_passes) { - geometry_pass->SetData(rendering_instances, light_transform_pairs); - } + auto skybox_passes = frame_graph_->GetRenderPasses<SkyboxPass>(); + for (auto skybox_pass : skybox_passes) { + skybox_pass->SetSkyboxComponent(skybox); + } - frame_graph_->Execute(); - } + auto geometry_passes = frame_graph_->GetRenderPasses<GeometryPass>(); + for (auto geometry_pass : geometry_passes) { + geometry_pass->SetData(rendering_instances, light_transform_pairs); + } - FrameGraph* RenderingSystem::GetFrameGraph() const { - return frame_graph_.get(); - } + frame_graph_->Execute(); +} - void RenderingSystem::SetFrameGraph( - std::unique_ptr<FrameGraph> frame_graph) { - frame_graph_ = std::move(frame_graph); - } +FrameGraph* RenderingSystem::GetFrameGraph() const { + return frame_graph_.get(); +} - std::string RenderingSystem::ToString() const { - return "RenderingSystem with #FrameGraph-Passes: " + - std::to_string(frame_graph_->GetNumberOfPasses()); - } +void RenderingSystem::SetFrameGraph(std::unique_ptr<FrameGraph> frame_graph) { + frame_graph_ = std::move(frame_graph); +} + +std::string RenderingSystem::ToString() const { + return "RenderingSystem with #FrameGraph-Passes: " + + std::to_string(frame_graph_->GetNumberOfPasses()); +} - } // namespace phx +} // namespace phx diff --git a/tests/src/test_resource_pointer.cpp b/tests/src/test_resource_pointer.cpp index fd924b1f732d0de930c72fd3fc4193c7c921a1a2..1e80bb34b306537e47f08acedb982bde6c0ae474 100644 --- a/tests/src/test_resource_pointer.cpp +++ b/tests/src/test_resource_pointer.cpp @@ -90,7 +90,7 @@ SCENARIO( } } } -SCENARIO("ResourcePointers can be used as components directly") { +SCENARIO("ResourcePointers can be used in a ResourceComponent") { GIVEN("A resource pointer to an arbitrarily chosen model resource.") { phx::ResourcePointer<phx::Model> resource_pointer = phx::ResourceManager::instance().DeclareResource<phx::Model>( @@ -98,12 +98,12 @@ SCENARIO("ResourcePointers can be used as components directly") { resource_pointer.Load(); auto mesh_resource_pointer = resource_pointer->GetMeshes()[0]; phx::Entity entity; - WHEN("We add the mesh_resource_pointer as resource component") { + WHEN("We add the mesh_resource_pointer as ResourceComponent") { entity.AddComponent<phx::ResourceComponent<phx::Mesh>>( mesh_resource_pointer); THEN( - "the resouce pointer itself is the resource and can be obtained as " - "usual") { + "the resouce pointer is in the ResourceComponent and can be obtained " + "using GetResourcePointer()") { auto resource_component = entity.GetFirstComponent<phx::ResourceComponent<phx::Mesh>>(); REQUIRE(resource_component->GetResourcePointer().Get() ==