Detailed Description
- See also:
- Class MtlBase,
Class ShadeContext, Class MapSampler, Class Point2, Class Point3, Class Matrix3.
- Description:
- Most texture maps that use UV coordinates will use an instance
of this class. This class encapsulates much of the user interface
functionality for setting mirroring, tiling and so on. These are
the settings found in the 'Coordinate' and 'Noise' rollup pages.
This class generates UV coordinates based on the results of a UV
source provided by the plug-in and the user specified
transformations. An instance of this class is referenced by all the
2D texture maps. All methods of this class are implemented by the
system.
The following four methods are the only ones a plug-in needs to
call typically:
#include <imtl.h>
List of all
members.
Public Member Functions
|
virtual
void |
GetUV
(ShadeContext
&sc, Point2 &UV,
Point2 &dUV)=0 |
virtual
AColor |
EvalUVMap
(ShadeContext
&sc, MapSampler
*samp, BOOL filter=TRUE)=0 |
virtual
float |
EvalUVMapMono
(ShadeContext
&sc, MapSampler
*samp, BOOL filter=TRUE)=0 |
virtual
Point2 |
EvalDeriv
(ShadeContext
&sc, MapSampler
*samp, BOOL filter=TRUE)=0 |
virtual
void |
GetBumpDP
(ShadeContext
&sc, Point3
&dPdu, Point3
&dPdv)=0 |
virtual
void |
GetUVTransform
(Matrix3
&uvtrans)=0 |
virtual
int |
GetTextureTiling
()=0 |
virtual
void |
SetTextureTiling
(int t)=0 |
virtual
int |
GetUVWSource
()=0 |
virtual
int |
GetMapChannel
() |
virtual
void |
SetUVWSource
(int s)=0 |
virtual
void |
SetMapChannel
(int s) |
virtual
int |
SymFlags
()=0 |
virtual
void |
SetSymFlags
(int f)=0 |
virtual
int |
GetSlotType
()=0 |
virtual
void |
InitSlotType
(int sType)=0 |
virtual
int |
GetAxis
()=0 |
virtual
void |
SetAxis
(int ax)=0 |
virtual
void |
SetClipFlag
(BOOL b)=0 |
virtual
BOOL |
GetClipFlag
()=0 |
virtual
BOOL |
IsStdUVGen
() |
SClass_ID |
SuperClassID
() |
|
Retrieves a constant representing the type
of the plugin.
|
virtual
void |
SetRollupOpen
(BOOL open)=0 |
virtual
BOOL |
GetRollupOpen
()=0 |
CoreExport
SvGraphNodeReference |
SvTraverseAnimGraph
(IGraphObjectManager *gom,
Animatable *owner,
int id, DWORD flags) |
CoreExport
MSTR |
SvGetName
(IGraphObjectManager *gom,
IGraphNode *gNode,
bool isBeingEdited) |
Member Function Documentation
- Parameters:
- ShadeContext& sc
Describes the properties of the point to evaluate.
Point2&
UV
The UV texture coordinates for the point.
Point2&
dUV
The derivatives of UV for the point to shade. This describes how
big of a range in UV space the current pixel covers.
- Parameters:
- ShadeContext &sc
Describes the properties of the point to evaluate.
MapSampler* samp
This is a callback used to sample the map. The plug-in creates an
instance of this class, and implements its methods. A pointer to
the instance is passed here. The methods of the class sample the
texture for a single UV coordinate.
BOOL filter=TRUE
If TRUE the texture will be filtered.
- Returns:
- The result as an AColor.
- Parameters:
- ShadeContext &sc
Describes the properties of the point to evaluate.
MapSampler* samp
This is a callback used to sample the map. The plug-in creates an
instance of this class, and implements its methods. A pointer to
the instance is passed here. The methods of the class sample the
texture for a single UV coordinate.
BOOL filter=TRUE
If TRUE the texture will be filtered.
- Returns:
- The result as a float.
The following two methods are called for bump mapping to retrieve a
normal perturbation. The calling sequence for these methods is
shown in the sample code below. This code takes the sum of the U
derivative times the U bump vector, and the V derivative times the
V bump vector. The result is the normal perturbation returned from
EvalNormalPerturb().
Point3 BMTex::EvalNormalPerturb(ShadeContext& sc)
{
Point3 dPdu, dPdv;
if (thebm==NULL)
return Point3(0,0,0);
uvGen->GetBumpDP(sc,dPdu,dPdv);
Point2 dM =(.01f)*uvGen->EvalDeriv(sc,&mysamp,filterType!=FILTER_NADA);
return texout->Filter(dM.x*dPdu+dM.y*dPdv);
}
Note: In the following code you'll see the 'text book' Blinn's
algorithm and the 'Lazy' approach that is actually used. During
testing it was determined that these two methods are visually
identical. The 'Lazy' algorithm avoids the cross products however.
Point3 Gradient::EvalNormalPerturb(ShadeContext\& sc) {
Point3 dPdu, dPdv;
Point2 dM = uvGen->EvalDeriv(sc,\&mysamp);
uvGen->GetBumpDP(sc,dPdu,dPdv);
return texout->Filter(dM.x*dPdu+dM.y*dPdv);
}
- Parameters:
- ShadeContext& sc
Describes the properties of the point to evaluate.
MapSampler* samp
This is a callback used to sample the map. The plug-in creates an
instance of this class, and implements its methods. A pointer to
the instance is passed here. The methods of the class sample the
texture for a single UV coordinate.
BOOL filter=TRUE
If TRUE the texture will be filtered.
- Returns:
- df/du, df/dv as a Point2.
- Parameters:
- ShadeContext& sc
Describes the properties of the point to evaluate.
Point3& dPdu,
Point3&
dPdv
The bump basis vectors are returned here.
virtual void GetUVTransform |
( |
Matrix3 & |
uvtrans |
) |
[pure virtual] |
virtual int GetTextureTiling |
( |
|
) |
[pure virtual] |
virtual void SetTextureTiling |
( |
int |
t |
) |
[pure virtual] |
virtual int GetUVWSource |
( |
|
) |
[pure virtual] |
- Returns:
- One of the following values:
UVWSRC_EXPLICIT
Use explicit mesh texture vertices from channel 1.
UVWSRC_EXPLICIT2
Use explicit mesh texture vertices from channel 2.
UVWSRC_OBJXYZ
Generate planar UVW mapping coordinates from the object XYZ
on-the-fly.
virtual int GetMapChannel |
( |
|
) |
[inline, virtual] |
virtual void SetUVWSource |
( |
int |
s |
) |
[pure virtual] |
- Parameters:
- int s
One of the following values:
UVWSRC_EXPLICIT
Use explicit mesh texture vertices from one of the mapping channels
(as established by SetMapChannel()
below).
UVWSRC_EXPLICIT2
Use explicit mesh texture vertices from the Vertex Color Channel.
UVWSRC_OBJXYZ
Generate planar UVW mapping coordinates from the object XYZ
on-the-fly.
UVWSRC_WORLDXYZ
This parameter is available in release 3.0 and later only.
Generate planar uvw mapping from world xyz on-the-fly.
virtual void SetMapChannel |
( |
int |
s |
) |
[inline, virtual] |
- Parameters:
- int s
The mapping channel value to set.
- Default Implementation:
- {}
Reimplemented in StdUVGen.
virtual int SymFlags |
( |
|
) |
[pure virtual] |
virtual void SetSymFlags |
( |
int |
f |
) |
[pure virtual] |
virtual int GetSlotType |
( |
|
) |
[pure virtual] |
virtual void InitSlotType |
( |
int |
sType |
) |
[pure virtual] |
- Parameters:
- int sType
One of the following values:
MAPSLOT_TEXTURE
This is either texture coordinates.
MAPSLOT_ENVIRON
Environment coordinates.
virtual int GetAxis |
( |
|
) |
[pure virtual] |
- Returns:
- One of the following values:
AXIS_UV
AXIS_VW
AXIS_WU
virtual void SetAxis |
( |
int |
ax |
) |
[pure virtual] |
- Parameters:
- int ax
One of the following values:
AXIS_UV
AXIS_VW
AXIS_WU
virtual void SetClipFlag |
( |
BOOL |
b |
) |
[pure virtual] |
- Parameters:
- BOOL b
TRUE to clip; FALSE to not clip.
virtual BOOL GetClipFlag |
( |
|
) |
[pure virtual] |
- Returns:
- TRUE for clipped; FALSE if not clipped.
virtual BOOL IsStdUVGen |
( |
|
) |
[inline, virtual] |
- Default Implementation:
- { return FALSE; }
Reimplemented in StdUVGen.
SClass_ID SuperClassID |
( |
|
) |
[inline, virtual] |
Retrieves a constant representing the type of the plugin.
- Returns:
- A super class id that uniquely identifies the type (category)
of the plugin. Note that several plugin classes can be of the same
type, thus return the same super class id. Plugins are uniquely
identified by their class ids. List of Super Class
IDs.
- See also:
- SClass_ID
Reimplemented from ReferenceTarget.
virtual void SetRollupOpen |
( |
BOOL |
open |
) |
[pure virtual] |
- Parameters:
- BOOL open
TRUE for open; FALSE for closed.
virtual BOOL GetRollupOpen |
( |
|
) |
[pure virtual] |
- Returns:
- TRUE is open; FALSE is closed.
- Parameters:
-
gom |
Points to the schematic view window manager. |
gNode |
Points to this node in the schematic view. |
isBeingEdited |
TRUE if the item is being edited; FALSE if not. |
- Default Implementation:
-
{
Animatable *owner;
int subNum;
MSTR name;
owner = gNode->GetOwner();
subNum = gNode->GetID();
name = owner->SubAnimName(subNum);
return name;
}
Reimplemented from MtlBase.