Public Member Functions | Static Public Member Functions

IProjection_WorkingModelInfo Class Reference

Search for all occurrences

Detailed Description

See also:
Class ShadeContext
Description:
This interface provides access to some shade context information for the working model. It is used when performing a projection mapped Render To Texture, to support shading operations on the reference models which additionally require information about the working model.

This interface is provided by the renderer to Texture Bake elements, when performing a Render To Texture (RTT) in projection mode. In this mode, pixels are shaded as follows. First, the renderer locates a point on the working model. A ray is cast to locate a corresponding point on one of the reference models. Material shading proceeds on the reference model instead of the working model. The material is responsible for invoking each texture bake element and render element, as part of its shading operation. However, the texture bake elements might need information about the working model, and the shade context only contains information for the reference model. The renderer solves this problem by attaching an IProjection_WorkingModelInfo interface to the ShadeContext that it passes to the material.

When a bake projection is done, all the information in the shade context is overriden to represent the intersection point on the projected object. If a bake render element still needs access to shade context information from the original object (the working model), then this interface may be used.

This interface provides a render instance of the working model and information about the working model point being shaded. It should be queried from the shade context through ShadeContext::GetInterface(). A NULL pointer will be returned if no projection was done.
Examples:
For an example of usage, please refer to the Normal Map and Height Map texture bake elements, in the SDK samples maxsdk\samples\render\renderelements\stdBakeElem.cpp.

#include <IProjection_WorkingModelInfo.h>

Inheritance diagram for IProjection_WorkingModelInfo:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual RenderInstance GetRenderInstance ()=0
  Returns the render instance of the working model.
virtual int  GetFaceNumber ()=0
  Returns the face number of that hit face.
virtual const Point3 GetOrigNormal ()=0
  Returns the original interpolated normal.
virtual void  GetBarycentricCoords (Point3 &bary)=0
  Returns the barycentric coordinates of the hit point.
virtual void  GetBarycentricCoords (float &b0, float &b1, float &b2)=0
virtual BOOL  GetBackFace ()=0
  Returns whether the backface was hit.
virtual const Point3 GetPoint ()=0
  Returns the point that was hit, in camera space.
virtual const Point3 GetViewDir ()=0
  Get the view direction, in camera space (equivalent to SContext::V())
virtual const Point3 GetOriginalViewDir ()=0
  Get the original view direction, in camera space (equivalent to SContext::OrigView())
virtual int  GetMaterialNumber ()=0
  Get the material number of the hit face.
virtual void  BumpBasisVectors (Point3 dP[2], int axis, int channel)=0
  Get the bump basis vectors of the hit face (equivalent to SContext::BumpBasisVectors())
virtual void  TangentBasisVectors (Point3 dP[2], int mapChannel)=0
  Get the map basis vectors (aks bump basis vectors) interpolated at the current position.
virtual Interface_ID  GetID ()

Static Public Member Functions

static
IProjection_WorkingModelInfo
GetInterface (ShadeContext &shadeContext)
  Query this interface on a shade context.

Member Function Documentation

IProjection_WorkingModelInfo * GetInterface ( ShadeContext shadeContext ) [inline, static]

Query this interface on a shade context.

                                                                                                          {

    return static_cast<IProjection_WorkingModelInfo*>(shadeContext.GetInterface(IPROJECTION_WORKINGMODELINFO_INTERFACE_ID));
}
virtual RenderInstance* GetRenderInstance ( ) [pure virtual]

Returns the render instance of the working model.

virtual int GetFaceNumber ( ) [pure virtual]

Returns the face number of that hit face.

virtual const Point3& GetOrigNormal ( ) [pure virtual]

Returns the original interpolated normal.

virtual void GetBarycentricCoords ( Point3 bary ) [pure virtual]

Returns the barycentric coordinates of the hit point.

virtual void GetBarycentricCoords ( float &  b0,
float &  b1,
float &  b2 
) [pure virtual]
virtual BOOL GetBackFace ( ) [pure virtual]

Returns whether the backface was hit.

virtual const Point3& GetPoint ( ) [pure virtual]

Returns the point that was hit, in camera space.

virtual const Point3& GetViewDir ( ) [pure virtual]

Get the view direction, in camera space (equivalent to SContext::V())

virtual const Point3& GetOriginalViewDir ( ) [pure virtual]

Get the original view direction, in camera space (equivalent to SContext::OrigView())

virtual int GetMaterialNumber ( ) [pure virtual]

Get the material number of the hit face.

virtual void BumpBasisVectors ( Point3  dP[2],
int  axis,
int  channel 
) [pure virtual]

Get the bump basis vectors of the hit face (equivalent to SContext::BumpBasisVectors())

virtual void TangentBasisVectors ( Point3  dP[2],
int  mapChannel 
) [pure virtual]

Get the map basis vectors (aks bump basis vectors) interpolated at the current position.

Interface_ID GetID ( ) [inline, virtual]
Remarks:
This method returns the unique interface ID.

Reimplemented from BaseInterface.

                                                        {

    return IPROJECTION_WORKINGMODELINFO_INTERFACE_ID;
}

IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo
IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo IProjection_WorkingModelInfo