Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 524 feat add directives to core #525

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
types: v-log
  • Loading branch information
alvarosabu committed Jan 27, 2024
commit 09ce01c284d007e88256362c366d23738d5f5902
8 changes: 6 additions & 2 deletions playground/src/pages/lights.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { TresObject } from '@tresjs/core'
import { TresCanvas, vLightHelper, vAlwaysLookAt, vDistanceTo } from '@tresjs/core'
import { TresCanvas, vLightHelper, vAlwaysLookAt, vDistanceTo, vLog } from '@tresjs/core'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'

import { OrbitControls } from '@tresjs/cientos'
Expand All @@ -18,7 +18,10 @@ const planeRef: Ref<TresObject | null> = ref(null)
</script>

<template>
<TresCanvas v-bind="gl">
<TresCanvas

v-bind="gl"
>
<TresPerspectiveCamera :position="[3, 3, 3]" />
<OrbitControls />

Expand All @@ -32,6 +35,7 @@ const planeRef: Ref<TresObject | null> = ref(null)
/>
<TresMesh
ref="planeRef"
v-log:material
:rotation="[-Math.PI / 2, 0, 0]"
receive-shadow
>
Expand Down
4 changes: 3 additions & 1 deletion src/directives/vLog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { TresObject } from '../types'

export const vLog = {
mounted: (el: any, binding: any) => {
mounted: (el: TresObject, binding: { arg: string }) => {
if (binding.arg) {
// eslint-disable-next-line no-console
console.log(`v-log:${binding.arg}`, el[binding.arg])
Expand Down
Loading