summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/graphics
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-19 23:06:27 +0800
committerchai <chaifix@163.com>2019-03-19 23:06:27 +0800
commit1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 (patch)
treef8d1bff50da13e126d08c7345653e002e293202d /Source/Asura.Engine/graphics
parent5e2a973516e0729b225da9de0b03015dc5854ac4 (diff)
*rename
Diffstat (limited to 'Source/Asura.Engine/graphics')
-rw-r--r--Source/Asura.Engine/graphics/application.graphics.cpp19
-rw-r--r--Source/Asura.Engine/graphics/binding/canvas.binding.cpp0
-rw-r--r--Source/Asura.Engine/graphics/binding/color.binding.cpp0
-rw-r--r--Source/Asura.Engine/graphics/binding/image.binding.cpp0
-rw-r--r--Source/Asura.Engine/graphics/binding/image_data.binding.cpp35
-rw-r--r--Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp0
-rw-r--r--Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp9
-rw-r--r--Source/Asura.Engine/graphics/binding/shader.binding.cpp119
-rw-r--r--Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp0
-rw-r--r--Source/Asura.Engine/graphics/binding/window.binding.cpp11
-rw-r--r--Source/Asura.Engine/graphics/blend_mode.h17
-rw-r--r--Source/Asura.Engine/graphics/canvas.cpp41
-rw-r--r--Source/Asura.Engine/graphics/canvas.h81
-rw-r--r--Source/Asura.Engine/graphics/color.cpp132
-rw-r--r--Source/Asura.Engine/graphics/color.h94
-rw-r--r--Source/Asura.Engine/graphics/color_palette.h0
-rw-r--r--Source/Asura.Engine/graphics/gif.cpp0
-rw-r--r--Source/Asura.Engine/graphics/gif.h4
-rw-r--r--Source/Asura.Engine/graphics/gl.cpp11
-rw-r--r--Source/Asura.Engine/graphics/gl.h19
-rw-r--r--Source/Asura.Engine/graphics/image.cpp32
-rw-r--r--Source/Asura.Engine/graphics/image.h75
-rw-r--r--Source/Asura.Engine/graphics/image_data.cpp50
-rw-r--r--Source/Asura.Engine/graphics/image_data.h62
-rw-r--r--Source/Asura.Engine/graphics/image_decoder.h35
-rw-r--r--Source/Asura.Engine/graphics/mesh2d.cpp0
-rw-r--r--Source/Asura.Engine/graphics/mesh2d.h30
-rw-r--r--Source/Asura.Engine/graphics/mesh2d_data.cpp0
-rw-r--r--Source/Asura.Engine/graphics/mesh2d_data.h0
-rw-r--r--Source/Asura.Engine/graphics/pixel_format.h91
-rw-r--r--Source/Asura.Engine/graphics/png_decoder.cpp19
-rw-r--r--Source/Asura.Engine/graphics/png_decoder.h27
-rw-r--r--Source/Asura.Engine/graphics/quad.cpp0
-rw-r--r--Source/Asura.Engine/graphics/quad.h1
-rw-r--r--Source/Asura.Engine/graphics/render_state.h50
-rw-r--r--Source/Asura.Engine/graphics/render_target.cpp0
-rw-r--r--Source/Asura.Engine/graphics/render_target.h54
-rw-r--r--Source/Asura.Engine/graphics/shader.cpp81
-rw-r--r--Source/Asura.Engine/graphics/shader.h125
-rw-r--r--Source/Asura.Engine/graphics/shape.cpp0
-rw-r--r--Source/Asura.Engine/graphics/shape.h0
-rw-r--r--Source/Asura.Engine/graphics/sprite_batch.cpp0
-rw-r--r--Source/Asura.Engine/graphics/sprite_batch.h28
-rw-r--r--Source/Asura.Engine/graphics/stb_decoder.cpp65
-rw-r--r--Source/Asura.Engine/graphics/stb_decoder.h28
-rw-r--r--Source/Asura.Engine/graphics/texture.cpp26
-rw-r--r--Source/Asura.Engine/graphics/texture.h66
-rw-r--r--Source/Asura.Engine/graphics/window.cpp56
-rw-r--r--Source/Asura.Engine/graphics/window.h85
49 files changed, 0 insertions, 1678 deletions
diff --git a/Source/Asura.Engine/graphics/application.graphics.cpp b/Source/Asura.Engine/graphics/application.graphics.cpp
deleted file mode 100644
index 4d3102f..0000000
--- a/Source/Asura.Engine/graphics/application.graphics.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "Application.h"
-#include "Sdl2/SDL.h"
-#include "Exceptions/Exception.h"
-
-namespace AsuraEngine
-{
-
- ///
- /// ʼgraphicsģ
- ///
- bool Application::InitGraphics()
- {
-
- if (SDL_Init(SDL_INIT_VIDEO) < 0)
- return false;
-
- }
-
-} \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/binding/canvas.binding.cpp b/Source/Asura.Engine/graphics/binding/canvas.binding.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/binding/canvas.binding.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/binding/color.binding.cpp b/Source/Asura.Engine/graphics/binding/color.binding.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/binding/color.binding.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/binding/image.binding.cpp b/Source/Asura.Engine/graphics/binding/image.binding.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/binding/image.binding.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/binding/image_data.binding.cpp b/Source/Asura.Engine/graphics/binding/image_data.binding.cpp
deleted file mode 100644
index d576718..0000000
--- a/Source/Asura.Engine/graphics/binding/image_data.binding.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "../image.h"
-
-using namespace Luax;
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- void Image::RegisterLuaxInterface(LuaxState& state)
- {
-
- }
-
- void Image::RegisterLuaxClass(LuaxState& state)
- {
-
- }
-
- void Image::RegisterLuaxPostprocess(LuaxState& state)
- {
- // blendö٣AsuraEngine.EBlendMode
- LuaxEnum EBlendMode[] = {
- { "Additive", 1 },
- { "PreBlend", 2 },
- { "Substruction", 3 },
- { "Multiplied", 4 },
- {0, 0}
- };
-
- state.RegisterEnum("EBlendMode", EBlendMode);
- }
-
- }
-} \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp b/Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp b/Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp
deleted file mode 100644
index 6e15052..0000000
--- a/Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
-
-
- }
-} \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/binding/shader.binding.cpp b/Source/Asura.Engine/graphics/binding/shader.binding.cpp
deleted file mode 100644
index 1190997..0000000
--- a/Source/Asura.Engine/graphics/binding/shader.binding.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-#include "../shader.h"
-
-using namespace Luax;
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- void Shader::RegisterLuaxInterface(LuaxState& state)
- {
-
- }
-
- void Shader::RegisterLuaxClass(LuaxState& state)
- {
-
- LuaxEnum EBuiltIn[] = {
- {0, 0}
- };
-
- state.RegisterEnum("EBuiltIn", EBuiltIn);
-
- }
-
- void Shader::RegisterLuaxPostprocess(LuaxState& state)
- {
-
- }
-
- ///
- /// 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);
-
- }
-
- }
-} \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp b/Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/binding/window.binding.cpp b/Source/Asura.Engine/graphics/binding/window.binding.cpp
deleted file mode 100644
index 3befc8c..0000000
--- a/Source/Asura.Engine/graphics/binding/window.binding.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "../Window.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
-
-
- }
-}
diff --git a/Source/Asura.Engine/graphics/blend_mode.h b/Source/Asura.Engine/graphics/blend_mode.h
deleted file mode 100644
index 775cc45..0000000
--- a/Source/Asura.Engine/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/Asura.Engine/graphics/canvas.cpp b/Source/Asura.Engine/graphics/canvas.cpp
deleted file mode 100644
index 61787b6..0000000
--- a/Source/Asura.Engine/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, &current_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, &current_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/Asura.Engine/graphics/canvas.h b/Source/Asura.Engine/graphics/canvas.h
deleted file mode 100644
index c4e0f65..0000000
--- a/Source/Asura.Engine/graphics/canvas.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef __ASURA_ENGINE_CANVAS_H__
-#define __ASURA_ENGINE_CANVAS_H__
-
-#include <Scripting/Luax.hpp>
-
-#include "Math/Rect.hpp"
-#include "GL.h"
-#include "Texture.h"
-#include "RenderTarget.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- ///
- /// CanvasҲԳΪrender textureҲΪtextureȾ
- ///
- class Canvas ASURA_FINAL
- : public Drawable
- , public RenderTarget
- , public Scripting::Portable
- {
- 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(l_SetSize);
- LUAX_DECL_METHOD(l_Bind);
- LUAX_DECL_METHOD(l_Unbind);
-
- //----------------------------------------------------------------------------------------------------------
-
- };
-
- ///
- /// CanvasΪRenderTexture
- ///
- using RenderTexture = Canvas;
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/color.cpp b/Source/Asura.Engine/graphics/color.cpp
deleted file mode 100644
index 106493d..0000000
--- a/Source/Asura.Engine/graphics/color.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-#include "Color.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;
- }
-
- int Color32::l_GetRed(lua_State* L)
- {
-
- }
-
- int Color32::l_GetGreen(lua_State* L)
- {
-
- }
-
- int Color32::l_GetBlue(lua_State* L)
- {
-
- }
-
- int Color32::l_GetAlpha(lua_State* L)
- {
-
- }
-
- //------------------------------------------------------------------------------------------------------------
-
- 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;
- }
-
- int Color::l_GetRed(lua_State* L)
- {
-
- }
-
- int Color::l_GetGreen(lua_State* L)
- {
-
- }
-
- int Color::l_GetBlue(lua_State* L)
- {
-
- }
-
- int Color::l_GetAlpha(lua_State* L)
- {
-
- }
-
- int Color::l_Add(lua_State* L)
- {
-
- }
-
- int Color::l_Minus(lua_State* L)
- {
-
- }
-
- int Color::l_Multiply(lua_State* L)
- {
-
- }
-
- }
-} \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/color.h b/Source/Asura.Engine/graphics/color.h
deleted file mode 100644
index 0d65cb1..0000000
--- a/Source/Asura.Engine/graphics/color.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef __ASURA_ENGINE_COLOR_H__
-#define __ASURA_ENGINE_COLOR_H__
-
-#include "Scripting/Luax.hpp"
-#include "Scripting/Portable.h"
-#include "Config.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- class Color;
-
- ///
- /// 32bitsɫ
- ///
- class Color32 ASURA_FINAL: public Scripting::Portable
- {
- public:
-
- 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_FACTORY(Color32);
-
- LUAX_DECL_METHOD(l_ToColor);
- LUAX_DECL_METHOD(l_GetRed);
- LUAX_DECL_METHOD(l_GetGreen);
- LUAX_DECL_METHOD(l_GetBlue);
- LUAX_DECL_METHOD(l_GetAlpha);
- LUAX_DECL_METHOD(l_Multiply);
- LUAX_DECL_METHOD(l_Index); //r,g,b,a
- LUAX_DECL_METHOD(l_NewIndex); //޸r,g,b,a
-
- //----------------------------------------------------------------------------------------------------------
-
- };
-
- ///
- /// 淶ɫ
- ///
- class Color ASURA_FINAL: public Scripting::Portable
- {
- 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(l_ToColor32);
- LUAX_DECL_METHOD(l_SetColor);
- LUAX_DECL_METHOD(l_GetColor);
- LUAX_DECL_METHOD(l_Multiply); // ɫ˷
-
- //----------------------------------------------------------------------------------------------------------
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/color_palette.h b/Source/Asura.Engine/graphics/color_palette.h
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/color_palette.h
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/gif.cpp b/Source/Asura.Engine/graphics/gif.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/gif.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/gif.h b/Source/Asura.Engine/graphics/gif.h
deleted file mode 100644
index 36a3259..0000000
--- a/Source/Asura.Engine/graphics/gif.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __ASURA_GIF_H__
-#define __ASURA_GIF_H__
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/gl.cpp b/Source/Asura.Engine/graphics/gl.cpp
deleted file mode 100644
index dac2ea4..0000000
--- a/Source/Asura.Engine/graphics/gl.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "OpenGL.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
-
-
- }
-} \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/gl.h b/Source/Asura.Engine/graphics/gl.h
deleted file mode 100644
index 0661e17..0000000
--- a/Source/Asura.Engine/graphics/gl.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __ASURA_ENGINE_OPENGL_H__
-#define __ASURA_ENGINE_OPENGL_H__
-
-#include "glad/glad.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- class OpenGL
- {
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/image.cpp b/Source/Asura.Engine/graphics/image.cpp
deleted file mode 100644
index e704945..0000000
--- a/Source/Asura.Engine/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/Asura.Engine/graphics/image.h b/Source/Asura.Engine/graphics/image.h
deleted file mode 100644
index 916c365..0000000
--- a/Source/Asura.Engine/graphics/image.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef __ASURA_ENGINE_IMAGE_H__
-#define __ASURA_ENGINE_IMAGE_H__
-
-#include "math/vector2.hpp"
-#include "scripting/portable.hpp"
-#include "fileSystem/reloadable.h"
-#include "stringmap.hpp"
-#include "manager.hpp"
-#include "texture.h"
-#include "color.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 Filesystem::Reloadable
- {
- public:
-
- 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;
-
- Math::Vector2u mSize;
-
- public:
-
- LUAX_DECL_FACTORY(SimImage);
-
- LUAX_DECL_METHOD(l_Load);
- LUAX_DECL_METHOD(l_GetWidth);
- LUAX_DECL_METHOD(l_GetHeight);
- LUAX_DECL_METHOD(l_GetSize);
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/image_data.cpp b/Source/Asura.Engine/graphics/image_data.cpp
deleted file mode 100644
index 821bfd6..0000000
--- a/Source/Asura.Engine/graphics/image_data.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "image_data.h"
-#include "png_decoder.h"
-#include "stb_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 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/image_data.h b/Source/Asura.Engine/graphics/image_data.h
deleted file mode 100644
index 1e711a8..0000000
--- a/Source/Asura.Engine/graphics/image_data.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/decoded_data.h"
-#include "image_decoder.h"
-#include "pixel_format.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/image_decoder.h b/Source/Asura.Engine/graphics/image_decoder.h
deleted file mode 100644
index 2c73fd1..0000000
--- a/Source/Asura.Engine/graphics/image_decoder.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/mesh2d.cpp b/Source/Asura.Engine/graphics/mesh2d.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/mesh2d.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/mesh2d.h b/Source/Asura.Engine/graphics/mesh2d.h
deleted file mode 100644
index 2c58f00..0000000
--- a/Source/Asura.Engine/graphics/mesh2d.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __ASURA_ENGINE_MESH2D_H__
-#define __ASURA_ENGINE_MESH2D_H__
-
-#include "Scripting/Luax.hpp"
-
-#include "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/Asura.Engine/graphics/mesh2d_data.cpp b/Source/Asura.Engine/graphics/mesh2d_data.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/mesh2d_data.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/mesh2d_data.h b/Source/Asura.Engine/graphics/mesh2d_data.h
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/mesh2d_data.h
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/pixel_format.h b/Source/Asura.Engine/graphics/pixel_format.h
deleted file mode 100644
index 8df07d5..0000000
--- a/Source/Asura.Engine/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/Asura.Engine/graphics/png_decoder.cpp b/Source/Asura.Engine/graphics/png_decoder.cpp
deleted file mode 100644
index f919090..0000000
--- a/Source/Asura.Engine/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/Asura.Engine/graphics/png_decoder.h b/Source/Asura.Engine/graphics/png_decoder.h
deleted file mode 100644
index 980753f..0000000
--- a/Source/Asura.Engine/graphics/png_decoder.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/quad.cpp b/Source/Asura.Engine/graphics/quad.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/quad.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/quad.h b/Source/Asura.Engine/graphics/quad.h
deleted file mode 100644
index b7dd3d9..0000000
--- a/Source/Asura.Engine/graphics/quad.h
+++ /dev/null
@@ -1 +0,0 @@
-// Quadrectڣrectǵıƫᣬquadһ
diff --git a/Source/Asura.Engine/graphics/render_state.h b/Source/Asura.Engine/graphics/render_state.h
deleted file mode 100644
index a80efd3..0000000
--- a/Source/Asura.Engine/graphics/render_state.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 "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/Asura.Engine/graphics/render_target.cpp b/Source/Asura.Engine/graphics/render_target.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/render_target.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/render_target.h b/Source/Asura.Engine/graphics/render_target.h
deleted file mode 100644
index d6de164..0000000
--- a/Source/Asura.Engine/graphics/render_target.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/shader.cpp b/Source/Asura.Engine/graphics/shader.cpp
deleted file mode 100644
index 1a85866..0000000
--- a/Source/Asura.Engine/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/Asura.Engine/graphics/shader.h b/Source/Asura.Engine/graphics/shader.h
deleted file mode 100644
index 65f214e..0000000
--- a/Source/Asura.Engine/graphics/shader.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef __ASURA_ENGINE_SHADER_H__
-#define __ASURA_ENGINE_SHADER_H__
-
-#include <map>
-#include <string>
-
-#include "FileSystem/Reloadable.h"
-#include "Scripting/Luax.hpp"
-#include "Math/Vector2.hpp"
-#include "Math/Vector3.hpp"
-#include "Math/Vector4.h"
-#include "Math/Matrix44.h"
-#include "StringMap.hpp"
-#include "scripting/portable.hpp"
-#include "Color.h"
-#include "Manager.hpp"
-#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 Filesystem::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(l_Use);
- LUAX_DECL_METHOD(l_Unuse);
- LUAX_DECL_METHOD(l_Load);
- LUAX_DECL_METHOD(l_HasUniform);
- LUAX_DECL_METHOD(l_GetUniformLocation);
- LUAX_DECL_METHOD(l_SetBuiltInUniforms);
- LUAX_DECL_METHOD(l_SetUniformFloat);
- LUAX_DECL_METHOD(l_SetUniformTexture);
- LUAX_DECL_METHOD(l_SetUniformVector2);
- LUAX_DECL_METHOD(l_SetUniformVector3);
- LUAX_DECL_METHOD(l_SetUniformVector4);
- LUAX_DECL_METHOD(l_SetUniformColor);
-
- private:
-
- Luax::LuaxMemberRef mCodeLuaRef;
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/shape.cpp b/Source/Asura.Engine/graphics/shape.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/shape.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/shape.h b/Source/Asura.Engine/graphics/shape.h
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/shape.h
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/sprite_batch.cpp b/Source/Asura.Engine/graphics/sprite_batch.cpp
deleted file mode 100644
index e69de29..0000000
--- a/Source/Asura.Engine/graphics/sprite_batch.cpp
+++ /dev/null
diff --git a/Source/Asura.Engine/graphics/sprite_batch.h b/Source/Asura.Engine/graphics/sprite_batch.h
deleted file mode 100644
index 7909519..0000000
--- a/Source/Asura.Engine/graphics/sprite_batch.h
+++ /dev/null
@@ -1,28 +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<SpriteBatch>
- {
- public:
-
- SpriteBatch();
-
- ~SpriteBatch();
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/stb_decoder.cpp b/Source/Asura.Engine/graphics/stb_decoder.cpp
deleted file mode 100644
index b14d0f3..0000000
--- a/Source/Asura.Engine/graphics/stb_decoder.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/stb_decoder.h b/Source/Asura.Engine/graphics/stb_decoder.h
deleted file mode 100644
index 57b247c..0000000
--- a/Source/Asura.Engine/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 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/texture.cpp b/Source/Asura.Engine/graphics/texture.cpp
deleted file mode 100644
index 6cb6497..0000000
--- a/Source/Asura.Engine/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/Asura.Engine/graphics/texture.h b/Source/Asura.Engine/graphics/texture.h
deleted file mode 100644
index 81aa469..0000000
--- a/Source/Asura.Engine/graphics/texture.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __ASURA_ENGINE_TEXTURE_H__
-#define __ASURA_ENGINE_TEXTURE_H__
-
-#include "Config.h"
-#include "Math/Rect.hpp"
-#include "Math/Vector2.hpp"
-#include "Scripting/Luax.hpp"
-#include "RenderState.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
diff --git a/Source/Asura.Engine/graphics/window.cpp b/Source/Asura.Engine/graphics/window.cpp
deleted file mode 100644
index bb941e1..0000000
--- a/Source/Asura.Engine/graphics/window.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "Config.h"
-#include "Window.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- Window::Window(WindowStyle style)
- {
- //mWindowHandle = SDL_CreateWindow();
- }
-
- Window::~Window()
- {
-
- }
-
- SDL_Window* Window::GetSDLWindowHandle()
- {
- return mWindowHandle;
- }
-
- void Window::SetPosition(int x, int y)
- {
- ASSERT(mWindowHandle);
- SDL_SetWindowPosition(mWindowHandle, x, y);
- }
-
- void Window::SetTitle(const std::string& title)
- {
-
- }
-
- void Window::Show()
- {
-
- }
-
- void Window::Hide()
- {
-
- }
-
- void Window::SetWindowStyle(WindowStyle style)
- {
-
- }
-
- void Window::SwapRenderBuffer()
- {
-
- }
-
- }
-}
diff --git a/Source/Asura.Engine/graphics/window.h b/Source/Asura.Engine/graphics/window.h
deleted file mode 100644
index 973fd98..0000000
--- a/Source/Asura.Engine/graphics/window.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef __ASURA_ENGINE_WINDOW_H__
-#define __ASURA_ENGINE_WINDOW_H__
-
-#include "SDL2/Sdl.h"
-#include "Graphics/RenderTarget.h"
-#include "Math/Vector2.hpp"
-#include "Scripting/Portable.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- enum WindowStyle
- {
- WINDOW_STYLE_FULLSCREEN = 1 << 1,
- };
-
- ///
- /// ڣֶ֧രڡڱ༭Ҫ֧֣runnerֻҪһڡ
- ///
- class Window ASURA_FINAL
- : public RenderTarget
- , public Scripting::Portable
- {
- public:
-
- Window(WindowStyle style);
-
- ~Window();
-
- SDL_Window* GetSDLWindowHandle();
-
- void SetSize(uint width, uint height);
-
- void SetPosition(int x, int y);
-
- void SetTitle(const std::string& title);
-
- void SetWindowStyle(WindowStyle style);
-
- void Show();
-
- void Hide();
-
- ///
- /// ǿ˫ĴڣҪչʾǰ̨
- ///
- void SwapRenderBuffer();
-
- void Clear(const Color& col = Color::Black) override;
-
- void Clear(const Math::Recti& quad, const Color& col = Color::Black) override;
-
- void Draw(const Drawable* texture, const RenderState& state) override;
-
- void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state) override;
-
- private:
-
- ///
- /// SDL window handle.
- ///
- SDL_Window* mWindowHandle;
-
- Math::Vector2i mPosition;
-
- Math::Vector2i mSize;
-
- public:
-
- //----------------------------------------------------------------------------------------------------------
-
- LUAX_DECL_FACTORY(Window);
-
- //----------------------------------------------------------------------------------------------------------
-
- };
-
- using RenderWindow = Window;
-
- }
-}
-
-#endif \ No newline at end of file