Skip to content

Commit

Permalink
Revert "[WIP 1] #143"
Browse files Browse the repository at this point in the history
This reverts commit 3e6ba21.
  • Loading branch information
Vatroslav Vrbanic committed Aug 19, 2022
1 parent 3e6ba21 commit 896760a
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 35 deletions.
7 changes: 5 additions & 2 deletions src/components/AmbientLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ AmbientLight cannot be used to cast shadows as it doesn't have a direction. Posi
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { AmbientLight } from "three"
import type { AmbientLightProps } from "../types-comp-props"
import type { Color, Vector3, Object3D } from "three"
import { get_root_scene } from "../utils/SceneUtils"
import type { Writable } from "svelte/store"
/**
* SVELTEKIT SSR /
Expand Down Expand Up @@ -249,6 +250,8 @@ AmbientLight cannot be used to cast shadows as it doesn't have a direction. Posi
$: if (light && name) light.name = name
$: if (shadow_dom_el && name) shadow_dom_el.dataset.name = name
const w_sh = PropUtils.getShortHandAttrWarnings(`SVELTHREE > ${c_name} >`)
let sProps: SvelthreeProps
// IMPORTANT `props` will be overridden by 'shorthand' attributes!
Expand Down Expand Up @@ -308,7 +311,7 @@ AmbientLight cannot be used to cast shadows as it doesn't have a direction. Posi
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(light, "light")
const removed: boolean = await remove_instance(light, "light")
return removed
}
/**
Expand Down
10 changes: 6 additions & 4 deletions src/components/Canvas.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This is a **svelthree** _Canvas_ Component.
import type { Object3D } from "three"
import { svelthreeStores } from "svelthree/stores"
import { SvelthreeStoreArray } from "../utils/SvelthreeStoreArray"
import type { PointerState, StoreBody } from "../types-extra"
import type { PointerState, StoreBody, WebGLRendererMode } from "../types-extra"
import { c_rs, c_lc, c_dev, verbose_mode, get_comp_name } from "../utils/SvelthreeLogger"
import type { LogLC, LogDEV } from "../utils/SvelthreeLogger"
import { RaycastArray } from "../utils/RaycastArray"
Expand Down Expand Up @@ -62,8 +62,7 @@ This is a **svelthree** _Canvas_ Component.
// #region --- Optional Attributes
/** RECONSIDER `name` attribute is currently unused, but could be somehow useful in future. */
// export let name: string = undefined
export let name: string = undefined
export let style: string = undefined
let clazz: string = undefined
Expand Down Expand Up @@ -335,6 +334,9 @@ This is a **svelthree** _Canvas_ Component.
// reactive create raycaster
$: interactive && !raycaster && c && $svelthreeStores[sti].renderer ? createRaycaster() : null
let render_mode: WebGLRendererMode
$: render_mode = $svelthreeStores[sti].rendererComponent?.mode
function createRaycaster() {
if (verbose && log_rs) console.debug(...c_rs(c_name, "createRaycaster > interactive", interactive))
Expand Down Expand Up @@ -389,7 +391,7 @@ This is a **svelthree** _Canvas_ Component.
remove_interaction_1_listener = $svelthreeStores[sti].rendererComponent.$on("interaction_1", on_interaction_1)
}
function on_interaction_1(): void {
function on_interaction_1(e: CustomEvent): void {
update_all_intersections_and_cursor()
update_canvas_listeners()
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/CubeCamera.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Renders a CubeMap for usage with **non-PBR** materials which have an `.envMap` p
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { CubeCamera, WebGLCubeRenderTarget } from "three"
import type { CubeCameraProps, WebGLCubeRenderTargetProps } from "../types-comp-props"
Expand All @@ -43,9 +43,10 @@ Renders a CubeMap for usage with **non-PBR** materials which have an `.envMap` p
MeshBasicMaterial,
MeshLambertMaterial
} from "three"
import type { RemoveLast } from "../types-extra"
import type { RemoveLast, OnlyWritableNonFunctionProps } from "../types-extra"
import type { default as MeshSvelthreeComponent } from "./Mesh.svelte"
import type { default as Object3DSvelthreeComponent } from "./Object3D.svelte"
import type { Writable } from "svelte/store"
/**
* SVELTEKIT SSR /
Expand Down Expand Up @@ -613,7 +614,7 @@ Renders a CubeMap for usage with **non-PBR** materials which have an `.envMap` p
export const remove_instance_from_parent = async (): Promise<boolean> => {
// SVELTEKIT SSR
if (browser) {
const removed: boolean = remove_instance(camera, "camera")
const removed: boolean = await remove_instance(camera, "camera")
return removed
}
return false
Expand Down
4 changes: 2 additions & 2 deletions src/components/DirectionalLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeLightWithShadow } from "../components-internal"
import type { LightShadowCamProps, LightShadowProps } from "../types-extra"
Expand Down Expand Up @@ -451,7 +451,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(light, "light")
const removed: boolean = await remove_instance(light, "light")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Group.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { BoxHelper } from "three"
import { get_root_scene } from "../utils/SceneUtils"
Expand Down Expand Up @@ -426,7 +426,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(group, "group")
const removed: boolean = await remove_instance(group, "group")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/HemisphereLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { HemisphereLight, HemisphereLightHelper } from "three"
import type { HemisphereLightProps } from "../types-comp-props"
Expand Down Expand Up @@ -353,7 +353,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(light, "light")
const removed: boolean = await remove_instance(light, "light")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/LoadedGLTF.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeInteraction } from "../components-internal"
import type { RaycastArray } from "../utils/RaycastArray"
Expand Down Expand Up @@ -701,7 +701,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(container, "container")
const removed: boolean = await remove_instance(container, "container")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Mesh.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeInteraction } from "../components-internal"
import type { RaycastArray } from "../utils/RaycastArray"
Expand Down Expand Up @@ -844,7 +844,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(mesh, "mesh")
const removed: boolean = await remove_instance(mesh, "mesh")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Object3D.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { BoxHelper } from "three"
import { get_root_scene } from "../utils/SceneUtils"
Expand Down Expand Up @@ -427,7 +427,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(object3d, "object3d")
const removed: boolean = await remove_instance(object3d, "object3d")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/OrthographicCamera.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If you use this approach you'll see a warning in the console if you define left,
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { OrthographicCamera, CameraHelper } from "three"
import type { OrthographicCameraProps } from "../types-comp-props"
Expand Down Expand Up @@ -533,7 +533,7 @@ If you use this approach you'll see a warning in the console if you define left,
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(camera, "camera")
const removed: boolean = await remove_instance(camera, "camera")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/PerspectiveCamera.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { PerspectiveCamera, CameraHelper } from "three"
import type { PerspectiveCameraProps } from "../types-comp-props"
Expand Down Expand Up @@ -567,7 +567,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(camera, "camera")
const removed: boolean = await remove_instance(camera, "camera")
return removed
}
/**
Expand Down
5 changes: 3 additions & 2 deletions src/components/PointLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeLightWithShadow } from "../components-internal"
import type { LightShadowCamProps, LightShadowProps } from "../types-extra"
Expand All @@ -38,6 +38,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import type { Color } from "three"
import type { RemoveFirst } from "../types-extra"
import { get_root_scene } from "../utils/SceneUtils"
import type { Writable } from "svelte/store"
/**
* SVELTEKIT SSR /
Expand Down Expand Up @@ -415,7 +416,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(light, "light")
const removed: boolean = await remove_instance(light, "light")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Points.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeInteraction } from "../components-internal"
import type { RaycastArray } from "../utils/RaycastArray"
Expand Down Expand Up @@ -837,7 +837,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(points, "points")
const removed: boolean = await remove_instance(points, "points")
return removed
}
/**
Expand Down
5 changes: 3 additions & 2 deletions src/components/RectAreaLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { RectAreaLight } from "three"
import type { RectAreaLightProps } from "../types-comp-props"
Expand All @@ -36,6 +36,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { RectAreaLightUniformsLib } from "three/examples/jsm/lights/RectAreaLightUniformsLib.js"
import type { RemoveFirst } from "../types-extra"
import { get_root_scene } from "../utils/SceneUtils"
import type { Writable } from "svelte/store"
/**
* SVELTEKIT SSR /
Expand Down Expand Up @@ -431,7 +432,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(light, "light")
const removed: boolean = await remove_instance(light, "light")
return removed
}
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Scene.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeInteraction } from "../components-internal"
import type { RaycastArray } from "../utils/RaycastArray"
Expand Down Expand Up @@ -829,7 +829,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(scene, "scene")
const removed: boolean = await remove_instance(scene, "scene")
return removed
}
/**
Expand Down
5 changes: 3 additions & 2 deletions src/components/SpotLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import { PropUtils, SvelthreeProps } from "../utils"
import { SvelthreeAnimation } from "../ani"
import type { SvelthreeAnimationFunction } from "../types-extra"
import type { SvelthreeAnimationFunction, SvelthreeAnimationFunctionReturn } from "../types-extra"
import { SvelthreeLightWithShadow } from "../components-internal"
import type { LightShadowCamProps, LightShadowProps } from "../types-extra"
Expand All @@ -42,6 +42,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
import type { Color } from "three"
import type { RemoveFirst } from "../types-extra"
import { get_root_scene } from "../utils/SceneUtils"
import type { Writable } from "svelte/store"
/**
* SVELTEKIT SSR /
Expand Down Expand Up @@ -495,7 +496,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
/** Removes the (three) instance created by / provided to the component from it's parent. */
export const remove_instance_from_parent = async (): Promise<boolean> => {
const removed: boolean = remove_instance(light, "light")
const removed: boolean = await remove_instance(light, "light")
return removed
}
/**
Expand Down

0 comments on commit 896760a

Please # to comment.