Inherits DD::Image::Box3.
Public Member Functions | |
Scene () | |
virtual | ~Scene () |
virtual void | validate (int sample=0) |
virtual void | request (const ChannelSet &channels, int count) |
MotionVectorType | mb_type () const |
Scene * | mb_scene () const |
void | geo (GeoOp *geo) |
GeoOp * | geo () const |
const GeometryList * | object_list () const |
GeometryList * | object_list () |
std::vector< DrawableGeo > * | geo_list () |
unsigned | objects () const |
GeoInfo & | object (unsigned n=0) |
int | sceneId () const |
void | time (float t) |
float | time () const |
void | format (const Format *f) |
const Format * | format () const |
void | projection_mode (int p) |
int | projection_mode () const |
void | max_tessellation (int t) |
int | max_tessellation () const |
const Box & | screen_bbox () const |
const ChannelSet & | channels () const |
const ChannelSet & | shadow_channels () const |
MatrixArray * | transforms () |
const Matrix4 & | matrix (int n) |
const Matrix4 & | inverse_matrix (int n) |
const Matrix4 & | camera_matrix () const |
const Matrix4 & | projection_matrix () const |
const Matrix4 & | format_matrix () const |
MatrixArray * | object_transforms (unsigned n) |
void | set_shadow_scene (bool s) |
bool | is_shadow_scene () const |
bool | transparency () const |
void | transparency (bool v) |
virtual void | add_light (LightOp *) |
virtual void | add_lights (const std::vector< LightOp * > *light_list) |
virtual void | clear_lights () |
virtual bool | evaluate_lights () |
TextureFilter * | filter () const |
void | filter (TextureFilter *v) |
void | copyInfo (const Scene *scene) |
const Quadtree< unsigned > * | quadtree () |
bool | testRayIntersection (Ray &ray, const VertexContext *vtx=nullptr, const Iop *material=nullptr) |
virtual bool | generate_render_primitives () |
unsigned | render_primitives () const |
unsigned | displacement_primitives () const |
virtual void | add_render_primitive (rPrimitive *, PrimitiveContext *) |
virtual void | add_clipped_render_primitive (rPrimitive *) |
virtual void | add_clipped_displacement_render_primitive (rPrimitive *) |
rPrimitive * | renderable_primitive (unsigned n) const |
rPrimitive * | displacement_primitive (unsigned n) const |
void | buildCircularTriangleList (unsigned from, unsigned to) |
virtual void | delete_render_primitives () |
virtual void | clear_render_primitives () |
virtual void | delete_light_context () |
void | print_info (const char *title) |
void | generateObjectTransforms () |
Public Member Functions inherited from DD::Image::Box3 | |
Box3 (float x, float y, float z) | |
Box3 (const Vector3 p) | |
Box3 (const Vector3 p1, const Vector3 p2) | |
const Vector3 & | min () const |
const Vector3 & | max () const |
float | x () const |
float | y () const |
float | n () const |
near, min z | |
float | r () const |
right, max x | |
float | t () const |
top, max y | |
float | f () const |
far, max z | |
float | w () const |
width | |
float | h () const |
height | |
float | d () const |
depth | |
Vector3 | center () const |
float | radius () const |
void | set (float x, float y, float z, float r, float t, float f) |
void | set (Vector3 p1, Vector3 p2) |
void | set (const Box3 &v) |
void | set_min (float x, float y, float z) |
void | set_max (float x, float y, float z) |
bool | empty () const |
void | clear () |
bool | inside (const Vector3 &p) const |
void | expand (const Box3 &v) |
void | expand (const Vector3 &p) |
void | intersect (const Box3 &v) |
void | transform (const Matrix4 &m) |
void | project (const Matrix4 &m, Box &bbox) const |
void | append (Hash &h) const |
void | print_info (const char *title=nullptr) const |
Public Attributes | |
CameraOp * | camera |
The shooting camera. | |
CameraOp::LensNFunc * | lens_func |
Camera projection function to use. | |
Axis | cam_vectors |
Camera PXYZ vectors in world-space. | |
std::vector< LightContext * > | lights |
Lights and their vectors. | |
std::vector< MatrixArray > | light_transforms |
Light transforms. | |
std::vector< Render * > | light_renderers |
Renderer attached to light. | |
Vector3 | ambient |
Ambient RGB color. | |
Protected Attributes | |
GeoOp * | geo_ |
GeometryList | object_list_ |
Geometry object list. More... | |
MotionVectorType | mb_type_ |
Motion vector type. | |
Scene * | mb_scene_ |
Next scene in time to motionblur to. | |
Quadtree< unsigned > * | quadtree_ |
Spatial subdivision tree. | |
std::vector< rPrimitive *, STL3DAllocator< rPrimitive * > > | render_primitives_ |
Primitives to render. | |
std::vector< rPrimitive *, STL3DAllocator< rPrimitive * > > | mb_render_primitives_ |
Motionblur primitives. | |
std::vector< rPrimitive *, STL3DAllocator< rPrimitive * > > | displacement_primitives_ |
Displacement primitives. | |
std::vector< MatrixArray > | object_transforms_ |
Rendering transforms. | |
MatrixArray | transforms_ |
const Format * | format_ |
Output render format. | |
int | projection_mode_ |
Point projection mode. | |
int | max_tessellation_ |
Threshold to limit recursive subdivision. | |
bool | transparency_ |
Transparency setting from renderer. | |
Box | screen_bbox_ |
Screen-projected bounding box. | |
ChannelSet | channels_ |
Intersected channels of all materials. | |
ChannelSet | shadow_channels_ |
shadow channels for all lights | |
TextureFilter * | filter_ |
bool | shadow_scene_ |
Is this a shadow scene? | |
float | _time |
Scene time. | |
std::map< Iop *, Box > | _materialBoxes |
2D bounding boxes for each material input | |
RegularGrid * | _grid |
std::vector< DrawableGeo > | _geoList |
Lock | _lock |
int | _id |
id for current rendering scene | |
Friends | |
class | GeoOp |
class | Render |
class | DepthMapRender |
We create a Scene structure for every rendering sample. This structure is a snapshot in time of all objects and transforms that are needed to render a certain camera view. To that end it's very important to have local copies of renderable primitives, their transforms, the taking camera's transform and all lights that affect this scene.
The Scene contains everything a renderer needs to generate an image.
Scene::Scene | ( | ) |
Constructor creates a single GeoInfo object.
References ambient, camera, channels_, DD::Image::Box::clear(), displacement_primitives_, DD::Image::eDisableMotionVector, format_, lens_func, DD::Image::CameraOp::LENS_PERSPECTIVE, light_renderers, light_transforms, lights, max_tessellation_, mb_scene_, mb_type_, object_transforms_, projection_mode_, quadtree_, render_primitives_, DD::Image::MatrixArray::reset(), screen_bbox_, DD::Image::Vector3::set(), shadow_scene_, and transforms_.
|
virtual |
Destructor. Delete and clear the primitives list.
References delete_light_context(), delete_render_primitives(), and quadtree_.
|
virtual |
Calculate the scene's bounding box which surrounds all of it's constituent objects. We keep two current, the entire scene's bbox in world space, and that same bbox projected into screen space.
References _materialBoxes, cam_vectors, camera, DD::Image::GeoInfoRenderState::castShadow, DD::Image::IopInfoOwner::channels(), channels_, clamp(), DD::Image::Box::clear(), DD::Image::Box::contains(), DD::Image::Iop::displacement_bound(), DD::Image::GeoInfo::display3d, DD::Image::Box3::empty(), DD::Image::Box3::expand(), DD::Image::Box3::f(), DD::Image::Primitive::face_vertices(), DD::Image::Primitive::faces(), DD::Image::IopInfoOwner::format(), DD::Image::Primitive::get_face_vertices(), DD::Image::Box::h(), DD::Image::IopInfoOwner::info(), DD::Image::Box3::inside(), DD::Image::CameraOp::LENS_ORTHOGRAPHIC, DD::Image::CameraOp::LENS_PERSPECTIVE, lights, DD::Image::GeoInfo::material, DD::Image::MatrixArray::matrix(), DD::Image::GeoInfo::matrix, MAX(), DD::Image::Box::merge(), MIN(), DD::Image::Box3::n(), object_list_, DD::Image::Box3::project(), projection_mode_, DD::Image::Box3::r(), DD::Image::GeoInfo::render_mode, DD::Image::Iop::request(), screen_bbox_, DD::Image::Box::set(), DD::Image::MatrixArray::set_object_matrix(), shadow_channels_, shadow_scene_, DD::Image::GeometryList::size(), DD::Image::Box3::t(), DD::Image::Box3::transform(), transforms_, DD::Image::GeoInfo::validate(), DD::Image::Op::validate(), DD::Image::Primitive::vertex_shader(), DD::Image::Box::w(), DD::Image::Box::x(), and DD::Image::Box::y().
Referenced by DD::Image::Render::_validate().
|
virtual |
Call request on all the materials.
References _materialBoxes, lights, DD::Image::Box3::n(), DD::Image::Op::node_disabled(), DD::Image::Box::r(), DD::Image::LightOp::request(), DD::Image::Box::t(), DD::Image::Box::x(), and DD::Image::Box::y().
Referenced by DD::Image::RenderScene::_request(), and DD::Image::Render::_request().
|
virtual |
Add a LightOp to the Scene's light list.
References light_renderers, light_transforms, and lights.
Referenced by add_lights().
|
virtual |
Add LightOps from a LightOp list.
References add_light().
|
virtual |
Clear the light list.
References delete_light_context(), light_renderers, light_transforms, and DD::Image::Box3::n().
Referenced by DD::Image::GeoOp::build_scene().
|
virtual |
Transform the Scene's lights into the scene's camera(eye) space. The renderer needs a local copy of the light transforms because the lights can be used in multiple scenes and it's cheaper to pre-transform them than to do it during rendering. This call is separate from generate_primitives() so that Materials can generate their shader previews. If the call is aborted early because of a user interrupt, return false so the calling function can abort too.
References DD::Image::Op::aborted(), DD::Image::Op::invalidate(), light_renderers, light_transforms, lights, DD::Image::Box3::n(), DD::Image::Op::node_disabled(), DD::Image::Op::parent(), DD::Image::Box3::r(), DD::Image::Iop::request(), DD::Image::MatrixArray::set_camera_matrix(), DD::Image::MatrixArray::set_format_matrix(), DD::Image::MatrixArray::set_object_matrix(), DD::Image::MatrixArray::set_projection_matrix(), and DD::Image::Op::validate().
Referenced by DD::Image::Render::evaluate_lights().
void Scene::copyInfo | ( | const Scene * | scene | ) |
< shadow channels for all lights
References ambient, camera, channels_, DD::Image::end(), format_, lens_func, light_renderers, light_transforms, lights, max_tessellation_, projection_mode_, screen_bbox_, shadow_channels_, transforms_, and transparency_.
|
virtual |
Create renderable primitives from the GeoInfo's primitive list. A primitive may not be directly renderable and may need tessellation(subdivision) into simpler primitives - a NURBS surface for example. Usually these primitives will create triangles, and this generally will only need to be done to support a scanline rendering algorithm as raytracing usually intersect tests directly on implicit surfaces.
Because this routine can be time intensive, we check frequently for user aborts so we can clean up and bail out quickly.
References DD::Image::Op::aborted(), DD::Image::GeoInfoRenderState::castShadow, delete_render_primitives(), mb_scene_, DD::Image::Box3::n(), object_list_, object_transforms_, DD::Image::GeoInfo::render_mode, shadow_scene_, DD::Image::GeometryList::size(), and DD::Image::GeoInfo::validate().
Referenced by DD::Image::DepthMapRender::generate_render_primitives(), and DD::Image::Render::generate_render_primitives().
|
virtual |
Add an unclipped primitive to the renderable list. This call calls clip() on the primitive. If you know the primitive is completely visible, use add_clipped_render_primitive() instead. This is usually called directly from a rPrimitive to either add a reference to a copy of itself, or to add a sub-primitive during tessellation. rPrimitives should not add a reference to themselves as the Scene deletes all its rPrimitive pointers after rendering.
The pointer 'p' is deleted after rendering is complete!****
References DD::Image::rPrimitive::add_to_render(), DD::Image::Iop::displacement_bound(), and DD::Image::GeoInfo::material.
Referenced by DD::Image::Point::tessellate(), DD::Image::Mesh::tessellateFace(), and DD::Image::ParticlesSprite::tessellateSprite().
|
virtual |
Add an already clipped primitive to the renderable list. This is usually called directly from a rPrimitive to either add a reference to a copy of itself, or to add a sub-primitive during tessellation. rPrimitives should not pass a reference to itself as the Scene deletes all its rPrimitive pointers after rendering.
The pointer 'p' is deleted after rendering is complete!****
References render_primitives_.
Referenced by DD::Image::rPoint::add_to_render().
|
virtual |
Delete all added renderable primitives and their associated allocations.
References displacement_primitives_, mb_render_primitives_, DD::Image::Box3::n(), quadtree_, and render_primitives_.
Referenced by DD::Image::Render::generate_render_primitives(), generate_render_primitives(), and ~Scene().
|
virtual |
|
protected |
Geometry object list.
Geometry GeoInfo instances:
Referenced by DD::Image::GeoOp::add_draw_geometry(), DD::Image::GeoOp::build_scene(), generate_render_primitives(), DD::Image::GeoOp::setupScene(), and validate().
|
protected |
Scene transforms(object, camera, projection, format)
Referenced by copyInfo(), DD::Image::DepthMapRender::generate_render_primitives(), DD::Image::Render::generate_render_primitives(), Scene(), and validate().
©2020 The Foundry Visionmongers, Ltd. All Rights Reserved. |