Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
slr::SlrThreadContext Class Reference

#include <SlrThreadContext.h>

Public Member Functions

uint32_t index () const
 
uint32_t nThreads () const
 
DD::Image::ThreadId threadId () const
 
const std::vector< SlrShadingContext > & shaderContextList () const
 Returns a reference to the shader context list.
 
void setInterestRatchet (DD::Image::InterestRatchet *interest)
 
void clearShaderContexts ()
 Clear the shader context list but keep the memory allocation.
 
SlrShadingContextcurrentShaderContext ()
 Get the current SlrShaderContext (the last in the list.)
 
SlrShadingContextgetShaderContext (uint32_t i)
 Get the shader context for index i.
 
SlrShadingContextpushShaderContext (const SlrShadingContext *src_stx=nullptr)
 Add a SlrShaderContext to the end of the list, and return it, copying src_stx if it's not null.
 
SlrShadingContextpushShaderContext (const SlrShadingContext &src_stx, const fdk::Vec3f &Rdir, float minT, float maxT, uint32_t ray_type, uint32_t sides_mode)
 Add SlrShaderContext src_stx to the end of the list, copying the source context, returning a reference to it.
 
SlrShadingContextpushShaderContext (const SlrShadingContext &src_stx, const ndk::RayContext &Rtx, uint32_t ray_type, uint32_t sides_mode)
 Add SlrShaderContext src_stx to the end of the list, copying the source context, returning a reference to it.
 
int popShaderContext ()
 Remove a SlrShaderContext from the end of the list, and return the new index or -1 if empty.
 
const fdk::Mat4d & camWorld2Eye () const
 Render camera world-to-eye xform (world-space coords to camera local-space)
 
const fdk::Mat4d & camEye2World () const
 Render camera eye-to-world xform (camera local-space coords to world-space)
 
const fdk::Vec3d & camP () const
 
const fdk::Vec3d & camHeroP () const
 Hero-view camera origin in world space - for specular copying.
 
bool isPixel (int32_t px, int32_t py) const
 
bool isPixelX (int32_t px) const
 
bool isPixelY (int32_t py) const
 
bool isSample (int32_t si) const
 
bool isDebugPixel () const
 
bool isDebugSample () const
 

Protected Attributes

uint32_t _index
 
uint32_t _nThreads
 
DD::Image::ThreadId _threadId
 
SlrShadingContextList _stxList
 Ray segment context list - index 0 is always the primary(camera) ray.
 
fdk::Mat4d _camL2W
 Camera local-to-world xform (eye-space coords to world-space)
 
fdk::Mat4d _camW2L
 Camera world-to-local xform (world-space coords to eye-space)
 
fdk::Vec3d _camP
 Camera origin in world space (same as l2w.getTranslation())
 
fdk::Vec3d _camHeroP
 Hero-view camera origin in world space - for specular copying.
 
fdk::Mat4dList _lensContextTransforms
 Camera projection context matrices (TODO: switch to lens shader)
 
DD::Image::CameraLensContext _lensContext
 Camera projection context (TODO: switch to lens shader)
 
DD::Image::LensProjectionFunc * _lensFunc
 Camera projection function to use (TODO: switch to lens shader)
 
fdk::Vec2i _pxy
 Current output screen coords.
 
fdk::Vec2f _sxy
 Current output subpixel screen coords.
 
int32_t _si
 Current subsample index.
 
float _shutterOffset
 Shutter offset from time0 reference (i.e. -0.5, -0.35, 0.0, +0.5, etc)
 
uint32_t _shutterStep
 Global-context shutter-step index for the context's time.
 
fdk::Vec2i _debugpxy
 For shading debugging, set by renderer.
 
int32_t _debugsi
 For shading debugging, set by renderer.
 
bool _blendBackToFront
 Blending Z order is back-to-front (true) or front-to-back (false)
 
bool _enableColorChannels
 Shaders should output color layers + alphas.
 
bool _enableDataChannels
 Shaders should output any data channels (Z, etc)
 
bool _lightingEnabled
 If true, even if no lights the surface shaders should do illum calcs.
 
bool _shadowingEnabled
 
bool _directLightingEnabled
 
bool _indirectLightingEnabled
 
bool _useHeroCamForSpec
 If enabled camera ray uses heroV for reflection vector.
 
fdk::Vec3f _ambientLightingBias
 
SlrTraceableBvh * _objectsBvh
 Raytracing BVH for object intersections.
 
SlrTraceableBvh * _lightVolumesBvh
 Raytracing BVH for light volume intersections.
 
SlrLightInfoList * _activeLights
 Currently-active lights.
 
SlrIntersectionInfo * _intersectionInfo
 Intersection info working buffer.
 
DD::Image::Pixel _textureColor
 For sampling texture map Iops - defaults to RGBA.
 
DD::Image::Pixel _bindingColor
 For Connection sampling calls - defaults to RGBA.
 
DD::Image::Pixel _illumColor
 For LightShader evaluation - defaults to RGB.
 
DD::Image::Pixel _shadowColor
 For LightShader shadow transmission evaluation - defaults to RGB (no depth!)
 
DD::Image::Pixel _volumeColor
 For VolumeShader color evaluation - defaults to RGB.
 

Friends

class SlrShadingContext
 
class RenderEngine
 
class IntersectedSurfaces
 
class RenderSpan
 

Detailed Description

The render context (SlrRenderContext) has one of these for each thread it's performing shading calls with.

It stores thread-safe variables to help avoid per-sample allocation/deletion costs for temporary structures like a Pixel in a SlrShader.

Since there's usually very few of these (one per thread) the vars can be generous with their memory reserves. ie even at 90 threads (which may kill Nuke performance in other ways,) 90 of these objects would only occupy a relatively small amount of temporary memory.

Member Function Documentation

◆ setInterestRatchet()

void slr::SlrThreadContext::setInterestRatchet ( DD::Image::InterestRatchet interest)

Assigns an InterestRatchet to all the Pixels. This InterestRatchet var is usually a local var sitting in the renderer's engine() method, which is thread safe.

◆ camP()

const fdk::Vec3d & slr::SlrThreadContext::camP ( ) const
inline

Render camera origin (camera rays originate here). Same as camEye2World().getTranslation(), but cached for speed.

Referenced by slr::SlrShadingContext::camP().



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com