Definition at line 18 of file VP1SoMaterialMixer.cxx.
◆ defaultMaterial()
SoMaterial* VP1SoMaterialMixer::Imp::defaultMaterial |
( |
| ) |
|
|
inline |
◆ inputMaterialValid()
bool VP1SoMaterialMixer::Imp::inputMaterialValid |
( |
SoMaterial * |
m | ) |
|
|
static |
Definition at line 118 of file VP1SoMaterialMixer.cxx.
121 &&
m->ambientColor.getNum() == 1
122 &&
m->diffuseColor.getNum() == 1
123 &&
m->specularColor.getNum() == 1
124 &&
m->emissiveColor.getNum() == 1
125 &&
m->transparency.getNum() == 1
126 &&
m->shininess.getNum() == 1;
◆ materialChanged()
void VP1SoMaterialMixer::Imp::materialChanged |
( |
SoMaterial * |
mat | ) |
|
Definition at line 160 of file VP1SoMaterialMixer.cxx.
166 for (;it2!=it2E;++it2) {
176 std::map<SoMaterial*,double>::const_iterator it4(it3->first.begin()),it4E(it3->first.end());
177 for (;it4!=it4E;++it4) {
178 if (
mat==it4->first) {
◆ materialChangedCB()
void VP1SoMaterialMixer::Imp::materialChangedCB |
( |
void * |
data, |
|
|
SoSensor * |
sensor |
|
) |
| |
|
static |
Definition at line 131 of file VP1SoMaterialMixer.cxx.
133 SoMaterial *material = (SoMaterial *)
data;
136 " (multiple values in a field). Ignore changes.");
142 it->second->materialChanged(material);
◆ monitorMaterial()
void VP1SoMaterialMixer::Imp::monitorMaterial |
( |
SoMaterial * |
mat | ) |
|
◆ norm()
static float VP1SoMaterialMixer::Imp::norm |
( |
const float & |
x | ) |
|
|
inlinestatic |
◆ setMaterialFieldsAsAverageOfMatList() [1/2]
void VP1SoMaterialMixer::Imp::setMaterialFieldsAsAverageOfMatList |
( |
SoMaterial * |
mat, |
|
|
const std::map< SoMaterial *, double > & |
matlist |
|
) |
| |
Definition at line 228 of file VP1SoMaterialMixer.cxx.
230 float w, totweight(0.0
f);
231 float ambient_r(0.0
f), ambient_g(0.0
f), ambient_b(0.0
f);
232 float diffuse_r(0.0
f), diffuse_g(0.0
f), diffuse_b(0.0
f);
233 float specular_r(0.0
f), specular_g(0.0
f), specular_b(0.0
f);
234 float emissive_r(0.0
f), emissive_g(0.0
f), emissive_b(0.0
f);
235 float shininess(0.0
f), transparency(0.0
f);
237 std::map<SoMaterial*,double>::const_iterator
it(matlist.begin()),
itE(matlist.end());
243 m->ambientColor[0].getValue(
r,
g,
b); ambient_r +=
w*
r; ambient_g +=
w*
g; ambient_b +=
w*
b;
244 m->diffuseColor[0].getValue(
r,
g,
b); diffuse_r +=
w*
r; diffuse_g +=
w*
g; diffuse_b +=
w*
b;
245 m->specularColor[0].getValue(
r,
g,
b); specular_r +=
w*
r; specular_g +=
w*
g; specular_b +=
w*
b;
246 m->emissiveColor[0].getValue(
r,
g,
b); emissive_r +=
w*
r; emissive_g +=
w*
g; emissive_b +=
w*
b;
247 shininess +=
m->shininess[0]*
w;
248 transparency +=
m->transparency[0]*
w;
251 float n = 1.0f/totweight;
252 bool save =
mat->enableNotify(
false);
255 mat->specularColor.setValue(
norm(
n*specular_r),
norm(
n*specular_g),
norm(
n*specular_b));
256 mat->emissiveColor.setValue(
norm(
n*emissive_r),
norm(
n*emissive_g),
norm(
n*emissive_b));
257 mat->shininess.setValue(
norm(
n*shininess));
258 mat->transparency.setValue(
norm(
n*transparency));
260 mat->enableNotify(
true);
◆ setMaterialFieldsAsAverageOfMatList() [2/2]
void VP1SoMaterialMixer::Imp::setMaterialFieldsAsAverageOfMatList |
( |
SoMaterial * |
mat, |
|
|
const std::set< SoMaterial * > & |
matlist |
|
) |
| |
Definition at line 188 of file VP1SoMaterialMixer.cxx.
190 float ambient_r(0.0
f), ambient_g(0.0
f), ambient_b(0.0
f);
191 float diffuse_r(0.0
f), diffuse_g(0.0
f), diffuse_b(0.0
f);
192 float specular_r(0.0
f), specular_g(0.0
f), specular_b(0.0
f);
193 float emissive_r(0.0
f), emissive_g(0.0
f), emissive_b(0.0
f);
194 float shininess(0.0
f), transparency(0.0
f);
196 std::set<SoMaterial*>::const_iterator
it(matlist.begin()),
itE(matlist.end());
198 (*it)->ambientColor[0].getValue(
r,
g,
b); ambient_r +=
r; ambient_g +=
g; ambient_b +=
b;
199 (*it)->diffuseColor[0].getValue(
r,
g,
b); diffuse_r +=
r; diffuse_g +=
g; diffuse_b +=
b;
200 (*it)->specularColor[0].getValue(
r,
g,
b); specular_r +=
r; specular_g +=
g; specular_b +=
b;
201 (*it)->emissiveColor[0].getValue(
r,
g,
b); emissive_r +=
r; emissive_g +=
g; emissive_b +=
b;
202 shininess += (*it)->shininess[0];
203 transparency += (*it)->transparency[0];
206 float n = 1.0f/matlist.size();
207 bool save =
mat->enableNotify(
false);
210 mat->specularColor.setValue(
norm(
n*specular_r),
norm(
n*specular_g),
norm(
n*specular_b));
211 mat->emissiveColor.setValue(
norm(
n*emissive_r),
norm(
n*emissive_g),
norm(
n*emissive_b));
212 mat->shininess.setValue(
norm(
n*shininess));
213 mat->transparency.setValue(
norm(
n*transparency));
215 mat->enableNotify(
true);
◆ defmat
SoMaterial* VP1SoMaterialMixer::Imp::defmat |
◆ mat2sensors
std::map<SoMaterial*,SoNodeSensor*> VP1SoMaterialMixer::Imp::mat2sensors |
◆ matlists2mixedmats
std::map<std::set<SoMaterial*>,SoMaterial*> VP1SoMaterialMixer::Imp::matlists2mixedmats |
◆ matlists2mixedmats_weighted
std::map<std::map<SoMaterial*,double>,SoMaterial*> VP1SoMaterialMixer::Imp::matlists2mixedmats_weighted |
◆ sensor2matmixerimp
◆ theclass
The documentation for this class was generated from the following file: