Skip to content

Commit

Permalink
feat: pass run test: visual, visualRun, run app
Browse files Browse the repository at this point in the history
  • Loading branch information
yyc-git committed Nov 11, 2023
1 parent 8ad74b4 commit 49530e2
Show file tree
Hide file tree
Showing 41 changed files with 231 additions and 75 deletions.
19 changes: 17 additions & 2 deletions doc/0.21.0.org
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ TODO packages + actions(contributes) + uiControls(contributes) + uiControlInputs



**** TODO run test: Scene View
**** DONE run test: Scene View

TODO add engine-scene, core

Expand Down Expand Up @@ -302,6 +302,13 @@ TODO update editor-whole
TODO publish all


TODO need publish:
# editor whole
# sceneview render
# pipeline-camera
# meta3d-pipeline-webgl1-three-sceneviewrender


TODO pass run test:
visual
visualRun
Expand All @@ -311,6 +318,7 @@ runApp
# **** TODO run test: SceneTree+Scene View+ *Game View
**** TODO run test: Controller+Scene View


**** TODO run test: Controller+Scene View+ *Game View

TODO extract Three Render Package from Editor Whole Package for both Editor/Engine Whole Package
Expand All @@ -326,7 +334,14 @@ TODO feat:engine-core: add mark pipeline execOnce and exec/not exec for game vie



**** TODO fix: import app/package should keep package structure(sub, subsub, ... packages)
**** TODO feat: Selected Package: add start
TODO start entry extension


**** TODO fix: import app should keep package structure(sub, subsub, ... packages)


**** TODO fix: import package should keep package structure(sub, subsub, ... packages)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let getContribute: Meta3dType.Index.getContribute<
{
pipelineName: Meta3dPipelineRootProtocol.StateType.pipelineName,
createStateFunc: (meta3dState, _): Meta3dPipelineRootProtocol.StateType.state => {
let mostService: Meta3dBsMostProtocol.ServiceType.service = api.getExtensionService(.
let mostService: Meta3dBsMostProtocol.ServiceType.service = api.getExtensionService(.
meta3dState,
"meta3d-bs-most-protocol",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { state as meta3dState, extensionName } from "meta3d-type/src/Index"
import { actionName, actionContribute } from "../contribute/ActionContributeType"
import { state } from "../state/StateType"
import { customEvent, userData } from "./EventType.gen"
import { browser } from "./BrowserType.gen"
import { nullable } from "meta3d-commonlib-ts/src/nullable"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-editor-webgl1-three-engine-whole",
"version": "0.20.1",
"version": "0.20.4",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"protocol": {
"name": "meta3d-editor-whole-protocol"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let _registerEditorPipelines = (
) => {
let engineCoreService = getExn(api.getPackageService<coreService>(
meta3dState,
"meta3d-core-sceneview-protocol"
"meta3d-core-protocol"
)).engineCore(meta3dState)


Expand All @@ -52,7 +52,7 @@ let _registerEditorPipelines = (
{
pipelineName: pipelineRootPipeline.Init,
insertElementName: pipelineRootJob.Init,
insertAction: "before"
insertAction: "after"
}
]
)
Expand Down Expand Up @@ -219,7 +219,7 @@ let _execAllInitFuncs = (meta3dState, initFuncs, initData) => {

// return _func(meta3dState, initFuncs.count() - 1)

return reducePromise<meta3dState, initFunc>(initFuncs, (meta3dState, initFunc) => initFunc(meta3dState, initData), meta3dState)
return reducePromise<meta3dState, initFunc>(initFuncs.toArray(), (meta3dState, initFunc) => initFunc(meta3dState, initData), meta3dState)
}

let _loopEngine = (meta3dState: meta3dState, api: api) => {
Expand All @@ -241,7 +241,26 @@ let _handleError = (api: api, meta3dState: meta3dState) => {
)
}

let _update = (meta3dState, api: api, { clearColor, time, skinName }) => {
let _updateForVisual = (meta3dState, api: api, { clearColor, time, skinName }) => {
let { getSkin, render, clear, setStyle } = getExn(api.getPackageService<uiService>(meta3dState, "meta3d-ui-protocol"))

if (!isNullable(skinName)) {
let skin = getSkin<skin>(meta3dState, getExn(skinName))
if (!isNullable(skin)) {
meta3dState = setStyle(meta3dState, getExn(skin).skin.style)
}
}

meta3dState = clear(meta3dState, [api, "meta3d-imgui-renderer-protocol"], clearColor)

return render(meta3dState, ["meta3d-ui-protocol", "meta3d-imgui-renderer-protocol"], time)
.catch(e => {
_handleError(api, meta3dState)
throw e
})
}

let _updateForVisualRun = (meta3dState, api: api, { clearColor, time, skinName }) => {
let { getSkin, render, clear, setStyle } = getExn(api.getPackageService<uiService>(meta3dState, "meta3d-ui-protocol"))

if (!isNullable(skinName)) {
Expand All @@ -265,6 +284,8 @@ let _update = (meta3dState, api: api, { clearColor, time, skinName }) => {
})
}

let _updateForRun = _updateForVisualRun

let _prepareUIForRun = (meta3dState: meta3dState, api: api) => {
let { registerSkin, registerElement } = getExn(api.getPackageService<uiService>(meta3dState, "meta3d-ui-protocol"))

Expand Down Expand Up @@ -293,10 +314,8 @@ let _createAndInsertCanvas = ({ width, height }: canvasData) => {
return canvas
}

let _initForRun = (meta3dState: meta3dState, api: api, [canvasData, { isDebug }]: configData) => {
let _initForRun = (meta3dState: meta3dState, api: api, [_, { isDebug }]: configData, canvas: HTMLCanvasElement) => {
return _prepareUIForRun(meta3dState, api).then(meta3dState => {
let canvas = _createAndInsertCanvas(canvasData)

let uiService = getExn(api.getPackageService<uiService>(meta3dState, "meta3d-ui-protocol"))

return uiService.init(meta3dState, [api, "meta3d-imgui-renderer-protocol"], true, isDebug, canvas).then(meta3dState => {
Expand All @@ -317,10 +336,7 @@ let _loop = (
) => {
let [_, { skinName, clearColor }] = configData

return _update(meta3dState, api, { clearColor, time, skinName }).catch(e => {
_handleError(api, meta3dState)
throw e
}).then(meta3dState => {
return _updateForRun(meta3dState, api, { clearColor, time, skinName }).then(meta3dState => {
requestAnimationFrame(
(time) => {
_loop(api, meta3dState,
Expand Down Expand Up @@ -354,7 +370,14 @@ export let getExtensionService: getExtensionServiceMeta3D<
})
},
update: (meta3dState, updateData) => {
return _update(meta3dState, api, updateData)
switch (updateData.target) {
case "visual":
return _updateForVisual(meta3dState, api, updateData)
case "visualRun":
return _updateForVisualRun(meta3dState, api, updateData)
default:
throw new Error("error")
}
},
loadScene: (meta3dState, sceneGLB) => {
throw new Error("not implement")
Expand All @@ -379,7 +402,13 @@ export let getExtensionService: getExtensionServiceMeta3D<
return api.getPackageService(meta3dState, packageProtocolName)
},
run: (meta3dState: meta3dState, configData) => {
_initForRun(meta3dState, api, configData).catch(e => {
let [canvasData, { isDebug }] = configData

let canvas = _createAndInsertCanvas(canvasData)

_execAllInitFuncs(meta3dState, api.getExtensionState<state>(meta3dState, "meta3d-editor-whole-protocol").initFuncs, { isDebug, canvas }).then(meta3dState => {
return _initForRun(meta3dState, api, configData, canvas)
}).catch(e => {
_handleError(api, meta3dState)
throw e
}).then((meta3dState: meta3dState) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let _getAddedEvents = (eventSourcingService: eventSourcingService, meta3dState,
export let sync = (meta3dState: meta3dState, api: api) => {
let state = api.getExtensionState<state>(meta3dState, "meta3d-editor-whole-protocol")

let eventSourcingService = getExn(api.getPackageService<eventService>(meta3dState, "meta3d-event-sourcing-protocol")).eventSourcing(meta3dState)
let eventSourcingService = getExn(api.getPackageService<eventService>(meta3dState, "meta3d-event-protocol")).eventSourcing(meta3dState)

let promise = null
if (eventSourcingService.getNeedBackwardEvents(meta3dState).count() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,25 @@ gulp.task("publish_production_env", function (done) {
})
});

gulp.task("publishConfig_local_env", function (done) {
publish.publishExtensionProtocolConfig(
"local",
path.join(__dirname, "package.json"),
path.join(__dirname, "dist/static/js", "main.js")
).then(() => {
done()
})
});


gulp.task("publishConfig_production_env", function (done) {
publish.publishExtensionProtocolConfig(
"production",
path.join(__dirname, "package.json"),
path.join(__dirname, "dist/static/js", "main.js")
).then(() => {
done()
})
});


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1 -bs-package-output commonjs:lib/js:.bs.js -bs-package-output es6-global:lib/es6_global:.bs.js
bsconfig.json 0x1.9530ccdp+30
src 0x1.952c04f4p+30
src/service 0x1.9530c61p+30
src/state 0x1.952c04f4p+30
src/service 0x1.953bb464p+30
src/state 0x1.953bb464p+30
===
/Users/yang/Github/Meta3D/node_modules/rescript/darwin/rescript.exe 0x1.92f29018p+30
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Start(1699565298285)
#Done(1699565298336)
#Start(1699703055046)
#Done(1699703055095)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ninja log v6
0 18 1699565298301867764 src/service/ServiceType.ast 785165cefc5839bb
1 19 1699565298302564745 Meta3dEditorWholeProtocol.cmi 27dde7c45547adb8
18 24 1699565298309062812 src/service/ServiceType.d 702d225c4edca7ca
24 50 1699565298334502971 src/service/ServiceType-Meta3dEditorWholeProtocol.cmj 525caf1204e556b0
24 50 1699565298334502971 src/service/ServiceType-Meta3dEditorWholeProtocol.cmi 525caf1204e556b0
24 50 1699565298334502971 ../es6_global/src/service/ServiceType.bs.js 525caf1204e556b0
24 50 1699565298334502971 ../js/src/service/ServiceType.bs.js 525caf1204e556b0
0 18 1699703055062284363 src/service/ServiceType.ast 785165cefc5839bb
1 20 1699703055063225942 Meta3dEditorWholeProtocol.cmi 27dde7c45547adb8
18 30 1699703055075992776 src/service/ServiceType.d 702d225c4edca7ca
30 49 1699703055094225288 src/service/ServiceType-Meta3dEditorWholeProtocol.cmj e7c866b10982c5f9
30 49 1699703055094225288 src/service/ServiceType-Meta3dEditorWholeProtocol.cmi e7c866b10982c5f9
30 49 1699703055094225288 ../es6_global/src/service/ServiceType.bs.js e7c866b10982c5f9
30 49 1699703055094225288 ../js/src/service/ServiceType.bs.js e7c866b10982c5f9
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file modified ...meta3d-editor-whole-protocol/lib/bs/src/service/ServiceType-Meta3dEditorWholeProtocol.cmi
100755 → 100644
Binary file not shown.
Empty file.
Binary file modified ...meta3d-editor-whole-protocol/lib/bs/src/service/ServiceType-Meta3dEditorWholeProtocol.cmt
100755 → 100644
Binary file not shown.
Binary file modified ...ocols/extension_protocols/meta3d-editor-whole-protocol/lib/bs/src/service/ServiceType.ast
100755 → 100644
Binary file not shown.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
{
"name": "meta3d-editor-whole-protocol",
"version": "0.20.1",
"version": "0.20.3",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"description": "",
"author": "Wonder",
"license": "",
"scripts": {
"watch": "tsc -w -noEmit",
"meta3d:publish_dev": "gulp publish_local_env",
"meta3d:publish_pro": "gulp publish_production_env"
"webpack": "webpack --config webpack.config.js",
"meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publishConfig_local_env && gulp publish_local_env",
"meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publishConfig_production_env &&gulp publish_production_env"
},
"keywords": [],
"devDependencies": {
"typescript": "^4.2.3"
"clean-webpack-plugin": "^4.0.0",
"cross-env": "^7.0.3",
"cz-customizable": "^6.3.0",
"gulp": "^4.0.2",
"meta3d-tool-publish": "^0.20.0",
"source-map-loader": "^3.0.0",
"ts-loader": "^9.2.6",
"typescript": "^4.2.3",
"webpack": "^5.62.1",
"webpack-cli": "^4.9.1"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { getNeedConfigData as getNeedConfigDataMeta3D } from "meta3d-type/src/extension/StartExtensionProtocolConfigType"

export let getNeedConfigData: getNeedConfigDataMeta3D = () => {
return [
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ import { nullable } from "meta3d-commonlib-ts/src/nullable";
import { events } from "meta3d-event-sourcing-protocol/src/state/StateType"


export type initTarget = "visual" | "visualRun"
export type target = "visual" | "visualRun"

export type initData = {
target: initTarget,
target: target,
isDebug: boolean,
canvas: HTMLCanvasElement
}

export type updateData = { clearColor: [number, number, number, number], time: number, skinName: nullable<string> }
export type updateData = {
target: target,
clearColor: [number, number, number, number], time: number, skinName: nullable<string>
}

export type initDataForInitFunc = {
isDebug: boolean,
canvas: HTMLCanvasElement
}

export type initFunc = (meta3dState: meta3dState, initData: initData) => Promise<meta3dState>
export type initFunc = (meta3dState: meta3dState, initData: initDataForInitFunc) => Promise<meta3dState>

// export type func = (meta3dState: meta3dState) => Promise<meta3dState>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"resolveJsonModule": true,
"esModuleInterop": true,
"jsx": "react",
"noEmit": true,
"noUnusedLocals": true,
// "noEmit": true,
"noUnusedLocals": false,
"noUnusedParameters": true,
"noImplicitReturns": true,
"lib": [
"DOM",
"ESNext",
],
"types": [],
"strict": true
// "strict": true
},
"include": [
"./src"
Expand Down
Loading

0 comments on commit 49530e2

Please sign in to comment.