TBasicShader Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicShader:
I3DExShader TBasicDataExchanger IMCUnknown TBasicUnknown IExDataExchanger TMCObject IMCUnknown 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 IsChannelConstantInUVSpace (const uint32 &uvSpaceID, const uint32 &channelIndex)
virtual MCCOMErr MCCOMAPI GetShadersForChannel (const uint32 &uvSpaceID, const uint32 &channelIndex, TMCPtrArray< I3DShShader > &outShaders)
virtual boolean MCCOMAPI HasExplicitLightingModel (const LightingContext &lightingContext)
virtual MCCOMErr MCCOMAPI ShadeAndLight2 (LightingDetail &result, const LightingContext &lightingContext, I3DShLightingModel *inDefaultLightingModel, TAbsorptionFunction *absorptionFunction)
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 void MCCOMAPI GetReflection (TReflectionParameters &reflectionParams, const ShadingIn &shadingIn)
virtual void MCCOMAPI GetTransparency (TTransparencyParameters &transparencyParams, const ShadingIn &shadingIn)
virtual real MCCOMAPI GetVector (TVector3 &result, ShadingIn &shadingIn)
virtual void MCCOMAPI GetShaderApproximation (ShadingOut &result, ShadingIn &shadingIn)
virtual void MCCOMAPI GetShaderApproxColor (TMCColorRGBA &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 boolean MCCOMAPI GetSubShaderPreview (IShParameterComponent **shader, IShParameterComponent *subShader, FourCharT subShaderKeyword)
virtual void MCCOMAPI GetShaderPreview (IShParameterComponent **shader)
virtual boolean MCCOMAPI PreviewSubShaderAsTopShader (IDType keyword)
virtual int16 MCCOMAPI GetSubShaderViewID (IDType keyword)
virtual MCCOMErr MCCOMAPI SetDefaultParameters ()
virtual EShaderFunctionType
MCCOMAPI 
GetSubShaderType (IDType keyword)
virtual MCCOMErr MCCOMAPI SetupPreviewScene (IPreviewMaker *previewMaker, I3DShMasterShader *masterShader)
virtual boolean MCCOMAPI CanBeTransparent (int32 shadingDomainIndex)
virtual void MCCOMAPI CalculateDirectLighting (LightingDetail &result, const LightingContext &lightingContext)
virtual void MCCOMAPI CalculateReflection (TMCColorRGB &reflectionColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void MCCOMAPI CalculateCaustics (TMCColorRGB &causticColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void MCCOMAPI CalculateIndirectLighting (TMCColorRGB &indirectDiffuseColor, real &ambientOcclusionFactor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void MCCOMAPI CalculateTransparency (TMCColorRGB &resColor, real32 &outAlpha, const LightingContext &lightingContext, const ShadingOut &shading)
virtual void MCCOMAPI CalculateAlpha (LightingDetail &result, const LightingContext &lightingContext, const ShadingOut &shading, TAbsorptionFunction *absorptionFunction)
virtual void MCCOMAPI CalculateSubsurfaceScattering (TMCColorRGB &subsurfaceColor, const TMCColorRGB &currentColor, const LightingContext &lightingContext, const ShadingOut &shading)
virtual boolean MCCOMAPI GetRecommendedTextureSize (uint32 channelIndex, uint32 &width, uint32 &height) const
virtual void MCCOMAPI GetRelevantTextureBucketCache (uint32 channelIndex, boolean allowMultiplierModification, IShTextureMapBucketCache **outTextureMapFile) const
virtual MCCOMErr MCCOMAPI GetConstantColor (TMCColorRGBA &resColor) const
virtual TMCColorRGB MCCOMAPI GetTextureMultiplyColor () const
virtual real MCCOMAPI GetBumpAmplitude () const
virtual MCCOMErr MCCOMAPI GetConstantValue (real &resValue) const

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 TBasicDataExchanger.

virtual void MCCOMAPI TBasicShader::CalculateAlpha ( LightingDetail result,
const LightingContext lightingContext,
const ShadingOut shading,
TAbsorptionFunction absorptionFunction 
) [virtual]

Override this method to implement your own Alpha channel calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
resColor The resulting color.
lightingContext Info about the point being shaded and the lighting of the scene.
shading The shading at this point.

Implements I3DExShader.

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

Override this method to implement your own Caustics calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
causticColor The resulting caustic color.
lightingContext Info about the point being shaded and the lighting of the scene.
shading The shading at this point.

Implements I3DExShader.

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

Override this method to implement your own direct lighting calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
result The result direct lighting. The fields fAmbient, fDiffuseLight, fSpecularLight, fLightShadow and fGlow should be filled.
lightingContext Info about the point being shaded and the lighting of the scene.

Implements I3DExShader.

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

Override this method to implement your own Global Illumination calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
indirectDiffuseColor The resulting indirect lighting color.
ambientOcclusionFactor The ambient occlusion factor.
lightingContext Info about the point being shaded and the lighting of the scene.
shading The shading at this point.

Implements I3DExShader.

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

Override this method to implement your own reflection calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
reflectionColor The resulting reflection color.
lightingContext Info about the point being shaded and the lighting of the scene.
shading The shading at this point.

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::CalculateSubsurfaceScattering ( TMCColorRGB subsurfaceColor,
const TMCColorRGB currentColor,
const LightingContext lightingContext,
const ShadingOut shading 
) [virtual]

Override this method to implement your own Subsurface Scattering calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
subsurfaceColor The resulting subsurface scattering color to add to the final color.
currentColor The current final color.
lightingContext Info about the point being shaded and the lighting of the scene.
shading The shading at this point.

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::CalculateTransparency ( TMCColorRGB resColor,
real32 outAlpha,
const LightingContext lightingContext,
const ShadingOut shading 
) [virtual]

Override this method to implement your own Transparency calculation. Note that if you have overriden ShadeAndLight2(), this method won't be called.

Parameters:
resColor The resulting transparency color to add to the final color.
outAlpha The resulting alpha.
lightingContext Info about the point being shaded and the lighting of the scene.
shading The shading at this point.

Implements I3DExShader.

virtual boolean MCCOMAPI TBasicShader::CanBeTransparent ( int32  shadingDomainIndex  )  [inline, virtual]

Return true if the shader can have some transparency.

Parameters:
shadingDomainIndex The shading domain that is considered.

Implements I3DExShader.

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::GetBumpAmplitude (  )  const [virtual]

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 MCCOMErr MCCOMAPI TBasicShader::GetConstantColor ( TMCColorRGBA resColor  )  const [virtual]

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::GetConstantValue ( real resValue  )  const [virtual]

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

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 boolean MCCOMAPI TBasicShader::GetRecommendedTextureSize ( uint32  channelIndex,
uint32 width,
uint32 height 
) const [virtual]

Calculate the intrinsic appropriate texture size.

Parameters:
[in] channelIndex The channel for which texture is searched

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::GetReflection ( TReflectionParameters reflectionParams,
const ShadingIn shadingIn 
) [virtual]

Returns the parameters used to calculate the reflection. This function is only called if the shader is placed in the reflection channel of a multichannel.

Do not forget to specify kUseGetReflection in GetImplementedOutput().

Parameters:
reflectionParams The parameters used for reflections calculations
shadingIn The info about the point to shade

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::GetRelevantTextureBucketCache ( uint32  channelIndex,
boolean  allowMultiplierModification,
IShTextureMapBucketCache **  outTextureMapFile 
) const [virtual]
Parameters:
[in] channelIndex The channel for which texture is searched Get the texture map file associated to the specified shading domain.

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::GetShaderApproxColor ( TMCColorRGBA result,
ShadingIn shadingIn 
) [virtual]

Returns information used to approximate the shading

Parameters:
result The approximation of the shading.
shadingIn The info about the point to shade.

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::GetShaderApproximation ( ShadingOut result,
ShadingIn shadingIn 
) [virtual]

Returns information used to approximate the shading

Parameters:
result The approximation of the shading.
shadingIn The info about the point to shade.

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::GetShaderPreview ( IShParameterComponent **  shader  )  [virtual]

Creates a shader that can be used to preview this shader.

Parameters:
shader Shader created to be used for the preview (this shader must be a clone).

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::GetShadersForChannel ( const uint32 uvSpaceID,
const uint32 channelIndex,
TMCPtrArray< I3DShShader > &  outShaders 
) [virtual]

Returns the shader part of a given uvspace / channel.

Parameters:
uvSpaceID The uvSpaceID for which we want the texture
channelIndex The index of the channel that we want (color,alpha,...)
outShaders Returns the list of the shaders found.

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 boolean MCCOMAPI TBasicShader::GetSubShaderPreview ( IShParameterComponent **  shader,
IShParameterComponent subShader,
FourCharT  subShaderKeyword 
) [virtual]

Creates a shader that can be used to preview one of the subshader.

Parameters:
shader Shader created to be used for the preview.
subShader Shader to put in the sub shader identified by the keyword subShaderKeyword.
subShaderKeyword Keywork of the sub shader (in the PMap).
Returns:
true if the shader created have to be processed by the parent shader, false if not.

Implements I3DExShader.

virtual EShaderFunctionType MCCOMAPI TBasicShader::GetSubShaderType ( IDType  keyword  )  [inline, virtual]

Get the type of a sub shader.

Parameters:
keyword Id of the sub shader.
Returns:
the type of the sub shader.

Implements I3DExShader.

virtual int16 MCCOMAPI TBasicShader::GetSubShaderViewID ( IDType  keyword  )  [inline, virtual]

Get the view id of a sub shader.

Parameters:
keyword Id of the sub shader.
Returns:
the view id (ressource id) of the view, or -1 if no view.

Implements I3DExShader.

virtual TMCColorRGB MCCOMAPI TBasicShader::GetTextureMultiplyColor (  )  const [virtual]

Implements I3DExShader.

virtual void MCCOMAPI TBasicShader::GetTransparency ( TTransparencyParameters transparencyParams,
const ShadingIn shadingIn 
) [virtual]

Returns the parameters used to calculate the transparency. This function is only called if the shader is placed in the transparency channel of a multichannel.

Parameters:
transparencyParams The parameters used for transparency calculations
shadingIn The info about the point to shade

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 ShadeAndLight2 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::IsChannelConstantInUVSpace ( const uint32 uvSpaceID,
const uint32 channelIndex 
) [virtual]

Return true if this channel is constant on that UV Space. If not, an exporter should try to bake a texture map.

Parameters:
uvSpaceID The UVSpaceID that is considered.
channelIndex The index of the channel

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 boolean MCCOMAPI TBasicShader::PreviewSubShaderAsTopShader ( IDType  keyword  )  [inline, virtual]

Returns true is the sub shader should be previewed as a top shader (only this one will be visible in the preview window)

Parameters:
keyword Id of the sub shader.

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 MCCOMErr MCCOMAPI TBasicShader::SetDefaultParameters (  )  [inline, virtual]

Set the parameters to the default values (especially to create default sub shaders).

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::SetupPreviewScene ( IPreviewMaker previewMaker,
I3DShMasterShader masterShader 
) [inline, virtual]

Setup the preview maker to render a preview of this shader.

Parameters:
previewMaker The preview maker to setup.
masterShader The master shader to be previewed.

Implements I3DExShader.

virtual MCCOMErr MCCOMAPI TBasicShader::ShadeAndLight2 ( LightingDetail result,
const LightingContext lightingContext,
I3DShLightingModel inDefaultLightingModel,
TAbsorptionFunction absorptionFunction 
) [virtual]

Calculates the shading and lighting in one point. You should only override this method if you want to implement advanced lighting effects in your shader. Note that you can override part of the lighting model by overriding CalculateDirectLighting() or CalculateReflection()...

Parameters:
result The lighting that is returned.
lightingContext Info about the point being shaded and the lighting of the scene.
inDefaultLightingModel A pointer to the default lighting model.
Returns:
MC_S_OK if you implemented this method, MC_E_NOTIMPL if not.

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 Apr 26 22:47:58 2010 for Carrara SDK Doc by  doxygen 1.6.3