diff options
Diffstat (limited to 'source/modules/asura-core')
20 files changed, 330 insertions, 169 deletions
diff --git a/source/modules/asura-core/core_config.h b/source/modules/asura-core/core_config.h index 2286189..717f254 100644 --- a/source/modules/asura-core/core_config.h +++ b/source/modules/asura-core/core_config.h @@ -3,4 +3,9 @@ #define ASURA_WINDOW_SDL 1 +#define ASURA_OPENGL_GLAD (1 << 1) +#define ASURA_OPENGL_GLEE (1 << 2) +#define ASURA_OPENGL_GLUT (1 << 3) +#define ASURA_OPENGL_LOADER (ASURA_OPENGL_GLAD|ASURA_OPENGL_GLEE|ASURA_OPENGL_GLUT) + #endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/binding/_image.cpp b/source/modules/asura-core/graphics/binding/_image.cpp index 6179706..76ac635 100644 --- a/source/modules/asura-core/graphics/binding/_image.cpp +++ b/source/modules/asura-core/graphics/binding/_image.cpp @@ -39,7 +39,7 @@ namespace AsuraEngine { LUAX_PREPARE(L, Image); ImageData* imgData = state.CheckUserdata<ImageData>(2); - state.Push(self->Update(imgData)); + state.Push(self->Load(imgData)); return 1; } diff --git a/source/modules/asura-core/graphics/canvas.h b/source/modules/asura-core/graphics/canvas.h index 6af81d7..555ce5d 100644 --- a/source/modules/asura-core/graphics/canvas.h +++ b/source/modules/asura-core/graphics/canvas.h @@ -20,9 +20,7 @@ namespace AsuraEngine /// CanvasҲԳΪrender textureҲΪtextureȾ /// class Canvas ASURA_FINAL - : public Drawable - , public RenderTarget - , public Scripting::Portable<Canvas> + : public Scripting::Portable<Canvas, RenderTarget> { public: @@ -33,12 +31,12 @@ namespace AsuraEngine /// /// render textureĴС /// - void SetSize(uint w, uint h) asura_throw(Exception); + void SetSize(uint w, uint h) ASURA_THROW(Exception); 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); @@ -55,6 +53,11 @@ namespace AsuraEngine GLuint mFBO; /// + /// tex + /// + GLuint mTex; + + /// /// canvasĴС /// uint mWidth, mHeight; diff --git a/source/modules/asura-core/graphics/gl.cpp b/source/modules/asura-core/graphics/gl.cpp index 47476a7..54fadb7 100644 --- a/source/modules/asura-core/graphics/gl.cpp +++ b/source/modules/asura-core/graphics/gl.cpp @@ -30,13 +30,41 @@ namespace AsuraEngine { } + bool OpenGL::Init(const AEMath::Recti& view) + { + bool loaded = false; +#if ASURA_OPENGL_LOADER & ASURA_OPENGL_GLAD + if (!loaded) + loaded = gladLoadGL(); +#endif + if (!loaded) + return false; + state.viewport = view; + return true; + } + + void OpenGL::WipeError() + { + while (glGetError() != GL_NO_ERROR); + } + + bool OpenGL::HasError() + { + return glGetError() != GL_NO_ERROR; + } + + GLenum OpenGL::GetError() + { + return glGetError(); + } + void OpenGL::SetViewport(const Recti v) { glViewport(v.x, v.y, v.w, v.h); state.viewport = v; } - Recti OpenGL::GetViewport() + const Recti& OpenGL::GetViewport() { return state.viewport; } diff --git a/source/modules/asura-core/graphics/gl.h b/source/modules/asura-core/graphics/gl.h index 6838bc9..e3c2ffc 100644 --- a/source/modules/asura-core/graphics/gl.h +++ b/source/modules/asura-core/graphics/gl.h @@ -18,6 +18,7 @@ namespace AsuraEngine class Profiler; class Shader; + class GPUBuffer; enum MatrixMode { @@ -35,17 +36,23 @@ namespace AsuraEngine { public: - LUAX_DECL_SINGLETON(GL); - OpenGL(); ~OpenGL(); + /// + /// ʼOpenGLIJڴOpenGL֮˺עOpenGLĵַ + /// + bool Init(const AEMath::Recti& viewport); + void SetViewport(const AEMath::Recti viewport); - AEMath::Recti GetViewport(); + const AEMath::Recti& GetViewport(); void UseShader(Shader* shader); void UnuseShader(); + /// + /// Matrix stackز + /// void SetMatrixMode(MatrixMode mode); MatrixMode GetMatrixMode(); void PushMatrix(); @@ -59,6 +66,13 @@ namespace AsuraEngine uint GetMatrixDepth(); uint GetMatrixIndex(); + /// + /// ʾ + /// + void WipeError(); + bool HasError(); + GLenum GetError(); + /// /// OpenGL3.0Ժû任ӿڡshaderȲﱣһЩOpenGL״̬ע /// ƺȫ̵ģҲ˵Asuraֶ֧߳ȾOpenGLĵĴʹһ @@ -78,6 +92,8 @@ namespace AsuraEngine friend class Profiler; + LUAX_DECL_SINGLETON(OpenGL); + //----------------------------------------------------------------------------// LUAX_DECL_ENUM(MatrixMode, 0); diff --git a/source/modules/asura-core/graphics/gpu_buffer.cpp b/source/modules/asura-core/graphics/gpu_buffer.cpp new file mode 100644 index 0000000..c796bb0 --- /dev/null +++ b/source/modules/asura-core/graphics/gpu_buffer.cpp @@ -0,0 +1,94 @@ +#include "gpu_buffer.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + GPUBuffer::GPUBuffer(BufferType type, BufferUsage usage, size_t size) + : mTarget(GL_ZERO) + , mBuffer(GL_ZERO) + , mSize(0) +#if ASURA_DEBUG + , mData(nullptr) +#endif + { + switch (type) + { + case BUFFER_TYPE_VERTEX: + mTarget = GL_ARRAY_BUFFER; + break; + case BUFFER_TYPE_INDEX: + mTarget = GL_ELEMENT_ARRAY_BUFFER; + break; + } + switch (usage) + { + case BUFFER_USAGE_STREAM: + mUsage = GL_STREAM_DRAW; + break; + case BUFFER_USAGE_DYNAMIC: + mUsage = GL_DYNAMIC_DRAW; + break; + case BUFFER_USAGE_STATIC: + mUsage = GL_STATIC_DRAW; + break; + } + gl.WipeError(); + glGenBuffers(1, &mBuffer); + if (mBuffer == 0) + throw Exception("OpenGL glGenBuffers failed."); + glBindBuffer(mTarget, mBuffer); + glBufferData(mTarget, size, NULL, mUsage); // ʼСΪsizeĻ + if (gl.HasError()) + throw Exception("OpenGL glBufferData failed. Errorcode=%d.", gl.GetError()); + glBindBuffer(mTarget, 0); +#if ASURA_DEBUG + mData = (byte*)malloc(size); + memset(mData, 0, size); +#endif + mSize = size; + } + + GPUBuffer::~GPUBuffer() + { +#if ASURA_DEBUG + if (mData) + free(mData); +#endif + glDeleteBuffers(1, &mBuffer); + } + + bool GPUBuffer::Fill(const void * data, size_t size, uint offset) + { + if (data == nullptr) + return false; + glBindBuffer(mTarget, mBuffer); + glBufferSubData(mTarget, offset, size, data); + if (gl.HasError()) + throw Exception("OpenGL glBufferSubData failed. Errorcode=%d.", gl.GetError()); + glBindBuffer(mTarget, 0); +#if ASURA_DEBUG + // һݣ + memcpy(mData + offset, data, size); +#endif + return true; + } + + void GPUBuffer::Bind() + { + glBindBuffer(mTarget, mBuffer); + } + + void GPUBuffer::UnBind() + { + glBindBuffer(mTarget, 0); + } + + uint GPUBuffer::GetBufferSize() + { + return mSize; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/gpu_buffer.h b/source/modules/asura-core/graphics/gpu_buffer.h new file mode 100644 index 0000000..aba1157 --- /dev/null +++ b/source/modules/asura-core/graphics/gpu_buffer.h @@ -0,0 +1,69 @@ +#ifndef __ASURA_GPU_BUFFER_H__ +#define __ASURA_GPU_BUFFER_H__ + +#include <asura-utils/exceptions/exception.h> +#include <asura-utils/type.h> + +#include "gl.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + enum BufferType + { + BUFFER_TYPE_VERTEX, ///< 㻺 + BUFFER_TYPE_INDEX, ///< + }; + + enum BufferUsage + { + BUFFER_USAGE_STREAM, ///< һΣʹô + BUFFER_USAGE_DYNAMIC, ///< һΣʹ + BUFFER_USAGE_STATIC, ///< ĺʹ + }; + + /// + /// GPU壬ֶ㻺֣ÿζڴԴϴݡ + /// + class GPUBuffer + { + public: + + GPUBuffer(BufferType type, BufferUsage usage, size_t size) ASURA_THROW(Exception); + ~GPUBuffer(); + + /// + /// ʼ\»棬ûgpu bufferԴΪdzʼΪǸ¡ + /// + bool Fill(const void* data, size_t size, uint offset = 0) ASURA_THROW(Exception); + + /// + /// ӦĿϣͿʹˡ + /// + void Bind(); + void UnBind(); + + uint GetBufferSize(); + + private: + + GLenum mTarget; + GLuint mBuffer; + GLuint mUsage; + uint mSize; + +#if ASURA_DEBUG + /// + /// رbufferݣԴݱһ£ԺԴ档 + /// + byte* mData; +#endif + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp index 4cbe826..d4c4cdd 100644 --- a/source/modules/asura-core/graphics/image.cpp +++ b/source/modules/asura-core/graphics/image.cpp @@ -20,11 +20,9 @@ namespace AsuraEngine { } - bool Image::Update(DecodedData* data) + bool Image::Load(ImageData* imgData) { - if (!data) return false; - ImageData* imgData = static_cast<ImageData*>(data); - if (!imgData) return false; + if (!imgData) return false; if (mTex == 0) { @@ -59,10 +57,8 @@ namespace AsuraEngine return true; } - bool Image::Update(AEIO::DecodedData* data, const AEMath::Vector2i& pos) + bool Image::Load(ImageData* imgData, const AEMath::Vector2i& pos) { - if (!data) return false; - ImageData* imgData = static_cast<ImageData*>(data); if (!imgData) return false; glBindTexture(GL_TEXTURE_2D, mTex); diff --git a/source/modules/asura-core/graphics/image.h b/source/modules/asura-core/graphics/image.h index e4aecd1..d3cca4b 100644 --- a/source/modules/asura-core/graphics/image.h +++ b/source/modules/asura-core/graphics/image.h @@ -20,21 +20,16 @@ namespace AsuraEngine namespace Graphics { - class ImageFactory; - /// /// ImageͼƬڴȡϷĽһImageڴ桢Դֻᱣһ /// ݣҪimageêλãźתǶȣʹsprite /// һֻࡣҪǿǵeditorengineʹòͬķװ /// class Image ASURA_FINAL - : public AEIO::Renewable - , public AEScripting::Portable<Image, Texture> + : public AEScripting::Portable<Image, Texture> { public: - LUAX_DECL_FACTORY(Image); - Image(); ~Image(); @@ -43,19 +38,21 @@ namespace AsuraEngine /// ͼύGPUϢ¹imageʹglTexImage2D /// ύimageݡ /// - bool Update(AEIO::DecodedData* decodeData) override; - bool Update(AEIO::DecodedData* decodeData, const AEMath::Vector2i& pos); + bool Load(ImageData* decodeData); + bool Load(ImageData* decodeData, const AEMath::Vector2i& pos); uint GetWidth(); uint GetHeight(); void Render(const RenderTarget* rt, const RenderState& state) override {}; - void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override {}; + void Render(const RenderTarget* rt, const AEMath::Rectf& quad, const RenderState& state) override {}; private: //----------------------------------------------------------------------------// + LUAX_DECL_FACTORY(Image, Texture); + LUAX_DECL_METHOD(_New); LUAX_DECL_METHOD(_Update); LUAX_DECL_METHOD(_GetWidth); diff --git a/source/modules/asura-core/graphics/matrix_stack.h b/source/modules/asura-core/graphics/matrix_stack.h index e69ee98..db7248b 100644 --- a/source/modules/asura-core/graphics/matrix_stack.h +++ b/source/modules/asura-core/graphics/matrix_stack.h @@ -35,7 +35,7 @@ namespace AsuraEngine bool Pop(); AEMath::Matrix44& GetTop(); - void GetTop(asura_out AEMath::Matrix44& mat44); + void GetTop(ASURA_OUT AEMath::Matrix44& mat44); void LoadMatrix(const AEMath::Matrix44& mat44); void MultMatrix(const AEMath::Matrix44& mat44); diff --git a/source/modules/asura-core/graphics/render_target.h b/source/modules/asura-core/graphics/render_target.h index 0749cab..1992f6c 100644 --- a/source/modules/asura-core/graphics/render_target.h +++ b/source/modules/asura-core/graphics/render_target.h @@ -18,7 +18,7 @@ namespace AsuraEngine /// Canvas(RenderTexture) /// Window(RenderWindow) /// - class RenderTarget + class RenderTarget : public AEScripting::Object { public: diff --git a/source/modules/asura-core/graphics/shader.cpp b/source/modules/asura-core/graphics/shader.cpp index c26ddf1..e6779df 100644 --- a/source/modules/asura-core/graphics/shader.cpp +++ b/source/modules/asura-core/graphics/shader.cpp @@ -1,6 +1,5 @@ #include <asura-utils/exceptions/exception.h> -#include "shader_source.h" #include "shader.h" using namespace std; @@ -12,47 +11,49 @@ namespace AsuraEngine Shader::Shader() { - //Fix: Ҫʱ - //mProgram = glCreateProgram(); - //if (mProgram == 0) - // throw Exception("Cannot create OpenGL shader program."); - - //mVertShader = glCreateShader(GL_VERTEX_SHADER); - //if (mVertShader == 0) - //{ - // glDeleteProgram(mProgram); - // throw Exception("Cannot create OpenGL vertex shader."); - //} - - //mFragShader = glCreateShader(GL_FRAGMENT_SHADER); - //if (mFragShader == 0) - //{ - // glDeleteProgram(mProgram); - // glDeleteShader(mVertShader); - // throw Exception("Cannot create OpenGL fragment shader."); - //} } Shader::~Shader() { - glDeleteShader(mVertShader); - glDeleteShader(mFragShader); - glDeleteProgram(mProgram); + if(mVertShader != 0) + glDeleteShader(mVertShader); + if(mFragShader != 0) + glDeleteShader(mFragShader); + if(mProgram != 0) + glDeleteProgram(mProgram); } - bool Shader::Update(AEIO::DecodedData* db) + bool Shader::Load(const string& vert, const string& frag) { - if (!db) return false; - ShaderSouce* shaderSource = static_cast<ShaderSouce*>(db); - if (!shaderSource) return false; - GLenum err = GL_NO_ERROR; - const GLchar* source; GLint success; string warnning = ""; + if (mProgram == 0) + { + mProgram = glCreateProgram(); + if (mProgram == 0) + throw Exception("Cannot create OpenGL shader program."); + } + + if (mVertShader == 0) + { + mVertShader = glCreateShader(GL_VERTEX_SHADER); + if (mVertShader == 0) + throw Exception("Cannot create OpenGL vertex shader."); + } + + if (mFragShader == 0) + { + mFragShader = glCreateShader(GL_FRAGMENT_SHADER); + if(mFragShader == 0) + throw Exception("Cannot create OpenGL fragment shader."); + } + + const GLchar* source; + // Compile vertex shader. - source = shaderSource->mVert.c_str(); + source = vert.c_str(); glShaderSource(mVertShader, 1, &source, NULL); glCompileShader(mVertShader); glGetShaderiv(mVertShader, GL_COMPILE_STATUS, &success); @@ -63,7 +64,7 @@ namespace AsuraEngine } // Compile fragment shader. - source = shaderSource->mFrag.c_str(); + source = frag.c_str(); glShaderSource(mFragShader, 1, &source, NULL); glCompileShader(mFragShader); glGetShaderiv(mFragShader, GL_COMPILE_STATUS, &success); @@ -83,29 +84,27 @@ namespace AsuraEngine warnning = GetProgramWarnings(); throw Exception("Link shader program failed:\n%s", warnning.c_str()); } - } - uint Shader::GetUniformLocation(const std::string& uniform) - { - return 0; + return true; } - GLuint Shader::GetGLProgramHandle() + uint Shader::GetUniformLocation(const std::string& uniform) { - return mProgram; + // This function returns -1 if name does not correspond to an active uniform variable + // in program or if name starts with the reserved prefix "gl_". + GLint loc = glGetUniformLocation(mProgram, uniform.c_str()); + return loc; } - void Shader::Use() + bool Shader::HasUniform(const std::string& uniform) { - if (mProgram != 0) - { - gl.UseShader(this); - } + GLint loc = glGetUniformLocation(mProgram, uniform.c_str()); + return loc != -1; } - void Shader::Unuse() + GLuint Shader::GetGLProgramHandle() { - gl.UnuseShader(); + return mProgram; } void Shader::SetUniformFloat(uint loc, float value) @@ -138,6 +137,18 @@ namespace AsuraEngine glUniform4f(loc, vec4.x, vec4.y, vec4.z, vec4.w); } + void Shader::SetUniformMatrix44(uint loc, const Math::Matrix44& mat) + { + if (gl.state.shader == this) + glUniformMatrix4fv(loc, 1, GL_FALSE, mat.GetElements()); + } + + //void Shader::GetUniform() + //{ + // //if(gl.state.shader == this) + // // glGetUniformfv() + //} + uint Shader::GetGLTextureUnitCount() { GLint maxTextureUnits = 0; diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h index f4bce25..9cf9653 100644 --- a/source/modules/asura-core/graphics/shader.h +++ b/source/modules/asura-core/graphics/shader.h @@ -14,7 +14,6 @@ #include <asura-utils/stringmap.hpp> #include <asura-utils/manager.hpp> -#include "shader_source.h" #include "color.h" #include "texture.h" #include "gl.h" @@ -35,31 +34,14 @@ namespace AsuraEngine { public: - LUAX_DECL_FACTORY(Shader); - - Shader() asura_throw(Exception); + Shader(); ~Shader(); - /// - /// ӴshaderʱȼǷϴλuniforms location mapʹ - /// glAttachShader±ɫɫ - /// - bool Update(AEIO::DecodedData* decodeData) override; - - /// - /// shaderΪ - /// - void Use(); - - /// - /// shaderΪǻ - /// - void Unuse(); - - /// - /// Ѿ֪uniform location£ֵ - /// + bool Load(const std::string& vert, const std::string& frag); + + uint GetAttributeLocation(const std::string& name); + void SetUniformFloat(uint loc, float value); void SetUniformTexture(uint loc, const Texture& texture); void SetUniformVector2(uint loc, const Math::Vector2f& vec2); @@ -68,40 +50,32 @@ namespace AsuraEngine void SetUniformColor(uint loc, const Color& color); void SetUniformMatrix44(uint loc, const Math::Matrix44& mat44); + float GetUniformFloat(uint loc); + AEMath::Vector2f GetUniformVector2(uint loc); + AEMath::Vector3f GetUniformVector3(uint loc); + AEMath::Vector4f GetUniformVector4s(uint loc); + AEMath::Matrix44 GetUniformMatrix44(uint loc); + uint GetUniformLocation(const std::string& uniform); bool HasUniform(const std::string& uniform); GLuint GetGLProgramHandle(); - /// - /// texture unitһΪ16 - /// static uint GetGLTextureUnitCount(); private: - /// - /// ñ - /// vec2 Asura_Time xֵΪ뵱ǰʼʱ䣬yֵΪһ֡ʱ - /// vec2 Asura_RenderTargetSize RTĴСΪλ - /// Texture Asura_MainTexture - /// - void SetBuiltInUniforms(); - - /// - /// OpenGL shader program handle. - /// GLuint mProgram; GLuint mVertShader; GLuint mFragShader; - Luax::LuaxMemberRef mCodeRef; - private: //----------------------------------------------------------------------------// + LUAX_DECL_FACTORY(Shader); + LUAX_DECL_METHOD(_New); LUAX_DECL_METHOD(_Use); LUAX_DECL_METHOD(_Unuse); diff --git a/source/modules/asura-core/graphics/shader_source.h b/source/modules/asura-core/graphics/shader_source.h deleted file mode 100644 index eedbe53..0000000 --- a/source/modules/asura-core/graphics/shader_source.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __ASURA_SHADER_SOURCE_H__ -#define __ASURA_SHADER_SOURCE_H__ - -#include <string> - -#include <asura-utils/io/decoded_data.h> - -namespace AsuraEngine -{ - namespace Graphics - { - - class Shader; - - /// - /// Asura EngineʹõshaderԴ룬GLSL - /// - class ShaderSouce : public AEIO::DecodedData - { - public: - - void Decode(AEIO::DataBuffer& vert, AEIO::DataBuffer& frag); - void Load(const std::string& vert, const std::string& frag); - - private: - - friend class Shader; - - void Decode(AEIO::DataBuffer& buffer) override; - - std::string mVert; - std::string mFrag; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/sprite_batch.h b/source/modules/asura-core/graphics/sprite_batch.h index eb1c89c..17ecb40 100644 --- a/source/modules/asura-core/graphics/sprite_batch.h +++ b/source/modules/asura-core/graphics/sprite_batch.h @@ -3,6 +3,8 @@ #include <asura-utils/scripting/portable.hpp> +#include "gpu_buffer.h" + namespace AsuraEngine { namespace Graphics @@ -16,12 +18,16 @@ namespace AsuraEngine { public: - LUAX_DECL_FACTORY(SpriteBatch); - SpriteBatch(); ~SpriteBatch(); + private: + + LUAX_DECL_FACTORY(SpriteBatch); + + + }; } diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h index 571c617..4a414b4 100644 --- a/source/modules/asura-core/graphics/texture.h +++ b/source/modules/asura-core/graphics/texture.h @@ -1,8 +1,8 @@ #ifndef __ASURA_TEXTURE_H__ #define __ASURA_TEXTURE_H__ -#include <asura-utils/math/rect.hpp> #include <asura-utils/math/vector2.hpp> +#include <asura-utils/math/rect.hpp> #include "../core_config.h" @@ -87,7 +87,7 @@ namespace AsuraEngine /// /// ȾtextureһֵrtϣԭϽǣң졣 /// - virtual void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) = 0; + virtual void Render(const RenderTarget* rt, const AEMath::Rectf& quad, const RenderState& state) = 0; protected: @@ -112,6 +112,9 @@ namespace AsuraEngine //----------------------------------------------------------------------------// + /// + /// OpenGL + /// GLuint mTex; FilterMode mMinFilter; diff --git a/source/modules/asura-core/image/image_data.h b/source/modules/asura-core/image/image_data.h index d9427d3..b05507a 100644 --- a/source/modules/asura-core/image/image_data.h +++ b/source/modules/asura-core/image/image_data.h @@ -20,13 +20,11 @@ namespace AsuraEngine class ImageDecoder; class ImageData ASURA_FINAL - : public AEIO::DecodedData - , public Scripting::Portable<ImageData> + : public Scripting::Portable<ImageData> + , public AEIO::DecodedData { public: - LUAX_DECL_FACTORY(ImageData); - /// /// ͼƬļϢʧܣ׳쳣 /// @@ -53,6 +51,8 @@ namespace AsuraEngine //----------------------------------------------------------------------------// + LUAX_DECL_FACTORY(ImageData); + LUAX_DECL_METHOD(_New); LUAX_DECL_METHOD(_GetPixel); LUAX_DECL_METHOD(_GetSize); diff --git a/source/modules/asura-core/image/image_decode_task.h b/source/modules/asura-core/image/image_decode_task.h index 15b0837..666d00f 100644 --- a/source/modules/asura-core/image/image_decode_task.h +++ b/source/modules/asura-core/image/image_decode_task.h @@ -10,8 +10,7 @@ namespace AsuraEngine { class ImageDecodeTask - : public AEScripting::Portable<ImageDecodeTask> - , public AEThreading::Task + : public AEScripting::Portable<ImageDecodeTask, AEThreading::Task> { public: diff --git a/source/modules/asura-core/window/window.cpp b/source/modules/asura-core/window/window.cpp index 99433d5..9dc247d 100644 --- a/source/modules/asura-core/window/window.cpp +++ b/source/modules/asura-core/window/window.cpp @@ -84,23 +84,23 @@ namespace AsuraEngine glClearColor(col.r, col.g, col.b, col.a); } - void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) - { - ASSERT(mImpl); + //void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) + //{ + // ASSERT(mImpl); - } + //} void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state) { ASSERT(mImpl); } - +/* void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state) { ASSERT(mImpl); } - +*/ } } diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h index 8ce0e64..61adae1 100644 --- a/source/modules/asura-core/window/window.h +++ b/source/modules/asura-core/window/window.h @@ -58,8 +58,7 @@ namespace AsuraEngine /// ᵼ࣬ӵ༭ⴰϡ /// class Window ASURA_FINAL - : public AEGraphics::RenderTarget - , public AEScripting::Portable<Window> + : public AEScripting::Portable<Window, AEGraphics::RenderTarget> , public Singleton<Window> { public: |