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

sglCurrState.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: sglCurrState.hpp
00021  *   Author: Tom Stimson
00022  *  Created: 15 July 2000
00023  *  Summary:
00024  *****************************************************************************/
00025 
00026 #ifndef __SGL_CURR_STATE_HPP
00027 #define __SGL_CURR_STATE_HPP
00028 
00029 #include <sgl.h>
00030 
00031 #include <sglDrawable.hpp>
00032 
00033 
00034 // A complete state.
00035 struct SGL_DLL_API sglFullState
00036 {
00037 public:
00038    sglFullState()
00039          : m_statelet(sgl::s_num_statelet_types, (const sglStatelet*)NULL) {}
00040    ~sglFullState() {}
00041 
00042    void clear()
00043       {
00044          for (unsigned int ii = 0; ii < sgl::s_num_statelet_types; ++ii)
00045             m_statelet[ii] = NULL;
00046          m_tex_coords = NULL;
00047          m_dlist = 0;
00048       }
00049 
00050    // Call this for each drawable rendered
00051    void addStats(sglStats& stats) const;
00052 
00053 private: // not implemented
00054    sglFullState(const sglFullState &);
00055    sglFullState& operator=(const sglFullState &);
00056 
00057 public:
00058    vector<const sglStatelet*>  m_statelet;
00059    const vector<sglTexCoords> *m_tex_coords;
00060    GLuint                      m_dlist;
00061 };
00062 
00063 class SGL_DLL_API sglCurrState
00064 {
00065 public:
00066    sglCurrState()
00067       : m_point_smooth(false), m_line_smooth(false), m_multisample(false) {}
00068    ~sglCurrState() {}
00069 
00070    void apply(const sglFullState *new_state);
00071    void statsApply(const sglFullState *new_state, sglStats& stats);
00072    void draw(const sglDrawable *drawable);
00073    void force(const sglFullState *new_state);
00074 
00075    void checkBlend();
00076    void checkDepthMask();
00077 
00078 private:
00079    void checkPointSmooth(bool point_type);
00080    void checkLineSmooth(bool line_type);
00081    void checkMultisample(bool line_type, bool fill_type);
00082    void drawGeometry(const sglDrawable *drawable);
00083 
00084    // not implemented
00085    sglCurrState(const sglCurrState &);
00086    sglCurrState &operator=(const sglCurrState &);
00087 
00088 private:
00089    sglFullState m_state;
00090    bool         m_point_smooth;
00091    bool         m_line_smooth;
00092    bool         m_multisample;
00093 };
00094 
00095 
00096 #endif

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