Skip to content

Commit

Permalink
release v0.8
Browse files Browse the repository at this point in the history
## [0.8.1](v0.7.2...v0.8.1) (2024-07-10)


### Bug Fixes

* **canvas:** fix external canvas resize on dpi change ([2e54053](2e54053))
* **effect:** fix grass get uniform data ([588721f](588721f))
* **effect:** update windSpeed ([538ec2d](538ec2d))
* Error when lineJoin is set to round ([#366](#366)) ([1ab8718](1ab8718))
* fix issue of [#387](#387) ([#394](#394)) ([6271c37](6271c37))
* **GlobalUniformGroup:** missing property for shadow camera ([1f90393](1f90393))
* **loaderFunctions:** onUrl on loadGltf ([65bda50](65bda50))
* object is disabled after removeChild  ([#381](#381)) ([51ff3ee](51ff3ee))
* **objparser:** loadObj crash [#372](#372) ([b3e9194](b3e9194))
* **picker:** missing normal in pickFire ([4e05c04](4e05c04))
* **pick:** fix normal in pickInfo ([5197317](5197317))
* Solve the issues mentioned in Issue367 ([#368](#368)) ([7ab2f48](7ab2f48))
* **transform:** fix wrong localRotQuat ([8c5e2b3](8c5e2b3))


### Features

* **Animator:** Unified skeleton animation and morph animation to AnimatorComponent ([#405](#405)) ([4cf51f3](4cf51f3))
* **buffer:** return promise result ([590b213](590b213))
* **GBuff:** compressed GBuff data. ([#412](#412)) ([4649add](4649add))
* **orbit:** pan at xz plane ([52383f5](52383f5))
* **sample:** add camera path animation sample ([#385](#385)) ([d447cd1](d447cd1))
* **sample:** add EatTheBox sample,add ShootTheBox sample ([#391](#391)) ([e925d1f](e925d1f))
  • Loading branch information
lslzl3000 committed Jul 10, 2024
2 parents 49ad63a + 85a691a commit 4902f04
Show file tree
Hide file tree
Showing 304 changed files with 11,680 additions and 2,514 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
## [0.8.1](https://github.com/Orillusion/orillusion/compare/v0.7.2...v0.8.1) (2024-07-10)


### Bug Fixes

* **canvas:** fix external canvas resize on dpi change ([2e54053](https://github.com/Orillusion/orillusion/commit/2e54053efbffbd1d70d2a1b7c2e2f62ca672c4e9))
* **effect:** fix grass get uniform data ([588721f](https://github.com/Orillusion/orillusion/commit/588721f52013fb9cadbe5d8156a41d2110636ac7))
* **effect:** update windSpeed ([538ec2d](https://github.com/Orillusion/orillusion/commit/538ec2df976e1a45d13e3deaf15ef7c15fe5b409))
* Error when lineJoin is set to round ([#366](https://github.com/Orillusion/orillusion/issues/366)) ([1ab8718](https://github.com/Orillusion/orillusion/commit/1ab87183c6910c2fc3e61d940b0183a2d5597b08))
* fix issue of [#387](https://github.com/Orillusion/orillusion/issues/387) ([#394](https://github.com/Orillusion/orillusion/issues/394)) ([6271c37](https://github.com/Orillusion/orillusion/commit/6271c3748a1520cd444431200f7ec35111af049e))
* **GlobalUniformGroup:** missing property for shadow camera ([1f90393](https://github.com/Orillusion/orillusion/commit/1f903935fc50be16763067b888c0c37cae860c5c))
* **loaderFunctions:** onUrl on loadGltf ([65bda50](https://github.com/Orillusion/orillusion/commit/65bda50eac61694bb4e8354ee2f1744c876bd7ba))
* object is disabled after removeChild ([#381](https://github.com/Orillusion/orillusion/issues/381)) ([51ff3ee](https://github.com/Orillusion/orillusion/commit/51ff3ee84fb8aae46819d5c7db914b3dc873062f))
* **objparser:** loadObj crash [#372](https://github.com/Orillusion/orillusion/issues/372) ([b3e9194](https://github.com/Orillusion/orillusion/commit/b3e9194630c9d0f3ab5a1cbc92dc7b760dd58f8b))
* **picker:** missing normal in pickFire ([4e05c04](https://github.com/Orillusion/orillusion/commit/4e05c04dd22cccfb44e63c8dd2af859d4ff01c86))
* **pick:** fix normal in pickInfo ([5197317](https://github.com/Orillusion/orillusion/commit/519731748ba046dd28891d99899e68e61a77c409))
* Solve the issues mentioned in Issue367 ([#368](https://github.com/Orillusion/orillusion/issues/368)) ([7ab2f48](https://github.com/Orillusion/orillusion/commit/7ab2f489dfca66b6cb2cb84111097b430bb87c34))
* **transform:** fix wrong localRotQuat ([8c5e2b3](https://github.com/Orillusion/orillusion/commit/8c5e2b3606378009045a460edf841e5d36142de8))


### Features

* **Animator:** Unified skeleton animation and morph animation to AnimatorComponent ([#405](https://github.com/Orillusion/orillusion/issues/405)) ([4cf51f3](https://github.com/Orillusion/orillusion/commit/4cf51f34937da6800f6cde2487defe12fe87ba8f))
* **buffer:** return promise result ([590b213](https://github.com/Orillusion/orillusion/commit/590b213d41dd26ca86e1780376a7e04ece8a5166))
* **GBuff:** compressed GBuff data. ([#412](https://github.com/Orillusion/orillusion/issues/412)) ([4649add](https://github.com/Orillusion/orillusion/commit/4649addc066cd53a5ee286940c1e254d64bde89e))
* **orbit:** pan at xz plane ([52383f5](https://github.com/Orillusion/orillusion/commit/52383f5c60da7f6f2e3407de6bda355946f61fed))
* **sample:** add camera path animation sample ([#385](https://github.com/Orillusion/orillusion/issues/385)) ([d447cd1](https://github.com/Orillusion/orillusion/commit/d447cd18e6e85763706e67c12e19d6a02e5e1dc4))
* **sample:** add EatTheBox sample,add ShootTheBox sample ([#391](https://github.com/Orillusion/orillusion/issues/391)) ([e925d1f](https://github.com/Orillusion/orillusion/commit/e925d1f743ade799dac9d33c01ad829bcef386cb))



## [0.7.2](https://github.com/Orillusion/orillusion/compare/v0.7.1...v0.7.2) (2024-01-26)


Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orillusion/core",
"version": "0.7.2",
"version": "0.8.1",
"author": "Orillusion",
"description": "Orillusion WebGPU Engine",
"type": "module",
Expand Down Expand Up @@ -33,11 +33,11 @@
"build": "tsc --p tsconfig.build.json && vite build && npm run build:types && npm run minify",
"build:test": "tsc --p tsconfig.build.json && vite 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 --minify --outfile=dist/orillusion.es.js && ./node_modules/vite/node_modules/.bin/esbuild dist/orillusion.umd.max.js --minify --outfile=dist/orillusion.umd.js",
"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",
"test:ci": "xvfb-maybe -- electron --enable-unsafe-webgpu --enable-features=Vulkan --use-vulkan=swiftshader --use-webgpu-adapter=swiftshader --no-sandbox test/ci/main.js",
"docs": "npm run docs:core && npm run docs:physics && npm run docs:media && npm run docs:stats && npm run docs:particle && npm run docs:graphic",
"docs:typedoc": "npx typedoc --plugin typedoc-plugin-markdown --plugin ./script/typedoc-plugin-not-exported.js --tsconfig tsconfig.build.json --gitRevision main --hideBreadcrumbs true --allReflectionsHaveOwnDocument true --readme none --excludeInternal --excludePrivate --excludeProtected --sort source-order --out",
"docs:typedoc": "npx typedoc --plugin typedoc-plugin-markdown --plugin ./script/typedoc-plugin-not-exported.cjs --tsconfig tsconfig.build.json --gitRevision main --hideBreadcrumbs true --allReflectionsHaveOwnDocument true --readme none --excludeInternal --excludePrivate --excludeProtected --sort source-order --out",
"docs:core": "npm run docs:typedoc docs/api src/index.ts",
"docs:physics": "cd packages/physics && npm run docs",
"docs:media": "cd packages/media-extention && npm run docs",
Expand All @@ -50,11 +50,11 @@
"@webgpu/types": "^0.1.40",
"conventional-changelog-cli": "^2.2.2",
"earcut": "^2.2.4",
"electron": "^28.2.0",
"electron": "^31.1.0",
"typedoc": "^0.25.7",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite": "^5.3.1",
"xvfb-maybe": "^0.2.1"
}
}
9 changes: 8 additions & 1 deletion packages/debug/GUIHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,16 @@ class _GUIHelp {
}

_addLabel(gui: GUI, label: string) {
GUIHelp._add(gui, { label: label }, 'label');
return GUIHelp._add(gui, { label: label }, 'label');
}

_addLabelValue(gui: GUI, label: string, value: number) {
let obj = {};
obj[label] = value;
return GUIHelp._add(gui, obj, label);
}


_addButton(gui: GUI, label: string, fun: Function) {
var controls = new (function () {
this[label] = fun;
Expand Down
24 changes: 12 additions & 12 deletions packages/effect/grass/material/GrassMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class GrassMaterial extends Material {
colorPass.setUniformVector4("windBound", new Vector4(0, 0, 2000, 2000));
colorPass.setUniformVector2("windDirection", new Vector2(0.6, 0.8));
colorPass.setUniformFloat("windPower", 0.8);
colorPass.setUniformFloat("windSpeed", 12);
colorPass.setUniformFloat("windSpeed", 1.2);
colorPass.setUniformFloat("translucent", 0.35);
colorPass.setUniformFloat("roughness", 0.35);
colorPass.setUniformFloat("curvature", 0.4068);
Expand All @@ -57,7 +57,7 @@ export class GrassMaterial extends Material {
shadowPass.setUniformVector4("windBound", new Vector4(0, 0, 2000, 2000));
shadowPass.setUniformVector2("windDirection", new Vector2(0.6, 0.8));
shadowPass.setUniformFloat("windPower", 0.8);
shadowPass.setUniformFloat("windSpeed", 10);
shadowPass.setUniformFloat("windSpeed", 1.0);
shadowPass.setUniformFloat("translucent", 0.35);
shadowPass.setUniformFloat("roughness", 0.35);
shadowPass.setUniformFloat("curvature", 0.4068);
Expand Down Expand Up @@ -93,7 +93,7 @@ export class GrassMaterial extends Material {
}

public get windBound(): Vector4 {
return this.shader.getUniform("windBound").data;
return this.shader.getUniformVector4("windBound");
}

public set grassBaseColor(v: Color) {
Expand All @@ -117,70 +117,70 @@ export class GrassMaterial extends Material {
}

public get windDirection(): Vector2 {
return this.shader.getUniform("windDirection").data;
return this.shader.getUniformVector2("windDirection");
}

public set windPower(v: number) {
this.shader.setUniformFloat("windPower", v);
}

public get windPower(): number {
return this.shader.getUniform("windPower").data;
return this.shader.getUniformFloat("windPower");
}

public set windSpeed(v: number) {
this.shader.setUniformFloat("windSpeed", v);
}

public get windSpeed(): number {
return this.shader.getUniform("windSpeed").data;
return this.shader.getUniformFloat("windSpeed");
}

public set grassHeight(v: number) {
this.shader.setUniformFloat("grassHeight", v);
}

public get grassHeight(): number {
return this.shader.getUniform("grassHeight").data;
return this.shader.getUniformFloat("grassHeight");
}

public set curvature(v: number) {
this.shader.setUniformFloat("curvature", v);
}

public get curvature(): number {
return this.shader.getUniform("curvature").data;
return this.shader.getUniformFloat("curvature");
}

public set roughness(v: number) {
this.shader.setUniformFloat("roughness", v);
}

public get roughness(): number {
return this.shader.getUniform("roughness").data;
return this.shader.getUniformFloat("roughness");
}

public set translucent(v: number) {
this.shader.setUniformFloat("translucent", v);
}

public get translucent(): number {
return this.shader.getUniform("translucent").data;
return this.shader.getUniformFloat("translucent");
}

public set soft(v: number) {
this.shader.setUniformFloat("soft", v);
}

public get soft(): number {
return this.shader.getUniform("soft").data;
return this.shader.getUniformFloat("soft");
}

public set specular(v: number) {
this.shader.setUniformFloat("specular", v);
}

public get specular(): number {
return this.shader.getUniform("specular").data;
return this.shader.getUniformFloat("specular");
}
}
2 changes: 1 addition & 1 deletion packages/effect/grass/shader/GrassBaseShader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export let GrassBaseShader = /*wgsl*/ `
#include "GlobalUniform"
#include "ColorPassFragmentOutput"
#include "FragmentOutput"
#include "ShadingInput"
struct FragmentVarying {
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/grass/shader/GrassCastShadowShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export let GrassCastShadowShader = /* wgsl */`
let grassPivot = localMatrix[3].xyz ;
let bound = materialUniform.windBound ;
let time = TIME.y * 0.001 ;
let time = TIME_time() * 0.001 ;
let cycleTime = sin(time) ;
//sampler wind noise texture by vertex shader
Expand Down
6 changes: 4 additions & 2 deletions packages/effect/grass/shader/GrassShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export let GrassShader = /* wgsl */`
#include "MatrixShader"
#include "BrdfLut_frag"
#include "LightingFunction_frag"
#include "ReflectionCG"
struct MaterialUniform {
baseColor: vec4<f32>,
Expand Down Expand Up @@ -43,6 +44,7 @@ export let GrassShader = /* wgsl */`
const DEGREES_TO_RADIANS : f32 = 3.1415926 / 180.0 ;
const PI : f32 = 3.1415926 ;
const LUMEN = 10.764;
@vertex
fn VertMain( vertex:VertexAttributes ) -> VertexOutput {
Expand All @@ -60,7 +62,7 @@ export let GrassShader = /* wgsl */`
let grassPivot = localMatrix[3].xyz ;
let bound = materialUniform.windBound ;
let time = TIME.y * 0.001 ;
let time = TIME_time() * 0.001 ;
let cycleTime = sin(time) ;
//sampler wind noise texture by vertex shader
Expand Down Expand Up @@ -155,7 +157,7 @@ export let GrassShader = /* wgsl */`
var irradiance = LinearToGammaSpace(globalUniform.skyExposure * textureSampleLevel(prefilterMap, prefilterMapSampler, fragData.N.xyz, 0.8 * (MAX_REFLECTION_LOD) ).rgb);
let specular = vec3<f32>( pow(max(dot(viewDir, reflectDir), 0.0), (1.0 - roughness + 0.001) * 200.0 ) ) * mainLightColor * materialUniform.specular;
var diffuse = color.rgb / PI * grassColor.rgb * shadowStrut.directShadowVisibility[0] ;
var diffuse = color.rgb / PI * grassColor.rgb * directShadowVisibility[0] ;
var finalColor = diffuse + specular + irradiance * grassColor.rgb * sunLight.quadratic;//+ backColor;
ORI_ShadingInput.BaseColor = vec4<f32>(finalColor.rgb,1.0) ;
Expand Down
4 changes: 2 additions & 2 deletions packages/effect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orillusion/effect",
"version": "0.1.2",
"version": "0.1.3",
"author": "Orillusion",
"description": "Orillusion Effects Plugin",
"main": "./dist/effect.umd.js",
Expand All @@ -19,6 +19,6 @@
"url": "git+https://github.com/Orillusion/orillusion.git"
},
"dependencies": {
"@orillusion/core": "^0.7.0"
"@orillusion/core": "^0.8.0"
}
}
2 changes: 2 additions & 0 deletions packages/graphic/compute/grass/GrassAnimCompute_cs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export let GrassAnimCompute_cs = /*wgsl*/`
`
66 changes: 66 additions & 0 deletions packages/graphic/compute/grass/GrassGeometryCompute_cs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
export let GrassGeometryCompute_cs = /*wgsl*/`
struct GrassNode {
grassCount: f32,
grassHSegment: f32,
grassWight: f32,
grassHeigh: f32,
grassX: f32,
grassY: f32,
grassZ: f32,
grassRotation: f32
}
@group(0) @binding(3) var<storage, read> nodeBuffer : array<GrassNode> ;
var<private> zero_pos : vec3f = vec3f(0.0,0.0,0.0);
var<private> zero_uv : vec2f = vec2f(0.0,0.0);
fn compute(workgroup_id:vec3<u32>,local_invocation_id:vec3<u32>) {
// Grass geometry compute code goes here
var time = globalUniform.time * 0.005;
let globalIndex = workgroup_id.x * 256u + local_invocation_id.x ;
if(globalIndex < drawBuffer.skipFace2 * 12u){
// if(globalIndex == 0u){
// }
let nodeInfo = nodeBuffer[globalIndex];
let posWs = vec3f(nodeInfo.grassX, nodeInfo.grassY, nodeInfo.grassZ) ;
if(IsOutofFrustum(posWs.xyz,0.1)){
// drawCube(globalIndex,posWs,nodeInfo.grassWight,nodeInfo.grassWight,nodeInfo.grassWight,0.0,time,0.0);
let mat = buildYRotateXMat4(nodeInfo.grassRotation,posWs.x, posWs.y, posWs.z);
let vertexOffset = vec4f(sin(time + f32(local_invocation_id.x) / 16.0 ) ,0.0,0.0,0.0);
let width = nodeInfo.grassWight * 0.5 ;
let height = nodeInfo.grassHeigh * 0.5 ;
// var p0 = (mat * vec4f(-width, height, 0.0,1.0)) + vertexOffset;
// var p1 = (mat * vec4f(width, height, 0.0,1.0)) + vertexOffset;
// var p2 = mat * vec4f(width, 0.0, 0.0,1.0) ;
// var p3 = mat * vec4f(-width, 0.0, 0.0,1.0) ;
// let u0 = vec2f(0.0, 0.0);
// let u1 = vec2f(1.0, 0.0);
// let u2 = vec2f(1.0, 1.0);
// let u3 = vec2f(0.0, 1.0);
// drawFace(globalIndex,p0.xyz,p1.xyz,p2.xyz,u0,u1,u2);
// drawFace(globalIndex,p0.xyz,p2.xyz,p3.xyz,u0,u2,u3);
var p0 = (mat * vec4f(width * 0.5, height, 0.0,1.0)) + vertexOffset;
var p1 = (mat * vec4f(-width, 0.0, 0.0,1.0)) ;// + vertexOffset;
var p2 = mat * vec4f(width, 0.0, 0.0,1.0) ;
let u0 = vec2f(0.5, 0.0);
let u1 = vec2f(1.0, 1.0);
let u2 = vec2f(0.0, 1.0);
drawFace(globalIndex,p0.xyz,p1.xyz,p2.xyz,u0,u1,u2);
}else{
// drawCube(globalIndex,zero_pos,0.0,0.0,0.0,0.0,0.0,0.0);
drawFace(globalIndex,zero_pos,zero_pos,zero_pos,zero_uv,zero_uv,zero_uv);
}
}
}
`
5 changes: 4 additions & 1 deletion packages/graphic/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export * from "./compute/grass/GrassAnimCompute_cs"
export * from "./compute/grass/GrassGeometryCompute_cs"
export * from "./renderer/GrassRenderer"
export * from "./renderer/Shape3DRenderer"
export * from "./renderer/Shape3DMaker"
export * from "./renderer/shape3d/RoundRectShape3D"
Expand All @@ -8,4 +11,4 @@ export * from "./renderer/shape3d/CurveShape3D"
export * from "./renderer/shape3d/LineShape3D"
export * from "./renderer/shape3d/Shape3D"
export * from "./renderer/shape3d/Path3DShape3D"
export * from "./renderer/shape3d/Path2DShape3D"
export * from "./renderer/shape3d/Path2DShape3D"
36 changes: 36 additions & 0 deletions packages/graphic/renderer/GrassRenderer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

import { ComputeShader, DynamicDrawStruct, DynamicFaceRenderer, Struct, graphicDynamicCompute } from "@orillusion/core";
import { GrassGeometryCompute_cs } from "../compute/grass/GrassGeometryCompute_cs";

export class GrassNodeStruct extends DynamicDrawStruct {
grassCount: number = 1;
grassHSegment: number = 1;
grassWight: number = 2;
grassHeigh: number = 4;
grassX: number = 0;
grassY: number = 0;
grassZ: number = 0;
grassRotation: number = 0;
}

export class GrassRenderer extends DynamicFaceRenderer {
grassGeometryCompute: ComputeShader;

constructor() {
super();
}

public init(param?: any): void {
super.init(param);
}

protected createComputeKernel(): void {
console.log("createComputeKernel");


this.grassGeometryCompute = new ComputeShader(graphicDynamicCompute(GrassGeometryCompute_cs));
this.grassGeometryCompute.workerSizeX = Math.floor(this.maxNodeCount / 256) + 1;
// this._onStartKernel.push(this.grassGeometryCompute);
this._onFrameKernelGroup.push(this.grassGeometryCompute);
}
}
2 changes: 1 addition & 1 deletion packages/graphic/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export default defineConfig({
}
}
}
})
})
Loading

0 comments on commit 4902f04

Please sign in to comment.