diff options
author | chai <chaifix@163.com> | 2019-03-29 22:51:04 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-29 22:51:04 +0800 |
commit | c302f5ae5f9e30a28e487e8a764d9cc31546bbea (patch) | |
tree | 7f18bedeece950600336ea7ced7c52c468552c98 /source/libs/asura-lib-core/graphics | |
parent | 157530b8b6e11efc5573d5a0db8987a440197aa1 (diff) |
*rename
Diffstat (limited to 'source/libs/asura-lib-core/graphics')
51 files changed, 0 insertions, 2053 deletions
diff --git a/source/libs/asura-lib-core/graphics/binding/_canvas.cpp b/source/libs/asura-lib-core/graphics/binding/_canvas.cpp deleted file mode 100644 index 7927995..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_canvas.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "../canvas.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Canvas) - { - LUAX_REGISTER_METHODS(state, - { "SetSize", _SetSize }, - { "Bind", _Bind }, - { "Unbind", _Unbind } - ); - } - - LUAX_POSTPROCESS(Canvas) - { - - } - - // canvas:SetSize() - LUAX_IMPL_METHOD(Canvas, _SetSize) - { - LUAX_PREPARE(L, Canvas); - - } - - // canvas:Bind() - LUAX_IMPL_METHOD(Canvas, _Bind) - { - LUAX_PREPARE(L, Canvas); - - } - - // canvas:Unbind() - LUAX_IMPL_METHOD(Canvas, _Unbind) - { - LUAX_PREPARE(L, Canvas); - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_color.cpp b/source/libs/asura-lib-core/graphics/binding/_color.cpp deleted file mode 100644 index 11e80a1..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_color.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "../color.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Color) - { - LUAX_REGISTER_METHODS(state, - { "ToColor32", _ToColor32 }, - { "SetColor", _SetColor }, - { "GetColor", _GetColor }, - { "Multiply", _Multiply } - ); - } - - LUAX_POSTPROCESS(Color) - { - - } - - // color:ToColor32() - LUAX_IMPL_METHOD(Color, _ToColor32) - { - LUAX_PREPARE(L, Color); - - } - - // color:SetColor() - LUAX_IMPL_METHOD(Color, _SetColor) - { - LUAX_PREPARE(L, Color); - - } - - // color:GetColor() - LUAX_IMPL_METHOD(Color, _GetColor) - { - LUAX_PREPARE(L, Color); - - } - - // color:Multiply() - LUAX_IMPL_METHOD(Color, _Multiply) - { - LUAX_PREPARE(L, Color); - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_color32.cpp b/source/libs/asura-lib-core/graphics/binding/_color32.cpp deleted file mode 100644 index 7095866..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_color32.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "../color32.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Color32) - { - LUAX_REGISTER_METHODS(state, - { "ToColor", _ToColor }, - { "GetRed", _GetRed }, - { "GetGreen", _GetGreen }, - { "GetBlue", _GetBlue }, - { "GetAlpha", _GetAlpha }, - { "Multiply", _Multiply }, - { "Index", _Index }, - { "NewIndex", _NewIndex } - ); - } - - LUAX_POSTPROCESS(Color32) - { - - } - - // color32:ToColor() - LUAX_IMPL_METHOD(Color32, _ToColor) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:GetRed() - LUAX_IMPL_METHOD(Color32, _GetRed) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:GetGreen() - LUAX_IMPL_METHOD(Color32, _GetGreen) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:GetBlue() - LUAX_IMPL_METHOD(Color32, _GetBlue) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:GetAlpha() - LUAX_IMPL_METHOD(Color32, _GetAlpha) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:Multiply() - LUAX_IMPL_METHOD(Color32, _Multiply) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:Index() - LUAX_IMPL_METHOD(Color32, _Index) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:NewIndex() - LUAX_IMPL_METHOD(Color32, _NewIndex) - { - LUAX_PREPARE(L, Color32); - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_image.cpp b/source/libs/asura-lib-core/graphics/binding/_image.cpp deleted file mode 100644 index cb008d3..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_image.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "../image.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Image) - { - LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "Load", _Load }, - { "GetWidth", _GetWidth }, - { "GetHeight", _GetHeight }, - { "GetSize", _GetSize }, - { "GetPixel", _GetPixel }, - { "Render", _Render } - ); - } - - LUAX_POSTPROCESS(Image) - { - - } - - // image = Image.New() - LUAX_IMPL_METHOD(Image, _New) - { - LUAX_STATE(L); - - Image* image = new Image(); - image->PushLuaxUserdata(state); - return 0; - } - - // successed = image:Load(image_data) - LUAX_IMPL_METHOD(Image, _Load) - { - LUAX_PREPARE(L, Image); - - ImageData* imgdata = state.CheckUserdata<ImageData>(2); - bool loaded = self->Load(imgdata); - state.Push(loaded); - return 1; - } - - // width = image:GetWidth() - LUAX_IMPL_METHOD(Image, _GetWidth) - { - LUAX_PREPARE(L, Image); - - state.Push(self->GetWidth()); - return 1; - } - - // height = image:GetHeight() - LUAX_IMPL_METHOD(Image, _GetHeight) - { - LUAX_PREPARE(L, Image); - - state.Push(self->GetHeight()); - return 1; - } - - // w, h = image:GetSize() - LUAX_IMPL_METHOD(Image, _GetSize) - { - LUAX_PREPARE(L, Image); - - Math::Vector2u size = self->GetSize(); - state.Push(size.x); - state.Push(size.y); - return 2; - } - - // color32 = image:GetPixel(x, y) - LUAX_IMPL_METHOD(Image, _GetPixel) - { - LUAX_PREPARE(L, Image); - - uint x = state.CheckValue<uint>(2); - uint y = state.CheckValue<uint>(3); - Color32* c32 = new Color32(self->GetPixel(x, y)); - c32->PushLuaxUserdata(state); - return 1; - } - - // image:Render() - LUAX_IMPL_METHOD(Image, _Render) - { - LUAX_PREPARE(L, Image); - - return 0; - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/binding/_image_data.cpp b/source/libs/asura-lib-core/graphics/binding/_image_data.cpp deleted file mode 100644 index 3ff38f9..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_image_data.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "../image_data.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(ImageData) - { - LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "GetPixel", _GetPixel }, - { "GetSize", _GetSize }, - { "GetWidth", _GetWidth }, - { "GetHeight", _GetHeight }, - { "GetPixelFormat", _GetPixelFormat } - ); - } - - LUAX_POSTPROCESS(ImageData) - { - - } - - // ImageData.New() - LUAX_IMPL_METHOD(ImageData, _New) - { - LUAX_STATE(L); - - } - - // imagedata:GetPixel() - LUAX_IMPL_METHOD(ImageData, _GetPixel) - { - LUAX_PREPARE(L, ImageData); - - } - - // imagedata:GetSize() - LUAX_IMPL_METHOD(ImageData, _GetSize) - { - LUAX_PREPARE(L, ImageData); - - } - - // imagedata:GetWidth() - LUAX_IMPL_METHOD(ImageData, _GetWidth) - { - LUAX_PREPARE(L, ImageData); - - } - - // imagedata:GetHeight() - LUAX_IMPL_METHOD(ImageData, _GetHeight) - { - LUAX_PREPARE(L, ImageData); - - } - - // imagedata:GetPixelFormat() - LUAX_IMPL_METHOD(ImageData, _GetPixelFormat) - { - LUAX_PREPARE(L, ImageData); - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_image_decode_task.cpp b/source/libs/asura-lib-core/graphics/binding/_image_decode_task.cpp deleted file mode 100644 index 76b544b..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_image_decode_task.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "../image_decode_task.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(ImageDecodeTask) - { - - } - - LUAX_POSTPROCESS(ImageDecodeTask) - { - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_mesh2d.cpp b/source/libs/asura-lib-core/graphics/binding/_mesh2d.cpp deleted file mode 100644 index 07e9f12..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_mesh2d.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "../mesh2d.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Mesh2D) - { - - } - - LUAX_POSTPROCESS(Mesh2D) - { - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_shader.cpp b/source/libs/asura-lib-core/graphics/binding/_shader.cpp deleted file mode 100644 index a06e54b..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_shader.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "../shader.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Shader) - { - LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "Use", _Use }, - { "Unuse", _Unuse }, - { "Load", _Load }, - { "HasUniform", _HasUniform }, - { "GetUniformLocation", _GetUniformLocation }, - { "SetBuiltInUniforms", _SetBuiltInUniforms }, - { "SetUniformFloat", _SetUniformFloat }, - { "SetUniformTexture", _SetUniformTexture }, - { "SetUniformVector2", _SetUniformVector2 }, - { "SetUniformVector3", _SetUniformVector3 }, - { "SetUniformVector4", _SetUniformVector4 }, - { "SetUniformColor", _SetUniformColor } - ); - } - - LUAX_POSTPROCESS(Shader) - { - - } - - // Shader.New() - LUAX_IMPL_METHOD(Shader, _New) - { - LUAX_STATE(L); - - } - - // shader:Use() - LUAX_IMPL_METHOD(Shader, _Use) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:Unuse() - LUAX_IMPL_METHOD(Shader, _Unuse) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:Load() - LUAX_IMPL_METHOD(Shader, _Load) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:HasUniform() - LUAX_IMPL_METHOD(Shader, _HasUniform) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:GetUniformLocation() - LUAX_IMPL_METHOD(Shader, _GetUniformLocation) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetBuiltInUniforms() - LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetUniformFloat() - LUAX_IMPL_METHOD(Shader, _SetUniformFloat) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetUniformTexture() - LUAX_IMPL_METHOD(Shader, _SetUniformTexture) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetUniformVector2() - LUAX_IMPL_METHOD(Shader, _SetUniformVector2) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetUniformVector3() - LUAX_IMPL_METHOD(Shader, _SetUniformVector3) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetUniformVector4() - LUAX_IMPL_METHOD(Shader, _SetUniformVector4) - { - LUAX_PREPARE(L, Shader); - - } - - // shader:SetUniformColor() - LUAX_IMPL_METHOD(Shader, _SetUniformColor) - { - LUAX_PREPARE(L, Shader); - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_sprite_batch.cpp b/source/libs/asura-lib-core/graphics/binding/_sprite_batch.cpp deleted file mode 100644 index 8556c02..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_sprite_batch.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "../sprite_batch.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(SpriteBatch) - { - - } - - LUAX_POSTPROCESS(SpriteBatch) - { - - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/binding/_window.cpp b/source/libs/asura-lib-core/graphics/binding/_window.cpp deleted file mode 100644 index fc74d6c..0000000 --- a/source/libs/asura-lib-core/graphics/binding/_window.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "../window.h" - -using namespace std; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(Window) - { - LUAX_REGISTER_METHODS(state, - { "Show", _Show }, - { "Hide", _Hide }, - { "SetResolution", _SetResolution }, - { "SetFullScreen", _SetFullScreen }, - { "SetTitle", _SetTitle }, - { "SetWindowStyle", _SetWindowStyle }, - { "Clear", _Clear }, - { "Draw", _Draw }, - { "SwapRenderBuffer", _SwapRenderBuffer } - ); - } - - LUAX_POSTPROCESS(Window) - { - - } - - // window:Show() - LUAX_IMPL_METHOD(Window, _Show) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:Hide() - LUAX_IMPL_METHOD(Window, _Hide) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:SetResolution() - LUAX_IMPL_METHOD(Window, _SetResolution) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:SetFullScreen() - LUAX_IMPL_METHOD(Window, _SetFullScreen) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:SetTitle() - LUAX_IMPL_METHOD(Window, _SetTitle) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:SetWindowStyle() - LUAX_IMPL_METHOD(Window, _SetWindowStyle) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:Clear() - LUAX_IMPL_METHOD(Window, _Clear) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:Draw() - LUAX_IMPL_METHOD(Window, _Draw) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - // window:SwapRenderBuffer() - LUAX_IMPL_METHOD(Window, _SwapRenderBuffer) - { - LUAX_PREPARE(L, Window); - - return 0; - } - - } -} diff --git a/source/libs/asura-lib-core/graphics/blend_mode.h b/source/libs/asura-lib-core/graphics/blend_mode.h deleted file mode 100644 index 775cc45..0000000 --- a/source/libs/asura-lib-core/graphics/blend_mode.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/libs/asura-lib-core/graphics/canvas.cpp b/source/libs/asura-lib-core/graphics/canvas.cpp deleted file mode 100644 index 61787b6..0000000 --- a/source/libs/asura-lib-core/graphics/canvas.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "Canvas.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Canvas::Canvas() - : Texture() - , mWidth(0) - , mHeight(0) - { - glGenFramebuffers(1, &mFBO); - GLint current_fbo; - glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextureHandle, 0); - glBindFramebuffer(GL_FRAMEBUFFER, current_fbo); - } - - void Canvas::SetSize(uint w, uint h) - { - GLint current_tex; - glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_tex); - glBindTexture(GL_TEXTURE_2D, mTextureHandle); - - glBindTexture(GL_TEXTURE_2D, current_tex); - } - - void Canvas::Bind() - { - - } - - void Canvas::Unbind() - { - - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/canvas.h b/source/libs/asura-lib-core/graphics/canvas.h deleted file mode 100644 index 5b188ca..0000000 --- a/source/libs/asura-lib-core/graphics/canvas.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __ASURA_ENGINE_CANVAS_H__ -#define __ASURA_ENGINE_CANVAS_H__ - -#include <asura-lib-utils/scripting/portable.hpp> -#include <asura-lib-utils/math/rect.hpp> -#include <asura-lib-utils/math/vector2.hpp> - -#include "gl.h" -#include "texture.h" -#include "render_target.h" -#include "render_state.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// CanvasҲԳΪrender textureҲΪtextureȾ - /// - class Canvas ASURA_FINAL - : public Drawable - , public RenderTarget - , public Scripting::Portable<Canvas> - { - public: - - Canvas(); - - ~Canvas(); - - /// - /// render textureĴС - /// - void SetSize(uint w, uint h); - - void Clear(const Color& col = Color::Black) override; - - void Clear(const Math::Recti& quad, const Color& col = Color::Black) override; - - void Render(const RenderTarget* rt, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); - - void Render(const RenderTarget* rt, const Math::Rectf& quad, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); - - void Draw(const Drawable* texture, const RenderState& state); - - void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state); - - private: - - /// - /// Frame buffer object id. - /// - GLuint mFBO; - - /// - /// canvasĴС - /// - uint mWidth, mHeight; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(SimCanvas); - - LUAX_DECL_METHOD(_SetSize); - LUAX_DECL_METHOD(_Bind); - LUAX_DECL_METHOD(_Unbind); - - //---------------------------------------------------------------------------------------------------------- - - }; - - /// - /// CanvasΪRenderTexture - /// - using RenderTexture = Canvas; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/color.cpp b/source/libs/asura-lib-core/graphics/color.cpp deleted file mode 100644 index 4d3691e..0000000 --- a/source/libs/asura-lib-core/graphics/color.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "color.h" -#include "color32.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Color::Color() - { - r = g = b = a = 0; - } - - Color::Color(const Color& c) - { - r = c.r; - g = c.g; - b = c.b; - a = c.a; - } - - Color::Color(float r, float g, float b, float a) - { - this->r = r; - this->g = g; - this->b = b; - this->a = a; - } - - Color::Color(const Color32& c) - { - r = c.r / 255.f; - g = c.g / 255.f; - b = c.b / 255.f; - a = c.a / 255.f; - } - - Color Color::operator *(const Color& c) - { - r *= c.r; - g *= c.g; - b *= c.b; - a *= c.a; - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/color.h b/source/libs/asura-lib-core/graphics/color.h deleted file mode 100644 index 607314b..0000000 --- a/source/libs/asura-lib-core/graphics/color.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __ASURA_ENGINE_COLOR_H__ -#define __ASURA_ENGINE_COLOR_H__ - -#include <asura-lib-utils/scripting/portable.hpp> - -#include "../core_config.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Color32; - - /// - /// 淶ɫ - /// - class Color ASURA_FINAL - : public Scripting::Portable<Color> - { - public: - - static Color Black; - static Color White; - static Color Red; - static Color Green; - static Color Blue; - - Color(); - - Color(const Color& c); - - Color(float r, float g, float b, float a); - - Color(const Color32& c); - - ~Color(); - - Color operator *(const Color& c); - - float r, g, b, a; - - LUAX_DECL_FACTORY(Color); - - LUAX_DECL_METHOD(_ToColor32); - LUAX_DECL_METHOD(_SetColor); - LUAX_DECL_METHOD(_GetColor); - LUAX_DECL_METHOD(_Multiply); // ɫ˷ - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/color32.cpp b/source/libs/asura-lib-core/graphics/color32.cpp deleted file mode 100644 index 0ebc77c..0000000 --- a/source/libs/asura-lib-core/graphics/color32.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "color.h" -#include "color32.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Color32::Color32() - { - r = g = b = a = 0; - } - - Color32::Color32(const Color32& c) - { - r = c.r; - g = c.g; - b = c.b; - a = c.a; - } - - Color32::Color32(const Color& c) - { - r = 255.f * c.r; - g = 255.f * c.g; - b = 255.f * c.b; - a = 255.f * c.a; - } - - Color32::Color32(byte r, byte g, byte b, byte a) - { - this->r = r; - this->g = g; - this->b = b; - this->a = a; - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/color32.h b/source/libs/asura-lib-core/graphics/color32.h deleted file mode 100644 index c64a9b9..0000000 --- a/source/libs/asura-lib-core/graphics/color32.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __ASURA_ENGINE_COLOR32_H__ -#define __ASURA_ENGINE_COLOR32_H__ - -#include <asura-lib-utils/scripting/portable.hpp> - -#include "../core_config.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Color; - - /// - /// 32bitsɫ - /// - class Color32 ASURA_FINAL - : public Scripting::Portable<Color32> - { - public: - - LUAX_DECL_FACTORY(Color32); - - Color32(); - - ~Color32(); - - Color32(const Color32& c); - - Color32(const Color& c); - - Color32(byte r, byte g, byte b, byte a); - - byte r, g, b, a; - - LUAX_DECL_METHOD(_ToColor); - LUAX_DECL_METHOD(_GetRed); - LUAX_DECL_METHOD(_GetGreen); - LUAX_DECL_METHOD(_GetBlue); - LUAX_DECL_METHOD(_GetAlpha); - LUAX_DECL_METHOD(_Multiply); - LUAX_DECL_METHOD(_Index); //r,g,b,a - LUAX_DECL_METHOD(_NewIndex); //r,g,b,a - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/color_palette.h b/source/libs/asura-lib-core/graphics/color_palette.h deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/color_palette.h +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/gif.cpp b/source/libs/asura-lib-core/graphics/gif.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/gif.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/gif.h b/source/libs/asura-lib-core/graphics/gif.h deleted file mode 100644 index 8b89858..0000000 --- a/source/libs/asura-lib-core/graphics/gif.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __ASURA_GIF_H__ -#define __ASURA_GIF_H__ - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Gif - /// - class Gif - { - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/gl.cpp b/source/libs/asura-lib-core/graphics/gl.cpp deleted file mode 100644 index 7c68c8f..0000000 --- a/source/libs/asura-lib-core/graphics/gl.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "../core_config.h" -#include "gl.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - bool OpenGL::instantiated = false; - - // - OpenGL gl; - - OpenGL::OpenGL() - { - ASSERT(!instantiated); - instantiated = true; - } - - OpenGL::~OpenGL() - { - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/gl.h b/source/libs/asura-lib-core/graphics/gl.h deleted file mode 100644 index bfc60ea..0000000 --- a/source/libs/asura-lib-core/graphics/gl.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __ASURA_ENGINE_OPENGL_H__ -#define __ASURA_ENGINE_OPENGL_H__ - -#include "glad/glad.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Profiler; - - /// - /// һЩopengl״̬١ - /// - class OpenGL - { - public: - OpenGL(); - ~OpenGL(); - - private: - - friend class Profiler; - - /// - /// opengl - /// - static bool instantiated; - - }; - - /// - /// OpenGL - /// - extern OpenGL gl; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/image.cpp b/source/libs/asura-lib-core/graphics/image.cpp deleted file mode 100644 index e704945..0000000 --- a/source/libs/asura-lib-core/graphics/image.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Config.h" -#include "Image.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Image::Image() - { - } - - Image::~Image() - { - } - - //\Ϣ - bool Image::Load(ImageData* data) - { - ASSERT(data); - - glBindTexture(GL_TEXTURE_2D, mTextureHandle); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, data->width, data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data->pixels); - glBindTexture(GL_TEXTURE_2D, 0); - return true; - - RRA(data, mImageData); - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/image.h b/source/libs/asura-lib-core/graphics/image.h deleted file mode 100644 index 4d9787b..0000000 --- a/source/libs/asura-lib-core/graphics/image.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGE_H__ -#define __ASURA_ENGINE_IMAGE_H__ - -#include <asura-lib-utils/math/rect.hpp> -#include <asura-lib-utils/math/vector2.hpp> -#include <asura-lib-utils/scripting/portable.hpp> -#include <asura-lib-utils/io/reloadable.h> -#include <asura-lib-utils/stringmap.hpp> -#include <asura-lib-utils/manager.hpp> - -#include "texture.h" -#include "color.h" -#include "color32.h" -#include "image_data.h" -#include "render_state.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageFactory; - - /// - /// ImageͼƬڴȡϷĽһImageڴ桢Դֻᱣһ - /// ݣҪimageêλãźתǶȣʹsprite - /// һֻࡣҪǿǵeditorengineʹòͬķװ - /// - class Image ASURA_FINAL - : public Drawable - , public Scripting::Portable<Image> - , public AEIO::Reloadable - { - public: - - LUAX_DECL_FACTORY(SimImage); - - Image(); - - ~Image(); - - /// - /// bufferimageϢmPixelsΪգݡ¹image - /// ʹglTexImage2Dύimageݡ - /// - bool Load(ImageData* data); - - uint GetWidth(); - uint GetHeight(); - Math::Vector2u GetSize(); - - /// - /// ijһλõ - /// - Color32 GetPixel(uint x, uint y); - - void Render(const RenderTarget* rt, const RenderState& state) override; - - void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override; - - private: - - ImageData* mImageData; - Luax::LuaxMemberRef mImageDataRef; - - Math::Vector2u mSize; - - LUAX_DECL_METHOD(_New); - LUAX_DECL_METHOD(_Load); - LUAX_DECL_METHOD(_GetWidth); - LUAX_DECL_METHOD(_GetHeight); - LUAX_DECL_METHOD(_GetSize); - LUAX_DECL_METHOD(_GetPixel); - LUAX_DECL_METHOD(_Render); - - }; - - } -} - -namespace AEGraphics = AsuraEngine::Graphics; - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/image_data.cpp b/source/libs/asura-lib-core/graphics/image_data.cpp deleted file mode 100644 index b79dfab..0000000 --- a/source/libs/asura-lib-core/graphics/image_data.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "image_data.h" -#include "png_decoder.h" -#include "stb_decoder.h" -#include "image_decoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - using namespace std; - - // imagedecoderΪԡ - list<ImageDecoder*> ImageData::ImageDecoders = { - new PNGDecoder(), // png - new STBDecoder() // jpeg, tga, bmp - }; - - ImageData::ImageData(const IO::DataBuffer& buffer) - : DecodedData(buffer) - { - } - - ImageData::~ImageData() - { - if (pixels) - delete[] pixels; - } - - /// - /// ɹ׳쳣 - /// - void ImageData::Decode(const IO::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/libs/asura-lib-core/graphics/image_data.h b/source/libs/asura-lib-core/graphics/image_data.h deleted file mode 100644 index 820e276..0000000 --- a/source/libs/asura-lib-core/graphics/image_data.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGEDATA_H__ -#define __ASURA_ENGINE_IMAGEDATA_H__ - -#include <list> - -#include <asura-lib-utils/scripting/portable.hpp> -#include <asura-lib-utils/io/decoded_data.h> -#include <asura-lib-utils/io/data_buffer.h> -#include <asura-lib-utils/threading/thread.h> - -#include "pixel_format.h" -#include "color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageDecoder; - - class ImageData ASURA_FINAL - : public AEIO::DecodedData - , public Scripting::Portable<ImageData> - { - public: - - LUAX_DECL_FACTORY(ImageData); - - /// - /// ͼƬļϢʧܣ׳쳣 - /// - ImageData(const AEIO::DataBuffer& buffer); - ~ImageData(); - - void Load(const AEIO::DataBuffer& buffer); - void LoadAsync(const AEIO::DataBuffer& buffer, AEThreading::Thread* thread); - - Color GetPixel(uint x, uint y); - - uint width, height; - PixelFormat format; - std::size_t size; - byte* pixels; - - private: - - void Decode(const AEIO::DataBuffer& buffer) override; - - /// - /// ڵһimage dataʱṩdecoderڼdecodersмѡԡ - /// - static std::list<ImageDecoder*> ImageDecoders; - - LUAX_DECL_METHOD(_New); - LUAX_DECL_METHOD(_GetPixel); - LUAX_DECL_METHOD(_GetSize); - LUAX_DECL_METHOD(_GetWidth); - LUAX_DECL_METHOD(_GetHeight); - LUAX_DECL_METHOD(_GetPixelFormat); - - }; - - } -} - -namespace AEGraphics = AsuraEngine::Graphics; - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/image_decode_task.cpp b/source/libs/asura-lib-core/graphics/image_decode_task.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/image_decode_task.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/image_decode_task.h b/source/libs/asura-lib-core/graphics/image_decode_task.h deleted file mode 100644 index a721b3e..0000000 --- a/source/libs/asura-lib-core/graphics/image_decode_task.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __ASURA_IMAGE_DECODE_TASK_H__ -#define __ASURA_IMAGE_DECODE_TASK_H__ - -#include <asura-lib-utils/threading/thread_task.h> -#include <asura-lib-utils/scripting/portable.hpp> - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageDecodeTask - : public AEScripting::Portable<ImageDecodeTask> - , public AEThreading::ThreadTask - { - public: - - LUAX_DECL_FACTORY(ImageDecodeTask); - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/image_decoder.h b/source/libs/asura-lib-core/graphics/image_decoder.h deleted file mode 100644 index 6f2049a..0000000 --- a/source/libs/asura-lib-core/graphics/image_decoder.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGE_DECODER_H__ -#define __ASURA_ENGINE_IMAGE_DECODER_H__ - -#include <asura-lib-utils/io/data_buffer.h> - -#include "image_data.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageDecoder - { - public: - - ImageDecoder(); - virtual ~ImageDecoder(); - - /// - /// жڴǷñdecoderѹ - /// - virtual bool CanDecode(const AEIO::DataBuffer& buffer) = 0; - - /// - /// һڴ棬һѹImage dataѹʧܷnullptr - /// - virtual void Decode(const AEIO::DataBuffer& buffer, ImageData& data) = 0; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/mesh2d.cpp b/source/libs/asura-lib-core/graphics/mesh2d.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/mesh2d.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/mesh2d.h b/source/libs/asura-lib-core/graphics/mesh2d.h deleted file mode 100644 index 48b461d..0000000 --- a/source/libs/asura-lib-core/graphics/mesh2d.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASURA_ENGINE_MESH2D_H__ -#define __ASURA_ENGINE_MESH2D_H__ - -#include <asura-lib-utils/scripting/portable.hpp> - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 2D meshһЩ㶯 - /// - class Mesh2D ASURA_FINAL - : public Scripting::Portable<Mesh2D> - { - public: - - Mesh2D(); - - ~Mesh2D(); - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/mesh2d_data.cpp b/source/libs/asura-lib-core/graphics/mesh2d_data.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/mesh2d_data.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/mesh2d_data.h b/source/libs/asura-lib-core/graphics/mesh2d_data.h deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/mesh2d_data.h +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/pixel_format.h b/source/libs/asura-lib-core/graphics/pixel_format.h deleted file mode 100644 index 8df07d5..0000000 --- a/source/libs/asura-lib-core/graphics/pixel_format.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/libs/asura-lib-core/graphics/png_decoder.cpp b/source/libs/asura-lib-core/graphics/png_decoder.cpp deleted file mode 100644 index f919090..0000000 --- a/source/libs/asura-lib-core/graphics/png_decoder.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/libs/asura-lib-core/graphics/png_decoder.h b/source/libs/asura-lib-core/graphics/png_decoder.h deleted file mode 100644 index bc871fa..0000000 --- a/source/libs/asura-lib-core/graphics/png_decoder.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_PNGDECODER_H__ -#define __ASURA_ENGINE_PNGDECODER_H__ - -#include "image_decoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// ʹlodepngѹpngļ - /// - class PNGDecoder ASURA_FINAL: public ImageDecoder - { - public: - - bool CanDecode(const AEIO::DataBuffer& buffer) override; - - void Decode(const AEIO::DataBuffer& buffer, ImageData& data) override; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/quad.cpp b/source/libs/asura-lib-core/graphics/quad.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/quad.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/quad.h b/source/libs/asura-lib-core/graphics/quad.h deleted file mode 100644 index b7dd3d9..0000000 --- a/source/libs/asura-lib-core/graphics/quad.h +++ /dev/null @@ -1 +0,0 @@ -// Quadrectڣrectǵıƫᣬquadһ diff --git a/source/libs/asura-lib-core/graphics/render_state.h b/source/libs/asura-lib-core/graphics/render_state.h deleted file mode 100644 index 4d1831c..0000000 --- a/source/libs/asura-lib-core/graphics/render_state.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __ASURA_ENGINE_RENDER_STATE_H__ -#define __ASURA_ENGINE_RENDER_STATE_H__ - -#include <asura-lib-utils/math/vector2.hpp> -#include <asura-lib-utils/math/transform.h> - -#include "Shader.h" -#include "blend_mode.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/libs/asura-lib-core/graphics/render_target.cpp b/source/libs/asura-lib-core/graphics/render_target.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/render_target.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/render_target.h b/source/libs/asura-lib-core/graphics/render_target.h deleted file mode 100644 index afa5c6a..0000000 --- a/source/libs/asura-lib-core/graphics/render_target.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __ASURA_ENGINE_RENDERTARGET_H__ -#define __ASURA_ENGINE_RENDERTARGET_H__ - -#include <asura-lib-utils/math/vector2.hpp> -#include <asura-lib-utils/math/rect.hpp> -#include <asura-lib-utils/scripting/portable.hpp> - -#include "texture.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/libs/asura-lib-core/graphics/shader.cpp b/source/libs/asura-lib-core/graphics/shader.cpp deleted file mode 100644 index 1a85866..0000000 --- a/source/libs/asura-lib-core/graphics/shader.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "Shader.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Shader::Shader() - { - - } - - Shader::~Shader() - { - - } - - bool Shader::Load(const std::string& vertexShader, const std::string& fragmentShader) - { - - } - - uint Shader::GetUniformLocation(const std::string& uniform) - { - - } - - GLuint Shader::GetGLProgramHandle() - { - return mProgramHandle; - } - - void Shader::Use() - { - - } - - void Shader::Unuse() - { - - } - - void Shader::SetUniformFloat(uint loc, float value) - { - - } - - void Shader::SetUniformFloat(uint loc, float value) - { - - } - - void Shader::SetUniformTexture(uint loc, const Texture& texture) - { - - } - - void Shader::SetUniformVector2(uint loc, const Math::Vector2f& vec2) - { - - } - - void Shader::SetUniformVector3(uint loc, const Math::Vector3f& vec3) - { - - } - - void Shader::SetUniformVector4(uint loc, const Math::Vector4f& vec4) - { - - } - - uint Shader::GetGLTextureUnitCount() - { - GLint maxTextureUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits); - return (uint)maxTextureUnits; - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/shader.h b/source/libs/asura-lib-core/graphics/shader.h deleted file mode 100644 index 1c81355..0000000 --- a/source/libs/asura-lib-core/graphics/shader.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __ASURA_ENGINE_SHADER_H__ -#define __ASURA_ENGINE_SHADER_H__ - -#include <map> -#include <string> - -#include <asura-lib-utils/scripting/portable.hpp> -#include <asura-lib-utils/io/reloadable.h> -#include <asura-lib-utils/math/vector2.hpp> -#include <asura-lib-utils/math/vector3.hpp> -#include <asura-lib-utils/math/vector4.h> -#include <asura-lib-utils/math/matrix44.h> -#include <asura-lib-utils/stringmap.hpp> -#include <asura-lib-utils/manager.hpp> - -#include "color.h" -#include "texture.h" -#include "gl.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩuniformsuseɫķ༭ - /// ÿshaderͨshaderҵuniforms¶frameworkmaterialá - /// - class Shader ASURA_FINAL - : public Scripting::Portable<Shader> - , public AEIO::Reloadable - { - public: - - Shader(); - - ~Shader(); - - /// - /// ӴshaderʱȼǷϴλuniforms location mapʹglAttachShader±ɫ - /// ɫ - /// - bool Load(const std::string& vertexShader, const std::string& fragmentShader); - - /// - /// shaderΪ - /// - void Use(); - - /// - /// shaderΪǻ - /// - void Unuse(); - - /// - /// Ѿ֪uniform location£ֵ - /// - void SetUniformFloat(uint loc, float value); - void SetUniformTexture(uint loc, const Texture& texture); - void SetUniformVector2(uint loc, const Math::Vector2f& vec2); - void SetUniformVector3(uint loc, const Math::Vector3f& vec3); - void SetUniformVector4(uint loc, const Math::Vector4f& vec4); - void SetUniformColor(uint loc, const Color& color); - void SetUniformMatrix44(uint loc, const Math::Matrix44& mat44); - - uint GetUniformLocation(const std::string& uniform); - - bool HasUniform(const std::string& uniform); - - GLuint GetGLProgramHandle(); - - /// - /// texture unitһΪ16 - /// - static uint GetGLTextureUnitCount(); - - private: - - /// - /// ǰshader - /// - static Shader* mCurrentShader; - - /// - /// ñ - /// vec2 Asura_Time xֵΪ뵱ǰʼʱ䣬yֵΪһ֡ʱ - /// vec2 Asura_RenderTargetSize RTĴСΪλ - /// Texture Asura_MainTexture - /// - void SetBuiltInUniforms(); - - /// - /// OpenGL shader program handle. - /// - GLuint mProgramHandle; - - //------------------------------------------------------------------------------// - - public: - - LUAX_DECL_FACTORY(SimShader); - - LUAX_DECL_METHOD(_New); - LUAX_DECL_METHOD(_Use); - LUAX_DECL_METHOD(_Unuse); - LUAX_DECL_METHOD(_Load); - LUAX_DECL_METHOD(_HasUniform); - LUAX_DECL_METHOD(_GetUniformLocation); - LUAX_DECL_METHOD(_SetBuiltInUniforms); - LUAX_DECL_METHOD(_SetUniformFloat); - LUAX_DECL_METHOD(_SetUniformTexture); - LUAX_DECL_METHOD(_SetUniformVector2); - LUAX_DECL_METHOD(_SetUniformVector3); - LUAX_DECL_METHOD(_SetUniformVector4); - LUAX_DECL_METHOD(_SetUniformColor); - - private: - - Luax::LuaxMemberRef mCodeLuaRef; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/shape.cpp b/source/libs/asura-lib-core/graphics/shape.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/shape.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/shape.h b/source/libs/asura-lib-core/graphics/shape.h deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/shape.h +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/sprite_batch.cpp b/source/libs/asura-lib-core/graphics/sprite_batch.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/libs/asura-lib-core/graphics/sprite_batch.cpp +++ /dev/null diff --git a/source/libs/asura-lib-core/graphics/sprite_batch.h b/source/libs/asura-lib-core/graphics/sprite_batch.h deleted file mode 100644 index d8d9ca6..0000000 --- a/source/libs/asura-lib-core/graphics/sprite_batch.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASURA_ENGINE_SPRITE_BATCH_H__ -#define __ASURA_ENGINE_SPRITE_BATCH_H__ - -#include <asura-lib-utils/scripting/portable.hpp> - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Sprite batchȾͼƬĵطϵͳ - /// - class SpriteBatch ASURA_FINAL - : public Scripting::Portable<SpriteBatch> - { - public: - - SpriteBatch(); - - ~SpriteBatch(); - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/stb_decoder.cpp b/source/libs/asura-lib-core/graphics/stb_decoder.cpp deleted file mode 100644 index a13d6b8..0000000 --- a/source/libs/asura-lib-core/graphics/stb_decoder.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include <asura-lib-utils/exceptions/exception.h> - -#include "stb_decoder.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/libs/asura-lib-core/graphics/stb_decoder.h b/source/libs/asura-lib-core/graphics/stb_decoder.h deleted file mode 100644 index 85bad21..0000000 --- a/source/libs/asura-lib-core/graphics/stb_decoder.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASURA_ENGINE_STBDECODER_H__ -#define __ASURA_ENGINE_STBDECODER_H__ - -#include "image_decoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// ʹstb_imageѹJPEGTGABMPļ - /// - class STBDecoder ASURA_FINAL - : public ImageDecoder - { - public: - - bool CanDecode(const AEIO::DataBuffer& buffer) override; - - void Decode(const AEIO::DataBuffer& buffer, ImageData& data) override; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/texture.cpp b/source/libs/asura-lib-core/graphics/texture.cpp deleted file mode 100644 index 6cb6497..0000000 --- a/source/libs/asura-lib-core/graphics/texture.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "Texture.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Texture::Texture() - : mTextureHandle(0) - { - // GL texture - glGenTextures(1, &mTextureHandle); - } - - Texture::~Texture() - { - glDeleteTextures(1, &mTextureHandle); - } - - GLuint Texture::GetGLTextureHandle() const - { - return mTextureHandle; - } - - } -}
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/texture.h b/source/libs/asura-lib-core/graphics/texture.h deleted file mode 100644 index c412b2e..0000000 --- a/source/libs/asura-lib-core/graphics/texture.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef __ASURA_ENGINE_TEXTURE_H__ -#define __ASURA_ENGINE_TEXTURE_H__ - -#include <asura-lib-utils/math/rect.hpp> -#include <asura-lib-utils/math/vector2.hpp> -#include <asura-lib-utils/scripting/portable.hpp> - -#include "../core_config.h" - -#include "render_state.h" -#include "gl.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class RenderTarget; - - /// - /// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷϲԵѿϵΪ - /// EditorҲϽΪԭ㣬Ϊ˷㡣 - /// - ASURA_ABSTRACT class Texture - { - public: - - Texture(); - - virtual ~Texture(); - - GLuint GetGLTextureHandle() const; - - /// - /// ȾtexturertϣԭϽǣң - /// - virtual void Render(const RenderTarget* rt, const RenderState& state) = 0; - - /// - /// ȾtextureһֵrtϣԭϽǣң졣 - /// - virtual void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) = 0; - - /// - /// ù˷ʽ - /// - void SetSmooth(bool smooth); - - /// - /// ظʽ - /// - void SetRepeated(); - - protected: - - /// - /// OpenGL texture handle - /// - GLuint mTextureHandle; - - }; - - using Drawable = Texture; - - } -} - -#endif
\ No newline at end of file |