00001 /********************************************************************** 00002 *< 00003 FILE: mtl.h 00004 00005 DESCRIPTION: Material and texture class definitions 00006 00007 CREATED BY: Don Brittain 00008 00009 HISTORY: 00010 00011 *> Copyright (c) 1994, All Rights Reserved. 00012 **********************************************************************/ 00013 #pragma once 00014 00015 #include "export.h" 00016 #include "tab.h" 00017 #include "matrix3.h" 00018 #include "BaseInterface.h" 00019 00020 // forward declarations 00021 class MtlBase; 00022 00023 #define UVSOURCE_MESH 0 // use UVW coords from a standard map channel 00024 #define UVSOURCE_XYZ 1 // compute UVW from object XYZ 00025 #define UVSOURCE_MESH2 2 // use UVW2 (vertexCol) coords 00026 #define UVSOURCE_WORLDXYZ 3 // use world XYZ as UVW 00027 #ifdef GEOREFSYS_UVW_MAPPING 00028 #define UVSOURCE_GEOXYZ 4 // generate planar uvw mapping from geo referenced world xyz on-the-fly 00029 #endif 00030 #define UVSOURCE_FACEMAP 5 // use "face map" UV coords 00031 #define UVSOURCE_HWGEN 6 // use hardware generated texture coords 00032 00033 // texture class definition 00171 class TextureInfo : public BaseInterfaceServer { 00172 public: 00186 DllExport TextureInfo(); 00188 virtual ~TextureInfo() {}; 00189 DllExport TextureInfo& operator=(const TextureInfo &from); 00190 00191 int useTex; 00192 int faceMap; 00193 DWORD_PTR textHandle; // texture handle 00194 int uvwSource; 00195 int mapChannel; 00196 Matrix3 textTM; // texture transform 00197 UBYTE tiling[3]; // u,v,w tiling: GW_TEX_REPEAT, GW_TEX_MIRROR, or GW_TEX_NO_TILING 00198 UBYTE colorOp; // color texture operation 00199 UBYTE colorAlphaSource; // color blend alpha source 00200 UBYTE colorScale; // color scale factor 00201 UBYTE alphaOp; // alpha texture operation 00202 UBYTE alphaAlphaSource; // alpha blend alpha source 00203 UBYTE alphaScale; // alpha scale factor 00204 }; 00205 00206 // main material class definition 00237 class Material : public BaseInterfaceServer { 00238 protected: 00239 00240 public: 00254 DllExport Material(); 00256 virtual ~Material() {}; 00260 DllExport Material(const Material &from); 00264 DllExport Material& operator=(const Material &from); 00265 00266 Point3 Ka; 00267 Point3 Kd; 00268 Point3 Ks; 00269 float shininess; 00270 float shinStrength; 00271 float opacity; 00272 float selfIllum; 00273 int dblSided; 00274 int shadeLimit; 00275 Tab<TextureInfo> texture; 00276 DllExport BaseInterface *GetInterface(Interface_ID id); 00277 private: 00278 void CopyFrom(const Material &from); 00279 };