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/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 ++++----- 10 files changed, 152 insertions(+), 132 deletions(-) (limited to 'Source/Asura.Engine/Graphics') 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 -- cgit v1.1-26-g67d0