From 6c8788ed76e1ead173fdeb51caaa43d538fcfe21 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 27 Jan 2019 01:26:36 +0800 Subject: *misc --- Source/Asura.Engine/AI/BehaviorTree.cpp | 0 Source/Asura.Engine/AI/BehaviorTree.h | 0 Source/Asura.Engine/AI/StateMachine.cpp | 0 Source/Asura.Engine/AI/StateMachine.h | 33 ---- Source/Asura.Engine/AI/StateMap.cpp | 0 Source/Asura.Engine/AI/StateMap.h | 25 --- Source/Asura.Engine/Component.cpp | 0 Source/Asura.Engine/Component.h | 43 ----- .../Asura.Engine/FileSystem/Importer.Animation.cpp | 0 Source/Asura.Engine/FileSystem/Importer.Asset.cpp | 3 - Source/Asura.Engine/FileSystem/Importer.Image.cpp | 0 Source/Asura.Engine/FileSystem/Importer.Sprite.cpp | 0 .../Asura.Engine/FileSystem/Importer.StateMap.cpp | 0 Source/Asura.Engine/FileSystem/Importer.cpp | 0 Source/Asura.Engine/FileSystem/Importer.h | 21 --- Source/Asura.Engine/GameObject.cpp | 11 -- Source/Asura.Engine/GameObject.h | 56 ------ Source/Asura.Engine/Graphics/Animation.cpp | 21 --- Source/Asura.Engine/Graphics/Animation.h | 128 -------------- Source/Asura.Engine/Graphics/Animator.cpp | 0 Source/Asura.Engine/Graphics/Animator.h | 96 ----------- Source/Asura.Engine/Graphics/Camera.cpp | 0 Source/Asura.Engine/Graphics/Camera.h | 42 ----- Source/Asura.Engine/Graphics/CanvasRenderer.cpp | 0 Source/Asura.Engine/Graphics/CanvasRenderer.h | 30 ---- Source/Asura.Engine/Graphics/Image.h | 1 + Source/Asura.Engine/Graphics/Material.cpp | 18 -- Source/Asura.Engine/Graphics/Material.h | 189 --------------------- Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp | 0 Source/Asura.Engine/Graphics/Mesh2DRenderer.h | 19 --- Source/Asura.Engine/Graphics/ParticleSystem.cpp | 0 Source/Asura.Engine/Graphics/ParticleSystem.h | 22 --- Source/Asura.Engine/Graphics/Prefab.cpp | 0 Source/Asura.Engine/Graphics/Prefab.h | 30 ---- Source/Asura.Engine/Graphics/Renderer.cpp | 0 Source/Asura.Engine/Graphics/Renderer.h | 39 ----- Source/Asura.Engine/Graphics/ShapeRenderer.cpp | 0 Source/Asura.Engine/Graphics/ShapeRenderer.h | 0 Source/Asura.Engine/Graphics/Sprite.cpp | 0 Source/Asura.Engine/Graphics/Sprite.h | 71 -------- Source/Asura.Engine/Graphics/SpriteRenderer.cpp | 0 Source/Asura.Engine/Graphics/SpriteRenderer.h | 32 ---- Source/Asura.Engine/Graphics/Window.h | 7 +- Source/Asura.Engine/Layer.cpp | 0 Source/Asura.Engine/Layer.h | 0 Source/Asura.Engine/ObjectPool.cpp | 0 Source/Asura.Engine/ObjectPool.h | 14 -- Source/Asura.Engine/Scene.cpp | 0 Source/Asura.Engine/Scene.h | 28 --- Source/Asura.Engine/Transform.cpp | 0 Source/Asura.Engine/Transform.h | 24 --- Source/Asura.Framework/AI/StateMachine.lua | 3 - Source/Asura.Framework/Audio/SoundPlayer.lua | 4 +- Source/Asura.Framework/Class.lua | 3 +- Source/Asura.Framework/Component.lua | 12 +- Source/Asura.Framework/Filesystem/Loader.lua | 19 ++- .../Filesystem/animation_loader.lua | 13 +- .../Asura.Framework/Filesystem/material_loader.lua | 11 +- Source/Asura.Framework/Filesystem/path_loader.lua | 11 +- Source/Asura.Framework/Filesystem/scene_loader.lua | 5 + Source/Asura.Framework/Framework.lua | 2 +- Source/Asura.Framework/Game.lua | 1 - Source/Asura.Framework/Object.lua | 0 Source/Asura.Framework/Scene.lua | 11 +- Source/Asura.Framework/Transform.lua | 8 + Source/Asura.Framework/ai/behavior_tree.lua | 0 Source/Asura.Framework/ai/state_machine.lua | 6 + Source/Asura.Framework/ai/state_map.lua | 12 ++ Source/Asura.Framework/ai/statemachine.lua | 3 - Source/Asura.Framework/audio/soundplayer.lua | 4 +- Source/Asura.Framework/class.lua | 3 +- Source/Asura.Framework/component.lua | 12 +- Source/Asura.Framework/entity.lua | 64 ++++++- .../filesystem/animation_loader.lua | 13 +- .../Asura.Framework/filesystem/entity_loader.lua | 5 +- Source/Asura.Framework/filesystem/loader.lua | 19 ++- .../Asura.Framework/filesystem/material_loader.lua | 11 +- Source/Asura.Framework/filesystem/path_loader.lua | 11 +- Source/Asura.Framework/filesystem/scene_loader.lua | 5 + .../Asura.Framework/filesystem/statemap_loader.lua | 7 + Source/Asura.Framework/framework.lua | 2 +- Source/Asura.Framework/game.lua | 1 - Source/Asura.Framework/object.lua | 0 Source/Asura.Framework/scene.lua | 11 +- Source/Asura.Framework/transform.lua | 8 + 85 files changed, 223 insertions(+), 1080 deletions(-) delete mode 100644 Source/Asura.Engine/AI/BehaviorTree.cpp delete mode 100644 Source/Asura.Engine/AI/BehaviorTree.h delete mode 100644 Source/Asura.Engine/AI/StateMachine.cpp delete mode 100644 Source/Asura.Engine/AI/StateMachine.h delete mode 100644 Source/Asura.Engine/AI/StateMap.cpp delete mode 100644 Source/Asura.Engine/AI/StateMap.h delete mode 100644 Source/Asura.Engine/Component.cpp delete mode 100644 Source/Asura.Engine/Component.h delete mode 100644 Source/Asura.Engine/FileSystem/Importer.Animation.cpp delete mode 100644 Source/Asura.Engine/FileSystem/Importer.Asset.cpp delete mode 100644 Source/Asura.Engine/FileSystem/Importer.Image.cpp delete mode 100644 Source/Asura.Engine/FileSystem/Importer.Sprite.cpp delete mode 100644 Source/Asura.Engine/FileSystem/Importer.StateMap.cpp delete mode 100644 Source/Asura.Engine/FileSystem/Importer.cpp delete mode 100644 Source/Asura.Engine/FileSystem/Importer.h delete mode 100644 Source/Asura.Engine/GameObject.cpp delete mode 100644 Source/Asura.Engine/GameObject.h delete mode 100644 Source/Asura.Engine/Graphics/Animation.cpp delete mode 100644 Source/Asura.Engine/Graphics/Animation.h delete mode 100644 Source/Asura.Engine/Graphics/Animator.cpp delete mode 100644 Source/Asura.Engine/Graphics/Animator.h delete mode 100644 Source/Asura.Engine/Graphics/Camera.cpp delete mode 100644 Source/Asura.Engine/Graphics/Camera.h delete mode 100644 Source/Asura.Engine/Graphics/CanvasRenderer.cpp delete mode 100644 Source/Asura.Engine/Graphics/CanvasRenderer.h delete mode 100644 Source/Asura.Engine/Graphics/Material.cpp delete mode 100644 Source/Asura.Engine/Graphics/Material.h delete mode 100644 Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp delete mode 100644 Source/Asura.Engine/Graphics/Mesh2DRenderer.h delete mode 100644 Source/Asura.Engine/Graphics/ParticleSystem.cpp delete mode 100644 Source/Asura.Engine/Graphics/ParticleSystem.h delete mode 100644 Source/Asura.Engine/Graphics/Prefab.cpp delete mode 100644 Source/Asura.Engine/Graphics/Prefab.h delete mode 100644 Source/Asura.Engine/Graphics/Renderer.cpp delete mode 100644 Source/Asura.Engine/Graphics/Renderer.h delete mode 100644 Source/Asura.Engine/Graphics/ShapeRenderer.cpp delete mode 100644 Source/Asura.Engine/Graphics/ShapeRenderer.h delete mode 100644 Source/Asura.Engine/Graphics/Sprite.cpp delete mode 100644 Source/Asura.Engine/Graphics/Sprite.h delete mode 100644 Source/Asura.Engine/Graphics/SpriteRenderer.cpp delete mode 100644 Source/Asura.Engine/Graphics/SpriteRenderer.h delete mode 100644 Source/Asura.Engine/Layer.cpp delete mode 100644 Source/Asura.Engine/Layer.h delete mode 100644 Source/Asura.Engine/ObjectPool.cpp delete mode 100644 Source/Asura.Engine/ObjectPool.h delete mode 100644 Source/Asura.Engine/Scene.cpp delete mode 100644 Source/Asura.Engine/Scene.h delete mode 100644 Source/Asura.Engine/Transform.cpp delete mode 100644 Source/Asura.Engine/Transform.h delete mode 100644 Source/Asura.Framework/AI/StateMachine.lua delete mode 100644 Source/Asura.Framework/Object.lua create mode 100644 Source/Asura.Framework/ai/behavior_tree.lua create mode 100644 Source/Asura.Framework/ai/state_machine.lua create mode 100644 Source/Asura.Framework/ai/state_map.lua delete mode 100644 Source/Asura.Framework/ai/statemachine.lua create mode 100644 Source/Asura.Framework/filesystem/statemap_loader.lua delete mode 100644 Source/Asura.Framework/object.lua (limited to 'Source') diff --git a/Source/Asura.Engine/AI/BehaviorTree.cpp b/Source/Asura.Engine/AI/BehaviorTree.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/AI/BehaviorTree.h b/Source/Asura.Engine/AI/BehaviorTree.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/AI/StateMachine.cpp b/Source/Asura.Engine/AI/StateMachine.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/AI/StateMachine.h b/Source/Asura.Engine/AI/StateMachine.h deleted file mode 100644 index 17f8945..0000000 --- a/Source/Asura.Engine/AI/StateMachine.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __AE_STATEMACHINE_H__ -#define __AE_STATEMACHINE_H__ - -#include "StateMap.h" -#include "Component.h" - -namespace AsuraEngine -{ - namespace AI - { - - /// - /// 作为state map的代理 - /// - class StateMachine : public Component - { - public: - - - - private: - - /// - /// Statemachine 所使用的state图 - /// - StateMap* mStateMap; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/AI/StateMap.cpp b/Source/Asura.Engine/AI/StateMap.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/AI/StateMap.h b/Source/Asura.Engine/AI/StateMap.h deleted file mode 100644 index 873e1d9..0000000 --- a/Source/Asura.Engine/AI/StateMap.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __AE_STATEMAP_H__ -#define __AE_STATEMAP_H__ - -#include "Filesystem/Asset.h" - -namespace AsuraEngine -{ - namespace AI - { - - class StateMap : public Filesystem::Asset - { - public: - - - private: - - - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Component.cpp b/Source/Asura.Engine/Component.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Component.h b/Source/Asura.Engine/Component.h deleted file mode 100644 index 807bbba..0000000 --- a/Source/Asura.Engine/Component.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __AE_COMPONENT_H__ -#define __AE_COMPONENT_H__ - -#include "GameObject.h" - -namespace AsuraEngine -{ - - class GameObject; - - /// - /// Component通过代码或者prefab附加在GameObject上。 - /// - class Component : public Object - { - public: - - virtual void OnEnable(); - virtual void OnEvent(); - virtual void OnUpdate(uint32 milliseconds); - virtual void OnRender(); - virtual void OnDisable(); - - protected: - - enum class EnableCallback - { - OnEnable = 1, - OnEvent = 1 << 1, - OnUpdate = 1 << 2, - OnRender = 1 << 3, - OnDisable = 1 << 4, - }; - - EnableCallback mEnabledCallbacks; - - GameObject* mGameObject; - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/Importer.Animation.cpp b/Source/Asura.Engine/FileSystem/Importer.Animation.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/FileSystem/Importer.Asset.cpp b/Source/Asura.Engine/FileSystem/Importer.Asset.cpp deleted file mode 100644 index 0af7436..0000000 --- a/Source/Asura.Engine/FileSystem/Importer.Asset.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "Importer.h" - -// 导入自定义资源 diff --git a/Source/Asura.Engine/FileSystem/Importer.Image.cpp b/Source/Asura.Engine/FileSystem/Importer.Image.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/FileSystem/Importer.Sprite.cpp b/Source/Asura.Engine/FileSystem/Importer.Sprite.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/FileSystem/Importer.StateMap.cpp b/Source/Asura.Engine/FileSystem/Importer.StateMap.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/FileSystem/Importer.cpp b/Source/Asura.Engine/FileSystem/Importer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/FileSystem/Importer.h b/Source/Asura.Engine/FileSystem/Importer.h deleted file mode 100644 index 16689e9..0000000 --- a/Source/Asura.Engine/FileSystem/Importer.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __AE_IMPORTER_H__ -#define __AE_IMPORTER_H__ - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// 把外部资源导入为Asset,存放在各自资源的manager里。区别不同的importer方法的是根据.asr文件的根tag,如果是image - /// 就用importImage导入,如果是asset就以importAsset导入。对于自定义资源,如果没有指定importer,就以asset导入。 - /// - class Importer - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/GameObject.cpp b/Source/Asura.Engine/GameObject.cpp deleted file mode 100644 index 322f798..0000000 --- a/Source/Asura.Engine/GameObject.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "GameObject.h" - -namespace AsuraEngine -{ - - void GameObject::OnUpdate(uint32 milliseconds) - { - - } - -} diff --git a/Source/Asura.Engine/GameObject.h b/Source/Asura.Engine/GameObject.h deleted file mode 100644 index 85dc87f..0000000 --- a/Source/Asura.Engine/GameObject.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __AE_GAMEOBJECT_H__ -#define __AE_GAMEOBJECT_H__ - -#include "./Containers/Vector.hpp" -#include "./Math/Vector2.h" - -#include "Object.h" -#include "Component.h" -#include "Transform.h" -#include "Manager.hpp" - -namespace AsuraEngine -{ - - /// - /// 游戏实体,由引擎管理。 - /// - class GameObject final : public Object - { - public: - - // 场景的回调函数 - - void OnEnable(); - void OnEvent(); - void OnUpdate(uint32 milliseconds); - void OnRender(); - void OnDisable(); - - // 设置transform,组件可以通过下列函数修改GameObject的位置、缩放和旋转 - - const Transform& GetTransform(); - const Math::Vector2& GetPosition(); - const Math::Vector2& GetScale(); - const Math::Vector2& GetRotation(); - void SetTransform(const Transform& transform); - void SetPosition(const Math::Vector2& position); - void SetScale(const Math::Vector2& scale); - void SetRotation(const Math::Vector2& rotation); - - template - inline T GetComponent() - { - return NULL; - } - - private: - - Transform mTransform; - Containers::Vector mComponents; - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Animation.cpp b/Source/Asura.Engine/Graphics/Animation.cpp deleted file mode 100644 index 47643aa..0000000 --- a/Source/Asura.Engine/Graphics/Animation.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Animation.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - void Animation::OnEnable() - { - mSpriteRenderer = mGameObject->GetComponent(); - } - - void Animation::OnUpdate(uint32 milliseconds) - { - if (!mSpriteRenderer) - return; - mSpriteRenderer->SetSprite(NULL); - } - - } -} diff --git a/Source/Asura.Engine/Graphics/Animation.h b/Source/Asura.Engine/Graphics/Animation.h deleted file mode 100644 index 391da22..0000000 --- a/Source/Asura.Engine/Graphics/Animation.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef __AE_ANIMATION_H__ -#define __AE_ANIMATION_H__ - -#include "Sprite.h" -#include "Component.h" -#include "Manager.hpp" -#include "SpriteRenderer.h" -#include "Containers/Map.h" -#include "Containers/Vector.hpp" -#include "Containers/StringMap.hpp" -#include "Filesystem/Asset.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 关键帧 - /// - struct Frame - { - uint mask; // - float time; - Sprite* sprite; - }; - - /// - /// Sprite动画,可以改变的有sprite的大小、旋转、缩放、image。Animation通过animator修改。 - /// - class Animation final : public Filesystem::Asset - { - public: - - enum UpdateMask - { - Scale = 1, - Position = 1 << 1, - Rotation = 1 << 2, - Sprite = 1 << 3 - }; - - struct Definition - { - - }; - - /// - /// 根据时间获得一帧 - /// - Frame GetFrame(float t); - - /// - /// 获得关键帧数量 - /// - uint GetKeyFrameCount(); - - /// - /// 是否循环 - /// - uint GetLoop(); - - /// - /// 获取总时间 - /// - uint GetDuration(); - - private: - - /// - /// 关键帧 - /// - Containers::Vector mFrames; - - /// - /// 总时长 - /// - float mDuration; - - /// - /// 是否循环 - /// - bool mLoop; - - /// - /// ID - /// - uint mID; - - UpdateMask mUpdateMask; - - }; - - class AnimationManager : public Manager - { - public: - - Containers::String GetAnimationName(uint ID); - - uint GetAnimationID(const Containers::String& name); - - Animation* GetAnimation(uint ID); - - Animation* GetAnimation(const Containers::String& name); - - /// - /// 添加动画并返回ID - /// - uint AddAnimation(Animation* animation); - - private: - - /// - /// 映射ID到animation - /// - Containers::StringMap mAnimationIDs; - - /// - /// 映射key到animation - /// - Containers::Map mAnimations; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Animator.cpp b/Source/Asura.Engine/Graphics/Animator.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Animator.h b/Source/Asura.Engine/Graphics/Animator.h deleted file mode 100644 index 4d3d269..0000000 --- a/Source/Asura.Engine/Graphics/Animator.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __AE_ANIMATOR_H__ -#define __AE_ANIMATOR_H__ - -#include "Component.h" -#include "Animation.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 控制animation的组件,主要是作为animation的代理 - /// - class Animator final : public Component - { - public: - - void OnEnable() override; - void OnUpdate(uint32 milliseconds) override; - - /// - /// 设置animation - /// - void SetAnimation(uint ID); - - /// - /// 设置animation - /// - void SetAnimation(Animation* animation); - - /// - /// 根据设置animation状态 - /// - void SetTime(float time); - - /// - /// 修改播放速度 - /// - void SetSpeed(float speed); - - /// - /// 设置是否循环 - /// - void SetLoop(bool isloop); - - /// - /// 根据关键帧修改animation - /// - void SetKeyFrame(uint keyFrame); - - /// - /// 设置到结束 - /// - void SetToBegin(); - - /// - /// 设置到开始 - /// - void SetToEnd(); - - /// - /// 暂停 - /// - void Pause(); - - private: - - /// - /// 当前的animation - /// - Animation* mAnimation; - - /// - /// Animation要求物体必须有一个sprite renderer组件 - /// - SpriteRenderer* mSpriteRenderer; - - /// - /// 播放速度,默认为1,dt = mSpeed * DELTA_TIME - /// - float mSpeed; - - /// - /// 当前执行的时间 - /// - float mTime; - - bool mLoop; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Camera.cpp b/Source/Asura.Engine/Graphics/Camera.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Camera.h b/Source/Asura.Engine/Graphics/Camera.h deleted file mode 100644 index 699d342..0000000 --- a/Source/Asura.Engine/Graphics/Camera.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __AE_CAMERA_H__ -#define __AE_CAMERA_H__ - -#include "RenderTarget.h" -#include "Component.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Orthographic Camera. - /// - class Camera : public Component - { - public: - - - private: - - /// - /// 渲染的目标 - /// - RenderTarget* mRenderTarget; - - /// - /// 是否渲染到屏幕上 - /// - bool mIsOnScreen; - - /// - /// 裁剪 - /// - bool mIsCulling; - - }; - - } -} - -#endif diff --git a/Source/Asura.Engine/Graphics/CanvasRenderer.cpp b/Source/Asura.Engine/Graphics/CanvasRenderer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/CanvasRenderer.h b/Source/Asura.Engine/Graphics/CanvasRenderer.h deleted file mode 100644 index ef188a5..0000000 --- a/Source/Asura.Engine/Graphics/CanvasRenderer.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __AE_CANVAS_RENDERER_H__ -#define __AE_CANVAS_RENDERER_H__ - -#include "Canvas.h" -#include "Renderer.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class CanvasRenderer : public Renderer - { - public: - - void SetCanvas(Canvas* canvas); - Canvas* GetCanvas(); - - void SetBlendMode(); - - private: - - Canvas * mCanvas; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h index 5b27079..fc013e3 100644 --- a/Source/Asura.Engine/Graphics/Image.h +++ b/Source/Asura.Engine/Graphics/Image.h @@ -1,6 +1,7 @@ #ifndef __AE_IMAGE_H__ #define __AE_IMAGE_H__ +#include "Containers/String.h" #include "Math/Vector2.h" #include "Manager.hpp" #include "Texture.h" diff --git a/Source/Asura.Engine/Graphics/Material.cpp b/Source/Asura.Engine/Graphics/Material.cpp deleted file mode 100644 index eaf9742..0000000 --- a/Source/Asura.Engine/Graphics/Material.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "Material.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - - - //-------------------------------------------------------------------------------------------------------- - - int Material::l_SetColor(lua_State* L) - { - - } - - } -} diff --git a/Source/Asura.Engine/Graphics/Material.h b/Source/Asura.Engine/Graphics/Material.h deleted file mode 100644 index 68dfa1e..0000000 --- a/Source/Asura.Engine/Graphics/Material.h +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef __AE_MATERIAL_H__ -#define __AE_MATERIAL_H__ - -#include "Containers/Vector.hpp" -#include "Containers/String.h" -#include "Math/Vector2.h" -#include "Math/Vector3.h" -#include "Math/Vector4.h" -#include "Math/Matrix44.h" -#include "Scripting/Luax.hpp" - -#include "Shader.h" -#include "Texture.h" -#include "Manager.hpp" - -namespace AsuraEngine -{ - namespace Graphics - { - - class MaterialFactory; - - /// - /// 通过材质调整Shader中的uniforms变量。Shader将可以修改的变量暴露给material,每个材质可以差异化配置相同着色器的 - /// 不同参数,通过数据文件(.mat)实现,而不是在代码里配置。所以在Asura中,Shader无法直接应用到渲染流程而必须和一个 - /// 材质关联,由材质修改shader的uniforms,material充当了shader的代理。 - /// - class Material final : public Filesystem::Asset - { - public: - - enum class UniformsType - { - None = 0, - Float, - Int, - Vector2, - Vector3, - Vector4, - Matrix44, - Texture, - Color, - }; - - struct UniformsInfo - { - uint ID; // uniform变量的ID - UniformsType type; // uniform变量的类型 - union - { - float f; - int i; - Math::Vector2 v2; - Math::Vector3 v3; - Math::Vector4 v4; - Math::Matrix44 m44; - Texture* tex; - Color col; - }value; // uniform变量的值 - }; - - void SetShader(Shader* shader); - - // 设置Uniform变量,保存在材质中,渲染时上传到GPU - - /// - /// 获得uniform变量的ID,ID和name的map在shader间共享。设置uniform变量的值时,通过ID查询uniform变量名,在 - /// shader中找到uniform location并对这个location赋值。 - /// - static int GetUniformID(const Containers::String& name); - - void SetTexture(uint ID, Texture* texture); - void SetVector2(uint ID, Math::Vector2* vector2); - void SetVector3(uint ID, Math::Vector3* vector3); - void SetVector4(uint ID, Math::Vector4* vector4); - void SetMatrix44(uint ID, Math::Matrix44* matrix44); - void SetFloat(uint ID, float value); - void SetInteger(uint ID, int value); - void SetColor(uint ID, Color color); - - UniformsInfo GetUniformInfo(uint ID); - float GetUniformInfof(uint ID); - int GetUniformInfoi(uint ID); - Math::Vector2 GetUniformInfov2(uint ID); - Math::Vector3 GetUniformInfov3(uint ID); - Math::Vector4 GetUniformInfov4(uint ID); - Math::Matrix44 GetUniformInfom44(uint ID); - Texture* GetUniformInfotex(uint ID); - Color GetUniformInfocol(uint ID); - - // 上传顶点数据 - - void SetVertexAttributes(); - - private: - - friend class MaterialFactory; - - Material(); - Material(const Material& src); - ~Material(); - - /// - /// - /// - uint mID; - - /// - /// - /// - Shader* mShader; - - /// - /// Uniforms变量的值,映射ID到值 - /// - Containers::Map mUniforms; - - /// - /// 是否是共享的材质 - /// - bool mIsShared; - - //---------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Material); - - LUAX_DECL_METHOD(l_Clone); - - LUAX_DECL_METHOD(l_SetShader); - - LUAX_DECL_METHOD(l_SetTexture); - LUAX_DECL_METHOD(l_SetVector2); - LUAX_DECL_METHOD(l_SetVector3); - LUAX_DECL_METHOD(l_SetVector4); - LUAX_DECL_METHOD(l_SetMatrix44); - LUAX_DECL_METHOD(l_SetFloat); - LUAX_DECL_METHOD(l_SetInteger); - LUAX_DECL_METHOD(l_SetColor); - - LUAX_DECL_METHOD(l_GetUniformInfo); - LUAX_DECL_METHOD(l_GetUniformInfof); - LUAX_DECL_METHOD(l_GetUniformInfoi); - LUAX_DECL_METHOD(l_GetUniformInfov2); - LUAX_DECL_METHOD(l_GetUniformInfov3); - LUAX_DECL_METHOD(l_GetUniformInfov4); - LUAX_DECL_METHOD(l_GetUniformInfom44); - LUAX_DECL_METHOD(l_GetUniformInfotex); - LUAX_DECL_METHOD(l_GetUniformInfocol); - - LUAX_DECL_METHOD(l_SetVertexAttributes); - - }; - - class MaterialManager : public Manager - { - public: - - private: - - /// - /// 所有的image - /// - Containers::Map mMaterials; - - /// - /// image,路径和ID的映射。针对从.asr导入的image,通过路径可以拿到image。所以并不是所有的image都在此map中。 - /// 由程序创建的image只能通过ID来获取,所以程序中需要保留ID。 - /// - Containers::StringMap mMaterialIDs; - - }; - - class MaterialFactory : public Factory - { - public: - - /// - /// 拷贝一个material - /// - Material* Clone(Material* src); - - Material* Create(); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp b/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Mesh2DRenderer.h b/Source/Asura.Engine/Graphics/Mesh2DRenderer.h deleted file mode 100644 index fcbfd2c..0000000 --- a/Source/Asura.Engine/Graphics/Mesh2DRenderer.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __AE_MESH2D_H__ -#define __AE_MESH2D_H__ - -#include "FileSystem/Asset.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Mesh2D : public Filesystem::Asset - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ParticleSystem.cpp b/Source/Asura.Engine/Graphics/ParticleSystem.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/ParticleSystem.h b/Source/Asura.Engine/Graphics/ParticleSystem.h deleted file mode 100644 index 078427a..0000000 --- a/Source/Asura.Engine/Graphics/ParticleSystem.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __AE_PARTICLESYSTEM_H__ -#define __AE_PARTICLESYSTEM_H__ - -#include "Component.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 粒子系统 - /// - class ParticleSystem final : public Component - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Prefab.cpp b/Source/Asura.Engine/Graphics/Prefab.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Prefab.h b/Source/Asura.Engine/Graphics/Prefab.h deleted file mode 100644 index 82a8da2..0000000 --- a/Source/Asura.Engine/Graphics/Prefab.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __AE_PREFAB_H__ -#define __AE_PREFAB_H__ - -#include "Manager.hpp" -#include "FileSystem/Asset.h" - -namespace AsuraEngine -{ - - /// - /// Prefab用来构建GameObject - /// - class Prefab : public Filesystem::Asset - { - - }; - - class PrefabManager : public Manager - { - - }; - - class PrefabFactory - { - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Renderer.cpp b/Source/Asura.Engine/Graphics/Renderer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Renderer.h b/Source/Asura.Engine/Graphics/Renderer.h deleted file mode 100644 index c3677a7..0000000 --- a/Source/Asura.Engine/Graphics/Renderer.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __AE_RENDERER_H__ -#define __AE_RENDERER_H__ - -#include "Component.h" -#include "Material.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 抽象基类,渲染由Renderer类处理,每个Renderer必须具备一个材质。 - /// - class Renderer : public Component - { - public: - - /// - /// 一旦调用此方法,就会拷贝shared material,调用此方法意味着要对material的配置进行修改,如果此时使用的材质是 - /// shared material,则需要拷贝一份,避免影响其他共享的renderer。 - /// - Material* GetMaterial(); - - /// - /// 渲染回调函数 - /// - virtual void OnRender() = 0; - - protected: - - Material* mMaterial; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ShapeRenderer.cpp b/Source/Asura.Engine/Graphics/ShapeRenderer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/ShapeRenderer.h b/Source/Asura.Engine/Graphics/ShapeRenderer.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Sprite.cpp b/Source/Asura.Engine/Graphics/Sprite.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Sprite.h b/Source/Asura.Engine/Graphics/Sprite.h deleted file mode 100644 index b621f1b..0000000 --- a/Source/Asura.Engine/Graphics/Sprite.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __AE_SPRITE_H__ -#define __AE_SPRITE_H__ - -#include "Math/Vector2.h" -#include "Transform.h" -#include "Component.h" -#include "Image.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Sprite是控制image的代理,image是在sprite间共享的数据,sprite可以区别化处理image的属性,如旋转,缩放等。 - /// - class Sprite final : public Filesystem::Asset - { - public: - - enum Type - { - - }; - - /// - /// 对齐方式 - /// - enum Align - { - - }; - - struct SpriteDef - { - Image* image; - Align align; - Math::Vector2 anchor; - Math::Vector2 size; - }; - - Sprite(SpriteDef definition); - ~Sprite(); - - private: - - /// - /// 锚点坐标 - /// - Math::Vector2 mAnchor; - - /// - /// 大小 - /// - Math::Vector2 mSize; - - /// - /// 绑定的image - /// - Image* mImage; - - //---------------------------------------------------------------------------------------------------- - - - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/SpriteRenderer.cpp b/Source/Asura.Engine/Graphics/SpriteRenderer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/SpriteRenderer.h b/Source/Asura.Engine/Graphics/SpriteRenderer.h deleted file mode 100644 index bd81509..0000000 --- a/Source/Asura.Engine/Graphics/SpriteRenderer.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __AE_SPRITE_RENDERER_H__ -#define __AE_SPRITE_RENDERER_H__ - -#include "Renderer.h" -#include "Sprite.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class SpriteRenderer final : public Renderer - { - public: - - void SetSprite(Sprite* sprite); - - void OnRender() override; - - private: - - /// - /// 用来渲染的sprite - /// - Sprite* mSprite; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Window.h b/Source/Asura.Engine/Graphics/Window.h index 1707e3d..ab612fc 100644 --- a/Source/Asura.Engine/Graphics/Window.h +++ b/Source/Asura.Engine/Graphics/Window.h @@ -7,10 +7,15 @@ namespace AsuraEngine { /// - /// 游戏窗口 + /// 窗口,支持多窗口。在编辑器下需要多个窗口支持,runner只需要一个窗口。 /// class Window { + public: + + + private: + }; diff --git a/Source/Asura.Engine/Layer.cpp b/Source/Asura.Engine/Layer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Layer.h b/Source/Asura.Engine/Layer.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/ObjectPool.cpp b/Source/Asura.Engine/ObjectPool.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/ObjectPool.h b/Source/Asura.Engine/ObjectPool.h deleted file mode 100644 index bf97858..0000000 --- a/Source/Asura.Engine/ObjectPool.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __AE_OBJECT_POOL_H__ -#define __AE_OBJECT_POOL_H__ - -namespace AsuraEngine -{ - - class ObjectPool - { - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Scene.cpp b/Source/Asura.Engine/Scene.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Scene.h b/Source/Asura.Engine/Scene.h deleted file mode 100644 index 742d872..0000000 --- a/Source/Asura.Engine/Scene.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __AE_SCENE_H__ -#define __AE_SCENE_H__ - -#include "FileSystem/Asset.h" -#include "Containers/Vector.hpp" -#include "GameObject.h" - -namespace AsuraEngine -{ - - /// - /// 游戏场景 - /// - class Scene final : public Filesystem::Asset - { - public: - - // - - private: - - Containers::Vector mGameObjects; - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Transform.cpp b/Source/Asura.Engine/Transform.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Transform.h b/Source/Asura.Engine/Transform.h deleted file mode 100644 index cca7575..0000000 --- a/Source/Asura.Engine/Transform.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __AE_TRANSFORM_H__ -#define __AE_TRANSFORM_H__ - -#include "Object.h" -#include "Math/Vector2.h" - -namespace AsuraEngine -{ - - /// - /// Transform作为基本属性,不作为组件处理 - /// - class Transform final : public Object - { - private: - Math::Vector2 position; - Math::Vector2 rotation; - Math::Vector2 scale; - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Framework/AI/StateMachine.lua b/Source/Asura.Framework/AI/StateMachine.lua deleted file mode 100644 index 58012ca..0000000 --- a/Source/Asura.Framework/AI/StateMachine.lua +++ /dev/null @@ -1,3 +0,0 @@ -local StateMachine = Class() - -return StateMachine \ No newline at end of file diff --git a/Source/Asura.Framework/Audio/SoundPlayer.lua b/Source/Asura.Framework/Audio/SoundPlayer.lua index 8bbeddb..c3921af 100644 --- a/Source/Asura.Framework/Audio/SoundPlayer.lua +++ b/Source/Asura.Framework/Audio/SoundPlayer.lua @@ -1,3 +1,5 @@ -local SoundPlayer = AsuraEngine.Component.New("SoundPlayer") +local SoundPlayer = AsuraEngine.Component.Sub("SoundPlayer") + + return SoundPlayer \ No newline at end of file diff --git a/Source/Asura.Framework/Class.lua b/Source/Asura.Framework/Class.lua index bec3e9a..164cb4a 100644 --- a/Source/Asura.Framework/Class.lua +++ b/Source/Asura.Framework/Class.lua @@ -1,5 +1,4 @@ local Class = {} +AsuraEngine.Class = Class - -AsuraEngine.Class = Class \ No newline at end of file diff --git a/Source/Asura.Framework/Component.lua b/Source/Asura.Framework/Component.lua index dd843eb..b498a36 100644 --- a/Source/Asura.Framework/Component.lua +++ b/Source/Asura.Framework/Component.lua @@ -1,6 +1,14 @@ -local Component = Class() +local Component = AsuraEngine.Class("Component") -Component.gameobject = AsuraEngine.Type.GameObject +AsuraEngine.Component = Component + +--Component.gameobject = AsuraEngine.Type.GameObject + +--娲剧敓鏂扮殑缁勪欢 +function Component.Sub(cname) + assert(Component.components[cname] == nil) + +end function Component:Ctor(go) self.gameobject = go diff --git a/Source/Asura.Framework/Filesystem/Loader.lua b/Source/Asura.Framework/Filesystem/Loader.lua index 9ac058b..2d1e8cf 100644 --- a/Source/Asura.Framework/Filesystem/Loader.lua +++ b/Source/Asura.Framework/Filesystem/Loader.lua @@ -1,9 +1,14 @@ -local Loader = Class() - -function Loader:InnerResource( data ) - - - +-- Assets loaders +AsuraEngine.Loader = {} +local Loader = AsuraEngine.Loader +Loader.Loaders = {} + +function Loader.New(type) + if Loader.Loaders[type] ~= nil then + return Loader.Loaders[type] + end + local loader = {} + Loader[type] = loader + return loader end -return Loader \ No newline at end of file diff --git a/Source/Asura.Framework/Filesystem/animation_loader.lua b/Source/Asura.Framework/Filesystem/animation_loader.lua index f1dee29..4f989bd 100644 --- a/Source/Asura.Framework/Filesystem/animation_loader.lua +++ b/Source/Asura.Framework/Filesystem/animation_loader.lua @@ -1,11 +1,12 @@ -local AnimationLoader = AsuraEngine.Loader.New("animation") -local AnimationManager = require "AnimationManager" -local Animation = require "Animation" +require "AnimationManager" +require "Animation" + +local loader = AsuraEngine.Loader.New("animation") +local manager = AsuraEngine.AnimationManager +local Animation = AsuraEngine.Animation function AnimationLoader.Load(asset) local animation = AsuraEngine.Class() -end - -return AnimationLoader \ No newline at end of file +end \ No newline at end of file diff --git a/Source/Asura.Framework/Filesystem/material_loader.lua b/Source/Asura.Framework/Filesystem/material_loader.lua index 2ea47f4..2c2058e 100644 --- a/Source/Asura.Framework/Filesystem/material_loader.lua +++ b/Source/Asura.Framework/Filesystem/material_loader.lua @@ -1,8 +1,7 @@ -local MaterialLoader = AsuraEngine.Loader.New("material") -local MaterialManager = require "MaterialManager" +require "MaterialManager" -function MaterialLoader.Load(mat) - -end +local loader = AsuraEngine.Loader.New("material") -return MaterialLoader \ No newline at end of file +function loader.Load(asset) + +end \ No newline at end of file diff --git a/Source/Asura.Framework/Filesystem/path_loader.lua b/Source/Asura.Framework/Filesystem/path_loader.lua index c62be96..8618c03 100644 --- a/Source/Asura.Framework/Filesystem/path_loader.lua +++ b/Source/Asura.Framework/Filesystem/path_loader.lua @@ -1,10 +1,9 @@ -local PathLoader = AsuraEngine.Loader.New("path") -local PathManager = require "Path/PathManager" +require "Path/PathManager" -function PathLoader.Load(asset) +local loader = AsuraEngine.Loader.New("path") + +function loader.Load(asset) if asset.type ~= "path" then return nil end -end - -return Path \ No newline at end of file +end \ No newline at end of file diff --git a/Source/Asura.Framework/Filesystem/scene_loader.lua b/Source/Asura.Framework/Filesystem/scene_loader.lua index e69de29..3284c57 100644 --- a/Source/Asura.Framework/Filesystem/scene_loader.lua +++ b/Source/Asura.Framework/Filesystem/scene_loader.lua @@ -0,0 +1,5 @@ +local loader = AsuraEngine.Loader.New("scene") + +function loader.Load(asset) + +end \ No newline at end of file diff --git a/Source/Asura.Framework/Framework.lua b/Source/Asura.Framework/Framework.lua index b465f78..449cc4a 100644 --- a/Source/Asura.Framework/Framework.lua +++ b/Source/Asura.Framework/Framework.lua @@ -1 +1 @@ -require "" \ No newline at end of file +require "" diff --git a/Source/Asura.Framework/Game.lua b/Source/Asura.Framework/Game.lua index 3e44b53..e69de29 100644 --- a/Source/Asura.Framework/Game.lua +++ b/Source/Asura.Framework/Game.lua @@ -1 +0,0 @@ ---启动脚本,主循环在这里 diff --git a/Source/Asura.Framework/Object.lua b/Source/Asura.Framework/Object.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Framework/Scene.lua b/Source/Asura.Framework/Scene.lua index afe6344..0ef41c7 100644 --- a/Source/Asura.Framework/Scene.lua +++ b/Source/Asura.Framework/Scene.lua @@ -1,8 +1,13 @@ ---[[ -原点在左下角 -]] local Scene = Class() +AsuraEngine.Scene = Scene +function Scene.Ctor(self) + self.entities = {} --褰撳墠鍦烘櫙鐨勬墍鏈塭ntity +end +--鑾峰彇褰撳墠鐨勫満鏅 +function Scene.GetCurrent() + +end return Scene \ No newline at end of file diff --git a/Source/Asura.Framework/Transform.lua b/Source/Asura.Framework/Transform.lua index e69de29..e45a027 100644 --- a/Source/Asura.Framework/Transform.lua +++ b/Source/Asura.Framework/Transform.lua @@ -0,0 +1,8 @@ +local Transform = AsuraEngine.Class("Transform") +AsuraEngine.Transform = Transform + +function Transform.Ctor(self) + self.position = {} + self.rotation = {} + self.size = {} +end diff --git a/Source/Asura.Framework/ai/behavior_tree.lua b/Source/Asura.Framework/ai/behavior_tree.lua new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Framework/ai/state_machine.lua b/Source/Asura.Framework/ai/state_machine.lua new file mode 100644 index 0000000..b1ff849 --- /dev/null +++ b/Source/Asura.Framework/ai/state_machine.lua @@ -0,0 +1,6 @@ +local StateMachine = Class() +AsuraEngine.StateMachine = StateMachine + +function StateMachine.Ctor(self, statemap) + self.statemap = statemap +end \ No newline at end of file diff --git a/Source/Asura.Framework/ai/state_map.lua b/Source/Asura.Framework/ai/state_map.lua new file mode 100644 index 0000000..7e986de --- /dev/null +++ b/Source/Asura.Framework/ai/state_map.lua @@ -0,0 +1,12 @@ +local StateMap = AsuraEngine.Asset.Sub("StateMap") + +AsuraEngine.StateMap = StateMap + +function StateMap.Ctor(self) + +end + +function StateMap.ToAsset() + +end + diff --git a/Source/Asura.Framework/ai/statemachine.lua b/Source/Asura.Framework/ai/statemachine.lua deleted file mode 100644 index 58012ca..0000000 --- a/Source/Asura.Framework/ai/statemachine.lua +++ /dev/null @@ -1,3 +0,0 @@ -local StateMachine = Class() - -return StateMachine \ No newline at end of file diff --git a/Source/Asura.Framework/audio/soundplayer.lua b/Source/Asura.Framework/audio/soundplayer.lua index 8bbeddb..c3921af 100644 --- a/Source/Asura.Framework/audio/soundplayer.lua +++ b/Source/Asura.Framework/audio/soundplayer.lua @@ -1,3 +1,5 @@ -local SoundPlayer = AsuraEngine.Component.New("SoundPlayer") +local SoundPlayer = AsuraEngine.Component.Sub("SoundPlayer") + + return SoundPlayer \ No newline at end of file diff --git a/Source/Asura.Framework/class.lua b/Source/Asura.Framework/class.lua index bec3e9a..164cb4a 100644 --- a/Source/Asura.Framework/class.lua +++ b/Source/Asura.Framework/class.lua @@ -1,5 +1,4 @@ local Class = {} +AsuraEngine.Class = Class - -AsuraEngine.Class = Class \ No newline at end of file diff --git a/Source/Asura.Framework/component.lua b/Source/Asura.Framework/component.lua index dd843eb..b498a36 100644 --- a/Source/Asura.Framework/component.lua +++ b/Source/Asura.Framework/component.lua @@ -1,6 +1,14 @@ -local Component = Class() +local Component = AsuraEngine.Class("Component") -Component.gameobject = AsuraEngine.Type.GameObject +AsuraEngine.Component = Component + +--Component.gameobject = AsuraEngine.Type.GameObject + +--娲剧敓鏂扮殑缁勪欢 +function Component.Sub(cname) + assert(Component.components[cname] == nil) + +end function Component:Ctor(go) self.gameobject = go diff --git a/Source/Asura.Framework/entity.lua b/Source/Asura.Framework/entity.lua index ffd9b65..0edded4 100644 --- a/Source/Asura.Framework/entity.lua +++ b/Source/Asura.Framework/entity.lua @@ -1,27 +1,76 @@ -local Entity = AsuraEngine.Asset.SubClass("Entity") +--[[ +瀹炰綋锛屼綔涓簊cene涓殑瀹炰綋瀛樺湪銆 +]] +require "transform" -function Entity:OnEnable() +local Entity = AsuraEngine.Asset.Sub("Entity") +AsuraEngine.Entity = Entity +function Entity:Ctor() + self.transform = AsuraEngine.Transform.New() end -function Entity:OnEvent(e) +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:OnUpdate(dt) +--鏍规嵁缁勪欢绫诲瀷鎷垮埌缁勪欢 +function Entity:GetComponentByType(tname) end -function Entity:OnRender() +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:OnDisable() +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() @@ -52,6 +101,7 @@ function Entity:SetRotation() end +--鍐檃sset function Entity:ToAsset() end diff --git a/Source/Asura.Framework/filesystem/animation_loader.lua b/Source/Asura.Framework/filesystem/animation_loader.lua index f1dee29..4f989bd 100644 --- a/Source/Asura.Framework/filesystem/animation_loader.lua +++ b/Source/Asura.Framework/filesystem/animation_loader.lua @@ -1,11 +1,12 @@ -local AnimationLoader = AsuraEngine.Loader.New("animation") -local AnimationManager = require "AnimationManager" -local Animation = require "Animation" +require "AnimationManager" +require "Animation" + +local loader = AsuraEngine.Loader.New("animation") +local manager = AsuraEngine.AnimationManager +local Animation = AsuraEngine.Animation function AnimationLoader.Load(asset) local animation = AsuraEngine.Class() -end - -return AnimationLoader \ No newline at end of file +end \ No newline at end of file diff --git a/Source/Asura.Framework/filesystem/entity_loader.lua b/Source/Asura.Framework/filesystem/entity_loader.lua index ad2351c..67a849d 100644 --- a/Source/Asura.Framework/filesystem/entity_loader.lua +++ b/Source/Asura.Framework/filesystem/entity_loader.lua @@ -1,2 +1,5 @@ -local EntityLoader = AsuraEngine.Loader.New("entity") +local loader = AsuraEngine.Loader.New("entity") +function loader.Load(asset) + +end \ No newline at end of file diff --git a/Source/Asura.Framework/filesystem/loader.lua b/Source/Asura.Framework/filesystem/loader.lua index 9ac058b..2d1e8cf 100644 --- a/Source/Asura.Framework/filesystem/loader.lua +++ b/Source/Asura.Framework/filesystem/loader.lua @@ -1,9 +1,14 @@ -local Loader = Class() - -function Loader:InnerResource( data ) - - - +-- Assets loaders +AsuraEngine.Loader = {} +local Loader = AsuraEngine.Loader +Loader.Loaders = {} + +function Loader.New(type) + if Loader.Loaders[type] ~= nil then + return Loader.Loaders[type] + end + local loader = {} + Loader[type] = loader + return loader end -return Loader \ No newline at end of file diff --git a/Source/Asura.Framework/filesystem/material_loader.lua b/Source/Asura.Framework/filesystem/material_loader.lua index 2ea47f4..2c2058e 100644 --- a/Source/Asura.Framework/filesystem/material_loader.lua +++ b/Source/Asura.Framework/filesystem/material_loader.lua @@ -1,8 +1,7 @@ -local MaterialLoader = AsuraEngine.Loader.New("material") -local MaterialManager = require "MaterialManager" +require "MaterialManager" -function MaterialLoader.Load(mat) - -end +local loader = AsuraEngine.Loader.New("material") -return MaterialLoader \ No newline at end of file +function loader.Load(asset) + +end \ No newline at end of file diff --git a/Source/Asura.Framework/filesystem/path_loader.lua b/Source/Asura.Framework/filesystem/path_loader.lua index c62be96..8618c03 100644 --- a/Source/Asura.Framework/filesystem/path_loader.lua +++ b/Source/Asura.Framework/filesystem/path_loader.lua @@ -1,10 +1,9 @@ -local PathLoader = AsuraEngine.Loader.New("path") -local PathManager = require "Path/PathManager" +require "Path/PathManager" -function PathLoader.Load(asset) +local loader = AsuraEngine.Loader.New("path") + +function loader.Load(asset) if asset.type ~= "path" then return nil end -end - -return Path \ No newline at end of file +end \ No newline at end of file diff --git a/Source/Asura.Framework/filesystem/scene_loader.lua b/Source/Asura.Framework/filesystem/scene_loader.lua index e69de29..3284c57 100644 --- a/Source/Asura.Framework/filesystem/scene_loader.lua +++ b/Source/Asura.Framework/filesystem/scene_loader.lua @@ -0,0 +1,5 @@ +local loader = AsuraEngine.Loader.New("scene") + +function loader.Load(asset) + +end \ No newline at end of file diff --git a/Source/Asura.Framework/filesystem/statemap_loader.lua b/Source/Asura.Framework/filesystem/statemap_loader.lua new file mode 100644 index 0000000..ededcfc --- /dev/null +++ b/Source/Asura.Framework/filesystem/statemap_loader.lua @@ -0,0 +1,7 @@ +require "ai/statemap_manager" +local loader = AsuraEngine.Loader.New("statemap") + +--杞藉叆statemap +function loader.Load(asset) + +end \ No newline at end of file diff --git a/Source/Asura.Framework/framework.lua b/Source/Asura.Framework/framework.lua index b465f78..449cc4a 100644 --- a/Source/Asura.Framework/framework.lua +++ b/Source/Asura.Framework/framework.lua @@ -1 +1 @@ -require "" \ No newline at end of file +require "" diff --git a/Source/Asura.Framework/game.lua b/Source/Asura.Framework/game.lua index 3e44b53..e69de29 100644 --- a/Source/Asura.Framework/game.lua +++ b/Source/Asura.Framework/game.lua @@ -1 +0,0 @@ ---启动脚本,主循环在这里 diff --git a/Source/Asura.Framework/object.lua b/Source/Asura.Framework/object.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Framework/scene.lua b/Source/Asura.Framework/scene.lua index afe6344..0ef41c7 100644 --- a/Source/Asura.Framework/scene.lua +++ b/Source/Asura.Framework/scene.lua @@ -1,8 +1,13 @@ ---[[ -原点在左下角 -]] local Scene = Class() +AsuraEngine.Scene = Scene +function Scene.Ctor(self) + self.entities = {} --褰撳墠鍦烘櫙鐨勬墍鏈塭ntity +end +--鑾峰彇褰撳墠鐨勫満鏅 +function Scene.GetCurrent() + +end return Scene \ No newline at end of file diff --git a/Source/Asura.Framework/transform.lua b/Source/Asura.Framework/transform.lua index e69de29..e45a027 100644 --- a/Source/Asura.Framework/transform.lua +++ b/Source/Asura.Framework/transform.lua @@ -0,0 +1,8 @@ +local Transform = AsuraEngine.Class("Transform") +AsuraEngine.Transform = Transform + +function Transform.Ctor(self) + self.position = {} + self.rotation = {} + self.size = {} +end -- cgit v1.1-26-g67d0