|
@@ -1,10 +1,12 @@
|
|
|
|
|
|
import * as React from "react";
|
|
|
import { GlobalState } from '../../globalState';
|
|
|
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
-import { faPlay, faStop, faPalette, faCheckDouble, faSun, faLocationArrow, faClone } from '@fortawesome/free-solid-svg-icons';
|
|
|
-import { Color3, Color4 } from 'babylonjs/Maths/math.color';
|
|
|
import { DataStorage } from '../../dataStorage';
|
|
|
+import DoubleSided from './svgs/doubleSided.svg'
|
|
|
+import DepthPass from './svgs/depthPass.svg'
|
|
|
+import Omni from './svgs/omni.svg'
|
|
|
+import DirectionalRight from './svgs/directionalRight.svg'
|
|
|
+import DirectionalLeft from './svgs/directionalLeft.svg'
|
|
|
|
|
|
interface IPreviewAreaComponentProps {
|
|
|
globalState: GlobalState;
|
|
@@ -21,23 +23,6 @@ export class PreviewAreaComponent extends React.Component<IPreviewAreaComponentP
|
|
|
this.props.globalState.onIsLoadingChanged.add(state => this.setState({isLoading: state}));
|
|
|
}
|
|
|
|
|
|
- changeAnimation() {
|
|
|
- this.props.globalState.rotatePreview = !this.props.globalState.rotatePreview;
|
|
|
- this.props.globalState.onAnimationCommandActivated.notifyObservers();
|
|
|
- this.forceUpdate();
|
|
|
- }
|
|
|
-
|
|
|
- changeBackground(value: string) {
|
|
|
- const newColor = Color3.FromHexString(value);
|
|
|
-
|
|
|
- DataStorage.StoreNumber("BackgroundColorR", newColor.r);
|
|
|
- DataStorage.StoreNumber("BackgroundColorG", newColor.g);
|
|
|
- DataStorage.StoreNumber("BackgroundColorB", newColor.b);
|
|
|
-
|
|
|
- this.props.globalState.backgroundColor = Color4.FromColor3(newColor, 1.0);
|
|
|
- this.props.globalState.onPreviewBackgroundChanged.notifyObservers();
|
|
|
- }
|
|
|
-
|
|
|
changeBackFaceCulling(value: boolean) {
|
|
|
this.props.globalState.backFaceCulling = value;
|
|
|
DataStorage.StoreBoolean("BackFaceCulling", value);
|
|
@@ -63,30 +48,17 @@ export class PreviewAreaComponent extends React.Component<IPreviewAreaComponentP
|
|
|
</div>
|
|
|
}
|
|
|
</div>
|
|
|
- <div id="preview-config-bar">
|
|
|
- <div
|
|
|
- title="Turn-table animation"
|
|
|
- onClick={() => this.changeAnimation()} className={"button"}>
|
|
|
- <FontAwesomeIcon icon={this.props.globalState.rotatePreview ? faStop : faPlay} />
|
|
|
- </div>
|
|
|
- <div
|
|
|
- title="Background color"
|
|
|
- className={"button align"}>
|
|
|
- <label htmlFor="color-picker" id="color-picker-label">
|
|
|
- <FontAwesomeIcon icon={faPalette} />
|
|
|
- </label>
|
|
|
- <input ref="color-picker" id="color-picker" type="color" onChange={evt => this.changeBackground(evt.target.value)} />
|
|
|
- </div>
|
|
|
+ <div id="preview-config-bar">
|
|
|
<div
|
|
|
title="Render without back face culling"
|
|
|
- onClick={() => this.changeBackFaceCulling(!this.props.globalState.backFaceCulling)} className={"button" + (!this.props.globalState.backFaceCulling ? " selected" : "")}>
|
|
|
- <FontAwesomeIcon icon={faCheckDouble} />
|
|
|
- </div>
|
|
|
+ onClick={() => this.changeBackFaceCulling(!this.props.globalState.backFaceCulling)} className={"button back-face" + (!this.props.globalState.backFaceCulling ? " selected" : "")}>
|
|
|
+ <img src={DoubleSided} alt=""/>
|
|
|
+ </div>
|
|
|
<div
|
|
|
title="Render with depth pre-pass"
|
|
|
- onClick={() => this.changeDepthPrePass(!this.props.globalState.depthPrePass)} className={"button" + (this.props.globalState.depthPrePass ? " selected" : "")}>
|
|
|
- <FontAwesomeIcon icon={faClone} />
|
|
|
- </div>
|
|
|
+ onClick={() => this.changeDepthPrePass(!this.props.globalState.depthPrePass)} className={"button depth-pass" + (this.props.globalState.depthPrePass ? " selected" : "")}>
|
|
|
+ <img src={DepthPass} alt=""/>
|
|
|
+ </div>
|
|
|
<div
|
|
|
title="Turn on/off hemispheric light"
|
|
|
onClick={() => {
|
|
@@ -94,29 +66,30 @@ export class PreviewAreaComponent extends React.Component<IPreviewAreaComponentP
|
|
|
DataStorage.StoreBoolean("HemisphericLight", this.props.globalState.hemisphericLight);
|
|
|
this.props.globalState.onLightUpdated.notifyObservers();
|
|
|
this.forceUpdate();
|
|
|
- }} className={"button" + (this.props.globalState.hemisphericLight ? " selected" : "")}>
|
|
|
- <FontAwesomeIcon icon={faSun} />
|
|
|
- </div>
|
|
|
+ }} className={"button hemispheric-light" + (this.props.globalState.hemisphericLight ? " selected" : "")}>
|
|
|
+ <img src={Omni} alt=""/>
|
|
|
+ </div>
|
|
|
<div
|
|
|
- title="Turn on/off direction light #0"
|
|
|
+ title="Turn on/off direction light #1"
|
|
|
onClick={() => {
|
|
|
- this.props.globalState.directionalLight0 = !this.props.globalState.directionalLight0;
|
|
|
- DataStorage.StoreBoolean("DirectionalLight0", this.props.globalState.directionalLight0);
|
|
|
+ this.props.globalState.directionalLight1 = !this.props.globalState.directionalLight1;
|
|
|
+ DataStorage.StoreBoolean("DirectionalLight1", this.props.globalState.directionalLight1);
|
|
|
this.props.globalState.onLightUpdated.notifyObservers();
|
|
|
this.forceUpdate();
|
|
|
- }} className={"button" + (this.props.globalState.directionalLight0 ? " selected" : "")}>
|
|
|
- <FontAwesomeIcon icon={faLocationArrow} />
|
|
|
- </div>
|
|
|
+ }} className={"button direction-light-1" + (this.props.globalState.directionalLight1 ? " selected" : "")}>
|
|
|
+ <img src={DirectionalRight} alt=""/>
|
|
|
+
|
|
|
+ </div>
|
|
|
<div
|
|
|
- title="Turn on/off direction light #1"
|
|
|
+ title="Turn on/off direction light #0"
|
|
|
onClick={() => {
|
|
|
- this.props.globalState.directionalLight1 = !this.props.globalState.directionalLight1;
|
|
|
- DataStorage.StoreBoolean("DirectionalLight1", this.props.globalState.directionalLight1);
|
|
|
+ this.props.globalState.directionalLight0 = !this.props.globalState.directionalLight0;
|
|
|
+ DataStorage.StoreBoolean("DirectionalLight0", this.props.globalState.directionalLight0);
|
|
|
this.props.globalState.onLightUpdated.notifyObservers();
|
|
|
this.forceUpdate();
|
|
|
- }} className={"button" + (this.props.globalState.directionalLight1 ? " selected" : "")}>
|
|
|
- <FontAwesomeIcon icon={faLocationArrow} />
|
|
|
- </div>
|
|
|
+ }} className={"button direction-light-0" + (this.props.globalState.directionalLight0 ? " selected" : "")}>
|
|
|
+ <img src={DirectionalLeft} alt=""/>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</>
|
|
|
);
|