Skip to content

Commit

Permalink
feat(architecture): add UpdateTextureArrayCPJobEntity
Browse files Browse the repository at this point in the history
pass unit test;
  • Loading branch information
yyc-git committed Oct 30, 2020
1 parent b69eb34 commit 6ea4ed7
Show file tree
Hide file tree
Showing 46 changed files with 2,316 additions and 66 deletions.
3 changes: 3 additions & 0 deletions src/construct/application_layer/asset/AssetApService.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let getImageData = id => {
OperateImageDoService.getData(id);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let set = dp => {
DpContainer.setImageRepoDp(dp);
};
53 changes: 53 additions & 0 deletions src/construct/application_layer/scene/BSDFMaterialApService.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
let getDiffuseColor = material => {
OperateBSDFMaterialDoService.getDiffuseColor(material);
};

let getSpecular = material => {
OperateBSDFMaterialDoService.getSpecular(material);
};

let getSpecularColor = material => {
OperateBSDFMaterialDoService.getSpecularColor(material);
};

let getRoughness = material => {
OperateBSDFMaterialDoService.getRoughness(material);
};

let getMetalness = material => {
OperateBSDFMaterialDoService.getMetalness(material);
};

let getTransmission = material => {
OperateBSDFMaterialDoService.getTransmission(material);
};

let getIOR = material => {
OperateBSDFMaterialDoService.getIOR(material);
};

let getDiffuseMapImageId = material => {
OperateBSDFMaterialDoService.getDiffuseMapImageId(material);
};

let getChannelRoughnessMetallicMapImageId = material => {
OperateBSDFMaterialDoService.getChannelRoughnessMetallicMapImageId(
material,
);
};

let getEmissionMapImageId = material => {
OperateBSDFMaterialDoService.getEmissionMapImageId(material);
};

let getNormalMapImageId = material => {
OperateBSDFMaterialDoService.getNormalMapImageId(material);
};

let getTransmissionMapImageId = material => {
OperateBSDFMaterialDoService.getTransmissionMapImageId(material);
};

let getSpecularMapImageId = material => {
OperateBSDFMaterialDoService.getSpecularMapImageId(material);
};
16 changes: 12 additions & 4 deletions src/construct/application_layer/scene/GameObjectApService.re
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
let getAllRenderGameObjects = sceneGameObject => {
AllRenderGameObjectsDoService.getAllRenderGameObjects(sceneGameObject);
};

let getTransform = gameObject => {
GetComponentGameObjectDoService.getTransform(gameObject);
};
Expand All @@ -17,3 +13,15 @@ let getBasicCameraView = gameObject => {
let getPerspectiveCameraProjection = gameObject => {
GetComponentGameObjectDoService.getPerspectiveCameraProjection(gameObject);
};

let getBSDFMaterial = gameObject => {
GetComponentGameObjectDoService.getBSDFMaterial(gameObject);
};

let getAllRenderGameObjects = sceneGameObject => {
AllRenderGameObjectsDoService.getAllRenderGameObjects(sceneGameObject);
};

let getAllRenderBSDFMaterials = (sceneGameObject) => {
AllRenderGameObjectsDoService.getAllRenderBSDFMaterials(sceneGameObject);
};
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
let load = LoadWebGPUDoService.load;
let load = LoadWebGPUDoService.load;

let getTextureArrayLayerSize = TextureArrayWebGPUDoService.getTextureArrayLayerSize;
18 changes: 15 additions & 3 deletions src/construct/domain_layer/dependency/container/DpContainer.re
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
type t = {
mutable config: option(IConfigDp.config),
mutable sceneGraphRepo: option(ISceneGraphRepoDp.sceneGraphRepo),
mutable imageRepo: option(IImageRepoDp.imageRepo),
mutable timeRepo: option(ITimeRepoDp.timeRepo),
mutable pipelineRepo: option(IPipelineRepoDp.pipelineRepo),
mutable time: option(ITimeDp.time),
Expand All @@ -12,6 +13,7 @@ let dpContainer = {
config: None,
sceneGraphRepo: None,
timeRepo: None,
imageRepo: None,
pipelineRepo: None,
time: None,
webgpuCore: None,
Expand Down Expand Up @@ -44,9 +46,9 @@ let unsafeGetTransformRepoDp = () => {
_unsafeGetSceneGraphRepoDp().transformRepo;
};

// let unsafeGetBSDFMaterialRepoDp = () => {
// _unsafeGetSceneGraphRepoDp().bsdfMaterialRepo;
// };
let unsafeGetBSDFMaterialRepoDp = () => {
_unsafeGetSceneGraphRepoDp().bsdfMaterialRepo;
};

// let unsafeGetGeometryRepoDp = () => {
// _unsafeGetSceneGraphRepoDp().geometryRepo;
Expand Down Expand Up @@ -123,3 +125,13 @@ let setWebGPURayTracingDp = dp => {

();
};

let unsafeGetImageRepoDp = () => {
dpContainer.imageRepo->OptionSt.unsafeGet;
};

let setImageRepoDp = dp => {
dpContainer.imageRepo = dp->Some;

();
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
open ImageRepoType;

type imageRepo = {getData: id => option(data)};
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ type sceneRepo = {getSceneGameObject: unit => sceneGameObject};

type gameObjectRepo = {
getTransform: gameObject => option(transform),
// getBSDFMaterial: gameObject => option(bsdfMaterial),
getBSDFMaterial: gameObject => option(bsdfMaterial),
// getGeometry: gameObject => option(geometry),
getDirectionLight: gameObject => option(directionLight),
getBasicCameraView: gameObject => option(basicCameraView),
getPerspectiveCameraProjection:
gameObject => option(perspectiveCameraProjection),
getAllGeometryGameObjects: sceneGameObject => list(gameObject),
// getAllGameObjectGeometries: gameObject => list(geometry),
// getAllGameObjectBSDFMaterials: gameObject => list(bsdfMaterial),
// getAllGameObjectGeometries: sceneGameObject => list(geometry),
getAllGameObjectBSDFMaterials: sceneGameObject => list(bsdfMaterial),
};

type transformRepo = {
Expand Down Expand Up @@ -47,28 +47,29 @@ type perspectiveCameraProjectionRepo = {
getFar: perspectiveCameraProjection => float,
};

// type bsdfMaterialRepo = {
// getDiffuseColor: bsdfMaterial => diffuse,
// getSpecular: bsdfMaterial => float,
// getSpecularColor: bsdfMaterial => specularColor,
// getRoughness: bsdfMaterial => float,
// getMetalness: bsdfMaterial => float,
// getTransmission: bsdfMaterial => float,
// getIOR: bsdfMaterial => float,
// getDiffuseMapImageId: bsdfMaterial => option(ImagePOType.id),
// getChannelRoughnessMetallicMapImageId:
// bsdfMaterial => option(ImagePOType.id),
// getEmissionMapImageId: bsdfMaterial => option(ImagePOType.id),
// getNormalMapImageId: bsdfMaterial => option(ImagePOType.id),
// getTransmissionMapImageId: bsdfMaterial => option(ImagePOType.id),
// getSpecularMapImageId: bsdfMaterial => option(ImagePOType.id),
// };
type bsdfMaterialRepo = {
getDiffuseColor: bsdfMaterial => diffuse,
getSpecular: bsdfMaterial => float,
getSpecularColor: bsdfMaterial => specularColor,
getRoughness: bsdfMaterial => float,
getMetalness: bsdfMaterial => float,
getTransmission: bsdfMaterial => float,
getIOR: bsdfMaterial => float,
getDiffuseMapImageId: bsdfMaterial => option(ImageRepoType.id),
getChannelRoughnessMetallicMapImageId:
bsdfMaterial => option(ImageRepoType.id),
getEmissionMapImageId: bsdfMaterial => option(ImageRepoType.id),
getNormalMapImageId: bsdfMaterial => option(ImageRepoType.id),
getTransmissionMapImageId: bsdfMaterial => option(ImageRepoType.id),
getSpecularMapImageId: bsdfMaterial => option(ImageRepoType.id),
};

type sceneGraphRepo = {
sceneRepo,
transformRepo,
directionLightRepo,
basicCameraViewRepo,
perspectiveCameraProjectionRepo,
bsdfMaterialRepo,
gameObjectRepo,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type id = string;

type data = {
width: int,
height: int,
data: Js.Typed_array.Uint8Array.t,
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ type basicCameraView;

type perspectiveCameraProjection;

type bsdfMaterial;

type position = (float, float, float);

type rotation = (float, float, float, float);
Expand Down Expand Up @@ -37,3 +39,15 @@ type fovy = float;
type viewWorldToCameraMatrix = Js.Typed_array.Float32Array.t;

type projectionMatrix = Js.Typed_array.Float32Array.t;

type diffuse = color3;

type specularColor = color3;

type imageId = string;

type imageData = {
width: int,
height: int,
data: Js.Typed_array.Uint8Array.t,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let getData = id => {
DpContainer.unsafeGetImageRepoDp().getData(id->ImageIdVO.value);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| ImageId(ImageRepoType.id);

let create = value => ImageId(value);

let value = id =>
switch (id) {
| ImageId(value) => value
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| BSDFMaterial(SceneGraphType.bsdfMaterial);

let create = index => BSDFMaterial(index);

let value = bsdfMaterial =>
switch (bsdfMaterial) {
| BSDFMaterial(index) => index
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
let getDiffuseColor = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getDiffuseColor(
material->BSDFMaterialEntity.value,
)
->Color3VO.create
->DiffuseVO.create;

let getSpecular = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getSpecular(
material->BSDFMaterialEntity.value,
)
->SpecularVO.create;

let getSpecularColor = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getSpecularColor(
material->BSDFMaterialEntity.value,
)
->Color3VO.create
->SpecularColorVO.create;

let getRoughness = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getRoughness(
material->BSDFMaterialEntity.value,
)
->RoughnessVO.create;

let getMetalness = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getMetalness(
material->BSDFMaterialEntity.value,
)
->MetalnessVO.create;

let getTransmission = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getTransmission(
material->BSDFMaterialEntity.value,
)
->TransmissionVO.create;

let getIOR = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getIOR(
material->BSDFMaterialEntity.value,
)
->IORVO.create;

let getDiffuseMapImageId = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getDiffuseMapImageId(
material->BSDFMaterialEntity.value,
)
->OptionSt.map(ImageIdVO.create);

let getChannelRoughnessMetallicMapImageId = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().
getChannelRoughnessMetallicMapImageId(
material->BSDFMaterialEntity.value,
)
->OptionSt.map(ImageIdVO.create);

let getEmissionMapImageId = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getEmissionMapImageId(
material->BSDFMaterialEntity.value,
)
->OptionSt.map(ImageIdVO.create);

let getNormalMapImageId = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getNormalMapImageId(
material->BSDFMaterialEntity.value,
)
->OptionSt.map(ImageIdVO.create);

let getTransmissionMapImageId = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getTransmissionMapImageId(
material->BSDFMaterialEntity.value,
)
->OptionSt.map(ImageIdVO.create);

let getSpecularMapImageId = material =>
DpContainer.unsafeGetBSDFMaterialRepoDp().getSpecularMapImageId(
material->BSDFMaterialEntity.value,
)
->OptionSt.map(ImageIdVO.create);
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ let getAllRenderGameObjects = sceneGameObject => {
};

// let getAllRenderGeometries = () => {
// DpContainer.unsafeGetGameObjectRepoDp().getAllGameObjectGeometries()
// DpContainer.unsafeGetGameObjectRepoDp().getAllGameObjectGeometries(
// sceneGameObject->GameObjectEntity.value,
// )
// ->ListSt.map(GeometryEntity.create);
// };

// let getAllRenderBSDFMaterials = () => {
// DpContainer.unsafeGetGameObjectRepoDp().getAllGameObjectBSDFMaterials()
// ->ListSt.map(BSDFMaterialEntity.create);
// };
let getAllRenderBSDFMaterials = sceneGameObject => {
DpContainer.unsafeGetGameObjectRepoDp().getAllGameObjectBSDFMaterials(
sceneGameObject->GameObjectEntity.value,
)
->ListSt.map(BSDFMaterialEntity.create);
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ let getPerspectiveCameraProjection = gameObject =>
gameObject->GameObjectEntity.value,
)
->OptionSt.map(PerspectiveCameraProjectionEntity.create);

let getBSDFMaterial = gameObject =>
DpContainer.unsafeGetGameObjectRepoDp().getBSDFMaterial(
gameObject->GameObjectEntity.value,
)
->OptionSt.map(BSDFMaterialEntity.create);
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type t =
| Diffuse(Color3VO.t);

let create = value => Diffuse(value);

let value = color =>
switch (color) {
| Diffuse(value) => value
};

let getPrimitiveValue = color => color->value->Color3VO.value;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t =
| IOR(float);

let create = value => IOR(value);

let value = ior =>
switch (ior) {
| IOR(value) => value
};
Loading

0 comments on commit 6ea4ed7

Please sign in to comment.