DD::Image::Material Class Reference

Inherits DD::Image::Iop.

Inherited by DD::Image::IllumShader.

List of all members.

Public Member Functions

 Material (Node *)
const char * node_shape () const
unsigned node_color () const
void knobs (Knob_Callback)
virtual void get_geometry_hash (Hash *geo_hashes)
bool set_texturemap (ViewerContext *ctx, bool gl)
void unset_texturemap (ViewerContext *ctx)
bool shade_GL (ViewerContext *, GeoInfo &)
void vertex_shader (VertexContext &)
void fragment_shader (const VertexContext &, Pixel &out)
void displacement_shader (const VertexContext &vtx, VArray &out)
float displacement_bound () const
void blending_shader (const Pixel &in, Pixel &out)
void render_state (GeoInfoRenderState &state)

Static Public Member Functions

static void default_lighting (const VertexContext &vtx, Pixel &out)

Static Public Attributes

static const Vector4 gDefaultAmbient
static const Vector4 gDefaultDiffuse
static const Vector4 gDefaultSpecular
static const Vector4 gDefaultEmission

Protected Member Functions

void _validate (bool)
void _request (int x, int y, int r, int t, ChannelMask, int count)
void engine (int y, int x, int r, ChannelMask, Row &)
void set_blending_shader (const VertexContext &vtx)

Friends

std::ostream & operator<< (std::ostream &, const Material &)

Detailed Description

This subclass of Iop provides some convienence functions so that it is easier to shade a 3D geometry object, such as calls to calculate the blinn or other lighting models, and the output has been modified to produce an image of a sphere lit using this material.

To make a useful Material, you almost certainly need to override these Iop functions: bool Iop::shade_GL(ViewerContext*, GeoInfo&); void Iop::fragment_shader(Scene*, VertexContext*, Pixel& out);


Member Function Documentation

const char * Material::node_shape ( ) const [virtual]

Define the material op's shape in the DAG.

Reimplemented from DD::Image::Op.

unsigned Material::node_color ( ) const [virtual]

All material operators default to a orangish color.

Reimplemented from DD::Image::Op.

void Material::get_geometry_hash ( Hash geo_hashes) [virtual]

Hash up knobs that can affect the geometric hashes. Base class just calls its input.

References get_geometry_hash(), and DD::Image::Iop::input().

Referenced by DD::Image::SourceGeo::get_geometry_hash(), and get_geometry_hash().

bool Material::shade_GL ( ViewerContext ctx,
GeoInfo geo 
) [virtual]

Your subclass must implement this. This version produces an error.

Reimplemented from DD::Image::Iop.

Reimplemented in DD::Image::IllumShader.

References DD::Image::Op::Class(), and DD::Image::Op::debug().

void Material::vertex_shader ( VertexContext vtx) [virtual]

Default version does nothing.

Reimplemented from DD::Image::Iop.

Reimplemented in DD::Image::IllumShader.

References DD::Image::Op::Class(), and DD::Image::Op::debug().

void Material::fragment_shader ( const VertexContext vtx,
Pixel out 
) [virtual]

Your subclass must implement this. This version produces an error.

Reimplemented from DD::Image::Iop.

References DD::Image::Op::Class(), and DD::Image::Op::debug().

Referenced by engine().

void Material::engine ( int  y,
int  x,
int  r,
ChannelMask  channels,
Row outrow 
) [protected, virtual]

If a Material is used as an Iop, it produces an image of a sphere rendered with the shader atop a gray background, with a light at the upper-left corner.

Implements DD::Image::Iop.

References fragment_shader(), DD::Image::Row::get(), DD::Image::Iop::input0(), DD::Image::IopInfoOwner::r(), DD::Image::Vector3::set(), DD::Image::Vector4::set(), DD::Image::VertexContext::vdX, DD::Image::VertexContext::vdY, DD::Image::VertexContext::vP, and DD::Image::Row::writable().

void DD::Image::Material::set_blending_shader ( const VertexContext vtx) [inline, protected]

Call this at the start of fragment shader for Materials that do lighting.

References DD::Image::VertexContext::blending_shader.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const Material  
) [friend]

Not implemented in the library but you can define it