Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/mevis/include/Inventor/elements/SoStencilBitsElement.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  Copyright (C) 2003 MeVis gGmbH  All Rights Reserved.
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  Further, this software is distributed without any warranty that it is
00016  *  free of the rightful claim of any third person regarding infringement
00017  *  or the like.  Any license provided herein, whether implied or
00018  *  otherwise, applies only to this software file.  Patent licenses, if
00019  *  any, provided herein do not apply to combinations of this program with
00020  *  other software, or any other product whatsoever.
00021  *
00022  *  You should have received a copy of the GNU Lesser General Public
00023  *  License along with this library; if not, write to the Free Software
00024  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  *  Contact information: MeVis, Center for Medical Diagnostic Systems and
00027  *  Visualization GmbH, Universitätsallee 29, D-28359 Bremen, GERMANY, or:
00028  *
00029  *  http://www.mevis.de
00030  *
00031  */
00032 
00033 /*
00034  * Copyright (C) 2003   MeVis Research GmbH
00035  *
00036  _______________________________________________________________________
00037  _______________  M E V I S   R E S E A R C H   G M B H  _______________
00038  |
00039  |   Description:
00040  |   Manages stencil bits of the OpenGL stencil buffer
00041  |
00042  |   Author(s)      : Felix Ritter
00043  |
00044  _______________  M E V I S   R E S E A R C H   G M B H  _______________
00045  _______________________________________________________________________
00046  */
00047 
00048 #ifndef _SO_STENCIL_BITS_ELEMENT_
00049 #define _SO_STENCIL_BITS_ELEMENT_
00050 
00051 #include <Inventor/system/SbSystem.h>
00052 #include <Inventor/elements/SoInt32Element.h>
00053 
00054 SoEXTENDER class INVENTOR_API SoStencilBitsElement : public SoInt32Element
00055 {
00056    typedef SoInt32Element inherited;
00057    
00058    SO_ELEMENT_HEADER(SoStencilBitsElement);
00059    
00060    public:
00061 
00063       virtual void      init(SoState *state);
00064 
00068       static uint32_t   acquireBits(SoState *state, SoNode *node, int num);
00069       
00071       static void       releaseBits(SoState *state, uint32_t mask);
00072       
00077       static void       clearBitsInUse(SoState *state);
00078       
00080       static uint32_t   get(SoState *state) {
00081          return (uint32_t)SoInt32Element::get(classStackIndex, state);
00082       }
00083 
00085       static uint32_t   getDefault() {
00086          return 0x0;
00087       }
00088       
00090       static int        getNumRemainingBits(SoState *state);
00091 
00093       virtual void      push(SoState *state);
00094 
00095    protected:
00096 
00098       static int        getNumBitPositionsToShift(uint32_t mask, SoState *state);
00099       
00101       virtual           ~SoStencilBitsElement();
00102 
00104       int               getNumGLBits() const;
00105       
00106    SoINTERNAL public:
00107 
00109       static void       initClass();
00110 
00111    private:
00112 
00114       mutable int       numGLBits;
00115 };
00116 
00117 #endif  // _SO_STENCIL_BITS_ELEMENT_