From 91e589d1678a8187c307e09b98b67ec4133092ff Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 19 Jan 2019 01:44:05 +0800 Subject: =?UTF-8?q?*=E6=B8=B8=E6=88=8F=E6=A1=86=E6=9E=B6=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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/Asura.h | 6 + Source/Asura.Engine/Audio/Sound.cpp | 0 Source/Asura.Engine/Audio/Sound.h | 0 Source/Asura.Engine/Audio/Source.cpp | 0 Source/Asura.Engine/Audio/Source.h | 0 Source/Asura.Engine/Component.cpp | 0 Source/Asura.Engine/Component.h | 43 +++++ Source/Asura.Engine/Containers/Map.cpp | 0 Source/Asura.Engine/Containers/Map.h | 17 ++ Source/Asura.Engine/Containers/Stack.cpp | 0 Source/Asura.Engine/Containers/Stack.h | 0 Source/Asura.Engine/Containers/String.cpp | 0 Source/Asura.Engine/Containers/String.h | 78 +++++++++ Source/Asura.Engine/Containers/StringMap.cpp | 0 Source/Asura.Engine/Containers/StringMap.hpp | 32 ++++ Source/Asura.Engine/Containers/UnorderedMap.hpp | 0 Source/Asura.Engine/Containers/Vector.hpp | 16 ++ Source/Asura.Engine/Exceptions/Exception.cpp | 0 Source/Asura.Engine/Exceptions/Exception.h | 0 Source/Asura.Engine/Factory.h | 14 ++ Source/Asura.Engine/FileSystem/AnimationImpoter.h | 20 +++ Source/Asura.Engine/FileSystem/Asset.cpp | 0 Source/Asura.Engine/FileSystem/Asset.h | 22 +++ Source/Asura.Engine/FileSystem/ImageImpoter.h | 20 +++ Source/Asura.Engine/FileSystem/Importer.h | 17 ++ .../FileSystem/ParticleSystemImpoter.h | 20 +++ Source/Asura.Engine/FileSystem/SpriteImpoter.h | 20 +++ Source/Asura.Engine/Font/TrueTypeFont.cpp | 0 Source/Asura.Engine/Font/TrueTypeFont.h | 0 Source/Asura.Engine/GUI/Button.cpp | 0 Source/Asura.Engine/GUI/README.md | 1 + 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/Canvas.cpp | 0 Source/Asura.Engine/Graphics/Canvas.h | 20 +++ Source/Asura.Engine/Graphics/CanvasRenderer.cpp | 0 Source/Asura.Engine/Graphics/CanvasRenderer.h | 30 ++++ Source/Asura.Engine/Graphics/Color.cpp | 0 Source/Asura.Engine/Graphics/Color.h | 30 ++++ Source/Asura.Engine/Graphics/Image.cpp | 0 Source/Asura.Engine/Graphics/Image.h | 119 +++++++++++++ Source/Asura.Engine/Graphics/Material.cpp | 18 ++ Source/Asura.Engine/Graphics/Material.h | 189 +++++++++++++++++++++ Source/Asura.Engine/Graphics/Mesh2D.cpp | 0 Source/Asura.Engine/Graphics/Mesh2D.h | 20 +++ Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp | 0 Source/Asura.Engine/Graphics/Mesh2DRenderer.h | 19 +++ Source/Asura.Engine/Graphics/OpenGL.cpp | 11 ++ Source/Asura.Engine/Graphics/OpenGL.h | 17 ++ 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/Shader.cpp | 0 Source/Asura.Engine/Graphics/Shader.h | 67 ++++++++ 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/SpriteBatch.cpp | 0 Source/Asura.Engine/Graphics/SpriteBatch.h | 0 Source/Asura.Engine/Graphics/SpriteRenderer.cpp | 0 Source/Asura.Engine/Graphics/SpriteRenderer.h | 32 ++++ Source/Asura.Engine/Graphics/Texture.cpp | 0 Source/Asura.Engine/Graphics/Texture.h | 22 +++ Source/Asura.Engine/Input/Keyboard.cpp | 0 Source/Asura.Engine/Input/Keyboard.h | 0 Source/Asura.Engine/Layer.cpp | 0 Source/Asura.Engine/Layer.h | 0 Source/Asura.Engine/Manager.hpp | 14 ++ Source/Asura.Engine/Math/Curve.cpp | 0 Source/Asura.Engine/Math/Curve.h | 0 Source/Asura.Engine/Math/Functions.cpp | 0 Source/Asura.Engine/Math/Functions.h | 0 Source/Asura.Engine/Math/Matrix44.cpp | 0 Source/Asura.Engine/Math/Matrix44.h | 24 +++ Source/Asura.Engine/Math/RangedValue.cpp | 0 Source/Asura.Engine/Math/RangedValue.h | 0 Source/Asura.Engine/Math/Vector2.cpp | 0 Source/Asura.Engine/Math/Vector2.h | 17 ++ Source/Asura.Engine/Math/Vector3.cpp | 0 Source/Asura.Engine/Math/Vector3.h | 17 ++ Source/Asura.Engine/Math/Vector4.cpp | 0 Source/Asura.Engine/Math/Vector4.h | 17 ++ Source/Asura.Engine/Object.cpp | 23 +++ Source/Asura.Engine/Object.h | 32 ++++ Source/Asura.Engine/ObjectPool.cpp | 0 Source/Asura.Engine/ObjectPool.h | 14 ++ Source/Asura.Engine/Physics/World.h | 14 ++ Source/Asura.Engine/Profiler/Stats.cpp | 0 Source/Asura.Engine/Profiler/Stats.h | 0 Source/Asura.Engine/Scene.cpp | 0 Source/Asura.Engine/Scene.h | 28 +++ Source/Asura.Engine/Scripting/Luax.hpp | 8 + Source/Asura.Engine/Time/Timer.cpp | 0 Source/Asura.Engine/Time/Timer.h | 0 Source/Asura.Engine/Transform.cpp | 0 Source/Asura.Engine/Transform.h | 24 +++ Source/Asura.Engine/Type.h | 24 +++ 113 files changed, 1750 insertions(+) create mode 100644 Source/Asura.Engine/AI/BehaviorTree.cpp create mode 100644 Source/Asura.Engine/AI/BehaviorTree.h create mode 100644 Source/Asura.Engine/AI/StateMachine.cpp create mode 100644 Source/Asura.Engine/AI/StateMachine.h create mode 100644 Source/Asura.Engine/AI/StateMap.cpp create mode 100644 Source/Asura.Engine/AI/StateMap.h create mode 100644 Source/Asura.Engine/Asura.h create mode 100644 Source/Asura.Engine/Audio/Sound.cpp create mode 100644 Source/Asura.Engine/Audio/Sound.h create mode 100644 Source/Asura.Engine/Audio/Source.cpp create mode 100644 Source/Asura.Engine/Audio/Source.h create mode 100644 Source/Asura.Engine/Component.cpp create mode 100644 Source/Asura.Engine/Component.h create mode 100644 Source/Asura.Engine/Containers/Map.cpp create mode 100644 Source/Asura.Engine/Containers/Map.h create mode 100644 Source/Asura.Engine/Containers/Stack.cpp create mode 100644 Source/Asura.Engine/Containers/Stack.h create mode 100644 Source/Asura.Engine/Containers/String.cpp create mode 100644 Source/Asura.Engine/Containers/String.h create mode 100644 Source/Asura.Engine/Containers/StringMap.cpp create mode 100644 Source/Asura.Engine/Containers/StringMap.hpp create mode 100644 Source/Asura.Engine/Containers/UnorderedMap.hpp create mode 100644 Source/Asura.Engine/Containers/Vector.hpp create mode 100644 Source/Asura.Engine/Exceptions/Exception.cpp create mode 100644 Source/Asura.Engine/Exceptions/Exception.h create mode 100644 Source/Asura.Engine/Factory.h create mode 100644 Source/Asura.Engine/FileSystem/AnimationImpoter.h create mode 100644 Source/Asura.Engine/FileSystem/Asset.cpp create mode 100644 Source/Asura.Engine/FileSystem/Asset.h create mode 100644 Source/Asura.Engine/FileSystem/ImageImpoter.h create mode 100644 Source/Asura.Engine/FileSystem/Importer.h create mode 100644 Source/Asura.Engine/FileSystem/ParticleSystemImpoter.h create mode 100644 Source/Asura.Engine/FileSystem/SpriteImpoter.h create mode 100644 Source/Asura.Engine/Font/TrueTypeFont.cpp create mode 100644 Source/Asura.Engine/Font/TrueTypeFont.h create mode 100644 Source/Asura.Engine/GUI/Button.cpp create mode 100644 Source/Asura.Engine/GUI/README.md create mode 100644 Source/Asura.Engine/GameObject.cpp create mode 100644 Source/Asura.Engine/GameObject.h create mode 100644 Source/Asura.Engine/Graphics/Animation.cpp create mode 100644 Source/Asura.Engine/Graphics/Animation.h create mode 100644 Source/Asura.Engine/Graphics/Animator.cpp create mode 100644 Source/Asura.Engine/Graphics/Animator.h create mode 100644 Source/Asura.Engine/Graphics/Camera.cpp create mode 100644 Source/Asura.Engine/Graphics/Camera.h create mode 100644 Source/Asura.Engine/Graphics/Canvas.cpp create mode 100644 Source/Asura.Engine/Graphics/Canvas.h create mode 100644 Source/Asura.Engine/Graphics/CanvasRenderer.cpp create mode 100644 Source/Asura.Engine/Graphics/CanvasRenderer.h create mode 100644 Source/Asura.Engine/Graphics/Color.cpp create mode 100644 Source/Asura.Engine/Graphics/Color.h create mode 100644 Source/Asura.Engine/Graphics/Image.cpp create mode 100644 Source/Asura.Engine/Graphics/Image.h create mode 100644 Source/Asura.Engine/Graphics/Material.cpp create mode 100644 Source/Asura.Engine/Graphics/Material.h create mode 100644 Source/Asura.Engine/Graphics/Mesh2D.cpp create mode 100644 Source/Asura.Engine/Graphics/Mesh2D.h create mode 100644 Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp create mode 100644 Source/Asura.Engine/Graphics/Mesh2DRenderer.h create mode 100644 Source/Asura.Engine/Graphics/OpenGL.cpp create mode 100644 Source/Asura.Engine/Graphics/OpenGL.h create mode 100644 Source/Asura.Engine/Graphics/ParticleSystem.cpp create mode 100644 Source/Asura.Engine/Graphics/ParticleSystem.h create mode 100644 Source/Asura.Engine/Graphics/Prefab.cpp create mode 100644 Source/Asura.Engine/Graphics/Prefab.h create mode 100644 Source/Asura.Engine/Graphics/Renderer.cpp create mode 100644 Source/Asura.Engine/Graphics/Renderer.h create mode 100644 Source/Asura.Engine/Graphics/Shader.cpp create mode 100644 Source/Asura.Engine/Graphics/Shader.h create mode 100644 Source/Asura.Engine/Graphics/ShapeRenderer.cpp create mode 100644 Source/Asura.Engine/Graphics/ShapeRenderer.h create mode 100644 Source/Asura.Engine/Graphics/Sprite.cpp create mode 100644 Source/Asura.Engine/Graphics/Sprite.h create mode 100644 Source/Asura.Engine/Graphics/SpriteBatch.cpp create mode 100644 Source/Asura.Engine/Graphics/SpriteBatch.h create mode 100644 Source/Asura.Engine/Graphics/SpriteRenderer.cpp create mode 100644 Source/Asura.Engine/Graphics/SpriteRenderer.h create mode 100644 Source/Asura.Engine/Graphics/Texture.cpp create mode 100644 Source/Asura.Engine/Graphics/Texture.h create mode 100644 Source/Asura.Engine/Input/Keyboard.cpp create mode 100644 Source/Asura.Engine/Input/Keyboard.h create mode 100644 Source/Asura.Engine/Layer.cpp create mode 100644 Source/Asura.Engine/Layer.h create mode 100644 Source/Asura.Engine/Manager.hpp create mode 100644 Source/Asura.Engine/Math/Curve.cpp create mode 100644 Source/Asura.Engine/Math/Curve.h create mode 100644 Source/Asura.Engine/Math/Functions.cpp create mode 100644 Source/Asura.Engine/Math/Functions.h create mode 100644 Source/Asura.Engine/Math/Matrix44.cpp create mode 100644 Source/Asura.Engine/Math/Matrix44.h create mode 100644 Source/Asura.Engine/Math/RangedValue.cpp create mode 100644 Source/Asura.Engine/Math/RangedValue.h create mode 100644 Source/Asura.Engine/Math/Vector2.cpp create mode 100644 Source/Asura.Engine/Math/Vector2.h create mode 100644 Source/Asura.Engine/Math/Vector3.cpp create mode 100644 Source/Asura.Engine/Math/Vector3.h create mode 100644 Source/Asura.Engine/Math/Vector4.cpp create mode 100644 Source/Asura.Engine/Math/Vector4.h create mode 100644 Source/Asura.Engine/Object.cpp create mode 100644 Source/Asura.Engine/Object.h create mode 100644 Source/Asura.Engine/ObjectPool.cpp create mode 100644 Source/Asura.Engine/ObjectPool.h create mode 100644 Source/Asura.Engine/Physics/World.h create mode 100644 Source/Asura.Engine/Profiler/Stats.cpp create mode 100644 Source/Asura.Engine/Profiler/Stats.h create mode 100644 Source/Asura.Engine/Scene.cpp create mode 100644 Source/Asura.Engine/Scene.h create mode 100644 Source/Asura.Engine/Scripting/Luax.hpp create mode 100644 Source/Asura.Engine/Time/Timer.cpp create mode 100644 Source/Asura.Engine/Time/Timer.h create mode 100644 Source/Asura.Engine/Transform.cpp create mode 100644 Source/Asura.Engine/Transform.h create mode 100644 Source/Asura.Engine/Type.h (limited to 'Source/Asura.Engine') diff --git a/Source/Asura.Engine/AI/BehaviorTree.cpp b/Source/Asura.Engine/AI/BehaviorTree.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/AI/BehaviorTree.h b/Source/Asura.Engine/AI/BehaviorTree.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/AI/StateMachine.cpp b/Source/Asura.Engine/AI/StateMachine.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/AI/StateMachine.h b/Source/Asura.Engine/AI/StateMachine.h new file mode 100644 index 0000000..17f8945 --- /dev/null +++ b/Source/Asura.Engine/AI/StateMachine.h @@ -0,0 +1,33 @@ +#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 new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/AI/StateMap.h b/Source/Asura.Engine/AI/StateMap.h new file mode 100644 index 0000000..873e1d9 --- /dev/null +++ b/Source/Asura.Engine/AI/StateMap.h @@ -0,0 +1,25 @@ +#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/Asura.h b/Source/Asura.Engine/Asura.h new file mode 100644 index 0000000..dfa0fa5 --- /dev/null +++ b/Source/Asura.Engine/Asura.h @@ -0,0 +1,6 @@ +#ifndef __AE_H__ +#define __AE_H__ + + + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Audio/Sound.cpp b/Source/Asura.Engine/Audio/Sound.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Audio/Sound.h b/Source/Asura.Engine/Audio/Sound.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Audio/Source.cpp b/Source/Asura.Engine/Audio/Source.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Audio/Source.h b/Source/Asura.Engine/Audio/Source.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Component.cpp b/Source/Asura.Engine/Component.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Component.h b/Source/Asura.Engine/Component.h new file mode 100644 index 0000000..807bbba --- /dev/null +++ b/Source/Asura.Engine/Component.h @@ -0,0 +1,43 @@ +#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/Containers/Map.cpp b/Source/Asura.Engine/Containers/Map.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Containers/Map.h b/Source/Asura.Engine/Containers/Map.h new file mode 100644 index 0000000..2caedef --- /dev/null +++ b/Source/Asura.Engine/Containers/Map.h @@ -0,0 +1,17 @@ +#ifndef __AE_MAP_H__ +#define __AE_MAP_H__ + +#include + +namespace AsuraEngine +{ + namespace Containers + { + + template + using Map = std::map; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Containers/Stack.cpp b/Source/Asura.Engine/Containers/Stack.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Containers/Stack.h b/Source/Asura.Engine/Containers/Stack.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Containers/String.cpp b/Source/Asura.Engine/Containers/String.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Containers/String.h b/Source/Asura.Engine/Containers/String.h new file mode 100644 index 0000000..3c806fb --- /dev/null +++ b/Source/Asura.Engine/Containers/String.h @@ -0,0 +1,78 @@ +#ifndef __AE_STRING_H__ +#define __AE_STRING_H__ + +#include + +namespace AsuraEngine +{ + namespace Containers + { + + /// + /// 封装std::string + /// + class String : public std::string + { + public: + inline String() + : std::string() + { + } + + inline String(const std::string& str) + : std::string(str) + { + } + + inline String(const String& str) + : std::string(str) + { + } + + inline String(const char* str) + : std::string(str) + { + } + + inline String& operator = (const String& str) + { + std::string::operator=(str); + return *this; + } + + inline operator const char* () const + { + return this->c_str(); + } + + inline const char* str() const + { + return this->c_str(); + } + + inline String(const String& s2, size_type pos2, size_type len2) + : std::string(s2, pos2, len2) + { + } + + inline String(const char* buf, size_type bufsize) + : std::string(buf, bufsize) + { + } + + inline String(size_type repetitions, char c) + : std::string(repetitions, c) + { + } + + inline int length() const + { + return size(); + } + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Containers/StringMap.cpp b/Source/Asura.Engine/Containers/StringMap.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Containers/StringMap.hpp b/Source/Asura.Engine/Containers/StringMap.hpp new file mode 100644 index 0000000..94858a7 --- /dev/null +++ b/Source/Asura.Engine/Containers/StringMap.hpp @@ -0,0 +1,32 @@ +#ifndef __AE_STRINGMAP_H__ +#define __AE_STRINGMAP_H__ + +#include "String.h" + +namespace AsuraEngine +{ + namespace Containers + { + + /// + /// 一个双向一一对应的映射,用来储存shader uniforms、statemathine state parameter的ID。 + /// + template + class StringMap + { + public: + + bool ContainsKey(const key_type& key); + + bool ContainsString(const String& str); + + String GetStringByKey(const key_type& key); + + key_type GetKeyByString(const String& str); + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Containers/UnorderedMap.hpp b/Source/Asura.Engine/Containers/UnorderedMap.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Containers/Vector.hpp b/Source/Asura.Engine/Containers/Vector.hpp new file mode 100644 index 0000000..9fbd52a --- /dev/null +++ b/Source/Asura.Engine/Containers/Vector.hpp @@ -0,0 +1,16 @@ +#ifndef __AE_VECTOR_HPP__ +#define __AE_VECTOR_HPP__ + +#include + +namespace AsuraEngine +{ + namespace Containers + { + template + using Vector = std::vector; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Exceptions/Exception.cpp b/Source/Asura.Engine/Exceptions/Exception.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Exceptions/Exception.h b/Source/Asura.Engine/Exceptions/Exception.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Factory.h b/Source/Asura.Engine/Factory.h new file mode 100644 index 0000000..0cccab2 --- /dev/null +++ b/Source/Asura.Engine/Factory.h @@ -0,0 +1,14 @@ +#ifndef __AE_FACTORY_H__ +#define __AE_FACTORY_H__ + +namespace AsuraEngine +{ + + class Factory + { + + }; + +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/AnimationImpoter.h b/Source/Asura.Engine/FileSystem/AnimationImpoter.h new file mode 100644 index 0000000..57fdfdb --- /dev/null +++ b/Source/Asura.Engine/FileSystem/AnimationImpoter.h @@ -0,0 +1,20 @@ +#ifndef __AE_IMAGE_IMPORTER_H__ +#define __AE_IMAGE_IMPORTER_H___ + +namespace AsuraEngine +{ + namespace Filesystem + { + + /// + /// 从.asr导入animation + /// + class AnimationImporter + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/Asset.cpp b/Source/Asura.Engine/FileSystem/Asset.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/FileSystem/Asset.h b/Source/Asura.Engine/FileSystem/Asset.h new file mode 100644 index 0000000..9fc6607 --- /dev/null +++ b/Source/Asura.Engine/FileSystem/Asset.h @@ -0,0 +1,22 @@ +#ifndef __AE_ASSET_H__ +#define __AE_ASSET_H__ + +#include "Object.h" + +namespace AsuraEngine +{ + namespace Filesystem + { + + /// + /// Asset不会作为组件。 + /// + class Asset : public Object + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/ImageImpoter.h b/Source/Asura.Engine/FileSystem/ImageImpoter.h new file mode 100644 index 0000000..ca7cb9a --- /dev/null +++ b/Source/Asura.Engine/FileSystem/ImageImpoter.h @@ -0,0 +1,20 @@ +#ifndef __AE_IMAGE_IMPORTER_H__ +#define __AE_IMAGE_IMPORTER_H___ + +namespace AsuraEngine +{ + namespace Filesystem + { + + /// + /// 从.asr导入image + /// + class ImageImporter + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/Importer.h b/Source/Asura.Engine/FileSystem/Importer.h new file mode 100644 index 0000000..b343a92 --- /dev/null +++ b/Source/Asura.Engine/FileSystem/Importer.h @@ -0,0 +1,17 @@ +#ifndef __AE_IMPORTER_H__ +#define __AE_IMPORTER_H__ + +namespace AsuraEngine +{ + namespace Filesystem + { + + class Importer + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/ParticleSystemImpoter.h b/Source/Asura.Engine/FileSystem/ParticleSystemImpoter.h new file mode 100644 index 0000000..92796f3 --- /dev/null +++ b/Source/Asura.Engine/FileSystem/ParticleSystemImpoter.h @@ -0,0 +1,20 @@ +#ifndef __AE_IMAGE_IMPORTER_H__ +#define __AE_IMAGE_IMPORTER_H___ + +namespace AsuraEngine +{ + namespace Filesystem + { + + /// + /// 从.asr导入particle system + /// + class ParticleSystemImporter + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/SpriteImpoter.h b/Source/Asura.Engine/FileSystem/SpriteImpoter.h new file mode 100644 index 0000000..0e157c1 --- /dev/null +++ b/Source/Asura.Engine/FileSystem/SpriteImpoter.h @@ -0,0 +1,20 @@ +#ifndef __AE_IMAGE_IMPORTER_H__ +#define __AE_IMAGE_IMPORTER_H___ + +namespace AsuraEngine +{ + namespace Filesystem + { + + /// + /// 从.asr导入sprite + /// + class SpriteImporter + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Font/TrueTypeFont.cpp b/Source/Asura.Engine/Font/TrueTypeFont.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Font/TrueTypeFont.h b/Source/Asura.Engine/Font/TrueTypeFont.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/GUI/Button.cpp b/Source/Asura.Engine/GUI/Button.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/GUI/README.md b/Source/Asura.Engine/GUI/README.md new file mode 100644 index 0000000..3e367c7 --- /dev/null +++ b/Source/Asura.Engine/GUI/README.md @@ -0,0 +1 @@ +immediate mode game gui \ No newline at end of file diff --git a/Source/Asura.Engine/GameObject.cpp b/Source/Asura.Engine/GameObject.cpp new file mode 100644 index 0000000..322f798 --- /dev/null +++ b/Source/Asura.Engine/GameObject.cpp @@ -0,0 +1,11 @@ +#include "GameObject.h" + +namespace AsuraEngine +{ + + void GameObject::OnUpdate(uint32 milliseconds) + { + + } + +} diff --git a/Source/Asura.Engine/GameObject.h b/Source/Asura.Engine/GameObject.h new file mode 100644 index 0000000..85dc87f --- /dev/null +++ b/Source/Asura.Engine/GameObject.h @@ -0,0 +1,56 @@ +#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 new file mode 100644 index 0000000..47643aa --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animation.cpp @@ -0,0 +1,21 @@ +#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 new file mode 100644 index 0000000..391da22 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animation.h @@ -0,0 +1,128 @@ +#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 new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Animator.h b/Source/Asura.Engine/Graphics/Animator.h new file mode 100644 index 0000000..4d3d269 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animator.h @@ -0,0 +1,96 @@ +#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 new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Camera.h b/Source/Asura.Engine/Graphics/Camera.h new file mode 100644 index 0000000..699d342 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Camera.h @@ -0,0 +1,42 @@ +#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/Canvas.cpp b/Source/Asura.Engine/Graphics/Canvas.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Canvas.h b/Source/Asura.Engine/Graphics/Canvas.h new file mode 100644 index 0000000..cd78194 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Canvas.h @@ -0,0 +1,20 @@ +#ifndef __AE_Canvas_H__ +#define __AE_Canvas_H__ + +#include "Component.h" +#include "Texture.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class Canvas : public Texture, public Component + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/CanvasRenderer.cpp b/Source/Asura.Engine/Graphics/CanvasRenderer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/CanvasRenderer.h b/Source/Asura.Engine/Graphics/CanvasRenderer.h new file mode 100644 index 0000000..ef188a5 --- /dev/null +++ b/Source/Asura.Engine/Graphics/CanvasRenderer.h @@ -0,0 +1,30 @@ +#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/Color.cpp b/Source/Asura.Engine/Graphics/Color.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Color.h b/Source/Asura.Engine/Graphics/Color.h new file mode 100644 index 0000000..f172156 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Color.h @@ -0,0 +1,30 @@ +#ifndef __AE_COLOR_H__ +#define __AE_COLOR_H__ + +#include "Type.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 32bits颜色 + /// + class Color + { + public: + + Color(byte r, byte g, byte b, byte a); + ~Color(); + + private: + + byte mR, mG, mB, mA; + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Image.cpp b/Source/Asura.Engine/Graphics/Image.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h new file mode 100644 index 0000000..5b27079 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Image.h @@ -0,0 +1,119 @@ +#ifndef __AE_IMAGE_H__ +#define __AE_IMAGE_H__ + +#include "Math/Vector2.h" +#include "Manager.hpp" +#include "Texture.h" +#include "Color.h" +#include "Factory.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class ImageFactory; + + /// + /// Image是图片从内存中载入后,读取进游戏后保存的结果。一个Image在内存、显存中只会保存一份,不会产生副本。需要特征 + /// 化的区别image,如锚点位置,缩放和旋转角度,使用sprite。基本是一个只读类。 + /// + class Image final : public Texture, public Filesystem::Asset + { + public: + + uint GetWidth(); + uint GetHeight(); + + /// + /// 获得某一个位置的像素 + /// + Color GetPixel(uint x, uint y); + + private: + + friend class ImageFactory; + + Image(Color* pixels, int width, int height); + ~Image(); + + /// + /// 大小(以像素为单位) + /// + uint mWidth, mHeight; + Color* mPixels; + + /// + /// ID + /// + uint mID; + + }; + + /// + /// + /// + class ImageManager : public Manager + { + public: + + /// + /// 通过ID获取路径,如果是程序创建的图片,返回String::Null + /// + Containers::String GetImagePath(uint ID); + + /// + /// 通过ID路径获取ID,如果没找到,返回0 + /// + uint GetImageID(const Containers::String& path); + + Image* GetImage(const Containers::String& path); + + Image* GetImage(const Containers::String& ID); + + uint AddImage(const Containers::String& path, Image* image); + + uint AddImage(Image* image); + + bool RemoveImage(uint ID); + + bool RemoveImage(Image* image); + + private: + + /// + /// 所有的image + /// + Containers::Map mImages; + + /// + /// image,路径和ID的映射。针对从.asr导入的image,通过路径可以拿到image。所以并不是所有的image都在此map中。 + /// 由程序创建的image只能通过ID来获取,所以程序中需要保留ID。 + /// + Containers::StringMap mImageIDs; + + }; + + /// + /// + /// + class ImageFactory : public Factory + { + public: + + /// + /// 从image pixel数据中构建image + /// + Image* ReadBuffer(Color* pixels, int width, int height); + + /// + /// 从image extern数据并返回 + /// + Image* Decode(); + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Material.cpp b/Source/Asura.Engine/Graphics/Material.cpp new file mode 100644 index 0000000..eaf9742 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Material.cpp @@ -0,0 +1,18 @@ +#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 new file mode 100644 index 0000000..1cb3c88 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Material.h @@ -0,0 +1,189 @@ +#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 mImages; + + /// + /// image,路径和ID的映射。针对从.asr导入的image,通过路径可以拿到image。所以并不是所有的image都在此map中。 + /// 由程序创建的image只能通过ID来获取,所以程序中需要保留ID。 + /// + Containers::StringMap mImageIDs; + + }; + + 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/Mesh2D.cpp b/Source/Asura.Engine/Graphics/Mesh2D.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Mesh2D.h b/Source/Asura.Engine/Graphics/Mesh2D.h new file mode 100644 index 0000000..a113f4c --- /dev/null +++ b/Source/Asura.Engine/Graphics/Mesh2D.h @@ -0,0 +1,20 @@ +#ifndef __AE_MESH2D_H__ +#define __AE_MESH2D_H__ + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 2D mesh,用于做一些UV动画 + /// + class Mesh2D + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp b/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Mesh2DRenderer.h b/Source/Asura.Engine/Graphics/Mesh2DRenderer.h new file mode 100644 index 0000000..fcbfd2c --- /dev/null +++ b/Source/Asura.Engine/Graphics/Mesh2DRenderer.h @@ -0,0 +1,19 @@ +#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/OpenGL.cpp b/Source/Asura.Engine/Graphics/OpenGL.cpp new file mode 100644 index 0000000..ec23f52 --- /dev/null +++ b/Source/Asura.Engine/Graphics/OpenGL.cpp @@ -0,0 +1,11 @@ +#include "OpenGL.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + + + } +} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/OpenGL.h b/Source/Asura.Engine/Graphics/OpenGL.h new file mode 100644 index 0000000..f46497b --- /dev/null +++ b/Source/Asura.Engine/Graphics/OpenGL.h @@ -0,0 +1,17 @@ +#ifndef __AE_OPENGL_H__ +#define __AE_OPENGL_H__ + +namespace AsuraEngine +{ + namespace Graphics + { + + class OpenGL + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ParticleSystem.cpp b/Source/Asura.Engine/Graphics/ParticleSystem.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/ParticleSystem.h b/Source/Asura.Engine/Graphics/ParticleSystem.h new file mode 100644 index 0000000..078427a --- /dev/null +++ b/Source/Asura.Engine/Graphics/ParticleSystem.h @@ -0,0 +1,22 @@ +#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 new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Prefab.h b/Source/Asura.Engine/Graphics/Prefab.h new file mode 100644 index 0000000..82a8da2 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Prefab.h @@ -0,0 +1,30 @@ +#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 new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Renderer.h b/Source/Asura.Engine/Graphics/Renderer.h new file mode 100644 index 0000000..c3677a7 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Renderer.h @@ -0,0 +1,39 @@ +#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/Shader.cpp b/Source/Asura.Engine/Graphics/Shader.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Shader.h b/Source/Asura.Engine/Graphics/Shader.h new file mode 100644 index 0000000..c3c67ad --- /dev/null +++ b/Source/Asura.Engine/Graphics/Shader.h @@ -0,0 +1,67 @@ +#ifndef __AE_SHADER_H__ +#define __AE_SHADER_H__ + +#include "luax/luax.h" + +#include "FileSystem/Asset.h" +#include "Containers/Map.h" +#include "Containers/StringMap.hpp" +#include "Object.h" +#include "Color.h" +#include "Manager.hpp" + +namespace AsuraEngine +{ + namespace Graphics + { + + class Material; + + /// + /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只保存uniforms location。 + /// + class Shader final : public Filesystem::Asset + { + public: + + Shader(); + ~Shader(); + + private: + + friend class Material; + + /// + /// 保存了所有shader的uniforms变量的ID映射。 + /// + static Containers::StringMap sUniformsID; + + /// + /// 获得uniform变量的ID。 + /// + static int GetUniformID(const Containers::String& name); + + /// + /// 设置内置变量: + /// vec2 Asura_Time x值为进入当前场景开始的时间,y值为上一帧的时间间隔 + /// vec2 Asura_RenderTargetSize RT的大小,以像素为单位 + /// Texture Asura_MainTexture 主纹理 + /// + void SetBuiltInUniforms(); + + /// + /// 映射uniforms ID到location。 + /// + Containers::Map mLocations; + + }; + + class ShaderManager final : public Manager + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ShapeRenderer.cpp b/Source/Asura.Engine/Graphics/ShapeRenderer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/ShapeRenderer.h b/Source/Asura.Engine/Graphics/ShapeRenderer.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Sprite.cpp b/Source/Asura.Engine/Graphics/Sprite.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Sprite.h b/Source/Asura.Engine/Graphics/Sprite.h new file mode 100644 index 0000000..b621f1b --- /dev/null +++ b/Source/Asura.Engine/Graphics/Sprite.h @@ -0,0 +1,71 @@ +#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/SpriteBatch.cpp b/Source/Asura.Engine/Graphics/SpriteBatch.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/SpriteBatch.h b/Source/Asura.Engine/Graphics/SpriteBatch.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/SpriteRenderer.cpp b/Source/Asura.Engine/Graphics/SpriteRenderer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/SpriteRenderer.h b/Source/Asura.Engine/Graphics/SpriteRenderer.h new file mode 100644 index 0000000..bd81509 --- /dev/null +++ b/Source/Asura.Engine/Graphics/SpriteRenderer.h @@ -0,0 +1,32 @@ +#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/Texture.cpp b/Source/Asura.Engine/Graphics/Texture.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Graphics/Texture.h b/Source/Asura.Engine/Graphics/Texture.h new file mode 100644 index 0000000..8195fc9 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Texture.h @@ -0,0 +1,22 @@ +#ifndef __AE_TEXTURE_H__ +#define __AE_TEXTURE_H__ + +#include "Object.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 2D纹理(抽象类),在2d mesh和render target中被使用 + /// + class Texture : public Object + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Input/Keyboard.cpp b/Source/Asura.Engine/Input/Keyboard.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Input/Keyboard.h b/Source/Asura.Engine/Input/Keyboard.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Layer.cpp b/Source/Asura.Engine/Layer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Layer.h b/Source/Asura.Engine/Layer.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Manager.hpp b/Source/Asura.Engine/Manager.hpp new file mode 100644 index 0000000..5a94889 --- /dev/null +++ b/Source/Asura.Engine/Manager.hpp @@ -0,0 +1,14 @@ +#ifndef __AE_MANAGER_H__ +#define __AE_MANAGER_H__ + +namespace AsuraEngine +{ + + class Manager + { + + }; + +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Curve.cpp b/Source/Asura.Engine/Math/Curve.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Curve.h b/Source/Asura.Engine/Math/Curve.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Functions.cpp b/Source/Asura.Engine/Math/Functions.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Functions.h b/Source/Asura.Engine/Math/Functions.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Matrix44.cpp b/Source/Asura.Engine/Math/Matrix44.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Matrix44.h b/Source/Asura.Engine/Math/Matrix44.h new file mode 100644 index 0000000..5bc44e7 --- /dev/null +++ b/Source/Asura.Engine/Math/Matrix44.h @@ -0,0 +1,24 @@ +#ifndef __AE_MATRIX44_H__ +#define __AE_MATRIX44_H__ + +namespace AsuraEngine +{ + namespace Math + { + + /// + /// 4x4矩阵 + /// + class Matrix44 + { + public: + + private: + + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/RangedValue.cpp b/Source/Asura.Engine/Math/RangedValue.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/RangedValue.h b/Source/Asura.Engine/Math/RangedValue.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Vector2.cpp b/Source/Asura.Engine/Math/Vector2.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Vector2.h b/Source/Asura.Engine/Math/Vector2.h new file mode 100644 index 0000000..d5f8739 --- /dev/null +++ b/Source/Asura.Engine/Math/Vector2.h @@ -0,0 +1,17 @@ +#ifndef __AE_VECTOR2_H__ +#define __AE_VECTOR2_H__ + +namespace AsuraEngine +{ + namespace Math + { + + class Vector2 + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector3.cpp b/Source/Asura.Engine/Math/Vector3.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Vector3.h b/Source/Asura.Engine/Math/Vector3.h new file mode 100644 index 0000000..14fdd88 --- /dev/null +++ b/Source/Asura.Engine/Math/Vector3.h @@ -0,0 +1,17 @@ +#ifndef __AE_VECTOR3_H__ +#define __AE_VECTOR3_H__ + +namespace AsuraEngine +{ + namespace Math + { + + class Vector3 + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector4.cpp b/Source/Asura.Engine/Math/Vector4.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Math/Vector4.h b/Source/Asura.Engine/Math/Vector4.h new file mode 100644 index 0000000..a6e8b38 --- /dev/null +++ b/Source/Asura.Engine/Math/Vector4.h @@ -0,0 +1,17 @@ +#ifndef __AE_VECTOR4_H__ +#define __AE_VECTOR4_H__ + +namespace AsuraEngine +{ + namespace Math + { + + class Vector4 + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Object.cpp b/Source/Asura.Engine/Object.cpp new file mode 100644 index 0000000..587dca7 --- /dev/null +++ b/Source/Asura.Engine/Object.cpp @@ -0,0 +1,23 @@ +#include "Object.h" + +namespace AsuraEngine +{ + + Object::Object() + : mRC(0) + { + + } + + void Object::Retain(Object* obj) + { + ++obj->mRC; + } + + void Object::Release(Object* obj) + { + if (--obj->mRC == 0) + delete obj; + } + +} \ No newline at end of file diff --git a/Source/Asura.Engine/Object.h b/Source/Asura.Engine/Object.h new file mode 100644 index 0000000..3dace26 --- /dev/null +++ b/Source/Asura.Engine/Object.h @@ -0,0 +1,32 @@ +#ifndef __AE_OBJECT_H__ +#define __AE_OBJECT_H__ + +#include "Type.h" + +namespace AsuraEngine +{ + + /// + /// 基类 + /// + class Object + { + public: + + Object(); + + virtual ~Object(); + + static void Retain(Object* obj); + + static void Release(Object* obj); + + private: + + int mRC; // 引用数 + + }; + +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/ObjectPool.cpp b/Source/Asura.Engine/ObjectPool.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/ObjectPool.h b/Source/Asura.Engine/ObjectPool.h new file mode 100644 index 0000000..bf97858 --- /dev/null +++ b/Source/Asura.Engine/ObjectPool.h @@ -0,0 +1,14 @@ +#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/Physics/World.h b/Source/Asura.Engine/Physics/World.h new file mode 100644 index 0000000..7000351 --- /dev/null +++ b/Source/Asura.Engine/Physics/World.h @@ -0,0 +1,14 @@ +#ifndef __AE_WORLD_H__ +#define __AE_WORLD_H__ + +namespace AsuraEngine +{ + namespace Physics + { + + + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Profiler/Stats.cpp b/Source/Asura.Engine/Profiler/Stats.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Profiler/Stats.h b/Source/Asura.Engine/Profiler/Stats.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Scene.cpp b/Source/Asura.Engine/Scene.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Scene.h b/Source/Asura.Engine/Scene.h new file mode 100644 index 0000000..742d872 --- /dev/null +++ b/Source/Asura.Engine/Scene.h @@ -0,0 +1,28 @@ +#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/Scripting/Luax.hpp b/Source/Asura.Engine/Scripting/Luax.hpp new file mode 100644 index 0000000..b371166 --- /dev/null +++ b/Source/Asura.Engine/Scripting/Luax.hpp @@ -0,0 +1,8 @@ +#ifndef __AE_LUAX_H__ +#define __AE_LUAX_H__ + +#include "Lua51/lua.h" +#include "Lua51/lauxlib.h" +#include "Luax/luax.h" + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Time/Timer.cpp b/Source/Asura.Engine/Time/Timer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Time/Timer.h b/Source/Asura.Engine/Time/Timer.h new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Transform.cpp b/Source/Asura.Engine/Transform.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Asura.Engine/Transform.h b/Source/Asura.Engine/Transform.h new file mode 100644 index 0000000..cca7575 --- /dev/null +++ b/Source/Asura.Engine/Transform.h @@ -0,0 +1,24 @@ +#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.Engine/Type.h b/Source/Asura.Engine/Type.h new file mode 100644 index 0000000..2a2bc70 --- /dev/null +++ b/Source/Asura.Engine/Type.h @@ -0,0 +1,24 @@ +#ifndef __AE_TYPE_H__ +#define __AE_TYPE_H__ + +#include + +namespace AsuraEngine +{ + + typedef int8_t int8; + typedef uint8_t uint8; + typedef uint8 byte; + typedef int16_t int16; + typedef uint16_t uint16; + typedef int32_t int32; + typedef uint32_t uint32; + typedef int64_t int64; + typedef uint64_t uint64; + + typedef uint32_t uint; + typedef int32_t sint; + +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0