@objectifthunes/three-book 0.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/dist/AutoTurn.d.ts +162 -0
- package/dist/AutoTurn.d.ts.map +1 -0
- package/dist/Book.d.ts +154 -0
- package/dist/Book.d.ts.map +1 -0
- package/dist/BookBinding.d.ts +26 -0
- package/dist/BookBinding.d.ts.map +1 -0
- package/dist/BookContent.d.ts +44 -0
- package/dist/BookContent.d.ts.map +1 -0
- package/dist/BookDirection.d.ts +10 -0
- package/dist/BookDirection.d.ts.map +1 -0
- package/dist/Cylinder.d.ts +40 -0
- package/dist/Cylinder.d.ts.map +1 -0
- package/dist/PageContent.d.ts +44 -0
- package/dist/PageContent.d.ts.map +1 -0
- package/dist/Paper.d.ts +191 -0
- package/dist/Paper.d.ts.map +1 -0
- package/dist/PaperMaterialData.d.ts +29 -0
- package/dist/PaperMaterialData.d.ts.map +1 -0
- package/dist/PaperMeshData.d.ts +43 -0
- package/dist/PaperMeshData.d.ts.map +1 -0
- package/dist/PaperMeshUtility.d.ts +72 -0
- package/dist/PaperMeshUtility.d.ts.map +1 -0
- package/dist/PaperNode.d.ts +31 -0
- package/dist/PaperNode.d.ts.map +1 -0
- package/dist/PaperPattern.d.ts +30 -0
- package/dist/PaperPattern.d.ts.map +1 -0
- package/dist/PaperSetup.d.ts +52 -0
- package/dist/PaperSetup.d.ts.map +1 -0
- package/dist/PaperStructs.d.ts +43 -0
- package/dist/PaperStructs.d.ts.map +1 -0
- package/dist/PaperUVMargin.d.ts +40 -0
- package/dist/PaperUVMargin.d.ts.map +1 -0
- package/dist/Renderer.d.ts +82 -0
- package/dist/Renderer.d.ts.map +1 -0
- package/dist/StapleBinding.d.ts +132 -0
- package/dist/StapleBinding.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2692 -0
- package/dist/utils/BezierUtility.d.ts +8 -0
- package/dist/utils/BezierUtility.d.ts.map +1 -0
- package/dist/utils/EllipseUtility.d.ts +8 -0
- package/dist/utils/EllipseUtility.d.ts.map +1 -0
- package/dist/utils/LoopUtility.d.ts +14 -0
- package/dist/utils/LoopUtility.d.ts.map +1 -0
- package/dist/utils/MatrixUtility.d.ts +13 -0
- package/dist/utils/MatrixUtility.d.ts.map +1 -0
- package/dist/utils/TextureUtility.d.ts +17 -0
- package/dist/utils/TextureUtility.d.ts.map +1 -0
- package/dist/utils/TriangleUtility.d.ts +11 -0
- package/dist/utils/TriangleUtility.d.ts.map +1 -0
- package/dist/utils/VectorUtility.d.ts +29 -0
- package/dist/utils/VectorUtility.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Evaluates a quadratic Bezier curve at parameter t.
|
|
4
|
+
*
|
|
5
|
+
* B(t) = (1-t)^2 * p0 + 2*(1-t)*t * p1 + t^2 * p2
|
|
6
|
+
*/
|
|
7
|
+
export declare function evaluate(p0: THREE.Vector3, p1: THREE.Vector3, p2: THREE.Vector3, t: number): THREE.Vector3;
|
|
8
|
+
//# sourceMappingURL=BezierUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BezierUtility.d.ts","sourceRoot":"","sources":["../../src/utils/BezierUtility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,CAAC,EAAE,MAAM,GACR,KAAK,CAAC,OAAO,CAQf"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Clamps a point to the surface of an ellipse if it lies outside.
|
|
4
|
+
* (Note: the original C# method was named "Calmp" -- a typo preserved here
|
|
5
|
+
* in the comment but corrected in the exported function name.)
|
|
6
|
+
*/
|
|
7
|
+
export declare function clamp(point: THREE.Vector2, ellipseCenter: THREE.Vector2, ellipseSize: THREE.Vector2): THREE.Vector2;
|
|
8
|
+
//# sourceMappingURL=EllipseUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EllipseUtility.d.ts","sourceRoot":"","sources":["../../src/utils/EllipseUtility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuC/B;;;;GAIG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,KAAK,CAAC,OAAO,EACpB,aAAa,EAAE,KAAK,CAAC,OAAO,EAC5B,WAAW,EAAE,KAAK,CAAC,OAAO,GACzB,KAAK,CAAC,OAAO,CASf"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the next index in a circular array, wrapping from the end to 0.
|
|
3
|
+
*/
|
|
4
|
+
export declare function nextIndex(index: number, arrayLength: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the previous index in a circular array, wrapping from 0 to the end.
|
|
7
|
+
*/
|
|
8
|
+
export declare function prevIndex(index: number, arrayLength: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Wraps an index into the valid range [0, arrayLength) using floor-based modulo.
|
|
11
|
+
* Handles negative indices correctly (unlike the JS % operator).
|
|
12
|
+
*/
|
|
13
|
+
export declare function loopIndex(index: number, arrayLength: number): number;
|
|
14
|
+
//# sourceMappingURL=LoopUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoopUtility.d.ts","sourceRoot":"","sources":["../../src/utils/LoopUtility.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms a ray by a matrix.
|
|
4
|
+
*
|
|
5
|
+
* The original C# uses Matrix4x4.MultiplyPoint3x4 which applies the full
|
|
6
|
+
* affine transform (rotation + scale + translation) but ignores the
|
|
7
|
+
* projective row. THREE.Vector3.applyMatrix4 does the same for affine
|
|
8
|
+
* matrices (w is assumed 1 and the perspective divide is a no-op).
|
|
9
|
+
*
|
|
10
|
+
* Returns a new THREE.Ray with the transformed origin and direction.
|
|
11
|
+
*/
|
|
12
|
+
export declare function transformRay(ray: THREE.Ray, matrix: THREE.Matrix4): THREE.Ray;
|
|
13
|
+
//# sourceMappingURL=MatrixUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatrixUtility.d.ts","sourceRoot":"","sources":["../../src/utils/MatrixUtility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,MAAM,EAAE,KAAK,CAAC,OAAO,GACpB,KAAK,CAAC,GAAG,CAIX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal TextureUtility — ported from the portions of TextureUtility.cs
|
|
3
|
+
* that are used by the Paper class (ST flip operations).
|
|
4
|
+
* Unity-specific texture creation is omitted.
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
/**
|
|
8
|
+
* Flip the X axis of a texture ST vector.
|
|
9
|
+
* ST format: (scaleX, scaleY, offsetX, offsetY)
|
|
10
|
+
*/
|
|
11
|
+
export declare function xFlipST(st: THREE.Vector4): THREE.Vector4;
|
|
12
|
+
/**
|
|
13
|
+
* Flip the Y axis of a texture ST vector.
|
|
14
|
+
*/
|
|
15
|
+
export declare function yFlipST(st: THREE.Vector4): THREE.Vector4;
|
|
16
|
+
export declare function fixNull(texture: THREE.Texture | null): THREE.Texture;
|
|
17
|
+
//# sourceMappingURL=TextureUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextureUtility.d.ts","sourceRoot":"","sources":["../../src/utils/TextureUtility.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAExD;AAQD,wBAAgB,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC,OAAO,CAWpE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the normal of a triangle defined by vertices a, b, c.
|
|
4
|
+
*
|
|
5
|
+
* This is a faithful port of the original C# implementation which manually
|
|
6
|
+
* normalises the edge vectors before computing the cross product, then
|
|
7
|
+
* normalises the result. This differs from a simple (b-a).cross(c-a).normalize()
|
|
8
|
+
* and is preserved exactly.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNormal(a: THREE.Vector3, b: THREE.Vector3, c: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
|
|
11
|
+
//# sourceMappingURL=TriangleUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TriangleUtility.d.ts","sourceRoot":"","sources":["../../src/utils/TriangleUtility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,KAAK,CAAC,OAAO,EAChB,CAAC,EAAE,KAAK,CAAC,OAAO,EAChB,CAAC,EAAE,KAAK,CAAC,OAAO,EAChB,GAAG,GAAE,KAAK,CAAC,OAA6B,GACvC,KAAK,CAAC,OAAO,CAuBf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Per-component SmoothDamp for Vector3 using per-component smooth times.
|
|
4
|
+
*
|
|
5
|
+
* `currentVelocity` is mutated in-place (mirrors the C# `ref` semantics).
|
|
6
|
+
* Returns the new smoothed position.
|
|
7
|
+
*/
|
|
8
|
+
export declare function smoothDamp(current: THREE.Vector3, target: THREE.Vector3, currentVelocity: THREE.Vector3, smoothTime: THREE.Vector3, maxSpeed?: number, deltaTime?: number): THREE.Vector3;
|
|
9
|
+
/**
|
|
10
|
+
* Per-component SmoothStep for Vector3.
|
|
11
|
+
*/
|
|
12
|
+
export declare function smoothStep(from: THREE.Vector3, to: THREE.Vector3, smoothStepT: THREE.Vector3): THREE.Vector3;
|
|
13
|
+
/**
|
|
14
|
+
* Per-component MoveTowards for Vector3.
|
|
15
|
+
*/
|
|
16
|
+
export declare function moveTowards(current: THREE.Vector3, target: THREE.Vector3, maxDistanceDelta: THREE.Vector3): THREE.Vector3;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a perpendicular vector in the XZ plane (swaps x and z, negates z).
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPerpendicularXZ2(vector: THREE.Vector3): THREE.Vector3;
|
|
21
|
+
/**
|
|
22
|
+
* Converts an XY vector to XZ (y -> z, y set to 0).
|
|
23
|
+
*/
|
|
24
|
+
export declare function xy2xz(v: THREE.Vector3): THREE.Vector3;
|
|
25
|
+
/**
|
|
26
|
+
* Converts an XZ vector to XY (z -> y, z set to 0).
|
|
27
|
+
*/
|
|
28
|
+
export declare function xz2xy(v: THREE.Vector3): THREE.Vector3;
|
|
29
|
+
//# sourceMappingURL=VectorUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VectorUtility.d.ts","sourceRoot":"","sources":["../../src/utils/VectorUtility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmF/B;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,MAAM,EAAE,KAAK,CAAC,OAAO,EACrB,eAAe,EAAE,KAAK,CAAC,OAAO,EAC9B,UAAU,EAAE,KAAK,CAAC,OAAO,EACzB,QAAQ,GAAE,MAAiB,EAC3B,SAAS,GAAE,MAAe,GACzB,KAAK,CAAC,OAAO,CA8Bf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,KAAK,CAAC,OAAO,EACnB,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,WAAW,EAAE,KAAK,CAAC,OAAO,GACzB,KAAK,CAAC,OAAO,CAMf;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,MAAM,EAAE,KAAK,CAAC,OAAO,EACrB,gBAAgB,EAAE,KAAK,CAAC,OAAO,GAC9B,KAAK,CAAC,OAAO,CAMf;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAExE;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAErD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * as VectorUtility from './VectorUtility';
|
|
2
|
+
export * as BezierUtility from './BezierUtility';
|
|
3
|
+
export * as EllipseUtility from './EllipseUtility';
|
|
4
|
+
export * as TriangleUtility from './TriangleUtility';
|
|
5
|
+
export * as LoopUtility from './LoopUtility';
|
|
6
|
+
export * as MatrixUtility from './MatrixUtility';
|
|
7
|
+
export * as TextureUtility from './TextureUtility';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@objectifthunes/three-book",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"three": ">=0.150.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"three": "^0.172.0",
|
|
21
|
+
"@types/three": "^0.172.0",
|
|
22
|
+
"typescript": "^5.7.0",
|
|
23
|
+
"vite": "^6.0.0",
|
|
24
|
+
"vite-plugin-dts": "^4.0.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
29
|
+
}
|
|
30
|
+
}
|