-
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.
- Loading branch information
Showing
17 changed files
with
323 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import mat4 from "../math/mat4"; | ||
import vec3 from "../math/vec3"; | ||
import Projection from "../projection/Projection"; | ||
import TransformationStack from "../transformation/TransformationStack"; | ||
|
||
/** | ||
* A minimal interface that describes the functionality of a camera. | ||
*/ | ||
export default interface Camera { | ||
transformationStack: TransformationStack; | ||
getProjectionMatrix(width: number, height: number): mat4; | ||
getProjection(): Projection; | ||
getViewMatrix(): mat4; | ||
getWorldLocation(): vec3; | ||
} |
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
61 changes: 61 additions & 0 deletions
61
frontend/src/ts/dynamicObject/heightField/HeightFieldShadowPipeline.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,61 @@ | ||
import { gpuDevice } from "../../GPUX"; | ||
import { AbstractPipeline, vertexGeometryEntryPoint } from "../../Material/AbstractPipeline"; | ||
import staticShaderCode from "./heightField.wgsl?raw"; | ||
import { resolveShader } from "../../rendering/Shader"; | ||
import { Project } from "../../project/Project"; | ||
import { heightFieldDataLayout } from "./HeightFieldPipeline"; | ||
|
||
export class HeightFieldShadowPipeline extends AbstractPipeline { | ||
vertexEntryPoint = vertexGeometryEntryPoint; | ||
fragmentEntryPoint = undefined; | ||
gpuPipeline: GPURenderPipeline; | ||
readonly isDisplayOutputPipeline = false; | ||
readonly shaderCode: string; | ||
readonly preProzessedShaderCoder; | ||
readonly shaderModule: GPUShaderModule; | ||
vertexConstants: Record<string, number>; | ||
vertexBufferLayout: GPUVertexBufferLayout[]; | ||
fragmentConstants: Record<string, number>; | ||
fragmentTargets: GPUColorTargetState[]; | ||
topology: GPUPrimitiveTopology; | ||
cullMode: GPUCullMode; | ||
stripIndexFormat?: GPUIndexFormat; | ||
depthStencilFormat: GPUTextureFormat; | ||
depthCompare: GPUCompareFunction; | ||
depthWriteEnabled: boolean; | ||
project: Project; | ||
|
||
constructor(project: Project, label: string) { | ||
super(label); | ||
this.project = project; | ||
this.shaderCode = staticShaderCode; | ||
this.preProzessedShaderCoder = resolveShader(this.shaderCode); | ||
this.vertexConstants = {}; | ||
this.vertexBufferLayout = []; | ||
this.fragmentConstants = {}; | ||
this.topology = "triangle-strip"; | ||
this.cullMode = "none"; | ||
this.depthCompare = "less"; | ||
this.depthWriteEnabled = true; | ||
this.depthStencilFormat = "depth24plus"; | ||
this.fragmentTargets = []; | ||
|
||
this.shaderModule = gpuDevice.createShaderModule( | ||
{ | ||
label: `${label} shader module`, | ||
code: this.preProzessedShaderCoder, | ||
compilationHints: [ | ||
{ entryPoint: vertexGeometryEntryPoint }, | ||
] | ||
}); | ||
this.gpuPipeline = this.buildPipeline(); | ||
} | ||
|
||
createPipelineLayout(): GPUPipelineLayout | "auto" { | ||
const renderer = this.project.renderer; | ||
return gpuDevice.createPipelineLayout({ | ||
label: "Height field shadow pipeline layout", | ||
bindGroupLayouts: [renderer.bindGroup0Layout, renderer.bindGroupR3Layout, heightFieldDataLayout], | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.