Open Inventor Reference
SoAmbientColorElement.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27  * Mountain View, CA 94043, or:
28  *
29  * http://www.sgi.com
30  *
31  * For further information regarding this notice, see:
32  *
33  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34  *
35  */
36 
37 
38 /*
39  * Copyright (C) 1990,91 Silicon Graphics, Inc.
40  *
41  _______________________________________________________________________
42  ______________ S I L I C O N G R A P H I C S I N C . ____________
43  |
44  | $Revision: 1.1.1.1 $
45  |
46  | Description:
47  | This file defines the SoAmbientColorElement class.
48  |
49  | Author(s) : Paul S. Strauss
50  |
51  ______________ S I L I C O N G R A P H I C S I N C . ____________
52  _______________________________________________________________________
53  */
54 #ifdef IV_STRICT
55 #error SoAmbientColorElement is obsolete. See SoLazyElement.h instead.
56 #endif /*IV_STRICT*/
57 #ifndef _SO_AMBIENT_COLOR_ELEMENT
58 #define _SO_AMBIENT_COLOR_ELEMENT
59 
60 
61 #include <Inventor/SbColor.h>
62 #include <Inventor/misc/SoState.h>
65 
77 
79 
80 
81  public:
82 
84  static void set(SoState *state, SoNode *,
85  int32_t numColors, const SbColor *colors)
86  {
87  SoLazyElement::setAmbient(state,(SbColor *)colors);
88 #ifdef DEBUG
89  if(numColors>1){
90  SoDebugError::post("SoAmbientColorElement::set",
91  "multiple ambient colors not supported");
92  }
93 #endif /*DEBUG*/
94  }
95 
96 
98  static const SoAmbientColorElement * getInstance(SoState *state)
99  {
101  ace->saveState = state;
102  return(ace);
103  }
104 
105 
107  int32_t getNum() const { return 1; }
108 
110  const SbColor & get(int index) const
111  {
112 #ifdef DEBUG
113  if(index >1)
114  SoDebugError::post("SoAmbientColorElement::get",
115  "multiple ambient colors not supported");
116 #endif /*DEBUG*/
117  return(SoLazyElement::getAmbient(saveState));
118  }
119 
121  static SbColor getDefault()
123 
124  private:
125  SoState* saveState;
126 };
127 
128 #endif /* _SO_AMBIENT_COLOR_ELEMENT */
129 
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition: SbBasic.h:154
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
signed int int32_t
Definition: SbTypeDefs.h:43
Color vector class.
Definition: SbColor.h:84
This class is being superceded by the SoLazyElement class.
const SbColor & get(int index) const
Returns the current ambient color.
int32_t getNum() const
Returns the number of ambient colors in any instance.
static SbColor getDefault()
Returns the default ambient color.
static const SoAmbientColorElement * getInstance(SoState *state)
Returns the top (current) instance of the element in the state.
static void set(SoState *state, SoNode *, int32_t numColors, const SbColor *colors)
Sets the current ambient color(s)
static void post(const char *methodName, const char *formatString ...)
Posts an error.
static SbColor getDefaultAmbient()
static void setAmbient(SoState *state, const SbColor *color)
static const SbColor & getAmbient(SoState *)
Abstract base class for all database nodes.
Definition: SoNode.h:103
An SoState collects and holds state while traversing a scene graph.
Definition: SoState.h:82