summaryrefslogtreecommitdiff
path: root/source/modules/asura-utils
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-04-02 21:45:33 +0800
committerchai <chaifix@163.com>2019-04-02 21:45:33 +0800
commitaf7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 (patch)
tree58611985001b78c5a76b78ae146fdb07dde31c1d /source/modules/asura-utils
parent250e30d73f09e9da2b5a81d0fbae63744ae12a73 (diff)
*misc
Diffstat (limited to 'source/modules/asura-utils')
-rw-r--r--source/modules/asura-utils/exceptions/exception.cpp9
-rw-r--r--source/modules/asura-utils/exceptions/exception.h14
-rw-r--r--source/modules/asura-utils/io/binding/_file.cpp2
-rw-r--r--source/modules/asura-utils/io/binding/_file_system.cpp4
-rw-r--r--source/modules/asura-utils/io/file.cpp8
-rw-r--r--source/modules/asura-utils/io/file.h12
-rw-r--r--source/modules/asura-utils/io/file_data.h2
-rw-r--r--source/modules/asura-utils/io/file_system.cpp8
-rw-r--r--source/modules/asura-utils/io/file_system.h10
-rw-r--r--source/modules/asura-utils/io/io_task.h2
-rw-r--r--source/modules/asura-utils/io/renewable.h8
-rw-r--r--source/modules/asura-utils/math/matrix44.cpp203
-rw-r--r--source/modules/asura-utils/math/matrix44.h152
-rw-r--r--source/modules/asura-utils/math/rect.hpp2
-rw-r--r--source/modules/asura-utils/type.h13
15 files changed, 385 insertions, 64 deletions
diff --git a/source/modules/asura-utils/exceptions/exception.cpp b/source/modules/asura-utils/exceptions/exception.cpp
index dbb36ca..5240c49 100644
--- a/source/modules/asura-utils/exceptions/exception.cpp
+++ b/source/modules/asura-utils/exceptions/exception.cpp
@@ -20,17 +20,10 @@ namespace AsuraEngine
size_out = vsnprintf(buffer, size_buffer, fmt, args);
va_end(args);
- // see http://perfec.to/vsnprintf/pasprintf.c
- // if size_out ...
- // == -1 --> output was truncated
- // == size_buffer --> output was truncated
- // == size_buffer-1 --> ambiguous, /may/ have been truncated
- // > size_buffer --> output was truncated, and size_out
- // bytes would have been written
if (size_out == size_buffer || size_out == -1 || size_out == size_buffer - 1)
size_buffer *= 2;
else if (size_out > size_buffer)
- size_buffer = size_out + 2; // to avoid the ambiguous case
+ size_buffer = size_out + 2;
else
break;
diff --git a/source/modules/asura-utils/exceptions/exception.h b/source/modules/asura-utils/exceptions/exception.h
index 57c9ed6..9873a38 100644
--- a/source/modules/asura-utils/exceptions/exception.h
+++ b/source/modules/asura-utils/exceptions/exception.h
@@ -7,27 +7,13 @@
namespace AsuraEngine
{
- /**
- * A convenient vararg-enabled exception class.
- **/
class Exception : public std::exception
{
public:
- /**
- * Creates a new Exception according to printf-rules.
- *
- * See: http://www.cplusplus.com/reference/clibrary/cstdio/printf/
- *
- * @param fmt The format string (see printf).
- **/
Exception(const char *fmt, ...);
virtual ~Exception() throw();
- /**
- * Returns a string containing reason for the exception.
- * @return A description of the exception.
- **/
inline virtual const char *what() const throw()
{
return message.c_str();
diff --git a/source/modules/asura-utils/io/binding/_file.cpp b/source/modules/asura-utils/io/binding/_file.cpp
index c44bc90..2de7882 100644
--- a/source/modules/asura-utils/io/binding/_file.cpp
+++ b/source/modules/asura-utils/io/binding/_file.cpp
@@ -186,7 +186,7 @@ namespace AsuraEngine
LUAX_PREPARE(L, File);
size_t size = 0;
- BufferMode mode = self->GetBuffer(ASURA_OUT size);
+ BufferMode mode = self->GetBuffer(asura_out size);
state.Push((int)size);
state.Push((int)mode);
return 2;
diff --git a/source/modules/asura-utils/io/binding/_file_system.cpp b/source/modules/asura-utils/io/binding/_file_system.cpp
index 3843451..2efc4f6 100644
--- a/source/modules/asura-utils/io/binding/_file_system.cpp
+++ b/source/modules/asura-utils/io/binding/_file_system.cpp
@@ -113,7 +113,7 @@ namespace AsuraEngine
cc8* path = state.CheckValue<cc8*>(1);
std::string mp;
- if (fs->GetMountPoint(path, ASURA_OUT mp))
+ if (fs->GetMountPoint(path, asura_out mp))
state.Push(mp);
else
state.PushNil();
@@ -246,7 +246,7 @@ namespace AsuraEngine
cc8* path = state.CheckValue<cc8*>(1);
std::vector<std::string> items;
- if(fs->GetDirectoryItems(path, ASURA_OUT items))
+ if(fs->GetDirectoryItems(path, asura_out items))
{
lua_newtable(L); // item list
for (int i = 0; i < items.size(); ++i)
diff --git a/source/modules/asura-utils/io/file.cpp b/source/modules/asura-utils/io/file.cpp
index 9e89c85..690f405 100644
--- a/source/modules/asura-utils/io/file.cpp
+++ b/source/modules/asura-utils/io/file.cpp
@@ -118,7 +118,7 @@ namespace AsuraEngine
return PHYSFS_fileLength(mFileHandle);
}
- size_t File::Read(ASURA_OUT DataBuffer* dst, size_t length)
+ size_t File::Read(asura_out DataBuffer* dst, size_t length)
{
ASSERT(dst);
@@ -140,7 +140,7 @@ namespace AsuraEngine
return size;
}
- size_t File::ReadAll(ASURA_OUT DataBuffer* dst)
+ size_t File::ReadAll(asura_out DataBuffer* dst)
{
ASSERT(dst);
@@ -192,7 +192,7 @@ namespace AsuraEngine
return mFileHandle != nullptr && PHYSFS_seek(mFileHandle, pos) != 0;
}
- bool File::Write(ASURA_REF DataBuffer* src)
+ bool File::Write(asura_ref DataBuffer* src)
{
if (!mFileHandle || (mMode != FILE_MODE_APPEND && mMode != FILE_MODE_WRITE))
throw Exception("File is not opened for writing.");
@@ -264,7 +264,7 @@ namespace AsuraEngine
return true;
}
- File::BufferMode File::GetBuffer(ASURA_OUT size_t& size)
+ File::BufferMode File::GetBuffer(asura_out size_t& size)
{
size = mBufferSize;
return mBufferMode;
diff --git a/source/modules/asura-utils/io/file.h b/source/modules/asura-utils/io/file.h
index 56077e0..9af8919 100644
--- a/source/modules/asura-utils/io/file.h
+++ b/source/modules/asura-utils/io/file.h
@@ -57,9 +57,9 @@ namespace AsuraEngine
///
/// ȡdata bufferض
///
- size_t Read(ASURA_OUT DataBuffer* dst, size_t length);
- size_t ReadAll(ASURA_OUT DataBuffer* dst);
- size_t ReadAsync(ASURA_OUT DataBuffer* dst);
+ size_t Read(asura_out DataBuffer* dst, size_t length);
+ size_t ReadAll(asura_out DataBuffer* dst);
+ size_t ReadAsync(asura_out DataBuffer* dst);
///
/// Ƿļβ
@@ -69,12 +69,12 @@ namespace AsuraEngine
///
/// data bufferед룬Ƿɹ
///
- bool Write(ASURA_REF DataBuffer* src);
+ bool Write(asura_ref DataBuffer* src);
///
/// 첽дļдļtaskthreadĶС
///
- bool WriteAsync(ASURA_REF DataBuffer* src, AEThreading::Thread* thread);
+ bool WriteAsync(asura_ref DataBuffer* src, AEThreading::Thread* thread);
///
/// ˻壬ǿջдļ
@@ -99,7 +99,7 @@ namespace AsuraEngine
///
/// ȡСģʽ
///
- BufferMode GetBuffer(ASURA_OUT size_t& size);
+ BufferMode GetBuffer(asura_out size_t& size);
const std::string& GetFileName();
const std::string& GetName();
diff --git a/source/modules/asura-utils/io/file_data.h b/source/modules/asura-utils/io/file_data.h
index cd69477..f5a6085 100644
--- a/source/modules/asura-utils/io/file_data.h
+++ b/source/modules/asura-utils/io/file_data.h
@@ -49,7 +49,7 @@ namespace AsuraEngine
///
/// Data bufferfiledataʱ٣luaüΪ0ʱluaGC١mDataʱһԱá
///
- ASURA_REF DataBuffer* mData;
+ asura_ref DataBuffer* mData;
Luax::LuaxMemberRef mDataRef;
std::string mFileName; ///< չļ
diff --git a/source/modules/asura-utils/io/file_system.cpp b/source/modules/asura-utils/io/file_system.cpp
index 20f3cb2..30e7861 100644
--- a/source/modules/asura-utils/io/file_system.cpp
+++ b/source/modules/asura-utils/io/file_system.cpp
@@ -83,7 +83,7 @@ namespace AsuraEngine
}
}
- bool Filesystem::GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint)
+ bool Filesystem::GetMountPoint(const std::string& locpath, asura_out std::string& mountpoint)
{
if (!mInited)
return false;
@@ -125,7 +125,7 @@ namespace AsuraEngine
return true;
}
- bool Filesystem::Write(const std::string& name, ASURA_REF DataBuffer* buffer)
+ bool Filesystem::Write(const std::string& name, asura_ref DataBuffer* buffer)
{
File file(name);
file.Open(File::FILE_MODE_WRITE);
@@ -133,7 +133,7 @@ namespace AsuraEngine
throw Exception("Data could not be written.");
}
- bool Filesystem::Append(const std::string& name, ASURA_REF DataBuffer* buffer)
+ bool Filesystem::Append(const std::string& name, asura_ref DataBuffer* buffer)
{
File file(name);
file.Open(File::FILE_MODE_APPEND);
@@ -170,7 +170,7 @@ namespace AsuraEngine
return true;
}
- bool Filesystem::GetFileInfo(const std::string& filepath, ASURA_OUT FileInfo* info)
+ bool Filesystem::GetFileInfo(const std::string& filepath, asura_out FileInfo* info)
{
if (!mInited)
return false;
diff --git a/source/modules/asura-utils/io/file_system.h b/source/modules/asura-utils/io/file_system.h
index 849cbb6..3a33504 100644
--- a/source/modules/asura-utils/io/file_system.h
+++ b/source/modules/asura-utils/io/file_system.h
@@ -59,20 +59,20 @@ namespace AsuraEngine
bool Unmount(const std::string& locpath);
bool Unmount(DataBuffer* db);
- bool GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint);
+ bool GetMountPoint(const std::string& locpath, asura_out std::string& mountpoint);
void SetWriteDirectory(const std::string locpath);
std::string GetWriteDirectory();
File* NewFile(const std::string& name);
bool NewDirectory(const std::string& path);
- bool Write(const std::string& path, ASURA_REF DataBuffer* buffer);
- bool Append(const std::string& path, ASURA_REF DataBuffer* buffer);
+ bool Write(const std::string& path, asura_ref DataBuffer* buffer);
+ bool Append(const std::string& path, asura_ref DataBuffer* buffer);
bool Remove(const std::string& path);
FileData* Read(const std::string& path);
- bool GetFileInfo(const std::string& path, ASURA_OUT FileInfo* info);
+ bool GetFileInfo(const std::string& path, asura_out FileInfo* info);
- bool GetDirectoryItems(const std::string& path, ASURA_OUT std::vector<std::string>& items) { return false; };
+ bool GetDirectoryItems(const std::string& path, asura_out std::vector<std::string>& items) { return false; };
private:
diff --git a/source/modules/asura-utils/io/io_task.h b/source/modules/asura-utils/io/io_task.h
index 8f04142..09c8798 100644
--- a/source/modules/asura-utils/io/io_task.h
+++ b/source/modules/asura-utils/io/io_task.h
@@ -46,7 +46,7 @@ namespace AsuraEngine
std::string mPath;
IOTaskType mType;
- ASURA_REF DataBuffer* mBuffer;
+ asura_ref DataBuffer* mBuffer;
Luax::LuaxMemberRef mBufferRef;
};
diff --git a/source/modules/asura-utils/io/renewable.h b/source/modules/asura-utils/io/renewable.h
index 282106d..a624c2c 100644
--- a/source/modules/asura-utils/io/renewable.h
+++ b/source/modules/asura-utils/io/renewable.h
@@ -21,12 +21,12 @@ namespace AsuraEngine
virtual ~Renewable() {};
///
- /// ̳RenewableҪṩһRefresh
+ /// ̳RenewableҪṩһRenew
///
- /// Effective C++09.Ӧýֹڹ캯еvirtualRefresh
- /// ӹ캯г룬ҪֶRefresh
+ /// Effective C++09.Ӧýֹڹ캯еvirtualRenew
+ /// ӹ캯г룬ҪֶRenew
///
- virtual bool Refresh(AEIO::DecodedData* decode_data) = 0;
+ virtual bool Renew(AEIO::DecodedData* decode_data) = 0;
};
diff --git a/source/modules/asura-utils/math/matrix44.cpp b/source/modules/asura-utils/math/matrix44.cpp
index e69de29..10c9ece 100644
--- a/source/modules/asura-utils/math/matrix44.cpp
+++ b/source/modules/asura-utils/math/matrix44.cpp
@@ -0,0 +1,203 @@
+#include "matrix44.h"
+
+#include <cstring> // memcpy
+#include <cmath>
+
+namespace AsuraEngine
+{
+ namespace Math
+ {
+
+ const Matrix44 Matrix44::Identity;
+
+ // | e0 e4 e8 e12 |
+ // | e1 e5 e9 e13 |
+ // | e2 e6 e10 e14 |
+ // | e3 e7 e11 e15 |
+
+ Matrix44::Matrix44()
+ {
+ SetIdentity();
+ }
+
+ Matrix44::Matrix44(const Matrix44& m)
+ {
+ memcpy(&e, &m.e, 16 * sizeof(float));
+ }
+
+ Matrix44::~Matrix44()
+ {
+ }
+
+ void Matrix44::operator = (const Matrix44& m)
+ {
+ memcpy(&e, &m.e, 16 * sizeof(float));
+ }
+
+ void Matrix44::SetOrtho(float l, float r, float b, float t, float n, float f)
+ {
+ SetIdentity();
+ float w = r - l;
+ float h = t - b;
+ float z = f - n;
+ e[0] = 2 / w;
+ e[5] = 2 / h;
+ e[10] = -2 / z;
+ e[12] = -(r + l) / w;
+ e[13] = -(t + b) / h;
+ e[14] = -(f + n) / z;
+ e[15] = 1;
+ }
+
+ // | e0 e4 e8 e12 |
+ // | e1 e5 e9 e13 |
+ // | e2 e6 e10 e14 |
+ // | e3 e7 e11 e15 |
+ // | e0 e4 e8 e12 |
+ // | e1 e5 e9 e13 |
+ // | e2 e6 e10 e14 |
+ // | e3 e7 e11 e15 |
+
+ Matrix44 Matrix44::operator * (const Matrix44 & m) const
+ {
+ Matrix44 t;
+
+ t.e[0] = (e[0] * m.e[0]) + (e[4] * m.e[1]) + (e[8] * m.e[2]) + (e[12] * m.e[3]);
+ t.e[4] = (e[0] * m.e[4]) + (e[4] * m.e[5]) + (e[8] * m.e[6]) + (e[12] * m.e[7]);
+ t.e[8] = (e[0] * m.e[8]) + (e[4] * m.e[9]) + (e[8] * m.e[10]) + (e[12] * m.e[11]);
+ t.e[12] = (e[0] * m.e[12]) + (e[4] * m.e[13]) + (e[8] * m.e[14]) + (e[12] * m.e[15]);
+
+ t.e[1] = (e[1] * m.e[0]) + (e[5] * m.e[1]) + (e[9] * m.e[2]) + (e[13] * m.e[3]);
+ t.e[5] = (e[1] * m.e[4]) + (e[5] * m.e[5]) + (e[9] * m.e[6]) + (e[13] * m.e[7]);
+ t.e[9] = (e[1] * m.e[8]) + (e[5] * m.e[9]) + (e[9] * m.e[10]) + (e[13] * m.e[11]);
+ t.e[13] = (e[1] * m.e[12]) + (e[5] * m.e[13]) + (e[9] * m.e[14]) + (e[13] * m.e[15]);
+
+ t.e[2] = (e[2] * m.e[0]) + (e[6] * m.e[1]) + (e[10] * m.e[2]) + (e[14] * m.e[3]);
+ t.e[6] = (e[2] * m.e[4]) + (e[6] * m.e[5]) + (e[10] * m.e[6]) + (e[14] * m.e[7]);
+ t.e[10] = (e[2] * m.e[8]) + (e[6] * m.e[9]) + (e[10] * m.e[10]) + (e[14] * m.e[11]);
+ t.e[14] = (e[2] * m.e[12]) + (e[6] * m.e[13]) + (e[10] * m.e[14]) + (e[14] * m.e[15]);
+
+ t.e[3] = (e[3] * m.e[0]) + (e[7] * m.e[1]) + (e[11] * m.e[2]) + (e[15] * m.e[3]);
+ t.e[7] = (e[3] * m.e[4]) + (e[7] * m.e[5]) + (e[11] * m.e[6]) + (e[15] * m.e[7]);
+ t.e[11] = (e[3] * m.e[8]) + (e[7] * m.e[9]) + (e[11] * m.e[10]) + (e[15] * m.e[11]);
+ t.e[15] = (e[3] * m.e[12]) + (e[7] * m.e[13]) + (e[11] * m.e[14]) + (e[15] * m.e[15]);
+
+ return t;
+ }
+
+ void Matrix44::operator *= (const Matrix44 & m)
+ {
+ Matrix44 t = (*this) * m;
+ memcpy((void*)this->e, (void*)t.e, sizeof(float) * 16);
+ }
+
+ const float * Matrix44::GetElements() const
+ {
+ return e;
+ }
+
+ void Matrix44::SetIdentity()
+ {
+ memset(e, 0, sizeof(float) * 16);
+ e[0] = e[5] = e[10] = e[15] = 1;
+ }
+
+ void Matrix44::SetTranslation(float x, float y)
+ {
+ SetIdentity();
+ e[12] = x;
+ e[13] = y;
+ }
+
+ void Matrix44::SetRotation(float rad)
+ {
+ SetIdentity();
+ float c = cos(rad), s = sin(rad);
+ e[0] = c; e[4] = -s;
+ e[1] = s; e[5] = c;
+ }
+
+ void Matrix44::SetScale(float sx, float sy)
+ {
+ SetIdentity();
+ e[0] = sx;
+ e[5] = sy;
+ }
+
+ void Matrix44::SetShear(float kx, float ky)
+ {
+ SetIdentity();
+ e[1] = ky;
+ e[4] = kx;
+ }
+
+ void Matrix44::SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy)
+ {
+ memset(e, 0, sizeof(float) * 16); // zero out matrix
+ float c = cos(angle), s = sin(angle);
+ // matrix multiplication carried out on paper:
+ // |1 x| |c -s | |sx | |1 -ox|
+ // | 1 y| |s c | | sy | | 1 -oy|
+ // | 1 | | 1 | | 1 | | 1 |
+ // | 1| | 1| | 1| | 1 |
+ // move rotate scale origin
+ e[10] = e[15] = 1.0f;
+ e[0] = c * sx; // = a
+ e[1] = s * sx; // = b
+ e[4] = -s * sy; // = c
+ e[5] = c * sy; // = d
+ e[12] = x - ox * e[0] - oy * e[4];
+ e[13] = y - ox * e[1] - oy * e[5];
+ }
+
+ void Matrix44::Translate(float x, float y)
+ {
+ Matrix44 t;
+ t.SetTranslation(x, y);
+ this->operator *=(t);
+ }
+
+ void Matrix44::Rotate(float rad)
+ {
+ Matrix44 t;
+ t.SetRotation(rad);
+ this->operator *=(t);
+ }
+
+ void Matrix44::Scale(float sx, float sy)
+ {
+ Matrix44 t;
+ t.SetScale(sx, sy);
+ this->operator *=(t);
+ }
+
+ void Matrix44::Shear(float kx, float ky)
+ {
+ Matrix44 t;
+ t.SetShear(kx, ky);
+ this->operator *=(t);
+ }
+
+ // | x |
+ // | y |
+ // | 0 |
+ // | 1 |
+ // | e0 e4 e8 e12 |
+ // | e1 e5 e9 e13 |
+ // | e2 e6 e10 e14 |
+ // | e3 e7 e11 e15 |
+
+ //void Matrix44::transform(Graphics::Vertex* dst, const Graphics::Vertex* src, int size) const
+ //{
+ // for (int i = 0; i<size; ++i)
+ // {
+ // // Store in temp variables in case src = dst
+ // float x = (e[0] * src[i].xy.x()) + (e[4] * src[i].xy.y()) + (0) + (e[12]);
+ // float y = (e[1] * src[i].xy.x()) + (e[5] * src[i].xy.y()) + (0) + (e[13]);
+
+ // dst[i].xy.Set(x, y);
+ // }
+ //}
+
+ } // namespace Math
+} // namespace JinEngine \ No newline at end of file
diff --git a/source/modules/asura-utils/math/matrix44.h b/source/modules/asura-utils/math/matrix44.h
index 4ab3c0b..c0cea92 100644
--- a/source/modules/asura-utils/math/matrix44.h
+++ b/source/modules/asura-utils/math/matrix44.h
@@ -1,24 +1,160 @@
-#ifndef __ASURA_ENGINE_MATRIX44_H__
-#define __ASURA_ENGINE_MATRIX44_H__
+#ifndef __ASURA_MATRIX_H__
+#define __ASURA_MATRIX_H__
namespace AsuraEngine
{
namespace Math
{
+ ///
+ /// ҪתõOpenGLglm::mat4
+ /// https://blog.csdn.net/candycat1992/article/details/8830894
///
- /// 4x4
- ///
+
class Matrix44
{
public:
+ static const Matrix44 Identity;
+
+ ///
+ /// Creates a new identity matrix.
+ ///
+ Matrix44();
+
+ ///
+ /// Copy constructor.
+ ///
+ Matrix44(const Matrix44& m);
+
+ ///
+ /// Destructor.
+ ///
+ ~Matrix44();
+
+ void operator = (const Matrix44& m);
+
+ void SetOrtho(float _left, float _right, float _bottom, float _top, float _near, float _far);
+
+ ///
+ /// Multiplies this Matrix44 with another Matrix44, changing neither.
+ /// @param m The Matrix44 to multiply with this Matrix44.
+ /// @return The combined matrix.
+ ///
+ Matrix44 operator * (const Matrix44 & m) const;
+
+ ///
+ /// Multiplies a Matrix44 into this Matrix44.
+ /// @param m The Matrix44 to combine into this Matrix44.
+ ///
+ void operator *= (const Matrix44 & m);
+
+ ///
+ /// Gets a pointer to the 16 array elements.
+ /// @return The array elements.
+ ///
+ const float* GetElements() const;
+
+ ///
+ /// ReSets this Matrix44 to the identity matrix.
+ ///
+ void SetIdentity();
+
+ ///
+ /// ReSets this Matrix44 to a translation.
+ /// @param x Translation along x-axis.
+ /// @param y Translation along y-axis.
+ ///
+ void SetTranslation(float x, float y);
+
+ ///
+ /// ReSets this Matrix44 to a rotation.
+ /// @param r The angle in radians.
+ ///
+ void SetRotation(float r);
+
+ ///
+ /// ReSets this Matrix44 to a scale transformation.
+ /// @param sx Scale factor along the x-axis.
+ /// @param sy Scale factor along the y-axis.
+ ///
+ void SetScale(float sx, float sy);
+
+ ///
+ /// ReSets this Matrix44 to a shear transformation.
+ /// @param kx Shear along x-axis.
+ /// @param ky Shear along y-axis.
+ ///
+ void SetShear(float kx, float ky);
+
+ ///
+ /// Creates a transformation with a certain position, orientation, scale
+ /// and offSet. Perfect for Drawables -- what a coincidence!
+ ///
+ /// @param x The translation along the x-axis.
+ /// @param y The translation along the y-axis.
+ /// @param angle The rotation (rad) around the center with offSet (ox,oy).
+ /// @param sx Scale along x-axis.
+ /// @param sy Scale along y-axis.
+ /// @param ox The offSet for rotation along the x-axis.
+ /// @param oy The offSet for rotation along the y-axis.
+ /// @param kx Shear along x-axis
+ /// @param ky Shear along y-axis
+ ///
+ void SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy);
+
+ ///
+ /// Multiplies this Matrix44 with a translation.
+ /// @param x Translation along x-axis.
+ /// @param y Translation along y-axis.
+ ///
+ void Translate(float x, float y);
+
+ ///
+ /// Multiplies this Matrix44 with a rotation.
+ /// @param r Angle in radians.
+ ///
+ void Rotate(float r);
+
+ ///
+ /// Multiplies this Matrix44 with a scale transformation.
+ /// @param sx Scale factor along the x-axis.
+ /// @param sy Scale factor along the y-axis.
+ ///
+ void Scale(float sx, float sy);
+
+ ///
+ /// Multiplies this Matrix44 with a shear transformation.
+ /// @param kx Shear along the x-axis.
+ /// @param ky Shear along the y-axis.
+ ///
+ void Shear(float kx, float ky);
+
+ /////
+ ///// Transforms an array of vertices by this Matrix44. The sources and
+ ///// destination arrays may be the same.
+ /////
+ ///// @param dst Storage for the transformed vertices.
+ ///// @param src The source vertices.
+ ///// @param size The number of vertices.
+ /////
+ //void transform(Graphics::Vertex* dst, const Graphics::Vertex * src, int size) const;
+
private:
-
+
+ ///
+ /// | e0 e4 e8 e12 |
+ /// | e1 e5 e9 e13 |
+ /// | e2 e6 e10 e14 |
+ /// | e3 e7 e11 e15 |
+ ///
+ float e[16];
};
- }
-}
+ }
+}
+
+namespace AEMath = AsuraEngine::Math;
-#endif \ No newline at end of file
+#endif \ No newline at end of file
diff --git a/source/modules/asura-utils/math/rect.hpp b/source/modules/asura-utils/math/rect.hpp
index 282b606..15981c2 100644
--- a/source/modules/asura-utils/math/rect.hpp
+++ b/source/modules/asura-utils/math/rect.hpp
@@ -12,7 +12,7 @@ namespace AsuraEngine
public:
Rect();
Rect(T x, T y, T w, T h);
- ~Rect();
+ ~Rect() {};
///
/// x,yǷrectڡ
diff --git a/source/modules/asura-utils/type.h b/source/modules/asura-utils/type.h
index bd09bc4..7f80bfa 100644
--- a/source/modules/asura-utils/type.h
+++ b/source/modules/asura-utils/type.h
@@ -67,11 +67,6 @@ namespace AsuraEngine
#endif
///
- /// ò
- ///
-#define ASURA_OUT
-#define ASURA_REF
- ///
/// ƶָȨ
///
#define ASURA_MOVE
@@ -82,6 +77,14 @@ namespace AsuraEngine
#define ASURA_LITTLE_ENDIAN 1
+ //--------------------------------------------------------------------------------//
+ // չؼ
+
+#define asura_throw(ex) throw(ex) // ʾ׳쳣
+
+#define asura_out
+#define asura_ref
+
} // namespace AsuraEngine
#endif // __ASURA_CONFIG_H__ \ No newline at end of file