Skip to content

Commit

Permalink
feat(architecture): add InitPathTracingCPJobEntity, InitAccumulationC…
Browse files Browse the repository at this point in the history
…PJobEntity

pass unit test;
  • Loading branch information
yyc-git committed Oct 30, 2020
1 parent 92ee13e commit 3a410a0
Show file tree
Hide file tree
Showing 41 changed files with 2,748 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let set = dp => {
DpContainer.setWebGPURayTracingDp(dp);
};
19 changes: 19 additions & 0 deletions src/construct/application_layer/scene/DirectionLightApService.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let getColor = light => {
OperateDirectionLightDoService.getColor(light);
};

let getIntensity = light => {
OperateDirectionLightDoService.getIntensity(light);
};

let getAllLights = (sceneGameObject) => {
AllDirectionLightsDoService.getAllLights(sceneGameObject);
};

let getDirection = light => {
DirectionDirectionLightDoService.getDirection(light);
};

let getLightCount = (sceneGameObject) => {
AllDirectionLightsDoService.getLightCount(sceneGameObject);
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ let unsafeGetTransformRepoDp = () => {
// _unsafeGetSceneGraphRepoDp().geometryRepo;
// };

// let unsafeGetDirectionLightRepoDp = () => {
// _unsafeGetSceneGraphRepoDp().directionLightRepo;
// };
let unsafeGetDirectionLightRepoDp = () => {
_unsafeGetSceneGraphRepoDp().directionLightRepo;
};

// let unsafeGetBasicCameraViewRepoDp = () => {
// _unsafeGetSceneGraphRepoDp().basicCameraViewRepo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type gameObjectRepo = {
getTransform: gameObject => option(transform),
// getBSDFMaterial: gameObject => option(bsdfMaterial),
// getGeometry: gameObject => option(geometry),
// getDirectionLight: gameObject => option(directionLight),
getDirectionLight: gameObject => option(directionLight),
// getBasicCameraView: gameObject => option(basicCameraView),
// getPerspectiveCameraProjection:
// gameObject => option(perspectiveCameraProjection),
Expand All @@ -27,6 +27,13 @@ type transformRepo = {
getScale: transform => scale,
};

type directionLightRepo = {
getColor: directionLight => color3,
getIntensity: directionLight => intensity,
getDirection: directionLight => direction,
getAllLights: gameObject => list(directionLight),
};

// type bsdfMaterialRepo = {
// getDiffuseColor: bsdfMaterial => diffuse,
// getSpecular: bsdfMaterial => float,
Expand All @@ -47,5 +54,6 @@ type transformRepo = {
type sceneGraphRepo = {
sceneRepo,
transformRepo,
directionLightRepo,
gameObjectRepo,
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ type localToWorldMatrix = Js.Typed_array.Float32Array.t;
type normalMatrix = Js.Typed_array.Float32Array.t;

type transform;

type color3 = (float, float, float);

type intensity = float;

type direction = (float, float, float);

type directionLight;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| DirectionLight(SceneGraphType.directionLight);

let create = index => DirectionLight(index);

let value = directionLight =>
switch (directionLight) {
| DirectionLight(index) => index
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let getAllLights = sceneGameObject => {
DpContainer.unsafeGetDirectionLightRepoDp().getAllLights(
sceneGameObject->GameObjectEntity.value,
)
->ListSt.map(DirectionLightEntity.create);
};

let getLightCount = sceneGameObject => {
getAllLights(sceneGameObject)->ListSt.length;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let getDirection = light =>
DpContainer.unsafeGetDirectionLightRepoDp().getDirection(
light->DirectionLightEntity.value,
)
->DirectionVO.create;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let getColor = light =>
DpContainer.unsafeGetDirectionLightRepoDp().getColor(
light->DirectionLightEntity.value,
)
->Color3VO.create;

let getIntensity = light =>
DpContainer.unsafeGetDirectionLightRepoDp().getIntensity(
light->DirectionLightEntity.value,
)
->IntensityVO.create;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| Color3(SceneGraphType.color3);

let create = value => Color3(value);

let value = color =>
switch (color) {
| Color3(value) => value
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| Direction(SceneGraphType.direction);

let create = value => Direction(value);

let value = direction =>
switch (direction) {
| Direction(value) => value
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| Intensity(SceneGraphType.intensity);

let create = value => Intensity(value);

let value = intensity =>
switch (intensity) {
| Intensity(value) => value
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let unsafeGet = () => {
DpContainer.unsafeGetWebGPURayTracingDp();
};

let set = (dp: IWebGPURayTracingDp.webgpuRayTracing) => {
WebGPURayTracingDpApService.set(dp);
};
19 changes: 19 additions & 0 deletions src/construct/external_layer/api/domain/DirectionLightRunAPI.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let getColor = light => {
DirectionLightApService.getColor(light);
};

let getIntensity = light => {
DirectionLightApService.getIntensity(light);
};

let getAllLights = (sceneGameObject) => {
DirectionLightApService.getAllLights(sceneGameObject);
};

let getDirection = light => {
DirectionLightApService.getDirection(light);
};

let getLightCount = (sceneGameObject) => {
DirectionLightApService.getLightCount(sceneGameObject);
};
5 changes: 2 additions & 3 deletions src/run/application_layer/DirectorCPApService.re
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ let _injectDependencies = () => {
});
};

// let prepare = (~pictureSize, ~sampleCount) => {
let prepare = (~pictureSize) => {
let prepare = (~pictureSize, ~sampleCount) => {
_injectDependencies();

PictureCPDoService.setSize(pictureSize);
// PassCPDoService.setSampleCount(sampleCount);
PassCPDoService.setSampleCount(sampleCount);
};

let _parseAndSetPipelineStream = pipelineData => {
Expand Down
Loading

0 comments on commit 3a410a0

Please sign in to comment.