Cortex  10.0.0-a4
Public Member Functions | Friends | List of all members
IECoreRI::Renderer Class Reference

#include <Renderer.h>

+ Inheritance diagram for IECoreRI::Renderer:

Public Member Functions

 Renderer ()
 
 Renderer (const std::string &name)
 
 IE_CORE_DECLARERUNTIMETYPEDEXTENSION (IECoreRI::Renderer, RendererTypeId, IECore::Renderer)
 
void setOption (const std::string &name, IECore::ConstDataPtr value) override
 
IECore::ConstDataPtr getOption (const std::string &name) const override
 
void camera (const std::string &name, const IECore::CompoundDataMap &parameters) override
 
void display (const std::string &name, const std::string &type, const std::string &data, const IECore::CompoundDataMap &parameters) override
 
void worldBegin () override
 
void worldEnd () override
 Finishes the world block.
 
void transformBegin () override
 
void transformEnd () override
 Returns to the transform state saved by the last transformBegin() call.
 
void setTransform (const Imath::M44f &m) override
 Sets the current transform.
 
void setTransform (const std::string &coordinateSystem) override
 
Imath::M44f getTransform () const override
 Returns the current transform.
 
Imath::M44f getTransform (const std::string &coordinateSystem) const override
 Returns the transform associated with the named coordinate system.
 
void concatTransform (const Imath::M44f &m) override
 Concatenates the specified transform onto the current transform.
 
void coordinateSystem (const std::string &name) override
 
void attributeBegin () override
 
void attributeEnd () override
 Return to the attribute state saved by the last call to attributeBegin().
 
void setAttribute (const std::string &name, IECore::ConstDataPtr value) override
 
IECore::ConstDataPtr getAttribute (const std::string &name) const override
 
void shader (const std::string &type, const std::string &name, const IECore::CompoundDataMap &parameters) override
 
void light (const std::string &name, const std::string &handle, const IECore::CompoundDataMap &parameters) override
 
void illuminate (const std::string &lightHandle, bool on) override
 Turns the specified light on or off for the current attribute state.
 
void motionBegin (const std::set< float > &times) override
 
void motionEnd () override
 
void points (size_t numPoints, const IECore::PrimitiveVariableMap &primVars) override
 Renders a set of points.
 
void disk (float radius, float z, float thetaMax, const IECore::PrimitiveVariableMap &primVars) override
 
void curves (const IECore::CubicBasisf &basis, bool periodic, IECore::ConstIntVectorDataPtr numVertices, const IECore::PrimitiveVariableMap &primVars) override
 
void text (const std::string &font, const std::string &text, float kerning=1.0f, const IECore::PrimitiveVariableMap &primVars=IECore::PrimitiveVariableMap()) override
 Renders some text.
 
void sphere (float radius, float zMin, float zMax, float thetaMax, const IECore::PrimitiveVariableMap &primVars) override
 
void image (const Imath::Box2i &dataWindow, const Imath::Box2i &displayWindow, const IECore::PrimitiveVariableMap &primVars) override
 
void mesh (IECore::ConstIntVectorDataPtr vertsPerFace, IECore::ConstIntVectorDataPtr vertIds, const std::string &interpolation, const IECore::PrimitiveVariableMap &primVars) override
 
void nurbs (int uOrder, IECore::ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, IECore::ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const IECore::PrimitiveVariableMap &primVars) override
 
void patchMesh (const IECore::CubicBasisf &uBasis, const IECore::CubicBasisf &vBasis, int nu, bool uPeriodic, int nv, bool vPeriodic, const IECore::PrimitiveVariableMap &primVars) override
 Render a patch mesh.
 
void geometry (const std::string &type, const IECore::CompoundDataMap &topology, const IECore::PrimitiveVariableMap &primVars) override
 Generic call for specifying renderer specify geometry types.
 
void procedural (IECore::Renderer::ProceduralPtr proc) override
 
void instanceBegin (const std::string &name, const IECore::CompoundDataMap &parameters) override
 Starts the description of a portion of a scene to be instanced.
 
void instanceEnd () override
 Ends the description of an instance.
 
void instance (const std::string &name) override
 
IECore::DataPtr command (const std::string &name, const IECore::CompoundDataMap &parameters) override
 
void editBegin (const std::string &name, const IECore::CompoundDataMap &parameters) override
 
void editEnd () override
 Ends the current scene edit.
 
- Public Member Functions inherited from IECore::Renderer
 IE_CORE_DECLARERUNTIMETYPED (Renderer, RunTimeTyped)
 
 IE_CORE_DECLAREPTR (Procedural)
 
 IE_CORE_DECLAREPTR (ExternalProcedural)
 
virtual void procedural (ProceduralPtr proc)=0
 Renders a piece of procedural geometry.
 
virtual void setOption (const std::string &name, ConstDataPtr value)=0
 Set an option. Must not be called after worldBegin().
 
virtual void setAttribute (const std::string &name, ConstDataPtr value)=0
 
virtual void curves (const CubicBasisf &basis, bool periodic, ConstIntVectorDataPtr numVertices, const IECore::PrimitiveVariableMap &primVars)=0
 Renders a set of curves.
 
virtual void mesh (ConstIntVectorDataPtr vertsPerFace, ConstIntVectorDataPtr vertIds, const std::string &interpolation, const PrimitiveVariableMap &primVars)=0
 
virtual void nurbs (int uOrder, ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const PrimitiveVariableMap &primVars)=0
 Renders a nurbs surface.
 
- Public Member Functions inherited from IECore::RunTimeTyped
 IE_CORE_DECLAREMEMBERPTR (RunTimeTyped)
 
virtual TypeId typeId () const
 
virtual const char * typeName () const
 
virtual bool isInstanceOf (TypeId typeId) const
 
virtual bool isInstanceOf (const char *typeName) const
 
- Public Member Functions inherited from IECore::RefCounted
 IE_CORE_DECLAREMEMBERPTR (RefCounted)
 
void addRef () const
 Add a reference to the current object.
 
void removeRef () const
 Remove a reference from the current object.
 
RefCount refCount () const
 Returns the current reference count.
 

Friends

class RendererImplementation
 

Additional Inherited Members

- Public Types inherited from IECore::RunTimeTyped
typedef RefCounted BaseClass
 A typedef for the class this class derives from. All RunTimeTyped classes define this typedef.
 
- Public Types inherited from IECore::RefCounted
typedef size_t RefCount
 
- Static Public Member Functions inherited from IECore::RunTimeTyped
static TypeId staticTypeId ()
 Returns the TypeId for this class, without needing an instance.
 
static const char * staticTypeName ()
 Returns the type name for this class, without needing an instance.
 
static TypeId baseTypeId ()
 
static const char * baseTypeName ()
 
static bool inheritsFrom (TypeId typeId)
 Returns true if this class inherits from the specified type.
 
static bool inheritsFrom (const char *typeName)
 Returns true if this class inherits from the specified type.
 
static bool inheritsFrom (TypeId type, TypeId baseType)
 Returns true if type inherits from baseType.
 
static bool inheritsFrom (const char *typeName, const char *baseTypeName)
 Returns true if typeName inherits from baseTypeName.
 
static TypeId baseTypeId (TypeId typeId)
 Returns the base type of the given type, or InvalidTypeId if no such base exists.
 
static const std::vector< TypeId > & baseTypeIds (TypeId typeId)
 
static const std::set< TypeId > & derivedTypeIds (TypeId typeId)
 
static TypeId typeIdFromTypeName (const char *typeName)
 
static const char * typeNameFromTypeId (TypeId typeId)
 
static void registerType (TypeId derivedTypeId, const char *derivedTypeName, TypeId baseTypeId)
 Allows external modules to register their own type ids.
 
- Protected Types inherited from IECore::RunTimeTyped
typedef std::map< TypeId, TypeIdBaseTypeRegistryMap
 
typedef std::map< TypeId, std::vector< TypeId > > BaseTypesRegistryMap
 
typedef std::map< TypeId, std::set< TypeId > > DerivedTypesRegistryMap
 
typedef tbb::spin_rw_mutex Mutex
 
typedef std::map< TypeId, std::string > TypeIdsToTypeNamesMap
 
typedef std::map< std::string, TypeIdTypeNamesToTypeIdsMap
 
- Static Protected Member Functions inherited from IECore::RunTimeTyped
static BaseTypeRegistryMap & baseTypeRegistry ()
 
static DerivedTypesRegistryMap & derivedTypesRegistry ()
 
static BaseTypesRegistryMap & completeBaseTypesRegistry ()
 
static DerivedTypesRegistryMap & completeDerivedTypesRegistry ()
 
static void derivedTypeIdsWalk (TypeId typeId, std::set< TypeId > &)
 
static TypeIdsToTypeNamesMap & typeIdsToTypeNames ()
 
static TypeNamesToTypeIdsMap & typeNamesToTypeIds ()
 
- Static Protected Attributes inherited from IECore::RunTimeTyped
static Mutex g_baseTypeIdsMutex
 
static Mutex g_derivedTypeIdsMutex
 

Detailed Description

An IECore::Renderer subclass which renders through the renderman interface.

Threading:
Scenes should be described to this class from a single thread. However, when rendering live (with a Renderer constructed with Renderer( "" )), procedurals may be expanded concurrently in multiple threads, and in this case each procedural will see a separate Renderer instance to provide thread safety.

Constructor & Destructor Documentation

IECoreRI::Renderer::Renderer ( )

Creates a Renderer that will always render to the RiContext which is active at the time a given function is called.

IECoreRI::Renderer::Renderer ( const std::string &  name)

Creates a Renderer that will create a new RiContext with a call to RiBegin( name.c_str() ) and will subsequently always render to that context. If the empty string is passed then RiBegin( 0 ) is called to actually render the scene rather than create a rib.

Member Function Documentation

void IECoreRI::Renderer::attributeBegin ( )
overridevirtual

Push a new attribute state onto the attribute stack. This is identical to the current state, but subsequent calls to setAttribute() will be discarded by the matching attributeEnd().

Implements IECore::Renderer.

void IECoreRI::Renderer::camera ( const std::string &  name,
const IECore::CompoundDataMap parameters 
)
overridevirtual
Standard parameters supported :
  • "resolution"
  • "screenWindow"
  • "cropWindow"
  • "projection"
  • "projection:fov"
  • "clippingPlanes"
  • "shutter"
Implementation specific parameters supported :
\li <b>"projection:*"</b><br>
All parameters matching this naming convention are passed to the RiProjection call.

Implements IECore::Renderer.

IECore::DataPtr IECoreRI::Renderer::command ( const std::string &  name,
const IECore::CompoundDataMap parameters 
)
overridevirtual

Supports the following commands :

"clippingPlane" Makes an RiClippingPlane. This implementation is currently limited to making clipping planes only after all cameras have been specified.

"ri:readArchive"

Expects a single StringData parameter called "name", and calls RiReadArchive with it.

Todo:
Make a VisibleRenderable subclass to encapsulate a call to this.

"ri:archiveRecord" Makes a call to RiArchiveRecord(). Expects StringData parameters called "type" and "record".

Implements IECore::Renderer.

void IECoreRI::Renderer::coordinateSystem ( const std::string &  name)
overridevirtual

Creates a named coordinate system from the current transform. Coordinate systems are scoped by attributeBegin/attributeEnd blocks.

Implements IECore::Renderer.

void IECoreRI::Renderer::disk ( float  radius,
float  z,
float  thetaMax,
const IECore::PrimitiveVariableMap primVars 
)
overridevirtual

Renders a disk of the specified radius on the xy plane, at the specified z value. If the "rightHandedOrientation" attribute is true then the normal faces down positive z, otherwise it faces down negative z.

Implements IECore::Renderer.

void IECoreRI::Renderer::display ( const std::string &  name,
const std::string &  type,
const std::string &  data,
const IECore::CompoundDataMap parameters 
)
overridevirtual

Specifies an image to be output from the renderer. In the case of file outputs name specified the filename. type specifies the type of output to create and data specifies the data to be output, for instance "rgba". parameters provides an implementation specific set of parameters to control other aspects of the image created. It is only valid to call this before worldBegin.

Implements IECore::Renderer.

void IECoreRI::Renderer::editBegin ( const std::string &  editType,
const IECore::CompoundDataMap parameters 
)
overridevirtual

Starts a new scene edit of the specified type. The standard functions above for declaring the scene can then be used to perform the edit.

Todo:
Better define the semantics of this function as we implement it for different renderers.

Implements IECore::Renderer.

IECore::ConstDataPtr IECoreRI::Renderer::getAttribute ( const std::string &  name) const
overridevirtual
Currently supported attributes :
  • "doubleSided"
  • "rightHandedOrientation"
  • "name"
  • "user:*"
  • "ri:shadingRate"
  • "ri:matte"
  • "ri:textureCoordinates"
  • "ri:*:*"
    Supports all attributes for which the RxAttribute query works.

Implements IECore::Renderer.

IECore::ConstDataPtr IECoreRI::Renderer::getOption ( const std::string &  name) const
overridevirtual

Currently supported options :

"camera:resolution" V2iData "camera:shutter" "shutter" V2fData() "user:*" "ri:*" Queries of this form use the Rx API and therefore only work for options supported by that API.

Implements IECore::Renderer.

void IECoreRI::Renderer::image ( const Imath::Box2i &  dataWindow,
const Imath::Box2i &  displayWindow,
const IECore::PrimitiveVariableMap primVars 
)
overridevirtual

Renders an image.

Todo:
Clarify the intended use of dataWindow and displayWindow.

Implements IECore::Renderer.

void IECoreRI::Renderer::instance ( const std::string &  name)
overridevirtual

Instantiates a previously described instance at the current transform position, and using the current attribute state.

Implements IECore::Renderer.

void IECoreRI::Renderer::light ( const std::string &  name,
const std::string &  handle,
const IECore::CompoundDataMap parameters 
)
overridevirtual

By default, calls RiLightSource If the "ri:areaLight" parameter is true, calls RiAreaLightSource instead

Implements IECore::Renderer.

void IECoreRI::Renderer::mesh ( IECore::ConstIntVectorDataPtr  vertsPerFace,
IECore::ConstIntVectorDataPtr  vertIds,
const std::string &  interpolation,
const IECore::PrimitiveVariableMap primVars 
)
override

Renders interpolation types of "linear" as RiPointsGeneralPolygons and "catmullClark" as RiSubdivisionMesh. Supports an optional "tags" primitive variable of type CompoundData and interpolation Constant, which is used to specify tags for the RiSubdivisionMesh call. This should contain the following children :

    StringVectorData "names"
    IntVectorData "nArgs"
    FloatVectorData "floats"
    IntVectorData "integers"
Todo:
Consider how we might standardise a means of storing tags explicitly on the mesh rather than as primitive variables.
void IECoreRI::Renderer::motionBegin ( const std::set< float > &  times)
overridevirtual

Starts a new motion block. You should then make times.size() calls to one of the primitive or transform functions to specify the motion for the block.

Implements IECore::Renderer.

void IECoreRI::Renderer::motionEnd ( )
overridevirtual

Ends a motion block. Should be called when times.size() calls to an appropriate primitive or transform function have been made following a motionBegin() call.

Implements IECore::Renderer.

void IECoreRI::Renderer::procedural ( IECore::Renderer::ProceduralPtr  proc)
override

ExternalProcedurals are treated as DelayedReadArchives if their filename ends with ".rib" and as DynamicLoad procedurals otherwise. Because RenderMan has very poor support for passing parameters to DynamicLoad procedurals (you can only pass a single string), the arbitrary parameters of the ExternalProcedural are treated as follows :

  • If an "ri:data" StringData parameter exists, it is passed verbatim to the procedural. This allows procedurals which require data in a specific format to be supported.
  • All other parameters are serialised in a command line "--name value" style and concatenated. This allows the convenience of arbitrary typed parameters provided that the procedural itself uses a command line style parser.
void IECoreRI::Renderer::setAttribute ( const std::string &  name,
IECore::ConstDataPtr  value 
)
override
Standard attributes supported :
  • "color"
    Mapped to an RiColor call.
  • "opacity"
    Mapped to an RiOpacity call.
  • "doubleSided"
    Mapped to an RiSides call.
  • "rightHandedOrientation"
    Implemented via RiOrientation.
  • "name"
    Mapped to an RiAttribute "identifier" "name" call.
  • "user:*"
    Implementation specific attributes :
  • "ri:*:*" Data
    Passed to an RiAttribute call.
  • "ri:*" CompoundData
    Passed to an RiAttribute call. This allows multiple attribute values to be specified in one setAttribute() call.
  • "ri:shadingRate" FloatData
    Passed to RiShadingRate.
  • "ri:matte" BoolData
    Passed to RiMatte.
  • "ri:geometricApproximation:motionFactor" and ri:geometricApproximation:focusFactor" FloatData
    Passed to RiGeometricApproximation.
  • "ri:subsurface" CompoundData
    3delight gets upset if subsurface attributes aren't all specified as a group and in the right order. This is a problem as we can't specify order in the AttributeState or Group objects (see todo items there). We therefore support their specification as a single CompoundData, and ensure that they are specified in an appropriate order.
    Todo:
    Do the todo items in IECore::Group and IECore::AttributeState and deprecate the ri:subsurface call.
  • "ri:detail" Box3fData
    Passed to RiDetail.
  • "ri:detailRange" FloatVectorData
    Passed to RiDetailRange. The FloatVectorData must have length 4.
    Todo:
    Consider whether or not we should have a standard LOD mechanism defined in IECore.
  • "ri:textureCoordinates" FloatVectorData( [ s1, t1, s2, t2, s3, t3, s4, t4 ] )
    Passed to RiTextureCoordinates.
  • "ri:automaticInstancing" BoolData
    When this is true, all primitives are rendered as instances, and if a previously rendered primitive is encountered, the instance will simply be reused.
void IECoreRI::Renderer::setOption ( const std::string &  name,
IECore::ConstDataPtr  value 
)
override
Standard options supported :
  • "searchPath:font"
Implementation specific options :
  • "ri:searchpath:shader" StringData()
    A colon separated list of paths to search for shaders on.
  • "ri:pixelSamples" V2iData()
    Passed to an RiPixelSamples call.
  • "ri:hider" StringData()
  • "ri:hider:*" StringData() Passed to an RiHider call.
  • "ri:frame" IntData() Specifies the frame number for RiFrameBegin. If not specified, then no frame block will be output.
  • "ri:*:*"
    Passed to an RiOption call.
void IECoreRI::Renderer::setTransform ( const std::string &  coordinateSystem)
overridevirtual

Sets the current transform to a coordinate system previously created with a call to coordinateSystem().

Implements IECore::Renderer.

void IECoreRI::Renderer::shader ( const std::string &  type,
const std::string &  name,
const IECore::CompoundDataMap parameters 
)
overridevirtual

If type is "surface" or "ri:surface" then calls RiSurfaceV. If type is "displacement" or "ri:displacement" then calls RiDisplacementV. If type is "atmosphere" or "ri:atmosphere" then calls RiDisplacementV. If type is "interior" or "ri:interior" then calls RiInteriorV. If type is "exterior" or "ri:exterior" then calls RiExteriorV. If type is "deformation" or "ri:deformation" then calls RiDeformationV. If type is "shader" or "ri:shader" then calls RiShader. In this case you must specify a handle as a StringData parameter named "__handle".

Implements IECore::Renderer.

void IECoreRI::Renderer::sphere ( float  radius,
float  zMin,
float  zMax,
float  thetaMax,
const IECore::PrimitiveVariableMap primVars 
)
overridevirtual

Renders a sphere of the specified radius. zMin and zMax are measured as a proportion of the radius - so no matter what the radius, the default values will always give a full sphere. If the "rightHandedOrientation" attribute is true then the normals point outwards, otherwise they point inwards.

Todo:
Give this the default values it talks about.

Implements IECore::Renderer.

void IECoreRI::Renderer::transformBegin ( )
overridevirtual

Push a new transform state identical to the current one. Modifications can then be made locally before calling transformEnd() to return to the previous transform state.

Implements IECore::Renderer.

void IECoreRI::Renderer::worldBegin ( )
overridevirtual

Starts the world block and resets the current transform to the identity.

Implements IECore::Renderer.


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