OpendTect-6_4  6.4
vismaterial.h
Go to the documentation of this file.
1 #ifndef vismaterial_h
2 #define vismaterial_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl
9  Date: 4-11-2002
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "color.h"
17 #include "visnodestate.h"
18 #include "uistring.h"
19 
20 namespace osg {
21  class Material;
22  class Array;
23  class Geometry;
24  class StateSet;
25  class StateAttribute;
26 };
27 
28 class IOPar;
29 
30 namespace visBase
31 {
39 public:
40  Material();
41 
43 
44  void setFrom(const Material&, bool trigger= false);
45 
46  void setPropertiesFrom(const Material&, bool trigger= false);
48  void setColors(const TypeSet<Color>&,
49  bool trigger = true);
53  enum ColorMode { Ambient, Diffuse, Specular, Emission,
54  AmbientAndDiffuse, Off };
55 
56  void setColorMode( ColorMode );
57  ColorMode getColorMode() const;
58 
59  void setColor(const Color&,int=-1,bool trigger=true);
63  Color getColor(int matnr=0) const;
64 
65  void removeColor(int idx);
66 
67  void setDiffIntensity(float);
69  float getDiffIntensity() const;
70 
71  void setAmbience(float);
73  float getAmbience() const;
74 
75  void setSpecIntensity(float);
77  float getSpecIntensity() const;
78 
79  void setEmmIntensity(float);
81  float getEmmIntensity() const;
82 
83  void setShininess(float);
85  float getShininess() const;
86 
87  void setTransparency(float,int idx=0,bool updt=false);
89  void setAllTransparencies( float n );
92  void setTransparencies(float,const Interval<int>& range);
93 
94  float getTransparency(int idx=0) const;
95 
96  void rescaleTransparency(float bendpower);
97 
98  int usePar(const IOPar&);
99  void fillPar(IOPar&) const;
100 
101  int nrOfMaterial() const;
102 
103  void clear();
104 
105  void attachGeometry(osg::Geometry*);
106  void detachGeometry(osg::Geometry*);
107 
108  void setColorBindType(unsigned int);
109 
110  const TypeSet<Color> getColors();
111 
112 private:
113  ~Material();
115  void updateOsgMaterial();
116 
117  void createOsgColorArray(int);
118  void setColorArray(osg::Array*);
119  void removeOsgColor(int);
121  float getRescaledTransparency() const;
122 
123  static const char* sKeyColor();
124  static const char* sKeyAmbience();
125  static const char* sKeyDiffIntensity();
126  static const char* sKeySpectralIntensity();
127  static const char* sKeyEmmissiveIntensity();
128  static const char* sKeyShininess();
129  static const char* sKeyTransparency();
130 
131  friend class OsgColorArrayUpdator;
132 
133  osg::Material* material_;
134 
136  float ambience_;
139  float shininess_;
141 
142  unsigned int colorbindtype_;
143 
146  osg::Array* osgcolorarray_;
149 };
150 
151 } // namespace visBase
152 
153 
154 #endif
#define mExpClass(module)
Definition: commondefs.h:160
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
float shininess_
Definition: vismaterial.h:139
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
float diffuseintensity_
Definition: vismaterial.h:140
void clear(std::ios &)
float specularintensity_
Definition: vismaterial.h:137
float emmissiveintensity_
Definition: vismaterial.h:138
unsigned int colorbindtype_
Definition: vismaterial.h:142
Definition: visnodestate.h:27
Definition: callback.h:254
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
ColorMode
Definition: vismaterial.h:53
Definition: vismaterial.h:37
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
osg::Array * osgcolorarray_
Definition: vismaterial.h:146
Threads::Lock lock_
Definition: vismaterial.h:144
Definition: visannot.h:43
osg::Material * material_
Definition: vismaterial.h:133
Notifier< Material > change
Definition: vismaterial.h:42
Definition: vismaterial.h:53
Open Scene Graph.
Definition: visannot.h:29
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
Color color_
Definition: vismaterial.h:135
float ambience_
Definition: vismaterial.h:136
float transparencybendpower_
Definition: vismaterial.h:148
Definition: arraytesselator.h:21
ObjectSet< osg::Geometry > attachedgeoms_
Definition: vismaterial.h:147
FixedString Geometry()
Definition: keystrs.h:69

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019