Unify Tex2F to Vec2

This commit is contained in:
halx99 2021-10-24 22:44:44 +08:00
parent f88a490173
commit 67ce72db58
2 changed files with 13 additions and 51 deletions

View File

@ -30,7 +30,6 @@ THE SOFTWARE.
#include <string> #include <string>
#include "math/CCMath.h"
#include "math/CCMath.h" #include "math/CCMath.h"
#include "base/CCRef.h" #include "base/CCRef.h"
#include "renderer/backend/Types.h" #include "renderer/backend/Types.h"
@ -181,51 +180,11 @@ Color4F operator/(Color4F lhs, const Color4F& rhs);
Color4F& operator/=(Color4F& lhs, float rhs); Color4F& operator/=(Color4F& lhs, float rhs);
Color4F operator/(Color4F lhs, float rhs); Color4F operator/(Color4F lhs, float rhs);
/** A vertex composed of 2 floats: x, y
@since v3.0
*/
// struct Vertex2F
// {
// Vertex2F(float _x, float _y) :x(_x), y(_y) {}
// Vertex2F(): x(0.f), y(0.f) {}
// GLfloat x;
// GLfloat y;
// };
/** A vertex composed of 2 floats: x, y
@since v3.0
*/
// struct Vertex3F
// {
// Vertex3F(float _x, float _y, float _z)
// : x(_x)
// , y(_y)
// , z(_z)
// {}
// Vertex3F(): x(0.f), y(0.f), z(0.f) {}
// GLfloat x;
// GLfloat y;
// GLfloat z;
// };
/** @struct Tex2F /** @struct Tex2F
* A TEXCOORD composed of 2 floats: u, y * A TEXCOORD composed of 2 floats: u, v
* @since v3.0 * @since v3.0
*/ */
struct CC_DLL Tex2F { typedef Vec2 Tex2F;
Tex2F(float _u, float _v): u(_u), v(_v) {}
Tex2F() {}
float u = 0.f;
float v = 0.f;
};
/** @struct PointSprite /** @struct PointSprite
* Vec2 Sprite component. * Vec2 Sprite component.

View File

@ -57,24 +57,27 @@ public:
union union
{ {
float comps[2];
// The coord alias
struct struct
{ {
/**
* The x coordinate.
*/
float x; float x;
/**
* The y coordinate.
*/
float y; float y;
}; };
// The size alias
struct { struct {
float width; float width;
float height; float height;
}; };
// The tex coord alias
struct
{
float u;
float v;
};
}; };
/** /**
* Constructs a new vector initialized to all zeros. * Constructs a new vector initialized to all zeros.