This subclass of Material provides some convienence functions so that it is easier to write a lighting surface shader. More...
Inherits DD::Image::Material.
Public Member Functions | |
IllumShader (Node *) | |
int | minimum_inputs () const |
int | maximum_inputs () const |
Op * | default_input (int input) const |
const char * | input_label (int input, char *buffer) const |
void | knobs (Knob_Callback f) |
bool | shade_GL (ViewerContext *, GeoInfo &) |
void | unset_texturemap (ViewerContext *) |
void | vertex_shader (VertexContext &) |
void | fragment_shader (const VertexContext &, Pixel &out) |
Protected Member Functions | |
virtual void | surface_shader (Vector3 &P, Vector3 &V, Vector3 &N, const VertexContext &, Pixel &surface)=0 |
void | _validate (bool) |
void | _request (int x, int y, int r, int t, ChannelMask, int count) |
Protected Attributes | |
Channel | channel [4] |
Layer to apply shading to. | |
ChannelSet | surface_channels |
ChannelMask built from channel[]. |
This subclass of Material provides some convienence functions so that it is easier to write a lighting surface shader.
Base class of illumination shaders that adds convenience functions and a map input for typical lighting shaders.
IllumShader::IllumShader | ( | Node * | node | ) |
Default the shader channels to RGB.
References channel.
Op * IllumShader::default_input | ( | int | input | ) | const [virtual] |
For input 0 it uses the default Material input0. Input 1 is allowed to be NULL so we can test whether it's connected.
Reimplemented from DD::Image::Iop.
const char * IllumShader::input_label | ( | int | input, |
char * | buffer | ||
) | const [virtual] |
Input 0 has no label, input 1 is 'map'.
Reimplemented from DD::Image::Op.
void IllumShader::knobs | ( | Knob_Callback | f | ) | [virtual] |
Set up a channel knob for the shader.
Reimplemented from DD::Image::Material.
References channel, and DD::Image::Input_Channel_knob().
bool IllumShader::shade_GL | ( | ViewerContext * | ctx, |
GeoInfo & | geo | ||
) | [virtual] |
void IllumShader::unset_texturemap | ( | ViewerContext * | ctx | ) | [virtual] |
Pass call to input0.
Reimplemented from DD::Image::Material.
References DD::Image::Iop::input0(), and DD::Image::Iop::unset_texturemap().
void IllumShader::vertex_shader | ( | VertexContext & | vtx | ) | [virtual] |
Pass call to input0.
Reimplemented from DD::Image::Material.
References DD::Image::Iop::input0(), DD::Image::Scene::lights, DD::Image::Iop::vertex_shader(), and DD::Image::VertexContext::vP.
virtual void DD::Image::IllumShader::surface_shader | ( | Vector3 & | P, |
Vector3 & | V, | ||
Vector3 & | N, | ||
const VertexContext & | , | ||
Pixel & | surface | ||
) | [protected, pure virtual] |
The light shader call. Pure virtual, must be implemented by subclasses.
void IllumShader::_validate | ( | bool | for_real | ) | [protected, virtual] |
Add surface channels to info.
Reimplemented from DD::Image::Material.
References channel, DD::Image::IopInfoOwner::info_, DD::Image::Iop::input(), DD::Image::Iop::input1(), surface_channels, and DD::Image::Op::validate().
void IllumShader::_request | ( | int | x, |
int | y, | ||
int | r, | ||
int | t, | ||
ChannelMask | channels, | ||
int | count | ||
) | [protected, virtual] |
Add surface channels to request.
Reimplemented from DD::Image::Material.
References DD::Image::IopInfoOwner::info(), DD::Image::Iop::input(), DD::Image::Iop::input1(), DD::Image::Box::r(), DD::Image::Iop::request(), surface_channels, DD::Image::Box::t(), DD::Image::Box::x(), and DD::Image::Box::y().