TBasicShader Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicShader:

I3DExShader TBasicDataExchanger IMCUnknown TBasicUnknown IMCUnknown List of all members.

Public Member Functions

virtual MCCOMErr MCCOMAPI QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI AddRef ()
virtual boolean MCCOMAPI IsEqualTo (I3DExShader *aShader)
virtual MCCOMErr MCCOMAPI GetShadingFlags (ShadingFlags &theFlags)
virtual EShaderOutput MCCOMAPI GetImplementedOutput ()
virtual boolean MCCOMAPI WantsTransform ()
virtual boolean MCCOMAPI HasExplicitLightingModel (const LightingContext &lightingContext)
virtual void MCCOMAPI ShadeAndLight (LightingDetail &result, const LightingContext &lightingContext, I3DShShader *inShader)
virtual MCCOMErr MCCOMAPI DoShade (ShadingOut &result, ShadingIn &shadingIn)
virtual real MCCOMAPI GetValue (real &result, boolean &fullArea, ShadingIn &shadingIn)
virtual real MCCOMAPI GetColor (TMCColorRGBA &result, boolean &fullArea, ShadingIn &shadingIn)
virtual real MCCOMAPI GetVector (TVector3 &result, ShadingIn &shadingIn)
virtual MCCOMErr MCCOMAPI GetBump (TVector3 &result, ShadingIn &shadingIn)
virtual void MCCOMAPI ConvertToPoly (TMCArray< TVector2 > *vertices)
virtual boolean MCCOMAPI OutlineInPreviewMode ()
virtual boolean MCCOMAPI Contains (ShadingIn &shadingIn, TVector2 &localUV)
virtual MCCOMErr MCCOMAPI GetOriginalParametricTextureMap (const uint32 &uvSpaceID, const uint32 &channelIndex, IShTextureMap **outMap)
virtual void CalculateDirectLighting (LightingDetail &result, const LightingContext &lightingContext)
virtual void CalculateReflection (TMCColorRGB &reflectionColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void CalculateCaustics (TMCColorRGB &causticColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void CalculateIndirectLighting (TMCColorRGB &indirectDiffuseColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void ApplyTransparency (TMCColorRGBA &resColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void ApplyAlpha (TMCColorRGBA &resColor, const LightingContext &lightingContext, const ShadingOut &shading)

Detailed Description

Basic Shader class. Derive from this for a default implementation of I3DExShader
See also:
I3DExShader


Member Function Documentation

virtual uint32 MCCOMAPI TBasicShader::AddRef (   )  [inline, virtual]
 

Increments the reference count of the object

Reimplemented from TBasicUnknown.

virtual void TBasicShader::ApplyAlpha (  TMCColorRGBA &  resColor,
const LightingContext &  lightingContext,
const ShadingOut &  shading
)  [virtual]
 

virtual void TBasicShader::ApplyTransparency (  TMCColorRGBA &  resColor,
const LightingContext &  lightingContext,
const ShadingOut &  shading
)  [virtual]
 

virtual void TBasicShader::CalculateCaustics (  TMCColorRGB &  causticColor,
const LightingContext &  lightingContext,
const ShadingOut &  shading
)  [virtual]
 

virtual void TBasicShader::CalculateDirectLighting (  LightingDetail &  result,
const LightingContext &  lightingContext
)  [virtual]
 

virtual void TBasicShader::CalculateIndirectLighting (  TMCColorRGB &  indirectDiffuseColor,
const LightingContext &  lightingContext,
const ShadingOut &  shading
)  [virtual]
 

virtual void TBasicShader::CalculateReflection (  TMCColorRGB &  reflectionColor,
const LightingContext &  lightingContext,
const ShadingOut &  shading
)  [virtual]
 

virtual boolean MCCOMAPI TBasicShader::Contains (  ShadingIn &  shadingIn,
TVector2 &  localUV
)  [virtual]
 

Returns true if a point in uv coordinates is contained in the shape of the shaders (used for shape shaders only).

Parameters:
shadingIn The information about the point being shaded.
localUV The uv in the current projection mapping.

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::ConvertToPoly (  TMCArray< TVector2 > *  vertices  )  [virtual]
 

must be implemented to allow a shader to display an outline. This is typically used by layers such as ’rectangle’, ’ellipse’, and ’polygon’

Parameters:
vertices An array of 2D vertices used to draw a layout around the layer. Those vertices' coordinates are in the UVSpace of the layer.

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::DoShade (  ShadingOut &  result,
ShadingIn &  shadingIn
)  [virtual]
 

Returns the shading at a given point as described in the shadingIn. Note that you also need to fill the fCurrentCompletionMask of shadingIn with the channels that your shader is actually filling (this allows to have shaders that only after certain channel without modifying the others in a layered shader).

Note that the alpha is not premultiplied in the shading.

Note:
A shader should implement at least one other following methods: DoShader , GetValue or GetColor
Parameters:
result: the shading data as calculated by the shader
shadingIn: the location where the shading should be calculated
Returns:
MC_S_OK if the shader implements this method, MC_E_NOTIMPL otherwise

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::GetBump (  TVector3 &  result,
ShadingIn &  shadingIn
)  [virtual]
 

not supported in current version

Implements I3DExShader.

virtual real MCCOMAPI TBasicShader::GetColor (  TMCColorRGBA &  result,
boolean &  fullArea,
ShadingIn &  shadingIn
)  [virtual]
 

Calculates the color of a shader for given point described in shadingIn.

Note that the alpha is not premultiplied in the shading ! (But it is in the lighting calculation)

Parameters:
result: The color of the point
fullArea Return false if the shader only did a point sampling, Return false if the shader average the shading over the area.
shadingIn: the parameters for the shading
Returns:
The opacity (for Layer Lists) of this shader (between 0 and 1)

Implements I3DExShader.

virtual EShaderOutput MCCOMAPI TBasicShader::GetImplementedOutput (   )  [virtual]
 

Determines which methods the Shader actually implements. Return only one of the following values if you implement only one of the methods. If more than one is implemented then return the result as the OR of the two values

            return kUsesGetValue | kUsesGetColor;
For a complete description of the constant that can be used, please refer to EShaderOutput

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::GetOriginalParametricTextureMap (  const uint32 &  uvSpaceID,
const uint32 &  channelIndex,
IShTextureMap **  outMap
)  [inline, virtual]
 

Returns the original texture map when no special projections mappings.

Parameters:
uvSpaceID The uvSpaceID for which we want the texture
channelIndex The index of the channel that we want (color,alpha,...)
outMap Returns a pointer to the texture map if there is one.

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::GetShadingFlags (  ShadingFlags &  theFlags  )  [virtual]
 

specifies which parameters the shader will need to perform shading calculations. If the shader is a constant shader which values does not depend on any of the ShadingIn parameters then it should set the fCallOnce flag in theFlags to true. See the description of the ShadingFlags structure for more details.

Parameters:
theFlags The flags that are returned

Implements I3DExShader.

virtual real MCCOMAPI TBasicShader::GetValue (  real &  result,
boolean &  fullArea,
ShadingIn &  shadingIn
)  [virtual]
 

Calculates the value of the shader at a given point described in shadingIn.

Note:
A shader should implement at least one other following methods: DoShader , GetValue or GetColor
Parameters:
result The resulting value
fullArea Return false if the shader only did a point sampling, Return false if the shader average the shading over the area.
shadingIn: the parameters for the shading
Returns:
the opacity (for Layer Lists) of this shader (between 0 and 1)

Implements I3DExShader.

virtual real MCCOMAPI TBasicShader::GetVector (  TVector3 &  result,
ShadingIn &  shadingIn
)  [virtual]
 

Returns a perturbation of the normal in local coordinates. This perturbation is then added to the orginal normal of the point to calculate the bump.

Parameters:
result: the perturbation of the normal
shadingIn: the parameters for the shading
Returns:
The opacity (for Layer Lists) of this shader (between 0 and 1)

Implements I3DExShader.

virtual boolean MCCOMAPI TBasicShader::HasExplicitLightingModel (  const LightingContext &  lightingContext  )  [virtual]
 

Returns true if there is an explicit lighting model in the subtree. This is mostly used for layer lists to determine if DoShade or ShadeAndLight should be called on the layer.

Parameters:
lightingContext The information about the current point being shaded (including incoming ray...)

Implements I3DExShader.

virtual boolean MCCOMAPI TBasicShader::IsEqualTo (  I3DExShader *  aShader  )  [virtual]
 

Compares the values of two shaders. IsEqualTo() must first get a pointer on the same interface as itself before comparing the values.

Parameters:
aShader The shader that should be compared to this.

Implements I3DExShader.

virtual boolean MCCOMAPI TBasicShader::OutlineInPreviewMode (   )  [virtual]
 

Return True if the shader will draw an outline. ConvertToPoly() must then be implemented. This is typically used by layers such as ’rectangle’, ’ellipse’, and ’polygon’

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::QueryInterface (  const MCIID &  riid,
void **  ppvObj
)  [virtual]
 

Check if the object supports a given interface and returns a pointer to that interface if it does. Note that QueryInterface will increment the reference count of the object by one if the interface is found.

Parameters:
riid GUID of the interface
ppvObj A pointer to the pointer being returned.

Reimplemented from TBasicDataExchanger.

virtual void MCCOMAPI TBasicShader::ShadeAndLight (  LightingDetail &  result,
const LightingContext &  lightingContext,
I3DShShader *  inShader
)  [virtual]
 

Calculates the shading and lighting in one point. There is a default implementation of the phong shading in TBasicShader. You should only override this method if you want to implement advanced lighting effects in your shader.

Parameters:
resColor : color seen by the observer
lightingContext : info about the point being shaded and the lighting of the scene
inShader : a pointer to the internal shader instance, for calling the internal DoShade

Implements I3DExShader.

virtual boolean MCCOMAPI TBasicShader::WantsTransform (   )  [inline, virtual]
 

Returns true if the shader needs a transform tab. This is only useful if your shader relies on 3D coodinates and not UV coordinates.

Implements I3DExShader.


The documentation for this class was generated from the following file:
Generated on Mon Mar 14 12:29:07 2005 for Carrara SDK Doc by  doxygen 1.3.9.1