Skip to content

Commit

Permalink
Add the possibility to switch between environment maps #161
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Jun 12, 2022
1 parent 6a0148b commit ef5c710
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion source/website/featureset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const FeatureSet =
{
EnvironmentMap : true

};
49 changes: 23 additions & 26 deletions source/website/sidebarsettingspanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Color, ColorToHexString } from '../engine/model/color.js';
import { AddDiv, AddDomElement, ShowDomElement, SetDomElementOuterHeight } from '../engine/viewer/domutils.js';
import { AddRangeSlider, AddToggle, AddCheckbox } from '../website/utils.js';
import { CalculatePopupPositionToElementTopLeft } from './dialogs.js';
import { FeatureSet } from './featureset.js';
import { PopupDialog } from './dialog.js';
import { Settings, Theme } from './settings.js';
import { SidebarPanel } from './sidebarpanel.js';
Expand Down Expand Up @@ -205,35 +204,33 @@ class SettingsModelDisplaySection extends SettingsSection
callbacks.onBackgroundColorChange ();
});

if (FeatureSet.EnvironmentMap) {
this.environmentMapPhongDiv = AddDiv (this.contentDiv, 'ov_sidebar_parameter');
this.environmentMapPhongInput = AddDiv (this.environmentMapPhongDiv, 'ov_sidebar_image_picker');
AddDiv (this.environmentMapPhongDiv, null, 'Background Image');
this.environmentMapPhongInput.addEventListener ('click', () => {
this.environmentMapPopup = new EnvironmentMapPopup ();
this.environmentMapPopup.ShowPopup (this.environmentMapPhongInput, ShadingType.Phong, settings, {
onEnvironmentMapChange : () => {
this.UpdateEnvironmentMap (settings);
callbacks.onEnvironmentMapChange ();
}
});
this.environmentMapPhongDiv = AddDiv (this.contentDiv, 'ov_sidebar_parameter');
this.environmentMapPhongInput = AddDiv (this.environmentMapPhongDiv, 'ov_sidebar_image_picker');
AddDiv (this.environmentMapPhongDiv, null, 'Background Image');
this.environmentMapPhongInput.addEventListener ('click', () => {
this.environmentMapPopup = new EnvironmentMapPopup ();
this.environmentMapPopup.ShowPopup (this.environmentMapPhongInput, ShadingType.Phong, settings, {
onEnvironmentMapChange : () => {
this.UpdateEnvironmentMap (settings);
callbacks.onEnvironmentMapChange ();
}
});
});

this.environmentMapPbrDiv = AddDiv (this.contentDiv, 'ov_sidebar_parameter');
this.environmentMapPbrInput = AddDiv (this.environmentMapPbrDiv, 'ov_sidebar_image_picker');
AddDiv (this.environmentMapPbrDiv, null, 'Environment');
this.environmentMapPbrInput.addEventListener ('click', () => {
this.environmentMapPopup = new EnvironmentMapPopup ();
this.environmentMapPopup.ShowPopup (this.environmentMapPbrInput, ShadingType.Physical, settings, {
onEnvironmentMapChange : () => {
this.UpdateEnvironmentMap (settings);
callbacks.onEnvironmentMapChange ();
}
});
this.environmentMapPbrDiv = AddDiv (this.contentDiv, 'ov_sidebar_parameter');
this.environmentMapPbrInput = AddDiv (this.environmentMapPbrDiv, 'ov_sidebar_image_picker');
AddDiv (this.environmentMapPbrDiv, null, 'Environment');
this.environmentMapPbrInput.addEventListener ('click', () => {
this.environmentMapPopup = new EnvironmentMapPopup ();
this.environmentMapPopup.ShowPopup (this.environmentMapPbrInput, ShadingType.Physical, settings, {
onEnvironmentMapChange : () => {
this.UpdateEnvironmentMap (settings);
callbacks.onEnvironmentMapChange ();
}
});
});

this.UpdateEnvironmentMap (settings);
}
this.UpdateEnvironmentMap (settings);

let edgeParameterDiv = AddDiv (this.contentDiv, 'ov_sidebar_parameter');
this.edgeDisplayToggle = AddToggle (edgeParameterDiv, 'ov_sidebar_parameter_toggle');
Expand Down

0 comments on commit ef5c710

Please sign in to comment.