- fix: no more bleached procedural planets on the F7 screen. (trunk & maintenance)

- change: the position of the light illuminating the F7 screen now varies depending on the planet being shown - switchable at compile time(trunk)
- minor cleanup: there should be less wrongness with the planet orientation on the F7 screen now. (trunk)
- ai bugfix from rev3677 ported to maintenance.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3680 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2010-07-18 07:28:54 +00:00
parent e1e3541ae7
commit 99919cf0d4
2 changed files with 40 additions and 28 deletions

View File

@ -386,29 +386,25 @@ static int baseVertexIndexForEdge(int va, int vb, BOOL textured);
Vector land_hsb, sea_hsb, land_polar_hsb, sea_polar_hsb;
if (_texture == nil)
if (isTextureImage)
{
// standard overlay colours.
land_hsb.x = 0.0; land_hsb.y = 0.0; land_hsb.z = 1.0; // non-saturated fully bright (white)
sea_hsb.x = 0.0; sea_hsb.y = 1.0; sea_hsb.z = 1.0; // fully-saturated fully bright (red)
// override the mainPlanet texture colour...
[self setTextureColorForPlanet:!![dict objectForKey:@"mainForLocalSystem"] inSystem:[dict oo_boolForKey:@"mainForLocalSystem" defaultValue:NO]];
}
else
{
// random land & sea colours.
land_hsb.x = gen_rnd_number() / 256.0; land_hsb.y = gen_rnd_number() / 256.0; land_hsb.z = 0.5 + gen_rnd_number() / 512.0;
sea_hsb.x = gen_rnd_number() / 256.0; sea_hsb.y = gen_rnd_number() / 256.0; sea_hsb.z = 0.5 + gen_rnd_number() / 512.0;
while (dot_product(land_hsb,sea_hsb) > .80) // make sure land and sea colors differ significantly
{
sea_hsb.x = gen_rnd_number() / 256.0; sea_hsb.y = gen_rnd_number() / 256.0; sea_hsb.z = 0.5 + gen_rnd_number() / 512.0;
}
}
else
{
land_hsb.x = 0.0; land_hsb.y = 0.0; land_hsb.z = 1.0; // non-saturated fully bright (white)
sea_hsb.x = 0.0; sea_hsb.y = 1.0; sea_hsb.z = 1.0; // fully-saturated fully bright (red)
}
if (isTextureImage)
{
// override the mainPlanet texture colour...
[self setTextureColorForPlanet:!![dict objectForKey:@"mainForLocalSystem"] inSystem:[dict oo_boolForKey:@"mainForLocalSystem" defaultValue:NO]];
}
else
{
// possibly get land_hsb and sea_hsb from planetinfo.plist entry
// assign land_hsb and sea_hsb overrides from planetinfo.plist if they're there.
ScanVectorFromString([dict objectForKey:@"land_hsb_color"], &land_hsb);
ScanVectorFromString([dict objectForKey:@"sea_hsb_color"], &sea_hsb);

View File

@ -2631,6 +2631,23 @@ static int scriptRandomSeed = -1; // ensure proper random function
#else
OOPlanetEntity* doppelganger = nil;
NSMutableDictionary *planetInfo = [NSMutableDictionary dictionaryWithDictionary:[UNIVERSE generateSystemData:target_system_seed]];
#if 1
// sunlight position for F7 screen is chosen pseudo randomly from 4 different positions.
if (target_system_seed.b & 8)
{
_sysInfoLight = (target_system_seed.b & 2) ? (Vector){ -10000.0, 4000.0, -10000.0 } : (Vector){ -12000.0, -5000.0, -10000.0 };
}
else
{
_sysInfoLight = (target_system_seed.d & 2) ? (Vector){ 6000.0, -5000.0, -10000.0 } : (Vector){ 6000.0, 4000.0, -10000.0 };
}
#else
// basic sunlight position for F7 screen.
_sysInfoLight = (Vector){ -12000.0, -5000.0, -10000.0 };
#endif
[UNIVERSE setMainLightPosition:_sysInfoLight]; // set light origin
if ([i_key isEqualToString:@"local-planet"] && [UNIVERSE sun])
{
@ -2641,7 +2658,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
[planetInfo setObject:texture forKey:@"_oo_textureObject"];
[planetInfo oo_setBool:[mainPlanet isExplicitlyTextured] forKey:@"_oo_isExplicitlyTextured"];
[planetInfo oo_setBool:YES forKey:@"mainForLocalSystem"];
[planetInfo oo_setQuaternion:[mainPlanet orientation] forKey:@"orientation"];
//[planetInfo oo_setQuaternion:[mainPlanet orientation] forKey:@"orientation"]; // the orientation is overwritten later on, without regard for the real planet's orientation.
}
}
@ -2653,20 +2670,19 @@ static int scriptRandomSeed = -1; // ensure proper random function
#endif
ScanVectorFromString([[i_info subarrayWithRange:NSMakeRange(1, 3)] componentsJoinedByString:@" "], &model_p0);
// miniature radii are roughly between 60 and 120. Place miniatures with a radius bigger than 60 a bit futher away.
model_p0 = vector_multiply_scalar(model_p0, 1 - 0.5 * ((60 - [doppelganger radius]) / 60));
Quaternion model_q = { 0.912871, 0.365148, 0.182574, 0.0 }; // pole at top right.
_sysInfoLight = (Vector){ -12000.0, -5000.0, -10000.0 }; // TODO: sysinfo light coming from different places, depending on planet shown.
[UNIVERSE setMainLightPosition:_sysInfoLight]; // set light origin for pole
#if !NEW_PLANETS
if ([doppelganger isTextured])
{
model_q = make_quaternion( 0.707, 0.314, 0.707, 0.0 );
}
#endif
model_p0 = vector_add(model_p0, off);
#if NEW_PLANETS
Quaternion model_q = { 0.912871, 0.365148, 0.182574, 0.0 }; // pole at top right for new planets.
#else
// Only one quaternion needed.
//model_q = make_quaternion( 0.707, 0.314, 0.707, 0.0 );
Quaternion model_q = { 0.833492, 0.333396, 0.440611, 0.0 }; // TODO: find a better quaternion value.
#endif
OOLog(kOOLogDebugProcessSceneStringAddMiniPlanet, @"::::: adding %@ to scene:'%@'", i_key, doppelganger);
[doppelganger setOrientation: model_q];
[doppelganger setPosition: model_p0];