-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/phisn/rocket-game
- Loading branch information
Showing
18 changed files
with
2,810 additions
and
3,234 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.env | ||
.wrangler | ||
.dev.vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/web-game/src/game/modules/module-scene-agent/svg-loader.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { BufferGeometry, Loader, LoadingManager, Shape, ShapePath, Vector2 } from "three" | ||
|
||
export interface SVGResultPaths extends ShapePath { | ||
userData?: Record<string, any> | undefined | ||
} | ||
|
||
export interface SVGResult { | ||
paths: SVGResultPaths[] | ||
xml: XMLDocument | ||
} | ||
|
||
export interface StrokeStyle { | ||
strokeColor: string | ||
strokeWidth: number | ||
strokeLineJoin: string | ||
strokeLineCap: string | ||
strokeMiterLimit: number | ||
} | ||
|
||
export class SVGLoader extends Loader<SVGResult> { | ||
constructor(manager?: LoadingManager) | ||
|
||
defaultDPI: number | ||
defaultUnit: string | ||
|
||
parse(text: string): SVGResult | ||
|
||
static getStrokeStyle( | ||
width?: number, | ||
color?: string, | ||
lineJoin?: string, | ||
lineCap?: string, | ||
miterLimit?: number, | ||
): StrokeStyle | ||
|
||
/** | ||
* Generates a stroke with some witdh around the given path. | ||
* @remarks The path can be open or closed (last point equals to first point) | ||
* @param points Array of Vector2D (the path). Minimum 2 points. | ||
* @param style Object with SVG properties as returned by SVGLoader.getStrokeStyle(), or SVGLoader.parse() in the path.userData.style object | ||
* @param arcDivisions Arc divisions for round joins and endcaps. (Optional) | ||
* @param minDistance Points closer to this distance will be merged. (Optional) | ||
* @returns BufferGeometry with stroke triangles (In plane z = 0). UV coordinates are generated ('u' along path. 'v' across it, from left to right) | ||
*/ | ||
static pointsToStroke( | ||
points: Vector2[], | ||
style: StrokeStyle, | ||
arcDivisions?: number, | ||
minDistance?: number, | ||
): BufferGeometry | ||
|
||
static pointsToStrokeWithBuffers( | ||
points: Vector2[], | ||
style: StrokeStyle, | ||
arcDivisions?: number, | ||
minDistance?: number, | ||
vertices?: number[], | ||
normals?: number[], | ||
uvs?: number[], | ||
vertexOffset?: number, | ||
): number | ||
|
||
static createShapes(shapePath: ShapePath): Shape[] | ||
} |
Oops, something went wrong.