* DONE build engine packages: engine basic + create scene package + render scene package + whole engine package(use first twos)


** DONE scene package:
api
init, update jobs

transform, camera, gameObject

add other apis


pass compile


** DONE refactor: rename extensionName to extensionProtocolName

meta3d-package
meta3d



** DONE engine basic package:
register work plugin root
register extensions:
engine basic, engine core, most, immutable? extension

engineCoreState = setIsDebug(engineCoreState, isDebug)





** DONE render package:
api
init(material, geometry), update jobs

accept canvas





use webgl, no worker
# use webgpu





** DONE whole engine package has create scene, render api:
api:
    init,update,render
    scene api:
        encapsulate to engine core state, service to meta3d state;

init:
invoke three packages' init;
engineCoreState = engineCoreService.init(engineCoreState, meta3dState)
run init pipeline

update:
run update pipeline

render:
run render pipeline




* DONE download whole engine package to use as a engine to draw a cube

engine whole package:
engine whole, engine core, immutable, most
packages




engine basic package:
register extensions:
# engine basic, engine core, most, immutable? extension
engine basic

root





engine render package:
register extensions:
webgl1, ...


# ** TODO feat(default): meta3d: if not has entry extension, error with info

** DONE fix(default): meta3d: loadPackage should get current package's entry extensionProtocolName

////should store package's entry extensionProtocolName when build package!


** DONE pass empty gameObject run test

# init

# loop








** DONE pass cube run test

add to RenderJob:
clearColor
clear
////diable depth

TODO repack scene,render,whole packages



# * TODO add edit view control implement by FBO
* TODO add view control implement(low level) for scene view by FBO

# provide init life handle

# can use to build scene view, game view high level custom controls



# one canvas-one view-one gl




# one canvas-one view-one gl-one engine state(meta3dState?)(encapsulate), contain scene view and game view

pro:
share textures

# encapsulate viewport logic


# config:
# viewRect

#   |> DeviceManagerEngineService.setViewport(viewRect)
#   |> DeviceManagerEngineService.setScissorTest(true)
#   |> DeviceManagerEngineService.setScissor(viewRect)





# add extension:
# engineForEditor
#     has engine state

# invoke engine api by engine whole package


directly use engine-whole package?
engine state is engineCoreState in meta3dState








add pipeline for editor
scene-view

init jobs

job1:
create and init each fbo's texture
set texture to textureId in ui state. map

(uiService add getContext)


job2:
add default gameObjects(one cube gameObject, one camera gameObject) to engine state and editorState->sceneView




# update jobs

render jobs:
job1: 
viewport
setScissor test
bindFramebuffer
clear
render scene view, game view to each fbo's texture
unbindFramebuffer


register in use-editor extension


use-editor extension:
_loop:
invoke work plugin's update, render before uiService.render(so can generate view texture before)

init:
invoke work plugin's init after uiService.init(so can get imgui context after)








canvas?


            # {
            #     rect,
            #     canvasId,
            #     # no children
            # }


# specific data:
# {
#         name: "canvasId",
#         type_: "string",
#         value: _generateUniqueId()
#     }


# ui component
as ui control:
View

window    ////(bar:Scene View)
children:
Image: 
get texture by uiService.getViewTexture(meta3dState, textureId) from meta3dState
# (if texture not exist(when in element assemble space), get default texture)
(if texture not exist(when in element assemble space), get null)


            {
                rect,
                label,
                textureId,
                # no children
            }


specific data:
{
        name: "label",
        type_: "string",
        # user change to Scene View
        value: "View"
    }
{
        name: "textureID",
        type_: "string",
        # value: _generateUniqueId()

        # TODO need user give:sceneView
        value: ""
    }





** DONE finish UIManager

# TODO pass compile
# TODO pass test

add test cases


** DONE finish view control

** DONE work plugin->execFunc should get meta3dState and return stream<meta3dState>

# TODO pass work plugin compile:
creategl
render,
...


** DONE finish work plugins

TODO finis meta3d-pipeline-editor-webgl1-scene-view


add pipeline for editor
scene-view

init jobs

job1:
create and init each fbo's texture
set texture to textureId in ui state. map


# job2:
add default gameObjects(one cube gameObject, one camera gameObject) to engine state and editorState->sceneView




update jobs:
job1:
update engine


  |> DeviceManagerEngineService.setViewport(viewRect)
  |> DeviceManagerEngineService.setScissorTest(true)
  |> DeviceManagerEngineService.setScissor(viewRect)

render jobs:
job1: 
viewport
setScissor test
bindFramebuffer
clear
render scene view, game view to each fbo's texture
unbindFramebuffer



** TODO edit ui control


# # *** TODO getContribute return add data

# # equal to rect + specific data

# # data should be build the same as build rect and specific data




# # # so can get viewRect by getUIControlFunc()(null, [{}, {}]).data.rect!
# # so can get viewRect by getUIControlData(meta3dState, "SceneView").rect!


# # TODO update ElementMRUtils

# # TODO update ui controls



# # # *** TODO remove scene-view ->inputData->textureID, move it to contributeData

# # *** DONE uiControlContribute add controlData type




# *** TODO update ui


# add prepare for invoke ui control's createState



# remove old data, set new data


# add getUIControlState

# update meta3d type


# add test cases




# *** TODO can edit uiControlName in UIControlInspector


# TODO update rect, specific


# TODO update ElementMRUtils

# invoke getUIControlState



# TODO update UIControlInspector



# *** TODO update ui controls and protocol->Config and meta3d

# meta3d:
# add removeUIControlContribute
# remove config ->...








*** DONE 


# TODO ui remove updateUIConname,prepare,uiControlStateMap

# TODO ui update by get from elementFuncMap[0]
# (check elementFuncMap.length === 1)



# TODO move uiControlName to ui control protocol->Index
# not has unique id


# TODO not edit uiControlName, use SceneView ui control instead
# remove textureID from specific


# TODO elementContribute add uiControlStates data

////TODO update element protocol 





/*
TODO Config add :
export let getUIControlState: getUIControlStateMeta3D = (rect, specific) => {
  return {
    rect: rect
  }
}

  TODO should define specific type in Index

    TODO type inputData = {
      rect:rect,
      ...specific
    }
  */





////TODO ElementMRUtils generate  uiControlStates

////if uiControlName exist, not set again


////TODO update meta3d, add getUIControlState





# TODO update ui

# add setUIControlState

# update getUIControlState from ui state



# TODO update view

# setUIControlState in func 



# TODO update meta3d-pipeline-editor-webgl1-scene-view

# add UpdateJob

# update other



# TODO update all ui controls


** DONE fix engine-render: remove creategl?



** DONE update use-editor extension





use-editor extension:
_loop:
invoke work plugin's update, render after uiService.render
# (so can generate view texture before)
(so can get view rect)

init:
register editor work plugin
how to get viewRect?

  get viewRect


# prepare
# should invoke ui.prepare



invoke engineWhole.prepare, work plugin's init after uiService.init(so can get imgui context after)




TODO refactor

** DONE separate engine whole package between editor and engine

pipeline-camera not dependent on meta3d-ui?

on -data


-data:
add GetViewRectJob in update pipeline




update data, camera

editor -> engine use own creategl, data 




refactor: add gl to data; get gl from data




TODO different engine-render, engine-whole package
  # engine-render, engine-whole extension not change
  engine-whole extension not change
  engine-render extension change




TODO update use-editor




** DONE refactor: work plugin webgl1 state: remove   pipelineWhichHasAllRenderComponentsName, ..., use protocol name instead



** DONE refactor: rename DepenentMapType -> ExtensionName, ContributeName to ExtensionProtolName, ContributeProtocolName

** DONE refactor: rename work plugin -> ExtensionName, ContributeName to ExtensionProtolName, ContributeProtocolName
e.g.  let {
		meta3dWebgl1ExtensionProtocolName,
		meta3dBsMostExtensionProtocolName,
		meta3dUIExtensionProtocolName,
	} = dependentMapData[0]



** DONE rename work plugin to meta3d-pipeline






** TODO run test

*** DONE update use-package2

*** DONE refactor: remove unused extensions, contributes, related protocols


*** DONE rebuild engine package for engine

# update related version
all should update version!

publish all


*** DONE pass engine whole package run test

caml_notequal?
cache?
  not about cache!


# *** TODO .gitignore add lib/



*** DONE rebuild engine whole package for editor

not has meta3d-ui extension!


*** TODO pass view run test


TODO prepare editor app assemble




**** DONE empty fbo: element->run

why button follow parent?


fix:
fbo texture rect error
event not match



**** DONE has fbo: element->run


meta3d-element-assemble-visual not change
(not know engine, only know ui)


TODO meta3d-element-assemble-visual-run:
known engine
encapsulate register editor pipelines to editor engine whole->prepare!




**** DONE published app

update use-editor version and publish


*** DONE feat: check: only has one scene view ui control

# in visual, visual-run, use-editor:
# check when register ui control?




*** DONE why publish new ui control version and reselect, dev server not update?

why extension not has this problem???


solution
should cancel loop when exit!

fix ElementVisual 

////fix RunElementVisual


# *** TODO feat: handle package's extension/contribute are the same as the ones registerd by editor app


# usage:
# debug by register the new version one and use it!!!






# # should warn(protocol name, protocol version, name, version) and register the newest protocol version
# should warn:
# # protocol name, protocol version, name, version already exist, but wish to be set to protocol name, protocol version, name, version
# protocol name, protocol version already exist, but wish to be set to protocol version! 
# use protocol version finally!


# # and register the newest protocol version and newest version?
# # and register the newest protocol version?
# and register the newest protocol version or newest version with the same protocol version?


# if implement name not the same, error
# else, warn



# handle register extension:
# implement



# bdd test:
# test meta3d

# test assemble space






# run test





# TODO handle register contribute




*** DONE feat: check is register




////*** TODO fix: Extensions/Contributes should show only one!


*** DONE style: 

*** DONE fix: why not has webgl1 extension?

should check dependent when load!



*** DONE fix imgui

test in imgui example first!


**** DONE fix: run-scene view control : fix rect

create texture's size error?





# view rect error?



TODO fix: scene view control : fix pos with not 0



TODO change cube's transform to left-up side and run test






# **** TODO fix: scene view control : fix pos with not 0

**** DONE fix: scene view control should consider bar height






# **** TODO fix: child window should move along parent window


**** DONE pass element assemble run test








# * TODO feat: run element support scene view or no scene view


* DONE fix EnterApp, RunElementVisual: use jump url with param instead of store
so can refresh and not error!


* DONE feat: add a button to add a cube to scene view when run

no new geometry, material component;
only new gameObject, transform






# * TODO run test: add scene view based to show a cube + arcball camera



# * TODO run test: add scene view based on 3D view to show a cube + arcball camera + grid
# * TODO run test: add grid

# * TODO fix run loop not cancel bug


* TODO handle event


** DONE camera gameObject add arcball component

# add arcball api

# add arcball component

# bind event:
#   judge target in handle
#     provide by uiService


# TODO scene-view1 before update camera

** DONE handle event


# add InitEventJob
#   bind event on body


# add UpdateArcballCameraControllerJob

# handle region by target?




** DONE run test

# build render package

# build editor-engine-event package


# publish


# test










# * TODO feat: run element support only scene view(no game view) or scene view + game view


* DONE feat: add u_color


# * TODO refactor: use engine scene api in render pipeline
* DONE refactor: not use engine scene api in scene, render pipeline

* DONE refactor: arcball api remove getAllDirtyArcballCameraControllers, clearDirtyList


* DONE style: ui controls




# * TODO feat: element assemble: Pacakges should show loading...


# * TODO refactor: rename getGL to getGl??




# * TODO feat: run element support scene view or no scene view?




* TODO publish


# ** TODO clean and publish 0.10.0
** DONE clean and publish 0.9.10


# * TODO run test for 0.11.0 in dev
** DONE run test for Contract in dev

clear all old ones

# after publish 0.10.0
after publish 0.9.10

rebuild all engine packages

run test with isDebug:true




rebuild all editor engine packages


** DONE run test: download engine and use

# ** TODO run test: run, app

** DONE pass ci

TODO meta3d-event should pass

** DONE publish

*** DONE clean and publish 0.10.0 in pro

*** DONE update website and online

*** DONE build packages

*** DONE run test and record video

*** DONE write release
