File: make_canion

package info (click to toggle)
slune 1.0.7-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 25,332 kB
  • ctags: 1,061
  • sloc: python: 9,171; makefile: 8
file content (69 lines) | stat: -rwxr-xr-x 2,034 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /usr/bin/python -O
# -*- python -*-

# Slune
# Copyright (C) 2002-2003 Jean-Baptiste LAMY
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# launch this script to generate the level

import math, os, os.path
import copy

import soya
import soya.model  as model
import soya.soya3d as soya3d
import soya.editor.main
import soya.land

import slune.level


root = soya3d.World()
w = soya3d.World(root)
w.set_xyz(-20.0, -20.0, -20.0)
atm = soya3d.Atmosphere()
atm.ambient = (0.3, 0.3, 0.3, 1.0)
atm.bg_color  = (0.2, 0.1, 0.4, 1.0)
atm.skyplane = 1
atm.sky_color = (1.0, 1.0, 0.5, 1.0)
atm.fog_color = (0.2, 0.1, 0.4, 1.0)
atm.fog_type    = 0
atm.fog_start   = 10.0
atm.fog_end     = 50.0
atm.fog         = 1
atm.fog_density = 0.0
atm.cloud = model.Material.get("clouds1")
w.atmosphere = atm
land = soya.land.Land()
land.from_image(os.path.join(model.Image.PATH, "canion.png"))
land.map_size = 8
land.scale_factor = 1.5
land.texture_factor = 0.5
land.multiply_height(50.0)
land.set_texture_layer(model.Material.get("jungle1"),  0.0,  15.0)
land.set_texture_layer(model.Material.get("rocks1"), 15.0,  21.0)
land.set_texture_layer(model.Material.get("glace1"),  21.0, 26.0)
land.set_texture_layer(model.Material.get("snow1"),  26.0, 50.0)
w.set_shape(land)
w.y = -35.0
light = soya3d.Light(w)
light.set_xyz(20.0, 30.0, 20.0)

root.filename = "canion-level"
root.save()

print "Done."