featureType.h

Engine/source/shaderGen/featureType.h

More...

Classes:

Public Defines

define
DeclareFeatureType(name)    extern   name
define
ImplementFeatureType(name, group, order, isDefault)      name( #name, group, order, isDefault )

Public Typedefs

FeatureTypeVector 

A vector of feature types.

Detailed Description

Public Defines

DeclareFeatureType(name)    extern   name
ImplementFeatureType(name, group, order, isDefault)      name( #name, group, order, isDefault )

Public Typedefs

typedef Vector< const FeatureType * > FeatureTypeVector 

A vector of feature types.

  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 _FEATURETYPE_H_
 25#define _FEATURETYPE_H_
 26
 27#ifndef _TVECTOR_H_
 28#include "core/util/tVector.h"
 29#endif
 30#ifndef _TORQUE_STRING_H_
 31#include "core/util/str.h"
 32#endif
 33
 34class FeatureType;
 35class FeatureSet;
 36
 37
 38/// A vector of feature types.
 39typedef Vector<const FeatureType*> FeatureTypeVector;
 40
 41
 42///
 43class FeatureType
 44{
 45protected:
 46
 47   /// Returns the map of all the types.
 48   static FeatureTypeVector& _getTypes();
 49
 50   /// The feature type name.
 51   String mName;
 52
 53   /// A unique feature id value.
 54   U32 mId;
 55
 56   /// The group is used to orginize the types.
 57   U32 mGroup;
 58
 59   /// The sort order of this feature type 
 60   /// within its group.
 61   F32 mOrder;
 62
 63   ///
 64   bool mIsDefault;
 65
 66   ///
 67   FeatureType( const FeatureType &type );
 68
 69public:
 70
 71   /// Adds all the default features types to the set.
 72   static void addDefaultTypes( FeatureSet *outFeatures );
 73
 74   /// You should not use this constructor directly.
 75   /// @see DeclareFeatureType
 76   /// @see ImplementFeatureType
 77   FeatureType(   const char *type, 
 78                  U32 group = -1, 
 79                  F32 order = -1.0f,
 80                  bool isDefault = true );
 81
 82   bool operator!=( const FeatureType &type ) const { return this != &type; }
 83
 84   bool operator==( const FeatureType &type ) const { return this == &type; }
 85
 86   const String& getName() const { return mName; }
 87
 88   U32 getId() const { return mId; }
 89
 90   U32 getGroup() const { return mGroup; }
 91
 92   F32 getOrder() const { return mOrder; }
 93
 94   bool isDefault() const { return mIsDefault; }
 95
 96};
 97
 98
 99/// 
100#define DeclareFeatureType( name ) \
101   extern const FeatureType name
102
103
104///
105#define ImplementFeatureType( name, group, order, isDefault ) \
106   const FeatureType name( #name, group, order, isDefault )
107
108/*
109#define ImplementFeatureType( name, group, order ) \
110   const FeatureType name( #name, group, order );
111
112#define ImplementFeatureType( name, group ) \
113   const FeatureType name( #name, group );
114
115#define ImplementFeatureType( name ) \
116   const FeatureType name( #name );
117*/
118
119#endif // _FEATURETYPE_H_
120