Torque3D Documentation / _generateds / tsMaterialList.h

tsMaterialList.h

Engine/source/ts/tsMaterialList.h

More...

Classes:

class

Specialized material list for 3space objects.

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _TSMATERIALLIST_H_
 25#define _TSMATERIALLIST_H_
 26
 27#ifndef _MATERIALLIST_H_
 28#include "materials/materialList.h"
 29#endif
 30#ifndef _PATH_H_
 31#include "core/util/path.h"
 32#endif
 33
 34
 35/// Specialized material list for 3space objects.
 36class TSMaterialList : public MaterialList
 37{
 38   typedef MaterialList Parent;
 39
 40   Vector<U32> mFlags;
 41   Vector<U32> mReflectanceMaps;
 42   Vector<U32> mBumpMaps;
 43   Vector<U32> mDetailMaps;
 44   Vector<F32> mDetailScales;
 45   Vector<F32> mReflectionAmounts;
 46
 47   bool mNamesTransformed;
 48
 49   void allocate(U32 sz);
 50
 51  public:
 52
 53   enum
 54   {
 55      S_Wrap             = BIT(0),
 56      T_Wrap             = BIT(1),
 57      Translucent        = BIT(2),
 58      Additive           = BIT(3),
 59      Subtractive        = BIT(4),
 60      SelfIlluminating   = BIT(5),
 61      NeverEnvMap        = BIT(6),
 62      NoMipMap           = BIT(7),
 63      MipMap_ZeroBorder  = BIT(8),
 64      AuxiliaryMap       = BIT(27) | BIT(28) | BIT(29) | BIT(30) | BIT(31) // DEPRECATED
 65   };
 66
 67   TSMaterialList(U32 materialCount, const char **materialNames, const U32 * materialFlags,
 68                  const U32 * reflectanceMaps, const U32 * bumpMaps, const U32 * detailMaps,
 69                  const F32 * detailScales, const F32 * reflectionAmounts);
 70   TSMaterialList();
 71   TSMaterialList(const TSMaterialList*);
 72   ~TSMaterialList();
 73   void free();
 74
 75   U32 getFlags(U32 index);
 76   void setFlags(U32 index, U32 value);
 77
 78   bool renameMaterial(U32 index, const String& newName); // use to support reskinning
 79
 80   /// pre-load only
 81   void push_back(const String &name, U32 flags,
 82                  U32 a=0xFFFFFFFF, U32 b=0xFFFFFFFF, U32 c=0xFFFFFFFF,
 83                  F32 dm=1.0f, F32 em=1.0f);
 84   void push_back(const char * name, U32 flags, Material* mat);
 85
 86   /// @name IO
 87   /// Functions for reading/writing to/from streams
 88   /// @{
 89
 90   bool write(Stream &);
 91   bool read(Stream &);
 92   /// @}
 93
 94protected:
 95   virtual void mapMaterial( U32 index );
 96};
 97
 98
 99#endif // _TSMATERIALLIST_H_
100