IProjection_WorkingModelInfo Class Reference

IProjection_WorkingModelInfo Class Referenceabstract

#include <IProjection_WorkingModelInfo.h>

Class 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.
+ Inheritance diagram for IProjection_WorkingModelInfo:

Public Member Functions

virtual RenderInstanceGetRenderInstance ()=0
 Returns the render instance of the working model. More...
 
virtual int GetFaceNumber ()=0
 Returns the face number of that hit face. More...
 
virtual const Point3GetOrigNormal ()=0
 Returns the original interpolated normal. More...
 
virtual void GetBarycentricCoords (Point3 &bary)=0
 Returns the barycentric coordinates of the hit point. More...
 
virtual void GetBarycentricCoords (float &b0, float &b1, float &b2)=0
 
virtual BOOL GetBackFace ()=0
 Returns whether the backface was hit. More...
 
virtual const Point3GetPoint ()=0
 Returns the point that was hit, in camera space. More...
 
virtual const Point3GetViewDir ()=0
 Get the view direction, in camera space (equivalent to SContext::V()) More...
 
virtual const Point3GetOriginalViewDir ()=0
 Get the original view direction, in camera space (equivalent to SContext::OrigView()) More...
 
virtual int GetMaterialNumber ()=0
 Get the material number of the hit face. More...
 
virtual void BumpBasisVectors (Point3 dP[2], int axis, int channel)=0
 Get the bump basis vectors of the hit face (equivalent to SContext::BumpBasisVectors()) More...
 
virtual void TangentBasisVectors (Point3 dP[2], int mapChannel)=0
 Get the map basis vectors (aks bump basis vectors) interpolated at the current position. More...
 
virtual Interface_ID GetID ()
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual LifetimeType LifetimeControl ()
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

Static Public Member Functions

static IProjection_WorkingModelInfoGetInterface (ShadeContext &shadeContext)
 Query this interface on a shade context. More...
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 

Member Function Documentation

IProjection_WorkingModelInfo * GetInterface ( ShadeContext shadeContext)
inlinestatic

Query this interface on a shade context.

101  {
102 
104 }
Definition: IProjection_WorkingModelInfo.h:64
#define IPROJECTION_WORKINGMODELINFO_INTERFACE_ID
Definition: IProjection_WorkingModelInfo.h:99
virtual UtilExport BaseInterface * GetInterface(Interface_ID 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 ( )
inlinevirtual
Remarks
This method returns the unique interface ID.

Reimplemented from BaseInterface.

106  {
107 
109 }
#define IPROJECTION_WORKINGMODELINFO_INTERFACE_ID
Definition: IProjection_WorkingModelInfo.h:99