Public Member Functions | |
uint32_t | threadIdx () const |
Thread index from current SlrThreadContext. | |
SlrScene * | motionScene () const |
SlrScene * | motionScene0 () const |
SlrScene * | motionScene1 () const |
const fdk::Mat4d & | matrix (int n) const |
const fdk::Mat4d & | matrix0 (int n) const |
const fdk::Mat4d & | matrix1 (int n) const |
SlrRayTestCache * | rayTestCache () const |
void | setRayTestCache (SlrRayTestCache *r) |
float | getPolygonEdgeDistance (const fdk::Vec4f &P, float minDist) const |
bool | shadeBothSides () const |
Shade both sides of surface (front and back) ignoring surface normal to camera. | |
bool | shadeFrontOnly () const |
Shade only front side of surface. | |
bool | shadeBackOnly () const |
Shade only front side of surface. | |
void | enableBothSidesMode () |
void | enableFrontSideMode () |
void | enableBackSideMode () |
bool | isPixel (int32_t px, int32_t py) const |
bool | isPixelX (int32_t px) const |
bool | isPixelY (int32_t py) const |
float | w () const |
Current homogeneous W coordinate: | |
float | Z () const |
Current Z coordinate - W-normalized! | |
const fdk::Vec3f & | PW () const |
fdk::Vec3f & | PW () |
const fdk::Vec3f & | PL () const |
fdk::Vec3f & | PL () |
const fdk::Vec3f & | UV () const |
fdk::Vec3f & | UV () |
const fdk::Vec3f & | N () const |
fdk::Vec3f & | N () |
const fdk::Vec4f & | Cf () const |
fdk::Vec4f & | Cf () |
const fdk::Vec4f & | rgba () const |
fdk::Vec4f & | rgba () |
const fdk::Vec3f & | rgb () const |
fdk::Vec3f & | rgb () |
float | r () const |
float | g () const |
float | b () const |
float | a () const |
float | opacity () const |
void | sample (DD::Image::Sampler *sampler, DD::Image::Pixel &out) const |
void | sample (DD::Image::Iop *texture, DD::Image::Pixel &out) const |
Slower version using a raw Iop. | |
Public Attributes | |
SlrVertex | v |
Current values for shader - W-normalized, volatile! | |
double | distance |
Distance from last intersection/camera. | |
SlrVertex | vP |
Current values for shader - in homogeneous-space! | |
SlrVertex | vdX |
Change if X of render pixel is increased by 1. | |
SlrVertex | vdY |
Change if Y of render pixel is increased by 1. | |
int32_t | x |
int32_t | y |
Current output screen coords. | |
float | sx |
float | sy |
Current output subpixel screen coords. | |
int32_t | si |
Current subsample index. | |
double | time |
Absolute frame time (i.e. 101.0, 155.0, etc) | |
double | shutter_offset |
Shutter offset from time0 reference (i.e. -0.5, -0.35, 0.0, +0.5, etc) | |
uint32_t | shutter_step |
Global-context shutter-step index for the context's time. | |
SlrRenderContext * | slrtx |
For global rendering params, render Op, etc. | |
SlrScene * | motion_scene0 |
Scene info for motion sample at start of shutter_step. | |
SlrScene * | motion_scene1 |
Scene info for motion sample at end of shutter_step. | |
SlrPrimInfo * | motion_priminfo0 |
Current object SlrPrimInfo for motion sample at start of shutter_step. | |
SlrPrimInfo * | motion_priminfo1 |
Current object SlrPrimInfo for motion sample at end of shutter_step. | |
const SlrShadingContext * | previous_stx |
Previous SlrShadingContext, normally the last surface intersected/shaded. | |
SlrThreadContext * | sttx |
Per-thread 'scratch-pad' vars to speed up Pixel usage in shaders. | |
SlrTriangle * | rtriangle |
Current render triangle being evaluated. | |
SlrSurfaceShader * | surface_shader |
Current surface shader being evaluated. | |
SlrGeometryShader * | displacement_shader |
Current displacement shader being evaluated, if any. | |
SlrLightShader * | light_shader |
Current light shader being evaluated, if any. | |
SlrVolumeShader * | atmosphere_shader |
Current atmospheric volume shader being evaluated, if any. | |
int32_t | sides_mode |
Which sides to intersect against and shade (use methods to query) | |
bool | texture_sampling |
Whether shaders should sample their textures. | |
DD::Image::TextureFilter * | texture_filter |
Global texture filter to use. | |
bool | lighting_enabled |
If true, even if no lights the surface shaders should do illum calcs. | |
fdk::Vec3f | ambient |
Global ambient setting. | |
Protected Attributes | |
SlrRayTestCache * | _ray_test_cache |
Triangle cache for intersection testing. | |
This class is intended to be passed up a SlrShader tree. It's initialized with basic vertex info like the point location, a UV coordinate and a normal. A shader can then modify the parameters producing effects like point displacement, UV projection, and normal remapping.
float slr::SlrShadingContext::getPolygonEdgeDistance | ( | const fdk::Vec4f & | P, |
float | minDist | ||
) | const |
Distance from point P to the nearest not occluded polygon edge in screen-space for the current primitive. All triangles generated from the tessellation of the original SlrPrimInfo are tested, so the method checks all polygon edges. Returns when the first edge distance is under minDist.
References slr::SlrTriangle::eMaskEdgeAll, slr::SlrTriangle::faceEdgeMask, slr::SlrTriangle::nextTri, slr::SlrVertex::P, rtriangle, slr::SlrTriangle::v, and w().
void slr::SlrShadingContext::sample | ( | DD::Image::Sampler * | sampler, |
DD::Image::Pixel & | out | ||
) | const |
Use the UV and the derivatives of UV to sample the incoming image. UV of 0,0 is mapped to the lower-left corner of the image's format, and 1,1 is mapped to the upper-right corner.
For texture sampling it's much faster to provide a DD::Image::Sampler rather than a raw Iop so Tile caching is properly leveraged.
References DD::Image::Box::h(), texture_filter, slr::SlrVertex::UV, vdX, vdY, vP, DD::Image::Box::w(), DD::Image::Box::x(), DD::Image::Box::y(), and y.
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |