diff options
author | chai <chaifix@163.com> | 2019-03-14 23:12:54 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-14 23:12:54 +0800 |
commit | 8644e03586ac9c39741f62cbcbce87b18805538c (patch) | |
tree | 72021765f5262b7f2f7eebe299fd4e1aaa7c89b7 /Source/Asura.Engine/Graphics | |
parent | 8d8c4ff1664625e7428d0d31cd798d9321680cb2 (diff) |
*大小写
Diffstat (limited to 'Source/Asura.Engine/Graphics')
24 files changed, 2 insertions, 640 deletions
diff --git a/Source/Asura.Engine/Graphics/BlendMode.h b/Source/Asura.Engine/Graphics/BlendMode.h deleted file mode 100644 index 775cc45..0000000 --- a/Source/Asura.Engine/Graphics/BlendMode.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __ASURA_ENGINE_BLEND_MODE_H__ -#define __ASURA_ENGINE_BLEND_MODE_H__ - -namespace AsuraEngine -{ - namespace Graphics - { - - enum BlendMode - { - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ImageData.cpp b/Source/Asura.Engine/Graphics/ImageData.cpp deleted file mode 100644 index 68781a1..0000000 --- a/Source/Asura.Engine/Graphics/ImageData.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "ImageData.h" -#include "PNGDecoder.h" -#include "STBDecoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - using namespace std; - - // imagedecoderΪԡ - list<ImageDecoder*> ImageData::ImageDecoders = { - new PNGDecoder(), // png - new STBDecoder() // jpeg, tga, bmp - }; - - ImageData::ImageData(const Filesystem::DataBuffer& buffer) - : DecodedData(buffer) - { - } - - ImageData::~ImageData() - { - if (pixels) - delete[] pixels; - } - - /// - /// ɹ׳쳣 - /// - void ImageData::Decode(const Filesystem::DataBuffer& buffer) - { - for (ImageDecoder* decoder : ImageDecoders) - { - if (decoder->CanDecode(buffer)) - { - decoder->Decode(buffer, this); - return; - } - } - } - - Color ImageData::GetPixel(uint x, uint y) - { - - } - - } -}
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ImageData.h b/Source/Asura.Engine/Graphics/ImageData.h deleted file mode 100644 index 931eaa3..0000000 --- a/Source/Asura.Engine/Graphics/ImageData.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGEDATA_H__ -#define __ASURA_ENGINE_IMAGEDATA_H__ - -#include <list> - -#include "Scripting/Luax.hpp" -#include "Filesystem/DecodedData.h" -#include "ImageDecoder.h" -#include "PixelFormat.h" -#include "Color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageData ASURA_FINAL - : public Filesystem::DecodedData - , public Scripting::Portable - { - public: - - /// - /// ͼƬļϢʧܣ׳쳣 - /// - ImageData(const Filesystem::DataBuffer& buffer); - - ~ImageData(); - - Color GetPixel(uint x, uint y); - - uint width, height; - PixelFormat format; - std::size_t size; - byte* pixels; - - private: - - void Decode(const Filesystem::DataBuffer& buffer) override; - - /// - /// ڵһimage dataʱṩdecoderڼdecodersмѡԡ - /// - static std::list<ImageDecoder*> ImageDecoders; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(ImageData); - - LUAX_DECL_METHOD(l_GetPixel); - LUAX_DECL_METHOD(l_GetSize); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ImageDecoder.h b/Source/Asura.Engine/Graphics/ImageDecoder.h deleted file mode 100644 index 2c73fd1..0000000 --- a/Source/Asura.Engine/Graphics/ImageDecoder.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGE_DECODER_H__ -#define __ASURA_ENGINE_IMAGE_DECODER_H__ - -#include "FileSystem/DataBuffer.h" - -#include "ImageData.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageDecoder - { - public: - - ImageDecoder(); - virtual ~ImageDecoder(); - - /// - /// жڴǷñdecoderѹ - /// - virtual bool CanDecode(const Filesystem::DataBuffer& buffer) = 0; - - /// - /// һڴ棬һѹImage dataѹʧܷnullptr - /// - virtual void Decode(const Filesystem::DataBuffer& buffer, ImageData& data) = 0; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/PNGDecoder.cpp b/Source/Asura.Engine/Graphics/PNGDecoder.cpp deleted file mode 100644 index f919090..0000000 --- a/Source/Asura.Engine/Graphics/PNGDecoder.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "PNGDecoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - bool PNGDecoder::CanDecode(const Filesystem::DataBuffer& buffer) - { - return false; - } - - void PNGDecoder::Decode(const Filesystem::DataBuffer& buffer, ImageData& data) - { - - } - - } -} diff --git a/Source/Asura.Engine/Graphics/PNGDecoder.h b/Source/Asura.Engine/Graphics/PNGDecoder.h deleted file mode 100644 index 980753f..0000000 --- a/Source/Asura.Engine/Graphics/PNGDecoder.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_PNGDECODER_H__ -#define __ASURA_ENGINE_PNGDECODER_H__ - -#include "ImageDecoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// ʹlodepngѹpngļ - /// - class PNGDecoder ASURA_FINAL: public ImageDecoder - { - public: - - bool CanDecode(const Filesystem::DataBuffer& buffer) override; - - void Decode(const Filesystem::DataBuffer& buffer, ImageData& data) override; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/PixelFormat.h b/Source/Asura.Engine/Graphics/PixelFormat.h deleted file mode 100644 index 8df07d5..0000000 --- a/Source/Asura.Engine/Graphics/PixelFormat.h +++ /dev/null @@ -1,91 +0,0 @@ -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// ظʽ - /// - enum PixelFormat - { - PIXELFORMAT_UNKNOWN, - - // these are converted to an actual format by love - PIXELFORMAT_NORMAL, - PIXELFORMAT_HDR, - - // "regular" formats - PIXELFORMAT_R8, - PIXELFORMAT_RG8, - PIXELFORMAT_RGBA8, - PIXELFORMAT_sRGBA8, - PIXELFORMAT_R16, - PIXELFORMAT_RG16, - PIXELFORMAT_RGBA16, - PIXELFORMAT_R16F, - PIXELFORMAT_RG16F, - PIXELFORMAT_RGBA16F, - PIXELFORMAT_R32F, - PIXELFORMAT_RG32F, - PIXELFORMAT_RGBA32F, - - PIXELFORMAT_LA8, // Same as RG8, but accessed as (L, L, L, A) - - // packed formats - PIXELFORMAT_RGBA4, - PIXELFORMAT_RGB5A1, - PIXELFORMAT_RGB565, - PIXELFORMAT_RGB10A2, - PIXELFORMAT_RG11B10F, - - // depth/stencil formats - PIXELFORMAT_STENCIL8, - PIXELFORMAT_DEPTH16, - PIXELFORMAT_DEPTH24, - PIXELFORMAT_DEPTH32F, - PIXELFORMAT_DEPTH24_STENCIL8, - PIXELFORMAT_DEPTH32F_STENCIL8, - - // compressed formats - PIXELFORMAT_DXT1, - PIXELFORMAT_DXT3, - PIXELFORMAT_DXT5, - PIXELFORMAT_BC4, - PIXELFORMAT_BC4s, - PIXELFORMAT_BC5, - PIXELFORMAT_BC5s, - PIXELFORMAT_BC6H, - PIXELFORMAT_BC6Hs, - PIXELFORMAT_BC7, - PIXELFORMAT_PVR1_RGB2, - PIXELFORMAT_PVR1_RGB4, - PIXELFORMAT_PVR1_RGBA2, - PIXELFORMAT_PVR1_RGBA4, - PIXELFORMAT_ETC1, - PIXELFORMAT_ETC2_RGB, - PIXELFORMAT_ETC2_RGBA, - PIXELFORMAT_ETC2_RGBA1, - PIXELFORMAT_EAC_R, - PIXELFORMAT_EAC_Rs, - PIXELFORMAT_EAC_RG, - PIXELFORMAT_EAC_RGs, - PIXELFORMAT_ASTC_4x4, - PIXELFORMAT_ASTC_5x4, - PIXELFORMAT_ASTC_5x5, - PIXELFORMAT_ASTC_6x5, - PIXELFORMAT_ASTC_6x6, - PIXELFORMAT_ASTC_8x5, - PIXELFORMAT_ASTC_8x6, - PIXELFORMAT_ASTC_8x8, - PIXELFORMAT_ASTC_10x5, - PIXELFORMAT_ASTC_10x6, - PIXELFORMAT_ASTC_10x8, - PIXELFORMAT_ASTC_10x10, - PIXELFORMAT_ASTC_12x10, - PIXELFORMAT_ASTC_12x12, - - PIXELFORMAT_MAX_ENUM - }; - - } -} diff --git a/Source/Asura.Engine/Graphics/Port/Canvas.cpp b/Source/Asura.Engine/Graphics/Port/Canvas.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/Canvas.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/Color.cpp b/Source/Asura.Engine/Graphics/Port/Color.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/Color.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/Image.cpp b/Source/Asura.Engine/Graphics/Port/Image.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/Image.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/ImageData.cpp b/Source/Asura.Engine/Graphics/Port/ImageData.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/ImageData.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/Mesh2D.cpp b/Source/Asura.Engine/Graphics/Port/Mesh2D.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/Mesh2D.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/Mesh2DData.cpp b/Source/Asura.Engine/Graphics/Port/Mesh2DData.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/Mesh2DData.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/Shader.cpp b/Source/Asura.Engine/Graphics/Port/Shader.cpp deleted file mode 100644 index ba355f5..0000000 --- a/Source/Asura.Engine/Graphics/Port/Shader.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "../Shader.h" - -using namespace Luax; - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// shaderΪ - /// - int Shader::l_Use(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// shaderΪǻ - /// - int Shader::l_Unuse(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// ɫйshaderɹtrueʧܷfalse - /// - int Shader::l_Load(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// жshaderǷuniformзtrue,false - /// - int Shader::l_HasUniform(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// uniformslocationûuniformnilضӦloc - /// - int Shader::l_GetUniformLocation(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetBuiltInUniforms(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformFloat(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformTexture(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformVector2(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformVector3(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformVector4(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformColor(lua_State* L) - { - LUAX_STATE(L); - - } - - void Shader::RegisterLuaxClass(LuaxState& state) - { - - } - - } -}
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Port/SpriteBatch.cpp b/Source/Asura.Engine/Graphics/Port/SpriteBatch.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/Port/SpriteBatch.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/Port/Window.cpp b/Source/Asura.Engine/Graphics/Port/Window.cpp deleted file mode 100644 index 3befc8c..0000000 --- a/Source/Asura.Engine/Graphics/Port/Window.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "../Window.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - - - } -} diff --git a/Source/Asura.Engine/Graphics/RenderState.h b/Source/Asura.Engine/Graphics/RenderState.h deleted file mode 100644 index f313296..0000000 --- a/Source/Asura.Engine/Graphics/RenderState.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef __ASURA_ENGINE_RENDER_STATE_H__ -#define __ASURA_ENGINE_RENDER_STATE_H__ - -#include "Math/Vector2.hpp" -#include "Math/Rect.hpp" -#include "Math/Transform.h" - -#include "Shader.h" -#include "BlendMode.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Ⱦǰķʽ - /// - struct RenderState ASURA_FINAL - { - /// - /// Ĭϵrender state - /// - static RenderState Default; - - RenderState(); - ~RenderState(); - - /// - /// λášλúת - /// - - Math::Transform transform; - - /// - /// ɫ - /// - Shader* shader; - - /// - /// Ϸʽ - /// - BlendMode blendMode; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/RenderTarget.cpp b/Source/Asura.Engine/Graphics/RenderTarget.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/RenderTarget.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/RenderTarget.h b/Source/Asura.Engine/Graphics/RenderTarget.h deleted file mode 100644 index d6de164..0000000 --- a/Source/Asura.Engine/Graphics/RenderTarget.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __ASURA_ENGINE_RENDERTARGET_H__ -#define __ASURA_ENGINE_RENDERTARGET_H__ - -#include "Math/Rect.hpp" -#include "Texture.h" -#include "Scripting/Portable.h" -#include "Color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Drawable; - - /// - /// ɱΪȾĿ࣬ - /// Canvas(RenderTexture) - /// Window(RenderWindow) - /// - class RenderTarget - { - public: - - RenderTarget() {}; - - virtual ~RenderTarget() {}; - - /// - /// ɫcolRT - /// - virtual void Clear(const Color& col = Color::Black) = 0; - - /// - /// ɫcolղRT - /// - virtual void Clear(const Math::Recti& quad, const Color& col = Color::Black) = 0; - - /// - /// textureRT - /// - virtual void Draw(const Drawable* texture, const RenderState& state) = 0; - - /// - /// һtextureRT - /// - virtual void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state) = 0; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/STBDecoder.cpp b/Source/Asura.Engine/Graphics/STBDecoder.cpp deleted file mode 100644 index b14d0f3..0000000 --- a/Source/Asura.Engine/Graphics/STBDecoder.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "STBDecoder.h" - -#include "Exceptions/Exception.h" -#include "stb/stb_image.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - bool STBDecoder::CanDecode(const Filesystem::DataBuffer& buffer) - { - int w = 0; - int h = 0; - int comp = 0; - - int status = stbi_info_from_memory((const stbi_uc*)buffer.data, buffer.size, &w, &h, &comp); - - return status == 1 && w > 0 && h > 0; - } - - void STBDecoder::Decode(const Filesystem::DataBuffer& db, ImageData& imageData) - { - const stbi_uc *buffer = (const stbi_uc *)db.data; - int bufferlen = db.size; - int width, height; - int comp = 0; - byte* data = nullptr; - PixelFormat format = PIXELFORMAT_UNKNOWN; - std::size_t size = 0; - - if (stbi_is_hdr_from_memory(buffer, bufferlen)) - { - // 4channelfloat - data = (byte*)stbi_loadf_from_memory(buffer, bufferlen, &width, &height, &comp, STBI_rgb_alpha); - format = PIXELFORMAT_RGBA32F; - size = width * height * 4 * sizeof(float); - } - else - { - data = (byte*)stbi_load_from_memory(buffer, bufferlen, &width, &height, &comp, STBI_rgb_alpha); - format = PIXELFORMAT_ASTC_8x5; - size = width * height * 4; - } - if (data) - { - // ֤ڴ汻ͷţһϲûͷŵΪimage dataһԵģimageǶεġ - if (imageData.pixels) - delete[] imageData.pixels; - imageData.pixels = (byte*)data; - imageData.format = format; - imageData.width = width; - imageData.height = height; - } - else - { - const char *err = stbi_failure_reason(); - if (err == nullptr) - err = "unknown error"; - throw Exception("Could not decode image with stb_image (%s).", err); - } - } - - } -}
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/STBDecoder.h b/Source/Asura.Engine/Graphics/STBDecoder.h deleted file mode 100644 index 5567466..0000000 --- a/Source/Asura.Engine/Graphics/STBDecoder.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_STBDECODER_H__ -#define __ASURA_ENGINE_STBDECODER_H__ - -#include "ImageDecoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// ʹstb_imageѹJPEGTGABMPļ - /// - class STBDecoder ASURA_FINAL: public ImageDecoder - { - public: - - bool CanDecode(const Filesystem::DataBuffer& buffer) override; - - void Decode(const Filesystem::DataBuffer& buffer, ImageData& data) override; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Shader.h b/Source/Asura.Engine/Graphics/Shader.h index 932cc42..103c7b7 100644 --- a/Source/Asura.Engine/Graphics/Shader.h +++ b/Source/Asura.Engine/Graphics/Shader.h @@ -11,7 +11,7 @@ #include "Math/Vector4.h" #include "Math/Matrix44.h" #include "StringMap.hpp" -#include "Scripting/Portable.h" +#include "scripting/portable.h" #include "Color.h" #include "Manager.hpp" #include "Texture.h" @@ -27,7 +27,7 @@ namespace AsuraEngine /// ÿshaderͨshaderҵuniforms¶frameworkmaterialá /// class Shader ASURA_FINAL - : public Scripting::Portable + : public Scripting::Portable<Shader> , public Filesystem::Reloadable { public: diff --git a/Source/Asura.Engine/Graphics/SpriteBatch.cpp b/Source/Asura.Engine/Graphics/SpriteBatch.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Graphics/SpriteBatch.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Graphics/SpriteBatch.h b/Source/Asura.Engine/Graphics/SpriteBatch.h deleted file mode 100644 index 353bf77..0000000 --- a/Source/Asura.Engine/Graphics/SpriteBatch.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_SPRITE_BATCH_H__ -#define __ASURA_ENGINE_SPRITE_BATCH_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Sprite batchȾͼƬĵطϵͳ - /// - class SpriteBatch ASURA_FINAL : public Scripting::Portable - { - public: - - SpriteBatch(); - - ~SpriteBatch(); - - }; - - } -} - -#endif
\ No newline at end of file |