Commit 250941b6 authored by Marcel Campen's avatar Marcel Campen

Added min_val parameter additionally to max_val



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10069 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a1c2e211
......@@ -766,6 +766,7 @@ void TextureControlPlugin::computeValue(Texture& _texture, double _min, double _
const bool clamp = _texture.parameters.clamp ;
const bool center = _texture.parameters.center;
const double max_val = _texture.parameters.max_val;
const double min_val = _texture.parameters.min_val;
const bool abs = _texture.parameters.abs;
const double clamp_max = _texture.parameters.clamp_max;
const double clamp_min = _texture.parameters.clamp_min;
......@@ -819,7 +820,8 @@ void TextureControlPlugin::computeValue(Texture& _texture, double _min, double _
}
} else {
_value -= _min;
_value *= max_val / (_max - _min);
_value *= (max_val - min_val) / (_max - _min);
_value += min_val;
}
}
......@@ -915,6 +917,11 @@ bool TextureControlPlugin::parseMode( QString _mode, Texture& _texture ) {
_texture.parameters.max_val = value.toDouble();
changed = true;
}
} else if ( sectionName == "min_val" ) {
if (value.toDouble() != _texture.parameters.min_val){
_texture.parameters.min_val = value.toDouble();
changed = true;
}
} else if ( sectionName == "repeat" ) {
if ( StringToBool(value) != _texture.parameters.repeat ) {
_texture.parameters.repeat = StringToBool(value);
......@@ -1021,6 +1028,11 @@ void TextureControlPlugin::slotSetTextureMode(QString _textureName ,QString _mod
localTex.parameters.max_val = texture.parameters.max_val;
changed = true;
}
if ( _mode.contains("min_val") && (texture.parameters.min_val != localTex.parameters.min_val) ){
localTex.parameters.min_val = texture.parameters.min_val;
changed = true;
}
if ( _mode.contains("repeat") && (texture.parameters.repeat != localTex.parameters.repeat) ){
localTex.parameters.repeat = texture.parameters.repeat;
......@@ -1225,6 +1237,10 @@ void TextureControlPlugin::applyDialogSettings(TextureData* _texData, QString _t
localTexture.parameters.max_val = globalTexture.parameters.max_val;
changed = true;
}
if (localTexture.parameters.min_val != globalTexture.parameters.min_val){
localTexture.parameters.min_val = globalTexture.parameters.min_val;
changed = true;
}
if (localTexture.parameters.repeat != globalTexture.parameters.repeat){
localTexture.parameters.repeat = globalTexture.parameters.repeat;
changed = true;
......
......@@ -75,7 +75,8 @@ class TexParameters
repeat ( false ),
center ( false ),
abs ( false ),
max_val ( 1.0 ) {};
max_val ( 1.0 ),
min_val ( 0.0 ) {};
bool scale;
......@@ -90,6 +91,7 @@ class TexParameters
bool abs;
double max_val;
double min_val;
};
class Texture {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment