Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglTexCombinerParams.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglTexCombinerParams.hpp
00021  *   Author: Tom Stimson
00022  *  Created: 31 December 2001
00023  *  Summary: Paramters to control the texture environment mode eCOMBINE.
00024  *****************************************************************************/
00025 
00026 #ifndef __SGL_TEXCOMBINERPARAMS_HPP
00027 #define __SGL_TEXCOMBINERPARAMS_HPP
00028 
00029 #include <sgl.h>
00030 #include <sglObject.hpp>
00031 
00032 class sglTexEnv;
00033 
00034 //============================================================================
00035 
00094 class SGL_DLL_API sglTexCombinerParams : public sglObject
00095 {
00096 public:
00097    class SGL_DLL_API RGB
00098    {
00099    public:
00101       enum FuncEnum
00102       {
00104          eREPLACE      = GL_REPLACE,
00105 
00107          eMODULATE     = GL_MODULATE,
00108 
00110          eADD          = GL_ADD,
00111 
00113          eADD_SIGNED   = GL_ADD_SIGNED,
00114 
00116          eINTERPOLATE  = GL_INTERPOLATE,
00117 
00119          eSUBTRACT     = GL_SUBTRACT,
00120 
00125          eDOT3_RGB     = GL_DOT3_RGB,
00126 
00133          eDOT3_RGBA    = GL_DOT3_RGBA
00134       };
00135 
00136       enum OperandEnum
00137       {
00138          eSRC_COLOR           = GL_SRC_COLOR,
00139          eONE_MINUS_SRC_COLOR = GL_ONE_MINUS_SRC_COLOR,
00140          eSRC_ALPHA           = GL_SRC_ALPHA,
00141          eONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA
00142       };
00143    };
00144 
00145    class SGL_DLL_API Alpha
00146    {
00147    public:
00149       enum FuncEnum
00150       {
00152          eREPLACE      = GL_REPLACE,
00153 
00155          eMODULATE     = GL_MODULATE,
00156 
00158          eADD          = GL_ADD,
00159 
00161          eADD_SIGNED   = GL_ADD_SIGNED,
00162 
00164          eINTERPOLATE  = GL_INTERPOLATE,
00165 
00167          eSUBTRACT     = GL_SUBTRACT
00168       };
00169 
00170       enum OperandEnum
00171       {
00172          eSRC_ALPHA           = GL_SRC_ALPHA,
00173          eONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA
00174       };
00175    };
00176 
00177    enum ArgEnum
00178    {
00179       eARG0 = 0,
00180       eARG1,
00181       eARG2
00182    };
00183 
00185    enum SourceEnum
00186    {
00188       eTEXTURE        = GL_TEXTURE,
00189 
00191       eCONSTANT       = GL_CONSTANT,
00192 
00194       ePRIMARY_COLOR  = GL_PRIMARY_COLOR,
00195 
00200       ePREVIOUS       = GL_PREVIOUS
00201    };
00202 
00203 public:
00206    sglTexCombinerParams();
00207 
00209    virtual ~sglTexCombinerParams();
00210 
00212    sglTexCombinerParams(const sglTexCombinerParams &rhs);
00213 
00215    sglTexCombinerParams &operator=(const sglTexCombinerParams &rhs);
00216 
00223    void setRGBFunc(RGB::FuncEnum func);
00224 
00229    RGB::FuncEnum getRGBFunc() const { return m_rgb_func; }
00230 
00235    void setAlphaFunc(Alpha::FuncEnum func);
00236 
00241    Alpha::FuncEnum getAlphaFunc() const { return m_alpha_func; }
00242 
00247    void setRGBScale(float scale);
00248 
00252    float getRGBScale() const { return m_rgb_scale; }
00253 
00258    void setAlphaScale(float scale);
00259 
00264    float getAlphaScale() const { return m_alpha_scale; }
00265 
00275    void setRGBParameter(ArgEnum arg, SourceEnum src, RGB::OperandEnum op);
00276 
00282    void getRGBParameter(
00283       ArgEnum arg, SourceEnum &src, RGB::OperandEnum &op) const;
00284 
00294    void setAlphaParameter(ArgEnum arg, SourceEnum src, Alpha::OperandEnum op);
00295 
00301    void getAlphaParameter(
00302       ArgEnum arg, SourceEnum &src, Alpha::OperandEnum &op) const;
00303 
00304    // See sglObject::printInfo() for details.
00305    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00306 
00307 private:
00308    friend class sglTexEnv;
00309    void apply() const;
00310 
00311 private:
00312    RGB::FuncEnum       m_rgb_func;
00313    Alpha::FuncEnum     m_alpha_func;
00314    float               m_rgb_scale;
00315    float               m_alpha_scale;
00316    int                 m_rgb_num_args;
00317    SourceEnum          m_rgb_src[3];
00318    RGB::OperandEnum    m_rgb_op[3];
00319    int                 m_alpha_num_args;
00320    SourceEnum          m_alpha_src[3];
00321    Alpha::OperandEnum  m_alpha_op[3];
00322 };
00323 
00324 #endif

Generated at Mon Jul 1 18:00:06 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001