00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 3-20-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 ///GrinderKeys.h 00019 00020 /// Grinder specific key type, still just regular keys underneath, 00021 /// this class just adds some useful functionality as a toplevel 00022 /// key/symbol table. 00023 00024 #ifndef __GRINDER_GRINDER_KEYS_DOT_H 00025 #define __GRINDER_GRINDER_KEYS_DOT_H 00026 00027 #include "Keys.h" 00028 #include <textureGlift.h> 00029 00030 class GrinderKeys : public Key { 00031 public: 00032 GrinderKeys() : Key() {} 00033 GrinderKeys(const std::string &name, 00034 int type, 00035 const KeyPair *subKeys=0, 00036 int nSubKeys=0) 00037 : Key(name,type,subKeys,nSubKeys) 00038 {} 00039 virtual GrinderKey() {} 00040 00041 /// environment keys 00042 KeySP env() const; 00043 00044 /// data value keys 00045 KeySP val() const; 00046 00047 /// data position keys 00048 KeySP pos() const; 00049 00050 /// program constants 00051 KeySP pconst() const; 00052 KeySP addPConst(const GKeyType kn, const KeySP pconstKey); 00053 KeySP addPConst(const KeyPair pckp); 00054 /// get the program local parameter id of a key 00055 /// this is just stored in the IVec[0] of the key... 00056 int pconstID(const KeySP pconstKey) 00057 { return pconstKey->getIVec()[0]; } 00058 int pconstID(GKeyType kn); 00059 00060 //// textures 00061 /// set a texture, inserts null textures if it has to. 00062 void setTexture(int i, glift::SingleTexSP tex); 00063 /// add returns the texture's index 00064 int addTexture(glift::SingleTexSP tex); 00065 /// get returns a null sp if index is out of bounds 00066 glift::SingleTexSP getTexture(int i); 00067 /// size of texture vector 00068 int numTextures(); 00069 /// get the whole vector of textures! 00070 glift::SingleTexSPVec getTextureVec() const {return _textures;} 00071 00072 protected: 00073 glift::SingleTexSPVec _textures; 00074 }; 00075 00076 typedef gutz::SmartPtr<GrinderKeys> GrinderKeysSP; 00077 00078 #endif 00079