# Template.h

Go to the documentation of this file.

    00001 //***************************************************************************************
    00002 //
    00003 // File supervisor: Crosswalk team
    00004 //
    00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.
    00006 // Use of this software is subject to the terms of the Autodesk license agreement
    00007 // provided at the time of installation or download, or which otherwise accompanies
    00008 // this software in either electronic or hard copy form.
    00009 //
    00010 //***************************************************************************************
    00011
    00016 #ifndef _TEMPLATE_H
    00017 #define _TEMPLATE_H
    00018
    00019 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_XBOX)
    00020
    00021 // Disable "identifier was truncated to '255' characters in the debug information" warning.
    00022 #pragma warning( disable : 4786 )
    00023
    00024 // Disable warnings on extern before template instantiation.
    00025 #pragma warning( disable : 4231 )
    00026
    00027 #endif // defined(_WIN32) || defined(_WIN32_WCE)  || defined(_XBOX)
    00028
    00029 // Include files
    00030 #include "SLTypes.h"
    00031 #include <XSIParser.h>
    00032 #include <dotXSIDefines.h>
    00033
    00034
    00035 // Forward class declaration
    00036 class CSLScene;
    00037 class CSLModel;
    00038 class CSLCustomPSet;
    00039 class CSLUserDataBlob;
    00040 class CSLFCurve;
    00041 class CSLXSIUserKeyword;
    00042
    00058 class XSIEXPORT CSLTemplate : public CSIBCNode
    00059 {
    00060 public:
    00064     enum ETemplateType
    00065     {
    00066         SI_ACTION_FCURVE,
    00067         SI_ANGLE,
    00068         SI_AMBIENCE,
    00069         SI_BASE_SHAPE,
    00070         SI_CAMERA,
    00071         SI_CLUSTER,
    00072         SI_CONSTRAINT,
    00073         SI_COORDINATE_SYSTEM,
    00074         SI_CURVE_LIST,
    00075         SI_CUSTOM_PSET,
    00076         SI_CUSTOM_PARAM_INFO,
    00077         SI_DIRECTIONAL_LIGHT,
    00078         SI_ENVELOPE,
    00079         SI_ENVELOPE_LIST,
    00080         SI_FCURVE,
    00081         SI_FILE_INFO,
    00082         SI_FOG,
    00083         SI_GLOBAL_MATERIAL,
    00084         SI_IK_EFFECTOR,
    00085         SI_IK_JOINT,
    00086         SI_IK_ROOT,
    00087         SI_INFINITE_LIGHT,
    00088         SI_INSTANCE,
    00089         SI_LIGHT_INFO,
    00090         SI_MATERIAL,
    00091         SI_MATERIAL_LIBRARY,
    00092         SI_MESH,
    00093         SI_MODEL,
    00094         SI_NULL_OBJECT,
    00095         SI_NURBS_CURVE,
    00096         SI_NURBS_SURFACE,
    00097         SI_POINT_LIGHT,
    00098         SI_POLYGON_LIST,
    00099         SI_SCENE_INFO,
    00100         SI_SHAPE,
    00101         SI_SHAPE35,
    00102         SI_SHAPE_ANIMATION,
    00103         SI_SPOT_LIGHT,
    00104         SI_SURFACE_MESH,
    00105         SI_TEXTURE_2D,
    00106         SI_TRANSFORM,
    00107         SI_TRIANGLE_LIST,
    00108         SI_TRIANGLE_STRIP,
    00109         SI_TRIANGLE_STRIP_LIST,
    00110         SI_VISIBILITY,
    00111         XSI_ACTION,
    00112         XSI_ACTIONCLIP,
    00113         XSI_CUSTOM_PARAM_INFO,
    00114         XSI_EXTRAPOLATION,
    00115         XSI_FXOPERATOR,
    00116         XSI_FXTREE,
    00117         XSI_IMAGE,
    00118         XSI_IMAGE_DATA,
    00119         XSI_IMAGE_FX,
    00120         XSI_IMAGE_LIBRARY,
    00121         XSI_MATERIAL,
    00122         XSI_MATERIAL_INFO,
    00123         XSI_MIXER,
    00124         XSI_NURBS_PROJECTION,
    00125         XSI_NURBS_TRIM,
    00126         XSI_SHADER,
    00127         XSI_SHADER_INSTANCE_DATA,
    00128         XSI_STATIC_VALUES,
    00129         XSI_TIMECONTROL,
    00130         XSI_TRACK,
    00131         XSI_USER_DATA,
    00132         XSI_USER_DATA_LIST,
    00133         XSI_SUB_COMPONENT_ATTRIBUTE_LIST,
    00134         XSI_TRIANGLE_STRIP_LIST,
    00135         XSI_TRIANGLE_LIST,
    00136         XSI_POLYGON_LIST,
    00137         XSI_VERTEX_LIST,
    00138         XSI_SHAPE,
    00139         XSI_MESH,
    00140         XSI_SHAPE_ANIMATION,
    00141         XSI_CLUSTER_INFO,
    00142         XSI_USER_DATA_BLOB,
    00143         XSI_TRANSFORM,
    00144         XSI_LIMIT,
    00145         XSI_BASEPOSE,
    00146         COLLADA_MATERIAL,
    00147         COLLADA_EFFECT_LIBRARY,
    00148         COLLADA_EFFECT,
    00149         COLLADA_EFFECT_COMMON_PROFILE,
    00150         COLLADA_EFFECT_CG_PROFILE,
    00151         COLLADA_EFFECT_COMMON_PARAM,
    00152         COLLADA_EFFECT_COMMON_FLOAT,
    00153         COLLADA_EFFECT_COMMON_COLOR,
    00154         COLLADA_EFFECT_COMMON_TEXTURE,
    00155         COLLADA_EFFECT_COMMON_FLOAT_OR_PARAM,
    00156         COLLADA_EFFECT_COMMON_COLOR_OR_TEXTURE,
    00157         COLLADA_EFFECT_COMMON_SHADER,
    00158         COLLADA_EFFECT_SETPARAM,
    00159         XSI_IK_RESOLUTIONPLANE,
    00160         XSI_CAMERA,
    00161         XSI_POLYMATRICKS,
    00162         XSI_TRANSLATE,
    00163         XSI_ROTATE,
    00164         XSI_SCALE,
    00165         XSI_SHEAR,
    00166         XSI_LOOKAT,
    00167         XSI_MATRIX,
    00168         XSI_SHAPEREFERENCE,
    00169         XSI_ACTIONCLIPCONTAINER,
    00170         XSI_INDEX_LIST,
    00171         XSI_CAMERA_FOCALLENGTH,
    00172         XSI_SHADER_MULTI_PORT_CONNECTION,
    00173         XSI_IMAGE_FX2,
    00174         XSI_TEXTURE_LAYER,
    00175         XSI_TEXTURE_LAYER_PORT,
    00176         XSI_USER_KEYWORD,
    00177         XSI_CLIP_TO_PARENT,
    00178         XSI_SHADER_COMPOUND,
    00179         XSI_SHADER_COMPOUND_PORT,
    00180     };
    00181
    00185     enum EFCurveType
    00186     {
    00187         SI_COLOR_R,
    00188         SI_COLOR_G,
    00189         SI_COLOR_B,
    00190         SI_POSITION_X,
    00191         SI_POSITION_Y,
    00192         SI_POSITION_Z,
    00193         SI_ROLL,
    00194         SI_FOV,
    00195         SI_NEAR,
    00196         SI_FAR,
    00197         SI_INTEREST_X,
    00198         SI_INTEREST_Y,
    00199         SI_INTEREST_Z,
    00200         SI_CONE,
    00201         SI_SPREAD,
    00202         SI_ORIENTATION_X,
    00203         SI_ORIENTATION_Y,
    00204         SI_ORIENTATION_Z,
    00205         SI_DIFFUSE_R,
    00206         SI_DIFFUSE_G,
    00207         SI_DIFFUSE_B,
    00208         SI_DIFFUSE,
    00209         SI_PARAMETER,
    00210         SI_POWER,
    00211         SI_SPECULAR_R,
    00212         SI_SPECULAR_G,
    00213         SI_SPECULAR_B,
    00214         SI_EMISSIVE_R,
    00215         SI_EMISSIVE_G,
    00216         SI_EMISSIVE_B,
    00217         SI_AMBIENT_R,
    00218         SI_AMBIENT_G,
    00219         SI_AMBIENT_B,
    00220         SI_SCALING_X,
    00221         SI_SCALING_Y,
    00222         SI_SCALING_Z,
    00223         SI_ROTATION_X,
    00224         SI_ROTATION_Y,
    00225         SI_ROTATION_Z,
    00226         SI_TRANSLATION_X,
    00227         SI_TRANSLATION_Y,
    00228         SI_TRANSLATION_Z,
    00229         SI_SHPANIM,
    00230         SI_NODEVIS,
    00231         SI_HUE,
    00232         SI_GAIN,
    00233         SI_SATURATION,
    00234         SI_BRIGHTNESS,
    00235         SI_BLUR_RADIUS,
    00236         SI_BLUR_AMOUNT,
    00237         SI_BLUR_ALPHA,
    00238         SI_SCALING_TYPE,
    00239         SI_SCALE_X,
    00240         SI_SCALE_Y,
    00241         SI_FLIP_X,
    00242         SI_FLIP_Y,
    00243         SI_RGBA2GRAYSCALE,
    00244         SI_BITS_PER_CHANNEL,
    00245         SI_CROP_MIN_X,
    00246         SI_CROP_MAX_X,
    00247         SI_CROP_MIN_Y,
    00248         SI_CROP_MAX_Y,
    00249         SI_FALLOFF_ACTIVE,
    00250         SI_FALLOFF_START,
    00251         SI_FALLOFF_END,
    00252         SI_SHADOWS_ENABLED,
    00253         SI_UMBRA,
    00254         SI_LIGHT_AS_ENERGY,
    00255         SI_ENERGY_FACTOR,
    00256         SI_INTENSITY,
    00257     };
    00258
    00262     enum EFCurveInterpolationType
    00263     {
    00264         SI_CONSTANT,
    00265         SI_LINEAR,
    00266         SI_HERMITE,
    00267         SI_BEZIER,
    00268         SI_CUBIC,
    00269     };
    00270
    00274     enum ERotationOrder
    00275     {
    00276         SI_XYZ,
    00277         SI_XZY,
    00278         SI_YXZ,
    00279         SI_YZX,
    00280         SI_ZXY,
    00281         SI_ZYX,
    00282     };
    00283
    00286     CSLTemplate(CSLScene* in_pScene, CSLModel *in_pParentModel, CdotXSITemplate* in_pTemplate);
    00287     virtual ~CSLTemplate();
    00290     SI_Void SetName(SI_Char *in_szNewName);
    00293     SI_Char* GetName();
    00294
    00298     CSLModel* ParentModel();
    00299
    00303     CSLScene* Scene();
    00304
    00308     CdotXSITemplate* Template();
    00309
    00310     // FCurve manipulation functions
    00316     CSLFCurve* CreateFCurve(EFCurveType in_Type, EFCurveInterpolationType in_InterpolationType);
    00317
    00323     virtual CSLFCurve* CreateParameterFCurve(SI_Char* in_szParameterName, EFCurveInterpolationType in_InterpolationType);
    00324
    00325
    00330     SI_Error DestroyFCurve(EFCurveType in_Type);
    00331
    00336     CSLFCurve* RemoveFCurveAt(SI_Int in_Index);
    00337
    00341     CSLFCurve **FCurves();
    00342
    00346     SI_Int GetFCurveCount();
    00347
    00352     CSLFCurve* GetSpecificFCurve(EFCurveType in_Type);
    00353
    00358     CSLFCurve* GetParameterFCurve(SI_Char* in_szParameterName);
    00359
    00363     SI_Error ClearFCurves();
    00364
    00365     // Custom parameter set manipulation functions.
    00366     //todo : respect naming convention.
    00367
    00368
    00372     CSLCustomPSet* AddCustomPSet();
    00373
    00377     SI_Error ClearCustomPSets();
    00378
    00382     CSLCustomPSet** GetCustomPSetList();
    00383
    00387     CSLCustomPSet* FindCustomPSet(char *in_pName);
    00388
    00392     SI_Int GetCustomPSetCount();
    00393
    00397     SI_Error RemoveCustomPSet(SI_Int in_nIndex);
    00398
    00402     SI_Error RemoveCustomPSet(CSLCustomPSet *in_pToRemove);
    00403
    00404     // Connection functions.
    00409     CSLFCurve *ConnectFCurve(CSLFCurve *in_pNewFCurve);
    00410
    00415     CSLCustomPSet *ConnectCustomPSet(CSLCustomPSet *in_pNewCustomPSet);
    00416
    00420     virtual SI_Error Fix();
    00421
    00425     virtual SI_Error Synchronize();
    00426
    00430     virtual ETemplateType Type() = 0;
    00431
    00436     virtual CSLAnimatableType* ParameterFromName(SI_Char *in_szName);
    00437
    00443     virtual CSLAnimatableType* ParameterFromType(EFCurveType in_Type, SI_Char *in_szParameterName);
    00444
    00448     virtual SI_Char* FullName();
    00449
    00454     CSLUserDataBlob *ConnectUserDataBlob(CSLUserDataBlob *in_pNewUserDataBlob);
    00455
    00456
    00460     CSLUserDataBlob* AddUserDataBlob();
    00461
    00465     SI_Error ClearUserDataBlobs();
    00466
    00470     CSLUserDataBlob** GetUserDataBlobList();
    00471
    00475     SI_Int GetUserDataBlobCount();
    00476
    00480     SI_Error RemoveUserDataBlob(SI_Int in_nIndex);
    00481
    00485     SI_Error RemoveUserDataBlob(CSLUserDataBlob *in_pToRemove);
    00486
    00490     CSLXSIUserKeyword* GetUserKeyword();
    00491
    00495     CSLXSIUserKeyword*  CreateUserKeyword();
    00496
    00501     CSLXSIUserKeyword* ConnectUserKeyword(CSLXSIUserKeyword* in_pToConnect);
    00502
    00507     virtual const SI_Char* GetParameterName(CSLAnimatableType* in_pParameter);
    00508
    00512     SI_Bool AreFullNamesExported();
    00513
    00514     SI_Error Connect ( CdotXSITemplate* in_pConnection );
    00515
    00516
    00521     virtual SI_Error Evaluate( SI_Float in_fTime );
    00522
    00523 protected:
    00529     SI_Error SetParent( CSLModel *in_pNewParent );
    00530     CSLAnimatableType** m_pConnectionMap;
    00531
    00532     CSIBCArray<CSLCustomPSet *>     m_CustomPSets;
    00533     CSIBCArray<CSLFCurve *>         m_FCurves;
    00534     CSIBCArray<CSLUserDataBlob *>   m_UserDataBlobs;
    00535
    00536 private:
    00537     CSLFCurve* CreateCOLLADAFCurve(EFCurveType in_Type, EFCurveInterpolationType in_InterpolationType);
    00538     CSLFCurve* CreateCOLLADAParameterFCurve(SI_Char* in_szParameterName, EFCurveInterpolationType in_InterpolationType);
    00539
    00540     CdotXSITemplate*                m_pTemplate;
    00541     CSLScene*                       m_pScene;
    00542     CSLModel*                       m_pParentModel;
    00543     CSIBCString*                    m_szFullName;
    00544     CSLXSIUserKeyword*              m_pUserKeyword;
    00545     void*                           m_pReserved;
    00546 };
    00547
    00548 #endif