Skip to content

Commit

Permalink
Added FOV parameter to scene
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewJSchoen committed Sep 3, 2021
1 parent 4dc6682 commit 71445e1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion dist/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ function Content(props) {
backgroundColor = props.backgroundColor,
planeColor = props.planeColor,
highlightColor = props.highlightColor,
plane = props.plane;
plane = props.plane,
fov = props.fov;
var camera = (0, _fiber.useThree)(function (state) {
return state.camera;
});
camera.up.set(0, 0, 1);
camera.fov = fov ? fov : 60;
camera.updateProjectionMatrix();

var _useSceneStore = (0, _SceneStore.default)(function (state) {
var reducedTfs = Object.entries(state.tfs).map(function (pair) {
Expand Down
2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@



window['FEATURES'] = {"postcss":true};</script><script src="runtime~main.0904ee00.iframe.bundle.js"></script><script src="vendors~main.146e3d4e.iframe.bundle.js"></script><script src="main.34b71dbe.iframe.bundle.js"></script></body></html>
window['FEATURES'] = {"postcss":true};</script><script src="runtime~main.0904ee00.iframe.bundle.js"></script><script src="vendors~main.146e3d4e.iframe.bundle.js"></script><script src="main.2a8c734b.iframe.bundle.js"></script></body></html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "robot-scene",
"version": "0.3.5",
"version": "0.3.6",
"main": "dist/index.js",
"private": false,
"files": [
Expand Down
4 changes: 3 additions & 1 deletion src/components/Content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ export default function Content(props) {

const { displayTfs, displayGrid, isPolar,
backgroundColor, planeColor,
highlightColor, plane } = props;
highlightColor, plane, fov } = props;

const camera = useThree((state) => state.camera);

camera.up.set(0,0,1);
camera.fov = fov ? fov : 60;
camera.updateProjectionMatrix();

const [tfs, items, lines, hulls] = useSceneStore(state => {

Expand Down
4 changes: 4 additions & 0 deletions src/stories/Scene.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ RandomShapes.args = {
planeColor: '#a8a8a8',
highlightColor: '#ffffff',
plane: -0.75,
fov: 60,
onPointerMissed: () => console.log('Missed Click')
}
export const EvD = Template.bind({});
Expand Down Expand Up @@ -662,6 +663,7 @@ EvD.args = {
planeColor: '#141414',
highlightColor: '#ffffff',
plane: -0.75,
fov: 60,
onPointerMissed: () => console.log('Missed Click')
}
export const Movement = Template.bind({});
Expand Down Expand Up @@ -755,6 +757,7 @@ Movement.args = {
planeColor: '#a8a8a8',
highlightColor: '#ffffff',
plane: -0.75,
fov: 60,
onPointerMissed: () => console.log('Missed Click')
}

Expand Down Expand Up @@ -810,6 +813,7 @@ MeshDebugging.args = {
planeColor: '#a8a8a8',
highlightColor: '#ffffff',
plane: -0.75,
fov: 60,
onPointerMissed: () => console.log('Missed Click')
}

0 comments on commit 71445e1

Please sign in to comment.