19 #include <nori/scene.h>
20 #include <nori/bitmap.h>
21 #include <nori/integrator.h>
22 #include <nori/sampler.h>
23 #include <nori/camera.h>
24 #include <nori/emitter.h>
37 for(
auto e : m_emitters)
52 m_sampler =
static_cast<Sampler*
>(
58 cout <<
"Configuration: " <<
toString() << endl;
67 m_shapes.push_back(mesh);
74 m_emitters.push_back(
static_cast<Emitter *
>(obj));
79 throw NoriException(
"There can only be one sampler per scene!");
80 m_sampler =
static_cast<Sampler *
>(obj);
85 throw NoriException(
"There can only be one camera per scene!");
86 m_camera =
static_cast<Camera *
>(obj);
91 throw NoriException(
"There can only be one integrator per scene!");
96 throw NoriException(
"Scene::addChild(<%s>) is not supported!",
103 for (
size_t i=0; i<m_shapes.size(); ++i) {
104 shapes += std::string(
" ") + indent(m_shapes[i]->
toString(), 2);
105 if (i + 1 < m_shapes.size())
111 for (
size_t i=0; i<m_emitters.size(); ++i) {
112 lights += std::string(
" ") + indent(m_emitters[i]->
toString(), 2);
113 if (i + 1 < m_emitters.size())
120 " integrator = %s,\n"
136 NORI_REGISTER_CLASS(
Scene,
"scene");
Bounding Volume Hierarchy for fast ray intersection queries.
void build()
Build the BVH.
void addShape(Shape *shape)
Register a shape for inclusion in the BVH.
Generic camera interface.
Superclass of all emitters.
Abstract integrator (i.e. a rendering technique)
Simple exception class, which stores a human-readable error description.
static NoriObject * createInstance(const std::string &name, const PropertyList &propList)
Construct an instance from the class of the given name.
Base class of all objects.
virtual void activate()
Perform some action associated with the object.
virtual std::string toString() const =0
Return a brief string summary of the instance (for debugging purposes)
static std::string classTypeName(EClassType type)
Turn a class type into a human-readable string.
virtual EClassType getClassType() const =0
Return the type of object (i.e. Mesh/BSDF/etc.) provided by this instance.
This is an associative container used to supply the constructors of NoriObject subclasses with parame...
Abstract sample generator.
Main scene data structure.
virtual void activate() override
Inherited from NoriObject::activate()
virtual ~Scene()
Release all memory.
virtual std::string toString() const override
Return a string summary of the scene (for debugging purposes)
Scene(const PropertyList &)
Construct a new scene object.
virtual void addChild(NoriObject *obj) override
Add a child object to the scene (meshes, integrators etc.)
Superclass of all shapes.
bool isEmitter() const
Is this mesh an area emitter?
Emitter * getEmitter()
Return a pointer to an attached area emitter instance.