@tresjs/cientos 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,4 +87,4 @@ pnpm run docs:build
87
87
 
88
88
  ## Sponsors
89
89
 
90
- Be the first to support this project [here](https://github.com/sponsors/alvarosabu) ☺️
90
+ Be the first to support this project [here](https://github.com/sponsors/alvarosabu) ☺️.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Seedable pseudorandom number tools
3
+ */
4
+ export default class RandUtils {
5
+ private _getNext;
6
+ private _getGenerator;
7
+ /**
8
+ * Create a new seeded pseudorandom number generator.
9
+ * @param [seed=0] - the seed for the generator
10
+ * @param [getSeededRandomGenerator=getMulberry32] - a function that returns a pseudorandom number generator
11
+ * @constructor
12
+ */
13
+ constructor(seed?: number, getSeededRandomGenerator?: (seed: number) => () => number);
14
+ /**
15
+ * Reseed the pseudorandom number generator
16
+ */
17
+ seed(s: number): void;
18
+ /**
19
+ * Return the next pseudorandom number in the interval [0, 1]
20
+ */
21
+ rand(): number;
22
+ /**
23
+ * Random float from <low, high> interval
24
+ * @param low - Low value of the interval
25
+ * @param high - High value of the interval
26
+ */
27
+ float(low: number, high: number): number;
28
+ /**
29
+ * Random float from <-range/2, range/2> interval
30
+ * @param range - Interval range
31
+ */
32
+ floatSpread(range: number): number;
33
+ /**
34
+ * Random integer from <low, high> interval
35
+ * @param low Low value of the interval
36
+ * @param high High value of the interval
37
+ */
38
+ int(low: number, high: number): number;
39
+ /**
40
+ * Choose an element from an array.
41
+ * @param array The array to choose from
42
+ * @returns An element from the array or null if the array is empty
43
+ */
44
+ choice<T>(array: T[]): T | null;
45
+ /**
46
+ * Choose an element from an array or return defaultValue if array is empty.
47
+ * @param array The array to choose from
48
+ * @param defaultValue The value to return if the array is empty
49
+ * @returns An element from the array or defaultValue if the array is empty
50
+ */
51
+ defaultChoice<T>(array: T[], defaultValue: T): T;
52
+ /**
53
+ * Return n elements from an array.
54
+ * @param array The array to sample
55
+ * @param sampleSizeMin The minimum sample size
56
+ * @param sampleSizeMax The maximum sample size
57
+ */
58
+ sample<T>(array: T[], sampleSizeMin: number, sampleSizeMax?: number): T[];
59
+ /**
60
+ * Shuffle an array. Not in-place.
61
+ * @param array The array to shuffle
62
+ */
63
+ shuffle<T>(array: T[]): T[];
64
+ /**
65
+ * The default pseudorandom generator.
66
+ */
67
+ private getMulberry32;
68
+ }
@@ -0,0 +1,69 @@
1
+ import { Lensflare } from 'three/examples/jsm/objects/Lensflare';
2
+ import type { LensflareElementProps, SeedProps } from '.';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ color: {
5
+ type: import("vue").PropType<import("three").ColorRepresentation | [r: number, g: number, b: number]>;
6
+ };
7
+ texture: {
8
+ type: import("vue").PropType<string | import("three").Texture>;
9
+ };
10
+ scale: {
11
+ type: import("vue").PropType<number>;
12
+ default: number;
13
+ };
14
+ elements: {
15
+ type: import("vue").PropType<Partial<LensflareElementProps>[]>;
16
+ default: undefined;
17
+ };
18
+ size: {
19
+ type: import("vue").PropType<number>;
20
+ };
21
+ distance: {
22
+ type: import("vue").PropType<number>;
23
+ };
24
+ seed: {
25
+ type: import("vue").PropType<number>;
26
+ default: undefined;
27
+ };
28
+ seedProps: {
29
+ type: import("vue").PropType<SeedProps[]>;
30
+ default: undefined;
31
+ };
32
+ }, {
33
+ value: import("vue").ShallowRef<Lensflare | undefined>;
34
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
35
+ color: {
36
+ type: import("vue").PropType<import("three").ColorRepresentation | [r: number, g: number, b: number]>;
37
+ };
38
+ texture: {
39
+ type: import("vue").PropType<string | import("three").Texture>;
40
+ };
41
+ scale: {
42
+ type: import("vue").PropType<number>;
43
+ default: number;
44
+ };
45
+ elements: {
46
+ type: import("vue").PropType<Partial<LensflareElementProps>[]>;
47
+ default: undefined;
48
+ };
49
+ size: {
50
+ type: import("vue").PropType<number>;
51
+ };
52
+ distance: {
53
+ type: import("vue").PropType<number>;
54
+ };
55
+ seed: {
56
+ type: import("vue").PropType<number>;
57
+ default: undefined;
58
+ };
59
+ seedProps: {
60
+ type: import("vue").PropType<SeedProps[]>;
61
+ default: undefined;
62
+ };
63
+ }>>, {
64
+ scale: number;
65
+ elements: Partial<LensflareElementProps>[];
66
+ seed: number;
67
+ seedProps: SeedProps[];
68
+ }, {}>;
69
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import type { LensflareElementProps, SeedProps } from '.';
2
+ export declare const TEXTURE_PATH = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/";
3
+ export declare const circle = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/circle.png";
4
+ export declare const circleBlur = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/circleBlur.png";
5
+ export declare const circleRainbow = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/circleRainbow.png";
6
+ export declare const line = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/line.png";
7
+ export declare const poly6 = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/poly6.png";
8
+ export declare const polyStroke6 = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/polyStroke6.png";
9
+ export declare const rays = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/rays.png";
10
+ export declare const ring = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/ring.png";
11
+ export declare const starThin6 = "https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/starThin6.png";
12
+ export declare const oversize: SeedProps;
13
+ export declare const bodyRequired0: SeedProps;
14
+ export declare const bodyRequired1: SeedProps;
15
+ export declare const bodyOptional: SeedProps;
16
+ export declare const darkPurple: number, darkBlue: number;
17
+ export declare const front: SeedProps;
18
+ export declare const back: SeedProps;
19
+ export declare const defaultSeedProps: SeedProps[];
20
+ export declare const defaultLensflareElementProps: LensflareElementProps;
@@ -0,0 +1,36 @@
1
+ import type { Texture } from 'three';
2
+ import type { TresColor } from '@tresjs/core';
3
+ import Lensflare from './component.vue';
4
+ export { Lensflare };
5
+ export interface SeedProps {
6
+ texture: string[];
7
+ color: TresColor[];
8
+ distance: [number, number];
9
+ size: [number, number];
10
+ length: [number, number];
11
+ seed?: number;
12
+ }
13
+ /**
14
+ * To make creating a complex lensflare simpler, the component can generate some or all `LensflareElement` properties.
15
+ * The precendence in creating the final elements' props is as follows:
16
+ *
17
+ * 1. `elements`
18
+ * 2. `userDefaultElement` - `color`, `distance`, `size`, `texture` from component
19
+ * 3. seeded random props - if `seed` and/or `seedProps` is not `undefined`
20
+ * 4. system default
21
+ *
22
+ * @param elements - `undefined` or an array of (potentially) incomplete element props
23
+ * @param userDefaultElement - values to "fill in" missing partial elements fields – or overwrite seeded props
24
+ * @param seed - `undefined` or a number to seed random prop generation
25
+ * @param seedProps - `undefined` or an array of SeedProps for generating random seeded properties
26
+ * @param systemDefaultElement - default values to "fill in" any remaining missing props
27
+ * @returns LensflareElementProps[] - An array of complete props
28
+ **/
29
+ export declare const partialLensflarePropsArrayToLensflarePropsArray: (elements: Partial<LensflareElementProps>[] | undefined, userDefaultElement: Partial<LensflareElementProps>, seed?: number | undefined, seedProps?: SeedProps[] | undefined, systemDefaultElement?: LensflareElementProps) => LensflareElementProps[];
30
+ export interface LensflareElementProps {
31
+ texture: Texture | string;
32
+ size: number;
33
+ distance: number;
34
+ color: TresColor;
35
+ }
36
+ export declare function filterLensflareElementProps(props: Partial<LensflareElementProps>): Partial<LensflareElementProps>;
@@ -2,5 +2,6 @@ import Text3D from './Text3D.vue';
2
2
  import { useAnimations } from './useAnimations';
3
3
  import Levioso from './Levioso.vue';
4
4
  import MouseParallax from './MouseParallax.vue';
5
+ import Lensflare from './Lensflare/component.vue';
5
6
  export * from '../staging/useEnvironment';
6
- export { Text3D, useAnimations, MouseParallax, Levioso, };
7
+ export { Text3D, useAnimations, MouseParallax, Levioso, Lensflare, };