added the keep alpha feature

This commit is contained in:
Asad M. Zaman 2006-01-11 00:39:23 +00:00
parent 74d6a7265a
commit e53e0f8b6d
3 changed files with 12 additions and 7 deletions

View File

@ -60,6 +60,7 @@ MayaShaderColorDef() {
_wrap_v = true;
_has_alpha_channel = false;
_keep_alpha = false;
_blend_type = BT_unspecified;
@ -102,6 +103,7 @@ MayaShaderColorDef(MayaShaderColorDef &copy) {
_blend_type = copy._blend_type;
_has_alpha_channel = copy._has_alpha_channel;
_keep_alpha = copy._keep_alpha;
_repeat_uv = copy._repeat_uv;
_offset = copy._offset;
@ -336,13 +338,11 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
} else if (color.hasFn(MFn::kLayeredTexture)) {
maya_cat.debug() << "Found layered texture" << endl;
MFnDependencyNode layered_fn(color);
MPlugArray color_pa;
layered_fn.getConnections(color_pa);
int blendValue;
MStatus status;
MPlugArray color_pa;
MFnDependencyNode layered_fn(color);
layered_fn.getConnections(color_pa);
MPlug inputsPlug = layered_fn.findPlug("inputs", &status);
MPlug blendModePlug = layered_fn.findPlug("blendMode", &status);
@ -377,6 +377,8 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
break;
case 6:
bt = BT_modulate;
get_bool_attribute(color, "keepAlpha", _keep_alpha);
maya_cat.info() << "keepAlpha: " << _keep_alpha << endl;
break;
case 4:
bt = BT_add;

View File

@ -96,6 +96,7 @@ public:
bool _wrap_v;
bool _has_alpha_channel;
bool _keep_alpha;
LVector2f _repeat_uv;
LVector2f _offset;

View File

@ -2326,7 +2326,9 @@ set_shader_attributes(EggPrimitive &primitive, const MayaShader &shader,
if ((EggTexture::EnvType)color_def->_blend_type == EggTexture::ET_modulate) {
// read the _has_alpha_cahnnel to figure out rgb or rgba
//if (!color_def->_has_alpha_channel) {
//Maya's multiply is slightly different than panda's. Hence we are dropping the alpha.
// Maya's multiply is slightly different than panda's. Unless, _keep_alpha is set,
// we are dropping the alpha.
if (!color_def->_keep_alpha)
is_rgb = true; // modulate forces the alpha to be ignored
//}
}