tinypbrt 1.1.1
pbrt-v4 scene file parser for C11 with a header-only C++20 wrapper
Loading...
Searching...
No Matches
tpbrt::scene Class Reference

Scene loaded from a pbrt-v4 file or string, owning all its memory (move only, freed in the destructor). More...

#include <tinypbrt/detail/cpp/scene.hpp>

Public Member Functions

 scene (scene &&other) noexcept=default
 Moves scene (views created from other stay valid, they point to the same heap memory).
 
scene & operator= (scene &&other) noexcept=default
 Moves scene (the scene held before is freed).
 
 scene (const scene &)=delete
 Scene owns C memory, so it cannot be copied.
 
scene & operator= (const scene &)=delete
 Scene owns C memory, so it cannot be copied.
 
 ~scene ()=default
 Frees the scene.
 
- Public Member Functions inherited from tpbrt::scene_view
constexpr tpbrt::options options () const noexcept
 Returns options value.
 
constexpr tpbrt::camera camera () const noexcept
 Returns camera value.
 
constexpr tpbrt::film film () const noexcept
 Returns film value.
 
constexpr tpbrt::integrator integrator () const noexcept
 Returns integrator value.
 
constexpr tpbrt::accelerator accelerator () const noexcept
 Returns accelerator value.
 
constexpr tpbrt::sampler sampler () const noexcept
 Returns sampler value.
 
constexpr float_t start_time () const noexcept
 Returns start_time value.
 
constexpr tpbrt::filter filter () const noexcept
 Returns filter value.
 
constexpr float_t end_time () const noexcept
 Returns end_time value.
 
constexpr tpbrt::textures_list textures () const noexcept
 Returns textures value.
 
constexpr tpbrt::materials_list materials () const noexcept
 Returns materials value.
 
constexpr tpbrt::medias_list medias () const noexcept
 Returns medias value.
 
constexpr tpbrt::lights_list lights () const noexcept
 Returns lights value.
 
constexpr tpbrt::shapes_list shapes () const noexcept
 Returns shapes value.
 
constexpr tpbrt::objects_list objects () const noexcept
 Returns objects value.
 
constexpr tpbrt::objects_instances_list instances () const noexcept
 Returns instances value.
 
constexpr tpbrt::transforms_list transforms () const noexcept
 Returns transforms value.
 
constexpr auto reflect () const noexcept
 Conversion to tuple.
 

Static Public Member Functions

static result< scene > load_from_file (const std::string &filepath)
 Loads scene from given file.
 
static result< scene > load_from_memory (const std::string &data, const std::string &working_directory=".")
 Loads scene from memory (provided string).
 
static result< scene > load_from_memory (const char_t *const data, const std::string &working_directory=".")
 Loads scene from memory (provided null-terminated string).
 

Detailed Description

Scene loaded from a pbrt-v4 file or string, owning all its memory (move only, freed in the destructor).

All accessors from tpbrt::scene_view return views into the scene memory: they stay valid while the scene lives, also after the scene object is moved (the C scene lives on the heap and does not move).

Examples
examples/cpp/quickstart/main.cpp.

Constructor & Destructor Documentation

◆ scene() [1/2]

tpbrt::scene::scene ( scene &&  other)
defaultnoexcept

Moves scene (views created from other stay valid, they point to the same heap memory).

◆ scene() [2/2]

tpbrt::scene::scene ( const scene &  )
delete

Scene owns C memory, so it cannot be copied.

◆ ~scene()

tpbrt::scene::~scene ( )
default

Frees the scene.

Member Function Documentation

◆ operator=() [1/2]

scene & tpbrt::scene::operator= ( scene &&  other)
defaultnoexcept

Moves scene (the scene held before is freed).

◆ operator=() [2/2]

scene & tpbrt::scene::operator= ( const scene &  )
delete

Scene owns C memory, so it cannot be copied.

◆ load_from_file()

static result< scene > tpbrt::scene::load_from_file ( const std::string &  filepath)
inlinestatic

Loads scene from given file.

Parameters
filepathPath to scene file.
Returns
Result with error code or with scene.

◆ load_from_memory() [1/2]

static result< scene > tpbrt::scene::load_from_memory ( const std::string &  data,
const std::string &  working_directory = "." 
)
inlinestatic

Loads scene from memory (provided string).

Parameters
dataScene text (std::string is always null-terminated, so it is passed without a copy).
working_directoryDirectory used to resolve Include / Import and other relative paths.
Returns
Result with error code or with scene.

◆ load_from_memory() [2/2]

static result< scene > tpbrt::scene::load_from_memory ( const char_t *const  data,
const std::string &  working_directory = "." 
)
inlinestatic

Loads scene from memory (provided null-terminated string).

Parameters
dataScene text (must end with '\0').
working_directoryDirectory used to resolve Include / Import and other relative paths.
Returns
Result with error code or with scene.

The documentation for this class was generated from the following file: