Skip to content
Permalink
Browse files

feat(skybox): add skybox(by add job);

add and pass run test:examples->skybox;
update wonder-webgl version;
  • Loading branch information...
yyc-git committed May 11, 2019
1 parent 785be19 commit b1bd64f885b7a3e36d8d35ca646428e98f3741a1
Showing with 831 additions and 88 deletions.
  1. +3 −0 config/no_worker/job/init_jobs.json
  2. +3 −0 config/no_worker/job/loop_jobs.json
  3. +3 −0 config/no_worker/pipeline/init_pipelines.json
  4. +3 −0 config/no_worker/pipeline/loop_pipelines.json
  5. +29 −0 config/render/shader/shader_libs.json
  6. +16 −0 config/render/shader/shaders.json
  7. BIN examples/asset/image/skybox/nx.jpg
  8. BIN examples/asset/image/skybox/ny.jpg
  9. BIN examples/asset/image/skybox/nz.jpg
  10. BIN examples/asset/image/skybox/px.jpg
  11. BIN examples/asset/image/skybox/py.jpg
  12. BIN examples/asset/image/skybox/pz.jpg
  13. +3 −0 examples/config/no_worker/job/init_jobs.json
  14. +3 −0 examples/config/no_worker/job/loop_jobs.json
  15. +3 −0 examples/config/no_worker/pipeline/init_pipelines.json
  16. +3 −0 examples/config/no_worker/pipeline/loop_pipelines.json
  17. +29 −0 examples/config/render/shader/shader_libs.json
  18. +16 −0 examples/config/render/shader/shaders.json
  19. +137 −0 examples/skybox/index.html
  20. +2 −2 package.json
  21. +4 −0 src/Index.re
  22. 0 src/api/jiehuo/JieHuoAPI.re
  23. +29 −1 src/api/jobData/JobDataAPI.re
  24. +31 −0 src/glsl/ShaderChunkSystem.re
  25. +8 −0 src/glsl/skybox/webgl1_skybox_fragment.glsl
  26. +11 −0 src/glsl/skybox/webgl1_skybox_vertex.glsl
  27. +2 −0 src/job/no_worker/NoWorkerJobHandleSystem.re
  28. +60 −0 src/job/no_worker/init/InitSkyboxJob.re
  29. +7 −49 src/job/no_worker/loop/DrawOutlineJob.re
  30. +280 −0 src/job/no_worker/loop/RenderSkyboxJob.re
  31. +34 −5 src/service/atom/Matrix4Service.re
  32. +17 −1 src/service/record/all/data/jobData/JobDataType.re
  33. +13 −12 src/service/record/all/data/sender/GLSLSenderType.re
  34. +6 −0 src/service/record/all/device/DeviceManagerService.re
  35. +11 −0 src/service/record/all/jobData/RecordJobDataService.re
  36. +10 −8 src/service/record/all/sender/SendUniformService.re
  37. +32 −8 ...ce/record/all/sender/uniform/no_material_shader/HandleNoMaterialShaderUniformConfigDataService.re
  38. +4 −1 src/service/record/render/jobData/OperateRenderJobDataService.re
  39. +6 −1 src/service/record/sub/get_render_data/data/GetRenderDataJobDataType.re
  40. +4 −0 src/service/state/render/get_render_data/CreateGetRenederDataSubStateRenderService.re
  41. +9 −0 src/service/state/sub/get_render_data/no_material_shader/GetSkyboxDataGetRenderDataService.re
@@ -46,5 +46,8 @@
},
{
"name": "init_script"
},
{
"name": "init_skybox"
}
]
@@ -57,5 +57,8 @@
},
{
"name": "render_imgui"
},
{
"name": "render_skybox"
}
]
@@ -49,6 +49,9 @@
},
{
"name": "init_script"
},
{
"name": "init_skybox"
}
]
}
@@ -52,6 +52,9 @@
},
{
"name": "render_imgui"
},
{
"name": "render_skybox"
}
]
}
@@ -619,6 +619,35 @@
}
]
},
{
"name": "skybox",
"glsls": [
{
"type": "vs",
"name": "webgl1_skybox_vertex"
},
{
"type": "fs",
"name": "webgl1_skybox_fragment"
}
],
"variables": {
"uniforms": [
{
"name": "u_skyboxCubeMapSampler",
"from": "no_material_shader",
"field": "skyboxCubeMap",
"type": "samplerCube"
},
{
"name": "u_skyboxVMatrix",
"from": "no_material_shader",
"field": "skyboxVMatrix",
"type": "mat4"
}
]
}
},
{
"name": "end",
"variables": {
@@ -215,6 +215,22 @@
"name": "end"
}
]
},
{
"name": "skybox",
"shader_libs": [
{
"type": "group",
"name": "top"
},
{
"name": "skybox"
},
{
"type": "group",
"name": "end"
}
]
}
]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -46,5 +46,8 @@
},
{
"name": "init_script"
},
{
"name": "init_skybox"
}
]
@@ -57,5 +57,8 @@
},
{
"name": "render_imgui"
},
{
"name": "render_skybox"
}
]
@@ -49,6 +49,9 @@
},
{
"name": "init_script"
},
{
"name": "init_skybox"
}
]
}
@@ -52,6 +52,9 @@
},
{
"name": "render_imgui"
},
{
"name": "render_skybox"
}
]
}
@@ -619,6 +619,35 @@
}
]
},
{
"name": "skybox",
"glsls": [
{
"type": "vs",
"name": "webgl1_skybox_vertex"
},
{
"type": "fs",
"name": "webgl1_skybox_fragment"
}
],
"variables": {
"uniforms": [
{
"name": "u_skyboxCubeMapSampler",
"from": "no_material_shader",
"field": "skyboxCubeMap",
"type": "samplerCube"
},
{
"name": "u_skyboxVMatrix",
"from": "no_material_shader",
"field": "skyboxVMatrix",
"type": "mat4"
}
]
}
},
{
"name": "end",
"variables": {
@@ -215,6 +215,22 @@
"name": "end"
}
]
},
{
"name": "skybox",
"shader_libs": [
{
"type": "group",
"name": "top"
},
{
"name": "skybox"
},
{
"type": "group",
"name": "end"
}
]
}
]
}
@@ -0,0 +1,137 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>skybox</title>
</head>

<body>
<script src="../../test/e2e/js/AssetTool.js"></script>
<script src="../../test/e2e/js/LightBoxesTool.js"></script>
<script src="../../test/e2e/js/PositionTool.js"></script>
<script src="../../test/e2e/js/LightTool.js"></script>
<script src="../../test/e2e/js/CameraTool.js"></script>
<script src="../../test/e2e/js/LightMaterialTool.js"></script>
<script src="../../dist/wd.js"></script>

<script>
window.onload = function () {
return AssetTool.loadConfig(["../config/setting.json", "../config/"], null, function () {
var nx = new Image();
nx.src = "../asset/image/skybox/nx.jpg";
nx.onload = () => {
var px = new Image();
px.src = "../asset/image/skybox/px.jpg";
px.onload = () => {
var ny = new Image();
ny.src = "../asset/image/skybox/ny.jpg";
ny.onload = () => {
var py = new Image();
py.src = "../asset/image/skybox/py.jpg";
py.onload = () => {
var nz = new Image();
nz.src = "../asset/image/skybox/nz.jpg";
nz.onload = () => {
var pz = new Image();
pz.src = "../asset/image/skybox/pz.jpg";
pz.onload = () => {
return initSample(
[
px, nx, py, ny, pz, nz
],
wd.unsafeGetState());
};
};
};
};
};
};
});
function initSample(
[
px, nx, py, ny, pz, nz
],
state
) {
var state = wd.setSkyboxImage(
[
px, nx, py, ny, pz, nz
], state
);
var [state, box] = LightBoxesTool.createBox(state);
var state = wd.setAmbientLightColor([0.2, 0.2, 0.2], state);
var [state, directionLightGameObject] = LightTool.createDirectionLight(state);
var transform = wd.unsafeGetGameObjectTransformComponent(directionLightGameObject, state);
var state = wd.setTransformLocalEulerAngles(transform, [0, 180, 0], state);
var [state, cameraGameObject] = LightBoxesTool.createCamera(state);
var [state, cameraController] = wd.createArcballCameraController(state);
var state =
wd.setArcballCameraControllerDistance(cameraController, 50, state);
var state =
wd.setArcballCameraControllerWheelSpeed(cameraController, 1, state);
var state = wd.addGameObjectArcballCameraControllerComponent(cameraGameObject, cameraController, state);
var state =
wd.bindArcballCameraControllerEvent(
cameraController, state
);
wd.startDirector(state);
}
};
</script>
</body>

</html>
@@ -75,11 +75,11 @@
"wonder-imgui": "^0.0.34",
"wonder-log": "^0.2.11",
"wonder-most-animation-frame": "0.0.3",
"wonder-webgl": "^0.0.7"
"wonder-webgl": "^0.0.9"
},
"resolutions": {
"wonder-log": "^0.2.11",
"wonder-webgl": "^0.0.7",
"wonder-webgl": "^0.0.9",
"wonder-commonlib": "0.2.31",
"wonder-bs-jest": "0.3.0",
"wonder-bs-puppeteer": "^0.1.6"
@@ -542,6 +542,10 @@ let useByShaderIndex = RenderJobAPI.useByShaderIndex;

let getShaderIndex = RenderJobAPI.getShaderIndex;

let setSkyboxNeedUpdateCubeTexture = JobDataAPI.setSkyboxNeedUpdateCubeTexture;

let setSkyboxImage = JobDataAPI.setSkyboxImage;

let setGameObjectsNeedDrawOutline = JobDataAPI.setGameObjectsNeedDrawOutline;

let setOutlineColor = JobDataAPI.setOutlineColor;
0 src/api/jiehuo/JieHuoAPI.re 100644 → 100755
No changes.
@@ -10,4 +10,32 @@ let setGameObjectsNeedDrawOutline = (gameObjectsNeedDrawOutline, state) =>
OperateOutlineDataJobDataMainService.setGameObjectsNeedDrawOutline(
gameObjectsNeedDrawOutline,
state,
);
);

let setSkyboxImage =
((pxImage, nxImage, pyImage, nyImage, pzImage, nzImage), state) => {
...state,
jobDataRecord: {
...state.jobDataRecord,
skyboxData: {
...state.jobDataRecord.skyboxData,
nxImage: Some(nxImage),
pxImage: Some(pxImage),
nyImage: Some(nyImage),
pyImage: Some(pyImage),
nzImage: Some(nzImage),
pzImage: Some(pzImage),
},
},
};

let setSkyboxNeedUpdateCubeTexture = (needUpdateCubeTexture, state) => {
...state,
jobDataRecord: {
...state.jobDataRecord,
skyboxData: {
...state.jobDataRecord.skyboxData,
needUpdateCubeTexture,
},
},
};

0 comments on commit b1bd64f

Please sign in to comment.
You can’t perform that action at this time.