Add normal_gloss texture mode (requested by wezu)

This commit is contained in:
rdb 2012-02-13 08:35:52 +00:00
parent 3bb89ff4eb
commit 949395a4cc
9 changed files with 26 additions and 3 deletions

View File

@ -16,6 +16,7 @@ it is likely to contain bugs.
* Ambient occlusion generation for terrain
* Fixed bug where Windows installer wipes %PATH% when it's too long
* Added fog support to the shader generator
* Added normal_gloss texture mode
* Added a custom color option to the cartoon filter
* Support for texture arrays in shaders
* Better shader support in pandadx9

View File

@ -774,7 +774,8 @@ recompute_tangent_binormal_auto() {
for (eti = texs.begin(); eti != texs.end(); eti++) {
EggTexture *eggtex = (*eti);
if ((eggtex->get_env_type() == EggTexture::ET_normal)||
(eggtex->get_env_type() == EggTexture::ET_normal_height)) {
(eggtex->get_env_type() == EggTexture::ET_normal_height)||
(eggtex->get_env_type() == EggTexture::ET_normal_gloss)) {
string uv = eggtex->get_uv_name();
vector_string::iterator it = find(names.begin(), names.end(), uv);
if (it == names.end()) {

View File

@ -585,6 +585,7 @@ affects_polygon_alpha() const {
case ET_glow:
case ET_gloss:
case ET_height:
case ET_normal_gloss:
return false;
case ET_selector:
@ -925,6 +926,9 @@ string_env_type(const string &string) {
} else if (cmp_nocase_uh(string, "selector") == 0) {
return ET_selector;
} else if (cmp_nocase_uh(string, "normal_gloss") == 0) {
return ET_normal_gloss;
} else {
return ET_unspecified;
}
@ -1376,6 +1380,9 @@ ostream &operator << (ostream &out, EggTexture::EnvType type) {
case EggTexture::ET_selector:
return out << "selector";
case EggTexture::ET_normal_gloss:
return out << "normal_gloss";
}
nassertr(false, out);

View File

@ -106,6 +106,7 @@ PUBLISHED:
ET_gloss,
ET_height,
ET_selector,
ET_normal_gloss,
};
enum CombineMode {
CM_unspecified,

View File

@ -1506,6 +1506,10 @@ make_texture_stage(const EggTexture *egg_tex) {
stage->set_mode(TextureStage::M_selector);
break;
case EggTexture::ET_normal_gloss:
stage->set_mode(TextureStage::M_normal_gloss);
break;
case EggTexture::ET_unspecified:
break;
}

View File

@ -542,6 +542,9 @@ operator << (ostream &out, TextureStage::Mode mode) {
case TextureStage::M_selector:
return out << "selector";
case TextureStage::M_normal_gloss:
return out << "normal_gloss";
}
return out << "**invalid Mode(" << (int)mode << ")**";

View File

@ -65,6 +65,7 @@ PUBLISHED:
M_gloss, // Rarely used: modulate_gloss is more efficient.
M_height, // Rarely used: normal_height is more efficient.
M_selector,
M_normal_gloss,
};
enum CombineMode {

View File

@ -766,6 +766,7 @@ make_texture_layer(const NodePath &render,
case TextureStage::M_gloss:
case TextureStage::M_height:
case TextureStage::M_selector:
case TextureStage::M_normal_gloss:
// Don't know what to do with these funny modes. We should
// probably raise an exception or something. Fall through for
// now.

View File

@ -290,7 +290,9 @@ analyze_renderstate(const RenderState *rs) {
for (int i=0; i<_num_textures; i++) {
TextureStage *stage = texture->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if ((mode == TextureStage::M_normal)||(mode == TextureStage::M_normal_height)) {
if ((mode == TextureStage::M_normal)||
(mode == TextureStage::M_normal_height)||
(mode == TextureStage::M_normal_gloss)) {
_map_index_normal = i;
}
if ((mode == TextureStage::M_height)||(mode == TextureStage::M_normal_height)) {
@ -299,7 +301,9 @@ analyze_renderstate(const RenderState *rs) {
if ((mode == TextureStage::M_glow)||(mode == TextureStage::M_modulate_glow)) {
_map_index_glow = i;
}
if ((mode == TextureStage::M_gloss)||(mode == TextureStage::M_modulate_gloss)) {
if ((mode == TextureStage::M_gloss)||
(mode == TextureStage::M_modulate_gloss)||
(mode == TextureStage::M_normal_gloss)) {
_map_index_gloss = i;
}
if (mode == TextureStage::M_height) {