@pixiv/three-vrm-materials-mtoon 2.1.0-beta.3 → 2.1.0
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/LICENSE +22 -0
- package/lib/three-vrm-materials-mtoon.js +1 -1
- package/lib/three-vrm-materials-mtoon.module.js +1 -1
- package/package.json +5 -4
- package/ts3.4/types/GLTFMToonMaterialParamsAssignHelper.d.ts +20 -0
- package/ts3.4/types/MToonMaterial.d.ts +167 -0
- package/ts3.4/types/MToonMaterialDebugMode.d.ts +24 -0
- package/ts3.4/types/MToonMaterialLoaderPlugin.d.ts +68 -0
- package/ts3.4/types/MToonMaterialLoaderPluginOptions.d.ts +23 -0
- package/ts3.4/types/MToonMaterialOutlineWidthMode.d.ts +6 -0
- package/ts3.4/types/MToonMaterialParameters.d.ts +67 -0
- package/ts3.4/types/index.d.ts +6 -0
- package/ts3.4/types/utils/getTextureColorSpace.d.ts +11 -0
- package/ts3.4/types/utils/setTextureColorSpace.d.ts +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2019-2024 pixiv Inc.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixiv/three-vrm-materials-mtoon",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "MToon (toon material) module for @pixiv/three-vrm",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "pixiv",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@pixiv/types-vrm-0.0": "2.1.0
|
|
53
|
-
"@pixiv/types-vrmc-materials-mtoon-1.0": "2.1.0
|
|
52
|
+
"@pixiv/types-vrm-0.0": "2.1.0",
|
|
53
|
+
"@pixiv/types-vrmc-materials-mtoon-1.0": "2.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/three": "^0.160.0",
|
|
@@ -59,5 +59,6 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@types/three": "^0.160.0",
|
|
61
61
|
"three": "^0.160.0"
|
|
62
|
-
}
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "0d96aeaa6e20baa8158658652179df20a162d8a3"
|
|
63
64
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
|
+
import { MToonMaterialParameters } from './MToonMaterialParameters';
|
|
3
|
+
/**
|
|
4
|
+
* MaterialParameters hates `undefined`. This helper automatically rejects assign of these `undefined`.
|
|
5
|
+
* It also handles asynchronous process of textures.
|
|
6
|
+
* Make sure await for {@link GLTFMToonMaterialParamsAssignHelper.pending}.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GLTFMToonMaterialParamsAssignHelper {
|
|
9
|
+
private readonly _parser;
|
|
10
|
+
private _materialParams;
|
|
11
|
+
private _pendings;
|
|
12
|
+
readonly pending: Promise<unknown>;
|
|
13
|
+
constructor(parser: GLTFParser, materialParams: MToonMaterialParameters);
|
|
14
|
+
assignPrimitive<T extends keyof MToonMaterialParameters>(key: T, value: MToonMaterialParameters[T]): void;
|
|
15
|
+
assignColor<T extends keyof MToonMaterialParameters>(key: T, value: number[] | undefined, convertSRGBToLinear?: boolean): void;
|
|
16
|
+
assignTexture<T extends keyof MToonMaterialParameters>(key: T, texture: {
|
|
17
|
+
index: number;
|
|
18
|
+
} | undefined, isColorTexture: boolean): Promise<void>;
|
|
19
|
+
assignTextureByIndex<T extends keyof MToonMaterialParameters>(key: T, textureIndex: number | undefined, isColorTexture: boolean): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { MToonMaterialDebugMode } from './MToonMaterialDebugMode';
|
|
3
|
+
import { MToonMaterialOutlineWidthMode } from './MToonMaterialOutlineWidthMode';
|
|
4
|
+
import { MToonMaterialParameters } from './MToonMaterialParameters';
|
|
5
|
+
/**
|
|
6
|
+
* MToon is a material specification that has various features.
|
|
7
|
+
* The spec and implementation are originally founded for Unity engine and this is a port of the material.
|
|
8
|
+
*
|
|
9
|
+
* See: https://github.com/Santarh/MToon
|
|
10
|
+
*/
|
|
11
|
+
export declare class MToonMaterial extends THREE.ShaderMaterial {
|
|
12
|
+
uniforms: {
|
|
13
|
+
litFactor: THREE.IUniform<THREE.Color>;
|
|
14
|
+
alphaTest: THREE.IUniform<number>;
|
|
15
|
+
opacity: THREE.IUniform<number>;
|
|
16
|
+
map: THREE.IUniform<THREE.Texture | null>;
|
|
17
|
+
mapUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
18
|
+
normalMap: THREE.IUniform<THREE.Texture | null>;
|
|
19
|
+
normalMapUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
20
|
+
normalScale: THREE.IUniform<THREE.Vector2>;
|
|
21
|
+
emissive: THREE.IUniform<THREE.Color>;
|
|
22
|
+
emissiveIntensity: THREE.IUniform<number>;
|
|
23
|
+
emissiveMap: THREE.IUniform<THREE.Texture | null>;
|
|
24
|
+
emissiveMapUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
25
|
+
shadeColorFactor: THREE.IUniform<THREE.Color>;
|
|
26
|
+
shadeMultiplyTexture: THREE.IUniform<THREE.Texture | null>;
|
|
27
|
+
shadeMultiplyTextureUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
28
|
+
shadingShiftFactor: THREE.IUniform<number>;
|
|
29
|
+
shadingShiftTexture: THREE.IUniform<THREE.Texture | null>;
|
|
30
|
+
shadingShiftTextureUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
31
|
+
shadingShiftTextureScale: THREE.IUniform<number>;
|
|
32
|
+
shadingToonyFactor: THREE.IUniform<number>;
|
|
33
|
+
giEqualizationFactor: THREE.IUniform<number>;
|
|
34
|
+
matcapFactor: THREE.IUniform<THREE.Color>;
|
|
35
|
+
matcapTexture: THREE.IUniform<THREE.Texture | null>;
|
|
36
|
+
matcapTextureUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
37
|
+
parametricRimColorFactor: THREE.IUniform<THREE.Color>;
|
|
38
|
+
rimMultiplyTexture: THREE.IUniform<THREE.Texture | null>;
|
|
39
|
+
rimMultiplyTextureUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
40
|
+
rimLightingMixFactor: THREE.IUniform<number>;
|
|
41
|
+
parametricRimFresnelPowerFactor: THREE.IUniform<number>;
|
|
42
|
+
parametricRimLiftFactor: THREE.IUniform<number>;
|
|
43
|
+
outlineWidthMultiplyTexture: THREE.IUniform<THREE.Texture | null>;
|
|
44
|
+
outlineWidthMultiplyTextureUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
45
|
+
outlineWidthFactor: THREE.IUniform<number>;
|
|
46
|
+
outlineColorFactor: THREE.IUniform<THREE.Color>;
|
|
47
|
+
outlineLightingMixFactor: THREE.IUniform<number>;
|
|
48
|
+
uvAnimationMaskTexture: THREE.IUniform<THREE.Texture | null>;
|
|
49
|
+
uvAnimationMaskTextureUvTransform: THREE.IUniform<THREE.Matrix3>;
|
|
50
|
+
uvAnimationScrollXOffset: THREE.IUniform<number>;
|
|
51
|
+
uvAnimationScrollYOffset: THREE.IUniform<number>;
|
|
52
|
+
uvAnimationRotationPhase: THREE.IUniform<number>;
|
|
53
|
+
};
|
|
54
|
+
color: THREE.Color;
|
|
55
|
+
map: THREE.Texture | null;
|
|
56
|
+
normalMap: THREE.Texture | null;
|
|
57
|
+
normalScale: THREE.Vector2;
|
|
58
|
+
emissive: THREE.Color;
|
|
59
|
+
emissiveIntensity: number;
|
|
60
|
+
emissiveMap: THREE.Texture | null;
|
|
61
|
+
shadeColorFactor: THREE.Color;
|
|
62
|
+
shadeMultiplyTexture: THREE.Texture | null;
|
|
63
|
+
shadingShiftFactor: number;
|
|
64
|
+
shadingShiftTexture: THREE.Texture | null;
|
|
65
|
+
shadingShiftTextureScale: number;
|
|
66
|
+
shadingToonyFactor: number;
|
|
67
|
+
giEqualizationFactor: number;
|
|
68
|
+
matcapFactor: THREE.Color;
|
|
69
|
+
matcapTexture: THREE.Texture | null;
|
|
70
|
+
parametricRimColorFactor: THREE.Color;
|
|
71
|
+
rimMultiplyTexture: THREE.Texture | null;
|
|
72
|
+
rimLightingMixFactor: number;
|
|
73
|
+
parametricRimFresnelPowerFactor: number;
|
|
74
|
+
parametricRimLiftFactor: number;
|
|
75
|
+
outlineWidthMultiplyTexture: THREE.Texture | null;
|
|
76
|
+
outlineWidthFactor: number;
|
|
77
|
+
outlineColorFactor: THREE.Color;
|
|
78
|
+
outlineLightingMixFactor: number;
|
|
79
|
+
uvAnimationMaskTexture: THREE.Texture | null;
|
|
80
|
+
uvAnimationScrollXOffset: number;
|
|
81
|
+
uvAnimationScrollYOffset: number;
|
|
82
|
+
uvAnimationRotationPhase: number;
|
|
83
|
+
uvAnimationScrollXSpeedFactor: number;
|
|
84
|
+
uvAnimationScrollYSpeedFactor: number;
|
|
85
|
+
uvAnimationRotationSpeedFactor: number;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the material is affected by fog.
|
|
88
|
+
* `true` by default.
|
|
89
|
+
*/
|
|
90
|
+
fog: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Will be read in WebGLPrograms
|
|
93
|
+
*
|
|
94
|
+
* See: https://github.com/mrdoob/three.js/blob/4f5236ac3d6f41d904aa58401b40554e8fbdcb15/src/renderers/webgl/WebGLPrograms.js#L190-L191
|
|
95
|
+
*/
|
|
96
|
+
normalMapType: 0;
|
|
97
|
+
/**
|
|
98
|
+
* When this is `true`, vertex colors will be ignored.
|
|
99
|
+
* `true` by default.
|
|
100
|
+
*/
|
|
101
|
+
private _ignoreVertexColor;
|
|
102
|
+
/*
|
|
103
|
+
* When this is `true`, vertex colors will be ignored.
|
|
104
|
+
* `true` by default.
|
|
105
|
+
*/
|
|
106
|
+
ignoreVertexColor: boolean;
|
|
107
|
+
private _v0CompatShade;
|
|
108
|
+
/*
|
|
109
|
+
* There is a line of the shader called "comment out if you want to PBR absolutely" in VRM0.0 MToon.
|
|
110
|
+
* When this is true, the material enables the line to make it compatible with the legacy rendering of VRM.
|
|
111
|
+
* Usually not recommended to turn this on.
|
|
112
|
+
* `false` by default.
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
* There is a line of the shader called "comment out if you want to PBR absolutely" in VRM0.0 MToon.
|
|
116
|
+
* When this is true, the material enables the line to make it compatible with the legacy rendering of VRM.
|
|
117
|
+
* Usually not recommended to turn this on.
|
|
118
|
+
* `false` by default.
|
|
119
|
+
*/
|
|
120
|
+
v0CompatShade: boolean;
|
|
121
|
+
private _debugMode;
|
|
122
|
+
/*
|
|
123
|
+
* Debug mode for the material.
|
|
124
|
+
* You can visualize several components for diagnosis using debug mode.
|
|
125
|
+
*
|
|
126
|
+
* See: {@link MToonMaterialDebugMode}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
* Debug mode for the material.
|
|
130
|
+
* You can visualize several components for diagnosis using debug mode.
|
|
131
|
+
*
|
|
132
|
+
* See: {@link MToonMaterialDebugMode}
|
|
133
|
+
*/
|
|
134
|
+
debugMode: MToonMaterialDebugMode;
|
|
135
|
+
private _outlineWidthMode;
|
|
136
|
+
outlineWidthMode: MToonMaterialOutlineWidthMode;
|
|
137
|
+
private _isOutline;
|
|
138
|
+
isOutline: boolean;
|
|
139
|
+
/*
|
|
140
|
+
* Readonly boolean that indicates this is a [[MToonMaterial]].
|
|
141
|
+
*/
|
|
142
|
+
readonly isMToonMaterial: true;
|
|
143
|
+
constructor(parameters?: MToonMaterialParameters);
|
|
144
|
+
/**
|
|
145
|
+
* Update this material.
|
|
146
|
+
*
|
|
147
|
+
* @param delta deltaTime since last update
|
|
148
|
+
*/
|
|
149
|
+
update(delta: number): void;
|
|
150
|
+
copy(source: this): this;
|
|
151
|
+
/**
|
|
152
|
+
* Update UV animation state.
|
|
153
|
+
* Intended to be called via {@link update}.
|
|
154
|
+
* @param delta deltaTime
|
|
155
|
+
*/
|
|
156
|
+
private _updateUVAnimation;
|
|
157
|
+
/**
|
|
158
|
+
* Upload uniforms that need to upload but doesn't automatically because of reasons.
|
|
159
|
+
* Intended to be called via {@link constructor} and {@link update}.
|
|
160
|
+
*/
|
|
161
|
+
private _uploadUniformsWorkaround;
|
|
162
|
+
/**
|
|
163
|
+
* Returns a map object of preprocessor token and macro of the shader program.
|
|
164
|
+
*/
|
|
165
|
+
private _generateDefines;
|
|
166
|
+
private _updateTextureMatrix;
|
|
167
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifiers of debug mode of {@link MToonMaterial}.
|
|
3
|
+
*
|
|
4
|
+
* See: {@link MToonMaterial.debugMode}
|
|
5
|
+
*/
|
|
6
|
+
export declare const MToonMaterialDebugMode: {
|
|
7
|
+
/**
|
|
8
|
+
* Render normally.
|
|
9
|
+
*/
|
|
10
|
+
readonly None: "none";
|
|
11
|
+
/**
|
|
12
|
+
* Visualize normals of the surface.
|
|
13
|
+
*/
|
|
14
|
+
readonly Normal: "normal";
|
|
15
|
+
/**
|
|
16
|
+
* Visualize lit/shade of the surface.
|
|
17
|
+
*/
|
|
18
|
+
readonly LitShadeRate: "litShadeRate";
|
|
19
|
+
/**
|
|
20
|
+
* Visualize UV of the surface.
|
|
21
|
+
*/
|
|
22
|
+
readonly UV: "uv";
|
|
23
|
+
};
|
|
24
|
+
export type MToonMaterialDebugMode = typeof MToonMaterialDebugMode[keyof typeof MToonMaterialDebugMode];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
|
+
import { MToonMaterialParameters } from './MToonMaterialParameters';
|
|
4
|
+
import { MToonMaterialLoaderPluginOptions } from './MToonMaterialLoaderPluginOptions';
|
|
5
|
+
import { MToonMaterialDebugMode } from './MToonMaterialDebugMode';
|
|
6
|
+
export declare class MToonMaterialLoaderPlugin implements GLTFLoaderPlugin {
|
|
7
|
+
static EXTENSION_NAME: string;
|
|
8
|
+
/**
|
|
9
|
+
* This value will be added to `renderOrder` of every meshes who have MaterialsMToon.
|
|
10
|
+
* The final renderOrder will be sum of this `renderOrderOffset` and `renderQueueOffsetNumber` for each materials.
|
|
11
|
+
* `0` by default.
|
|
12
|
+
*/
|
|
13
|
+
renderOrderOffset: number;
|
|
14
|
+
/**
|
|
15
|
+
* There is a line of the shader called "comment out if you want to PBR absolutely" in VRM0.0 MToon.
|
|
16
|
+
* When this is true, the material enables the line to make it compatible with the legacy rendering of VRM.
|
|
17
|
+
* Usually not recommended to turn this on.
|
|
18
|
+
* `false` by default.
|
|
19
|
+
*/
|
|
20
|
+
v0CompatShade: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Debug mode for the material.
|
|
23
|
+
* You can visualize several components for diagnosis using debug mode.
|
|
24
|
+
*
|
|
25
|
+
* See: {@link MToonMaterialDebugMode}
|
|
26
|
+
*/
|
|
27
|
+
debugMode: MToonMaterialDebugMode;
|
|
28
|
+
readonly parser: GLTFParser;
|
|
29
|
+
/**
|
|
30
|
+
* Loaded materials will be stored in this set.
|
|
31
|
+
* Will be transferred into `gltf.userData.vrmMToonMaterials` in {@link afterRoot}.
|
|
32
|
+
*/
|
|
33
|
+
private readonly _mToonMaterialSet;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
constructor(parser: GLTFParser, options?: MToonMaterialLoaderPluginOptions);
|
|
36
|
+
beforeRoot(): Promise<void>;
|
|
37
|
+
afterRoot(gltf: GLTF): Promise<void>;
|
|
38
|
+
getMaterialType(materialIndex: number): typeof THREE.Material | null;
|
|
39
|
+
extendMaterialParams(materialIndex: number, materialParams: MToonMaterialParameters): Promise<any> | null;
|
|
40
|
+
loadMesh(meshIndex: number): Promise<THREE.Group | THREE.Mesh | THREE.SkinnedMesh>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete use of `KHR_materials_unlit` from its `materials` if the material is using MToon.
|
|
43
|
+
*
|
|
44
|
+
* Since GLTFLoader have so many hardcoded procedure related to `KHR_materials_unlit`
|
|
45
|
+
* we have to delete the extension before we start to parse the glTF.
|
|
46
|
+
*/
|
|
47
|
+
private _removeUnlitExtensionIfMToonExists;
|
|
48
|
+
private _getMToonExtension;
|
|
49
|
+
private _extendMaterialParams;
|
|
50
|
+
/**
|
|
51
|
+
* This will do two processes that is required to render MToon properly.
|
|
52
|
+
*
|
|
53
|
+
* - Set render order
|
|
54
|
+
* - Generate outline
|
|
55
|
+
*
|
|
56
|
+
* @param mesh A target GLTF primitive
|
|
57
|
+
* @param materialIndex The material index of the primitive
|
|
58
|
+
*/
|
|
59
|
+
private _setupPrimitive;
|
|
60
|
+
/**
|
|
61
|
+
* Generate outline for the given mesh, if it needs.
|
|
62
|
+
*
|
|
63
|
+
* @param mesh The target mesh
|
|
64
|
+
*/
|
|
65
|
+
private _generateOutline;
|
|
66
|
+
private _addToMaterialSet;
|
|
67
|
+
private _parseRenderOrder;
|
|
68
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MToonMaterialDebugMode } from './MToonMaterialDebugMode';
|
|
2
|
+
export interface MToonMaterialLoaderPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* This value will be added to every meshes who have MaterialsMToon.
|
|
5
|
+
* The final renderOrder will be sum of this `renderOrderOffset` and `renderQueueOffsetNumber` for each materials.
|
|
6
|
+
* `0` by default.
|
|
7
|
+
*/
|
|
8
|
+
renderOrderOffset?: number;
|
|
9
|
+
/**
|
|
10
|
+
* There is a line of the shader called "comment out if you want to PBR absolutely" in VRM0.0 MToon.
|
|
11
|
+
* When this is true, the material enables the line to make it compatible with the legacy rendering of VRM.
|
|
12
|
+
* Usually not recommended to turn this on.
|
|
13
|
+
* `false` by default.
|
|
14
|
+
*/
|
|
15
|
+
v0CompatShade?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Debug mode for the material.
|
|
18
|
+
* You can visualize several components for diagnosis using debug mode.
|
|
19
|
+
*
|
|
20
|
+
* See: {@link MToonMaterialDebugMode}
|
|
21
|
+
*/
|
|
22
|
+
debugMode?: MToonMaterialDebugMode;
|
|
23
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const MToonMaterialOutlineWidthMode: {
|
|
2
|
+
readonly None: "none";
|
|
3
|
+
readonly WorldCoordinates: "worldCoordinates";
|
|
4
|
+
readonly ScreenCoordinates: "screenCoordinates";
|
|
5
|
+
};
|
|
6
|
+
export type MToonMaterialOutlineWidthMode = typeof MToonMaterialOutlineWidthMode[keyof typeof MToonMaterialOutlineWidthMode];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MToonMaterialDebugMode } from './MToonMaterialDebugMode';
|
|
2
|
+
import { MToonMaterialOutlineWidthMode } from './MToonMaterialOutlineWidthMode';
|
|
3
|
+
export interface MToonMaterialParameters extends THREE.ShaderMaterialParameters {
|
|
4
|
+
/**
|
|
5
|
+
* Enable depth buffer when renderMode is transparent.
|
|
6
|
+
* Will be processed in the constructor.
|
|
7
|
+
*/
|
|
8
|
+
transparentWithZWrite?: boolean;
|
|
9
|
+
color?: THREE.Color;
|
|
10
|
+
map?: THREE.Texture;
|
|
11
|
+
normalMap?: THREE.Texture;
|
|
12
|
+
normalScale?: THREE.Vector2;
|
|
13
|
+
emissive?: THREE.Color;
|
|
14
|
+
emissiveIntensity?: number;
|
|
15
|
+
emissiveMap?: THREE.Texture;
|
|
16
|
+
shadeColorFactor?: THREE.Color;
|
|
17
|
+
shadeMultiplyTexture?: THREE.Texture;
|
|
18
|
+
shadingShiftFactor?: number;
|
|
19
|
+
shadingShiftTexture?: THREE.Texture;
|
|
20
|
+
shadingShiftTextureScale?: number;
|
|
21
|
+
shadingToonyFactor?: number;
|
|
22
|
+
giEqualizationFactor?: number;
|
|
23
|
+
matcapFactor?: THREE.Color;
|
|
24
|
+
matcapTexture?: THREE.Texture;
|
|
25
|
+
parametricRimColorFactor?: THREE.Color;
|
|
26
|
+
rimMultiplyTexture?: THREE.Texture;
|
|
27
|
+
rimLightingMixFactor?: number;
|
|
28
|
+
parametricRimFresnelPowerFactor?: number;
|
|
29
|
+
parametricRimLiftFactor?: number;
|
|
30
|
+
outlineWidthMode?: MToonMaterialOutlineWidthMode;
|
|
31
|
+
outlineWidthFactor?: number;
|
|
32
|
+
outlineWidthMultiplyTexture?: THREE.Texture;
|
|
33
|
+
outlineColorFactor?: THREE.Color;
|
|
34
|
+
outlineLightingMixFactor?: number;
|
|
35
|
+
uvAnimationMaskTexture?: THREE.Texture;
|
|
36
|
+
uvAnimationScrollXSpeedFactor?: number;
|
|
37
|
+
uvAnimationScrollYSpeedFactor?: number;
|
|
38
|
+
uvAnimationRotationSpeedFactor?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the material is affected by fog.
|
|
41
|
+
* `true` by default.
|
|
42
|
+
*/
|
|
43
|
+
fog?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* When this is `true`, vertex colors will be ignored.
|
|
46
|
+
* `true` by default.
|
|
47
|
+
*/
|
|
48
|
+
ignoreVertexColor?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Debug mode for the material.
|
|
51
|
+
* You can visualize several components for diagnosis using debug mode.
|
|
52
|
+
*
|
|
53
|
+
* See: {@link MToonMaterialDebugMode}
|
|
54
|
+
*/
|
|
55
|
+
debugMode?: MToonMaterialDebugMode;
|
|
56
|
+
/**
|
|
57
|
+
* There is a line of the shader called "comment out if you want to PBR absolutely" in VRM0.0 MToon.
|
|
58
|
+
* When this is true, the material enables the line to make it compatible with the legacy rendering of VRM.
|
|
59
|
+
* Usually not recommended to turn this on.
|
|
60
|
+
* `false` by default.
|
|
61
|
+
*/
|
|
62
|
+
v0CompatShade?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* It will draw its outline instead when it's `true`.
|
|
65
|
+
*/
|
|
66
|
+
isOutline?: boolean;
|
|
67
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MToonMaterialLoaderPlugin } from './MToonMaterialLoaderPlugin';
|
|
2
|
+
export { MToonMaterialLoaderPluginOptions } from './MToonMaterialLoaderPluginOptions';
|
|
3
|
+
export { MToonMaterial } from './MToonMaterial';
|
|
4
|
+
export { MToonMaterialDebugMode } from './MToonMaterialDebugMode';
|
|
5
|
+
export { MToonMaterialOutlineWidthMode } from './MToonMaterialOutlineWidthMode';
|
|
6
|
+
export { MToonMaterialParameters } from './MToonMaterialParameters';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* A compat function to get texture color space.
|
|
4
|
+
*
|
|
5
|
+
* COMPAT: pre-r152
|
|
6
|
+
* Starting from Three.js r152, `texture.encoding` is renamed to `texture.colorSpace`.
|
|
7
|
+
* This function will handle the comapt.
|
|
8
|
+
*
|
|
9
|
+
* @param texture The texture you want to get the color space from
|
|
10
|
+
*/
|
|
11
|
+
export declare function getTextureColorSpace(texture: THREE.Texture): '' | 'srgb';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* A compat function to set texture color space.
|
|
4
|
+
*
|
|
5
|
+
* COMPAT: pre-r152
|
|
6
|
+
* Starting from Three.js r152, `texture.encoding` is renamed to `texture.colorSpace`.
|
|
7
|
+
* This function will handle the comapt.
|
|
8
|
+
*
|
|
9
|
+
* @param texture The texture you want to set the color space to
|
|
10
|
+
* @param colorSpace The color space you want to set to the texture
|
|
11
|
+
*/
|
|
12
|
+
export declare function setTextureColorSpace(texture: THREE.Texture, colorSpace: '' | 'srgb'): void;
|