@fonsecabarreto/genesis-gl-react 0.1.32 → 0.1.34

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.
@@ -0,0 +1,153 @@
1
+ import {
2
+ useCameraControls
3
+ } from "./chunk-7AGC27WM.js";
4
+
5
+ // src/hooks/useModel.ts
6
+ import { useEffect, useRef, useState } from "react";
7
+ function useModel(context, options) {
8
+ const [result, setResult] = useState({
9
+ model: null,
10
+ loading: false,
11
+ error: null
12
+ });
13
+ const optionsRef = useRef(options);
14
+ optionsRef.current = options;
15
+ useEffect(() => {
16
+ if (!context?.scene || !context?.loadOBJ || !context?.webglCore) return;
17
+ const { scene, loadOBJ, webglCore } = context;
18
+ const { name, objUrl, postLoad, ...loadOpts } = optionsRef.current;
19
+ let cancelled = false;
20
+ setResult({ model: null, loading: true, error: null });
21
+ loadOBJ(objUrl, loadOpts).then(async (model) => {
22
+ if (cancelled) return;
23
+ if (postLoad) await postLoad(model, webglCore);
24
+ scene.add(name, model);
25
+ setResult({ model, loading: false, error: null });
26
+ }).catch((err) => {
27
+ if (cancelled) return;
28
+ const error = err instanceof Error ? err : new Error(String(err));
29
+ setResult({ model: null, loading: false, error });
30
+ });
31
+ return () => {
32
+ cancelled = true;
33
+ };
34
+ }, [context?.scene, context?.loadOBJ, context?.webglCore]);
35
+ return result;
36
+ }
37
+
38
+ // src/hooks/useModelRotation.ts
39
+ import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
40
+ function useModelRotation(model) {
41
+ const [rotation, setRotationState] = useState2([0, 0, 0]);
42
+ const modelRef = useRef2(model);
43
+ modelRef.current = model;
44
+ useEffect2(() => {
45
+ if (model) setRotationState([...model.rotation]);
46
+ }, [model]);
47
+ const setRotation = useCallback((x, y, z) => {
48
+ const m = modelRef.current;
49
+ if (!m) return;
50
+ m.setRotation(x, y, z);
51
+ setRotationState([x, y, z]);
52
+ }, []);
53
+ const rotate = useCallback((dx, dy, dz) => {
54
+ const m = modelRef.current;
55
+ if (!m) return;
56
+ const [cx, cy, cz] = m.rotation;
57
+ const nx = cx + dx;
58
+ const ny = cy + dy;
59
+ const nz = cz + dz;
60
+ m.setRotation(nx, ny, nz);
61
+ setRotationState([nx, ny, nz]);
62
+ }, []);
63
+ return { rotation, setRotation, rotate };
64
+ }
65
+
66
+ // src/hooks/useCameraMouseDrag.ts
67
+ import { useEffect as useEffect3, useRef as useRef3 } from "react";
68
+ import { MouseDragControl } from "@fonsecabarreto/genesis-gl-core/Core";
69
+ var SENSITIVITY = 8e-3;
70
+ function useCameraMouseDrag(ctx, canvasRef) {
71
+ const { rotate } = useCameraControls(ctx);
72
+ const rotateRef = useRef3(rotate);
73
+ rotateRef.current = rotate;
74
+ useEffect3(() => {
75
+ const el = canvasRef.current;
76
+ if (!el || !ctx) return;
77
+ const drag = new MouseDragControl(el);
78
+ const onDrag = (dx, dy, button) => {
79
+ if (button !== 2) return;
80
+ rotateRef.current(-dx * SENSITIVITY, dy * SENSITIVITY);
81
+ };
82
+ drag.onChange(onDrag);
83
+ drag.enable();
84
+ const onMouseDown = (e) => {
85
+ if (e.button !== 2) return;
86
+ el.style.cursor = "grabbing";
87
+ };
88
+ const onMouseUp = (e) => {
89
+ if (e.button !== 2) return;
90
+ el.style.cursor = "grab";
91
+ };
92
+ const onMouseEnter = () => {
93
+ el.style.cursor = "grab";
94
+ };
95
+ const onMouseLeave = () => {
96
+ el.style.cursor = "";
97
+ };
98
+ const onContextMenu = (e) => e.preventDefault();
99
+ el.addEventListener("mousedown", onMouseDown);
100
+ el.addEventListener("mouseenter", onMouseEnter);
101
+ el.addEventListener("mouseleave", onMouseLeave);
102
+ window.addEventListener("mouseup", onMouseUp);
103
+ el.addEventListener("contextmenu", onContextMenu);
104
+ return () => {
105
+ drag.disable();
106
+ el.removeEventListener("mousedown", onMouseDown);
107
+ el.removeEventListener("mouseenter", onMouseEnter);
108
+ el.removeEventListener("mouseleave", onMouseLeave);
109
+ window.removeEventListener("mouseup", onMouseUp);
110
+ el.removeEventListener("contextmenu", onContextMenu);
111
+ el.style.cursor = "";
112
+ };
113
+ }, [ctx]);
114
+ }
115
+
116
+ // src/hooks/useGroundShadow.ts
117
+ import { useEffect as useEffect4 } from "react";
118
+ import {
119
+ Model,
120
+ createGroundShadow
121
+ } from "@fonsecabarreto/genesis-gl-core/Core";
122
+ var SHADOW_ID = "__ground_shadow__";
123
+ function useGroundShadow(context, options = {}) {
124
+ const { y, radius, opacity, color } = options;
125
+ useEffect4(() => {
126
+ if (!context?.scene || !context?.webglCore) return;
127
+ const { scene, webglCore } = context;
128
+ const mesh = createGroundShadow(webglCore, { y, radius, opacity, color });
129
+ mesh.isCollidable = false;
130
+ const model = new Model([mesh]);
131
+ scene.add(SHADOW_ID, model);
132
+ return () => {
133
+ scene.remove(SHADOW_ID);
134
+ };
135
+ }, [
136
+ context?.scene,
137
+ context?.webglCore,
138
+ y,
139
+ radius,
140
+ opacity,
141
+ color?.[0],
142
+ color?.[1],
143
+ color?.[2]
144
+ ]);
145
+ }
146
+
147
+ export {
148
+ useModel,
149
+ useModelRotation,
150
+ useCameraMouseDrag,
151
+ useGroundShadow
152
+ };
153
+ //# sourceMappingURL=chunk-YFZKO7RD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useModel.ts","../src/hooks/useModelRotation.ts","../src/hooks/useCameraMouseDrag.ts","../src/hooks/useGroundShadow.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { Model, WebGLCore } from '@fonsecabarreto/genesis-gl-core/Core';\nimport type { GenesisGLContext, LoadOBJOptions } from './useGenesisGL';\n\nexport interface UseModelOptions extends LoadOBJOptions {\n name: string;\n objUrl: string;\n postLoad?: (model: Model, webglCore: WebGLCore) => Promise<void> | void;\n}\n\nexport interface UseModelResult {\n model: Model | null;\n loading: boolean;\n error: Error | null;\n}\n\nexport function useModel(\n context: GenesisGLContext | null,\n options: UseModelOptions,\n): UseModelResult {\n const [result, setResult] = useState<UseModelResult>({\n model: null,\n loading: false,\n error: null,\n });\n\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n useEffect(() => {\n if (!context?.scene || !context?.loadOBJ || !context?.webglCore) return;\n\n const { scene, loadOBJ, webglCore } = context;\n const { name, objUrl, postLoad, ...loadOpts } = optionsRef.current;\n let cancelled = false;\n\n setResult({ model: null, loading: true, error: null });\n\n loadOBJ(objUrl, loadOpts)\n .then(async (model) => {\n if (cancelled) return;\n if (postLoad) await postLoad(model, webglCore);\n scene.add(name, model);\n setResult({ model, loading: false, error: null });\n })\n .catch((err: unknown) => {\n if (cancelled) return;\n const error = err instanceof Error ? err : new Error(String(err));\n setResult({ model: null, loading: false, error });\n });\n\n return () => {\n cancelled = true;\n };\n }, [context?.scene, context?.loadOBJ, context?.webglCore]);\n\n return result;\n}\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { Model } from '@fonsecabarreto/genesis-gl-core/Core';\n\ntype Rotation = [number, number, number];\n\nexport interface UseModelRotationResult {\n rotation: Rotation;\n setRotation: (x: number, y: number, z: number) => void;\n rotate: (dx: number, dy: number, dz: number) => void;\n}\n\nexport function useModelRotation(model: Model | null): UseModelRotationResult {\n const [rotation, setRotationState] = useState<Rotation>([0, 0, 0]);\n const modelRef = useRef(model);\n modelRef.current = model;\n\n useEffect(() => {\n if (model) setRotationState([...model.rotation]);\n }, [model]);\n\n const setRotation = useCallback((x: number, y: number, z: number) => {\n const m = modelRef.current;\n if (!m) return;\n m.setRotation(x, y, z);\n setRotationState([x, y, z]);\n }, []);\n\n const rotate = useCallback((dx: number, dy: number, dz: number) => {\n const m = modelRef.current;\n if (!m) return;\n const [cx, cy, cz] = m.rotation;\n const nx = cx + dx;\n const ny = cy + dy;\n const nz = cz + dz;\n m.setRotation(nx, ny, nz);\n setRotationState([nx, ny, nz]);\n }, []);\n\n return { rotation, setRotation, rotate };\n}\n","import { useEffect, useRef } from 'react';\nimport { MouseDragControl } from '@fonsecabarreto/genesis-gl-core/Core';\nimport { useCameraControls } from './useCameraControls';\nimport type { GenesisGLContext } from './useGenesisGL';\n\nconst SENSITIVITY = 0.008;\n\nexport function useCameraMouseDrag(\n ctx: GenesisGLContext | null,\n canvasRef: React.RefObject<HTMLElement | null>,\n) {\n const { rotate } = useCameraControls(ctx);\n const rotateRef = useRef(rotate);\n rotateRef.current = rotate;\n\n useEffect(() => {\n const el = canvasRef.current;\n if (!el || !ctx) return;\n\n const drag = new MouseDragControl(el);\n\n const onDrag = (dx: number, dy: number, button: number) => {\n if (button !== 2) return;\n rotateRef.current(-dx * SENSITIVITY, dy * SENSITIVITY);\n };\n\n drag.onChange(onDrag);\n drag.enable();\n\n const onMouseDown = (e: MouseEvent) => {\n if (e.button !== 2) return;\n el.style.cursor = 'grabbing';\n };\n\n const onMouseUp = (e: MouseEvent) => {\n if (e.button !== 2) return;\n el.style.cursor = 'grab';\n };\n\n const onMouseEnter = () => {\n el.style.cursor = 'grab';\n };\n\n const onMouseLeave = () => {\n el.style.cursor = '';\n };\n\n const onContextMenu = (e: Event) => e.preventDefault();\n\n el.addEventListener('mousedown', onMouseDown);\n el.addEventListener('mouseenter', onMouseEnter);\n el.addEventListener('mouseleave', onMouseLeave);\n window.addEventListener('mouseup', onMouseUp);\n el.addEventListener('contextmenu', onContextMenu);\n\n return () => {\n drag.disable();\n el.removeEventListener('mousedown', onMouseDown);\n el.removeEventListener('mouseenter', onMouseEnter);\n el.removeEventListener('mouseleave', onMouseLeave);\n window.removeEventListener('mouseup', onMouseUp);\n el.removeEventListener('contextmenu', onContextMenu);\n el.style.cursor = '';\n };\n }, [ctx]);\n}\n","import { useEffect } from 'react';\nimport {\n Model,\n createGroundShadow,\n type GroundShadowOptions,\n} from '@fonsecabarreto/genesis-gl-core/Core';\nimport type { GenesisGLContext } from './useGenesisGL';\n\nconst SHADOW_ID = '__ground_shadow__';\n\nexport function useGroundShadow(\n context: GenesisGLContext | null,\n options: GroundShadowOptions = {},\n) {\n const { y, radius, opacity, color } = options;\n\n useEffect(() => {\n if (!context?.scene || !context?.webglCore) return;\n const { scene, webglCore } = context;\n\n const mesh = createGroundShadow(webglCore, { y, radius, opacity, color });\n mesh.isCollidable = false;\n const model = new Model([mesh]);\n scene.add(SHADOW_ID, model);\n\n return () => {\n scene.remove(SHADOW_ID);\n };\n }, [\n context?.scene,\n context?.webglCore,\n y,\n radius,\n opacity,\n color?.[0],\n color?.[1],\n color?.[2],\n ]);\n}\n"],"mappings":";;;;;AAAA,SAAS,WAAW,QAAQ,gBAAgB;AAgBrC,SAAS,SACd,SACA,SACgB;AAChB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAyB;AAAA,IACnD,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,EACT,CAAC;AAED,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AAErB,YAAU,MAAM;AACd,QAAI,CAAC,SAAS,SAAS,CAAC,SAAS,WAAW,CAAC,SAAS,UAAW;AAEjE,UAAM,EAAE,OAAO,SAAS,UAAU,IAAI;AACtC,UAAM,EAAE,MAAM,QAAQ,UAAU,GAAG,SAAS,IAAI,WAAW;AAC3D,QAAI,YAAY;AAEhB,cAAU,EAAE,OAAO,MAAM,SAAS,MAAM,OAAO,KAAK,CAAC;AAErD,YAAQ,QAAQ,QAAQ,EACrB,KAAK,OAAO,UAAU;AACrB,UAAI,UAAW;AACf,UAAI,SAAU,OAAM,SAAS,OAAO,SAAS;AAC7C,YAAM,IAAI,MAAM,KAAK;AACrB,gBAAU,EAAE,OAAO,SAAS,OAAO,OAAO,KAAK,CAAC;AAAA,IAClD,CAAC,EACA,MAAM,CAAC,QAAiB;AACvB,UAAI,UAAW;AACf,YAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAChE,gBAAU,EAAE,OAAO,MAAM,SAAS,OAAO,MAAM,CAAC;AAAA,IAClD,CAAC;AAEH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF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S,MAAM,IAAI;AAEtC,EAAAA,WAAU,MAAM;AACd,QAAI,CAAC,SAAS,SAAS,CAAC,SAAS,UAAW;AAC5C,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,UAAM,OAAO,mBAAmB,WAAW,EAAE,GAAG,QAAQ,SAAS,MAAM,CAAC;AACxE,SAAK,eAAe;AACpB,UAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC;AAC9B,UAAM,IAAI,WAAW,KAAK;AAE1B,WAAO,MAAM;AACX,YAAM,OAAO,SAAS;AAAA,IACxB;AAAA,EACF,GAAG;AAAA,IACD,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,QAAQ,CAAC;AAAA,IACT,QAAQ,CAAC;AAAA,EACX,CAAC;AACH;","names":["useEffect","useRef","useState","useEffect","useRef","useRef","useEffect","useEffect"]}
@@ -11,11 +11,35 @@ interface GenesisGLCanvasProps {
11
11
  initialYaw?: number;
12
12
  initialPitch?: number;
13
13
  initialZoom?: number;
14
+ /** RGBA clear color, e.g. [0.05, 0.05, 0.05, 1] */
15
+ background?: [number, number, number, number];
14
16
  style?: React.CSSProperties;
15
17
  className?: string;
16
18
  }
17
19
  declare const GenesisGLCanvas: React.ForwardRefExoticComponent<GenesisGLCanvasProps & React.RefAttributes<HTMLCanvasElement>>;
18
20
 
21
+ interface ViewportGizmoProps {
22
+ context: GenesisGLContext | null;
23
+ /** Size of the gizmo widget in px. Default 96 */
24
+ size?: number;
25
+ /** Corner to anchor in. Default 'top-right' */
26
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
27
+ style?: React.CSSProperties;
28
+ }
29
+ declare function ViewportGizmo({ context, size, position, style, }: ViewportGizmoProps): react_jsx_runtime.JSX.Element;
30
+
31
+ interface OrbitArrowsProps {
32
+ context: GenesisGLContext | null;
33
+ /** World-space centre the rings are drawn around. Default [0,0,0] */
34
+ center?: [number, number, number];
35
+ /** Radius of the orbit rings in world units. Default 1.2 */
36
+ radius?: number;
37
+ /** How many points to sample per arc. Default 48 */
38
+ segments?: number;
39
+ style?: React.CSSProperties;
40
+ }
41
+ declare function OrbitArrows({ context, center, radius, segments, style, }: OrbitArrowsProps): react_jsx_runtime.JSX.Element | null;
42
+
19
43
  interface RotationControlsProps {
20
44
  context: GenesisGLContext | null;
21
45
  style?: React.CSSProperties;
@@ -57,4 +81,4 @@ interface FaceSkinProps {
57
81
  }
58
82
  declare function FaceSkin({ context, model, corners, children, style, className, surfaceWidth, surfaceHeight, }: FaceSkinProps): react_jsx_runtime.JSX.Element | null;
59
83
 
60
- export { FaceSkin as FaceLabel, type FaceSkinProps as FaceLabelProps, FaceSkin, type FaceSkinProps, GenesisGLCanvas, type GenesisGLCanvasProps, RotationControls, type RotationControlsProps };
84
+ export { FaceSkin as FaceLabel, type FaceSkinProps as FaceLabelProps, FaceSkin, type FaceSkinProps, GenesisGLCanvas, type GenesisGLCanvasProps, OrbitArrows, type OrbitArrowsProps, RotationControls, type RotationControlsProps, ViewportGizmo, type ViewportGizmoProps };
@@ -1,13 +1,17 @@
1
1
  import {
2
2
  FaceSkin,
3
3
  GenesisGLCanvas,
4
- RotationControls
5
- } from "../chunk-R4MI3LWV.js";
6
- import "../chunk-MAGVIIUT.js";
4
+ OrbitArrows,
5
+ RotationControls,
6
+ ViewportGizmo
7
+ } from "../chunk-5SN3UL2T.js";
8
+ import "../chunk-7AGC27WM.js";
7
9
  export {
8
10
  FaceSkin as FaceLabel,
9
11
  FaceSkin,
10
12
  GenesisGLCanvas,
11
- RotationControls
13
+ OrbitArrows,
14
+ RotationControls,
15
+ ViewportGizmo
12
16
  };
13
17
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { L as LoadOBJOptions, G as GenesisGLContext } from '../useGenesisGL-VdB4J3Hl.js';
2
2
  export { U as UseGenesisGLOptions, u as useGenesisGL } from '../useGenesisGL-VdB4J3Hl.js';
3
- import { Renderer, Model, WebGLCore } from '@fonsecabarreto/genesis-gl-core/Core';
3
+ import { Renderer, Model, WebGLCore, GroundShadowOptions } from '@fonsecabarreto/genesis-gl-core/Core';
4
4
 
5
5
  interface UseRendererOptions {
6
6
  renderer: Renderer | null;
@@ -61,4 +61,6 @@ declare function useCameraControls(ctx: GenesisGLContext | null): UseCameraContr
61
61
 
62
62
  declare function useCameraMouseDrag(ctx: GenesisGLContext | null, canvasRef: React.RefObject<HTMLElement | null>): void;
63
63
 
64
- export { type CameraState, GenesisGLContext, LoadOBJOptions, type ScreenPoint, type UseCameraControlsResult, type UseModelOptions, type UseModelResult, type UseModelRotationResult, type UseRendererOptions, useCameraControls, useCameraMouseDrag, useModel, useModelRotation, useRenderer, useWorldToScreen };
64
+ declare function useGroundShadow(context: GenesisGLContext | null, options?: GroundShadowOptions): void;
65
+
66
+ export { type CameraState, GenesisGLContext, LoadOBJOptions, type ScreenPoint, type UseCameraControlsResult, type UseModelOptions, type UseModelResult, type UseModelRotationResult, type UseRendererOptions, useCameraControls, useCameraMouseDrag, useGroundShadow, useModel, useModelRotation, useRenderer, useWorldToScreen };
@@ -1,18 +1,20 @@
1
1
  import {
2
+ useCameraMouseDrag,
3
+ useGroundShadow,
2
4
  useModel,
3
5
  useModelRotation
4
- } from "../chunk-GDDOUPFO.js";
6
+ } from "../chunk-YFZKO7RD.js";
5
7
  import {
6
8
  useCameraControls,
7
- useCameraMouseDrag,
8
9
  useGenesisGL,
9
10
  useRenderer,
10
11
  useWorldToScreen
11
- } from "../chunk-MAGVIIUT.js";
12
+ } from "../chunk-7AGC27WM.js";
12
13
  export {
13
14
  useCameraControls,
14
15
  useCameraMouseDrag,
15
16
  useGenesisGL,
17
+ useGroundShadow,
16
18
  useModel,
17
19
  useModelRotation,
18
20
  useRenderer,
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { G as GenesisGLContext, L as LoadOBJOptions, U as UseGenesisGLOptions, u as useGenesisGL } from './useGenesisGL-VdB4J3Hl.js';
2
- export { CameraState, ScreenPoint, UseCameraControlsResult, UseModelOptions, UseModelResult, UseModelRotationResult, UseRendererOptions, useCameraControls, useCameraMouseDrag, useModel, useModelRotation, useRenderer, useWorldToScreen } from './hooks/index.js';
3
- export { FaceLabel, FaceLabelProps, FaceLabel as FaceSkin, FaceLabelProps as FaceSkinProps, GenesisGLCanvas, GenesisGLCanvasProps, RotationControls, RotationControlsProps } from './components/index.js';
2
+ export { CameraState, ScreenPoint, UseCameraControlsResult, UseModelOptions, UseModelResult, UseModelRotationResult, UseRendererOptions, useCameraControls, useCameraMouseDrag, useGroundShadow, useModel, useModelRotation, useRenderer, useWorldToScreen } from './hooks/index.js';
3
+ export { FaceLabel, FaceLabelProps, FaceLabel as FaceSkin, FaceLabelProps as FaceSkinProps, GenesisGLCanvas, GenesisGLCanvasProps, OrbitArrows, OrbitArrowsProps, RotationControls, RotationControlsProps, ViewportGizmo, ViewportGizmoProps } from './components/index.js';
4
4
  export { Model, Renderer, Scene, Viewport, WebGLCore } from '@fonsecabarreto/genesis-gl-core/Core';
5
5
  export { loadOBJWithMTL } from '@fonsecabarreto/genesis-gl-core/Core/utils/parse-obj';
6
6
  import 'react';
package/dist/index.js CHANGED
@@ -1,19 +1,22 @@
1
1
  import {
2
2
  FaceSkin,
3
3
  GenesisGLCanvas,
4
- RotationControls
5
- } from "./chunk-R4MI3LWV.js";
4
+ OrbitArrows,
5
+ RotationControls,
6
+ ViewportGizmo
7
+ } from "./chunk-5SN3UL2T.js";
6
8
  import {
9
+ useCameraMouseDrag,
10
+ useGroundShadow,
7
11
  useModel,
8
12
  useModelRotation
9
- } from "./chunk-GDDOUPFO.js";
13
+ } from "./chunk-YFZKO7RD.js";
10
14
  import {
11
15
  useCameraControls,
12
- useCameraMouseDrag,
13
16
  useGenesisGL,
14
17
  useRenderer,
15
18
  useWorldToScreen
16
- } from "./chunk-MAGVIIUT.js";
19
+ } from "./chunk-7AGC27WM.js";
17
20
 
18
21
  // src/index.ts
19
22
  import { loadOBJWithMTL } from "@fonsecabarreto/genesis-gl-core/Core/utils/parse-obj";
@@ -21,11 +24,14 @@ export {
21
24
  FaceSkin as FaceLabel,
22
25
  FaceSkin,
23
26
  GenesisGLCanvas,
27
+ OrbitArrows,
24
28
  RotationControls,
29
+ ViewportGizmo,
25
30
  loadOBJWithMTL,
26
31
  useCameraControls,
27
32
  useCameraMouseDrag,
28
33
  useGenesisGL,
34
+ useGroundShadow,
29
35
  useModel,
30
36
  useModelRotation,
31
37
  useRenderer,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './hooks';\nexport * from './components';\nexport type {\n Scene,\n Viewport,\n Renderer,\n Model,\n WebGLCore,\n} from '@fonsecabarreto/genesis-gl-core/Core';\nexport { loadOBJWithMTL } from '@fonsecabarreto/genesis-gl-core/Core/utils/parse-obj';\n"],"mappings":";;;;;;;;;;;;;;;;;;AASA,SAAS,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './hooks';\nexport * from './components';\nexport type {\n Scene,\n Viewport,\n Renderer,\n Model,\n WebGLCore,\n} from '@fonsecabarreto/genesis-gl-core/Core';\nexport { loadOBJWithMTL } from '@fonsecabarreto/genesis-gl-core/Core/utils/parse-obj';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,SAAS,sBAAsB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonsecabarreto/genesis-gl-react",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "React integration for GenesisGL — WebGL 3D engine",
5
5
  "author": "Lucas Fonseca Barreto",
6
6
  "license": "MIT",