Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
3DClient4SimStadtAPI
Commits
0468704c
Commit
0468704c
authored
Dec 04, 2021
by
BujarMuharemi
Browse files
painting shadows on roof works correctly
parent
363df370
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/js/globe.js
View file @
0468704c
...
...
@@ -398,12 +398,11 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//looping threw all surfaces
tileContent
.
forEach
(
t
=>
{
if
(
t
.
getProperty
(
"
description
"
).
includes
(
"
Roof
"
)){
//HACK: checking if the are a roof surface (should come from feature_type)
for
(
const
[
key
,
value
]
of
Object
.
entries
(
shadowdata
))
{
//looping threw the shadowdata array
for
(
const
[
key
,
value
]
of
Object
.
entries
(
shadowdata
))
{
//looping threw the shadowdata array
if
(
key
===
t
.
getProperty
(
"
gml_id
"
)){
//checking the id
console
.
log
(
value
);
shadowHourValue
=
value
[
chosenDate
.
hour
-
1
];
//getting the current chosen hour from the timeline
t
.
color
=
Cesium
.
Color
.
fromCssColorString
(
getShadowPalette
(
shadowHourValue
));
//coloring the surface
t
.
color
=
Cesium
.
Color
.
fromCssColorString
(
getShadowPalette
(
shadowHourValue
));
//coloring the surface
}
}
...
...
public/js/shadowPalette.js
View file @
0468704c
//Shadow palette for coloring the roofs
//color pallet white->black
var
shadow
Palette
=
[
'
#ffffff
'
,
'
#f0f0f0
'
,
'
#d9d9d9
'
,
'
#bdbdbd
'
,
'
#969696
'
,
'
#737373
'
,
'
#525252
'
,
'
#252525
'
];
//
const shadowPalette = colorPalette.reverse();
var
color
Palette
=
[
'
#ffffff
'
,
'
#f0f0f0
'
,
'
#d9d9d9
'
,
'
#bdbdbd
'
,
'
#969696
'
,
'
#737373
'
,
'
#525252
'
,
'
#252525
'
];
const
shadowPalette
=
colorPalette
.
reverse
();
//returns the responding color from the shadowPalette, depending on the inputShadowValue(0 to 1 in float)
function
getShadowPalette
(
inputShadowValue
){
//TODO: add check for wrong inputShadowValues
function
getShadowPalette
(
inputShadowValue
){
//checking for the float values
var
index
=
Math
.
ceil
((
shadowPalette
.
length
-
1
)
*
inputShadowValue
);
//console.log(inputShadowValue,"---",shadowPalette[index]);
return
shadowPalette
[
index
];
/* Can be ignored for now
if(!Number.isInteger(inputShadowValue)){
var index = Math.ceil((shadowPalette.length-1)*inputShadowValue);
//console.log(shadowPalette[index]);
...
...
@@ -15,9 +19,16 @@ function getShadowPalette(inputShadowValue){
}
//edge case for 0 and 1
else{
//console.log(inputShadowValue);
if(inputShadowValue===0){
//console.log(inputShadowValue);
return shadowPalette[shadowPalette.length-1];
}else{
return shadowPalette[0];
}
//console.log("black",shadowPalette[shadowPalette.length-1]);
return shadowPalette[shadowPalette.length-1];
}
}
*/
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment