Commit 9f7a24f4 authored by Torsten Rahn's avatar Torsten Rahn
Browse files

- Highlights for mountains

	- Fixed bug introduced by ingwa


svn path=/trunk/KDE/kdeedu/marble/; revision=717279
parent a06039a5
2007-09-26 Torsten Rahn <rahn@kde.org>
* src/lib/TextureColorizer.cpp:
* src/lib/texturepalette.cpp:
* src/lib/MarbleModel.h:
* tools/palettegen/palettegen.cpp:
- Highlights for mountains
- Fixed bug introduced by ingwa
2007-09-26 Torsten Rahn <rahn@kde.org>
* src/lib/PlaceMarkLayout.{h,cpp}:
- Adding placeMarksOnScreenLimit()
......
......@@ -192,14 +192,14 @@ class MARBLE_EXPORT MarbleModel : public QObject
void stopPolling();
Q_SIGNALS:
#if 0
/**
* @brief Signal that the MarbleModel has started to create a new set of tiles.
* @param
* @see zoomView()
*/
void creatingTilesStart( TileCreator*, const QString& name, const QString& description );
#endif
/**
* @brief Signal that the map theme has changed, and to which theme.
......
......@@ -91,22 +91,13 @@ void TextureColorizer::colorize(ViewParams *viewParams)
if ( showRelief == true )
{
bump = emboss.gpuint.x1 - grey;
if ( bump > 15 ) bump = 15;
if ( bump < 0 ) bump = 0;
}
else
bump = 0;
/*
if ( showRelief == true )
{
bump = ( emboss.gpuint.x1 + 7 - grey );
bump = ( emboss.gpuint.x1 + 8 - grey );
if ( bump < 0 ) bump = 0;
if ( bump > 15 ) bump = 15;
}
else
bump = 8;
*/
if ( *coastData == landoffscreen )
*writeData = texturepalette[bump][grey + 0x100];
else {
......@@ -153,32 +144,23 @@ void TextureColorizer::colorize(ViewParams *viewParams)
if ( showRelief == true )
{
bump = ( emboss.gpuint.x1 - grey ) >> 1;
bendradius = bendReliefx * relief;
bump *= qRound( 1.0 - bendradius * bendradius );
if ( bump > 15 ) bump = 15;
if ( bump < 0 ) bump = 0;
}
else
bump = 0;
bump = ( emboss.gpuint.x1 + 8 - grey ) >> 1;
bump += 3;
/*
if ( showRelief == true && emboss.gpuint.x1 > grey ) {
bump = ( emboss.gpuint.x1 - grey ) >> 1; // >> 1 to soften bumpmapping
// Apply "spherical" bumpmapping
// bump *= cos( bendRelief * sqrt(((imgrx-x)^2+(imgry-y)^2)));
// very cheap approximation:
// sqrt(dx^2 + dy^2) ~= 0.41 dx + 0.941246 +/- 3%
// cos(x) ~= 1-x^2
bendradius = bendReliefx * relief;
bump *= qRound( 1.0 - bendradius * bendradius );
*/
if ( bump > 15 ) bump = 15;
if ( bump < 0 ) bump = 0;
}
else
bump = 0;
*/
bump = 8;
if ( *coastData == landoffscreen )
*writeData = texturepalette[bump][grey + 0x100];
......
This diff is collapsed.
......@@ -10,6 +10,7 @@
//
#include <QtCore/QDebug>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QtCore/QStringList>
......@@ -79,43 +80,34 @@ int main(int argc, char *argv[])
}
painter.setBrush( gradient );
painter.drawRect( 0, 0, 256, 10 );
/*
int alpha;
if ( j < 8 ) alpha = j;
else alpha = 2 * (j - 7) + 7;
int alpha = j;
for ( int i = 0; i < 256; ++i) {
if ( filename == filelist[0] ) {
QRgb palcol = gradimg->pixel( i, 1 );
int red = qRed( palcol ) + 16 - alpha;
if ( red < 0 ) red = 0;
if ( red > 255 ) red = 255;
int green = qGreen( palcol ) + 16 - alpha;
if ( green < 0 ) green = 0;
if ( green > 255 ) green = 255;
int blue = qBlue( palcol ) + 16 - alpha;
if ( blue < 0 ) blue = 0;
if ( blue > 255 ) blue = 255;
palcol = qRgb( red, green, blue );
QRgb shadeColor = gradimg->pixel( i, 1 );
QImage shadeImage ( 256, 10, QImage::Format_RGB32 );
QLinearGradient shadeGradient( 0, 0, 256, 0 );
shadeGradient.setColorAt(0.15, QColor(Qt::white));
shadeGradient.setColorAt(0.496, shadeColor);
shadeGradient.setColorAt(0.504, shadeColor);
shadeGradient.setColorAt(0.75, QColor(Qt::black));
QPainter shadePainter(&shadeImage);
shadePainter.setPen(Qt::NoPen);
shadePainter.setBrush( shadeGradient );
shadePainter.drawRect( 0, 0, 256, 10 );
int shadeIndex = 120 + alpha;
// qDebug() << QString("Shade: %1").arg(shadeIndex);
QRgb palcol = shadeImage.pixel( shadeIndex, 1 );
if ( filename == filelist[0] ) {
if ( i == 0 )
out << " { 0x" << (uint)palcol << "," << endl;
else
out << " 0x" << (uint)palcol << "," << endl;
}
else {
QRgb palcol = gradimg->pixel(i,1);
int red = qRed( palcol ) + 16 - alpha;
if ( red < 0 ) red = 0;
if ( red > 255 ) red = 255;
int green = qGreen( palcol ) + 16 - alpha;
if ( green < 0 ) green = 0;
if ( green > 255 ) green = 255;
int blue = qBlue( palcol ) + 16 - alpha;
if ( blue < 0 ) blue = 0;
if ( blue > 255 ) blue = 255;
palcol = qRgb( red, green, blue );
if ( i == 255 )
out << " 0x" << (uint)palcol << " }," << endl;
else
......@@ -123,42 +115,6 @@ int main(int argc, char *argv[])
// out << " " << (uint)gradimg->pixel(i,1) << "," << endl;
}
}
*/
int alpha = 2 * j;
for ( int i = 0; i < 256; ++i) {
if ( filename == filelist[0] ) {
QRgb palcol = gradimg->pixel( i, 1 );
int red = ( qRed( palcol ) - alpha > 0
? qRed( palcol ) - alpha : 0 );
int green = ( qGreen( palcol ) - alpha > 0
? qGreen( palcol ) - alpha : 0 );
int blue = ( qBlue( palcol ) - alpha > 0
? qBlue( palcol ) - alpha : 0 );
palcol = qRgb( red, green, blue );
if ( i == 0 )
out << " { 0x" << (uint)palcol << "," << endl;
else
out << " 0x" << (uint)palcol << "," << endl;
}
else {
QRgb palcol = gradimg->pixel(i,1);
int red = ( qRed( palcol ) - alpha > 0
? qRed( palcol ) - alpha : 0 );
int green = ( qGreen( palcol ) - alpha > 0
? qGreen( palcol ) - alpha : 0 );
int blue = ( qBlue( palcol ) - alpha > 0
? qBlue( palcol ) - alpha : 0 );
palcol = qRgb( red, green, blue );
if ( i == 255 )
out << " 0x" << (uint)palcol << " }," << endl;
else
out << " 0x" << (uint)palcol << "," << endl;
// out << " " << (uint)gradimg->pixel(i,1) << "," << endl;
}
}
}
}
......
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