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

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