Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "mainwindow/rendering/renderingmanager.h"

// appleseed.renderer headers.
#include "renderer/kernel/intersection/assemblytree.h"
#include "renderer/kernel/intersection/tracecontext.h"
#include "renderer/kernel/rendering/scenepicker.h"

// Qt headers.
Expand All @@ -43,15 +45,15 @@ namespace appleseed {
namespace studio {

MaterialDropHandler::MaterialDropHandler(
const renderer::Project& project,
RenderingManager& rendering_manager)
const renderer::Project& project,
RenderingManager& rendering_manager)
: m_project(project), m_rendering_manager(rendering_manager)
{
}

void MaterialDropHandler::slot_material_dropped(
const foundation::Vector2d& drop_pos,
const QString& material_name)
const foundation::Vector2d& drop_pos,
const QString& material_name)
{
m_drop_pos = drop_pos;
m_material_name = material_name.toStdString();
Expand Down
13 changes: 7 additions & 6 deletions src/appleseed.studio/mainwindow/rendering/materialdrophandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#pragma once

// appleseed.renderer headers.
#include "renderer/api/scenepicker.h"
#include "renderer/modeling/project/project.h"
#include "renderer/modeling/scene/objectinstance.h"

Expand All @@ -55,19 +56,19 @@ class MaterialDropHandler

public:
MaterialDropHandler(
const renderer::Project& project,
RenderingManager& rendering_manager);
const renderer::Project& project,
RenderingManager& rendering_manager);

public slots:
void slot_material_dropped(
const foundation::Vector2d& drop_pos,
const QString& material_name);

private:
const renderer::Project& m_project;
RenderingManager& m_rendering_manager;
foundation::Vector2d m_drop_pos;
std::string m_material_name;
const renderer::Project& m_project;
RenderingManager& m_rendering_manager;
foundation::Vector2d m_drop_pos;
std::string m_material_name;

void assign_material(const renderer::ObjectInstance::Side side);

Expand Down
1 change: 0 additions & 1 deletion src/appleseed.studio/mainwindow/rendering/rendertab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ void RenderTab::recreate_handlers()
// Set initial state.
m_pixel_inspector_handler->set_enabled(false);
m_camera_controller->set_enabled(false);
m_scene_picking_handler->set_enabled(true);
}

} // namespace studio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include "renderer/api/project.h"
#include "renderer/api/scene.h"
#include "renderer/api/surfaceshader.h"
#include "renderer/kernel/intersection/assemblytree.h"
#include "renderer/kernel/intersection/tracecontext.h"

// appleseed.foundation headers.
#include "foundation/math/basis.h"
Expand Down
9 changes: 9 additions & 0 deletions src/appleseed/foundation/math/bvh/bvh_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class Tree
// Return the size (in bytes) of this object in memory.
size_t get_memory_size() const;

// Return the nodes in the tree.
const NodeVector& get_nodes() const;

protected:
template <typename Tree, typename Partitioner>
friend class Builder;
Expand Down Expand Up @@ -104,5 +107,11 @@ size_t Tree<NodeVector>::get_memory_size() const
+ m_nodes.capacity() * sizeof(NodeType);
}

template <typename NodeVector>
const NodeVector& Tree<NodeVector>::get_nodes() const
{
return m_nodes;
}

} // namespace bvh
} // namespace foundation
2 changes: 1 addition & 1 deletion src/appleseed/foundation/string/internedstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace foundation
//
// There are also some disadvantages:
//
// - Constructing an interned string can be slower that a normal string.
// - Constructing an interned string can be slower than a normal string.
// - Memory for the string characters is never freed.
//
// This implementation relies internally on OpenImageIO's ustring class.
Expand Down
2 changes: 1 addition & 1 deletion src/appleseed/renderer/device/cpu/cpurenderdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CPURenderDevice::CPURenderDevice(
Project& project,
const ParamArray& params)
: RenderDeviceBase(project, params)
, m_texture_store(*project.get_scene(), params.child("texture_store"))
, m_texture_store(project.get_texture_store(params.child("texture_store")))
{
m_error_handler = new OIIOErrorHandler();
#ifndef NDEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/appleseed/renderer/device/cpu/cpurenderdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class CPURenderDevice
RendererServices* m_renderer_services;
OSLShadingSystem* m_shading_system;
foundation::auto_release_ptr<ShaderCompiler> m_osl_compiler;
TextureStore m_texture_store;
TextureStore& m_texture_store;
std::unique_ptr<RendererComponents> m_components;
};

Expand Down
14 changes: 7 additions & 7 deletions src/appleseed/renderer/kernel/intersection/assemblytree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ namespace renderer
// AssemblyTree class implementation.
//

AssemblyTree::AssemblyTree(const Scene& scene)
AssemblyTree::AssemblyTree(const Project& project)
: TreeType(AlignedAllocator<void>(System::get_l1_data_cache_line_size()))
, m_scene(scene)
, m_project(project)
#ifdef APPLESEED_WITH_EMBREE
, m_use_embree(false)
, m_dirty(false)
Expand Down Expand Up @@ -163,7 +163,7 @@ void AssemblyTree::rebuild_assembly_tree()
RENDERER_LOG_INFO("collecting assembly instances...");
AABBVector assembly_instance_bboxes;
collect_assembly_instances(
m_scene.assembly_instances(),
m_project.get_scene()->assembly_instances(),
TransformSequence(),
assembly_instance_bboxes);

Expand All @@ -185,7 +185,7 @@ void AssemblyTree::rebuild_assembly_tree()
Builder builder;
builder.build<DefaultWallclockTimer>(*this, partitioner, m_items.size(), AssemblyTreeMaxLeafSize);
statistics.insert_time("build time", builder.get_build_time());
statistics.merge(bvh::TreeStatistics<AssemblyTree>(*this, AABB3d(m_scene.compute_bbox())));
statistics.merge(bvh::TreeStatistics<AssemblyTree>(*this, AABB3d(m_project.get_scene()->compute_bbox())));

if (!m_items.empty())
{
Expand Down Expand Up @@ -407,7 +407,7 @@ void AssemblyTree::create_triangle_tree(const Assembly& assembly)
std::unique_ptr<ILazyFactory<TriangleTree>> triangle_tree_factory(
new TriangleTreeFactory(
TriangleTree::Arguments(
m_scene,
m_project,
assembly.get_uid(),
assembly_bbox,
assembly)));
Expand Down Expand Up @@ -435,7 +435,7 @@ void AssemblyTree::create_curve_tree(const Assembly& assembly)
std::unique_ptr<ILazyFactory<CurveTree>> curve_tree_factory(
new CurveTreeFactory(
CurveTree::Arguments(
m_scene,
*m_project.get_scene(),
assembly.get_uid(),
assembly_bbox,
assembly)));
Expand Down Expand Up @@ -473,7 +473,7 @@ void AssemblyTree::create_embree_scene(const Assembly& assembly)
std::unique_ptr<ILazyFactory<EmbreeScene>> embree_scene_factory(
new EmbreeSceneFactory(
EmbreeScene::Arguments(
m_scene.get_embree_device(),
m_project.get_scene()->get_embree_device(),
assembly
)));

Expand Down
6 changes: 3 additions & 3 deletions src/appleseed/renderer/kernel/intersection/assemblytree.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
// Forward declarations.
namespace foundation { class Statistics; }
namespace renderer { class AssemblyInstance; }
namespace renderer { class Scene; }
namespace renderer { class Project; }
namespace renderer { class ShadingPoint; }

namespace renderer
Expand All @@ -77,7 +77,7 @@ class AssemblyTree
{
public:
// Constructor, builds the tree for a given scene.
explicit AssemblyTree(const Scene& scene);
explicit AssemblyTree(const Project& project);

// Destructor.
~AssemblyTree();
Expand Down Expand Up @@ -126,7 +126,7 @@ class AssemblyTree
typedef std::vector<const Assembly*> AssemblyVector;
typedef std::map<foundation::UniqueID, foundation::VersionID> AssemblyVersionMap;

const Scene& m_scene;
const Project& m_project;
ItemVector m_items;
AssemblyVersionMap m_assembly_versions;

Expand Down
6 changes: 3 additions & 3 deletions src/appleseed/renderer/kernel/intersection/tracecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace renderer
// TraceContext class implementation.
//

TraceContext::TraceContext(const Scene& scene)
: m_scene(scene)
, m_assembly_tree(new AssemblyTree(scene))
TraceContext::TraceContext(const Project& project)
: m_project(project)
, m_assembly_tree(new AssemblyTree(project))
{
RENDERER_LOG_DEBUG(
"data structures size:\n"
Expand Down
9 changes: 6 additions & 3 deletions src/appleseed/renderer/kernel/intersection/tracecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
// appleseed.foundation headers.
#include "foundation/core/concepts/noncopyable.h"

// appleseed.renderer headers.
#include "renderer/modeling/project/project.h"

// appleseed.main headers.
#include "main/dllsymbol.h"

Expand All @@ -54,7 +57,7 @@ class APPLESEED_DLLSYMBOL TraceContext
{
public:
// Constructor, initializes the trace context for a given scene.
explicit TraceContext(const Scene& scene);
explicit TraceContext(const Project& project);

// Destructor.
~TraceContext();
Expand All @@ -73,7 +76,7 @@ class APPLESEED_DLLSYMBOL TraceContext
#endif

private:
const Scene& m_scene;
const Project& m_project;
AssemblyTree* m_assembly_tree;
};

Expand All @@ -84,7 +87,7 @@ class APPLESEED_DLLSYMBOL TraceContext

inline const Scene& TraceContext::get_scene() const
{
return m_scene;
return *m_project.get_scene();
}

inline const AssemblyTree& TraceContext::get_assembly_tree() const
Expand Down
7 changes: 3 additions & 4 deletions src/appleseed/renderer/kernel/intersection/triangletree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@ namespace
}

TriangleTree::Arguments::Arguments(
const Scene& scene,
const Project& project,
const UniqueID triangle_tree_uid,
const GAABB3& bbox,
const Assembly& assembly)
: m_scene(scene)
: m_project(project)
, m_triangle_tree_uid(triangle_tree_uid)
, m_bbox(bbox)
, m_assembly(assembly)
Expand Down Expand Up @@ -1262,8 +1262,7 @@ void TriangleTree::update_intersection_filters()
object_instances_to_filter_keys);

// Create missing intersection filters and update existing ones.
TextureStore texture_store(m_arguments.m_scene);
TextureCache texture_cache(texture_store);
TextureCache texture_cache(m_arguments.m_project.get_texture_store());
create_missing_intersection_filters(
texture_cache,
filter_keys,
Expand Down
7 changes: 4 additions & 3 deletions src/appleseed/renderer/kernel/intersection/triangletree.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "renderer/kernel/intersection/probevisitorbase.h"
#include "renderer/kernel/intersection/trianglekey.h"
#include "renderer/kernel/intersection/trianglevertexinfo.h"
#include "renderer/modeling/project/project.h"
#include "renderer/modeling/scene/visibilityflags.h"

// appleseed.foundation headers.
Expand All @@ -59,7 +60,7 @@ namespace foundation { class Statistics; }
namespace renderer { class Assembly; }
namespace renderer { class IntersectionFilter; }
namespace renderer { class ParamArray; }
namespace renderer { class Scene; }
namespace renderer { class Project; }
namespace renderer { class ShadingPoint; }

namespace renderer
Expand All @@ -83,14 +84,14 @@ class TriangleTree
// Construction arguments.
struct Arguments
{
const Scene& m_scene;
const Project& m_project;
const foundation::UniqueID m_triangle_tree_uid;
const GAABB3 m_bbox;
const Assembly& m_assembly;

// Constructor.
Arguments(
const Scene& scene,
const Project& project,
const foundation::UniqueID triangle_tree_uid,
const GAABB3& bbox,
const Assembly& assembly);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ BackwardLightSampler::BackwardLightSampler(
}
else
{
// Prepare the light-emitting shapes CDF for smapling.
// Prepare the light-emitting shapes CDF for sampling.
if (m_emitting_shapes_cdf.valid())
m_emitting_shapes_cdf.prepare();

Expand Down
4 changes: 2 additions & 2 deletions src/appleseed/renderer/kernel/rendering/scenepicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ struct ScenePicker::Impl
{
const Project& m_project;
const TraceContext& m_trace_context;
TextureStore m_texture_store;
TextureStore& m_texture_store;
TextureCache m_texture_cache;
Intersector m_intersector;

explicit Impl(const Project& project)
: m_project(project)
, m_trace_context(m_project.get_trace_context())
, m_texture_store(m_trace_context.get_scene())
, m_texture_store(m_project.get_texture_store())
, m_texture_cache(m_texture_store)
, m_intersector(m_trace_context, m_texture_cache)
{
Expand Down
6 changes: 3 additions & 3 deletions src/appleseed/renderer/meta/tests/test_intersector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ TEST_SUITE(Renderer_Kernel_Intersection_Intersector)
: public StaticTestSceneContext<TestScene>
{
TraceContext m_trace_context;
TextureStore m_texture_store;
TextureStore& m_texture_store;
TextureCache m_texture_cache;
Intersector m_intersector;

Fixture()
: m_trace_context(m_scene)
, m_texture_store(m_scene)
: m_trace_context(m_project)
, m_texture_store(m_project.get_texture_store())
, m_texture_cache(m_texture_store)
, m_intersector(m_trace_context, m_texture_cache)
{
Expand Down
6 changes: 3 additions & 3 deletions src/appleseed/renderer/meta/tests/test_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ TEST_SUITE(Renderer_Kernel_Lighting_Tracer)
: public StaticTestSceneContext<typename FixtureParams::FixtureBaseClass>
{
TraceContext m_trace_context;
TextureStore m_texture_store;
TextureStore& m_texture_store;
TextureCache m_texture_cache;
Intersector m_intersector;
std::shared_ptr<OIIOTextureSystem> m_texture_system;
Expand All @@ -228,8 +228,8 @@ TEST_SUITE(Renderer_Kernel_Lighting_Tracer)
Tracer m_tracer;

Fixture()
: m_trace_context(FixtureParams::FixtureBaseClass::m_scene)
, m_texture_store(FixtureParams::FixtureBaseClass::m_scene)
: m_trace_context(FixtureParams::FixtureBaseClass::m_project)
, m_texture_store(FixtureParams::FixtureBaseClass::m_project.get_texture_store())
, m_texture_cache(m_texture_store)
, m_intersector(m_trace_context, m_texture_cache)
, m_texture_system(
Expand Down
Loading