ParamDimension.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 #pragma once
00012 #include "MaxHeap.h"
00013 #include "CoreExport.h"
00014 #include "strbasic.h"
00015 
00016 // This must be updated if a new entry is added to DimType!
00017 #define NUM_BUILTIN_DIMS    10
00018 
00023 enum DimType {
00024     DIM_WORLD,
00025     DIM_ANGLE,
00026     DIM_COLOR,      //0-1
00027     DIM_COLOR255,   //0-255
00028     DIM_PERCENT,    //0-100
00029     DIM_NORMALIZED, //0-1
00030     DIM_SEGMENTS,
00031     DIM_TIME,
00032     DIM_CUSTOM,
00033     DIM_NONE
00034 };
00036 
00037 // These two classes describe the dimension of a parameter (sub-anim).
00038 // The dimension type and possibly the dimension scale (if the type is
00039 // custom) are used to determine a scale factor for the parameter.
00040 // When a controller is drawing a function curve, it only needs to
00041 // use the Convert() function - the scale factor is rolled into the single
00042 // 'vzoom' parameter passed to PaintFCurves.
00043 // So, for a controller to plot a value 'val' at time t it would do the
00044 // following:
00045 // int x = TimeToScreen(t,tzoom,tscroll);
00046 // int y = ValueToScreen(dim->Convert(val),rect.h()-1,vzoom,vscroll);
00047 //
00062 class ParamDimensionBase: public MaxHeapOperators {
00063     public:
00065         virtual ~ParamDimensionBase() {}
00067         virtual DimType DimensionType()=0;
00074         virtual float Convert(float value)=0;
00080         virtual float UnConvert(float value)=0;
00081 }; 
00082 
00146 class ParamDimension : public ParamDimensionBase {
00147     public:
00148         // If the DimType is custom than these must be implemented.
00150         virtual float GetDimScale() {return 1.0f;}
00152         virtual void SetDimScale() {}
00154         virtual MCHAR* DimensionName() {return _M("");}     
00155 };
00156 
00157 // These point to default implementations for the standard DIM types.
00158 CoreExport extern ParamDimension *defaultDim;
00159 CoreExport extern ParamDimension *stdWorldDim;
00160 CoreExport extern ParamDimension *stdAngleDim;
00161 CoreExport extern ParamDimension *stdColorDim;
00162 CoreExport extern ParamDimension *stdColor255Dim;
00163 CoreExport extern ParamDimension *stdPercentDim;
00164 CoreExport extern ParamDimension *stdNormalizedDim;
00165 CoreExport extern ParamDimension *stdSegmentsDim;
00166 CoreExport extern ParamDimension *stdTimeDim;