mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
add an example script to control the sun light
This commit is contained in:
parent
6b29e314c2
commit
b4cb5ca9d1
1 changed files with 32 additions and 0 deletions
32
examples/example/misc/sunLightExample.js
Normal file
32
examples/example/misc/sunLightExample.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// SunLightExample.js
|
||||||
|
// examples
|
||||||
|
// Sam Gateau
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
var intensity = 1.0;
|
||||||
|
var day = 0.0;
|
||||||
|
var hour = 12.0;
|
||||||
|
var longitude = 0.0;
|
||||||
|
var latitude = -45.0;
|
||||||
|
|
||||||
|
Scene.setDayTime(hour);
|
||||||
|
Scene.setOriginLocation(longitude, latitude, 0.0);
|
||||||
|
|
||||||
|
function ticktack() {
|
||||||
|
hour += 0.1;
|
||||||
|
//Scene.setSunIntensity(Math.cos(time));
|
||||||
|
if (hour > 24.0) {
|
||||||
|
hour = 0.0;
|
||||||
|
day++;
|
||||||
|
Scene.setYearTime(day);
|
||||||
|
}
|
||||||
|
Scene.setDayTime(hour);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.setInterval(ticktack, 41);
|
Loading…
Reference in a new issue