From 22ba8d6af9e9a67e6bac11365df23b6a61fa62c7 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 22 Feb 2019 13:50:12 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Asura.Engine/Factory.h | 8 ++-- Source/Asura.Engine/Graphics/Canvas.h | 8 ++-- Source/Asura.Engine/Graphics/Color.h | 48 +++++++++---------- Source/Asura.Engine/Graphics/Image.h | 58 +++++++++++------------ Source/Asura.Engine/Graphics/Mesh2D.h | 18 +++---- Source/Asura.Engine/Graphics/OpenGL.cpp | 6 +-- Source/Asura.Engine/Graphics/OpenGL.h | 12 ++--- Source/Asura.Engine/Graphics/Shader.h | 74 ++++++++++++++--------------- Source/Asura.Engine/Graphics/SpriteBatch.h | 20 ++++++++ Source/Asura.Engine/Graphics/Texture.h | 18 +++---- Source/Asura.Engine/Graphics/Window.h | 22 ++++----- Source/Asura.Engine/Manager.hpp | 6 +-- Source/Asura.Engine/Map.cpp | 0 Source/Asura.Engine/Map.h | 14 ------ Source/Asura.Engine/Math/Matrix44.h | 24 +++++----- Source/Asura.Engine/Math/Vector2.h | 12 ++--- Source/Asura.Engine/Math/Vector3.h | 12 ++--- Source/Asura.Engine/Math/Vector4.h | 12 ++--- Source/Asura.Engine/Object.cpp | 26 +++++------ Source/Asura.Engine/Object.h | 22 ++++----- Source/Asura.Engine/Physics/World.h | 18 +++---- Source/Asura.Engine/Stack.cpp | 0 Source/Asura.Engine/Stack.h | 11 ----- Source/Asura.Engine/String.cpp | 0 Source/Asura.Engine/String.h | 75 ------------------------------ Source/Asura.Engine/StringMap.hpp | 24 +++++----- Source/Asura.Engine/Type.h | 22 ++++----- Source/Asura.Engine/UnorderedMap.hpp | 0 Source/Asura.Engine/Vector.hpp | 14 ------ 29 files changed, 245 insertions(+), 339 deletions(-) delete mode 100644 Source/Asura.Engine/Map.cpp delete mode 100644 Source/Asura.Engine/Map.h delete mode 100644 Source/Asura.Engine/Stack.cpp delete mode 100644 Source/Asura.Engine/Stack.h delete mode 100644 Source/Asura.Engine/String.cpp delete mode 100644 Source/Asura.Engine/String.h delete mode 100644 Source/Asura.Engine/UnorderedMap.hpp delete mode 100644 Source/Asura.Engine/Vector.hpp (limited to 'Source/Asura.Engine') diff --git a/Source/Asura.Engine/Factory.h b/Source/Asura.Engine/Factory.h index bc536d7..0ffaccf 100644 --- a/Source/Asura.Engine/Factory.h +++ b/Source/Asura.Engine/Factory.h @@ -4,11 +4,11 @@ namespace AsuraEngine { - class Factory - { + class Factory + { - }; + }; } - + #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Canvas.h b/Source/Asura.Engine/Graphics/Canvas.h index fab9cba..ca745ab 100644 --- a/Source/Asura.Engine/Graphics/Canvas.h +++ b/Source/Asura.Engine/Graphics/Canvas.h @@ -10,15 +10,15 @@ namespace AsuraEngine class Canvas : public Texture { - public: + public: - private: + private: - LUAX_DECL_FACTORY(SimCanvas); // AsuraEngine.SimCanvas + LUAX_DECL_FACTORY(SimCanvas); // AsuraEngine.SimCanvas - }; + }; } } diff --git a/Source/Asura.Engine/Graphics/Color.h b/Source/Asura.Engine/Graphics/Color.h index f07919c..f62f9b8 100644 --- a/Source/Asura.Engine/Graphics/Color.h +++ b/Source/Asura.Engine/Graphics/Color.h @@ -5,44 +5,44 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - class Color; + class Color; - /// - /// 32bits颜色 - /// - class Color32 - { - public: + /// + /// 32bits颜色 + /// + class Color32 + { + public: - Color32(Color c); - Color32(byte r, byte g, byte b, byte a); + Color32(Color c); + Color32(byte r, byte g, byte b, byte a); - byte r, g, b, a; + byte r, g, b, a; - private: + private: - LUAX_DECL_FACTORY(Color32); + LUAX_DECL_FACTORY(Color32); - }; + }; - class Color - { - public: + class Color + { + public: - Color(Color32 c32); + Color(Color32 c32); - float r, g, b, a; + float r, g, b, a; - private: + private: - LUAX_DECL_FACTORY(Color); + LUAX_DECL_FACTORY(Color); - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h index e84dd6c..553df21 100644 --- a/Source/Asura.Engine/Graphics/Image.h +++ b/Source/Asura.Engine/Graphics/Image.h @@ -12,52 +12,52 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - class ImageFactory; + class ImageFactory; - /// - /// Image是图片从内存中载入后,读取进游戏后保存的结果。一个Image在内存、显存中只会保存一份,不会产生副本。需要特征 - /// 化的区别image,如锚点位置,缩放和旋转角度,使用sprite。基本是一个只读类。 - /// - class Image final : public Texture - { - public: + /// + /// Image是图片从内存中载入后,读取进游戏后保存的结果。一个Image在内存、显存中只会保存一份,不会产生副本。需要特征 + /// 化的区别image,如锚点位置,缩放和旋转角度,使用sprite。基本是一个只读类。 + /// + class Image final : public Texture + { + public: - uint GetWidth(); - uint GetHeight(); + uint GetWidth(); + uint GetHeight(); - /// - /// 获得某一个位置的像素 - /// - Color GetPixel(uint x, uint y); + /// + /// 获得某一个位置的像素 + /// + Color GetPixel(uint x, uint y); - private: + private: - friend class ImageFactory; + friend class ImageFactory; - Image(Color* pixels, int width, int height); - ~Image(); + Image(Color* pixels, int width, int height); + ~Image(); - /// - /// 大小(以像素为单位) - /// - uint mWidth, mHeight; - Color* mPixels; + /// + /// 大小(以像素为单位) + /// + uint mWidth, mHeight; + Color* mPixels; /// /// ID /// uint mID; - //---------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------- - LUAX_DECL_FACTORY(SimImage); //AsuraEngine.SimImage + LUAX_DECL_FACTORY(SimImage); //AsuraEngine.SimImage - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Mesh2D.h b/Source/Asura.Engine/Graphics/Mesh2D.h index cff66c4..0d5113a 100644 --- a/Source/Asura.Engine/Graphics/Mesh2D.h +++ b/Source/Asura.Engine/Graphics/Mesh2D.h @@ -3,18 +3,18 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - /// - /// 2D mesh,用于做一些顶点动画。 - /// - class Mesh2D - { + /// + /// 2D mesh,用于做一些顶点动画。 + /// + class Mesh2D + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/OpenGL.cpp b/Source/Asura.Engine/Graphics/OpenGL.cpp index ec23f52..dac2ea4 100644 --- a/Source/Asura.Engine/Graphics/OpenGL.cpp +++ b/Source/Asura.Engine/Graphics/OpenGL.cpp @@ -2,10 +2,10 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - } + } } \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/OpenGL.h b/Source/Asura.Engine/Graphics/OpenGL.h index 34d662b..315c09b 100644 --- a/Source/Asura.Engine/Graphics/OpenGL.h +++ b/Source/Asura.Engine/Graphics/OpenGL.h @@ -3,15 +3,15 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - class OpenGL - { + class OpenGL + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Shader.h b/Source/Asura.Engine/Graphics/Shader.h index e15c6e0..e22fc66 100644 --- a/Source/Asura.Engine/Graphics/Shader.h +++ b/Source/Asura.Engine/Graphics/Shader.h @@ -11,56 +11,56 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - class Material; + class Material; - /// - /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只保存uniforms location。 - /// - class Shader - { - public: + /// + /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只保存uniforms location。 + /// + class Shader + { + public: - Shader(); - ~Shader(); + Shader(); + ~Shader(); - private: + private: - friend class Material; + friend class Material; - /// - /// 保存了所有shader的uniforms变量的ID映射。 - /// - static StringMap sUniformsID; + /// + /// 保存了所有shader的uniforms变量的ID映射。 + /// + static StringMap sUniformsID; - /// - /// 获得uniform变量的ID。 - /// - static int GetUniformID(const String& name); + /// + /// 获得uniform变量的ID。 + /// + static int GetUniformID(const String& name); - /// - /// 设置内置变量: - /// vec2 Asura_Time x值为进入当前场景开始的时间,y值为上一帧的时间间隔 - /// vec2 Asura_RenderTargetSize RT的大小,以像素为单位 - /// Texture Asura_MainTexture 主纹理 - /// - void SetBuiltInUniforms(); + /// + /// 设置内置变量: + /// vec2 Asura_Time x值为进入当前场景开始的时间,y值为上一帧的时间间隔 + /// vec2 Asura_RenderTargetSize RT的大小,以像素为单位 + /// Texture Asura_MainTexture 主纹理 + /// + void SetBuiltInUniforms(); - /// - /// 映射uniforms ID到location。 - /// - Map mLocations; + /// + /// 映射uniforms ID到location。 + /// + Map mLocations; - }; + }; - class ShaderManager final : public Manager - { + class ShaderManager final : public Manager + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/SpriteBatch.h b/Source/Asura.Engine/Graphics/SpriteBatch.h index e69de29..17d5e75 100644 --- a/Source/Asura.Engine/Graphics/SpriteBatch.h +++ b/Source/Asura.Engine/Graphics/SpriteBatch.h @@ -0,0 +1,20 @@ +#ifndef __ASURA_ENGINE_SPRITE_BATCH_H__ +#define __ASURA_ENGINE_SPRITE_BATCH_H__ + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// Sprite batch用在批量渲染单个图片的地方,比如粒子系统。 + /// + class SpriteBatch + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Texture.h b/Source/Asura.Engine/Graphics/Texture.h index b50467a..db5c72e 100644 --- a/Source/Asura.Engine/Graphics/Texture.h +++ b/Source/Asura.Engine/Graphics/Texture.h @@ -6,18 +6,18 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - /// - /// 2D纹理(抽象类),在2d mesh和render target中被使用 - /// - class Texture : public Object - { + /// + /// 2D纹理(抽象类),在2d mesh和render target中被使用 + /// + class Texture : public Object + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Window.h b/Source/Asura.Engine/Graphics/Window.h index 0f6ca92..3a09266 100644 --- a/Source/Asura.Engine/Graphics/Window.h +++ b/Source/Asura.Engine/Graphics/Window.h @@ -3,23 +3,23 @@ namespace AsuraEngine { - namespace Graphics - { + namespace Graphics + { - /// - /// 窗口,支持多窗口。在编辑器下需要多个窗口支持,runner只需要一个窗口。 - /// - class Window - { - public: + /// + /// 窗口,支持多窗口。在编辑器下需要多个窗口支持,runner只需要一个窗口。 + /// + class Window + { + public: - private: + private: - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Manager.hpp b/Source/Asura.Engine/Manager.hpp index fb32491..7b4e272 100644 --- a/Source/Asura.Engine/Manager.hpp +++ b/Source/Asura.Engine/Manager.hpp @@ -4,10 +4,10 @@ namespace AsuraEngine { - class Manager - { + class Manager + { - }; + }; } diff --git a/Source/Asura.Engine/Map.cpp b/Source/Asura.Engine/Map.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Map.h b/Source/Asura.Engine/Map.h deleted file mode 100644 index 3c538d4..0000000 --- a/Source/Asura.Engine/Map.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_ENGINE_MAP_H__ -#define __ASURA_ENGINE_MAP_H__ - -#include - -namespace AsuraEngine -{ - - template - using Map = std::map; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Matrix44.h b/Source/Asura.Engine/Math/Matrix44.h index 2741430..4ab3c0b 100644 --- a/Source/Asura.Engine/Math/Matrix44.h +++ b/Source/Asura.Engine/Math/Matrix44.h @@ -3,22 +3,22 @@ namespace AsuraEngine { - namespace Math - { + namespace Math + { - /// - /// 4x4矩阵 - /// - class Matrix44 - { - public: + /// + /// 4x4矩阵 + /// + class Matrix44 + { + public: - private: - + private: + - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector2.h b/Source/Asura.Engine/Math/Vector2.h index 99fe71b..875cef3 100644 --- a/Source/Asura.Engine/Math/Vector2.h +++ b/Source/Asura.Engine/Math/Vector2.h @@ -3,15 +3,15 @@ namespace AsuraEngine { - namespace Math - { + namespace Math + { - class Vector2 - { + class Vector2 + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector3.h b/Source/Asura.Engine/Math/Vector3.h index f450527..f0e48e4 100644 --- a/Source/Asura.Engine/Math/Vector3.h +++ b/Source/Asura.Engine/Math/Vector3.h @@ -3,15 +3,15 @@ namespace AsuraEngine { - namespace Math - { + namespace Math + { - class Vector3 - { + class Vector3 + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector4.h b/Source/Asura.Engine/Math/Vector4.h index 818274e..3739f83 100644 --- a/Source/Asura.Engine/Math/Vector4.h +++ b/Source/Asura.Engine/Math/Vector4.h @@ -3,15 +3,15 @@ namespace AsuraEngine { - namespace Math - { + namespace Math + { - class Vector4 - { + class Vector4 + { - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Object.cpp b/Source/Asura.Engine/Object.cpp index 587dca7..56fc164 100644 --- a/Source/Asura.Engine/Object.cpp +++ b/Source/Asura.Engine/Object.cpp @@ -3,21 +3,21 @@ namespace AsuraEngine { - Object::Object() - : mRC(0) - { + Object::Object() + : mRC(0) + { - } + } - void Object::Retain(Object* obj) - { - ++obj->mRC; - } + void Object::Retain(Object* obj) + { + ++obj->mRC; + } - void Object::Release(Object* obj) - { - if (--obj->mRC == 0) - delete obj; - } + 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 index 7efe74b..40ea7fe 100644 --- a/Source/Asura.Engine/Object.h +++ b/Source/Asura.Engine/Object.h @@ -6,26 +6,26 @@ namespace AsuraEngine { - /// - /// 基类 - /// + /// + /// 基类 + /// class Object { - public: + public: - Object(); + Object(); - virtual ~Object(); + virtual ~Object(); - static void Retain(Object* obj); + static void Retain(Object* obj); - static void Release(Object* obj); + static void Release(Object* obj); - private: + private: - int mRC; // 引用数 + int mRC; // 引用数 - }; + }; } diff --git a/Source/Asura.Engine/Physics/World.h b/Source/Asura.Engine/Physics/World.h index 36b55a8..71984f5 100644 --- a/Source/Asura.Engine/Physics/World.h +++ b/Source/Asura.Engine/Physics/World.h @@ -6,20 +6,20 @@ namespace AsuraEngine { - namespace Physics - { + namespace Physics + { - class World - { - public: + class World + { + public: - private: + private: - LUAX_DECL_FACTORY(SimWorld); //AsuraEngine.SimWorld + LUAX_DECL_FACTORY(SimWorld); //AsuraEngine.SimWorld - }; + }; - } + } } #endif \ No newline at end of file diff --git a/Source/Asura.Engine/Stack.cpp b/Source/Asura.Engine/Stack.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Stack.h b/Source/Asura.Engine/Stack.h deleted file mode 100644 index f51017f..0000000 --- a/Source/Asura.Engine/Stack.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __ASURA_ENGINE_STACK_H__ -#define __ASURA_ENGINE_STACK_H__ - -namespace AsuraEngine -{ - - - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/String.cpp b/Source/Asura.Engine/String.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/String.h b/Source/Asura.Engine/String.h deleted file mode 100644 index 6d0ec3a..0000000 --- a/Source/Asura.Engine/String.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __ASURA_ENGINE_STRING_H__ -#define __ASURA_ENGINE_STRING_H__ - -#include - -namespace AsuraEngine -{ - - /// - /// 封装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/StringMap.hpp b/Source/Asura.Engine/StringMap.hpp index 92a157f..971a890 100644 --- a/Source/Asura.Engine/StringMap.hpp +++ b/Source/Asura.Engine/StringMap.hpp @@ -6,23 +6,23 @@ namespace AsuraEngine { - /// - /// 一个双向一一对应的映射,用来储存shader uniforms、statemathine state parameter的ID。 - /// - template - class StringMap - { - public: + /// + /// 一个双向一一对应的映射,用来储存shader uniforms、statemathine state parameter的ID。 + /// + template + class StringMap + { + public: - bool ContainsKey(const key_type& key); + bool ContainsKey(const key_type& key); - bool ContainsString(const String& str); + bool ContainsString(const String& str); - String GetStringByKey(const key_type& key); + String GetStringByKey(const key_type& key); - key_type GetKeyByString(const String& str); + key_type GetKeyByString(const String& str); - }; + }; } diff --git a/Source/Asura.Engine/Type.h b/Source/Asura.Engine/Type.h index 36ee9e7..5159ee2 100644 --- a/Source/Asura.Engine/Type.h +++ b/Source/Asura.Engine/Type.h @@ -6,18 +6,18 @@ 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 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; + typedef uint32_t uint; + typedef int32_t sint; } diff --git a/Source/Asura.Engine/UnorderedMap.hpp b/Source/Asura.Engine/UnorderedMap.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Vector.hpp b/Source/Asura.Engine/Vector.hpp deleted file mode 100644 index 5e35312..0000000 --- a/Source/Asura.Engine/Vector.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR_HPP__ -#define __ASURA_ENGINE_VECTOR_HPP__ - -#include - -namespace AsuraEngine -{ - - template - using Vector = std::vector; - -} - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0