Skip to content

Commit 541498a

Browse files
committed
feat: Add type definition of the draft VRMC_springBone_limit extension
See: vrm-c/vrm-specification#496
1 parent 935fb63 commit 541498a

11 files changed

+160
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!types
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @pixiv/types-vrmc-springbone-limit-1.0
2+
3+
Type definitions of VRMC_springBone_limit 1.0 schema.
4+
5+
https://github.com/vrm-c/vrm-specification/tree/master/specification/VRMC_springBone_limit-1.0
6+
7+
There should not be any implementation in this package. Just type definitions of the schema.
8+
9+
The extension root is named `VRMCSpringBoneLimit` .
10+
11+
[GitHub Repository](https://github.com/pixiv/three-vrm/tree/dev/packages/types-vrmc-springbone-limit-1.0)
12+
13+
[API Reference](https://pixiv.github.io/three-vrm/docs/modules/types-vrmc-springbone-limit-1.0)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "@pixiv/types-vrmc-springbone-limit-1.0",
3+
"version": "3.4.0",
4+
"description": "Type definitions of VRMC_springBone_limit 1.0 schema",
5+
"license": "MIT",
6+
"author": "pixiv",
7+
"files": [
8+
"/types/",
9+
"LICENSE"
10+
],
11+
"main": "",
12+
"types": "types/index.d.ts",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/pixiv/three-vrm.git",
16+
"directory": "packages/types-vrmc-springbone-limit-1.0"
17+
},
18+
"scripts": {
19+
"version": "yarn clean",
20+
"clean": "rimraf docs/",
21+
"lint": "eslint \"types/**/*.{ts,tsx}\" && prettier \"types/**/*.{ts,tsx}\" --check",
22+
"lint-fix": "eslint \"types/**/*.{ts,tsx}\" --fix && prettier \"types/**/*.{ts,tsx}\" --write"
23+
},
24+
"lint-staged": {
25+
"./types/**/*.{ts,tsx}": [
26+
"eslint --fix",
27+
"prettier --write"
28+
]
29+
}
30+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": [
4+
"./types"
5+
]
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "types-vrmc-springbone-limit-1.0",
3+
"entryPoints": ["types/index.d.ts"]
4+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { SpringBoneLimitLimitCone } from './SpringBoneLimitLimitCone';
2+
import type { SpringBoneLimitLimitHinge } from './SpringBoneLimitLimitHinge';
3+
import type { SpringBoneLimitLimitSpherical } from './SpringBoneLimitLimitSpherical';
4+
5+
/**
6+
* Describes a limit apply to the spring. Either cone, hinge, or spherical must be present.
7+
*/
8+
export interface SpringBoneLimitLimit {
9+
/**
10+
* A limit that restricts the orientation of the spring in a cone shape.
11+
*/
12+
cone?: SpringBoneLimitLimitCone;
13+
14+
/**
15+
* A limit that restricts the orientation of the spring in a hinge shape.
16+
*/
17+
hinge?: SpringBoneLimitLimitHinge;
18+
19+
/**
20+
* A limit that restricts the orientation of the spring in a spherical coordinate shape.
21+
*/
22+
spherical?: SpringBoneLimitLimitSpherical;
23+
24+
extensions?: { [name: string]: any };
25+
extras?: any;
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* A limit that restricts the orientation of the spring in a cone shape.
3+
*/
4+
export interface SpringBoneLimitLimitCone {
5+
/**
6+
* The angle of the cone limit in radians. If the angle is set to π or greater, the angle will be interpreted as π by the implementation. When the angle is set to π, the cone shape becomes a sphere.
7+
*/
8+
angle: number;
9+
10+
/**
11+
* The rotation from the default orientation of the cone limit. The rotation is represented as a quaternion (x, y, z, w), where w is the scalar.
12+
*/
13+
rotation?: [number, number, number, number];
14+
15+
extensions?: { [name: string]: any };
16+
extras?: any;
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* A limit that restricts the orientation of the spring in a hinge shape.
3+
*/
4+
export interface SpringBoneLimitLimitHinge {
5+
/**
6+
* The angle of the hinge limit in radians. If the angle is set to π or greater, the angle will be interpreted as π by the implementation. When the angle is set to 180, the hinge shape becomes a full disc.
7+
*/
8+
angle: number;
9+
10+
/**
11+
* The rotation from the default orientation of the hinge limit. The rotation is represented as a quaternion (x, y, z, w), where w is the scalar.
12+
*/
13+
rotation?: [number, number, number, number];
14+
15+
extensions?: { [name: string]: any };
16+
extras?: any;
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* A limit that restricts the orientation of the spring in a spherical coordinate shape.
3+
*/
4+
export interface SpringBoneLimitLimitSpherical {
5+
/**
6+
* The theta angle of the spherical limit in radians. If the theta angle is set to π or greater, the angle will be interpreted as π by the implementation.
7+
*/
8+
theta: number;
9+
10+
/**
11+
* The phi angle of the spherical limit in radians. If the phi angle is set to π/2 or greater, the angle will be interpreted as π/2 by the implementation.
12+
*/
13+
phi: number;
14+
15+
/**
16+
* The rotation from the default orientation of the spherical limit. The rotation is represented as a quaternion (x, y, z, w), where w is the scalar.
17+
*/
18+
rotation?: [number, number, number, number];
19+
20+
extensions?: { [name: string]: any };
21+
extras?: any;
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { SpringBoneLimitLimit } from './SpringBoneLimitLimit';
2+
3+
/**
4+
* An angle limit for VRMC_springBone.
5+
*/
6+
export interface VRMCSpringBoneLimit {
7+
/**
8+
* Specification version of VRMC_springBone_limit.
9+
*/
10+
specVersion: '1.0-draft';
11+
12+
/**
13+
* Describes a limit apply to the spring.
14+
*/
15+
limit: SpringBoneLimitLimit;
16+
17+
extensions?: { [name: string]: any };
18+
extras?: any;
19+
}

0 commit comments

Comments
 (0)