Skip to content

Commit aa97c09

Browse files
author
takuma-hmng8
committed
publish v1.0.49
1 parent 077e797 commit aa97c09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3999
-3
lines changed

packages/use-shader-fx/build/use-shader-fx.js

Lines changed: 2177 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/use-shader-fx/build/use-shader-fx.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/use-shader-fx/build/use-shader-fx.umd.cjs

Lines changed: 706 additions & 0 deletions
Large diffs are not rendered by default.

packages/use-shader-fx/build/use-shader-fx.umd.cjs.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/use-shader-fx/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/use-shader-fx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hmng8/use-shader-fx",
3-
"version": "1.0.48",
3+
"version": "1.0.49",
44
"description": "The only difficult part is coding the shaders",
55
"main": "./build/use-shader-fx.umd.cjs",
66
"module": "./build/use-shader-fx.js",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as THREE from "three";
2+
import { RootState, Size } from "@react-three/fiber";
3+
export type HooksProps = {
4+
size: Size;
5+
dpr: number;
6+
/** Defines the count of MSAA samples. Can only be used with WebGL 2. Default is 0. */
7+
samples?: number;
8+
};
9+
/**
10+
* @returns {HooksReturn<T, O>}
11+
* updateFx - A function to be called inside `useFrame` that returns a `THREE.Texture`.
12+
* setParams - A function to update the parameters, useful for performance tuning, etc.
13+
* fxObject - An object containing various FX components such as scene, camera, material, and render target.
14+
*
15+
* @template T The type for the parameters of the hooks.
16+
* @template O The type for the FX object.
17+
*/
18+
export type HooksReturn<T, O> = [
19+
/**
20+
* An update function that returns THREE.Texture. Call it inside useFrame
21+
* @param props RootState
22+
* @param params params of hooks
23+
*/
24+
(props: RootState, updateParams?: T) => THREE.Texture,
25+
/**
26+
* Function to update params. It can be used for performance control, etc.
27+
* @param params params of hooks
28+
*/
29+
(params: T) => void,
30+
/**
31+
* Contains each part of FX such as scene, camera, material, render target, etc.
32+
*/
33+
O
34+
];
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as THREE from "three";
2+
import { HooksProps, HooksReturn } from "../types";
3+
export type BlendingParams = {
4+
/** Make this texture Blending , default:THREE.Texture */
5+
texture?: THREE.Texture;
6+
/** map texture, default:THREE.Texture */
7+
map?: THREE.Texture;
8+
/** map strength , r,g value are affecting , default:0.3 */
9+
mapIntensity?: number;
10+
/** Alpha blending is performed using the alpha of the set texture. , default:false */
11+
alphaMap?: THREE.Texture | false;
12+
/** default:(0.5,0.5,0.5) */
13+
brightness?: THREE.Vector3;
14+
/** default:0.0 */
15+
min?: number;
16+
/** default:1.0 */
17+
max?: number;
18+
/** If set, this value will apply color dodge , default: false */
19+
dodgeColor?: THREE.Color | false;
20+
};
21+
export type BlendingObject = {
22+
scene: THREE.Scene;
23+
material: THREE.Material;
24+
camera: THREE.Camera;
25+
renderTarget: THREE.WebGLRenderTarget;
26+
output: THREE.Texture;
27+
};
28+
export declare const BLENDING_PARAMS: BlendingParams;
29+
/**
30+
* Blend map to texture. You can set the threshold for blending with brightness. You can set the dodge color by setting color.
31+
If you don't want to reflect the map's color, you can use useFxBlending instead.
32+
* @link https://github.com/takuma-hmng8/use-shader-fx#usage
33+
*/
34+
export declare const useBlending: ({ size, dpr, samples, }: HooksProps) => HooksReturn<BlendingParams, BlendingObject>;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import * as THREE from "three";
2+
export declare class BlendingMaterial extends THREE.ShaderMaterial {
3+
uniforms: {
4+
u_texture: {
5+
value: THREE.Texture;
6+
};
7+
u_map: {
8+
value: THREE.Texture;
9+
};
10+
u_alphaMap: {
11+
value: THREE.Texture;
12+
};
13+
u_isAlphaMap: {
14+
value: boolean;
15+
};
16+
u_mapIntensity: {
17+
value: number;
18+
};
19+
u_brightness: {
20+
value: THREE.Vector3;
21+
};
22+
u_min: {
23+
value: number;
24+
};
25+
u_max: {
26+
value: number;
27+
};
28+
u_dodgeColor: {
29+
value: THREE.Color;
30+
};
31+
u_isDodgeColor: {
32+
value: boolean;
33+
};
34+
};
35+
}
36+
export declare const useMesh: (scene: THREE.Scene) => BlendingMaterial;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import * as THREE from "three";
2+
import { HooksProps, HooksReturn } from "../types";
3+
export type BrightnessPickerParams = {
4+
/** pick brightness from this texture , default:THREE.Texture */
5+
texture?: THREE.Texture;
6+
/** default:(0.5,0.5,0.5) */
7+
brightness?: THREE.Vector3;
8+
/** default:0.0 */
9+
min?: number;
10+
/** default:1.0 */
11+
max?: number;
12+
};
13+
export type BrightnessPickerObject = {
14+
scene: THREE.Scene;
15+
material: THREE.Material;
16+
camera: THREE.Camera;
17+
renderTarget: THREE.WebGLRenderTarget;
18+
output: THREE.Texture;
19+
};
20+
export declare const BRIGHTNESSPICKER_PARAMS: BrightnessPickerParams;
21+
/**
22+
* @link https://github.com/takuma-hmng8/use-shader-fx#usage
23+
*/
24+
export declare const useBrightnessPicker: ({ size, dpr, samples, }: HooksProps) => HooksReturn<BrightnessPickerParams, BrightnessPickerObject>;

0 commit comments

Comments
 (0)