Nuke binary plugins 15.1.4
 
Loading...
Searching...
No Matches
DD::Image::Scene Class Reference

#include <Scene.h>

Inheritance diagram for DD::Image::Scene:
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
 
Scenemb_scene () const
 
void geo (GeoOp *geo)
 
GeoOpgeo () const
 
const GeometryListobject_list () const
 
GeometryListobject_list ()
 
std::vector< DrawableGeo > * geo_list ()
 
unsigned objects () const
 
GeoInfoobject (unsigned n=0)
 
int sceneId () const
 
void time (float t)
 
float time () const
 
void format (const Format *f)
 
const Formatformat () const
 
void projection_mode (int p)
 
int projection_mode () const
 
void max_tessellation (int t)
 
int max_tessellation () const
 
const Boxscreen_bbox () const
 
const ChannelSetchannels () const
 
const ChannelSetshadow_channels () const
 
MatrixArraytransforms ()
 
const Matrix4matrix (int n)
 
const Matrix4inverse_matrix (int n)
 
const Matrix4camera_matrix () const
 
const Matrix4projection_matrix () const
 
const Matrix4format_matrix () const
 
MatrixArrayobject_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 ()
 
TextureFilterfilter () 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 *)
 
rPrimitiverenderable_primitive (unsigned n) const
 
rPrimitivedisplacement_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 Vector3min () const
 
const Vector3max () 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

CameraOpcamera
 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< MatrixArraylight_transforms
 Light transforms.
 
std::vector< Render * > light_renderers
 Renderer attached to light.
 
Vector3 ambient
 Ambient RGB color.
 

Protected Attributes

GeoOpgeo_
 
GeometryList object_list_
 Geometry object list.
 
MotionVectorType mb_type_
 Motion vector type.
 
Scenemb_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< MatrixArrayobject_transforms_
 Rendering transforms.
 
MatrixArray transforms_
 
const Formatformat_
 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
 
TextureFilterfilter_
 
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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Scene()

◆ ~Scene()

Scene::~Scene ( )
virtual

Destructor. Delete and clear the primitives list.

References delete_light_context(), delete_render_primitives(), and quadtree_.

Member Function Documentation

◆ validate()

void Scene::validate ( int  sample = 0)
virtual

◆ request()

◆ add_light()

void Scene::add_light ( LightOp l)
virtual

Add a LightOp to the Scene's light list.

References light_renderers, light_transforms, and lights.

Referenced by add_lights().

◆ add_lights()

void Scene::add_lights ( const std::vector< LightOp * > *  light_list)
virtual

Add LightOps from a LightOp list.

References add_light().

◆ clear_lights()

void Scene::clear_lights ( )
virtual

◆ evaluate_lights()

bool Scene::evaluate_lights ( )
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().

◆ copyInfo()

◆ generate_render_primitives()

bool Scene::generate_render_primitives ( )
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::Render::generate_render_primitives(), and DD::Image::DepthMapRender::generate_render_primitives().

◆ add_render_primitive()

void Scene::add_render_primitive ( rPrimitive p,
PrimitiveContext ptx 
)
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().

◆ add_clipped_render_primitive()

void Scene::add_clipped_render_primitive ( rPrimitive p)
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().

◆ delete_render_primitives()

void Scene::delete_render_primitives ( )
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().

◆ delete_light_context()

void Scene::delete_light_context ( )
virtual

Delete all allocated light context.

References lights.

Referenced by clear_lights(), and ~Scene().

Member Data Documentation

◆ object_list_

GeometryList DD::Image::Scene::object_list_
protected

◆ transforms_

MatrixArray DD::Image::Scene::transforms_
protected


©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com