summaryrefslogtreecommitdiff
path: root/source/modules/asura-framework/scripts
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-29 22:51:04 +0800
committerchai <chaifix@163.com>2019-03-29 22:51:04 +0800
commitc302f5ae5f9e30a28e487e8a764d9cc31546bbea (patch)
tree7f18bedeece950600336ea7ced7c52c468552c98 /source/modules/asura-framework/scripts
parent157530b8b6e11efc5573d5a0db8987a440197aa1 (diff)
*rename
Diffstat (limited to 'source/modules/asura-framework/scripts')
-rw-r--r--source/modules/asura-framework/scripts/ai/behavior_tree.lua0
-rw-r--r--source/modules/asura-framework/scripts/ai/state_graph.lua11
-rw-r--r--source/modules/asura-framework/scripts/ai/state_machine.lua6
-rw-r--r--source/modules/asura-framework/scripts/audio/sound.lua9
-rw-r--r--source/modules/asura-framework/scripts/audio/source.lua22
-rw-r--r--source/modules/asura-framework/scripts/class.lua17
-rw-r--r--source/modules/asura-framework/scripts/component.lua30
-rw-r--r--source/modules/asura-framework/scripts/entity.lua114
-rw-r--r--source/modules/asura-framework/scripts/filesystem/animation_loader.lua10
-rw-r--r--source/modules/asura-framework/scripts/filesystem/asset.lua20
-rw-r--r--source/modules/asura-framework/scripts/filesystem/entity_loader.lua5
-rw-r--r--source/modules/asura-framework/scripts/filesystem/image_loader.lua13
-rw-r--r--source/modules/asura-framework/scripts/filesystem/loader.lua12
-rw-r--r--source/modules/asura-framework/scripts/filesystem/material_loader.lua7
-rw-r--r--source/modules/asura-framework/scripts/filesystem/path_loader.lua9
-rw-r--r--source/modules/asura-framework/scripts/filesystem/scene_loader.lua7
-rw-r--r--source/modules/asura-framework/scripts/filesystem/script_loader.lua5
-rw-r--r--source/modules/asura-framework/scripts/filesystem/shader_loader.lua5
-rw-r--r--source/modules/asura-framework/scripts/filesystem/statemap_loader.lua7
-rw-r--r--source/modules/asura-framework/scripts/framework.lua21
-rw-r--r--source/modules/asura-framework/scripts/graphics/animation.lua15
-rw-r--r--source/modules/asura-framework/scripts/graphics/animator.lua33
-rw-r--r--source/modules/asura-framework/scripts/graphics/camera.lua21
-rw-r--r--source/modules/asura-framework/scripts/graphics/canvas.lua34
-rw-r--r--source/modules/asura-framework/scripts/graphics/default_shaders.lua5
-rw-r--r--source/modules/asura-framework/scripts/graphics/image.lua40
-rw-r--r--source/modules/asura-framework/scripts/graphics/material.lua48
-rw-r--r--source/modules/asura-framework/scripts/graphics/material_manager.lua3
-rw-r--r--source/modules/asura-framework/scripts/graphics/mesh2d.lua9
-rw-r--r--source/modules/asura-framework/scripts/graphics/mesh2d_renderer.lua13
-rw-r--r--source/modules/asura-framework/scripts/graphics/particle_system.lua20
-rw-r--r--source/modules/asura-framework/scripts/graphics/renderer.lua19
-rw-r--r--source/modules/asura-framework/scripts/graphics/shader.lua75
-rw-r--r--source/modules/asura-framework/scripts/graphics/shaderHelper.lua14
-rw-r--r--source/modules/asura-framework/scripts/graphics/shape.lua12
-rw-r--r--source/modules/asura-framework/scripts/graphics/shape_renderer.lua13
-rw-r--r--source/modules/asura-framework/scripts/graphics/sprite.lua10
-rw-r--r--source/modules/asura-framework/scripts/graphics/sprite_batch_renderer.lua9
-rw-r--r--source/modules/asura-framework/scripts/graphics/sprite_renderer.lua14
-rw-r--r--source/modules/asura-framework/scripts/gui/button.lua21
-rw-r--r--source/modules/asura-framework/scripts/gui/text.lua0
-rw-r--r--source/modules/asura-framework/scripts/gui/widget.lua14
-rw-r--r--source/modules/asura-framework/scripts/managers/scene_manager.lua16
-rw-r--r--source/modules/asura-framework/scripts/managers/sprite_manager.lua0
-rw-r--r--source/modules/asura-framework/scripts/math/curve.lua0
-rw-r--r--source/modules/asura-framework/scripts/path/path.lua13
-rw-r--r--source/modules/asura-framework/scripts/path/path_calculator.lua12
-rw-r--r--source/modules/asura-framework/scripts/path/path_manager.lua0
-rw-r--r--source/modules/asura-framework/scripts/scene.lua22
-rw-r--r--source/modules/asura-framework/scripts/transform.lua13
50 files changed, 848 insertions, 0 deletions
diff --git a/source/modules/asura-framework/scripts/ai/behavior_tree.lua b/source/modules/asura-framework/scripts/ai/behavior_tree.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-framework/scripts/ai/behavior_tree.lua
diff --git a/source/modules/asura-framework/scripts/ai/state_graph.lua b/source/modules/asura-framework/scripts/ai/state_graph.lua
new file mode 100644
index 0000000..4f563dc
--- /dev/null
+++ b/source/modules/asura-framework/scripts/ai/state_graph.lua
@@ -0,0 +1,11 @@
+local StateGraph = AsuraEngine.Asset.Extend("StateGraph")
+
+AsuraEngine.StateGraph = StateGraph
+
+function StateGraph.Ctor(self)
+
+end
+
+function StateGraph.ToAsset()
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/ai/state_machine.lua b/source/modules/asura-framework/scripts/ai/state_machine.lua
new file mode 100644
index 0000000..6dc5e14
--- /dev/null
+++ b/source/modules/asura-framework/scripts/ai/state_machine.lua
@@ -0,0 +1,6 @@
+local StateMachine = Class()
+AsuraEngine.StateMachine = StateMachine
+
+function StateMachine.Ctor(self, stategraph)
+ self.stategraph = stategraph
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/audio/sound.lua b/source/modules/asura-framework/scripts/audio/sound.lua
new file mode 100644
index 0000000..d7dea4f
--- /dev/null
+++ b/source/modules/asura-framework/scripts/audio/sound.lua
@@ -0,0 +1,9 @@
+AsuraEngine.Sound = AsuraEngine.Asset.Extend("Sound")
+
+local Sound = AsuraEngine.Sound
+
+function Sound.Ctor(self)
+
+end
+
+return Sound \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/audio/source.lua b/source/modules/asura-framework/scripts/audio/source.lua
new file mode 100644
index 0000000..7dec511
--- /dev/null
+++ b/source/modules/asura-framework/scripts/audio/source.lua
@@ -0,0 +1,22 @@
+-- Audio Source
+AsuraEngine.Source = AsuraEngine.Component.Extend("SoundPlayer")
+
+local Source = AsuraEngine.Source
+
+function Source.Ctor(self)
+ self.mSound = nil
+end
+
+function Source.SetSound(sound)
+ self.mSound = sound
+end
+
+function Source.GetSource()
+ return self.mSound
+end
+
+function Source.OnUpdate(dt)
+
+end
+
+return Source \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/class.lua b/source/modules/asura-framework/scripts/class.lua
new file mode 100644
index 0000000..6392483
--- /dev/null
+++ b/source/modules/asura-framework/scripts/class.lua
@@ -0,0 +1,17 @@
+AsuraEngine.Class = {}
+
+local Class = AsuraEngine.Class
+Class.__index = Class
+
+function Class.Extend(base, classname)
+ local subclass = {}
+ base.__index = base
+ setmetatable(subclass, base)
+ return c
+end
+
+function Class.New(cls)
+ local obj = {}
+ setmetatable(obj, cls)
+ cls.__index = cls
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/component.lua b/source/modules/asura-framework/scripts/component.lua
new file mode 100644
index 0000000..b560bd3
--- /dev/null
+++ b/source/modules/asura-framework/scripts/component.lua
@@ -0,0 +1,30 @@
+AsuraEngine.Component = AsuraEngine.Class("Component")
+
+local Component = AsuraEngine.Component
+
+-- Component要显示在inspector的变量
+Component.entity = AsuraEngine.Type.Entity
+
+function Component.Extend(cname)
+ self.base(cname)
+ assert(Component.components[cname] == nil)
+
+end
+
+function Component:Ctor(entity)
+ self.entity = entity
+end
+
+function Component:OnEvent(e)
+
+end
+
+function Component:OnUpdate(ms)
+
+end
+
+function Component:OnDraw()
+
+end
+
+return Component \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/entity.lua b/source/modules/asura-framework/scripts/entity.lua
new file mode 100644
index 0000000..ea8e14d
--- /dev/null
+++ b/source/modules/asura-framework/scripts/entity.lua
@@ -0,0 +1,114 @@
+--
+-- 实体,作为scene中的实体存在。Scene中唯一管理的就是实体entity,游戏里的所有component都依附于entity存在,包括camera组件。
+--
+module "AsuraEngine"
+require "transform"
+
+AsuraEngine.Entity = AsuraEngine.Asset.Extend("Entity")
+
+local Entity = AsuraEngine.Entity
+
+function Entity:Ctor()
+ self.transform = AsuraEngine.Transform.New()
+ self.subentities = {} -- Extend node entities
+end
+
+function Entity:AddChild(entity)
+ table.insert(self.child, entity)
+end
+
+function Entity:AddComponent(type, name)
+ local cname = type
+ if name == nil then
+ cname = name
+ end
+ local component = AsuraEngine.Component.GetComponent(type)
+ self.components[cname] = compoennt
+end
+
+function Entity:GetComponent(name)
+ return self.components[name]
+end
+
+function Entity:GetComponentByType(type)
+
+end
+
+function Entity:OnEnable()
+
+end
+
+function Entity:OnEvent(e)
+ if self.components == nil or type(self.components) ~= "table" then
+ AsuraEditor.LogError("")
+ return
+ end
+ for name, component in self.components do
+ if component.OnEvent ~= nil then
+ component:OnEvent(e)
+ end
+ end
+end
+
+function Entity:OnUpdate(dt)
+ for name, component in self.components do
+ if component.OnUpdate ~= nil then
+ component:OnUpdate(dt)
+ end
+ end
+end
+
+function Entity:OnRender()
+ for name, component in self.components do
+ if component.OnRender ~= nil then
+ component.OnRender()
+ end
+ end
+end
+
+function Entity:OnDisable()
+ for name, component in self.components do
+ if component.OnDisable ~= nil then
+ component.OnDisable()
+ end
+ end
+end
+
+function Entity:GetTrasform()
+ return self.transform
+end
+
+function Entity:GetPosition()
+
+end
+
+function Entity:GetScale()
+
+end
+
+function Entity:GetRotation()
+
+end
+
+function Entity:SetTrasform(transform)
+
+end
+
+function Entity:SetPosition()
+
+end
+
+function Entity:SetScale()
+
+end
+
+function Entity:SetRotation()
+
+end
+
+--写asset
+function Entity:ToAsset()
+
+end
+
+return Entity \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/animation_loader.lua b/source/modules/asura-framework/scripts/filesystem/animation_loader.lua
new file mode 100644
index 0000000..9c57c43
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/animation_loader.lua
@@ -0,0 +1,10 @@
+require "AnimationManager"
+require "Animation"
+
+local loader = AsuraEngine.Loader.New("animation")
+local manager = AsuraEngine.AnimationManager
+local Animation = AsuraEngine.Animation
+
+function AnimationLoader.OnLoad(asset)
+ local animation = AsuraEngine.Class()
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/asset.lua b/source/modules/asura-framework/scripts/filesystem/asset.lua
new file mode 100644
index 0000000..7cf3905
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/asset.lua
@@ -0,0 +1,20 @@
+--
+-- 游戏资源类需要继承Asset类,引擎读取.asset文件寻找对应的loader加载进游戏生成对应的Asset派生类对象。对于脚本,不会
+-- 生成对应的对象,而是直接运行脚本将结果保存。
+--
+AsuraEngine.Asset = AsuraEngine.Class("Asset")
+
+local Asset = AsuraEngine.Asset
+
+function Asset.Ctor(self)
+ self.guid = nil
+end
+
+--获得资源编号
+function Asset.GetGUID(self)
+
+end
+
+function Asset.GetAssetByGUID(guid)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/entity_loader.lua b/source/modules/asura-framework/scripts/filesystem/entity_loader.lua
new file mode 100644
index 0000000..39ae0d9
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/entity_loader.lua
@@ -0,0 +1,5 @@
+local loader = AsuraEngine.Loader.New("entity")
+
+function loader.OnLoad(asset)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/image_loader.lua b/source/modules/asura-framework/scripts/filesystem/image_loader.lua
new file mode 100644
index 0000000..6b0bef7
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/image_loader.lua
@@ -0,0 +1,13 @@
+require "graphics.image"
+local loader = AsuraEngine.Loader.New("image")
+
+function loader.OnLoad(asset)
+ assert(asset ~= nil)
+ local path = asset.extern
+ local image = AusraEngine.Image.New(path)
+ if image == nil then
+ AsuraEngine.LogError("")
+ return
+ end
+ return image
+end
diff --git a/source/modules/asura-framework/scripts/filesystem/loader.lua b/source/modules/asura-framework/scripts/filesystem/loader.lua
new file mode 100644
index 0000000..e192e30
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/loader.lua
@@ -0,0 +1,12 @@
+-- Assets loaders
+AsuraEngine.Loader = {}
+local Loader = AsuraEngine.Loader
+Loader.Loaders = {}
+
+function Loader.New(type)
+ assert(Loader.Loaders[type] == nil)
+ local loader = {}
+ Loader[type] = loader
+ return loader
+end
+
diff --git a/source/modules/asura-framework/scripts/filesystem/material_loader.lua b/source/modules/asura-framework/scripts/filesystem/material_loader.lua
new file mode 100644
index 0000000..07ca4e9
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/material_loader.lua
@@ -0,0 +1,7 @@
+require "MaterialManager"
+
+local loader = AsuraEngine.Loader.New("material")
+
+function loader.OnLoad(asset)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/path_loader.lua b/source/modules/asura-framework/scripts/filesystem/path_loader.lua
new file mode 100644
index 0000000..986e42c
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/path_loader.lua
@@ -0,0 +1,9 @@
+require "Path/PathManager"
+
+local loader = AsuraEngine.Loader.New("path")
+
+function loader.OnLoad(asset)
+ if asset.type ~= "path" then
+ return nil
+ end
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/scene_loader.lua b/source/modules/asura-framework/scripts/filesystem/scene_loader.lua
new file mode 100644
index 0000000..45731f8
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/scene_loader.lua
@@ -0,0 +1,7 @@
+local Scene = require "scene"
+
+local loader = AsuraEngine.Loader.New("scene")
+
+function loader.OnLoad(asset)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/script_loader.lua b/source/modules/asura-framework/scripts/filesystem/script_loader.lua
new file mode 100644
index 0000000..e93d903
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/script_loader.lua
@@ -0,0 +1,5 @@
+local loader = AsuraEngine.Loader.New("script")
+
+function loader.OnLoad(asset)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/shader_loader.lua b/source/modules/asura-framework/scripts/filesystem/shader_loader.lua
new file mode 100644
index 0000000..12d88bb
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/shader_loader.lua
@@ -0,0 +1,5 @@
+local loader = AsuraEngine.Loader.New("shader")
+
+function loader.OnLoad(asset)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/filesystem/statemap_loader.lua b/source/modules/asura-framework/scripts/filesystem/statemap_loader.lua
new file mode 100644
index 0000000..e52e086
--- /dev/null
+++ b/source/modules/asura-framework/scripts/filesystem/statemap_loader.lua
@@ -0,0 +1,7 @@
+require "ai/statemap_manager"
+local loader = AsuraEngine.Loader.New("statemap")
+
+--载入statemap
+function loader.OnLoad(asset)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/framework.lua b/source/modules/asura-framework/scripts/framework.lua
new file mode 100644
index 0000000..4643221
--- /dev/null
+++ b/source/modules/asura-framework/scripts/framework.lua
@@ -0,0 +1,21 @@
+package.path = "scripts\\?.lua"
+
+--loader
+local loadfn = function(modulename)
+ local errmsg = ""
+ local modulepath = string.gsub(modulename, "%.", "/")
+ for path in string.gmatch(package.path, "([^;]+)") do
+ local filename = string.gsub(path, "%?", modulepath)
+ filename = string.gsub(filename, "\\", "/")
+ local result = kleiloadlua(filename)
+ if result then
+ return result
+ end
+ errmsg = errmsg.."\n\tno file '"..filename.."' (checked with custom loader)"
+ end
+ return errmsg
+end
+
+table.insert(package.loaders, 1, loadfn)
+
+require ""
diff --git a/source/modules/asura-framework/scripts/graphics/animation.lua b/source/modules/asura-framework/scripts/graphics/animation.lua
new file mode 100644
index 0000000..285adaa
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/animation.lua
@@ -0,0 +1,15 @@
+AsuraEngine.Animation = AsuraEngine.Asset.Extend("Animation")
+
+local Animation = AsuraEngine.Animation
+
+local Frame = AsuraEngine.Class("Frame")
+
+function Frame.Ctor(self)
+
+end
+
+function Animation.Ctor(self)
+
+end
+
+return Animation \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/animator.lua b/source/modules/asura-framework/scripts/graphics/animator.lua
new file mode 100644
index 0000000..fd2f979
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/animator.lua
@@ -0,0 +1,33 @@
+local Component = AsuraEngine.Framework.Require("component")
+
+AsuraEngine.Animator = Component.Extend("Animator")
+
+local Animator = AsuraEngine.Animator
+
+-- Animator inspector variables.
+Animator.spriteRenderer = AsuraEngine.Type.SpriteRenderer
+Animator.animation = AsuraEngine.Type.Animation
+
+function Animator:Ctor(entity, animation)
+ self.base(entity)
+ self.spriteRenderer = entity:GetSpriteRenderer()
+ self.animation = animation
+end
+
+function Animator:SetAnimation(animation)
+ self.animation = animation
+end
+
+function Animator:GetAnimation()
+ return self.animation
+end
+
+function Animator:OnUpdate(dt)
+
+end
+
+function Animator:OnRender()
+
+end
+
+return Animator \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/camera.lua b/source/modules/asura-framework/scripts/graphics/camera.lua
new file mode 100644
index 0000000..a989de6
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/camera.lua
@@ -0,0 +1,21 @@
+AsuraEngine.Camera = AsuraEngine.Component.Extend("Camera")
+
+local Camera = AsuraEngine.Camera
+
+Camera.isCulling = AsuraEngine.Type.Bool
+Camera.isOnScreen = AsuraEngine.Type.Bool
+
+function Camera.Ctor(self)
+ self.isCulling = false
+ self.isOnScreen = false
+end
+
+function Camera.OnUpdate(dt)
+
+end
+
+function Camera.OnRender()
+
+end
+
+return Camera \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/canvas.lua b/source/modules/asura-framework/scripts/graphics/canvas.lua
new file mode 100644
index 0000000..ce2ca20
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/canvas.lua
@@ -0,0 +1,34 @@
+AsuraEngine.Canvas = AsuraEngine.Component.Extend("Canvas")
+
+local Canvas = AsuraEngine.Canvas
+
+function Canvas.Ctor(self, width, height)
+ self.simCanvas = AsuraEngine.SimCanvas.New(width, height)
+ self.width = width
+ self.height = height
+end
+
+function Canvas.GetWidth(self)
+ return self.width
+end
+
+function Canvas.GetHeight(self)
+ return self.height
+end
+
+function Canvas.GetSize(self)
+ return self.width, self.height
+end
+
+function Canvas.OnEnable(self)
+ if self.simCanvas == nil then
+ return
+ end
+ self.simCanvas:Begin()
+end
+
+function Canvas.OnDisable(self)
+
+end
+
+return Canvas \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/default_shaders.lua b/source/modules/asura-framework/scripts/graphics/default_shaders.lua
new file mode 100644
index 0000000..bd54cb9
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/default_shaders.lua
@@ -0,0 +1,5 @@
+--[[
+õshaders.
+]]
+
+
diff --git a/source/modules/asura-framework/scripts/graphics/image.lua b/source/modules/asura-framework/scripts/graphics/image.lua
new file mode 100644
index 0000000..f5ebaa2
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/image.lua
@@ -0,0 +1,40 @@
+-- 图片资源
+AsuraEngine.Image = AsuraEngine.Asset.Extend("Image")
+
+local Image = AsuraEngine.Image
+
+function Image.Ctor(self, path)
+ local simImage = AsuraEngine.SimImage.New(path)
+ local w, h = simImage:GetSize()
+ self.simImage = simImage
+ self.width = w
+ self.height = h
+end
+
+function Image.GetWidth(self)
+ return self.simImage.GetWidth()
+end
+
+function Image.GetHeight(self)
+ return self.simImage.GetHeight()
+end
+
+function Image.GetSize(self)
+ return self.simImage.GetSize()
+end
+
+--获得x,y位置的颜色值
+function Image.GetColor(self, x, y)
+ return self.simImage.GetColor(x, y)
+end
+
+--获得所有像素,返回到一个table里
+function Image.GetPixels(self)
+ return self.simImage:GetPixels()
+end
+
+--image不可再编辑器编辑,所以没有ToAsset方法
+--function Image.ToAsset()
+--end
+
+return Image \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/material.lua b/source/modules/asura-framework/scripts/graphics/material.lua
new file mode 100644
index 0000000..5a6e5bd
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/material.lua
@@ -0,0 +1,48 @@
+--material是shader的代理
+AsuraEngine.Material = AsuraEngine.Asset.Extend("Material")
+
+local Material = AsuraEngine.Material
+
+function Material.Ctor(self)
+ self.uniforms = {} --uniform变量和值
+ self.shader = nil
+ self.isShared = false
+end
+
+function Material.Clone(self)
+
+end
+
+function Material:ToAsset()
+
+end
+
+function Material:GetUniform(name)
+
+end
+
+function Material:SetFloat(uniform, value)
+
+end
+
+function Material:SetTexture(uniform, tex)
+
+end
+
+function Material:SetInteger(unifrom, value)
+
+end
+
+function Material:SetVec2(uniform, value)
+
+end
+
+function Material:SetMat44(uniform, value)
+
+end
+
+function Material:GetUniformID()
+
+end
+
+return Material \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/material_manager.lua b/source/modules/asura-framework/scripts/graphics/material_manager.lua
new file mode 100644
index 0000000..086a5db
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/material_manager.lua
@@ -0,0 +1,3 @@
+local MaterialManager = AsuraEngine.Manager.New()
+
+return MaterialManager \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/mesh2d.lua b/source/modules/asura-framework/scripts/graphics/mesh2d.lua
new file mode 100644
index 0000000..05b2e2e
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/mesh2d.lua
@@ -0,0 +1,9 @@
+AsuraEngine.Mesh2D = AsuraEngine.Asset.Extend("Mesh2D")
+
+local Mesh2D = AsuraEngine.Mesh2D
+
+function Mesh2D.Ctor(self)
+
+end
+
+return Mesh2D \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/mesh2d_renderer.lua b/source/modules/asura-framework/scripts/graphics/mesh2d_renderer.lua
new file mode 100644
index 0000000..09c8c98
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/mesh2d_renderer.lua
@@ -0,0 +1,13 @@
+AsuraEngine.Mesh2DRenderer = AsuraEngine.Renderer.Extend("Mesh2DRenderer")
+
+local Mesh2DRenderer = AsuraEngine.Mesh2DRenderer
+
+function Mesh2DRenderer.Ctor(self, material)
+ self.base(material)
+end
+
+function Mesh2DRenderer.OnRender(self)
+
+end
+
+return Mesh2DRenderer \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/particle_system.lua b/source/modules/asura-framework/scripts/graphics/particle_system.lua
new file mode 100644
index 0000000..065a845
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/particle_system.lua
@@ -0,0 +1,20 @@
+require "graphics.sprite_renderer"
+
+AsuraEngine.ParticleSystem = AsuraEngine.Component.Extend("ParticleSystem")
+
+local ParticleSystem = AsuraEngine.ParticleSystem
+
+function ParticleSystem.Ctor(self, entity, def)
+ self.base(entity)
+ self.spriteRenderer = AsuraEngine.SpriteRenderer.New()
+end
+
+function ParticleSystem.OnRenderer()
+
+end
+
+function ParticleSystem.OnUpdate(dt)
+
+end
+
+return ParticleSystem \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/renderer.lua b/source/modules/asura-framework/scripts/graphics/renderer.lua
new file mode 100644
index 0000000..92a6409
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/renderer.lua
@@ -0,0 +1,19 @@
+local Renderer = AsuraEngine.Component.Extend("Renderer")
+AsuraEngine.Renderer = Renderer
+
+function Renderer.Ctor(self)
+ self.materials = {}
+ self.material = nil
+ self.isMultiMaterials = false
+end
+
+--取材质,如果是shared,那么从此材质clone一个
+function Renderer.GetMaterial(self)
+
+end
+
+function Renderer.IsMultiMaterials(self)
+ return self.isMultiMaterials
+end
+
+return Renderer \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/shader.lua b/source/modules/asura-framework/scripts/graphics/shader.lua
new file mode 100644
index 0000000..c411619
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/shader.lua
@@ -0,0 +1,75 @@
+AsuraEngine.Shader = AsuraEngine.Asset.Extend("Shader")
+
+local helper = AsuraEngine.Framework.Require("graphics/shaderHelper")
+
+local Shader = AsuraEngine.Shader
+
+function Shader.Ctor(self)
+ self.simShader = nil
+ self.uniforms = {} -- 映射uniform name到location
+end
+
+--编译shader
+function Shader.Load(self, vert, frag)
+ self.uniforms = {}
+ if self.simShader == nil then
+ self.simShader = AsuraEngine.SimShader.New(vert, frag)
+ else
+ self.simShader:Load(vert, frag)
+ end
+ if self.simShader == nil then
+ --shader编译错误
+ return
+ end
+ --在编译的时候就获得所有的uniform和loc
+ local uniforms = helper.GetUniforms(vert, frag)
+ if uniforms == nil then
+ return
+ end
+ for _, uniform in uniforms do
+ self.uniforms[uniform] = self.simShader:GetUniformLocation(uniform)
+ end
+end
+
+function Shader.GetUniformLocation(self, name)
+ if self.uniforms then
+ local id = self.uniforms[name]
+ return id
+ end
+ return 0
+end
+
+function Shader.SendVec2(self, name, vec2)
+ local id = self:GetUniformLocation(name)
+ self.simShader:SendUniformVector2(name, vec2)
+end
+
+function Shader.SendVec3(self, name, vec3)
+
+end
+
+function Shader.SendVec4(self, name, vec4)
+
+end
+
+function Shader.SendTexture(self, name, tex)
+
+end
+
+function Shader.SendFloat(self, name, number)
+
+end
+
+function Shader.SendInteger(self, name, integer)
+
+end
+
+function Shader.SendColor(self, name, color)
+
+end
+
+function Shader.SendMat44(self, name, mat44)
+
+end
+
+return Shader \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/shaderHelper.lua b/source/modules/asura-framework/scripts/graphics/shaderHelper.lua
new file mode 100644
index 0000000..b1b42a6
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/shaderHelper.lua
@@ -0,0 +1,14 @@
+--[[
+解析vertex shader和 fragment shader,并取得两个shader里面定义的uniforms
+]]
+local helper = {}
+
+function helper.GetUniforms(vert, frag)
+
+end
+
+function helper.TryCompileShader(vert, frag)
+
+end
+
+return helper \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/shape.lua b/source/modules/asura-framework/scripts/graphics/shape.lua
new file mode 100644
index 0000000..51ea8c3
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/shape.lua
@@ -0,0 +1,12 @@
+--
+-- 2D图形
+--
+AsuraEngine.Shape = AsuraEngine.Asset.Extend("Shape")
+
+local Shape = AsuraEngine.Shape
+
+function Shape.Ctor(self)
+
+end
+
+return Shape \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/shape_renderer.lua b/source/modules/asura-framework/scripts/graphics/shape_renderer.lua
new file mode 100644
index 0000000..80b48b8
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/shape_renderer.lua
@@ -0,0 +1,13 @@
+AsuraEngine.ShapeRenderer = AsuraEngine.Component.Extend("ShapeRenderer")
+
+local ShapeRenderer = AsuraEngine.ShapeRenderer
+
+function ShapeRenderer.OnRenderer()
+
+end
+
+function ShapeRenderer.OnUpdate(dt)
+
+end
+
+return ShapeRenderer \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/sprite.lua b/source/modules/asura-framework/scripts/graphics/sprite.lua
new file mode 100644
index 0000000..9bf05f4
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/sprite.lua
@@ -0,0 +1,10 @@
+local Sprite = AsuraEngine.Asset.Extend("Sprite")
+AsuraEngine.Sprite = Sprite
+
+function Sprite.Ctor(self, image)
+ self.image = image
+end
+
+function Sprite.ToAsset(self)
+
+end \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/sprite_batch_renderer.lua b/source/modules/asura-framework/scripts/graphics/sprite_batch_renderer.lua
new file mode 100644
index 0000000..9ec73d2
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/sprite_batch_renderer.lua
@@ -0,0 +1,9 @@
+AsuraEngine.SpriteBatchRenderer = AsuraEngine.Component.Extend("SpriteBatchRenderer")
+
+local SpriteBatchRenderer = AsuraEngine.SpriteBatchRenderer
+
+function SpriteBatchRenderer.Ctor(self)
+
+end
+
+return SpriteBatchRenderer \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/graphics/sprite_renderer.lua b/source/modules/asura-framework/scripts/graphics/sprite_renderer.lua
new file mode 100644
index 0000000..0a41e08
--- /dev/null
+++ b/source/modules/asura-framework/scripts/graphics/sprite_renderer.lua
@@ -0,0 +1,14 @@
+require "graphics.renderer"
+
+local SpriteRenderer = AsuraEngine.Renderer.Extend("Spriterenderer")
+AsuraEngine.SpriteRenderer = SpriteRenderer
+
+function SpriteRenderer.Ctor(self)
+ self.materials = {}
+end
+
+function SpriteRenderer:OnRender()
+
+end
+
+return SpriteRenderer \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/gui/button.lua b/source/modules/asura-framework/scripts/gui/button.lua
new file mode 100644
index 0000000..b122931
--- /dev/null
+++ b/source/modules/asura-framework/scripts/gui/button.lua
@@ -0,0 +1,21 @@
+AsuraEngine.Button = AsuraEngine.Component.Extend("Button")
+
+local Button = AsuraEngine.Button
+
+function Button.Ctor(self)
+
+end
+
+function Button.OnEvent(e)
+
+end
+
+function Button.OnRender()
+
+end
+
+function Button.OnUpdate(dt)
+
+end
+
+return Button \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/gui/text.lua b/source/modules/asura-framework/scripts/gui/text.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-framework/scripts/gui/text.lua
diff --git a/source/modules/asura-framework/scripts/gui/widget.lua b/source/modules/asura-framework/scripts/gui/widget.lua
new file mode 100644
index 0000000..430ade0
--- /dev/null
+++ b/source/modules/asura-framework/scripts/gui/widget.lua
@@ -0,0 +1,14 @@
+--[[
+Imgui,用在游戏里面
+]]
+local Widget = AsuraEngine.Component("Widget")
+
+function Widget.Ctor(self)
+
+end
+
+function Widget.OnEvent(self, e)
+
+end
+
+return Widget \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/managers/scene_manager.lua b/source/modules/asura-framework/scripts/managers/scene_manager.lua
new file mode 100644
index 0000000..7886dc6
--- /dev/null
+++ b/source/modules/asura-framework/scripts/managers/scene_manager.lua
@@ -0,0 +1,16 @@
+AsuraEngine.SceneManager = AsuraEngine.Class("SceneManager")
+
+local SceneManager = AsuraEngine.SceneManager
+
+--游戏里的所有场景
+SceneManager.scenes = {}
+
+function SceneManager.Ctor()
+
+end
+
+function SceneManager.GetSceneByGUID()
+
+end
+
+return SceneManager \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/managers/sprite_manager.lua b/source/modules/asura-framework/scripts/managers/sprite_manager.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-framework/scripts/managers/sprite_manager.lua
diff --git a/source/modules/asura-framework/scripts/math/curve.lua b/source/modules/asura-framework/scripts/math/curve.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-framework/scripts/math/curve.lua
diff --git a/source/modules/asura-framework/scripts/path/path.lua b/source/modules/asura-framework/scripts/path/path.lua
new file mode 100644
index 0000000..1fc9b3a
--- /dev/null
+++ b/source/modules/asura-framework/scripts/path/path.lua
@@ -0,0 +1,13 @@
+local Path = AsuraEngine.Asset.New("path")
+
+function Path:Ctor()
+
+end
+
+-- ToAssetѶpathתΪ.assetļʽ
+function Path.ToAsset(path)
+ local builder = AsuraEngine.AssetBuilder.Get()
+
+end
+
+return Path \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/path/path_calculator.lua b/source/modules/asura-framework/scripts/path/path_calculator.lua
new file mode 100644
index 0000000..d44da08
--- /dev/null
+++ b/source/modules/asura-framework/scripts/path/path_calculator.lua
@@ -0,0 +1,12 @@
+--[[
+ڱ༭componentsб
+]]
+local PathCalculator = AsuraEngine.Component.New("PathCalculator")
+
+PathCalculator.path = AsuraEngine.Asset.Type("path", "·")
+
+function PathCalculator:ctor(path)
+ self.path = path
+end
+
+return PathCalculator \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/path/path_manager.lua b/source/modules/asura-framework/scripts/path/path_manager.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-framework/scripts/path/path_manager.lua
diff --git a/source/modules/asura-framework/scripts/scene.lua b/source/modules/asura-framework/scripts/scene.lua
new file mode 100644
index 0000000..11ac86c
--- /dev/null
+++ b/source/modules/asura-framework/scripts/scene.lua
@@ -0,0 +1,22 @@
+--
+-- Scene是一系列gameobject的集合。
+--
+AsuraEngine.Scene = AsuraEngine.Asset.Extend("Scene")
+
+local Scene = AsuraEngine.Scene
+
+function Scene.Ctor(self)
+ self.rootGameObjects = {} --当前场景的所有root entity
+ self.super.Ctor(self)
+end
+
+--获取当前的场景
+function Scene.GetCurrent()
+
+end
+
+function Scene.ToAsset()
+
+end
+
+return Scene \ No newline at end of file
diff --git a/source/modules/asura-framework/scripts/transform.lua b/source/modules/asura-framework/scripts/transform.lua
new file mode 100644
index 0000000..1d34ae6
--- /dev/null
+++ b/source/modules/asura-framework/scripts/transform.lua
@@ -0,0 +1,13 @@
+-- transform的起点在左下角,逆时针为正向
+AsuraEngine.Transform = AsuraEngine.Class("Transform")
+local Transform = AsuraEngine.Transform
+
+function Transform.Ctor(self)
+ self.position = {x=0, y=0}
+ self.rotation = 0
+ self.size = {w=0, h=0}
+end
+
+function Transform.Move(self)
+
+end \ No newline at end of file