arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

GrinderKeys.cpp

Go to the documentation of this file.
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.cpp
00019 
00020 #include "GrinderKeys.h"
00021 #include "EnvKeys.h"
00022 
00023 using namespace glift;
00024 
00025 
00026 ///////////////////////////////////////////////////////////////////
00027 /// env
00028 ///////////////////////////////////////////////////////////////////
00029 /// environment keys
00030 KeySP GrinderKeys::env() const
00031 {
00032    return getKey(EnvKey.kn);
00033 }
00034 
00035 ///////////////////////////////////////////////////////////////////
00036 /// val
00037 ///////////////////////////////////////////////////////////////////
00038 /// data value keys
00039 KeySP GrinderKeys::val() const
00040 {
00041    return getKey(DataValKey.kn);
00042 }
00043 
00044 ///////////////////////////////////////////////////////////////////
00045 /// pos
00046 ///////////////////////////////////////////////////////////////////
00047 /// data position keys
00048 KeySP GrinderKeys::pos() const
00049 {
00050    return getKey(TexCKey.kn);
00051 }
00052 
00053 ///////////////////////////////////////////////////////////////////
00054 /// pconst
00055 ///////////////////////////////////////////////////////////////////
00056 /// program constants
00057 KeySP GrinderKeys::pconst() const
00058 {
00059    return getKey(PConstKey.kn);
00060 }
00061 
00062 ///////////////////////////////////////////////////////////////////
00063 /// add pconst
00064 ///////////////////////////////////////////////////////////////////
00065 KeySP  GrinderKeys::addPConst(const GKeyType kn, const KeySP pconstKey)
00066 {
00067    KeySP key = pconst()->addKey(kn,pconstKey);
00068    key->setIVec(Key::IVEC_TYPE(pconst()->size()-1));   
00069    return key;
00070 }
00071 
00072 KeySP  GrinderKeys::addPConst(const KeyPair pckp)
00073 {
00074    return addPConst(pckp.kn,KeySP(new Key(pckp.key)));
00075 }
00076 
00077 ///////////////////////////////////////////////////////////////////
00078 /// pconst id
00079 ///////////////////////////////////////////////////////////////////
00080 int   GrinderKeys::pconstID(GKeyType kn)
00081 {
00082    KeySP key = pconst()->getKey(kn);
00083    if(!key.isNull()) return key->getIVec()[0];
00084    return -1;
00085 }
00086 
00087 ///////////////////////////////////////////////////////////////////
00088 ///////////////////////////////////////////////////////////////////
00089 /// texture
00090 ///////////////////////////////////////////////////////////////////
00091 ///////////////////////////////////////////////////////////////////
00092 
00093 ///////////////////////////////////////////////////////////////////
00094 /// set texture
00095 ///////////////////////////////////////////////////////////////////
00096 void                  GrinderKeys::setTexture(int i, glift::SingleTexSP tex)
00097 {
00098    if(i < int(_textures.size()))
00099    {
00100       _textures[i] = tex;
00101    }
00102    else if( i == int(_textures.size()))
00103    {
00104       _textures.push_back(tex);
00105    }
00106    else
00107    {
00108       _textures.resize(i, SingleTexSP(0));
00109       _textures.push_back(tex);
00110    }
00111 
00112 }
00113 
00114 ///////////////////////////////////////////////////////////////////
00115 /// add texture
00116 ///////////////////////////////////////////////////////////////////
00117 int                   GrinderKeys::addTexture(glift::SingleTexSP tex)
00118 {
00119    _textures.push_back(tex);
00120    return _textures.size() - 1;
00121 }
00122 
00123 
00124 ///////////////////////////////////////////////////////////////////
00125 /// set texture
00126 ///////////////////////////////////////////////////////////////////
00127 glift::SingleTexSP    GrinderKeys::getTexture(int i)
00128 {
00129    if( i < int(_textures.size()))
00130    {
00131       return _textures[i];
00132    }
00133    return glift::SingleTexSP(0);
00134 }
00135 
00136 ///////////////////////////////////////////////////////////////////
00137 /// set texture
00138 ///////////////////////////////////////////////////////////////////
00139 int                   GrinderKeys::numTextures()
00140 {
00141    return _textures.size();
00142 }
00143 
00144 

Send questions, comments, and bug reports to:
jmk