Cortex 6.0.0
Public Member Functions | Public Attributes

IECore::Primitive Class Reference

#include <Primitive.h>

Inheritance diagram for IECore::Primitive:

List of all members.

Public Member Functions

 IE_CORE_DECLAREABSTRACTOBJECT (Primitive, VisibleRenderable)
template<typename T >
T * variableData (const std::string &name, PrimitiveVariable::Interpolation requiredInterpolation=PrimitiveVariable::Invalid)
template<typename T >
const T * variableData (const std::string &name, PrimitiveVariable::Interpolation requiredInterpolation=PrimitiveVariable::Invalid) const
bool isPrimitiveVariableValid (const PrimitiveVariable &pv) const
 Returns true if the given primitive variable has the correct size for its interpolation type.
bool arePrimitiveVariablesValid () const
 Returns true if all primitive variables have the correct size for their interpolation type.
PrimitiveVariable::Interpolation inferInterpolation (size_t numElements) const
PrimitiveVariable::Interpolation inferInterpolation (const Data *data) const
virtual Imath::Box3f bound () const
virtual size_t variableSize (PrimitiveVariable::Interpolation interpolation) const =0

Public Attributes

PrimitiveVariableMap variables
 Variables a stored as a public map for easy manipulation.

Detailed Description

The Primitive class defines an abstract base for Renderable primitives. Primitives are expected to be objects which are visible in final rendered images rather than Renderables which just change some part of the renderer state (such as an attribute). Primitives may hold "primitive variables" which are simply values which vary over the surface of the Primitive and can be used by the renderer to define various aspects of its appearance.

Todo:
Validation of variableSizes before rendering.

Member Function Documentation

virtual Imath::Box3f IECore::Primitive::bound ( ) const [virtual]

Implemented to return a box containing all the points in the variable "P" if it exists.

Implements IECore::VisibleRenderable.

Reimplemented in IECore::ImagePrimitive, and IECore::SpherePrimitive.

PrimitiveVariable::Interpolation IECore::Primitive::inferInterpolation ( const Data data) const

Convenience function which finds the size of data and calls the above method.

PrimitiveVariable::Interpolation IECore::Primitive::inferInterpolation ( size_t  numElements) const

Guesses a suitable interpolation type for a PrimitiveVariable containing the specified number of data elements. Returns PrimitiveVariable::Invalid if no such interpolation exists. Note that for a given size multiple interpolation types may well be valid, so this method may not always give the desired results. In the case of multiple suitable types, interpolations are given the following priority (highest first) :

Constant Uniform Vertex Varying FaceVarying

template<typename T >
T* IECore::Primitive::variableData ( const std::string &  name,
PrimitiveVariable::Interpolation  requiredInterpolation = PrimitiveVariable::Invalid 
)

Convenience function to find name in variables, and returning a runTimeCast to the requested type. If requiredInterpolation is specified then 0 is returned if the interpolation doesn't match.

virtual size_t IECore::Primitive::variableSize ( PrimitiveVariable::Interpolation  interpolation) const [pure virtual]

Returns the number of values a piece of data must provide for the given interpolation type. Must be implemented in all derived classes.

Implemented in IECore::CurvesPrimitive, IECore::ImagePrimitive, IECore::MeshPrimitive, IECore::NURBSPrimitive, IECore::PatchMeshPrimitive, IECore::PointsPrimitive, and IECore::SpherePrimitive.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends