DD::Image::Scene Class Reference

Inherits DD::Image::Box3.

List of all members.

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
GeoOpgeo () const
GeometryListobject_list ()
std::vector< DrawableGeo > * geo_list ()
unsigned objects () const
GeoInfoobject (unsigned n=0)
int sceneId () const
const Formatformat () const
int projection_mode () const
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)
bool is_shadow_scene () const
bool transparency () const
void transparency (bool v)
bool raycasting () const
void raycasting (bool v)
const DisplacementCoefficients & displacementCoefficients () const
void displacementCoefficients (const DisplacementCoefficients &m)
virtual void add_light (LightOp *)
virtual void add_lights (const std::vector< LightOp * > *light_list)
virtual void clear_lights ()
virtual bool evaluate_lights ()
Filterfilter () const
void filter (Filter *v)
void copyInfo (const Scene *scene)
const Quadtree< unsigned > * quadtree () const
void buildGrid ()
bool testRayIntersection (Ray &ray, const VertexContext *vtx=NULL, const Iop *material=NULL)
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
virtual void delete_render_primitives ()
virtual void delete_light_context ()
void print_info (const char *title)

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
*, STLAllocator< rPrimitive * > > 
render_primitives_
 Primitives to render.
std::vector< rPrimitive
*, STLAllocator< rPrimitive * > > 
mb_render_primitives_
 Motionblur primitives.
std::vector< rPrimitive
*, STLAllocator< 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.
bool raycasting_
 Enable ray-tracing features.
DisplacementCoefficients displacementCoefficients_
Box screen_bbox_
 Screen-projected bounding box.
ChannelSet channels_
 Intersected channels of all materials.
ChannelSet shadow_channels_
 shadow channels for all lights
Filterfilter_
bool shadow_scene_
 Is this a shadow scene?
RegularGrid * _grid
std::vector< DrawableGeo > _geoList
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_render_primitives(), and quadtree_.


Member Function Documentation

void Scene::request ( const ChannelSet channels,
int  count 
) [virtual]

void Scene::add_light ( LightOp l  )  [virtual]

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

Add LightOps from a LightOp list.

References add_light().

void Scene::clear_lights (  )  [virtual]

Clear the light list.

References light_renderers, and light_transforms.

Referenced by DD::Image::GeoOp::build_scene().

bool Scene::evaluate_lights (  )  [virtual]

void Scene::copyInfo ( const Scene scene  ) 

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.

TODO: How do we communicate what kind of renderer is being supported? There's too much hardcoded scanline stuff right now. Renderers will need to test a primitive for compatibility and call the tessellation routines if not. All renderers will need to support at least the Triangle primitive I think. Perhaps this generate_primitives call should go back into the renderer's engine() call(into another procedure called from engine() that is) so that the renderer can do primitive typing tests directly.

References DD::Image::Op::aborted(), delete_render_primitives(), format_, DD::Image::PrimitiveContext::geoinfo_, DD::Image::PrimitiveContext::indices_, DD::Image::PrimitiveContext::mb_geoinfo_, mb_scene_, DD::Image::PrimitiveContext::mb_transforms_, object_list_, object_transforms_, objects(), DD::Image::GeoInfo::out_id(), DD::Image::GeoInfo::points(), DD::Image::PrimitiveContext::primitive_, DD::Image::GeoInfo::primitive_array(), DD::Image::GeoInfo::primitives(), quadtree_, DD::Image::Box::r(), DD::Image::GeoInfo::render_mode, DD::Image::GeometryList::size(), DD::Image::Box::t(), DD::Image::Primitive::tessellate(), DD::Image::PrimitiveContext::transforms_, DD::Image::GeoInfo::validate(), DD::Image::Box::x(), and DD::Image::Box::y().

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_displacement_render(), DD::Image::rPrimitive::add_to_render(), DD::Image::Iop::displacement_bound(), DD::Image::PrimitiveContext::geoinfo(), and DD::Image::GeoInfo::material.

Referenced by DD::Image::Triangle::tessellate(), DD::Image::Polygon::tessellate(), DD::Image::Point::tessellate(), DD::Image::ParticlesSprite::tessellate(), DD::Image::Particles::tessellate(), and DD::Image::Mesh::tessellate().

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 DD::Image::Quadtree< T >::add(), DD::Image::Quadtree< T >::add_to_root(), DD::Image::Quadtree< T >::bbox(), DD::Image::Box2f::max(), DD::Image::Box2f::min(), quadtree_, and render_primitives_.

Referenced by DD::Image::rPoint::add_to_render().

void Scene::delete_render_primitives (  )  [virtual]

Delete all added renderable primitives and their associated allocations.

References displacement_primitives_, mb_render_primitives_, quadtree_, and render_primitives_.

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


Member Data Documentation

Scene transforms(object, camera, projection, format)

Referenced by copyInfo(), request(), and Scene().



©2009 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk