Skip to content

Commit 0bd0e6b

Browse files
committed
Add source info for other .ts files in cornell sample
1 parent 2e61067 commit 0bd0e6b

File tree

7 files changed

+36
-0
lines changed

7 files changed

+36
-0
lines changed

src/sample/cornell/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import commonWGSL from './common.wgsl';
55
* Common holds the shared WGSL between the shaders, including the common uniform buffer.
66
*/
77
export default class Common {
8+
static sourceInfo = {
9+
name: __filename.substring(__dirname.length + 1),
10+
contents: __SOURCE__,
11+
};
12+
813
/** The WGSL of the common shader */
914
readonly wgsl = commonWGSL;
1015
/** The common uniform buffer bind group and layout */

src/sample/cornell/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ const CornellBox: () => JSX.Element = () =>
126126
name: __filename.substring(__dirname.length + 1),
127127
contents: __SOURCE__,
128128
},
129+
Common.sourceInfo,
130+
Scene.sourceInfo,
131+
Radiosity.sourceInfo,
132+
Rasterizer.sourceInfo,
133+
Raytracer.sourceInfo,
134+
Tonemapper.sourceInfo,
129135
{
130136
name: './radiosity.wgsl',
131137
contents: radiosityWGSL,

src/sample/cornell/radiosity.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Scene from './scene';
77
* the scene.
88
*/
99
export default class Radiosity {
10+
static sourceInfo = {
11+
name: __filename.substring(__dirname.length + 1),
12+
contents: __SOURCE__,
13+
};
14+
1015
// The output lightmap format and dimensions
1116
static readonly lightmapFormat = 'rgba16float';
1217
static readonly lightmapWidth = 256;

src/sample/cornell/rasterizer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import Scene from './scene';
88
* Rasterizer renders the scene using a regular raserization graphics pipeline.
99
*/
1010
export default class Rasterizer {
11+
static sourceInfo = {
12+
name: __filename.substring(__dirname.length + 1),
13+
contents: __SOURCE__,
14+
};
15+
1116
private readonly common: Common;
1217
private readonly scene: Scene;
1318
private readonly renderPassDescriptor: GPURenderPassDescriptor;

src/sample/cornell/raytracer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Radiosity from './radiosity';
77
* Raytracer renders the scene using a software ray-tracing compute pipeline.
88
*/
99
export default class Raytracer {
10+
static sourceInfo = {
11+
name: __filename.substring(__dirname.length + 1),
12+
contents: __SOURCE__,
13+
};
14+
1015
private readonly common: Common;
1116
private readonly framebuffer: GPUTexture;
1217
private readonly pipeline: GPUComputePipeline;

src/sample/cornell/scene.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ const light: Quad = {
144144
* Scene holds the cornell-box scene information.
145145
*/
146146
export default class Scene {
147+
static sourceInfo = {
148+
name: __filename.substring(__dirname.length + 1),
149+
contents: __SOURCE__,
150+
};
151+
147152
readonly vertexCount: number;
148153
readonly indexCount: number;
149154
readonly vertices: GPUBuffer;

src/sample/cornell/tonemapper.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import tonemapperWGSL from './tonemapper.wgsl';
66
* a gamma-correct, tonemapped framebuffer used for presentation.
77
*/
88
export default class Tonemapper {
9+
static sourceInfo = {
10+
name: __filename.substring(__dirname.length + 1),
11+
contents: __SOURCE__,
12+
};
13+
914
private readonly bindGroup: GPUBindGroup;
1015
private readonly pipeline: GPUComputePipeline;
1116
private readonly width: number;

0 commit comments

Comments
 (0)