Skip to content

Commit

Permalink
refactor(rename): rename Source to Image
Browse files Browse the repository at this point in the history
  • Loading branch information
yyc-git committed Sep 27, 2020
1 parent f2abb26 commit a228e8d
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 97 deletions.
Empty file modified src/construct/application_layer/asset/AssetApService.re
100644 → 100755
Empty file.
Empty file.
16 changes: 8 additions & 8 deletions src/construct/application_layer/scene/PBRMaterialApService.re
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ let setMetalness = (material, metalness) => {
OperatePBRMaterialDoService.setMetalness(material, metalness);
};

let setDiffuseMapSourceId = (material, id) => {
OperatePBRMaterialDoService.setDiffuseMapSourceId(material, id);
let setDiffuseMapImageId = (material, id) => {
OperatePBRMaterialDoService.setDiffuseMapImageId(material, id);
};

let setMetalRoughnessMapSourceId = (material, id) => {
OperatePBRMaterialDoService.setMetalRoughnessMapSourceId(material, id);
let setMetalRoughnessMapImageId = (material, id) => {
OperatePBRMaterialDoService.setMetalRoughnessMapImageId(material, id);
};

let setEmissionMapSourceId = (material, id) => {
OperatePBRMaterialDoService.setEmissionMapSourceId(material, id);
let setEmissionMapImageId = (material, id) => {
OperatePBRMaterialDoService.setEmissionMapImageId(material, id);
};

let setNormalMapSourceId = (material, id) => {
OperatePBRMaterialDoService.setNormalMapSourceId(material, id);
let setNormalMapImageId = (material, id) => {
OperatePBRMaterialDoService.setNormalMapImageId(material, id);
};
16 changes: 8 additions & 8 deletions src/construct/domain_layer/dependency/interface/IRepoDp.re
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ type pbrMaterialRepo = {
setRoughness: (pbrMaterial, float) => Result.t2(unit),
getMetalness: pbrMaterial => float,
setMetalness: (pbrMaterial, float) => Result.t2(unit),
getDiffuseMapSourceId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setDiffuseMapSourceId: (pbrMaterial, ImagePOType.id) => unit,
getMetalRoughnessMapSourceId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setMetalRoughnessMapSourceId: (pbrMaterial, ImagePOType.id) => unit,
getEmissionMapSourceId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setEmissionMapSourceId: (pbrMaterial, ImagePOType.id) => unit,
getNormalMapSourceId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setNormalMapSourceId: (pbrMaterial, ImagePOType.id) => unit,
getDiffuseMapImageId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setDiffuseMapImageId: (pbrMaterial, ImagePOType.id) => unit,
getMetalRoughnessMapImageId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setMetalRoughnessMapImageId: (pbrMaterial, ImagePOType.id) => unit,
getEmissionMapImageId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setEmissionMapImageId: (pbrMaterial, ImagePOType.id) => unit,
getNormalMapImageId: pbrMaterial => Js.Nullable.t(ImagePOType.id),
setNormalMapImageId: (pbrMaterial, ImagePOType.id) => unit,
};

type geometryRepo = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,57 +51,57 @@ let setMetalness = (material, metalness) => {
);
};

let getDiffuseMapSourceId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getDiffuseMapSourceId(
let getDiffuseMapImageId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getDiffuseMapImageId(
material->PBRMaterialEntity.value,
)
->OptionSt.fromNullable
->OptionSt.map(ImageIdVO.create);

let setDiffuseMapSourceId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setDiffuseMapSourceId(
let setDiffuseMapImageId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setDiffuseMapImageId(
material->PBRMaterialEntity.value,
id->ImageIdVO.value,
);
};

let getMetalRoughnessMapSourceId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getMetalRoughnessMapSourceId(
let getMetalRoughnessMapImageId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getMetalRoughnessMapImageId(
material->PBRMaterialEntity.value,
)
->OptionSt.fromNullable
->OptionSt.map(ImageIdVO.create);

let setMetalRoughnessMapSourceId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setMetalRoughnessMapSourceId(
let setMetalRoughnessMapImageId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setMetalRoughnessMapImageId(
material->PBRMaterialEntity.value,
id->ImageIdVO.value,
);
};

let getEmissionMapSourceId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getEmissionMapSourceId(
let getEmissionMapImageId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getEmissionMapImageId(
material->PBRMaterialEntity.value,
)
->OptionSt.fromNullable
->OptionSt.map(ImageIdVO.create);

let setEmissionMapSourceId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setEmissionMapSourceId(
let setEmissionMapImageId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setEmissionMapImageId(
material->PBRMaterialEntity.value,
id->ImageIdVO.value,
);
};

let getNormalMapSourceId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getNormalMapSourceId(
let getNormalMapImageId = material =>
DpContainer.unsafeGetPBRMaterialRepoDp().getNormalMapImageId(
material->PBRMaterialEntity.value,
)
->OptionSt.fromNullable
->OptionSt.map(ImageIdVO.create);

let setNormalMapSourceId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setNormalMapSourceId(
let setNormalMapImageId = (material, id) => {
DpContainer.unsafeGetPBRMaterialRepoDp().setNormalMapImageId(
material->PBRMaterialEntity.value,
id->ImageIdVO.value,
);
Expand Down
16 changes: 8 additions & 8 deletions src/construct/external_layer/api/run/domain/PBRMaterialRunAPI.re
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ let setMetalness = (material, metalness) => {
PBRMaterialApService.setMetalness(material, metalness);
};

let setDiffuseMapSourceId = (material, id) => {
PBRMaterialApService.setDiffuseMapSourceId(material, id);
let setDiffuseMapImageId = (material, id) => {
PBRMaterialApService.setDiffuseMapImageId(material, id);
};

let setMetalRoughnessMapSourceId = (material, id) => {
PBRMaterialApService.setMetalRoughnessMapSourceId(material, id);
let setMetalRoughnessMapImageId = (material, id) => {
PBRMaterialApService.setMetalRoughnessMapImageId(material, id);
};

let setEmissionMapSourceId = (material, id) => {
PBRMaterialApService.setEmissionMapSourceId(material, id);
let setEmissionMapImageId = (material, id) => {
PBRMaterialApService.setEmissionMapImageId(material, id);
};

let setNormalMapSourceId = (material, id) => {
PBRMaterialApService.setNormalMapSourceId(material, id);
let setNormalMapImageId = (material, id) => {
PBRMaterialApService.setNormalMapImageId(material, id);
};
16 changes: 8 additions & 8 deletions src/run/cloud_picture/application_layer/DirectorCPApService.re
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ let _injectDependencies = () => {
setRoughness: PBRMaterialCPRepoDp.setRoughness,
getMetalness: PBRMaterialCPRepoDp.getMetalness,
setMetalness: PBRMaterialCPRepoDp.setMetalness,
getDiffuseMapSourceId: PBRMaterialCPRepoDp.getDiffuseMapSourceId,
setDiffuseMapSourceId: PBRMaterialCPRepoDp.setDiffuseMapSourceId,
getMetalRoughnessMapSourceId: PBRMaterialCPRepoDp.getMetalRoughnessMapSourceId,
setMetalRoughnessMapSourceId: PBRMaterialCPRepoDp.setMetalRoughnessMapSourceId,
getEmissionMapSourceId: PBRMaterialCPRepoDp.getEmissionMapSourceId,
setEmissionMapSourceId: PBRMaterialCPRepoDp.setEmissionMapSourceId,
getNormalMapSourceId: PBRMaterialCPRepoDp.getNormalMapSourceId,
setNormalMapSourceId: PBRMaterialCPRepoDp.setNormalMapSourceId,
getDiffuseMapImageId: PBRMaterialCPRepoDp.getDiffuseMapImageId,
setDiffuseMapImageId: PBRMaterialCPRepoDp.setDiffuseMapImageId,
getMetalRoughnessMapImageId: PBRMaterialCPRepoDp.getMetalRoughnessMapImageId,
setMetalRoughnessMapImageId: PBRMaterialCPRepoDp.setMetalRoughnessMapImageId,
getEmissionMapImageId: PBRMaterialCPRepoDp.getEmissionMapImageId,
setEmissionMapImageId: PBRMaterialCPRepoDp.setEmissionMapImageId,
getNormalMapImageId: PBRMaterialCPRepoDp.getNormalMapImageId,
setNormalMapImageId: PBRMaterialCPRepoDp.setNormalMapImageId,
},
geometryRepo: {
getMaxIndex: GeometryCPRepoDp.getMaxIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ let createPO = () => {
defaultMetalness,
gameObjectsMap:
CreateMapComponentCPRepoUtils.createEmptyMap(pbrMaterialCount),
diffuseMapSourceIdMap:
diffuseMapImageIdMap:
CreateMapComponentCPRepoUtils.createEmptyMap(pbrMaterialCount),
metalRoughnessMapSourceIdMap:
metalRoughnessMapImageIdMap:
CreateMapComponentCPRepoUtils.createEmptyMap(pbrMaterialCount),
emissionMapSourceIdMap:
emissionMapImageIdMap:
CreateMapComponentCPRepoUtils.createEmptyMap(pbrMaterialCount),
normalMapSourceIdMap:
normalMapImageIdMap:
CreateMapComponentCPRepoUtils.createEmptyMap(pbrMaterialCount),
}: PBRMaterialCPPOType.pbrMaterial
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ type pbrMaterial = {
defaultRoughness: float,
defaultMetalness: float,
gameObjectsMap: ComponentCPPOType.gameObjectsMap,
diffuseMapSourceIdMap:
diffuseMapImageIdMap:
ImmutableSparseMap.t(PBRMaterialPOType.pbrMaterial, ImagePOType.id),
metalRoughnessMapSourceIdMap:
metalRoughnessMapImageIdMap:
ImmutableSparseMap.t(PBRMaterialPOType.pbrMaterial, ImagePOType.id),
emissionMapSourceIdMap:
emissionMapImageIdMap:
ImmutableSparseMap.t(PBRMaterialPOType.pbrMaterial, ImagePOType.id),
normalMapSourceIdMap:
normalMapImageIdMap:
ImmutableSparseMap.t(PBRMaterialPOType.pbrMaterial, ImagePOType.id),
};
Original file line number Diff line number Diff line change
Expand Up @@ -83,63 +83,63 @@ let setMetalness = (material, metalness) => {
);
};

let getDiffuseMapSourceId = material => {
CPRepo.getExnPBRMaterial().diffuseMapSourceIdMap
let getDiffuseMapImageId = material => {
CPRepo.getExnPBRMaterial().diffuseMapImageIdMap
->ImmutableSparseMap.getNullable(material);
};

let setDiffuseMapSourceId = (material, id) => {
let {diffuseMapSourceIdMap} as materialPO = CPRepo.getExnPBRMaterial();
let setDiffuseMapImageId = (material, id) => {
let {diffuseMapImageIdMap} as materialPO = CPRepo.getExnPBRMaterial();

CPRepo.setPBRMaterial({
...materialPO,
diffuseMapSourceIdMap:
diffuseMapSourceIdMap->ImmutableSparseMap.set(material, id),
diffuseMapImageIdMap:
diffuseMapImageIdMap->ImmutableSparseMap.set(material, id),
});
};

let getMetalRoughnessMapSourceId = material => {
CPRepo.getExnPBRMaterial().metalRoughnessMapSourceIdMap
let getMetalRoughnessMapImageId = material => {
CPRepo.getExnPBRMaterial().metalRoughnessMapImageIdMap
->ImmutableSparseMap.getNullable(material);
};

let setMetalRoughnessMapSourceId = (material, id) => {
let {metalRoughnessMapSourceIdMap} as materialPO =
let setMetalRoughnessMapImageId = (material, id) => {
let {metalRoughnessMapImageIdMap} as materialPO =
CPRepo.getExnPBRMaterial();

CPRepo.setPBRMaterial({
...materialPO,
metalRoughnessMapSourceIdMap:
metalRoughnessMapSourceIdMap->ImmutableSparseMap.set(material, id),
metalRoughnessMapImageIdMap:
metalRoughnessMapImageIdMap->ImmutableSparseMap.set(material, id),
});
};

let getEmissionMapSourceId = material => {
CPRepo.getExnPBRMaterial().emissionMapSourceIdMap
let getEmissionMapImageId = material => {
CPRepo.getExnPBRMaterial().emissionMapImageIdMap
->ImmutableSparseMap.getNullable(material);
};

let setEmissionMapSourceId = (material, id) => {
let {emissionMapSourceIdMap} as materialPO = CPRepo.getExnPBRMaterial();
let setEmissionMapImageId = (material, id) => {
let {emissionMapImageIdMap} as materialPO = CPRepo.getExnPBRMaterial();

CPRepo.setPBRMaterial({
...materialPO,
emissionMapSourceIdMap:
emissionMapSourceIdMap->ImmutableSparseMap.set(material, id),
emissionMapImageIdMap:
emissionMapImageIdMap->ImmutableSparseMap.set(material, id),
});
};

let getNormalMapSourceId = material => {
CPRepo.getExnPBRMaterial().normalMapSourceIdMap
let getNormalMapImageId = material => {
CPRepo.getExnPBRMaterial().normalMapImageIdMap
->ImmutableSparseMap.getNullable(material);
};

let setNormalMapSourceId = (material, id) => {
let {normalMapSourceIdMap} as materialPO = CPRepo.getExnPBRMaterial();
let setNormalMapImageId = (material, id) => {
let {normalMapImageIdMap} as materialPO = CPRepo.getExnPBRMaterial();

CPRepo.setPBRMaterial({
...materialPO,
normalMapSourceIdMap:
normalMapSourceIdMap->ImmutableSparseMap.set(material, id),
normalMapImageIdMap:
normalMapImageIdMap->ImmutableSparseMap.set(material, id),
});
};
8 changes: 4 additions & 4 deletions test/construct/tool/scene/PBRMaterialTool.re
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ let truncateColor = color => {
->createDiffuseColor;
};

let getDiffuseMapSourceId = OperatePBRMaterialDoService.getDiffuseMapSourceId;
let getDiffuseMapImageId = OperatePBRMaterialDoService.getDiffuseMapImageId;

let getMetalRoughnessMapSourceId = OperatePBRMaterialDoService.getMetalRoughnessMapSourceId;
let getMetalRoughnessMapImageId = OperatePBRMaterialDoService.getMetalRoughnessMapImageId;

let getEmissionMapSourceId = OperatePBRMaterialDoService.getEmissionMapSourceId;
let getEmissionMapImageId = OperatePBRMaterialDoService.getEmissionMapImageId;

let getNormalMapSourceId = OperatePBRMaterialDoService.getNormalMapSourceId;
let getNormalMapImageId = OperatePBRMaterialDoService.getNormalMapImageId;
26 changes: 13 additions & 13 deletions test/construct/unit/scene/component/PBRMaterial_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -146,59 +146,59 @@ let _ =
})
);

describe("set map's source id", () => {
describe("set map's image id", () => {
let _buildImageId = () => "image1"->ImageIdVO.create;

describe("setDiffuseMapSourceId", () => {
describe("setDiffuseMapImageId", () => {
test("set map's image id", () => {
let material = create()->ResultTool.getExnSuccessValue;
let id = _buildImageId();

setDiffuseMapSourceId(material, id);
setDiffuseMapImageId(material, id);

PBRMaterialTool.getDiffuseMapSourceId(material)
PBRMaterialTool.getDiffuseMapImageId(material)
->OptionSt.getExn
->expect
== id;
})
});

describe("setMetalRoughnessMapSourceId", () => {
describe("setMetalRoughnessMapImageId", () => {
test("set map's image id", () => {
let material = create()->ResultTool.getExnSuccessValue;
let id = _buildImageId();

setMetalRoughnessMapSourceId(material, id);
setMetalRoughnessMapImageId(material, id);

PBRMaterialTool.getMetalRoughnessMapSourceId(material)
PBRMaterialTool.getMetalRoughnessMapImageId(material)
->OptionSt.getExn
->expect
== id;
})
});

describe("setEmissionMapSourceId", () => {
describe("setEmissionMapImageId", () => {
test("set map's image id", () => {
let material = create()->ResultTool.getExnSuccessValue;
let id = _buildImageId();

setEmissionMapSourceId(material, id);
setEmissionMapImageId(material, id);

PBRMaterialTool.getEmissionMapSourceId(material)
PBRMaterialTool.getEmissionMapImageId(material)
->OptionSt.getExn
->expect
== id;
})
});

describe("setNormalMapSourceId", () => {
describe("setNormalMapImageId", () => {
test("set map's image id", () => {
let material = create()->ResultTool.getExnSuccessValue;
let id = _buildImageId();

setNormalMapSourceId(material, id);
setNormalMapImageId(material, id);

PBRMaterialTool.getNormalMapSourceId(material)
PBRMaterialTool.getNormalMapImageId(material)
->OptionSt.getExn
->expect
== id;
Expand Down

0 comments on commit a228e8d

Please sign in to comment.