Public Member Functions | Static Public Member Functions | Public Attributes

MSPluginAtmos Class Reference

Search for all occurrences

#include <mxsPlugin.h>

Inheritance diagram for MSPluginAtmos:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  MSPluginAtmos ()
  MSPluginAtmos (MSPluginClass *pc, BOOL loading)
  ~MSPluginAtmos ()
RefTargetHandle  Clone (RemapDir &remap)
  This method is used by 3ds Max to clone an object.
AtmosParamDlg CreateParamDialog (IRendParams *ip)
BOOL  SetDlgThing (AtmosParamDlg *dlg)
void  Shade (ShadeContext &sc, const Point3 &p0, const Point3 &p1, Color &color, Color &trans, BOOL isBG=FALSE)
Atmospheric to_atmospheric ()

Static Public Member Functions

static RefTargetHandle  create (MSPluginClass *pc, BOOL loading)

Public Attributes

MSAutoEParamDlg masterFXDlg

Constructor & Destructor Documentation

MSPluginAtmos ( ) [inline]
{ }
MSPluginAtmos ( MSPluginClass *  pc,
BOOL  loading 
)
~MSPluginAtmos ( ) [inline]

Member Function Documentation

static RefTargetHandle create ( MSPluginClass *  pc,
BOOL  loading 
) [static]
RefTargetHandle Clone ( RemapDir remap ) [virtual]

This method is used by 3ds Max to clone an object.

See also:
CloneRefHierarchy(), class RemapDir This method is called by 3ds Max to have the plugin clone itself. The plug-in's implementation of this method should copy both the data structure and all the data residing in the data structure of this reference target. The plugin should clone all its references as well. Also, the plug-in's implementation of this method must call BaseClone(). In order for classes derived from this class to clone cleanly, the Clone method should just create the new instance, and then call an implementation of BaseClone that clones the references and copies any other necessary data. For example:
            class MyDerivedPlugin
                : public MyBasePlugin
            {
                const int MY_REFERENCE = 1;

                ReferenceTarget* Clone(RemapDir& remap)
                {
                    ReferenceTarget* result = new MyDerivedPlugin();
                    BaseClone(this, result, remap);
                    return result;
                }

                void BaseClone(ReferenceTarget* from, ReferenceTarget* to, RemapDir& remap)
                {
                    if (!to || !from || from == to)
                        return;    
                    MyBasePlugin::BaseClone(from, to, remap);
                    to->ReplaceReference(MY_REFERENCE, remap->CloneRef(from->GetReference(MY_REFERENCE)));
                }
            };

This method should not be directly called by plug-ins. Instead, either RemapDir::CloneRef() or CloneRefHierachy() should be used to perform cloning. These methods ensure that the mapping from the original object to the clone is added to the RemapDir used for cloning, which may be used during backpatch operations

Note:
See the remarks in method BaseClone() below.
Parameters:
remap - A RemapDir instance used for remapping references during a Clone.
Returns:
A pointer to the cloned item.

Reimplemented from ReferenceTarget.

Reimplemented in MSAtmosXtnd.

AtmosParamDlg* CreateParamDialog ( IRendParams ip ) [virtual]
Remarks:
This method creates and returns a new instance of a class derived from AtmosParamDlg to manage the user interface. This put up a modal dialog that lets the user edit the plug-ins parameters.
Parameters:
IRendParams *ip

This is the interface given to the atmospheric effect so it may display its parameters.
Returns:
A new instance of a class derived from AtmosParamDlg.

Note: typedef SFXParamDlg AtmosParamDlg;
Default Implementation:
{return NULL;}

Reimplemented from Atmospheric.

Reimplemented in MSAtmosXtnd.

BOOL SetDlgThing ( AtmosParamDlg dlg ) [virtual]
Remarks:
You should implement this if you are using the ParamMap2 AUTO_UI system and the effect has secondary dialogs that have something other than the incoming effect as their 'thing'. Called once for each secondary dialog for you to install the correct thing. Return TRUE if you process the dialog, FALSE otherwise, in which case the incoming effect will be set into the dialog.

Note: Developers needing more information on this method can see the remarks for MtlBase::CreateParamDlg() which describes a similar example of this method in use (in that case it's for use by a texture map plug-in).
Parameters:
AtmosParamDlg* dlg

Points to the ParamDlg.
Default Implementation:
{ return FALSE; }

Reimplemented from Atmospheric.

Reimplemented in MSAtmosXtnd.

void Shade ( ShadeContext sc,
const Point3 p0,
const Point3 p1,
Color color,
Color trans,
BOOL  isBG = FALSE 
) [inline, virtual]
Remarks:
This is the function that is called to apply the atmospheric effect. The line segment defined by the world space points p0 and p1 represent a segment of volume that needs to be shaded. This line segment is a line along the ray defined by the line between the viewer's eye (the camera) and the pixel being rendered in the image plane and continuing through world space. This ray is broken up into segments, with the boundaries defined by surfaces. If there are no surfaces, there will just be a single segment from the eye point going off into space (p1 will be a large number). If there is a surface that is hit, and the surface is opaque, there will still be one segment from the eye to the surface. If the surface is transparent there may be two segments, the segment before and the segment after. Therefore the ray may be broken up into many segments depending on the number of transparent surfaces hit.

The shader does not need to be directly concerned with this however. It only knows it's shading the segment between p0 and p1. It will get called repeatedly for different pixels and different segments.

The output of this method is the computed color and transparency.

An example implementation of this method is 3ds Max's Simple Fog. It takes the distance of the line segment and essentially interpolates towards the fog color based on the distance. This is a very simple effect.

3ds Max's Volume Fog traverses along the segment and evaluates its 3D noise function. It integrates the density across the segment, and uses the density to compute the fog color.
Parameters:
ShadeContext& sc

The ShadeContext.

const Point3& p0

The start point of the segment to shade. This point (and p1) are in an undefined 'internal' space specific to the renderer (which for the 3ds Max renderer is in fact is camera space). To get to world space the plug-in would call sc.PointTo(p0,REF_WORLD).

const Point3& p1

The end point of the segment to shade.

Color& color

This method shades the volume between p0 and p1 and modifies this color.

Color& trans

This method shades the volume between p0 and p1 and modifies this transparency.

BOOL isBG=FALSE

TRUE if the background is being shaded; otherwise FALSE. If TRUE then p1 will be infinity (a large number). This is used when the option to not fog the background is on.

Implements Atmospheric.

Reimplemented in MSAtmosXtnd.

{ };
Atmospheric* to_atmospheric ( ) [inline, virtual]

Reimplemented from Value.

{ return this; }

Member Data Documentation


MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos
MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos MSPluginAtmos