mxsmaterial.h

Go to the documentation of this file.
00001 /*  
00002  *      MAXMaterials.h - MAX material & map wrapper classes
00003  *
00004  *          Copyright (c) John Wainwright 1996
00005  *
00006  */
00007 
00008 #pragma once
00009 
00010 #include "mxsobjects.h"
00011 // forward declarations
00012 class MultiMtl;
00013 
00014 
00015 /* -------------------------- MAXMaterial -------------------------- */
00016 
00017 visible_class (MAXMaterial)
00018 
00019 class MAXMaterial : public MAXWrapper
00020 {
00021 public:
00022     Mtl*        mat;                /* the MAX-side material    */
00023 
00024                 MAXMaterial() {};
00025                 MAXMaterial(Mtl* imat);
00026     static ScripterExport Value* intern(Mtl* imat);
00027 
00028     static Value* make(MAXClass* cls, Value** arg_list, int count);
00029 
00030     BOOL        is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXMaterial)) ? 1 : MAXWrapper::is_kind_of(c); }
00031     void        collect() { delete this; }
00032     ScripterExport void sprin1(CharStream* s);
00033     MCHAR*      class_name();
00034 
00035 #include "..\macros\define_implementations.h"
00036     Value*      copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
00037 
00038     def_property   ( name );
00039     def_property   ( effectsChannel );
00040     def_property   ( showInViewport );
00041     Value*      get_property(Value** arg_list, int count);
00042     Value*      set_property(Value** arg_list, int count);
00043 
00044     Mtl*        to_mtl() { check_for_deletion(); return mat; }
00045     MtlBase*    to_mtlbase() { check_for_deletion(); return mat; }
00046     void        to_fpvalue(FPValue& v) { v.mtl = mat; v.type = TYPE_MTL; }
00047 };
00048 
00049 /* ---------------------- MAXMultiMaterial ----------------------- */
00050 
00051 visible_class (MAXMultiMaterial)
00052 
00053 class MAXMultiMaterial : public MAXMaterial
00054 {
00055 public:
00056 
00057                 MAXMultiMaterial() {};
00058                 MAXMultiMaterial(MultiMtl* imat);
00059     static ScripterExport Value* intern(MultiMtl* imat);
00060 
00061     static Value* make(MAXClass* cls, Value** arg_list, int count);
00062 
00063     BOOL        is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXMultiMaterial)) ? 1 : MAXMaterial::is_kind_of(c); }
00064     void        collect() { delete this; }
00065     ScripterExport void sprin1(CharStream* s);
00066     MCHAR*      class_name();
00067 
00068     def_generic (get, "get");
00069     def_generic (put, "put");
00070     Value*      copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
00071 
00072     ScripterExport Value* map(node_map& m);
00073 
00074     def_property( numsubs );
00075     def_property( count );
00076 
00077     Mtl*        to_mtl() { return mat; }
00078     MtlBase*    to_mtlbase() { check_for_deletion(); return mat; }
00079     void        to_fpvalue(FPValue& v) { v.mtl = mat; v.type = TYPE_MTL; }
00080 };
00081 
00082 /* ---------------------- Material Library ----------------------- */
00083 
00084 applyable_class (MAXMaterialLibrary)
00085 
00086 class MAXMaterialLibrary : public MAXWrapper
00087 {
00088 public:
00089     MtlBaseLib  new_lib;
00090     MtlBaseLib& lib;
00091 
00092                 MAXMaterialLibrary(MtlBaseLib& ilib);
00093                 MAXMaterialLibrary(MtlBaseLib* ilib);
00094                 MAXMaterialLibrary();
00095     static ScripterExport Value* intern(MtlBaseLib& ilib);
00096     static ScripterExport Value* intern(MtlBaseLib* ilib);
00097 #   define      is_materiallibrary(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(MAXMaterialLibrary))
00098 
00099                 classof_methods (MAXMaterialLibrary, MAXWrapper);
00100     void        collect() { delete this; }
00101     ScripterExport void sprin1(CharStream* s);
00102     MtlBase*    get_mtlbase(int index);
00103     MtlBase*    find_mtlbase(MCHAR* name);
00104     MCHAR*      class_name();
00105 
00106     /* operations */
00107     
00108     ScripterExport Value* map(node_map& m);
00109 
00110 #include "..\macros\define_implementations.h"
00111 #   include "..\protocols\arrays.inl"
00112     Value*      copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
00113 
00114     /* built-in property accessors */
00115 
00116     def_property ( count );
00117 };
00118 
00119 /* ------------------------- MAXTexture ------------------------ */
00120 
00121 visible_class (MAXTexture)
00122 
00123 class MAXTexture : public MAXWrapper
00124 {
00125 public:
00126     Texmap* map;                /* the MAX-side map */
00127 
00128                 MAXTexture(Texmap* imap);
00129     static ScripterExport Value* intern(Texmap* imap);
00130 
00131     static Value* make(MAXClass* cls, Value** arg_list, int count);
00132 
00133     BOOL        is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXTexture)) ? 1 : MAXWrapper::is_kind_of(c); }
00134     void        collect() { delete this; }
00135     ScripterExport void sprin1(CharStream* s);
00136     MCHAR*      class_name();
00137 
00138 #include "..\macros\define_implementations.h"
00139 #   include "..\protocols\textures.inl"
00140     Value*      copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
00141 
00142     def_property( name );
00143 
00144     Texmap*     to_texmap() { check_for_deletion(); return map; }
00145     MtlBase*    to_mtlbase() { check_for_deletion(); return map; }
00146     void        to_fpvalue(FPValue& v) { v.tex = map; v.type = TYPE_TEXMAP; }
00147 };
00148 
00149 /* -------------------------- MAXMtlBase -------------------------- */
00150 
00151 // a generic wrapper for MtlBase classes such as UVGen, XYZGen, TexOut, etc.
00152 
00153 visible_class (MAXMtlBase)
00154 
00155 class MAXMtlBase : public MAXWrapper
00156 {
00157 public:
00158     MtlBase*    mtl;                /* the MAX-side mtlbase */
00159 
00160                 MAXMtlBase(MtlBase* imtl);
00161     static ScripterExport Value* intern(MtlBase* imtl);
00162 
00163     static Value* make(MAXClass* cls, Value** arg_list, int count);
00164 
00165     BOOL        is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXMtlBase)) ? 1 : MAXWrapper::is_kind_of(c); }
00166     void        collect() { delete this; }
00167     ScripterExport void sprin1(CharStream* s);
00168     MCHAR*      class_name() { return _M("MapSupportClass"); }
00169     Value*      copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
00170 
00171     MtlBase*    to_mtlbase() { check_for_deletion(); return mtl; }
00172 };
00173 
00174 /* ------------------ MEdit materials virtual array -------------------- */
00175 
00176 visible_class (MAXMeditMaterials)
00177 
00178 class MAXMeditMaterials : public MAXWrapper
00179 {
00180 public:
00181                 MAXMeditMaterials();
00182 
00183                 classof_methods (MAXMeditMaterials, MAXWrapper);
00184     void        collect() { delete this; }
00185     ScripterExport void sprin1(CharStream* s);
00186     MtlBase*    get_mtl(int index);
00187     MtlBase*    find_mtl(MCHAR* name);
00188     static void setup();
00189     MCHAR*      class_name();
00190 
00191     // operations
00192     ScripterExport Value* map(node_map& m);
00193 
00194 #include "..\macros\define_implementations.h"
00195 #   include "..\protocols\arrays.inl"
00196 
00197     // built-in property accessors
00198     def_property ( count );
00199 };
00200 
00201 extern ScripterExport MAXMeditMaterials medit_materials;
00202