mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
updated multi-texture with more power
This commit is contained in:
parent
1e8a6a9fee
commit
02a4499126
@ -50,6 +50,8 @@ MayaShader(MObject engine) {
|
|||||||
<< "Reading shading engine " << get_name() << "\n";
|
<< "Reading shading engine " << get_name() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_alpha_is_luminance = true;
|
||||||
|
|
||||||
bool found_shader = false;
|
bool found_shader = false;
|
||||||
MPlug shader_plug = engine_fn.findPlug("surfaceShader");
|
MPlug shader_plug = engine_fn.findPlug("surfaceShader");
|
||||||
if (!shader_plug.isNull()) {
|
if (!shader_plug.isNull()) {
|
||||||
|
@ -53,6 +53,8 @@ public:
|
|||||||
typedef pvector<MayaShaderColorDef *> ColorDef;
|
typedef pvector<MayaShaderColorDef *> ColorDef;
|
||||||
ColorDef _color;
|
ColorDef _color;
|
||||||
|
|
||||||
|
bool _alpha_is_luminance;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool read_surface_shader(MObject shader);
|
bool read_surface_shader(MObject shader);
|
||||||
};
|
};
|
||||||
|
@ -58,6 +58,8 @@ MayaShaderColorDef() {
|
|||||||
_wrap_u = true;
|
_wrap_u = true;
|
||||||
_wrap_v = true;
|
_wrap_v = true;
|
||||||
|
|
||||||
|
_alpha_is_luminance = false;
|
||||||
|
|
||||||
_repeat_uv.set(1.0, 1.0);
|
_repeat_uv.set(1.0, 1.0);
|
||||||
_offset.set(0.0, 0.0);
|
_offset.set(0.0, 0.0);
|
||||||
_rotate_uv = 0.0;
|
_rotate_uv = 0.0;
|
||||||
@ -95,6 +97,8 @@ MayaShaderColorDef(MayaShaderColorDef ©) {
|
|||||||
_wrap_u = copy._wrap_u;
|
_wrap_u = copy._wrap_u;
|
||||||
_wrap_v = copy._wrap_v;
|
_wrap_v = copy._wrap_v;
|
||||||
|
|
||||||
|
_alpha_is_luminance = copy._alpha_is_luminance;
|
||||||
|
|
||||||
_repeat_uv = copy._repeat_uv;
|
_repeat_uv = copy._repeat_uv;
|
||||||
_offset = copy._offset;
|
_offset = copy._offset;
|
||||||
_rotate_uv = copy._rotate_uv;
|
_rotate_uv = copy._rotate_uv;
|
||||||
@ -256,6 +260,8 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
|
|||||||
get_vec2f_attribute(color, "translateFrame", _translate_frame);
|
get_vec2f_attribute(color, "translateFrame", _translate_frame);
|
||||||
get_angle_attribute(color, "rotateFrame", _rotate_frame);
|
get_angle_attribute(color, "rotateFrame", _rotate_frame);
|
||||||
|
|
||||||
|
get_bool_attribute(color, "alphaIsLuminance", _alpha_is_luminance);
|
||||||
|
|
||||||
get_bool_attribute(color, "mirror", _mirror);
|
get_bool_attribute(color, "mirror", _mirror);
|
||||||
get_bool_attribute(color, "stagger", _stagger);
|
get_bool_attribute(color, "stagger", _stagger);
|
||||||
get_bool_attribute(color, "wrapU", _wrap_u);
|
get_bool_attribute(color, "wrapU", _wrap_u);
|
||||||
@ -309,6 +315,10 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
|
|||||||
//shader->_multi_texture = true;
|
//shader->_multi_texture = true;
|
||||||
//get_enum_attribute(color,"blendMode",shader->_blend_mode);
|
//get_enum_attribute(color,"blendMode",shader->_blend_mode);
|
||||||
//maya_cat.debug() << "blend mode :" << shader->_blend_mode << endl;
|
//maya_cat.debug() << "blend mode :" << shader->_blend_mode << endl;
|
||||||
|
|
||||||
|
get_bool_attribute(color, "alphaIsLuminance", shader->_alpha_is_luminance);
|
||||||
|
// get_bool_attribute(color, "isVisible", test_b);
|
||||||
|
|
||||||
MFnDependencyNode layered_fn(color);
|
MFnDependencyNode layered_fn(color);
|
||||||
MPlugArray color_pa;
|
MPlugArray color_pa;
|
||||||
MStatus status = layered_fn.getConnections(color_pa);
|
MStatus status = layered_fn.getConnections(color_pa);
|
||||||
@ -351,10 +361,10 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
|
|||||||
/*
|
/*
|
||||||
string blah;
|
string blah;
|
||||||
get_enum_attribute(pl.node(),"blendMode",blah);
|
get_enum_attribute(pl.node(),"blendMode",blah);
|
||||||
maya_cat.debug() << "blend mode :" << blah << endl;
|
maya_cat.info() << "rsc layer: blend mode :" << blah << endl;
|
||||||
float alpha;
|
float alpha;
|
||||||
get_maya_attribute(pl.node(),"alpha",alpha);
|
get_maya_attribute(pl.node(),"alpha",alpha);
|
||||||
maya_cat.debug() << "alpha :" << alpha << endl;
|
maya_cat.info() << "rsc layer: alpha :" << alpha << endl;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -80,6 +80,8 @@ public:
|
|||||||
bool _stagger;
|
bool _stagger;
|
||||||
bool _wrap_u;
|
bool _wrap_u;
|
||||||
bool _wrap_v;
|
bool _wrap_v;
|
||||||
|
|
||||||
|
bool _alpha_is_luminance;
|
||||||
|
|
||||||
LVector2f _repeat_uv;
|
LVector2f _repeat_uv;
|
||||||
LVector2f _offset;
|
LVector2f _offset;
|
||||||
|
@ -2281,13 +2281,19 @@ set_shader_attributes(EggPrimitive &primitive, const MayaShader &shader, const M
|
|||||||
//tex.set_format(EggTexture::F_rgb);
|
//tex.set_format(EggTexture::F_rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// if multi-textured, first texture in maya is on top, so
|
// if multi-textured, first texture in maya is on top, so
|
||||||
// default it to decal
|
if (shader._color.size() > 1) {
|
||||||
if ((shader._color.size() > 1) && (i!=shader._color.size()-1))
|
if (i!=shader._color.size()-1) {
|
||||||
tex.set_env_type(EggTexture::ET_decal);
|
// read the _alpha_is_luminance to figure out env_type
|
||||||
*/
|
if (!shader._alpha_is_luminance)
|
||||||
|
tex.set_env_type(EggTexture::ET_decal);
|
||||||
|
}
|
||||||
|
if (color_def->_alpha_is_luminance) {
|
||||||
|
// multitexture modulate mode may specify, desired alpha on/off
|
||||||
|
if (color_def->_alpha_is_luminance)
|
||||||
|
tex.set_alpha_mode(EggRenderMode::AM_off); // Force alpha to be 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
} else { // trans_def._has_texture
|
} else { // trans_def._has_texture
|
||||||
// We have a texture on transparency only. Apply it as the
|
// We have a texture on transparency only. Apply it as the
|
||||||
// primary filename, and set the format accordingly.
|
// primary filename, and set the format accordingly.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user