1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Added skybox

This commit is contained in:
Jon Ziebell 2022-08-24 22:28:22 -04:00
parent 0ebd2dad6a
commit b2a2e3d723
8 changed files with 32 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
img/visualize/cloudy/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View File

@ -83,6 +83,7 @@ beestat.component.card.three_d.prototype.decorate_ = function(parent) {
*/
beestat.component.card.three_d.prototype.decorate_contents_ = function(parent) {
const drawing_pane_container = document.createElement('div');
drawing_pane_container.style.overflowX = 'hidden';
parent.appendChild(drawing_pane_container);
this.decorate_drawing_pane_(drawing_pane_container);
@ -91,7 +92,6 @@ beestat.component.card.three_d.prototype.decorate_contents_ = function(parent) {
const controls_container = document.createElement('div');
Object.assign(controls_container.style, {
'position': 'absolute',
// 'margin': 'auto',
'top': `${beestat.style.size.gutter}px`,
'left': '50%',
'width': '300px',

View File

@ -92,6 +92,7 @@ beestat.component.scene.prototype.decorate_ = function(parent) {
this.add_renderer_(parent);
this.add_camera_();
this.add_controls_(parent);
this.add_skybox_(parent);
// this.add_sky_();
// this.add_moon_();
// this.add_directional_light_moon_();
@ -226,6 +227,36 @@ beestat.component.scene.prototype.add_controls_ = function(parent) {
this.controls_.maxPolarAngle = Math.PI / 2.5;
};
/**
* Add a skybox background. Generated using Spacescape with the Unity export
* settings. After export: bottom is rotated CW 90°; top is roted 90°CCW.
*
* nx -> bk
* ny -> dn
* nz -> lf
* px -> ft
* py -> up
* pz -> rt
*
* @link https://www.mapcore.org/topic/24535-online-tools-to-convert-cubemaps-to-panoramas-and-vice-versa/
* @link https://jaxry.github.io/panorama-to-cubemap/
* @link http://alexcpeterson.com/spacescape/
*/
beestat.component.scene.prototype.add_skybox_ = function() {
const skybox_name = 'cloudy';
const loader = new THREE.CubeTextureLoader();
loader.setPath('img/visualize/' + skybox_name + '/');
const texture = loader.load([
'front.png',
'back.png',
'up.png',
'down.png',
'right.png',
'left.png'
]);
this.scene_.background = texture;
};
/**
* Add the sky to the scene. This is a shader that draws on the inside of a
* box really far away. The size of the sun can be tweaked with the