Skip to content

Commit

Permalink
fix(core): fixed type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Mar 11, 2023
1 parent 71eff1b commit bd4be33
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 550 deletions.
40 changes: 8 additions & 32 deletions packages/tres/src/components/TresCanvas.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineComponent, h, PropType, provide, ref, watch } from 'vue'
import { defineComponent, h, PropType, ref, watch } from 'vue'
/* eslint-disable vue/one-component-per-file */
import * as THREE from 'three'
import { ShadowMapType, TextureEncoding, ToneMapping } from 'three'
/* import { OrbitControls } from '@tresjs/cientos' */
import { createTres } from '/@/core/renderer'
import { useCamera, useRenderer, useTres, useRenderLoop, useRaycaster } from '/@/composables'
import { useCamera, useRenderer, useRenderLoop, useRaycaster } from '/@/composables'
import { TresObject } from '/@/types'

export const TresCanvas = defineComponent({
name: 'TresCanvas',
Expand Down Expand Up @@ -34,35 +34,13 @@ export const TresCanvas = defineComponent({
setup(props, { slots, expose }) {
const container = ref<HTMLElement>()
const canvas = ref<HTMLCanvasElement>()
/* const { state, setState } = useTres() */

/* const { renderer, aspectRatio } = useRenderer(canvas, container, props) */
/* const { activeCamera } = useCamera()
provide('aspect-ratio', aspectRatio)
provide('renderer', renderer) */
watch(canvas, () => {
const { renderer, aspectRatio } = useRenderer(canvas, container, props)
const { renderer } = useRenderer(canvas, container, props)
const { activeCamera } = useCamera()

/* provide('aspect-ratio', aspectRatio)
provide('renderer', renderer) */

/* const controls = new OrbitControls(camera, renderer.domElement)
controls.enableDamping = true */

const scene = new THREE.Scene()

/* window.addEventListener('resize', () => {
renderer.setSize(window.innerWidth, window.innerHeight)
camera.aspect = window.innerWidth / window.innerHeight
camera.updateProjectionMatrix()
})
renderer.setAnimationLoop(() => {
renderer.render(scene, camera)
}) */

const { onLoop } = useRenderLoop()

const { raycaster, pointer } = useRaycaster()
Expand All @@ -74,20 +52,18 @@ export const TresCanvas = defineComponent({
renderer.value?.render(scene, activeCamera.value)
})

const internal = slots?.default() || []
const internal = slots.default ? slots?.default() : [] || []

const internalComponent = defineComponent({
name: 'Wrapper',
__name: 'tres-wrapper',
__scopeId: 'data-v-tres-supreme',
setup() {
return () => internal
},
})

const app = createTres(internalComponent)
app.mount(scene)

console.log(scene)

app.mount(scene as unknown as TresObject)
expose({
scene,
app,
Expand Down
2 changes: 0 additions & 2 deletions packages/tres/src/composables/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export * from './useCamera'
export * from './useCatalogue'
export * from './useInstanceCreator'
export * from './useRenderLoop/'
export * from './useRenderer/'
export * from './useScene/'
Expand Down
2 changes: 1 addition & 1 deletion packages/tres/src/composables/useCamera/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTres } from '/@/composables/'
import { PerspectiveCamera, OrthographicCamera } from 'three'

import { toRef, watch, Ref, inject, watchEffect } from 'vue'
import { toRef, Ref, watchEffect } from 'vue'

export enum CameraType {
Perspective = 'Perspective',
Expand Down
69 changes: 0 additions & 69 deletions packages/tres/src/composables/useCatalogue/index.ts

This file was deleted.

28 changes: 0 additions & 28 deletions packages/tres/src/composables/useCatalogue/useCatalogue.test.ts

This file was deleted.

Loading

0 comments on commit bd4be33

Please sign in to comment.