gaesup-world 0.9.5 → 0.9.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gaesup/controller/index.js +0 -5
- package/dist/gaesup/utils/innerHtml.js +1 -3
- package/dist/gaesup/world/context/index.js +0 -1
- package/dist/gaesup/world/context/reducer.d.ts +0 -1
- package/dist/gaesup/world/context/type.d.ts +0 -1
- package/dist/gaesup/world/initalize/index.d.ts +0 -1
- package/dist/gaesup/world/initalize/index.js +0 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/index.ts +0 -1
- package/package.json +1 -1
- package/dist/gaesup/controller/debug/airplane.d.ts +0 -71
- package/dist/gaesup/controller/debug/airplane.js +0 -71
- package/dist/gaesup/controller/debug/character.d.ts +0 -27
- package/dist/gaesup/controller/debug/character.js +0 -27
- package/dist/gaesup/controller/debug/index.d.ts +0 -6
- package/dist/gaesup/controller/debug/index.js +0 -49
- package/dist/gaesup/controller/debug/vehicle.d.ts +0 -27
- package/dist/gaesup/controller/debug/vehicle.js +0 -27
- package/dist/gaesup/tools/zoomButton/index.d.ts +0 -0
- package/dist/gaesup/tools/zoomButton/index.js +0 -102
- package/dist/gaesup/tools/zoomButton/style.css +0 -16
- package/dist/gaesup/utils/debug.d.ts +0 -30
- package/dist/gaesup/utils/debug.js +0 -36
- package/dist/gaesup/world/debug/cameraOption.d.ts +0 -47
- package/dist/gaesup/world/debug/cameraOption.js +0 -47
- package/dist/gaesup/world/debug/index.d.ts +0 -6
- package/dist/gaesup/world/debug/index.js +0 -32
- package/dist/gaesup/world/debug/mode.d.ts +0 -10
- package/dist/gaesup/world/debug/mode.js +0 -10
|
@@ -17,7 +17,6 @@ import { GaesupComponent } from "../component";
|
|
|
17
17
|
import { GaesupWorldContext } from "../world/context";
|
|
18
18
|
import { GaesupControllerContext, GaesupControllerDispatchContext, gaesupControllerDefault, } from "./context";
|
|
19
19
|
import { gaesupControllerReducer } from "./context/reducer";
|
|
20
|
-
import initDebug from "./debug";
|
|
21
20
|
import initControllerProps from "./initialize";
|
|
22
21
|
export function GaesupController(props) {
|
|
23
22
|
var keyBoardMap = useContext(GaesupWorldContext).keyBoardMap;
|
|
@@ -66,10 +65,6 @@ export function GaesupControllerInner(props) {
|
|
|
66
65
|
var prop = __assign(__assign(__assign(__assign({}, initControllerProps({
|
|
67
66
|
refs: refs,
|
|
68
67
|
})), { children: props.children, groupProps: props.groupProps, rigidBodyProps: props.rigidBodyProps, controllerOptions: gaesupControl.value.controllerOptions, parts: props.parts }), gaesupControl.value.callbacks), refs);
|
|
69
|
-
initDebug({
|
|
70
|
-
controllerContext: gaesupControl.value,
|
|
71
|
-
controllerDispatch: gaesupControl.dispatch,
|
|
72
|
-
});
|
|
73
68
|
var ContextBridge = useContextBridge(GaesupWorldContext, GaesupControllerContext);
|
|
74
69
|
return (_jsx(ContextBridge, { children: _jsx(GaesupControllerContext.Provider, { value: gaesupControl.value, children: _jsx(GaesupControllerDispatchContext.Provider, { value: gaesupControl.dispatch, children: _jsx(GaesupComponent, { props: prop, refs: refs }) }) }) }));
|
|
75
70
|
}
|
|
@@ -28,9 +28,7 @@ import * as THREE from "three";
|
|
|
28
28
|
export function InnerHtml(_a) {
|
|
29
29
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
30
30
|
var ref = useRef();
|
|
31
|
-
var _b = useState(),
|
|
32
|
-
var _c = useState(), isInRange = _c[0], setInRange = _c[1];
|
|
33
|
-
var isVisible = isInRange && !isOccluded;
|
|
31
|
+
var _b = useState(), isInRange = _b[0], setInRange = _b[1];
|
|
34
32
|
var vec = new THREE.Vector3();
|
|
35
33
|
useFrame(function (state) {
|
|
36
34
|
var range = state.camera.position.distanceTo(ref.current.getWorldPosition(vec)) <= 10;
|
|
@@ -7,7 +7,6 @@ export declare function gaesupWorldReducer(props: Partial<gaesupWorldContextType
|
|
|
7
7
|
mode?: import("./type").modeType;
|
|
8
8
|
urls?: import("./type").urlsType;
|
|
9
9
|
states?: import("./type").statesType;
|
|
10
|
-
debug?: boolean;
|
|
11
10
|
minimap?: import("../../tools/MiniMap/type").minimapInnerType;
|
|
12
11
|
joystick?: import("../../tools/joystick/type").joyStickInnerType;
|
|
13
12
|
control?: {
|
|
@@ -6,7 +6,6 @@ export default function initGaesupWorld(props: gaesupWorldPropsType): {
|
|
|
6
6
|
mode?: import("../context/type").modeType;
|
|
7
7
|
urls?: import("../context/type").urlsType;
|
|
8
8
|
states?: import("../context/type").statesType;
|
|
9
|
-
debug?: boolean;
|
|
10
9
|
minimap?: import("../../tools/MiniMap/type").minimapInnerType;
|
|
11
10
|
joystick?: import("../../tools/joystick/type").joyStickInnerType;
|
|
12
11
|
control?: {
|
|
@@ -10,10 +10,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { useEffect, useMemo, useReducer } from "react";
|
|
13
|
-
import { isDesktop } from "react-device-detect";
|
|
14
13
|
import { gaesupWorldDefault } from "../../world/context";
|
|
15
14
|
import { gaesupWorldReducer } from "../../world/context/reducer";
|
|
16
|
-
import initDebug from "../debug";
|
|
17
15
|
export default function initGaesupWorld(props) {
|
|
18
16
|
var _a = useReducer(gaesupWorldReducer, {
|
|
19
17
|
activeState: __assign(__assign({}, gaesupWorldDefault.activeState), { position: props.startPosition || gaesupWorldDefault.activeState.position }),
|
|
@@ -23,7 +21,6 @@ export default function initGaesupWorld(props) {
|
|
|
23
21
|
refs: null,
|
|
24
22
|
states: gaesupWorldDefault.states,
|
|
25
23
|
rideable: gaesupWorldDefault.rideable,
|
|
26
|
-
debug: (props.debug && isDesktop) || gaesupWorldDefault.debug,
|
|
27
24
|
minimap: gaesupWorldDefault.minimap,
|
|
28
25
|
joystick: gaesupWorldDefault.joystick,
|
|
29
26
|
control: gaesupWorldDefault.control,
|
|
@@ -53,7 +50,6 @@ export default function initGaesupWorld(props) {
|
|
|
53
50
|
});
|
|
54
51
|
}, []);
|
|
55
52
|
var gaesupProps = useMemo(function () { return ({ value: value, dispatch: dispatch }); }, [value, value.block, dispatch]);
|
|
56
|
-
initDebug({ value: gaesupProps.value, dispatch: dispatch });
|
|
57
53
|
return {
|
|
58
54
|
gaesupProps: gaesupProps,
|
|
59
55
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export { PassiveCharacter } from "./gaesup/component/passive/character";
|
|
|
4
4
|
export { PassiveVehicle } from "./gaesup/component/passive/vehicle";
|
|
5
5
|
export { GaesupController } from "./gaesup/controller";
|
|
6
6
|
export { GaeSupProps } from "./gaesup/gaesupProps";
|
|
7
|
+
export { MiniMap } from "./gaesup/tools/MiniMap";
|
|
7
8
|
export { Clicker } from "./gaesup/tools/clicker";
|
|
8
9
|
export { GameBoy } from "./gaesup/tools/gameboy";
|
|
9
10
|
export { GamePad } from "./gaesup/tools/gamepad";
|
|
10
11
|
export { JoyStick } from "./gaesup/tools/joystick";
|
|
11
12
|
export { JumpPortal } from "./gaesup/tools/jumpPortal";
|
|
12
13
|
export { KeyBoardToolTip } from "./gaesup/tools/keyBoardToolTip";
|
|
13
|
-
export { MiniMap } from "./gaesup/tools/MiniMap";
|
|
14
14
|
export { Rideable } from "./gaesup/tools/rideable";
|
|
15
15
|
export { InnerHtml } from "./gaesup/utils/innerHtml";
|
|
16
16
|
export { Elr, Qt, V3, V30, V31 } from "./gaesup/utils/vector";
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ export { PassiveCharacter } from "./gaesup/component/passive/character";
|
|
|
4
4
|
export { PassiveVehicle } from "./gaesup/component/passive/vehicle";
|
|
5
5
|
export { GaesupController } from "./gaesup/controller";
|
|
6
6
|
export { GaeSupProps } from "./gaesup/gaesupProps";
|
|
7
|
+
export { MiniMap } from "./gaesup/tools/MiniMap";
|
|
7
8
|
export { Clicker } from "./gaesup/tools/clicker";
|
|
8
9
|
export { GameBoy } from "./gaesup/tools/gameboy";
|
|
9
10
|
export { GamePad } from "./gaesup/tools/gamepad";
|
|
10
11
|
export { JoyStick } from "./gaesup/tools/joystick";
|
|
11
12
|
export { JumpPortal } from "./gaesup/tools/jumpPortal";
|
|
12
13
|
export { KeyBoardToolTip } from "./gaesup/tools/keyBoardToolTip";
|
|
13
|
-
export { MiniMap } from "./gaesup/tools/MiniMap";
|
|
14
14
|
export { Rideable } from "./gaesup/tools/rideable";
|
|
15
15
|
export { InnerHtml } from "./gaesup/utils/innerHtml";
|
|
16
16
|
export { Elr, Qt, V3, V30, V31 } from "./gaesup/utils/vector";
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export declare const airplaneDebugMap: {
|
|
2
|
-
angleDelta: {
|
|
3
|
-
value: {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
z: number;
|
|
7
|
-
};
|
|
8
|
-
x: {
|
|
9
|
-
min: number;
|
|
10
|
-
max: number;
|
|
11
|
-
step: number;
|
|
12
|
-
};
|
|
13
|
-
y: {
|
|
14
|
-
min: number;
|
|
15
|
-
max: number;
|
|
16
|
-
step: number;
|
|
17
|
-
};
|
|
18
|
-
z: {
|
|
19
|
-
min: number;
|
|
20
|
-
max: number;
|
|
21
|
-
step: number;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
maxAngle: {
|
|
25
|
-
value: {
|
|
26
|
-
x: number;
|
|
27
|
-
y: number;
|
|
28
|
-
z: number;
|
|
29
|
-
};
|
|
30
|
-
x: {
|
|
31
|
-
min: number;
|
|
32
|
-
max: number;
|
|
33
|
-
step: number;
|
|
34
|
-
};
|
|
35
|
-
y: {
|
|
36
|
-
min: number;
|
|
37
|
-
max: number;
|
|
38
|
-
step: number;
|
|
39
|
-
};
|
|
40
|
-
z: {
|
|
41
|
-
min: number;
|
|
42
|
-
max: number;
|
|
43
|
-
step: number;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
maxSpeed: {
|
|
47
|
-
min: number;
|
|
48
|
-
max: number;
|
|
49
|
-
step: number;
|
|
50
|
-
};
|
|
51
|
-
accelRatio: {
|
|
52
|
-
min: number;
|
|
53
|
-
max: number;
|
|
54
|
-
step: number;
|
|
55
|
-
};
|
|
56
|
-
brakeRatio: {
|
|
57
|
-
min: number;
|
|
58
|
-
max: number;
|
|
59
|
-
step: number;
|
|
60
|
-
};
|
|
61
|
-
buoyancy: {
|
|
62
|
-
min: number;
|
|
63
|
-
max: number;
|
|
64
|
-
step: number;
|
|
65
|
-
};
|
|
66
|
-
linearDamping: {
|
|
67
|
-
min: number;
|
|
68
|
-
max: number;
|
|
69
|
-
step: number;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export var airplaneDebugMap = {
|
|
2
|
-
angleDelta: {
|
|
3
|
-
value: {
|
|
4
|
-
x: 0.01,
|
|
5
|
-
y: 0.005,
|
|
6
|
-
z: 0.005,
|
|
7
|
-
},
|
|
8
|
-
x: {
|
|
9
|
-
min: -Math.PI,
|
|
10
|
-
max: Math.PI,
|
|
11
|
-
step: 0.01,
|
|
12
|
-
},
|
|
13
|
-
y: {
|
|
14
|
-
min: -Math.PI,
|
|
15
|
-
max: Math.PI,
|
|
16
|
-
step: 0.01,
|
|
17
|
-
},
|
|
18
|
-
z: {
|
|
19
|
-
min: -Math.PI,
|
|
20
|
-
max: Math.PI,
|
|
21
|
-
step: 0.01,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
maxAngle: {
|
|
25
|
-
value: {
|
|
26
|
-
x: 0.1,
|
|
27
|
-
y: 0.1,
|
|
28
|
-
z: 0.1,
|
|
29
|
-
},
|
|
30
|
-
x: {
|
|
31
|
-
min: -Math.PI,
|
|
32
|
-
max: Math.PI,
|
|
33
|
-
step: 0.01,
|
|
34
|
-
},
|
|
35
|
-
y: {
|
|
36
|
-
min: -Math.PI,
|
|
37
|
-
max: Math.PI,
|
|
38
|
-
step: 0.01,
|
|
39
|
-
},
|
|
40
|
-
z: {
|
|
41
|
-
min: -Math.PI,
|
|
42
|
-
max: Math.PI,
|
|
43
|
-
step: 0.01,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
maxSpeed: {
|
|
47
|
-
min: 50,
|
|
48
|
-
max: 100,
|
|
49
|
-
step: 0.01,
|
|
50
|
-
},
|
|
51
|
-
accelRatio: {
|
|
52
|
-
min: 1,
|
|
53
|
-
max: 10,
|
|
54
|
-
step: 0.01,
|
|
55
|
-
},
|
|
56
|
-
brakeRatio: {
|
|
57
|
-
min: 1,
|
|
58
|
-
max: 20,
|
|
59
|
-
step: 0.01,
|
|
60
|
-
},
|
|
61
|
-
buoyancy: {
|
|
62
|
-
min: 0.1,
|
|
63
|
-
max: 1,
|
|
64
|
-
step: 0.01,
|
|
65
|
-
},
|
|
66
|
-
linearDamping: {
|
|
67
|
-
min: 0,
|
|
68
|
-
max: 1,
|
|
69
|
-
step: 0.01,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const characterDebugMap: {
|
|
2
|
-
walkSpeed: {
|
|
3
|
-
min: number;
|
|
4
|
-
max: number;
|
|
5
|
-
step: number;
|
|
6
|
-
};
|
|
7
|
-
runSpeed: {
|
|
8
|
-
min: number;
|
|
9
|
-
max: number;
|
|
10
|
-
step: number;
|
|
11
|
-
};
|
|
12
|
-
turnSpeed: {
|
|
13
|
-
min: number;
|
|
14
|
-
max: number;
|
|
15
|
-
step: number;
|
|
16
|
-
};
|
|
17
|
-
jumpSpeed: {
|
|
18
|
-
min: number;
|
|
19
|
-
max: number;
|
|
20
|
-
step: number;
|
|
21
|
-
};
|
|
22
|
-
linearDamping: {
|
|
23
|
-
min: number;
|
|
24
|
-
max: number;
|
|
25
|
-
step: number;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export var characterDebugMap = {
|
|
2
|
-
walkSpeed: {
|
|
3
|
-
min: 1,
|
|
4
|
-
max: 20,
|
|
5
|
-
step: 0.01,
|
|
6
|
-
},
|
|
7
|
-
runSpeed: {
|
|
8
|
-
min: 1,
|
|
9
|
-
max: 20,
|
|
10
|
-
step: 0.01,
|
|
11
|
-
},
|
|
12
|
-
turnSpeed: {
|
|
13
|
-
min: 1,
|
|
14
|
-
max: 20,
|
|
15
|
-
step: 0.01,
|
|
16
|
-
},
|
|
17
|
-
jumpSpeed: {
|
|
18
|
-
min: 0.1,
|
|
19
|
-
max: 20,
|
|
20
|
-
step: 0.01,
|
|
21
|
-
},
|
|
22
|
-
linearDamping: {
|
|
23
|
-
min: -10,
|
|
24
|
-
max: 10,
|
|
25
|
-
step: 0.01,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { dispatchType } from "../../utils/type";
|
|
2
|
-
import { gaesupControllerType } from "../context/type";
|
|
3
|
-
export default function initDebug({ controllerContext, controllerDispatch, }: {
|
|
4
|
-
controllerContext: gaesupControllerType;
|
|
5
|
-
controllerDispatch: dispatchType<gaesupControllerType>;
|
|
6
|
-
}): void;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { useContext, useEffect } from "react";
|
|
13
|
-
import { update } from "../../utils/context";
|
|
14
|
-
import debug from "../../utils/debug";
|
|
15
|
-
import { GaesupWorldContext } from "../../world/context";
|
|
16
|
-
import { airplaneDebugMap } from "./airplane";
|
|
17
|
-
import { characterDebugMap } from "./character";
|
|
18
|
-
import { vehicleDebugMap } from "./vehicle";
|
|
19
|
-
export default function initDebug(_a) {
|
|
20
|
-
var controllerContext = _a.controllerContext, controllerDispatch = _a.controllerDispatch;
|
|
21
|
-
var worldDebug = useContext(GaesupWorldContext).debug;
|
|
22
|
-
if (!worldDebug)
|
|
23
|
-
return;
|
|
24
|
-
var characterOptionValue = debug({
|
|
25
|
-
debug: worldDebug,
|
|
26
|
-
debugProps: controllerContext.character,
|
|
27
|
-
tag: "character",
|
|
28
|
-
debugMap: characterDebugMap,
|
|
29
|
-
});
|
|
30
|
-
var vehicleOptionValue = debug({
|
|
31
|
-
debug: worldDebug,
|
|
32
|
-
debugProps: controllerContext.vehicle,
|
|
33
|
-
tag: "vehicle",
|
|
34
|
-
debugMap: vehicleDebugMap,
|
|
35
|
-
});
|
|
36
|
-
var airplaneOptionValue = debug({
|
|
37
|
-
debug: worldDebug,
|
|
38
|
-
debugProps: controllerContext.airplane,
|
|
39
|
-
tag: "airplane",
|
|
40
|
-
debugMap: airplaneDebugMap,
|
|
41
|
-
});
|
|
42
|
-
useEffect(function () {
|
|
43
|
-
update({
|
|
44
|
-
character: __assign({}, characterOptionValue),
|
|
45
|
-
vehicle: __assign({}, vehicleOptionValue),
|
|
46
|
-
airplane: __assign({}, airplaneOptionValue),
|
|
47
|
-
}, controllerDispatch);
|
|
48
|
-
}, [characterOptionValue, vehicleOptionValue, airplaneOptionValue]);
|
|
49
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const vehicleDebugMap: {
|
|
2
|
-
maxSpeed: {
|
|
3
|
-
min: number;
|
|
4
|
-
max: number;
|
|
5
|
-
step: number;
|
|
6
|
-
};
|
|
7
|
-
accelRatio: {
|
|
8
|
-
min: number;
|
|
9
|
-
max: number;
|
|
10
|
-
step: number;
|
|
11
|
-
};
|
|
12
|
-
brakeRatio: {
|
|
13
|
-
min: number;
|
|
14
|
-
max: number;
|
|
15
|
-
step: number;
|
|
16
|
-
};
|
|
17
|
-
wheelOffset: {
|
|
18
|
-
min: number;
|
|
19
|
-
max: number;
|
|
20
|
-
step: number;
|
|
21
|
-
};
|
|
22
|
-
linearDamping: {
|
|
23
|
-
min: number;
|
|
24
|
-
max: number;
|
|
25
|
-
step: number;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export var vehicleDebugMap = {
|
|
2
|
-
maxSpeed: {
|
|
3
|
-
min: 50,
|
|
4
|
-
max: 100,
|
|
5
|
-
step: 0.01,
|
|
6
|
-
},
|
|
7
|
-
accelRatio: {
|
|
8
|
-
min: 1,
|
|
9
|
-
max: 10,
|
|
10
|
-
step: 0.01,
|
|
11
|
-
},
|
|
12
|
-
brakeRatio: {
|
|
13
|
-
min: 1,
|
|
14
|
-
max: 20,
|
|
15
|
-
step: 0.01,
|
|
16
|
-
},
|
|
17
|
-
wheelOffset: {
|
|
18
|
-
min: 0.1,
|
|
19
|
-
max: 10,
|
|
20
|
-
step: 0.01,
|
|
21
|
-
},
|
|
22
|
-
linearDamping: {
|
|
23
|
-
min: 0,
|
|
24
|
-
max: 1,
|
|
25
|
-
step: 0.01,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
File without changes
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// import { useContext, useState } from "react";
|
|
2
|
-
// import * as THREE from "three";
|
|
3
|
-
// import { makeNormalCameraPosition } from "../../camera/control/normal";
|
|
4
|
-
// import { makeOrbitCameraPosition } from "../../camera/control/orbit";
|
|
5
|
-
// import {
|
|
6
|
-
// GaesupWorldContext,
|
|
7
|
-
// GaesupWorldDispatchContext,
|
|
8
|
-
// } from "../../world/context/index";
|
|
9
|
-
// import "./style.css";
|
|
10
|
-
//
|
|
11
|
-
// export type zoomButtonPropsType = {
|
|
12
|
-
// children?: React.ReactNode;
|
|
13
|
-
// position: THREE.Vector3;
|
|
14
|
-
// target?: THREE.Vector3;
|
|
15
|
-
// keepBlocking?: boolean;
|
|
16
|
-
// zoomButtonStyle?: React.CSSProperties;
|
|
17
|
-
// };
|
|
18
|
-
//
|
|
19
|
-
// export function useZoom() {
|
|
20
|
-
// const { moveTo, activeState, cameraOption, mode, block } =
|
|
21
|
-
// useContext(GaesupWorldContext);
|
|
22
|
-
// const dispatch = useContext(GaesupWorldDispatchContext);
|
|
23
|
-
// const [isZoom, setIsZoom] = useState(true);
|
|
24
|
-
//
|
|
25
|
-
// const closeCamera = async (position: THREE.Vector3) => {
|
|
26
|
-
// cameraOption.XDistance = position.x;
|
|
27
|
-
// cameraOption.YDistance = position.y;
|
|
28
|
-
// cameraOption.ZDistance = position.z;
|
|
29
|
-
// block.camera = true;
|
|
30
|
-
// dispatch({
|
|
31
|
-
// type: "update",
|
|
32
|
-
// payload: {
|
|
33
|
-
// block: {
|
|
34
|
-
// ...block,
|
|
35
|
-
// },
|
|
36
|
-
// cameraOption: {
|
|
37
|
-
// ...cameraOption,
|
|
38
|
-
// },
|
|
39
|
-
// },
|
|
40
|
-
// });
|
|
41
|
-
// };
|
|
42
|
-
//
|
|
43
|
-
// const openCamera = async () => {
|
|
44
|
-
// block.camera = false;
|
|
45
|
-
// dispatch({
|
|
46
|
-
// type: "update",
|
|
47
|
-
// payload: {
|
|
48
|
-
// block: {
|
|
49
|
-
// ...block,
|
|
50
|
-
// },
|
|
51
|
-
// },
|
|
52
|
-
// });
|
|
53
|
-
// };
|
|
54
|
-
//
|
|
55
|
-
// const moveToCamera = async () => {
|
|
56
|
-
// if (mode.control === "orbit" && moveTo) {
|
|
57
|
-
// await moveTo(
|
|
58
|
-
// makeOrbitCameraPosition(activeState, cameraOption),
|
|
59
|
-
// activeState.position
|
|
60
|
-
// );
|
|
61
|
-
// } else if (mode.control === "normal" && moveTo) {
|
|
62
|
-
// await moveTo(
|
|
63
|
-
// makeNormalCameraPosition(activeState, cameraOption),
|
|
64
|
-
// activeState.position
|
|
65
|
-
// );
|
|
66
|
-
// }
|
|
67
|
-
// };
|
|
68
|
-
//
|
|
69
|
-
// const setZoom = async (position: THREE.Vector3, isZoom: boolean) => {
|
|
70
|
-
// setIsZoom(isZoom);
|
|
71
|
-
// await closeCamera(position);
|
|
72
|
-
// await moveToCamera();
|
|
73
|
-
// await openCamera();
|
|
74
|
-
// };
|
|
75
|
-
//
|
|
76
|
-
// return {
|
|
77
|
-
// setZoom,
|
|
78
|
-
// openCamera,
|
|
79
|
-
// closeCamera,
|
|
80
|
-
// isZoom,
|
|
81
|
-
// setIsZoom,
|
|
82
|
-
// moveToCamera,
|
|
83
|
-
// };
|
|
84
|
-
// }
|
|
85
|
-
//
|
|
86
|
-
// export function ZoomButton(props: zoomButtonPropsType) {
|
|
87
|
-
// const { setZoom, isZoom } = useZoom();
|
|
88
|
-
//
|
|
89
|
-
// return (
|
|
90
|
-
// <div
|
|
91
|
-
// className="zoomButton"
|
|
92
|
-
// style={{
|
|
93
|
-
// ...props.zoomButtonStyle,
|
|
94
|
-
// }}
|
|
95
|
-
// onClick={async () => {
|
|
96
|
-
// await setZoom(props.position, isZoom);
|
|
97
|
-
// }}
|
|
98
|
-
// >
|
|
99
|
-
// {props.children}
|
|
100
|
-
// </div>
|
|
101
|
-
// );
|
|
102
|
-
// }
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.zoomButton {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
text-align: center;
|
|
6
|
-
margin: 1rem;
|
|
7
|
-
font-size: 1.2rem;
|
|
8
|
-
border-radius: 50%;
|
|
9
|
-
width: 5rem;
|
|
10
|
-
height: 5rem;
|
|
11
|
-
color: white;
|
|
12
|
-
background: rgba(0, 0, 0, 0.6);
|
|
13
|
-
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.6);
|
|
14
|
-
transition: all 0.2s ease-in;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
type valueType = string | boolean | number | THREE.Vector3 | THREE.Quaternion | THREE.Euler;
|
|
3
|
-
type constantType = {
|
|
4
|
-
[key: string]: valueType;
|
|
5
|
-
};
|
|
6
|
-
type changeDebugMapItem = {
|
|
7
|
-
min: number;
|
|
8
|
-
max: number;
|
|
9
|
-
step: number;
|
|
10
|
-
};
|
|
11
|
-
type chagneDebugVectorMapItem = {
|
|
12
|
-
x: changeDebugMapItem;
|
|
13
|
-
y: changeDebugMapItem;
|
|
14
|
-
z: changeDebugMapItem;
|
|
15
|
-
};
|
|
16
|
-
type changeDebugOptionItem = {
|
|
17
|
-
options: string[];
|
|
18
|
-
};
|
|
19
|
-
type changeDebugMapType<T> = {
|
|
20
|
-
[K in keyof T]: changeDebugMapItem | chagneDebugVectorMapItem | changeDebugOptionItem;
|
|
21
|
-
};
|
|
22
|
-
export type debugPropType<T extends constantType> = {
|
|
23
|
-
debug: boolean;
|
|
24
|
-
tag: string;
|
|
25
|
-
debugProps: T;
|
|
26
|
-
} & {
|
|
27
|
-
debugMap: changeDebugMapType<T>;
|
|
28
|
-
};
|
|
29
|
-
export default function debug<T extends constantType>(props: debugPropType<T>): T;
|
|
30
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { useControls } from "leva";
|
|
13
|
-
export default function debug(props) {
|
|
14
|
-
var debug = props.debug, tag = props.tag, debugMap = props.debugMap;
|
|
15
|
-
if (debug) {
|
|
16
|
-
var resultMap = Object.keys(props.debugProps).reduce(function (map, key) {
|
|
17
|
-
if (key in debugMap) {
|
|
18
|
-
var debugMapItem = debugMap[key];
|
|
19
|
-
if ("max" in debugMapItem) {
|
|
20
|
-
map[key] = __assign({ value: props.debugProps[key] }, debugMapItem);
|
|
21
|
-
}
|
|
22
|
-
else if ("options" in debugMapItem) {
|
|
23
|
-
map[key] = __assign({ value: props.debugProps[key] }, debugMapItem);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
map[key] = __assign(__assign(__assign({ value: props.debugProps[key] }, debugMapItem.x), debugMapItem.y), debugMapItem.z);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return map;
|
|
30
|
-
}, {});
|
|
31
|
-
props.debugProps = useControls(tag, __assign({}, resultMap), {
|
|
32
|
-
collapsed: true,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return props.debugProps;
|
|
36
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const cameraOptionDebugMap: {
|
|
2
|
-
initDistance: {
|
|
3
|
-
min: number;
|
|
4
|
-
max: number;
|
|
5
|
-
step: number;
|
|
6
|
-
};
|
|
7
|
-
maxDistance: {
|
|
8
|
-
min: number;
|
|
9
|
-
max: number;
|
|
10
|
-
step: number;
|
|
11
|
-
};
|
|
12
|
-
minDistance: {
|
|
13
|
-
min: number;
|
|
14
|
-
max: number;
|
|
15
|
-
step: number;
|
|
16
|
-
};
|
|
17
|
-
distance: {
|
|
18
|
-
min: number;
|
|
19
|
-
max: number;
|
|
20
|
-
step: number;
|
|
21
|
-
};
|
|
22
|
-
camfollow: {
|
|
23
|
-
min: number;
|
|
24
|
-
max: number;
|
|
25
|
-
step: number;
|
|
26
|
-
};
|
|
27
|
-
XZDistance: {
|
|
28
|
-
min: number;
|
|
29
|
-
max: number;
|
|
30
|
-
step: number;
|
|
31
|
-
};
|
|
32
|
-
XDistance: {
|
|
33
|
-
min: number;
|
|
34
|
-
max: number;
|
|
35
|
-
step: number;
|
|
36
|
-
};
|
|
37
|
-
YDistance: {
|
|
38
|
-
min: number;
|
|
39
|
-
max: number;
|
|
40
|
-
step: number;
|
|
41
|
-
};
|
|
42
|
-
ZDistance: {
|
|
43
|
-
min: number;
|
|
44
|
-
max: number;
|
|
45
|
-
step: number;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export var cameraOptionDebugMap = {
|
|
2
|
-
initDistance: {
|
|
3
|
-
min: -10,
|
|
4
|
-
max: 10,
|
|
5
|
-
step: 0.01,
|
|
6
|
-
},
|
|
7
|
-
maxDistance: {
|
|
8
|
-
min: -10,
|
|
9
|
-
max: 10,
|
|
10
|
-
step: 0.01,
|
|
11
|
-
},
|
|
12
|
-
minDistance: {
|
|
13
|
-
min: -10,
|
|
14
|
-
max: 10,
|
|
15
|
-
step: 0.01,
|
|
16
|
-
},
|
|
17
|
-
distance: {
|
|
18
|
-
min: -10,
|
|
19
|
-
max: 10,
|
|
20
|
-
step: 0.01,
|
|
21
|
-
},
|
|
22
|
-
camfollow: {
|
|
23
|
-
min: 1,
|
|
24
|
-
max: 100,
|
|
25
|
-
step: 0.01,
|
|
26
|
-
},
|
|
27
|
-
XZDistance: {
|
|
28
|
-
min: -50,
|
|
29
|
-
max: 50,
|
|
30
|
-
step: 0.01,
|
|
31
|
-
},
|
|
32
|
-
XDistance: {
|
|
33
|
-
min: -50,
|
|
34
|
-
max: 50,
|
|
35
|
-
step: 0.01,
|
|
36
|
-
},
|
|
37
|
-
YDistance: {
|
|
38
|
-
min: -50,
|
|
39
|
-
max: 50,
|
|
40
|
-
step: 0.01,
|
|
41
|
-
},
|
|
42
|
-
ZDistance: {
|
|
43
|
-
min: -50,
|
|
44
|
-
max: 50,
|
|
45
|
-
step: 0.01,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { dispatchType } from "../../utils/type";
|
|
2
|
-
import { gaesupWorldContextType } from "../context/type";
|
|
3
|
-
export default function initDebug({ value, dispatch, }: {
|
|
4
|
-
value: Partial<gaesupWorldContextType>;
|
|
5
|
-
dispatch: dispatchType<gaesupWorldContextType>;
|
|
6
|
-
}): void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { useEffect } from "react";
|
|
13
|
-
import { update } from "../../utils/context";
|
|
14
|
-
import debug from "../../utils/debug";
|
|
15
|
-
import { cameraOptionDebugMap } from "./cameraOption";
|
|
16
|
-
export default function initDebug(_a) {
|
|
17
|
-
var value = _a.value, dispatch = _a.dispatch;
|
|
18
|
-
var worldDebug = value.debug;
|
|
19
|
-
if (!worldDebug)
|
|
20
|
-
return;
|
|
21
|
-
var cameraOptionValue = debug({
|
|
22
|
-
debug: worldDebug,
|
|
23
|
-
debugProps: value.cameraOption,
|
|
24
|
-
tag: "cameraOption",
|
|
25
|
-
debugMap: cameraOptionDebugMap,
|
|
26
|
-
});
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
update({
|
|
29
|
-
cameraOption: __assign({}, cameraOptionValue),
|
|
30
|
-
}, dispatch);
|
|
31
|
-
}, [cameraOptionValue]);
|
|
32
|
-
}
|