mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 23:21:19 +02:00
- a few changes and now seems to compile in VC++ 2010 (still need to checkin project files)
This commit is contained in:
@@ -102,7 +102,11 @@ int MapPreview::getStartLocationY(int index) const {
|
||||
static int get_dist(int delta_x, int delta_y) {
|
||||
float dx = (float)delta_x;
|
||||
float dy = (float)delta_y;
|
||||
#ifdef USE_STREFLOP
|
||||
return static_cast<int>(streflop::sqrtf(dx * dx + dy * dy)+0.5); // round correctly
|
||||
#else
|
||||
return static_cast<int>(sqrtf(dx * dx + dy * dy)+0.5); // round correctly
|
||||
#endif
|
||||
}
|
||||
|
||||
void MapPreview::glestChangeHeight(int x, int y, int height, int radius) {
|
||||
@@ -265,7 +269,26 @@ void MapPreview::pirateChangeHeight(int x, int y, int height, int radius) {
|
||||
}
|
||||
|
||||
// Determine which gradients to use and take a weighted average
|
||||
#ifdef USE_STREFLOP
|
||||
if (streflop::fabs(normIf) > streflop::fabs(normJf)) {
|
||||
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]] * streflop::fabs(normJf) +
|
||||
gradient[normI[0]] [normJ[1]] * (1 - streflop::fabs(normJf));
|
||||
}
|
||||
else if (streflop::fabs(normIf) < streflop::fabs(normJf)) {
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]] * streflop::fabs(normIf) +
|
||||
gradient[normI[1]] [normJ[0]] * (1 - streflop::fabs(normIf));
|
||||
}
|
||||
else {
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]];
|
||||
}
|
||||
|
||||
#else
|
||||
if (fabs(normIf) > fabs(normJf)) {
|
||||
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]] * fabs(normJf) +
|
||||
gradient[normI[0]] [normJ[1]] * (1 - fabs(normJf));
|
||||
@@ -279,7 +302,7 @@ void MapPreview::pirateChangeHeight(int x, int y, int height, int radius) {
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
float newAlt = usedGrad * dist + goalAlt;
|
||||
|
||||
@@ -812,9 +835,13 @@ void MapPreview::sinRandomize(int strenght) {
|
||||
float normH = static_cast<float>(i) / w;
|
||||
float normV = static_cast<float>(j) / h;
|
||||
|
||||
#ifdef USE_STREFLOP
|
||||
float sh = (streflop::sinf(normH * sinH1) + streflop::sin(normH * sinH2)) / 2.f;
|
||||
float sv = (streflop::sinf(normV * sinV1) + streflop::sin(normV * sinV2)) / 2.f;
|
||||
#else
|
||||
float sh = (sinf(normH * sinH1) + sin(normH * sinH2)) / 2.f;
|
||||
float sv = (sinf(normV * sinV1) + sin(normV * sinV2)) / 2.f;
|
||||
|
||||
#endif
|
||||
float newHeight = (ah + bh * sh + av + bv * sv) / 2.f;
|
||||
applyNewHeight(newHeight, i, j, strenght);
|
||||
}
|
||||
|
@@ -386,7 +386,11 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
||||
// setup LOD bias factor
|
||||
//const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f);
|
||||
const float lodBias = max(min(0.0f,4.0f),-4.0f);
|
||||
if (fabs(lodBias)>0.01f) {
|
||||
#ifdef USE_STREFLOP
|
||||
if (streflop::fabs(lodBias) > 0.01f) {
|
||||
#else
|
||||
if (fabs(lodBias) > 0.01f) {
|
||||
#endif
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL,GL_TEXTURE_LOD_BIAS, lodBias );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user