DD::Image::rPrimitive Class Referenceabstract

This is the base class of anything renderable! We use this class to handle renderable objects that can have simple geometry such as triangles, spheres, etc. More...

Inherits DD::Image::Box3.

Inherited by DD::Image::rPoint, and DD::Image::rTriangle.

Public Types

enum  rPrimitiveType { eUnknownRPrimitive, eRTriangle, eRPoint }
 

Public Member Functions

virtual const char * Class ()
 
 rPrimitive (const GeoInfo *info, const Primitive *p)
 
 rPrimitive (const rPrimitive &)
 
virtual ~rPrimitive ()
 
virtual rPrimitiveduplicate () const
 
const GeoInfogeoinfo () const
 
const Primitiveparent () const
 
bool cast_shadows () const
 
bool receive_shadows () const
 
virtual bool add_to_render (Scene *, PrimitiveContext *)=0
 
virtual bool add_to_displacement_render (Scene *, PrimitiveContext *)
 
virtual bool intersect (float x, float y) const =0
 
virtual bool intersect (float x, float y, float *dist) const =0
 
virtual bool intersect_dist_squared (float x, float y, float *dist_squared) const =0
 
virtual bool intersect_scanline (float y, int &X, int &R, VArray &v0, VArray &du, VArray &dv) const =0
 
virtual float trace (Scene *)=0
 
virtual float distance (float x, float y) const =0
 
virtual float distance_squared (float x, float y) const =0
 
virtual void subdivide (std::vector< rPrimitive * > &primitives, SubdivisionContext *stx)
 
virtual rPrimitiveType getPrimitiveType () const
 
void * operator new (size_t size)
 
void operator delete (void *mem)
 
void * operator new[] (size_t size)
 
void operator delete[] (void *mem)
 
- 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
 

Protected Attributes

const GeoInfogeoinfo_
 Parent object.
 
const Primitiveparent_
 What primitive generated us.
 

Detailed Description

This is the base class of anything renderable! We use this class to handle renderable objects that can have simple geometry such as triangles, spheres, etc.

Rendering primitive parent class. These objects are usually created by a 'Primitive' subclass when rendering is done. The primary difference between two classes is that the 'Primitive' always remains in scene space, or world space, and a rPrimitive is allocated per render sample and transformed into clip and screen space. These objects are destroyed after rendering is complete.

Constructor & Destructor Documentation

rPrimitive::rPrimitive ( const rPrimitive b)

Copy constructor.

rPrimitive::~rPrimitive ( )
virtual

Base destructor does nothing.

Member Function Documentation

bool DD::Image::rPrimitive::add_to_render ( Scene ,
PrimitiveContext  
)
pure virtual

Clip this primitive, transform it to screen space, and add it to the list of primitives to render in the Scene.

The return value is true if this was added to the list. Originally this was used to indicate clipping. However implementations are now allowed to create other rPrimitive instances and add them to the list (for clipping into multiple pieces). If false is returned, this is immediately deleted. If true is returned it is assumed that destroying the Scene list will delete the primitive.

Implemented in DD::Image::rTriangle, and DD::Image::rPoint.

Referenced by DD::Image::Scene::add_render_primitive().

virtual rPrimitiveType DD::Image::rPrimitive::getPrimitiveType ( ) const
inlinevirtual

Only for internal Nuke use



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