Skip to content

Commit

Permalink
fix: removing unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Feb 19, 2023
1 parent d6aca6f commit 1a9ead7
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 1,847 deletions.
2 changes: 1 addition & 1 deletion packages/cientos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"vite-plugin-dts": "2.0.0-beta.1"
},
"dependencies": {
"@tresjs/core": "workspace:^1.6.0",
"@tresjs/core": "workspace:^1.6.3",
"three-stdlib": "^2.21.8"
}
}
4 changes: 2 additions & 2 deletions packages/cientos/src/core/useFBX/component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Object3D, Scene } from 'three'
import { defineComponent, inject, Ref } from 'vue'
import { Object3D } from 'three'
import { defineComponent } from 'vue'
import { useFBX } from '.'
import { useCientos } from '../useCientos'

Expand Down
4 changes: 2 additions & 2 deletions packages/cientos/src/core/useGLTF/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GLTFLoader, DRACOLoader } from 'three-stdlib'
import { useLoader } from '@tresjs/core'
import { TresObject } from '/@/types'
import { Object3D } from 'three'

export interface GLTFLoaderOptions {
draco?: boolean
Expand All @@ -9,7 +9,7 @@ export interface GLTFLoaderOptions {

export interface GLTFResult {
animations: Array<THREE.AnimationClip>
nodes: Array<TresObject>
nodes: Array<Object3D>
materials: Array<THREE.Material>
scene: THREE.Scene
}
Expand Down
1 change: 0 additions & 1 deletion packages/cientos/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { Environment } from './core/useEnvironment/component'
export * from './core/useGLTF'
export * from './core/useFBX'
export * from './core/useEnvironment'
export * from './types'
export {
OrbitControls,
TransformControls,
Expand Down
6 changes: 0 additions & 6 deletions packages/cientos/src/types/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cientos/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["vite/client", "node", "@tresjs/core"],
"types": ["vite/client", "node"],
"incremental": false,
"skipLibCheck": true,
"noUnusedLocals": false,
Expand Down
14 changes: 8 additions & 6 deletions packages/tres/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"import": "./dist/tres.js",
"require": "./dist/tres.umd.cjs"
},
"./types": {
"require": "./dist/index.d.ts",
"import": "./dist/index.d.ts"
},
"./styles": "./dist/style.css",
"./*": "./dist/tres.js"
},
Expand Down Expand Up @@ -45,8 +49,8 @@
"vue": "^3.2.47"
},
"dependencies": {
"@alvarosabu/utils": "^2.2.0",
"@vueuse/core": "^9.12.0"
"@alvarosabu/utils": "^2.3.0",
"@vueuse/core": "^9.13.0"
},
"devDependencies": {
"@tresjs/cientos": "workspace:^1.6.0",
Expand All @@ -58,14 +62,12 @@
"happy-dom": "^8.2.6",
"kolorist": "^1.7.0",
"pathe": "^1.1.0",
"release-it": "^15.6.0",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-visualizer": "^5.9.0",
"three": "latest",
"unplugin-vue-components": "^0.23.0",
"vite": "^4.1.1",
"vite": "^4.1.2",
"vite-plugin-banner": "^0.7.0",
"vite-plugin-dts": "^1.7.2",
"vite-plugin-dts": "2.0.0-beta.1",
"vite-plugin-glsl": "^1.1.2",
"vite-plugin-inspect": "^0.7.15",
"vite-plugin-require-transform": "^1.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/tres/src/components/Shapes.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BasicShadowMap, CubicBezierCurve3, DoubleSide, NoToneMapping, sRGBEncoding, Vector3 } from 'three'
import { reactive, ref, shallowRef, watch } from 'vue'
import { reactive, shallowRef, watch } from 'vue'
import {
Plane,
Tube,
Expand Down
2 changes: 1 addition & 1 deletion packages/tres/src/components/TestSphere.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const sphereRef: Ref<TresInstance | null> = ref(null)
const { onLoop, resume } = useRenderLoop()
resume()
onLoop(({ _delta, elapsed }) => {
onLoop(({ elapsed }) => {
if (sphereRef.value) {
sphereRef.value.position.y = Math.sin(elapsed * 0.2) * 2.0
}
Expand Down
17 changes: 2 additions & 15 deletions packages/tres/src/components/TheBasic.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
<script setup lang="ts">
import {
sRGBEncoding,
LinearEncoding,
BasicShadowMap,
PCFShadowMap,
PCFSoftShadowMap,
VSMShadowMap,
NoToneMapping,
LinearToneMapping,
ReinhardToneMapping,
CineonToneMapping,
ACESFilmicToneMapping,
CustomToneMapping,
} from 'three'
import { sRGBEncoding, BasicShadowMap, NoToneMapping } from 'three'
import { reactive, ref } from 'vue'
import { OrbitControls, TransformControls } from '@tresjs/cientos'
Expand All @@ -33,7 +20,7 @@ const sphereRef = ref()
const { onLoop } = useRenderLoop()
onLoop(({ delta, elapsed, state }) => {
onLoop(({ elapsed }) => {
sphereRef.value.position.y += Math.sin(elapsed * 0.01) * 0.1
})
</script>
Expand Down
6 changes: 3 additions & 3 deletions packages/tres/src/core/useInstanceCreator/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable new-cap */
/* eslint-disable @typescript-eslint/no-empty-function */
import { BufferAttribute, FogBase, OrthographicCamera, PerspectiveCamera } from 'three'
import { BufferAttribute, Fog, FogBase, Mesh, OrthographicCamera, PerspectiveCamera } from 'three'
import { defineComponent, inject, onUnmounted, Ref } from 'vue'
import { useEventListener } from '@vueuse/core'

Expand Down Expand Up @@ -179,7 +179,7 @@ export function useInstanceCreator(prefix: string) {

let prevInstance: TresEvent | null = null
let currentInstance: TresEvent | null = null
if (instance.isMesh) {
if (instance instanceof Mesh) {
onLoop(() => {
if (instance && raycaster && scene?.children) {
const intersects = raycaster.intersectObjects(scene?.children)
Expand Down Expand Up @@ -212,7 +212,7 @@ export function useInstanceCreator(prefix: string) {
})
}

if (scene && instance.isFog) {
if (scene && instance instanceof Fog) {
scene.fog = instance as unknown as FogBase
}

Expand Down
8 changes: 2 additions & 6 deletions packages/tres/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Scene } from '/@/core/useScene/component'
import { useCatalogue, useInstanceCreator, useTres } from '/@/core'
export * from '/@/core'
export * from './keys'
import { version } from '../package.json'
export * from './types'

export interface TresOptions {
prefix?: string
extends?: Record<string, unknown>
Expand Down Expand Up @@ -35,11 +36,6 @@ const plugin: TresPlugin = {
components.forEach(([key, cmp]) => {
app.component(key as string, cmp as Component)
})

window.__TRES__ = {
app,
version,
}
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Object3D } from 'three'
import { Color, Intersection, Object3D, Vector2, Vector3, Event } from 'three'
import { VNode, VNodeTypes } from 'vue'

export type TresInstance = Object3D<Event> & { [key: string]: any }
Expand All @@ -17,19 +17,7 @@ export type TresColor = string | number | Color | number[]
export interface TresEvent extends Intersection<Object3D<Event>> {
object: Object3D
distance: number
face?: Face3
faceIndex?: number | undefined
point: Vector3
uv?: Vector2
}

declare global {
// Define the window interface, with type annotations for the properties and methods of the window object
interface Window {
// Define the location property, with a type of Location
__TRES__: {
app: App
version: string
}
}
}
Loading

0 comments on commit 1a9ead7

Please sign in to comment.