*** empty log message ***

This commit is contained in:
David Rose 2001-05-04 03:11:40 +00:00
parent b0baecece5
commit a38bbff0b7
2 changed files with 30 additions and 9 deletions

View File

@ -69,6 +69,10 @@ CLwoSurface(LwoToEggConverter *converter, const LwoSurface *surface) :
_flags |= F_transparency;
_transparency = param->_value;
} else if (type == IffId("GLOS")) {
_flags |= F_gloss;
_gloss = param->_value;
} else if (type == IffId("TRNL")) {
_flags |= F_translucency;
_translucency = param->_value;
@ -126,6 +130,8 @@ CLwoSurface(LwoToEggConverter *converter, const LwoSurface *surface) :
if ((_flags & F_transparency) != 0) {
_color[3] = 1.0 - _transparency;
}
_diffuse_color = _color;
}
////////////////////////////////////////////////////////////////////
@ -165,7 +171,7 @@ apply_properties(EggPrimitive *egg_prim, vector_PT_EggVertex &egg_vertices,
bool has_texture = check_texture();
bool has_material = check_material();
egg_prim->set_color(_color);
egg_prim->set_color(_diffuse_color);
if (has_material) {
egg_prim->set_material(_egg_material);
@ -293,12 +299,19 @@ check_material() {
_egg_material = new EggMaterial(get_name());
if ((_flags & F_diffuse) != 0) {
Colorf diffuse(_color[0] * _diffuse,
_color[1] * _diffuse,
_color[2] * _diffuse,
_color[3]);
_egg_material->set_diff(diffuse);
_diffuse_color.set(_color[0] * _diffuse,
_color[1] * _diffuse,
_color[2] * _diffuse,
_color[3]);
// We want to avoid setting the diffuse color on the material.
// We're already setting the color explicitly on the object, so
// there's no need to also set a diffuse color on the material,
// and doing so prevents nice features like set_color() and
// set_color_scale() from working in Panda.
//_egg_material->set_diff(_diffuse_color);
}
if ((_flags & F_luminosity) != 0) {
Colorf luminosity(_color[0] * _luminosity,
_color[1] * _luminosity,
@ -306,6 +319,7 @@ check_material() {
1.0);
_egg_material->set_emit(luminosity);
}
if ((_flags & F_specular) != 0) {
Colorf specular(_color[0] * _specular,
_color[1] * _specular,
@ -314,6 +328,10 @@ check_material() {
_egg_material->set_spec(specular);
}
if ((_flags & F_gloss) != 0) {
_egg_material->set_shininess(_gloss * 128.0);
}
return true;
}

View File

@ -52,9 +52,10 @@ public:
F_specular = 0x0008,
F_reflection = 0x0010,
F_transparency = 0x0020,
F_translucency = 0x0040,
F_smooth_angle = 0x0080,
F_backface = 0x0100,
F_gloss = 0x0040,
F_translucency = 0x0080,
F_smooth_angle = 0x0100,
F_backface = 0x0200,
};
int _flags;
@ -64,11 +65,13 @@ public:
float _specular;
float _reflection;
float _transparency;
float _gloss;
float _translucency;
float _smooth_angle;
bool _backface;
Colorf _color;
Colorf _diffuse_color;
LwoToEggConverter *_converter;
CPT(LwoSurface) _surface;