gaesup-world 0.0.1

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.
Files changed (146) hide show
  1. package/README.md +51 -0
  2. package/index.html +13 -0
  3. package/package.json +82 -0
  4. package/src/gaesup/animation/actions.ts +123 -0
  5. package/src/gaesup/camera/cameraCollisionDetecter.tsx +53 -0
  6. package/src/gaesup/camera/control/map.ts +10 -0
  7. package/src/gaesup/camera/control/normal copy.ts +19 -0
  8. package/src/gaesup/camera/control/normal.ts +15 -0
  9. package/src/gaesup/camera/control/orbit.ts +31 -0
  10. package/src/gaesup/camera/index.tsx +102 -0
  11. package/src/gaesup/camera/type.ts +17 -0
  12. package/src/gaesup/component/Airplane.tsx +46 -0
  13. package/src/gaesup/component/Character.tsx +48 -0
  14. package/src/gaesup/component/Vehicle.tsx +40 -0
  15. package/src/gaesup/component/gltf/AirplaneGltf.tsx +31 -0
  16. package/src/gaesup/component/gltf/CharacterGltf.tsx +81 -0
  17. package/src/gaesup/component/gltf/VehicleGltf.tsx +31 -0
  18. package/src/gaesup/component/gltf/WheelJoint.tsx +39 -0
  19. package/src/gaesup/component/gltf/type.ts +6 -0
  20. package/src/gaesup/component/ref/airplane.tsx +83 -0
  21. package/src/gaesup/component/ref/character.tsx +132 -0
  22. package/src/gaesup/component/ref/vehicle.tsx +145 -0
  23. package/src/gaesup/controller/index.tsx +103 -0
  24. package/src/gaesup/controller/type.ts +139 -0
  25. package/src/gaesup/gaesupProps/index.tsx +66 -0
  26. package/src/gaesup/initial/callback/index.ts +73 -0
  27. package/src/gaesup/initial/callback/type.ts +45 -0
  28. package/src/gaesup/initial/controller/index.ts +143 -0
  29. package/src/gaesup/initial/controller/initDebug.ts +102 -0
  30. package/src/gaesup/initial/gaesupWorld/collider/airplane.ts +26 -0
  31. package/src/gaesup/initial/gaesupWorld/collider/character.ts +32 -0
  32. package/src/gaesup/initial/gaesupWorld/collider/gltf.ts +91 -0
  33. package/src/gaesup/initial/gaesupWorld/collider/index.ts +26 -0
  34. package/src/gaesup/initial/gaesupWorld/collider/vehicle.ts +43 -0
  35. package/src/gaesup/initial/gaesupWorld/index.ts +82 -0
  36. package/src/gaesup/initial/gaesupWorld/type.ts +37 -0
  37. package/src/gaesup/physics/airplane/currentSetting.ts +20 -0
  38. package/src/gaesup/physics/airplane/damping.ts +8 -0
  39. package/src/gaesup/physics/airplane/direction.ts +70 -0
  40. package/src/gaesup/physics/airplane/gravity.ts +11 -0
  41. package/src/gaesup/physics/airplane/impulse.ts +22 -0
  42. package/src/gaesup/physics/airplane/index.tsx +16 -0
  43. package/src/gaesup/physics/airplane/turn.ts +12 -0
  44. package/src/gaesup/physics/airplane copy/currentSetting.ts +20 -0
  45. package/src/gaesup/physics/airplane copy/direction.ts +52 -0
  46. package/src/gaesup/physics/airplane copy/gravity.ts +6 -0
  47. package/src/gaesup/physics/airplane copy/impulse.ts +28 -0
  48. package/src/gaesup/physics/airplane copy/index.tsx +14 -0
  49. package/src/gaesup/physics/airplane copy/turn.ts +9 -0
  50. package/src/gaesup/physics/character/accelaration.ts +14 -0
  51. package/src/gaesup/physics/character/currentSetting.ts +20 -0
  52. package/src/gaesup/physics/character/damping.ts +6 -0
  53. package/src/gaesup/physics/character/direction.ts +104 -0
  54. package/src/gaesup/physics/character/impulse.ts +24 -0
  55. package/src/gaesup/physics/character/index.tsx +20 -0
  56. package/src/gaesup/physics/character/jump.ts +21 -0
  57. package/src/gaesup/physics/character/stabilizing.ts +6 -0
  58. package/src/gaesup/physics/character/turn.ts +17 -0
  59. package/src/gaesup/physics/check/ground.ts +19 -0
  60. package/src/gaesup/physics/check/index.ts +12 -0
  61. package/src/gaesup/physics/check/moving.ts +21 -0
  62. package/src/gaesup/physics/check/rotate.ts +13 -0
  63. package/src/gaesup/physics/check/slope.ts +50 -0
  64. package/src/gaesup/physics/index.ts +50 -0
  65. package/src/gaesup/physics/type.ts +35 -0
  66. package/src/gaesup/physics/vehicle/currentSetting.ts +20 -0
  67. package/src/gaesup/physics/vehicle/damping.ts +8 -0
  68. package/src/gaesup/physics/vehicle/direction.ts +27 -0
  69. package/src/gaesup/physics/vehicle/impulse.ts +22 -0
  70. package/src/gaesup/physics/vehicle/index.tsx +14 -0
  71. package/src/gaesup/physics/vehicle/turn.ts +11 -0
  72. package/src/gaesup/stores/active/index.ts +19 -0
  73. package/src/gaesup/stores/active/type.ts +16 -0
  74. package/src/gaesup/stores/airplane/index.ts +6 -0
  75. package/src/gaesup/stores/airplane/type.ts +4 -0
  76. package/src/gaesup/stores/animation/index.ts +18 -0
  77. package/src/gaesup/stores/animation/type.ts +9 -0
  78. package/src/gaesup/stores/collider/index.ts +55 -0
  79. package/src/gaesup/stores/context/controller/index.ts +36 -0
  80. package/src/gaesup/stores/context/controller/reducer.ts +18 -0
  81. package/src/gaesup/stores/context/controller/type.ts +38 -0
  82. package/src/gaesup/stores/context/gaesupworld/index.ts +11 -0
  83. package/src/gaesup/stores/context/gaesupworld/reducer.ts +21 -0
  84. package/src/gaesup/stores/context/gaesupworld/type.ts +66 -0
  85. package/src/gaesup/stores/control/index.ts +33 -0
  86. package/src/gaesup/stores/control/type.ts +11 -0
  87. package/src/gaesup/stores/joystick/index.ts +72 -0
  88. package/src/gaesup/stores/joystick/type.ts +23 -0
  89. package/src/gaesup/stores/minimap/index.ts +5 -0
  90. package/src/gaesup/stores/minimap/type.ts +22 -0
  91. package/src/gaesup/stores/point/type.ts +6 -0
  92. package/src/gaesup/stores/states/index.tsx +10 -0
  93. package/src/gaesup/stores/states/type.ts +10 -0
  94. package/src/gaesup/stores/url/index.ts +6 -0
  95. package/src/gaesup/stores/url/type.ts +6 -0
  96. package/src/gaesup/styles.css.ts +26 -0
  97. package/src/gaesup/tools/gameboy/GameBoyButton.tsx +38 -0
  98. package/src/gaesup/tools/gameboy/index.tsx +36 -0
  99. package/src/gaesup/tools/gameboy/style.css.ts +78 -0
  100. package/src/gaesup/tools/gamepad/GamePadButton.tsx +31 -0
  101. package/src/gaesup/tools/gamepad/index.tsx +55 -0
  102. package/src/gaesup/tools/gamepad/style.css.ts +16 -0
  103. package/src/gaesup/tools/index.tsx +61 -0
  104. package/src/gaesup/tools/joystick/index.tsx +145 -0
  105. package/src/gaesup/tools/joystick/style.css.ts +40 -0
  106. package/src/gaesup/tools/jumpPoint/index.tsx +27 -0
  107. package/src/gaesup/tools/jumpPoint/style.css.ts +33 -0
  108. package/src/gaesup/tools/keyBoardToolTip/constant.ts +144 -0
  109. package/src/gaesup/tools/keyBoardToolTip/index.tsx +85 -0
  110. package/src/gaesup/tools/keyBoardToolTip/style.css.ts +49 -0
  111. package/src/gaesup/tools/minimap/index.tsx +47 -0
  112. package/src/gaesup/tools/minimap/style.css.ts +144 -0
  113. package/src/gaesup/tools/style.css.ts +34 -0
  114. package/src/gaesup/utils/constant.ts +1 -0
  115. package/src/gaesup/utils/ray.ts +23 -0
  116. package/src/gaesup/utils/ref.ts +17 -0
  117. package/src/gaesup/utils/vector.ts +40 -0
  118. package/src/gaesup/world/index.tsx +17 -0
  119. package/src/gaesup/world/type.ts +10 -0
  120. package/src/styles/constants/boxshadow.css.ts +499 -0
  121. package/src/styles/constants/constant.css.ts +81 -0
  122. package/src/styles/constants/direction.css.ts +168 -0
  123. package/src/styles/constants/flex.css.ts +68 -0
  124. package/src/styles/constants/gradient.css.ts +10 -0
  125. package/src/styles/constants/grid.css.ts +37 -0
  126. package/src/styles/constants/palette.css.ts +324 -0
  127. package/src/styles/constants/translate.css.ts +129 -0
  128. package/src/styles/global.css.ts +91 -0
  129. package/src/styles/recipe/base.css.ts +31 -0
  130. package/src/styles/recipe/button.css.ts +109 -0
  131. package/src/styles/recipe/index.css.ts +134 -0
  132. package/src/styles/recipe/input.css.ts +33 -0
  133. package/src/styles/sprinkles/color.css.ts +62 -0
  134. package/src/styles/sprinkles/direction.css.ts +26 -0
  135. package/src/styles/sprinkles/display.css.ts +25 -0
  136. package/src/styles/sprinkles/fontSize.css.ts +25 -0
  137. package/src/styles/sprinkles/grid.css.ts +25 -0
  138. package/src/styles/sprinkles/index.css.ts +22 -0
  139. package/src/styles/sprinkles/margin.css.ts +30 -0
  140. package/src/styles/sprinkles/padding.css.ts +30 -0
  141. package/src/styles/sprinkles/position.css.ts +14 -0
  142. package/src/styles/sprinkles/size.css.ts +23 -0
  143. package/src/styles/theme.css.ts +98 -0
  144. package/tsconfig.json +27 -0
  145. package/tsconfig.node.json +10 -0
  146. package/vite.config.ts +9 -0
@@ -0,0 +1,144 @@
1
+ import { keyframes, style } from "@vanilla-extract/css";
2
+ import { fixed, flex_absolute } from "../../../styles/recipe/index.css";
3
+ import { sprinkles } from "../../../styles/sprinkles/index.css";
4
+ import { vars } from "../../../styles/theme.css";
5
+
6
+ export const pulseWhite = keyframes({
7
+ "0%": {
8
+ boxShadow: "0 0 0 0 rgba(255, 255, 255, 0.7)",
9
+ opacity: 1,
10
+ },
11
+ "70%": {
12
+ boxShadow: "0 0 0 10px rgba(255, 255, 255, 0)",
13
+ opacity: 0.7,
14
+ },
15
+ "100%": {
16
+ boxShadow: "0 0 0 0 rgba(255, 255, 255, 0)",
17
+ opacity: 1,
18
+ },
19
+ });
20
+
21
+ export const avatar = style([
22
+ flex_absolute({
23
+ center: true,
24
+ }),
25
+ {
26
+ width: "2rem",
27
+ height: "2rem",
28
+ borderRadius: "50%",
29
+ background: "rgba(5,222,250,1)",
30
+ boxShadow: "0 0 10px rgba(5,222,250,1)",
31
+ border: "2px solid transparent",
32
+ objectFit: "cover",
33
+ zIndex: 100,
34
+ animation: `${pulseWhite} 2s infinite`,
35
+ },
36
+ ]);
37
+
38
+ export const avatarImage = style([
39
+ {
40
+ width: "4rem",
41
+ height: "4rem",
42
+ borderRadius: "50%",
43
+ background: vars.gradient.purple,
44
+ border: "2px solid transparent",
45
+ objectFit: "cover",
46
+ },
47
+ ]);
48
+
49
+ export const border = style([
50
+ {
51
+ width: "4rem",
52
+ height: "4rem",
53
+ borderRadius: "50%",
54
+ boxShadow: "0 0 0 0 rgba(255, 255, 255, 1)",
55
+ transform: "scale(1)",
56
+ animation: `${pulseWhite} 2s infinite`,
57
+ cursor: "pointer",
58
+ transition: "all 0.5s ease-in",
59
+ selectors: {
60
+ "&:hover": {
61
+ transform: "scale(1.1)",
62
+ },
63
+ },
64
+ },
65
+ ]);
66
+
67
+ export const minimap = style([
68
+ fixed({
69
+ south_east: true,
70
+ }),
71
+ sprinkles({
72
+ w: {
73
+ mobile: "12",
74
+ tablet: "14",
75
+ laptop: "16",
76
+ desktop: "19",
77
+ },
78
+ h: {
79
+ mobile: "12",
80
+ tablet: "14",
81
+ laptop: "16",
82
+ desktop: "19",
83
+ },
84
+ }),
85
+ {
86
+ margin: "1rem",
87
+ borderRadius: "50%",
88
+ background: "rgba(0, 0, 0, 0.9)",
89
+ boxShadow: `0 0 10px rgba(0, 0, 0, 0.9)`,
90
+ WebkitBackdropFilter: "blur(10px)",
91
+ backdropFilter: "blur(10px)",
92
+ },
93
+ ]);
94
+
95
+ export const minimapOuter = style([
96
+ flex_absolute({
97
+ center: true,
98
+ }),
99
+ ]);
100
+
101
+ export const minimapInner = style([
102
+ flex_absolute({
103
+ center: true,
104
+ }),
105
+ sprinkles({
106
+ w: {
107
+ mobile: "11",
108
+ tablet: "13",
109
+ laptop: "15",
110
+ desktop: "18",
111
+ },
112
+ h: {
113
+ mobile: "11",
114
+ tablet: "13",
115
+ laptop: "15",
116
+ desktop: "18",
117
+ },
118
+ }),
119
+ {
120
+ zIndex: 2,
121
+ borderRadius: "50%",
122
+ background: "rgba(0, 0, 0, 0.9)",
123
+ overflow: "hidden",
124
+ },
125
+ ]);
126
+
127
+ export const text = style([
128
+ {
129
+ fontSize: "1rem",
130
+ color: "white",
131
+ textShadow: "0 0 10px black",
132
+ },
133
+ ]);
134
+
135
+ export const minimapObject = style([
136
+ flex_absolute({}),
137
+ {
138
+ borderRadius: "2px",
139
+ background: "rgba(99,251,215,0.4)",
140
+ boxShadow: "0 0 10px rgba(99,251,215,0.4)",
141
+ border: "2px solid rgba(99,251,215,1)",
142
+ opacity: 0.5,
143
+ },
144
+ ]);
@@ -0,0 +1,34 @@
1
+ import { style } from "@vanilla-extract/css";
2
+ import { fixed } from "../../styles/recipe/index.css";
3
+
4
+ export const footer = style([
5
+ fixed({
6
+ south: true,
7
+ }),
8
+ {
9
+ width: "100%",
10
+ height: "25rem",
11
+ display: "grid",
12
+ gridTemplateColumns: "repeat(3, 1fr)",
13
+ gridTemplateRows: "repeat(2, 1fr)",
14
+ },
15
+ ]);
16
+
17
+ export const footerUpper = style([
18
+ {
19
+ gridColumn: "1/4",
20
+ gridRow: "1/2",
21
+ display: "flex",
22
+ justifyContent: "center",
23
+ alignItems: "center",
24
+ },
25
+ ]);
26
+
27
+ export const footerLower = style([
28
+ {
29
+ gridColumn: "1/4",
30
+ gridRow: "2/3",
31
+ display: "grid",
32
+ gridTemplateColumns: "repeat(3, 1fr)",
33
+ },
34
+ ]);
@@ -0,0 +1 @@
1
+ export const S3 = "https://jiggloghttps.s3.ap-northeast-2.amazonaws.com/gltf";
@@ -0,0 +1,23 @@
1
+ import { Collider } from "@dimforge/rapier3d-compat";
2
+ import { useRapier } from "@react-three/rapier";
3
+ import { MutableRefObject } from "react";
4
+ import { rayType } from "../controller/type";
5
+
6
+ export const getRayHit = <T extends rayType>({
7
+ ray,
8
+ ref,
9
+ }: {
10
+ ray: T;
11
+ ref: MutableRefObject<Collider>;
12
+ }) => {
13
+ const { world } = useRapier();
14
+ return world.castRay(
15
+ ray.rayCast,
16
+ ray.length,
17
+ true,
18
+ undefined,
19
+ undefined,
20
+ ref.current,
21
+ undefined
22
+ );
23
+ };
@@ -0,0 +1,17 @@
1
+ import { ForwardedRef, useEffect, useRef } from "react";
2
+
3
+ export const useForwardRef = <T>(
4
+ ref: ForwardedRef<T>,
5
+ initialValue: any = null
6
+ ) => {
7
+ const targetRef = useRef<T>(initialValue);
8
+ useEffect(() => {
9
+ if (!ref) return;
10
+ if (typeof ref === "function") {
11
+ ref(targetRef.current);
12
+ } else {
13
+ targetRef.current = ref.current;
14
+ }
15
+ }, [ref]);
16
+ return targetRef;
17
+ };
@@ -0,0 +1,40 @@
1
+ import * as THREE from "three";
2
+
3
+ export function isValidOrZero(
4
+ condision: boolean,
5
+ vector: THREE.Vector3
6
+ ): THREE.Vector3 {
7
+ return condision ? vector : new THREE.Vector3(0, 0, 0);
8
+ }
9
+
10
+ export function isValidOrOne(
11
+ condision: boolean,
12
+ vector: THREE.Vector3
13
+ ): THREE.Vector3 {
14
+ return condision ? vector : new THREE.Vector3(1, 1, 1);
15
+ }
16
+
17
+ export function V3(x?: number, y?: number, z?: number): THREE.Vector3 {
18
+ return new THREE.Vector3(x, y, z);
19
+ }
20
+
21
+ export function V30(): THREE.Vector3 {
22
+ return new THREE.Vector3(0, 0, 0);
23
+ }
24
+
25
+ export function V31(): THREE.Vector3 {
26
+ return new THREE.Vector3(1, 1, 1);
27
+ }
28
+
29
+ export function Qt(
30
+ x?: number,
31
+ y?: number,
32
+ z?: number,
33
+ w?: number
34
+ ): THREE.Quaternion {
35
+ return new THREE.Quaternion(x, y, z, w);
36
+ }
37
+
38
+ export function Elr(x: number, y: number, z: number): THREE.Euler {
39
+ return new THREE.Euler(x, y, z);
40
+ }
@@ -0,0 +1,17 @@
1
+ import initGaesupWorld from "../initial/gaesupWorld";
2
+ import { initGaesupWorldPropsType } from "../initial/gaesupWorld/type";
3
+ import {
4
+ GaesupWorldContext,
5
+ GaesupWorldDispatchContext,
6
+ } from "../stores/context/gaesupworld";
7
+
8
+ export default function GaesupWorld(props: initGaesupWorldPropsType) {
9
+ const { gaesupProps } = initGaesupWorld(props);
10
+ return (
11
+ <GaesupWorldContext.Provider value={gaesupProps.value}>
12
+ <GaesupWorldDispatchContext.Provider value={gaesupProps.dispatch}>
13
+ {props.children}
14
+ </GaesupWorldDispatchContext.Provider>
15
+ </GaesupWorldContext.Provider>
16
+ );
17
+ }
@@ -0,0 +1,10 @@
1
+ import { Dispatch } from "react";
2
+ import { gaesupWorldPropType } from "../stores/context/gaesupworld/type";
3
+
4
+ export type gaesupWorldInitType = {
5
+ value: gaesupWorldPropType;
6
+ dispatch: Dispatch<{
7
+ type: string;
8
+ payload?: Partial<gaesupWorldPropType>;
9
+ }>;
10
+ };