diff --git a/playground/src/pages/directives/vLightHelper.vue b/playground/src/pages/directives/vLightHelper.vue
new file mode 100644
index 00000000..738e79ca
--- /dev/null
+++ b/playground/src/pages/directives/vLightHelper.vue
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/playground/src/components/DirectivesDemo.vue b/playground/src/pages/directives/vLog.vue
similarity index 98%
rename from playground/src/components/DirectivesDemo.vue
rename to playground/src/pages/directives/vLog.vue
index 469af6af..0dbe3aca 100644
--- a/playground/src/components/DirectivesDemo.vue
+++ b/playground/src/pages/directives/vLog.vue
@@ -32,6 +32,7 @@ onLoop(({ elapsed }) => {
-
+
diff --git a/playground/src/router/index.ts b/playground/src/router/index.ts
index de4e0005..15823a5f 100644
--- a/playground/src/router/index.ts
+++ b/playground/src/router/index.ts
@@ -5,6 +5,7 @@ import {
stagingRoutes,
loadersRoutes,
materialsRoutes,
+ directivesRoutes,
} from './routes'
const routes = [
@@ -18,6 +19,7 @@ const routes = [
...stagingRoutes,
...loadersRoutes,
...materialsRoutes,
+ ...directivesRoutes,
]
export const router = createRouter({
diff --git a/playground/src/router/routes/directives.ts b/playground/src/router/routes/directives.ts
new file mode 100644
index 00000000..a9bb9fc6
--- /dev/null
+++ b/playground/src/router/routes/directives.ts
@@ -0,0 +1,12 @@
+export const directivesRoutes = [
+ {
+ path: '/directives/vlog',
+ name: 'vLog',
+ component: () => import('../../pages/directives/vLog.vue'),
+ },
+ {
+ path: '/directives/v-light-helper',
+ name: 'vLightHelper',
+ component: () => import('../../pages/directives/vLightHelper.vue'),
+ },
+]
\ No newline at end of file
diff --git a/playground/src/router/routes/index.ts b/playground/src/router/routes/index.ts
index 17d10a7e..30360585 100644
--- a/playground/src/router/routes/index.ts
+++ b/playground/src/router/routes/index.ts
@@ -2,6 +2,7 @@ import { controlsRoutes } from './controls'
import { abstractionsRoutes } from './abstractions'
import { stagingRoutes } from './staging'
import { loadersRoutes } from './loaders'
+import { directivesRoutes } from './directives'
import { materialsRoutes } from './materials'
export {
@@ -10,4 +11,5 @@ export {
stagingRoutes,
loadersRoutes,
materialsRoutes,
+ directivesRoutes,
}
\ No newline at end of file
diff --git a/src/core/directives/index.ts b/src/core/directives/index.ts
index 25fbb90a..e9f5305c 100644
--- a/src/core/directives/index.ts
+++ b/src/core/directives/index.ts
@@ -1,3 +1,4 @@
import { vLog } from './vLog'
+import { vLightHelper } from './vLightHelper'
-export { vLog }
+export { vLog, vLightHelper }
diff --git a/src/core/directives/vLightHelper.ts b/src/core/directives/vLightHelper.ts
new file mode 100644
index 00000000..3affe388
--- /dev/null
+++ b/src/core/directives/vLightHelper.ts
@@ -0,0 +1,22 @@
+import { useLogger } from '@tresjs/core'
+import { DirectionalLightHelper, PointLightHelper, SpotLightHelper, HemisphereLightHelper } from 'three'
+
+const { logWarning } = useLogger()
+
+export const vLightHelper = {
+ mounted: (el: any) => {
+ if (!el.isLight) {
+ logWarning(`${el.type} is not a light`)
+ return
+ }
+ const currentHelper = helpers[el.type]
+ el.parent.add(new currentHelper(el))
+ },
+}
+
+const helpers = {
+ DirectionalLight: DirectionalLightHelper,
+ PointLight: PointLightHelper,
+ SpotLight: SpotLightHelper,
+ HemisphereLight: HemisphereLightHelper,
+}