-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaterials.js
executable file
·70 lines (61 loc) · 2.04 KB
/
materials.js
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
70
// cubemaps
galaxysim.cubemap_path = 'textures/cubemaps/';
galaxysim.milky_way = ['GalaxyTex_PositiveX.jpg',
'GalaxyTex_NegativeX.jpg',
'GalaxyTex_PositiveY.jpg',
'GalaxyTex_NegativeY.jpg',
'GalaxyTex_PositiveZ.jpg',
'GalaxyTex_NegativeZ.jpg'
];
galaxysim.light_blue = ['BlueNebular_left.jpg',
'BlueNebular_right.jpg',
'BlueNebular_top.jpg',
'BlueNebular_bottom.jpg',
'BlueNebular_front.jpg',
'BlueNebular_back.jpg'
];
galaxysim.blue = ['bkg1_left.jpg',
'bkg1_right.jpg',
'bkg1_top.jpg',
'bkg1_bottom.jpg',
'bkg1_front.jpg',
'bkg1_back.jpg'
];
galaxysim.red = ['bkg2_left.jpg',
'bkg2_right.jpg',
'bkg2_top.jpg',
'bkg2_bottom.jpg',
'bkg2_front.jpg',
'bkg2_back.jpg'
];
galaxysim.cubemaps_list = [galaxysim.milky_way, galaxysim.light_blue, galaxysim.blue, galaxysim.red];
galaxysim.cubemaps = [];
galaxysim.createAllMaterials = function() {
function createParticleMaterial(texture, size, color, blending, opacity) {
return new THREE.PointCloudMaterial({
color: color,
opacity: opacity,
size: size,
map: texture,
blending: blending,
depthTest: false,
transparent: true,
vertexColors: THREE.VertexColors
});
}
var starLargeTexture = THREE.ImageUtils.loadTexture("textures/star_large.png");
var starSmallTexture = THREE.ImageUtils.loadTexture("textures/star_small.png");
var gasCloudTexture = THREE.ImageUtils.loadTexture("textures/cloud.png");
for (var i=0; i < galaxysim.cubemaps_list.length; i++) {
var cubemap = new THREE.CubeTextureLoader()
.setPath(galaxysim.cubemap_path)
.load(galaxysim.cubemaps_list[i]);
cubemap.format = THREE.RGBFormat;
galaxysim.cubemaps.push(cubemap);
}
return {
bright: createParticleMaterial(starLargeTexture, 140, 0xffffff, THREE.AdditiveBlending, 0.0),
brightSmall: createParticleMaterial(starSmallTexture, 80, 0xffffff, THREE.AdditiveBlending, 0.0),
gasCloud: createParticleMaterial(gasCloudTexture, 900, 0xffffff, THREE.NormalBlending, 0.18)
}
};