maxtypes.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 // FILE:        maxtypes.h
00012 // DESCRIPTION: Typedefs for general jaguar types.
00013 // AUTHOR:      Rolf Berteig
00014 // HISTORY:     created 19 November 1994
00015 //**************************************************************************/
00016 
00017 #pragma once
00018 
00019 #include "maxheap.h"
00020 #include <wtypes.h>
00021 #include <basetsd.h>
00022 
00023 typedef unsigned long ulong;
00024 typedef unsigned char uchar;
00025 typedef uchar UBYTE;
00026 typedef unsigned short USHORT;
00027 typedef unsigned short UWORD;
00028 typedef __int64        INT64;
00029 typedef unsigned short MtlID;               
00030 
00033 
00034 
00035 struct Color24: public MaxHeapOperators {
00036     Color24(uchar vr = 0, uchar vg = 0, uchar vb = 0): r(vr), g(vg), b(vb) {}
00037     uchar r,g,b;
00038 };
00039 
00041 
00042 struct Color48: public MaxHeapOperators {
00043     Color48(UWORD vr = 0, UWORD vg = 0, UWORD vb = 0): r(vr), g(vg), b(vb) {}
00044     UWORD r,g,b;
00045 };
00046 
00048 
00049 struct Color64: public MaxHeapOperators { 
00050     Color64(UWORD vr = 0, UWORD vg = 0, UWORD vb = 0, UWORD va = 0): r(vr), g(vg), b(vb), a(va) {}
00051     UWORD r,g,b,a;
00052 };
00053 
00054 //-- Pixel storage classes used by BitmapManager ----------------------------------------------------
00055 
00057 
00058 struct BMM_Color_24: public MaxHeapOperators {
00059     BMM_Color_24(BYTE vr = 0, BYTE vg = 0, BYTE vb = 0): r(vr), g(vg), b(vb) {}
00060     BYTE r,g,b;
00061 };
00062 
00064 
00065 struct BMM_Color_32: public MaxHeapOperators {
00066     BMM_Color_32(BYTE vr = 0, BYTE vg = 0, BYTE vb = 0, BYTE va = 0): r(vr), g(vg), b(vb), a(va) {}
00067     BYTE r,g,b,a;
00068 };
00069 
00071 
00072 struct BMM_Color_48: public MaxHeapOperators {
00073     BMM_Color_48(WORD vr = 0, WORD vg = 0, WORD vb = 0): r(vr), g(vg), b(vb) {}
00074     WORD r,g,b;
00075 };
00076 
00078 
00079 struct BMM_Color_64: public MaxHeapOperators {
00080     BMM_Color_64(WORD vr = 0, WORD vg = 0, WORD vb = 0, WORD va = 0): r(vr), g(vg), b(vb), a(va) {}
00081     WORD r,g,b,a;
00082 };
00083 
00085 
00086 struct BMM_Color_fl : public MaxHeapOperators
00087 {
00088     BMM_Color_fl(float vr = 0.0f, float vg = 0.0f, float vb = 0.0f, float va = 0.0f): r(vr), g(vg), b(vb), a(va) {}
00089 
00091     float r,g,b,a;
00092 
00094     operator float*() { return &r; }
00096     operator const float*() const { return &r; }
00097 
00099     static WORD clipColor(float c)
00100     {
00101         return c <= 0.0f ? 0 : c >= 1.0f ? 65535 : (WORD)(c * 65535.0);
00102     }
00103 };
00105 
00106 /* Time:
00107 */
00108 typedef int TimeValue;
00109 
00110 #define TIME_TICKSPERSEC    4800
00111 
00112 #define TicksToSec( ticks ) ((float)(ticks)/(float)TIME_TICKSPERSEC)
00113 #define SecToTicks( secs ) ((TimeValue)(secs*TIME_TICKSPERSEC))
00114 #define TicksSecToTime( ticks, secs ) ( (TimeValue)(ticks)+SecToTicks(secs) )
00115 #define TimeToTicksSec( time, ticks, secs ) { (ticks) = (time)%TIME_TICKSPERSEC; (secs) = (time)/TIME_TICKSPERSEC ; } 
00116 
00117 #define TIME_PosInfinity    TimeValue(0x7fffffff)
00118 #define TIME_NegInfinity    TimeValue(0x80000000)
00119 
00120 
00121 //-----------------------------------------------------
00122 // Class_ID
00123 //-----------------------------------------------------
00136 class Class_ID: public MaxHeapOperators {
00137     ULONG a,b;
00138 public:
00141     Class_ID() { a = b = 0xffffffff; }
00147     Class_ID(const Class_ID& cid) { a = cid.a; b = cid.b;   }
00156     Class_ID(ulong aa, ulong bb) { a = aa; b = bb; }
00158     ULONG PartA() const { return a; }
00162     ULONG PartB() const { return b; }
00163     void SetPartA( ulong aa ) { a = aa; } //-- Added 11/21/96 GG
00164     void SetPartB( ulong bb ) { b = bb; }
00166     int operator==(const Class_ID& cid) const { return (a==cid.a&&b==cid.b); }
00168     int operator!=(const Class_ID& cid) const { return (a!=cid.a||b!=cid.b); }
00171     Class_ID& operator=(const Class_ID& cid)  { a=cid.a; b = cid.b; return (*this); }
00172     // less operator - allows for ordering Class_IDs (used by stl maps for example) 
00177     bool operator<(const Class_ID& rhs) const
00178     {
00179         if ( a < rhs.a || ( a == rhs.a && b < rhs.b ) )
00180             return true;
00181 
00182         return false;
00183     }
00184 };
00185 
00186 // SuperClass ID
00187 typedef ULONG SClass_ID;    // SR NOTE64: was ULONG_PTR, which was WRONG.
00188 
00199 class Interface_ID: public MaxHeapOperators {
00200     ULONG a,b;
00201 public:
00204     Interface_ID() { a = b = 0xffffffff; }
00210     Interface_ID(const Interface_ID& iid) { a = iid.a; b = iid.b;   }
00219     Interface_ID(ulong aa, ulong bb) { a = aa; b = bb; }
00221     ULONG PartA() { return a; }
00223     ULONG PartB() { return b; }
00228     void SetPartA( ulong aa ) { a = aa; }
00233     void SetPartB( ulong bb ) { b = bb; }
00239     int operator==(const Interface_ID& iid) const { return (a==iid.a&&b==iid.b); }
00245     int operator!=(const Interface_ID& iid) const { return (a!=iid.a||b!=iid.b); }
00250     Interface_ID& operator=(const Interface_ID& iid)  { a=iid.a; b = iid.b; return (*this); }
00251     // less operator - allows for ordering Class_IDs (used by stl maps for example) 
00252     bool operator<(const Interface_ID& rhs) const
00253     {
00254         if ( a < rhs.a || ( a == rhs.a && b < rhs.b ) )
00255             return true;
00256 
00257         return false;
00258     }
00259 };
00260 
00261 
00262 // Types used by ISave, ILoad, AppSave, AppLoad
00263 
00266 enum IOResult
00267 {
00269     IO_OK = 0,  
00273     IO_END = 1,
00277     IO_ERROR = 2
00278 };
00280 
00281 enum ChunkType
00282 {
00283     NEW_CHUNK       = 0,
00284     CONTAINER_CHUNK = 1,
00285     DATA_CHUNK      = 2
00286 };
00287 
00288 enum FileIOType
00289 {
00292     IOTYPE_MAX    = 0, 
00295     IOTYPE_MATLIB = 1, 
00298     IOTYPE_RENDER_PRESETS = 2
00299 }; 
00300 
00302 enum ProductVersionType
00303 {
00304     PRODUCT_VERSION_DEVEL,
00305     PRODUCT_VERSION_TRIAL,
00306     PRODUCT_VERSION_ORDINARY,
00307     PRODUCT_VERSION_EDU, //Educational - Institution
00308     PRODUCT_VERSION_NFR,
00309     PRODUCT_VERSION_EMR //Educational - Student
00310 };
00311 
00313 enum LockBehaviorType
00314 {
00315     LICENSE_BEHAVIOR_PERMANENT,
00316     LICENSE_BEHAVIOR_EXTENDABLE,
00317     LICENSE_BEHAVIOR_NONEXTENDABLE,
00318     LICENSE_BEHAVIOR_BORROWED
00319 };