Skip to content

Commit 3a410a0

Browse files
committed
feat(architecture): add InitPathTracingCPJobEntity, InitAccumulationCPJobEntity
pass unit test;
1 parent 92ee13e commit 3a410a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2748
-68
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let set = dp => {
2+
DpContainer.setWebGPURayTracingDp(dp);
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
let getColor = light => {
2+
OperateDirectionLightDoService.getColor(light);
3+
};
4+
5+
let getIntensity = light => {
6+
OperateDirectionLightDoService.getIntensity(light);
7+
};
8+
9+
let getAllLights = (sceneGameObject) => {
10+
AllDirectionLightsDoService.getAllLights(sceneGameObject);
11+
};
12+
13+
let getDirection = light => {
14+
DirectionDirectionLightDoService.getDirection(light);
15+
};
16+
17+
let getLightCount = (sceneGameObject) => {
18+
AllDirectionLightsDoService.getLightCount(sceneGameObject);
19+
};

src/construct/domain_layer/dependency/container/DpContainer.re

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ let unsafeGetTransformRepoDp = () => {
5252
// _unsafeGetSceneGraphRepoDp().geometryRepo;
5353
// };
5454

55-
// let unsafeGetDirectionLightRepoDp = () => {
56-
// _unsafeGetSceneGraphRepoDp().directionLightRepo;
57-
// };
55+
let unsafeGetDirectionLightRepoDp = () => {
56+
_unsafeGetSceneGraphRepoDp().directionLightRepo;
57+
};
5858

5959
// let unsafeGetBasicCameraViewRepoDp = () => {
6060
// _unsafeGetSceneGraphRepoDp().basicCameraViewRepo;

src/construct/domain_layer/dependency/interface/engine/ISceneGraphRepoDp.re

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type gameObjectRepo = {
66
getTransform: gameObject => option(transform),
77
// getBSDFMaterial: gameObject => option(bsdfMaterial),
88
// getGeometry: gameObject => option(geometry),
9-
// getDirectionLight: gameObject => option(directionLight),
9+
getDirectionLight: gameObject => option(directionLight),
1010
// getBasicCameraView: gameObject => option(basicCameraView),
1111
// getPerspectiveCameraProjection:
1212
// gameObject => option(perspectiveCameraProjection),
@@ -27,6 +27,13 @@ type transformRepo = {
2727
getScale: transform => scale,
2828
};
2929

30+
type directionLightRepo = {
31+
getColor: directionLight => color3,
32+
getIntensity: directionLight => intensity,
33+
getDirection: directionLight => direction,
34+
getAllLights: gameObject => list(directionLight),
35+
};
36+
3037
// type bsdfMaterialRepo = {
3138
// getDiffuseColor: bsdfMaterial => diffuse,
3239
// getSpecular: bsdfMaterial => float,
@@ -47,5 +54,6 @@ type transformRepo = {
4754
type sceneGraphRepo = {
4855
sceneRepo,
4956
transformRepo,
57+
directionLightRepo,
5058
gameObjectRepo,
5159
};

src/construct/domain_layer/dependency/interface/engine/SceneGraphType.re

+8
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ type localToWorldMatrix = Js.Typed_array.Float32Array.t;
1111
type normalMatrix = Js.Typed_array.Float32Array.t;
1212

1313
type transform;
14+
15+
type color3 = (float, float, float);
16+
17+
type intensity = float;
18+
19+
type direction = (float, float, float);
20+
21+
type directionLight;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
type t =
2+
| DirectionLight(SceneGraphType.directionLight);
3+
4+
let create = index => DirectionLight(index);
5+
6+
let value = directionLight =>
7+
switch (directionLight) {
8+
| DirectionLight(index) => index
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
let getAllLights = sceneGameObject => {
2+
DpContainer.unsafeGetDirectionLightRepoDp().getAllLights(
3+
sceneGameObject->GameObjectEntity.value,
4+
)
5+
->ListSt.map(DirectionLightEntity.create);
6+
};
7+
8+
let getLightCount = sceneGameObject => {
9+
getAllLights(sceneGameObject)->ListSt.length;
10+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let getDirection = light =>
2+
DpContainer.unsafeGetDirectionLightRepoDp().getDirection(
3+
light->DirectionLightEntity.value,
4+
)
5+
->DirectionVO.create;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
let getColor = light =>
2+
DpContainer.unsafeGetDirectionLightRepoDp().getColor(
3+
light->DirectionLightEntity.value,
4+
)
5+
->Color3VO.create;
6+
7+
let getIntensity = light =>
8+
DpContainer.unsafeGetDirectionLightRepoDp().getIntensity(
9+
light->DirectionLightEntity.value,
10+
)
11+
->IntensityVO.create;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
type t =
2+
| Color3(SceneGraphType.color3);
3+
4+
let create = value => Color3(value);
5+
6+
let value = color =>
7+
switch (color) {
8+
| Color3(value) => value
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
type t =
2+
| Direction(SceneGraphType.direction);
3+
4+
let create = value => Direction(value);
5+
6+
let value = direction =>
7+
switch (direction) {
8+
| Direction(value) => value
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
type t =
2+
| Intensity(SceneGraphType.intensity);
3+
4+
let create = value => Intensity(value);
5+
6+
let value = intensity =>
7+
switch (intensity) {
8+
| Intensity(value) => value
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let unsafeGet = () => {
2+
DpContainer.unsafeGetWebGPURayTracingDp();
3+
};
4+
5+
let set = (dp: IWebGPURayTracingDp.webgpuRayTracing) => {
6+
WebGPURayTracingDpApService.set(dp);
7+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
let getColor = light => {
2+
DirectionLightApService.getColor(light);
3+
};
4+
5+
let getIntensity = light => {
6+
DirectionLightApService.getIntensity(light);
7+
};
8+
9+
let getAllLights = (sceneGameObject) => {
10+
DirectionLightApService.getAllLights(sceneGameObject);
11+
};
12+
13+
let getDirection = light => {
14+
DirectionLightApService.getDirection(light);
15+
};
16+
17+
let getLightCount = (sceneGameObject) => {
18+
DirectionLightApService.getLightCount(sceneGameObject);
19+
};

src/run/application_layer/DirectorCPApService.re

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ let _injectDependencies = () => {
1212
});
1313
};
1414

15-
// let prepare = (~pictureSize, ~sampleCount) => {
16-
let prepare = (~pictureSize) => {
15+
let prepare = (~pictureSize, ~sampleCount) => {
1716
_injectDependencies();
1817

1918
PictureCPDoService.setSize(pictureSize);
20-
// PassCPDoService.setSampleCount(sampleCount);
19+
PassCPDoService.setSampleCount(sampleCount);
2120
};
2221

2322
let _parseAndSetPipelineStream = pipelineData => {

0 commit comments

Comments
 (0)