Optimized surface division for speed.

This commit is contained in:
Quantum 2013-10-31 17:56:16 -04:00
parent a8bb6dfd34
commit 2c1344d799
2 changed files with 6 additions and 3 deletions

View file

@ -23,6 +23,7 @@
"roll": -90,
"mass": 5.97219e+24,
"rotation": 86400,
"division": 70,
"atmosphere": {
"cloud_texture": "cloudmap.png",
"diffuse_texture": "atmosphere_earth.png",
@ -35,6 +36,7 @@
"radius": 1738.14,
"distance": 38439,
"sma": 384399,
"division": 30,
"eccentricity": 0.0549,
"inclination": 5.145,
"rotation": 0,
@ -59,6 +61,7 @@
"mass": 6.4185e+23,
"rotation": 88643,
"orbit_distance": "AU",
"division": 30,
"satellites": {
"phobos": {
"distance": 9377,
@ -240,7 +243,8 @@
"texture": "sky.jpg",
"optional": true,
"lighting": false,
"radius": 190000,
"radius": 305000000,
"division": 30,
"pitch": 90,
"yaw": 30,
"roll": 180,

View file

@ -87,12 +87,12 @@ def load_world(file):
radius = e(info.get('radius', length)) / length
background = info.get('background', False)
orbit_distance = e(info.get('orbit_distance', au))
division = info.get('division', max(min(int(radius / 8), 60), 10))
if 'texture' in info:
cheap, skip, texture = get_best_texture(info['texture'], optional=info.get('optional', False))
if skip:
return
division = min(int(radius / 2), 100)
if cheap:
object_id = compile(colourball, radius, division, division, texture)
else:
@ -137,7 +137,6 @@ def load_world(file):
cloud_texture = atmosphere_data.get('cloud_texture', None)
cheap, _, cloud_texture = get_best_texture(cloud_texture)
if not cheap:
division = min(int(radius / 2), 100)
cloudmap_id = compile(sphere, radius + 2, division, division, cloud_texture,
lighting=False)
cheap, _, atm_texture = get_best_texture(atm_texture)