1 #ifndef COIN_SOSHAPESTYLEELEMENT_H 2 #define COIN_SOSHAPESTYLEELEMENT_H 3 4 /**************************************************************************\ 5 * Copyright (c) Kongsberg Oil & Gas Technologies AS 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 11 * 12 * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * 15 * Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * Neither the name of the copyright holder nor the names of its 20 * contributors may be used to endorse or promote products derived from 21 * this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 \**************************************************************************/ 35 36 #include <Inventor/elements/SoSubElement.h> 37 38 class COIN_DLL_API SoShapeStyleElement : public SoElement { 39 typedef SoElement inherited; 40 41 SO_ELEMENT_HEADER(SoShapeStyleElement); 42 public: 43 static void initClass(void); 44 protected: 45 virtual ~SoShapeStyleElement(); 46 47 public: 48 49 // flags used for optimized testing of features 50 enum Flags { 51 LIGHTING = 0x00000100, 52 TEXENABLED = 0x00000200, 53 TEXFUNC = 0x00000400, 54 BBOXCMPLX = 0x00000800, 55 INVISIBLE = 0x00001000, 56 ABORTCB = 0x00002000, 57 OVERRIDE = 0x00004000, 58 TEX3ENABLED = 0x00008000, 59 BIGIMAGE = 0x00010000, 60 BUMPMAP = 0x00020000, 61 VERTEXARRAY = 0x00040000, 62 TRANSP_TEXTURE = 0x00080000, 63 TRANSP_MATERIAL = 0x00100000, 64 TRANSP_SORTED_TRIANGLES = 0x00200000, 65 SHADOWMAP = 0x00400000, 66 SHADOWS = 0x00800000 67 }; 68 69 virtual void init(SoState * state); 70 71 virtual void push(SoState * state); 72 virtual void pop(SoState * state, const SoElement * prevTopElement); 73 74 virtual SbBool matches(const SoElement * element) const; 75 virtual SoElement * copyMatchInfo(void) const; 76 77 static const SoShapeStyleElement * get(SoState * const state); 78 79 unsigned int getFlags(void) const; 80 SbBool mightNotRender(void) const; 81 SbBool needNormals(void) const; 82 SbBool needTexCoords(void) const; 83 int getRenderCaseMask(void) const; 84 85 static void setDrawStyle(SoState * const state, const int32_t value); 86 static void setComplexityType(SoState * const state, 87 const int32_t value); 88 static void setTransparencyType(SoState * const state, 89 const int32_t value); 90 static void setTextureEnabled(SoState * const state, const SbBool value); 91 static void setTexture3Enabled(SoState * const state, const SbBool value); 92 static void setTextureFunction(SoState * const state, 93 const SbBool value); 94 static void setLightModel(SoState * const state, const int32_t value); 95 static void setOverrides(SoState * const state, const SbBool value); 96 97 static SbBool isScreenDoor(SoState * const state); 98 static int getTransparencyType(SoState * const state); 99 SbBool isTextureFunction(void) const; 100 101 static void setBumpmapEnabled(SoState * state, const SbBool value); 102 static void setBigImageEnabled(SoState * state, const SbBool value); 103 static void setVertexArrayRendering(SoState * state, const SbBool value); 104 105 static void setTransparentMaterial(SoState * state, const SbBool value); 106 static void setTransparentTexture(SoState * state, const SbBool value); 107 108 static void setShadowMapRendering(SoState * state, const SbBool value); 109 static void setShadowsRendering(SoState * state, const SbBool value); 110 111 private: 112 113 static SoShapeStyleElement * getElement(SoState * const state); 114 static const SoShapeStyleElement * getConstElement(SoState * const state); 115 116 unsigned int flags; 117 }; 118 119 #endif // !COIN_SOSHAPESTYLEELEMENT_H 120