HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BRAY::ScenePtr Class Reference

#include <BRAY_Interface.h>

Public Member Functions

 ScenePtr ()=default
 
 ~ScenePtr ()
 
bool isKarmaCPU () const
 
bool isKarmaXPU () const
 
void startEdits (BRAY::RendererPtr &renderer)
 Start edits/loading of the scene. More...
 
bool isValid () const
 Test validity. More...
 
bool threadSafe () const
 Test whether the scene is thread-safe. More...
 
bool nestedInstancing () const
 Test whether the renderer supports nested instancing. More...
 
void updateObject (const ObjectPtr &ptr, BRAY_EventType event)
 Update an object in the scene. More...
 
void updateLight (const LightPtr &ptr, BRAY_EventType event)
 Update light object in the scene. More...
 
void updateCamera (const CameraPtr &ptr, BRAY_EventType event)
 Update camera object in the scene. More...
 
void updateMaterial (const MaterialPtr &ptr, BRAY_EventType event)
 Update material object in the scene. More...
 
void updateCoordSys (const CoordSysPtr &ptr, BRAY_EventType event)
 Update coord sys object. More...
 
void saveCheckpointASAP ()
 Forcibly save checkpoint as soon as possible (if checkpointing is enabled) More...
 
void setCameraRayMask (BRAY_RayVisibility mask)
 
void setShadowRayMask (BRAY_RayVisibility mask)
 
void forceRedice ()
 
void commitOptions ()
 After changing any options, must commit prior to rendering. More...
 
OptionSet planeProperties ()
 Grab a copy of the current image plane properties. More...
 
const OptionSet constPlaneProperties () const
 
OptionSet defaultProperties (BRAY_PropertyType type) const
 
LightPtr createLight (const UT_StringHolder &name)
 Create a light. More...
 
LightPtr createDetachedLight (const UT_StringHolder &name)
 Create a detached light, which is not added to the scene. More...
 
CameraPtr createCamera (const UT_StringHolder &name)
 Create a camera. More...
 
CoordSysPtr createCoordSys (const UT_StringHolder &name)
 Create a coordinate system. More...
 
MaterialPtr createMaterial (const UT_StringHolder &name)
 Create a material. More...
 
ObjectPtr createGeometry (const GT_PrimitiveHandle &prim)
 
ObjectPtr createGeometry (const GT_PrimitiveHandle &prim, const GT_DataArrayHandle &holes)
 For polygonal meshes, use this to create geometry to handle holes. More...
 
ObjectPtr createVolume (const UT_StringHolder &name)
 
ObjectPtr createInstance (const ObjectPtr &obj, const UT_StringHolder &name)
 Create an instance of an object (not a light) More...
 
ObjectPtr createScene ()
 Create a nested scene graph. More...
 
LightInstancerPtr createLightInstancer (const UT_StringHolder &name)
 Create a light instancer. More...
 
ObjectPtr createProcedural (UT_UniquePtr< BRAY_Procedural > proc)
 
MaterialPtr findMaterial (const UT_StringRef &name) const
 Find a material. More...
 
bool destroyMaterial (const UT_StringRef &name)
 Destroy/Delete a material (returns false if material wasn't found) More...
 
bool addTraceset (const UT_StringHolder &name)
 
bool isTraceset (const UT_StringHolder &name)
 Check to see if a traceset exists. More...
 
ShaderGraphPtr createShaderGraph (const UT_StringHolder &name)
 Create a shader nodegraph. More...
 
bool loadHDA (const char *path)
 
void setSceneUnits (fpreal64 units)
 
fpreal64 sceneUnits () const
 
SYS_SAFE_BOOL operator bool () const
 
const BRAY_Scene * scenePtr () const
 
BRAY_Scene * scenePtr ()
 
OptionSet sceneOptions ()
 
const OptionSet constSceneOptions () const
 
OptionSet objectProperties ()
 
const OptionSet constObjectProperties () const
 
OptionSet lightProperties ()
 
const OptionSet constLightProperties () const
 
OptionSet cameraProperties ()
 
const OptionSet constCameraProperties () const
 
template<typename T >
SYS_FORCE_INLINE const T * optionImport (BRAY_SceneOption token, T *val, size_t n) const
 
template<typename T >
SYS_FORCE_INLINE bool setOption (BRAY_SceneOption token, const T *value, exint tuple_size)
 Interface to set an option. This template class is specialized for: More...
 
template<typename T >
SYS_FORCE_INLINE bool setOption (BRAY_SceneOption token, const T &value)
 Simple interface to set a scalar option. More...
 
SYS_FORCE_INLINE exint optionSize (BRAY_SceneOption token) const
 
SYS_FORCE_INLINE GT_Storage optionStorage (BRAY_SceneOption token) const
 Return the storage class of an option. More...
 
SYS_FORCE_INLINE bool optionIsVariadic (BRAY_SceneOption token) const
 Return whether an option has variadic arguments. More...
 
bool optionB (BRAY_SceneOption t) const
 
int64 optionI (BRAY_SceneOption t) const
 
fpreal64 optionF (BRAY_SceneOption t) const
 
UT_StringHolder optionS (BRAY_SceneOption t) const
 
template<typename T >
SYS_FORCE_INLINE const T * propertyImport (BRAY_ObjectProperty token, T *val, size_t n) const
 
template<typename T >
SYS_FORCE_INLINE bool setProperty (BRAY_ObjectProperty token, const T *value, exint tuple_size)
 Interface to set an property. This template class is specialized for: More...
 
bool lockProperty (BRAY_ObjectProperty token, bool state)
 
exint lockProperties (const char *pattern, bool state)
 
SYS_FORCE_INLINE exint lockAllObjectProperties (bool state)
 Lock or unlock all object properties. More...
 
template<typename T >
SYS_FORCE_INLINE bool setProperty (BRAY_ObjectProperty token, const T &value)
 Simple interface to set a scalar property. More...
 
SYS_FORCE_INLINE exint propertySize (BRAY_ObjectProperty token) const
 
SYS_FORCE_INLINE GT_Storage propertyStorage (BRAY_ObjectProperty token) const
 Return the storage class of an option. More...
 
SYS_FORCE_INLINE bool propertyIsVariadic (BRAY_ObjectProperty token) const
 Return whether an property has variadic arguments. More...
 
bool propertyB (BRAY_SceneOption t) const
 
int64 propertyI (BRAY_SceneOption t) const
 
fpreal64 propertyF (BRAY_SceneOption t) const
 
UT_StringHolder propertyS (BRAY_SceneOption t) const
 

Static Public Member Functions

static ScenePtr allocScene ()
 Allocate a new scene. More...
 
static void setExitOnFailedLicense (bool state=true)
 
static bool isEngineSupported (const UT_StringRef &name)
 Check to see whether a rendering engine is supported. More...
 

Detailed Description

When defining materials for face sets, the material specification is given by a pair of the MaterialPtr and an array of integers. The integers specify the list of faces to material and must appear in sorted order (smallest to largest). Interface to the scene manager

Examples:
karma_procedurals/BRAY_HdBox.C.

Definition at line 227 of file BRAY_Interface.h.

Constructor & Destructor Documentation

BRAY::ScenePtr::ScenePtr ( )
default
BRAY::ScenePtr::~ScenePtr ( )

Member Function Documentation

bool BRAY::ScenePtr::addTraceset ( const UT_StringHolder name)

Add traceset name to global list (categories on objects that do not belong to this list will be ignored) Returns true if added, false if already exists.

static ScenePtr BRAY::ScenePtr::allocScene ( )
static

Allocate a new scene.

OptionSet BRAY::ScenePtr::cameraProperties ( )

Grab a copy of the current camera properties

void BRAY::ScenePtr::commitOptions ( )

After changing any options, must commit prior to rendering.

const OptionSet BRAY::ScenePtr::constCameraProperties ( ) const

Grab a copy of the current light properties

const OptionSet BRAY::ScenePtr::constLightProperties ( ) const

Grab a copy of the current light properties

const OptionSet BRAY::ScenePtr::constObjectProperties ( ) const

Grab a copy of the current object properties.

const OptionSet BRAY::ScenePtr::constPlaneProperties ( ) const
const OptionSet BRAY::ScenePtr::constSceneOptions ( ) const

Grab a copy of the current scene options

CameraPtr BRAY::ScenePtr::createCamera ( const UT_StringHolder name)

Create a camera.

CoordSysPtr BRAY::ScenePtr::createCoordSys ( const UT_StringHolder name)

Create a coordinate system.

LightPtr BRAY::ScenePtr::createDetachedLight ( const UT_StringHolder name)

Create a detached light, which is not added to the scene.

ObjectPtr BRAY::ScenePtr::createGeometry ( const GT_PrimitiveHandle prim)

Create an object given a GT_Primitive handle. At the current time, the only classes supported are:

Examples:
karma_procedurals/BRAY_HdBox.C.
ObjectPtr BRAY::ScenePtr::createGeometry ( const GT_PrimitiveHandle prim,
const GT_DataArrayHandle holes 
)

For polygonal meshes, use this to create geometry to handle holes.

ObjectPtr BRAY::ScenePtr::createInstance ( const ObjectPtr obj,
const UT_StringHolder name 
)

Create an instance of an object (not a light)

Examples:
karma_procedurals/BRAY_HdBox.C.
LightPtr BRAY::ScenePtr::createLight ( const UT_StringHolder name)

Create a light.

LightInstancerPtr BRAY::ScenePtr::createLightInstancer ( const UT_StringHolder name)

Create a light instancer.

MaterialPtr BRAY::ScenePtr::createMaterial ( const UT_StringHolder name)

Create a material.

Examples:
karma_procedurals/BRAY_HdBox.C.
ObjectPtr BRAY::ScenePtr::createProcedural ( UT_UniquePtr< BRAY_Procedural proc)

Create a procedural object. Ownership of the procedural is passed to the object.

ObjectPtr BRAY::ScenePtr::createScene ( )

Create a nested scene graph.

ShaderGraphPtr BRAY::ScenePtr::createShaderGraph ( const UT_StringHolder name)

Create a shader nodegraph.

ObjectPtr BRAY::ScenePtr::createVolume ( const UT_StringHolder name)

Create a volume given its detail attribute and the names and GT_PrimitiveHandles of the corresponding fields in the volume

OptionSet BRAY::ScenePtr::defaultProperties ( BRAY_PropertyType  type) const

Grab a the default properties for a given type. Changing their values will cause all future objects created to inherit the new values.

bool BRAY::ScenePtr::destroyMaterial ( const UT_StringRef name)

Destroy/Delete a material (returns false if material wasn't found)

MaterialPtr BRAY::ScenePtr::findMaterial ( const UT_StringRef name) const

Find a material.

void BRAY::ScenePtr::forceRedice ( )

Force redicing of displacement and subd surfaces on the next render. This will only take effect on the next call to beginRender().

static bool BRAY::ScenePtr::isEngineSupported ( const UT_StringRef name)
static

Check to see whether a rendering engine is supported.

bool BRAY::ScenePtr::isKarmaCPU ( ) const

convenience methods to determine which renderer is active (tests the value of the BRAY_OPT_DELEGATE option)

bool BRAY::ScenePtr::isKarmaXPU ( ) const
bool BRAY::ScenePtr::isTraceset ( const UT_StringHolder name)

Check to see if a traceset exists.

bool BRAY::ScenePtr::isValid ( ) const
inline

Test validity.

Definition at line 252 of file BRAY_Interface.h.

OptionSet BRAY::ScenePtr::lightProperties ( )

Grab a copy of the current light properties

bool BRAY::ScenePtr::loadHDA ( const char *  path)

Load an HDA to define shader code. Not all applications support this feature.

SYS_FORCE_INLINE exint BRAY::ScenePtr::lockAllObjectProperties ( bool  state)
inline

Lock or unlock all object properties.

Definition at line 436 of file BRAY_Interface.h.

exint BRAY::ScenePtr::lockProperties ( const char *  pattern,
bool  state 
)

Lock properties based on a string pattern of parameter names. This method returns the number of properties modified.

bool BRAY::ScenePtr::lockProperty ( BRAY_ObjectProperty  token,
bool  state 
)

Locking the object property prevents any overriding of the property after the fact, essentially turning the property into a read-only property. This method is intended to lock default properties. The current value of the property is used as the value.

The return value is the previous lock state of the property.

bool BRAY::ScenePtr::nestedInstancing ( ) const

Test whether the renderer supports nested instancing.

OptionSet BRAY::ScenePtr::objectProperties ( )

Grab a copy of the current object properties.

Examples:
karma_procedurals/BRAY_HdBox.C.
SYS_SAFE_BOOL BRAY::ScenePtr::operator bool ( ) const
inline

Private access to the underling scene

Definition at line 307 of file BRAY_Interface.h.

bool BRAY::ScenePtr::optionB ( BRAY_SceneOption  t) const
inline

Convenience methods to look up scene and scene options. Get an scene option value.

Definition at line 394 of file BRAY_Interface.h.

fpreal64 BRAY::ScenePtr::optionF ( BRAY_SceneOption  t) const
inline

Convenience methods to look up scene and scene options. Get an scene option value.

Definition at line 398 of file BRAY_Interface.h.

int64 BRAY::ScenePtr::optionI ( BRAY_SceneOption  t) const
inline

Convenience methods to look up scene and scene options. Get an scene option value.

Definition at line 396 of file BRAY_Interface.h.

template<typename T >
SYS_FORCE_INLINE const T* BRAY::ScenePtr::optionImport ( BRAY_SceneOption  token,
T *  val,
size_t  n 
) const
inline

Convenience methods to look up scene and scene options. Get an scene option value.

Definition at line 351 of file BRAY_Interface.h.

SYS_FORCE_INLINE bool BRAY::ScenePtr::optionIsVariadic ( BRAY_SceneOption  token) const
inline

Return whether an option has variadic arguments.

Definition at line 390 of file BRAY_Interface.h.

UT_StringHolder BRAY::ScenePtr::optionS ( BRAY_SceneOption  t) const
inline

Convenience methods to look up scene and scene options. Get an scene option value.

Definition at line 400 of file BRAY_Interface.h.

SYS_FORCE_INLINE exint BRAY::ScenePtr::optionSize ( BRAY_SceneOption  token) const
inline

Return the size of an option. This can be used for variadics (e.g. shading quality will be 1)

Definition at line 376 of file BRAY_Interface.h.

SYS_FORCE_INLINE GT_Storage BRAY::ScenePtr::optionStorage ( BRAY_SceneOption  token) const
inline

Return the storage class of an option.

Definition at line 383 of file BRAY_Interface.h.

OptionSet BRAY::ScenePtr::planeProperties ( )

Grab a copy of the current image plane properties.

bool BRAY::ScenePtr::propertyB ( BRAY_SceneOption  t) const
inline

Convenience methods to look up object properties. Get an object property value.

Definition at line 467 of file BRAY_Interface.h.

fpreal64 BRAY::ScenePtr::propertyF ( BRAY_SceneOption  t) const
inline

Convenience methods to look up object properties. Get an object property value.

Definition at line 471 of file BRAY_Interface.h.

int64 BRAY::ScenePtr::propertyI ( BRAY_SceneOption  t) const
inline

Convenience methods to look up object properties. Get an object property value.

Definition at line 469 of file BRAY_Interface.h.

template<typename T >
SYS_FORCE_INLINE const T* BRAY::ScenePtr::propertyImport ( BRAY_ObjectProperty  token,
T *  val,
size_t  n 
) const
inline

Convenience methods to look up object properties. Get an object property value.

Definition at line 408 of file BRAY_Interface.h.

SYS_FORCE_INLINE bool BRAY::ScenePtr::propertyIsVariadic ( BRAY_ObjectProperty  token) const
inline

Return whether an property has variadic arguments.

Definition at line 463 of file BRAY_Interface.h.

UT_StringHolder BRAY::ScenePtr::propertyS ( BRAY_SceneOption  t) const
inline

Convenience methods to look up object properties. Get an object property value.

Definition at line 473 of file BRAY_Interface.h.

SYS_FORCE_INLINE exint BRAY::ScenePtr::propertySize ( BRAY_ObjectProperty  token) const
inline

Return the size of an option. This can be used for variadics (e.g. shading quality will be 1)

Definition at line 449 of file BRAY_Interface.h.

SYS_FORCE_INLINE GT_Storage BRAY::ScenePtr::propertyStorage ( BRAY_ObjectProperty  token) const
inline

Return the storage class of an option.

Definition at line 456 of file BRAY_Interface.h.

void BRAY::ScenePtr::saveCheckpointASAP ( )

Forcibly save checkpoint as soon as possible (if checkpointing is enabled)

OptionSet BRAY::ScenePtr::sceneOptions ( )

Grab a copy of the current scene options

const BRAY_Scene* BRAY::ScenePtr::scenePtr ( ) const
inline

Private access to the underling scene

Definition at line 308 of file BRAY_Interface.h.

BRAY_Scene* BRAY::ScenePtr::scenePtr ( )
inline

Private access to the underling scene

Definition at line 309 of file BRAY_Interface.h.

fpreal64 BRAY::ScenePtr::sceneUnits ( ) const

Set the unit scale for the scene - this is in meters/unit. For example, centimeters would be 0.01.

void BRAY::ScenePtr::setCameraRayMask ( BRAY_RayVisibility  mask)

Set camera ray visibility. The mask should be a combination of

  • BRAY_RAY_CAMERA
  • BRAY_PROXY_CAMERA
  • BRAY_GUIDE_CAMERA For example, (BRAY_RAY_CAMERA|BRAY_GUIDE_CAMERA) will cause guide and renderable object to be visible to camera rays, but not proxy objects
static void BRAY::ScenePtr::setExitOnFailedLicense ( bool  state = true)
static

Force an exit when there's a failed license check failure. The normal behaviour is to render a black image.

template<typename T >
SYS_FORCE_INLINE bool BRAY::ScenePtr::setOption ( BRAY_SceneOption  token,
const T *  value,
exint  tuple_size 
)
inline

Interface to set an option. This template class is specialized for:

Definition at line 359 of file BRAY_Interface.h.

template<typename T >
SYS_FORCE_INLINE bool BRAY::ScenePtr::setOption ( BRAY_SceneOption  token,
const T &  value 
)
inline

Simple interface to set a scalar option.

Definition at line 369 of file BRAY_Interface.h.

template<typename T >
SYS_FORCE_INLINE bool BRAY::ScenePtr::setProperty ( BRAY_ObjectProperty  token,
const T *  value,
exint  tuple_size 
)
inline

Interface to set an property. This template class is specialized for:

Definition at line 416 of file BRAY_Interface.h.

template<typename T >
SYS_FORCE_INLINE bool BRAY::ScenePtr::setProperty ( BRAY_ObjectProperty  token,
const T &  value 
)
inline

Simple interface to set a scalar property.

Definition at line 442 of file BRAY_Interface.h.

void BRAY::ScenePtr::setSceneUnits ( fpreal64  units)

Set the unit scale for the scene - this is in meters/unit. For example, centimeters would be 0.01.

void BRAY::ScenePtr::setShadowRayMask ( BRAY_RayVisibility  mask)

Set shadow ray visibility. The mask should be a combination of

  • BRAY_RAY_SHADOW
  • BRAY_PROXY_SHADOW
  • BRAY_GUIDE_SHADOW For example, (BRAY_RAY_SHADOW|BRAY_PROXY_SHADOW) will cause proxy and renderable object to cast shadows, but not GUIDE objects.
void BRAY::ScenePtr::startEdits ( BRAY::RendererPtr renderer)

Start edits/loading of the scene.

bool BRAY::ScenePtr::threadSafe ( ) const

Test whether the scene is thread-safe.

void BRAY::ScenePtr::updateCamera ( const CameraPtr ptr,
BRAY_EventType  event 
)

Update camera object in the scene.

void BRAY::ScenePtr::updateCoordSys ( const CoordSysPtr ptr,
BRAY_EventType  event 
)

Update coord sys object.

void BRAY::ScenePtr::updateLight ( const LightPtr ptr,
BRAY_EventType  event 
)

Update light object in the scene.

void BRAY::ScenePtr::updateMaterial ( const MaterialPtr ptr,
BRAY_EventType  event 
)

Update material object in the scene.

void BRAY::ScenePtr::updateObject ( const ObjectPtr ptr,
BRAY_EventType  event 
)

Update an object in the scene.

Examples:
karma_procedurals/BRAY_HdBox.C.

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