# Path: webalchemy/config.py
# DEFAULT_SETTINGS = {
#     'SERVER_STATIC_PATH': 'static',
#     'SERVER_PORT': 8080,
#     'SERVER_SSL_CERT': None,
#     'SERVER_SSL_KEY': None,
#     'SERVER_MONITORED_FILES': None,
#     'SERVER_MAIN_ROUTE': None,
#     'FREEZE_OUTPUT': None,
# }
# def read_config_from_app(app):
# def from_object(obj):
# def from_pyfile(filename, root=None):
# def from_envvar(variable_name):
# def from_dict(d):
#     def __init__(self, **kwargs):
#     def from_object(self, obj):
#     def from_pyfile(self, filename, root=None):
#     def from_envvar(self, variable_name):
#     def from_dict(self, d):
# class Config(dict):


from webalchemy import config
        geometry = new(THREE.SphereGeometry, radius, segments, segments)
        material = new(THREE.MeshPhongMaterial, {
                        'map':         THREE.ImageUtils.loadTexture('static/lowres_noclouds.jpg'),
                        'bumpMap':     THREE.ImageUtils.loadTexture('static/lowres_elevbump.jpg'),
                        'bumpScale':   0.005,
                        'specularMap': THREE.ImageUtils.loadTexture('static/lowres_water.png'),
                        'specular':    new(THREE.Color, 'grey')
        })
        return new(THREE.Mesh, geometry, material)

    def createClouds(self, radius, segments):
        geometry = new(THREE.SphereGeometry, radius + 0.005, segments, segments)
        material = new(THREE.MeshPhongMaterial, {
                        'map':         THREE.ImageUtils.loadTexture('static/lowres_fairclouds.png'),
                        'transparent': true
        })
        return new(THREE.Mesh, geometry,  material)

    def createStars(self, radius, segments):
        geometry = new(THREE.SphereGeometry, radius, segments, segments)
        material = new(THREE.MeshBasicMaterial, {
                        'map':  THREE.ImageUtils.loadTexture('static/lowres_starfield.png'),
                        'side': THREE.BackSide
        })
        return new(THREE.Mesh, geometry, material)


class ThreeDEarth:

    include = ['https://rawgithub.com/mrdoob/three.js/master/build/three.min.js']

# Path: webalchemy/config.py
# DEFAULT_SETTINGS = {
#     'SERVER_STATIC_PATH': 'static',
#     'SERVER_PORT': 8080,
#     'SERVER_SSL_CERT': None,
#     'SERVER_SSL_KEY': None,
#     'SERVER_MONITORED_FILES': None,
#     'SERVER_MAIN_ROUTE': None,
#     'FREEZE_OUTPUT': None,
# }
# def read_config_from_app(app):
# def from_object(obj):
# def from_pyfile(filename, root=None):
# def from_envvar(variable_name):
# def from_dict(d):
#     def __init__(self, **kwargs):
#     def from_object(self, obj):
#     def from_pyfile(self, filename, root=None):
#     def from_envvar(self, variable_name):
#     def from_dict(self, d):
# class Config(dict):


# Path: examples/three_d_earth/three_d_earth.py
from webalchemy import config

        geometry = new(THREE.SphereGeometry, radius, segments, segments)
        material = new(THREE.MeshPhongMaterial, {
                        'map':         THREE.ImageUtils.loadTexture('static/lowres_noclouds.jpg'),
                        'bumpMap':     THREE.ImageUtils.loadTexture('static/lowres_elevbump.jpg'),
                        'bumpScale':   0.005,
                        'specularMap': THREE.ImageUtils.loadTexture('static/lowres_water.png'),
                        'specular':    new(THREE.Color, 'grey')
        })
        return new(THREE.Mesh, geometry, material)

    def createClouds(self, radius, segments):
        geometry = new(THREE.SphereGeometry, radius + 0.005, segments, segments)
        material = new(THREE.MeshPhongMaterial, {
                        'map':         THREE.ImageUtils.loadTexture('static/lowres_fairclouds.png'),
                        'transparent': true
        })
        return new(THREE.Mesh, geometry,  material)

    def createStars(self, radius, segments):
        geometry = new(THREE.SphereGeometry, radius, segments, segments)
        material = new(THREE.MeshBasicMaterial, {
                        'map':  THREE.ImageUtils.loadTexture('static/lowres_starfield.png'),
                        'side': THREE.BackSide
        })
        return new(THREE.Mesh, geometry, material)


class ThreeDEarth:

    include = ['https://rawgithub.com/mrdoob/three.js/master/build/three.min.js']

    config = config.from_object(__name__)