-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [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
Showing
304 changed files
with
11,680 additions
and
2,514 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export let GrassAnimCompute_cs = /*wgsl*/` | ||
` |
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,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); | ||
} | ||
} | ||
} | ||
` |
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
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); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -23,4 +23,4 @@ export default defineConfig({ | |
} | ||
} | ||
} | ||
}) | ||
}) |
Oops, something went wrong.