Skip to content

Commit

Permalink
refactor: deprecate packages/effect, move Terrain Grass into packages…
Browse files Browse the repository at this point in the history
…/geometry (#446)
  • Loading branch information
lslzl3000 authored Aug 14, 2024
1 parent 5a9ff20 commit ba26dc8
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 245 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"dev": "vite",
"build": "tsc --p tsconfig.build.json && vite build && npm run build:types && npm run minify",
"build:test": "tsc --p tsconfig.build.json && vite build && npm run build:packages",
"build:packages": "npm run build:physics && npm run build:media && npm run build:stats && npm run build:particle && npm run build:graphic && npm run build:effect",
"build:packages": "npm run build:physics && npm run build:media && npm run build:stats && npm run build:particle && npm run build:graphic && npm run build:geometry",
"build:physics": "cd packages/physics && npm run build",
"build:media": "cd packages/media-extention && npm run build",
"build:stats": "cd packages/stats && npm run build",
"build:particle": "cd packages/particle && npm run build",
"build:graphic": "cd packages/graphic && npm run build",
"build:effect": "cd packages/effect && npm run build",
"build:geometry": "cd packages/geometry && npm run build",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json && rm -rf dist/packages && mv dist/src dist/types",
"minify": "./node_modules/vite/node_modules/.bin/esbuild dist/orillusion.es.max.js --sourcemap --minify --outfile=dist/orillusion.es.js && ./node_modules/vite/node_modules/.bin/esbuild dist/orillusion.umd.max.js --minify --sourcemap --outfile=dist/orillusion.umd.js",
"test": "electron test/ci/main.js",
Expand Down
15 changes: 0 additions & 15 deletions packages/effect/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions packages/effect/grass/GrassNode.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/effect/index.ts

This file was deleted.

24 changes: 0 additions & 24 deletions packages/effect/package.json

This file was deleted.

30 changes: 0 additions & 30 deletions packages/effect/tsconfig.json

This file was deleted.

26 changes: 0 additions & 26 deletions packages/effect/vite.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/geometry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ npm install @orillusion/geometry --save
```
```ts
import { Scene3D } from "@orillusion/core"
import { TextGeometry } from "@orillusion/geometry"
import { TextGeometry, ExtrudeGeometry, TerrainGeometry } from "@orillusion/geometry"
```

Or access Global build from CDN
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { BoundingBox, GeometryBase, Vector3, VertexAttributeName } from "@orillusion/core";
import { GrassNode } from "../GrassNode";



import { BoundingBox, GeometryBase, Transform, Vector3, VertexAttributeName } from "@orillusion/core";

export class GrassGeometry extends GeometryBase {
public width: number;
public height: number;
public segmentW: number;
public segmentH: number;
public nodes: GrassNode[];
public nodes: Transform[];

constructor(width: number, height: number, segmentW: number = 1, segmentH: number = 1, count: number) {
super();
Expand Down Expand Up @@ -43,7 +39,7 @@ export class GrassGeometry extends GeometryBase {

let pi = 3.1415926 * 0.5;
for (let gi = 0; gi < count; gi++) {
let node = new GrassNode();
let node = new Transform();
this.nodes.push(node);

let dir = new Vector3(1 * Math.random() - 0.5, 0.0, 1 * Math.random() - 0.5);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BoundingBox, Color, ComponentBase, GPUPrimitiveTopology, LightingFunction_frag, MeshRenderer, Texture, UnLitMaterial, Vector3, VertexAttributeName } from "@orillusion/core";
import { BoundingBox, Color, ComponentBase, GPUPrimitiveTopology, LightingFunction_frag, MeshRenderer, Texture, Transform, UnLitMaterial, Vector3, VertexAttributeName } from "@orillusion/core";
import { GrassMaterial } from "../material/GrassMaterial";
import { GrassGeometry } from "../geometry/GrassGeometry";
import { GrassNode } from "../GrassNode";
import { GrassGeometry } from "../GrassGeometry";

export class GrassComponent extends MeshRenderer {

Expand Down Expand Up @@ -40,7 +39,7 @@ export class GrassComponent extends MeshRenderer {
this.grassMaterial.baseMap = grassTexture;
}

public get nodes(): GrassNode[] {
public get nodes(): Transform[] {
return this.grassGeometry.nodes;
}
}
File renamed without changes.
6 changes: 5 additions & 1 deletion packages/geometry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ export * from "./ExtrudeGeometry/Path2D"
export * from "./ExtrudeGeometry/Shape2D"
export * from "./ExtrudeGeometry/ShapeUtils"
export * from "./parser/FontParser"
export * from "./TextGeometry"
export * from "./text/TextGeometry"
export * from "./terrain/TerrainGeometry"
export * from "./grass/GrassGeometry"
export * from "./grass/component/GrassComponent";
export * from "./grass/material/GrassMaterial";
2 changes: 1 addition & 1 deletion packages/geometry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orillusion/geometry",
"version": "0.2.1",
"version": "0.2.2",
"author": "Orillusion",
"description": "Orillusion geometry Plugin",
"main": "./dist/geometry.umd.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitmapTexture2D, Plane, PlaneGeometry, Texture, Vector3, VertexAttributeName, lerp } from "@orillusion/core"
import { BitmapTexture2D, PlaneGeometry, Vector3, VertexAttributeName, lerp } from "@orillusion/core"

export class TerrainGeometry extends PlaneGeometry {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Shape2D } from "./ExtrudeGeometry/Shape2D";
import { ExtrudeGeometry, ExtrudeGeometryArgs } from "./ExtrudeGeometry/ExtrudeGeometry";
import { ShapeUtils } from "./ExtrudeGeometry/ShapeUtils";
import { Font } from "./lib/opentype";
import { Shape2D } from "../ExtrudeGeometry/Shape2D";
import { ExtrudeGeometry, ExtrudeGeometryArgs } from "../ExtrudeGeometry/ExtrudeGeometry";
import { ShapeUtils } from "../ExtrudeGeometry/ShapeUtils";
import { Font } from "../lib/opentype";

export type TextGeometryArgs = ExtrudeGeometryArgs & {
font: Font;
Expand Down
117 changes: 0 additions & 117 deletions samples/ext/_Sample_Boxes.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Engine3D, View3D, Scene3D, CameraUtil, AtmosphericComponent, webGPUContext, HoverCameraController, Object3D, DirectLight, KelvinUtil, PlaneGeometry, VertexAttributeName, LitMaterial, MeshRenderer, Vector4, Vector3, Matrix3, PostProcessingComponent, TAAPost, BitmapTexture2D, GlobalFog, Color, FXAAPost } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { GrassComponent, TerrainGeometry } from "@orillusion/effect";
import { GrassComponent, TerrainGeometry } from "@orillusion/geometry";
import { Stats } from "@orillusion/stats";

// An sample of custom vertex attribute of geometry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Engine3D, View3D, Scene3D, CameraUtil, AtmosphericComponent, webGPUContext, HoverCameraController, Object3D, DirectLight, KelvinUtil, PlaneGeometry, VertexAttributeName, LitMaterial, MeshRenderer, Vector4, Vector3, Matrix3, PostProcessingComponent, TAAPost, BitmapTexture2D, GlobalFog, Color, FXAAPost } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { GrassComponent, TerrainGeometry } from "@orillusion/effect";
import { TerrainGeometry } from "@orillusion/geometry";

// An sample of custom vertex attribute of geometry
class Sample_Terrain {
Expand Down

0 comments on commit ba26dc8

Please sign in to comment.