diff --git a/core/2d/AnchoredSprite.cpp b/core/2d/AnchoredSprite.cpp index faa4eb8272c3..d71941b43935 100644 --- a/core/2d/AnchoredSprite.cpp +++ b/core/2d/AnchoredSprite.cpp @@ -147,7 +147,7 @@ AnchoredSprite* AnchoredSprite::create() return nullptr; } -void AnchoredSprite::setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad) +void AnchoredSprite::setVertexCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad) { float relativeOffsetX = _unflippedOffsetPositionFromCenter.x - getContentSize().x * _spriteVertexAnchor.x; float relativeOffsetY = _unflippedOffsetPositionFromCenter.y - getContentSize().y * _spriteVertexAnchor.y; diff --git a/core/2d/AnchoredSprite.h b/core/2d/AnchoredSprite.h index f749fe489942..72f7dfd255ae 100644 --- a/core/2d/AnchoredSprite.h +++ b/core/2d/AnchoredSprite.h @@ -143,7 +143,7 @@ class AX_DLL AnchoredSprite : public Sprite virtual Rect getTouchRect(); protected: - virtual void setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad) override; + virtual void setVertexCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad) override; Vec2 _spriteVertexAnchor = Vec2::ANCHOR_MIDDLE; }; diff --git a/core/2d/AutoPolygon.cpp b/core/2d/AutoPolygon.cpp index a77ae4a20ca3..e2020308da06 100644 --- a/core/2d/AutoPolygon.cpp +++ b/core/2d/AutoPolygon.cpp @@ -63,7 +63,7 @@ PolygonInfo::PolygonInfo(const PolygonInfo& other) : triangles(), _isVertsOwner( _filename = other._filename; _isVertsOwner = true; _rect = other._rect; - triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount]; + triangles.verts = new V3F_C4F_T2F[other.triangles.vertCount]; triangles.indices = new unsigned short[other.triangles.indexCount]; AXASSERT(triangles.verts && triangles.indices, "not enough memory"); triangles.vertCount = other.triangles.vertCount; @@ -80,7 +80,7 @@ PolygonInfo& PolygonInfo::operator=(const PolygonInfo& other) _filename = other._filename; _isVertsOwner = true; _rect = other._rect; - triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount]; + triangles.verts = new V3F_C4F_T2F[other.triangles.vertCount]; triangles.indices = new unsigned short[other.triangles.indexCount]; AXASSERT(triangles.verts && triangles.indices, "not enough memory"); triangles.vertCount = other.triangles.vertCount; @@ -97,17 +97,17 @@ PolygonInfo::~PolygonInfo() releaseVertsAndIndices(); } -void PolygonInfo::setQuad(V3F_C4B_T2F_Quad* quad) +void PolygonInfo::setQuad(V3F_C4F_T2F_Quad* quad) { releaseVertsAndIndices(); _isVertsOwner = false; triangles.indices = quadIndices9; triangles.vertCount = 4; triangles.indexCount = 6; - triangles.verts = (V3F_C4B_T2F*)quad; + triangles.verts = (V3F_C4F_T2F*)quad; } -void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads) +void PolygonInfo::setQuads(V3F_C4F_T2F_Quad* quad, int numberOfQuads) { AXASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads"); @@ -116,7 +116,7 @@ void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads) triangles.indices = quadIndices9; triangles.vertCount = 4 * numberOfQuads; triangles.indexCount = 6 * numberOfQuads; - triangles.verts = (V3F_C4B_T2F*)quad; + triangles.verts = (V3F_C4F_T2F*)quad; } void PolygonInfo::setTriangles(const TrianglesCommand::Triangles& other) @@ -159,7 +159,7 @@ unsigned int PolygonInfo::getTrianglesCount() const float PolygonInfo::getArea() const { float area = 0; - V3F_C4B_T2F* verts = triangles.verts; + V3F_C4F_T2F* verts = triangles.verts; unsigned short* indices = triangles.indices; for (unsigned int i = 0; i < triangles.indexCount; i += 3) { @@ -610,7 +610,7 @@ TrianglesCommand::Triangles AutoPolygon::triangulate(const std::vector& po std::vector tris = cdt.GetTriangles(); axstd::pod_vector indices(tris.size() * 3); - axstd::pod_vector verts; + axstd::pod_vector verts; verts.reserve(indices.size() / 2); // we won't know the size of verts until we process all of the triangles! unsigned short idx = 0; @@ -641,9 +641,9 @@ TrianglesCommand::Triangles AutoPolygon::triangulate(const std::vector& po else { // vert does not exist yet, so we need to create a new one, - auto c4b = Color4B::WHITE; + auto c = Color::WHITE; auto t2f = Tex2F(0, 0); // don't worry about tex coords now, we calculate that later - verts.push_back(V3F_C4B_T2F{v3, c4b, t2f}); + verts.push_back(V3F_C4F_T2F{v3, c, t2f}); indices[idx++] = vdx++;; } } @@ -656,7 +656,7 @@ TrianglesCommand::Triangles AutoPolygon::triangulate(const std::vector& po return triangles; } -void AutoPolygon::calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t count) +void AutoPolygon::calculateUV(const Rect& rect, V3F_C4F_T2F* verts, ssize_t count) { /* whole texture UV coordination diff --git a/core/2d/AutoPolygon.h b/core/2d/AutoPolygon.h index 0d53ea380d77..7f6470866153 100644 --- a/core/2d/AutoPolygon.h +++ b/core/2d/AutoPolygon.h @@ -80,17 +80,17 @@ class AX_DLL PolygonInfo * set the data to be a pointer to a quad * the member verts will not be released when this PolygonInfo destructs * as the verts memory are managed by other objects - * @param quad a pointer to the V3F_C4B_T2F_Quad object + * @param quad a pointer to the V3F_C4F_T2F_Quad object */ - void setQuad(V3F_C4B_T2F_Quad* quad); + void setQuad(V3F_C4F_T2F_Quad* quad); /** * set the data to be a pointer to a number of Quads * the member verts will not be released when this PolygonInfo destructs * as the verts memory are managed by other objects - * @param quad a pointer to the V3F_C4B_T2F_Quad quads + * @param quad a pointer to the V3F_C4F_T2F_Quad quads */ - void setQuads(V3F_C4B_T2F_Quad* quads, int numberOfQuads); + void setQuads(V3F_C4F_T2F_Quad* quads, int numberOfQuads); /** * set the data to be a pointer to a triangles @@ -225,7 +225,7 @@ class AX_DLL AutoPolygon * ap.calculateUV(rect, myPolygons.verts, 20); * @endcode */ - void calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t count); + void calculateUV(const Rect& rect, V3F_C4F_T2F* verts, ssize_t count); /** * a helper function, packing trace, reduce, expand, triangulate and calculate uv in one function diff --git a/core/2d/CameraBackgroundBrush.cpp b/core/2d/CameraBackgroundBrush.cpp index f69e652ed240..e37d359ef9fc 100644 --- a/core/2d/CameraBackgroundBrush.cpp +++ b/core/2d/CameraBackgroundBrush.cpp @@ -62,7 +62,7 @@ CameraBackgroundBrush* CameraBackgroundBrush::createNoneBrush() return ret; } -CameraBackgroundColorBrush* CameraBackgroundBrush::createColorBrush(const Color4F& color, float depth) +CameraBackgroundColorBrush* CameraBackgroundBrush::createColorBrush(const Color& color, float depth) { return CameraBackgroundColorBrush::create(color, depth); } @@ -138,7 +138,7 @@ bool CameraBackgroundDepthBrush::init() _vertices[2].vertices = Vec3(1, 1, 0); _vertices[3].vertices = Vec3(-1, 1, 0); - _vertices[0].colors = _vertices[1].colors = _vertices[2].colors = _vertices[3].colors = Color4B(0, 0, 0, 1); + _vertices[0].colors = _vertices[1].colors = _vertices[2].colors = _vertices[3].colors = Color(0, 0, 0, 1); _vertices[0].texCoords = Tex2F(0, 0); _vertices[1].texCoords = Tex2F(1, 0); @@ -231,16 +231,16 @@ void CameraBackgroundColorBrush::drawBackground(Camera* camera) CameraBackgroundDepthBrush::drawBackground(camera); } -void CameraBackgroundColorBrush::setColor(const Color4F& color) +void CameraBackgroundColorBrush::setColor(const Color& color) { for (auto&& vert : _vertices) { - vert.colors = Color4B(color); + vert.colors = color; } _customCommand.updateVertexBuffer(_vertices.data(), sizeof(_vertices[0]) * _vertices.size()); } -CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& color, float depth) +CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color& color, float depth) { auto ret = new CameraBackgroundColorBrush(); diff --git a/core/2d/CameraBackgroundBrush.h b/core/2d/CameraBackgroundBrush.h index 3e5c4bd462f5..35abe37c159e 100644 --- a/core/2d/CameraBackgroundBrush.h +++ b/core/2d/CameraBackgroundBrush.h @@ -95,7 +95,7 @@ class AX_DLL CameraBackgroundBrush : public Object * @param depth Depth used to clear depth buffer * @return Created brush */ - static CameraBackgroundColorBrush* createColorBrush(const Color4F& color, float depth); + static CameraBackgroundColorBrush* createColorBrush(const Color& color, float depth); /** Creates a Skybox brush with 6 textures. @param positive_x texture for the right side of the texture cube face. @@ -179,7 +179,7 @@ class AX_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush CustomCommand _customCommand; bool _clearColor; - std::vector _vertices; + std::vector _vertices; struct { uint32_t stencilWriteMask = 0; @@ -206,7 +206,7 @@ class AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush * @param depth Depth used to clear the depth buffer * @return Created brush */ - static CameraBackgroundColorBrush* create(const Color4F& color, float depth); + static CameraBackgroundColorBrush* create(const Color& color, float depth); /** * Draw background @@ -217,7 +217,7 @@ class AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush * Set clear color * @param color Color used to clear the color buffer */ - void setColor(const Color4F& color); + void setColor(const Color& color); CameraBackgroundColorBrush(); virtual ~CameraBackgroundColorBrush(); @@ -225,7 +225,7 @@ class AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush virtual bool init() override; protected: - Color4F _color; + Color _color; }; class TextureCube; diff --git a/core/2d/DrawNode.cpp b/core/2d/DrawNode.cpp index 8ba79e6f0688..57090aeffcbb 100644 --- a/core/2d/DrawNode.cpp +++ b/core/2d/DrawNode.cpp @@ -72,7 +72,7 @@ static bool isConvex(const Vec2* verts, int count) return true; // is convex } -static V2F_C4B_T2F* expandBufferAndGetPointer(axstd::pod_vector& buffer, size_t count) +static V2F_C4F_T2F* expandBufferAndGetPointer(axstd::pod_vector& buffer, size_t count) { size_t oldSize = buffer.size(); buffer.expand(count); @@ -235,7 +235,7 @@ void DrawNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags) } } -static void udpateCommand(CustomCommand& cmd, const axstd::pod_vector& buffer) +static void udpateCommand(CustomCommand& cmd, const axstd::pod_vector& buffer) { if (buffer.empty()) { @@ -243,8 +243,8 @@ static void udpateCommand(CustomCommand& cmd, const axstd::pod_vector triangleList; + std::vector triangleList; int vertex_count = 0; @@ -859,7 +859,7 @@ void DrawNode::_drawPolygon(const Vec2* verts, p2t::Point* vec2 = t->GetPoint(1); p2t::Point* vec3 = t->GetPoint(2); - V2F_C4B_T2F_Triangle triangle = { + V2F_C4F_T2F_Triangle triangle = { {Vec2(vec1->x, vec1->y), fillColor, Vec2::ZERO}, {Vec2(vec2->x, vec2->y), fillColor, Vec2::ZERO}, {Vec2(vec3->x, vec3->y), fillColor, Vec2::ZERO}, @@ -886,7 +886,7 @@ void DrawNode::_drawPolygon(const Vec2* verts, vertex_count *= 3; - auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); + auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); _trianglesDirty = true; // start drawing... @@ -1019,7 +1019,7 @@ void DrawNode::_drawPolygon(const Vec2* verts, void DrawNode::_drawPoly(const Vec2* verts, unsigned int count, bool closedPolygon, - const Color4B& color, + const Color& color, float thickness, bool isconvex) { @@ -1046,13 +1046,13 @@ void DrawNode::_drawPoly(const Vec2* verts, } else { - _drawPolygon(verts, count, Color4B::TRANSPARENT, color, closedPolygon, thickness, isconvex); + _drawPolygon(verts, count, Color::TRANSPARENT, color, closedPolygon, thickness, isconvex); } } void DrawNode::_drawSegment(const Vec2& from, const Vec2& to, - const Color4B& color, + const Color& color, float thickness, DrawNode::EndType etStart, DrawNode::EndType etEnd) @@ -1087,7 +1087,7 @@ void DrawNode::_drawSegment(const Vec2& from, unsigned int vertex_count = 3 * ((etStart != DrawNode::EndType::Butt) ? 2 : 0) + 3 * 2 + 3 * ((etEnd != DrawNode::EndType::Butt) ? 2 : 0); - auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); + auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); _trianglesDirty = true; int ii = 0; @@ -1180,16 +1180,16 @@ void DrawNode::_drawSegment(const Vec2& from, } } -void DrawNode::_drawDot(const Vec2& pos, float radius, const Color4B& color) +void DrawNode::_drawDot(const Vec2& pos, float radius, const Color& color) { unsigned int vertex_count = 2 * 3; - auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); + auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); _trianglesDirty = true; - V2F_C4B_T2F a = {Vec2(pos.x - radius, pos.y - radius), color, Vec2(-1.0f, -1.0f)}; - V2F_C4B_T2F b = {Vec2(pos.x - radius, pos.y + radius), color, Vec2(-1.0f, 1.0f)}; - V2F_C4B_T2F c = {Vec2(pos.x + radius, pos.y + radius), color, Vec2(1.0f, 1.0f)}; - V2F_C4B_T2F d = {Vec2(pos.x + radius, pos.y - radius), color, Vec2(1.0f, -1.0f)}; + V2F_C4F_T2F a = {Vec2(pos.x - radius, pos.y - radius), color, Vec2(-1.0f, -1.0f)}; + V2F_C4F_T2F b = {Vec2(pos.x - radius, pos.y + radius), color, Vec2(-1.0f, 1.0f)}; + V2F_C4F_T2F c = {Vec2(pos.x + radius, pos.y + radius), color, Vec2(1.0f, 1.0f)}; + V2F_C4F_T2F d = {Vec2(pos.x + radius, pos.y - radius), color, Vec2(1.0f, -1.0f)}; triangles[0] = {a, b, c}; triangles[1] = {a, c, d}; @@ -1202,8 +1202,8 @@ void DrawNode::_drawCircle(const Vec2& center, bool drawLineToCenter, float scaleX, float scaleY, - const Color4B& borderColor, - const Color4B& fillColor, + const Color& borderColor, + const Color& fillColor, bool solid, float thickness) { @@ -1234,8 +1234,8 @@ void DrawNode::_drawCircle(const Vec2& center, } void DrawNode::_drawTriangle(Vec2* vertices3, - const Color4B& borderColor, - const Color4B& fillColor, + const Color& borderColor, + const Color& fillColor, bool solid, float thickness) { @@ -1249,7 +1249,7 @@ void DrawNode::_drawTriangle(Vec2* vertices3, { applyTransform(vertices3, vertices3, vertex_count); - auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); + auto triangles = reinterpret_cast(expandBufferAndGetPointer(_triangles, vertex_count)); _trianglesDirty = true; triangles[0] = {{vertices3[0], fillColor, Vec2::ZERO}, @@ -1262,8 +1262,8 @@ void DrawNode::_drawAStar(const Vec2& center, float radiusI, // inner float radiusO, // outer unsigned int segments, - const Color4B& color, - const Color4B& filledColor, + const Color& color, + const Color& filledColor, float thickness, bool solid) { @@ -1294,7 +1294,7 @@ void DrawNode::_drawAStar(const Vec2& center, void DrawNode::_drawPoints(const Vec2* position, unsigned int numberOfPoints, const float pointSize, - const Color4B& color, + const Color& color, const DrawNode::PointType pointType) { if (properties.drawOrder == true) @@ -1307,7 +1307,7 @@ void DrawNode::_drawPoints(const Vec2* position, { case PointType::Circle: { - _drawCircle(position[i], pointSize4, 90, 32, false, 1.0f, 1.0f, Color4B(), color, true); + _drawCircle(position[i], pointSize4, 90, 32, false, 1.0f, 1.0f, Color(), color, true); break; } case PointType::Rect: @@ -1337,7 +1337,7 @@ void DrawNode::_drawPoints(const Vec2* position, void DrawNode::_drawPoint(const Vec2& position, const float pointSize, - const Color4B& color, + const Color& color, const DrawNode::PointType pointType) { if (properties.drawOrder == true) @@ -1349,7 +1349,7 @@ void DrawNode::_drawPoint(const Vec2& position, { case PointType::Circle: { - _drawCircle(position, pointSize4, 90, 32, false, 1.0f, 1.0f, Color4B(), color, true); + _drawCircle(position, pointSize4, 90, 32, false, 1.0f, 1.0f, Color(), color, true); break; } case PointType::Rect: @@ -1392,8 +1392,8 @@ void DrawNode::_drawPie(const Vec2& center, int endAngle, float scaleX, float scaleY, - const Color4B& fillColor, - const Color4B& borderColor, + const Color& fillColor, + const Color& borderColor, DrawMode drawMode, float thickness) { @@ -1412,11 +1412,11 @@ void DrawNode::_drawPie(const Vec2& center, _drawCircle(center, radius, 0.0f, 360, false, scaleX, scaleY, borderColor, fillColor, true, thickness); break; case DrawMode::Outline: - _drawCircle(center, radius, 0.0f, 360, false, scaleX, scaleY, borderColor, Color4B::TRANSPARENT, true, + _drawCircle(center, radius, 0.0f, 360, false, scaleX, scaleY, borderColor, Color::TRANSPARENT, true, thickness); break; case DrawMode::Line: - _drawCircle(center, radius, 0.0f, 360, false, scaleX, scaleY, borderColor, Color4B::TRANSPARENT, true, + _drawCircle(center, radius, 0.0f, 360, false, scaleX, scaleY, borderColor, Color::TRANSPARENT, true, thickness); break; case DrawMode::Semi: @@ -1466,10 +1466,10 @@ void DrawNode::_drawPie(const Vec2& center, case DrawMode::Outline: _vertices[n++] = center; _vertices[n++] = _vertices[0]; - _drawPolygon(_vertices.data(), n, Color4B::TRANSPARENT, borderColor, false, thickness, false); + _drawPolygon(_vertices.data(), n, Color::TRANSPARENT, borderColor, false, thickness, false); break; case DrawMode::Line: - _drawPolygon(_vertices.data(), n - 1, Color4B::TRANSPARENT, borderColor, false, thickness, false); + _drawPolygon(_vertices.data(), n - 1, Color::TRANSPARENT, borderColor, false, thickness, false); break; case DrawMode::Semi: _drawPolygon(_vertices.data(), n - 1, fillColor, borderColor, true, thickness, false); diff --git a/core/2d/DrawNode.h b/core/2d/DrawNode.h index e6710e3b0b35..0cf8942ae2df 100644 --- a/core/2d/DrawNode.h +++ b/core/2d/DrawNode.h @@ -101,7 +101,7 @@ class AX_DLL DrawNode : public Node */ void drawPoint(const Vec2& point, const float pointSize, - const Color4B& color, + const Color& color, DrawNode::PointType pointType = DrawNode::PointType::Rect); /** Draw a group point. @@ -113,7 +113,7 @@ class AX_DLL DrawNode : public Node */ void drawPoints(const Vec2* position, unsigned int numberOfPoints, - const Color4B& color, + const Color& color, DrawNode::PointType pointType = DrawNode::PointType::Rect); /** Draw a group point. @@ -127,7 +127,7 @@ class AX_DLL DrawNode : public Node void drawPoints(const Vec2* position, unsigned int numberOfPoints, const float pointSize, - const Color4B& color, + const Color& color, DrawNode::PointType pointType = DrawNode::PointType::Rect); /** Draw an line from origin to destination with color. @@ -139,7 +139,7 @@ class AX_DLL DrawNode : public Node */ void drawLine(const Vec2& origin, const Vec2& destination, - const Color4B& color, + const Color& color, float thickness = 1.0f, DrawNode::EndType etStart = DrawNode::EndType::Round, DrawNode::EndType etEnd = DrawNode::EndType::Round); @@ -151,7 +151,7 @@ class AX_DLL DrawNode : public Node * @param destination The rectangle destination. * @param color The rectangle color. */ - void drawRect(const Vec2& origin, const Vec2& destination, const Color4B& color, float thickness = 1.0f); + void drawRect(const Vec2& origin, const Vec2& destination, const Color& color, float thickness = 1.0f); /** Draws a polygon given a pointer to point coordinates and the number of vertices measured in points. * The polygon can be closed or open. @@ -164,7 +164,7 @@ class AX_DLL DrawNode : public Node void drawPoly(const Vec2* poli, unsigned int numberOfPoints, bool closedPolygon, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a circle given the center, radius and number of segments. @@ -186,7 +186,7 @@ class AX_DLL DrawNode : public Node bool drawLineToCenter, float scaleX, float scaleY, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a circle given the center, radius and number of segments. @@ -204,7 +204,7 @@ class AX_DLL DrawNode : public Node float angle, unsigned int segments, bool drawLineToCenter, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a star given the center, radiusI, radiusO and number of segments. @@ -220,7 +220,7 @@ class AX_DLL DrawNode : public Node float radiusI, float radiusO, unsigned int segments, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a solid star given the center, radiusI, radiusO and number of segments. @@ -236,8 +236,8 @@ class AX_DLL DrawNode : public Node float radiusI, float radiusO, unsigned int segments, - const Color4B& color, - const Color4B& filledColor, + const Color& color, + const Color& filledColor, float thickness = 1.0f); /** Draws a quad bezier path. @@ -252,7 +252,7 @@ class AX_DLL DrawNode : public Node const Vec2& control, const Vec2& destination, unsigned int segments, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draw a cubic bezier curve with color and number of segments @@ -269,7 +269,7 @@ class AX_DLL DrawNode : public Node const Vec2& control2, const Vec2& destination, unsigned int segments, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a Cardinal Spline path. @@ -282,7 +282,7 @@ class AX_DLL DrawNode : public Node void drawCardinalSpline(PointArray* config, float tension, unsigned int segments, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a Catmull Rom path. @@ -291,7 +291,7 @@ class AX_DLL DrawNode : public Node * @param segments The number of segments. * @param color The Catmull Rom color. */ - void drawCatmullRom(PointArray* points, unsigned int segments, const Color4B& color, float thickness = 1.0f); + void drawCatmullRom(PointArray* points, unsigned int segments, const Color& color, float thickness = 1.0f); /** draw a dot at a position, with a given radius and color. * @@ -299,7 +299,7 @@ class AX_DLL DrawNode : public Node * @param radius The dot radius. * @param color The dot color. */ - void drawDot(const Vec2& pos, float radius, const Color4B& color); + void drawDot(const Vec2& pos, float radius, const Color& color); /** Draws a rectangle with 4 points. * @@ -313,7 +313,7 @@ class AX_DLL DrawNode : public Node const Vec2& p2, const Vec2& p3, const Vec2& p4, - const Color4B& color, + const Color& color, float thickness = 1.0f); /** Draws a solid rectangle given the origin and destination point measured in points. @@ -326,9 +326,9 @@ class AX_DLL DrawNode : public Node */ void drawSolidRect(const Vec2& origin, const Vec2& destination, - const Color4B& color, + const Color& color, float thickness = 0, - const Color4B& borderColor = Color4B(0, 0, 0, 0)); + const Color& borderColor = Color(0, 0, 0, 0)); /** Draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a * color. @@ -340,9 +340,9 @@ class AX_DLL DrawNode : public Node */ void drawSolidPoly(const Vec2* poli, unsigned int numberOfPoints, - const Color4B& color, + const Color& color, float thickness = 0, - const Color4B& borderColor = Color4B(0, 0, 0, 0), + const Color& borderColor = Color(0, 0, 0, 0), bool isconvex = false); /** Draws a solid circle given the center, radius and number of segments. @@ -364,9 +364,9 @@ class AX_DLL DrawNode : public Node unsigned int segments, float scaleX, float scaleY, - const Color4B& fillColor, + const Color& fillColor, float thickness, - const Color4B& borderColor, + const Color& borderColor, bool drawLineToCenter = false); /** Draws a solid circle given the center, radius and number of segments. @@ -385,7 +385,7 @@ class AX_DLL DrawNode : public Node unsigned int segments, float scaleX, float scaleY, - const Color4B& color); + const Color& color); /** Draws a solid circle given the center, radius and number of segments. * @param center The circle center point. @@ -395,7 +395,7 @@ class AX_DLL DrawNode : public Node * @param color The solid circle color. * @js NA */ - void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, const Color4B& color); + void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, const Color& color); /** Draws a pie given the center, radius, angle, start angle, end angle and number of segments. * @param center The circle center point. @@ -417,8 +417,8 @@ class AX_DLL DrawNode : public Node int endAngle, float scaleX, float scaleY, - const Color4B& fillColor, - const Color4B& borderColor, + const Color& fillColor, + const Color& borderColor, DrawMode drawMode = DrawMode::Outline, float thickness = 1.0f); @@ -442,7 +442,7 @@ class AX_DLL DrawNode : public Node int endAngle, float scaleX, float scaleY, - const Color4B& color, + const Color& color, DrawMode drawMode = DrawMode::Outline); void setIsConvex(bool isConvex) @@ -461,7 +461,7 @@ class AX_DLL DrawNode : public Node void drawSegment(const Vec2& from, const Vec2& to, float radius, - const Color4B& color, + const Color& color, DrawNode::EndType etStart = DrawNode::EndType::Round, DrawNode::EndType etEnd = DrawNode::EndType::Round); @@ -480,18 +480,18 @@ class AX_DLL DrawNode : public Node */ void drawPolygon(Vec2* verts, int count, - const Color4B& fillColor, + const Color& fillColor, float thickness, - const Color4B& borderColor, + const Color& borderColor, bool isconvex = false); - void drawPolygon(Vec2* verts, int count, float thickness, const Color4B& borderColor, bool isconvex = false); + void drawPolygon(Vec2* verts, int count, float thickness, const Color& borderColor, bool isconvex = false); void drawSolidPolygon(Vec2* verts, int count, - const Color4B& fillColor, + const Color& fillColor, float thickness, - const Color4B& borderColor, + const Color& borderColor, bool isconvex = false); /** draw a triangle with color. @@ -503,20 +503,20 @@ class AX_DLL DrawNode : public Node * @js NA */ - void drawTriangle(const Vec2* vertices3, const Color4B& color); + void drawTriangle(const Vec2* vertices3, const Color& color); - void drawTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, const Color4B& color); + void drawTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, const Color& color); void drawSolidTriangle(const Vec2* vertices3, - const Color4B& fillColor, - const Color4B& borderColor, + const Color& fillColor, + const Color& borderColor, float thickness = 1.0f); void drawSolidTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, - const Color4B& fillColor, - const Color4B& borderColor, + const Color& fillColor, + const Color& borderColor, float thickness = 1.0f); /** Clear the geometry in the node's buffer. */ @@ -577,33 +577,33 @@ class AX_DLL DrawNode : public Node CustomCommand _customCommandPoint; CustomCommand _customCommandLine; - axstd::pod_vector _triangles; - axstd::pod_vector _points; - axstd::pod_vector _lines; + axstd::pod_vector _triangles; + axstd::pod_vector _points; + axstd::pod_vector _lines; private: // Internal function _drawPoint void _drawPoint(const Vec2& position, const float pointSize, - const Color4B& color, + const Color& color, const DrawNode::PointType pointType); // Internal function _drawPoints void _drawPoints(const Vec2* position, unsigned int numberOfPoints, const float pointSize, - const Color4B& color, + const Color& color, const DrawNode::PointType pointType); // Internal function _drawDot - void _drawDot(const Vec2& pos, float radius, const Color4B& color); + void _drawDot(const Vec2& pos, float radius, const Color& color); // Internal function _drawTriangle // Note: modifies supplied vertex array void _drawTriangle(Vec2* vertices3, - const Color4B& borderColor, - const Color4B& fillColor, + const Color& borderColor, + const Color& fillColor, bool solid = true, float thickness = 0.0f); @@ -612,8 +612,8 @@ class AX_DLL DrawNode : public Node float radiusI, float radiusO, unsigned int segments, - const Color4B& color, - const Color4B& filledColor, + const Color& color, + const Color& filledColor, float thickness = 1.0f, bool solid = false); @@ -621,15 +621,15 @@ class AX_DLL DrawNode : public Node void _drawPoly(const Vec2* poli, unsigned int numberOfPoints, bool closedPolygon, - const Color4B& color, + const Color& color, float thickness = 1.0f, bool isconvex = true); // Internal function _drawPolygon void _drawPolygon(const Vec2* verts, unsigned int count, - const Color4B& fillColor, - const Color4B& borderColor, + const Color& fillColor, + const Color& borderColor, bool closedPolygon = true, float thickness = 1.0f, bool isconvex = true); @@ -637,7 +637,7 @@ class AX_DLL DrawNode : public Node // Internal function _drawSegment void _drawSegment(const Vec2& origin, const Vec2& destination, - const Color4B& color, + const Color& color, float thickness = 1.0f, DrawNode::EndType etStart = DrawNode::EndType::Square, DrawNode::EndType etEnd = DrawNode::EndType::Square); @@ -650,8 +650,8 @@ class AX_DLL DrawNode : public Node bool drawLineToCenter, float scaleX, float scaleY, - const Color4B& borderColor, - const Color4B& fillColor, + const Color& borderColor, + const Color& fillColor, bool solid, float thickness = 1.0f); @@ -663,8 +663,8 @@ class AX_DLL DrawNode : public Node int endAngle, float scaleX, float scaleY, - const Color4B& fillColor, - const Color4B& borderColor, + const Color& fillColor, + const Color& borderColor, DrawMode drawMode, float thickness = 1.0f); diff --git a/core/2d/FastTMXLayer.cpp b/core/2d/FastTMXLayer.cpp index 676d34247106..66cb70936fba 100644 --- a/core/2d/FastTMXLayer.cpp +++ b/core/2d/FastTMXLayer.cpp @@ -275,7 +275,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect) void FastTMXLayer::updateVertexBuffer() { - unsigned int vertexBufferSize = (unsigned int)(sizeof(V3F_C4B_T2F) * _totalQuads.size() * 4); + unsigned int vertexBufferSize = (unsigned int)(sizeof(V3F_C4F_T2F) * _totalQuads.size() * 4); if (!_vertexBuffer) { _vertexBuffer = backend::DriverBase::getInstance()->newBuffer(vertexBufferSize, backend::BufferType::VERTEX, backend::BufferUsage::STATIC); @@ -503,7 +503,7 @@ void FastTMXLayer::updateTotalQuads() _tileToQuadIndex.resize(int(_layerSize.width * _layerSize.height), -1); _indicesVertexZOffsets.clear(); - auto color = Color4B::WHITE; + auto color = Color::WHITE; color.a = getDisplayedOpacity(); if (_texture->hasPremultipliedAlpha()) diff --git a/core/2d/FastTMXLayer.h b/core/2d/FastTMXLayer.h index 6b4a7cd861c6..2cf22e8bbdef 100644 --- a/core/2d/FastTMXLayer.h +++ b/core/2d/FastTMXLayer.h @@ -371,7 +371,7 @@ class AX_DLL FastTMXLayer : public Node float _cameraZoomDirty; std::vector _tileToQuadIndex; - std::vector _totalQuads; + std::vector _totalQuads; #ifdef AX_FAST_TILEMAP_32_BIT_INDICES std::vector _indices; #else diff --git a/core/2d/Grid.h b/core/2d/Grid.h index 3b17f7e18e55..a1a49882f3ef 100644 --- a/core/2d/Grid.h +++ b/core/2d/Grid.h @@ -152,7 +152,7 @@ class AX_DLL GridBase : public Object Director::Projection _directorProjection = Director::Projection::_2D; Rect _gridRect; - Color4F _clearColor = {0, 0, 0, 0}; + Color _clearColor = {0, 0, 0, 0}; CustomCommand _drawCommand; //CallbackCommand _beforeDrawCommand; diff --git a/core/2d/Label.cpp b/core/2d/Label.cpp index 6d28e11d302f..238b9f1e03e4 100644 --- a/core/2d/Label.cpp +++ b/core/2d/Label.cpp @@ -165,18 +165,18 @@ class LabelLetter : public Sprite { displayedOpacity = 0.0f; } - Color4B color4(_displayedColor.r, _displayedColor.g, _displayedColor.b, displayedOpacity); + Color color(_displayedColor, displayedOpacity); // special opacity for premultiplied textures if (_opacityModifyRGB) { - color4.r *= displayedOpacity / 255.0f; - color4.g *= displayedOpacity / 255.0f; - color4.b *= displayedOpacity / 255.0f; + color.r *= displayedOpacity / 255.0f; + color.g *= displayedOpacity / 255.0f; + color.b *= displayedOpacity / 255.0f; } - _quad.bl.colors = color4; - _quad.br.colors = color4; - _quad.tl.colors = color4; - _quad.tr.colors = color4; + _quad.bl.colors = color; + _quad.br.colors = color; + _quad.tl.colors = color; + _quad.tr.colors = color; _textureAtlas->updateQuad(_quad, _atlasIndex); } @@ -619,9 +619,9 @@ void Label::reset() _hAlignment = TextHAlignment::LEFT; _vAlignment = TextVAlignment::TOP; - _effectColorF = Color4F::BLACK; + _effectColorF = Color::BLACK; _textColor = Color4B::WHITE; - _textColorF = Color4F::WHITE; + _textColorF = Color::WHITE; setColor(Color3B::WHITE); _shadowDirty = false; @@ -1714,7 +1714,7 @@ void Label::updateContent() // Github issue #15214. Uses _displayedColor instead of _textColor for the underline. // This is to have the same behavior of SystemFonts. _underlineNode->drawLine(Vec2(_linesOffsetX[i], y), Vec2(_linesWidth[i] + _linesOffsetX[i], y), - Color4F(_displayedColor), charheight / 6); + Color(_displayedColor), charheight / 6); } } else if (_textSprite) @@ -1729,7 +1729,7 @@ void Label::updateContent() y += spriteSize.height / 2; // FIXME: Might not work with different vertical alignments _underlineNode->drawLine(Vec2(0.0f, y), Vec2(spriteSize.width, y), - Color4F(_textSprite->getDisplayedColor()), spriteSize.height / 6); + Color(_textSprite->getDisplayedColor()), spriteSize.height / 6); } } @@ -1775,7 +1775,7 @@ void Label::updateBuffer(TextureAtlas* textureAtlas, CustomCommand& customComman { if (textureAtlas->getTotalQuads() > customCommand.getVertexCapacity()) { - customCommand.createVertexBuffer((unsigned int)sizeof(V3F_C4B_T2F_Quad), + customCommand.createVertexBuffer((unsigned int)sizeof(V3F_C4F_T2F_Quad), (unsigned int)textureAtlas->getTotalQuads(), CustomCommand::BufferUsage::DYNAMIC); customCommand.createIndexBuffer(CustomCommand::IndexFormat::U_SHORT, @@ -1783,7 +1783,7 @@ void Label::updateBuffer(TextureAtlas* textureAtlas, CustomCommand& customComman CustomCommand::BufferUsage::DYNAMIC); } customCommand.updateVertexBuffer(textureAtlas->getQuads(), - (unsigned int)(textureAtlas->getTotalQuads() * sizeof(V3F_C4B_T2F_Quad))); + (unsigned int)(textureAtlas->getTotalQuads() * sizeof(V3F_C4F_T2F_Quad))); customCommand.updateIndexBuffer(textureAtlas->getIndices(), (unsigned int)(textureAtlas->getTotalQuads() * 6 * sizeof(unsigned short))); customCommand.setIndexDrawInfo(0, (unsigned int)(textureAtlas->getTotalQuads() * 6)); @@ -1899,7 +1899,7 @@ void Label::updateEffectUniforms(BatchCommand& batch, _displayedOpacity = _shadowColor4F.a * (oldOPacity / 255.0f) * 255; setColor(Color3B(_shadowColor4F)); batch.shadowCommand.updateVertexBuffer( - textureAtlas->getQuads(), (unsigned int)(textureAtlas->getTotalQuads() * sizeof(V3F_C4B_T2F_Quad))); + textureAtlas->getQuads(), (unsigned int)(textureAtlas->getTotalQuads() * sizeof(V3F_C4F_T2F_Quad))); batch.shadowCommand.init(_globalZOrder); renderer->addCommand(&batch.shadowCommand); @@ -2382,18 +2382,18 @@ void Label::updateColor() return; } - Color4B color4(_displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity); + Color color(_displayedColor, _displayedOpacity / 255.0f); // special opacity for premultiplied textures if (_isOpacityModifyRGB) { - color4.r *= _displayedOpacity / 255.0f; - color4.g *= _displayedOpacity / 255.0f; - color4.b *= _displayedOpacity / 255.0f; + color.r *= _displayedOpacity / 255.0f; + color.g *= _displayedOpacity / 255.0f; + color.b *= _displayedOpacity / 255.0f; } ax::TextureAtlas* textureAtlas; - V3F_C4B_T2F_Quad* quads; + V3F_C4F_T2F_Quad* quads; for (auto&& batchNode : _batchNodes) { textureAtlas = batchNode->getTextureAtlas(); @@ -2402,10 +2402,10 @@ void Label::updateColor() for (int index = 0; index < count; ++index) { - quads[index].bl.colors = color4; - quads[index].br.colors = color4; - quads[index].tl.colors = color4; - quads[index].tr.colors = color4; + quads[index].bl.colors = color; + quads[index].br.colors = color; + quads[index].tl.colors = color; + quads[index].tr.colors = color; textureAtlas->updateQuad(quads[index], index); } } diff --git a/core/2d/Label.h b/core/2d/Label.h index 046714bc003e..212aa698091b 100644 --- a/core/2d/Label.h +++ b/core/2d/Label.h @@ -474,7 +474,7 @@ class AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol /** * Return the shadow effect color value. */ - Color4F getShadowColor() const { return _shadowColor4F; } + Color getShadowColor() const { return _shadowColor4F; } /** * Return the outline effect size value. @@ -489,7 +489,7 @@ class AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol /** * Return current effect color value. */ - Color4F getEffectColor() const { return _effectColorF; } + Color getEffectColor() const { return _effectColorF; } /** Sets the Label's text horizontal alignment.*/ void setAlignment(TextHAlignment hAlignment) { setAlignment(hAlignment, _vAlignment); } @@ -874,9 +874,9 @@ class AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol Rect _bmRect; Rect _reusedRect; - Color4F _effectColorF; - Color4F _textColorF; - Color4F _shadowColor4F; + Color _effectColorF; + Color _textColorF; + Color _shadowColor4F; Mat4 _shadowTransform; std::u32string _utf32Text; diff --git a/core/2d/LabelAtlas.cpp b/core/2d/LabelAtlas.cpp index a045c23947f0..045721a00d45 100644 --- a/core/2d/LabelAtlas.cpp +++ b/core/2d/LabelAtlas.cpp @@ -161,7 +161,7 @@ void LabelAtlas::updateAtlasValues() } AXASSERT(n <= _textureAtlas->getCapacity(), "updateAtlasValues: Invalid String length"); - V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads(); + V3F_C4F_T2F_Quad* quads = _textureAtlas->getQuads(); for (ssize_t i = 0; i < n; i++) { @@ -203,7 +203,7 @@ void LabelAtlas::updateAtlasValues() quads[i].tr.vertices.x = (float)(i * _itemWidth + _itemWidth); quads[i].tr.vertices.y = (float)(_itemHeight); quads[i].tr.vertices.z = 0.0f; - Color4B c(_displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity); + Color c(_displayedColor, _displayedOpacity / 255.0f); quads[i].tl.colors = c; quads[i].tr.colors = c; quads[i].bl.colors = c; @@ -248,21 +248,21 @@ void LabelAtlas::updateColor() { if (_textureAtlas) { - Color4B color4(_displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity); + Color color(_displayedColor, _displayedOpacity / 255.0f); if (_isOpacityModifyRGB) { - color4.r *= _displayedOpacity / 255.0f; - color4.g *= _displayedOpacity / 255.0f; - color4.b *= _displayedOpacity / 255.0f; + color.r *= color.a; + color.g *= color.a; + color.b *= color.a; } auto quads = _textureAtlas->getQuads(); ssize_t length = _string.length(); for (int index = 0; index < length; index++) { - quads[index].bl.colors = color4; - quads[index].br.colors = color4; - quads[index].tl.colors = color4; - quads[index].tr.colors = color4; + quads[index].bl.colors = color; + quads[index].br.colors = color; + quads[index].tl.colors = color; + quads[index].tr.colors = color; _textureAtlas->updateQuad(quads[index], index); } } diff --git a/core/2d/Layer.cpp b/core/2d/Layer.cpp index 87da0ec1607f..a7ba06e80bc5 100644 --- a/core/2d/Layer.cpp +++ b/core/2d/Layer.cpp @@ -232,10 +232,10 @@ void LayerGradient::updateColor() float opacityf = (float)_displayedOpacity / 255.0f; - Color4F S(_displayedColor.r / 255.0f, _displayedColor.g / 255.0f, _displayedColor.b / 255.0f, + Color S(_displayedColor, _startOpacity * opacityf / 255.0f); - Color4F E(_endColor.r / 255.0f, _endColor.g / 255.0f, _endColor.b / 255.0f, _endOpacity * opacityf / 255.0f); + Color E(_endColor, _endOpacity * opacityf / 255.0f); // (-1, -1) _quad.bl.colors.r = (E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c))) * 255; @@ -558,7 +558,7 @@ const BlendFunc& LayerRadialGradient::getBlendFunc() const return _blendFunc; } -void LayerRadialGradient::convertColor4B24F(Color4F& outColor, const Color4B& inColor) +void LayerRadialGradient::convertColor4B24F(Color& outColor, const Color4B& inColor) { outColor.r = inColor.r / 255.0f; outColor.g = inColor.g / 255.0f; diff --git a/core/2d/Layer.h b/core/2d/Layer.h index 735d0288eac5..00c0b516f3d5 100644 --- a/core/2d/Layer.h +++ b/core/2d/Layer.h @@ -320,13 +320,13 @@ class AX_DLL LayerRadialGradient : public Node, BlendProtocol float expand); private: - void convertColor4B24F(Color4F& outColor, const Color4B& inColor); + void convertColor4B24F(Color& outColor, const Color4B& inColor); Color4B _startColor = Color4B::BLACK; - Color4F _startColorRend = Color4F::BLACK; // start color used in shader + Color _startColorRend = Color::BLACK; // start color used in shader Color4B _endColor = Color4B::BLACK; - Color4F _endColorRend = Color4F::BLACK; // end color used in shader + Color _endColorRend = Color::BLACK; // end color used in shader Vec2 _vertices[4]; Vec2 _center; diff --git a/core/2d/ParticleBatchNode.cpp b/core/2d/ParticleBatchNode.cpp index f5afe8eaa0bc..010b38d48f96 100644 --- a/core/2d/ParticleBatchNode.cpp +++ b/core/2d/ParticleBatchNode.cpp @@ -474,7 +474,7 @@ void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity) // sets a 0'd quad into the quads array void ParticleBatchNode::disableParticle(int particleIndex) { - V3F_C4B_T2F_Quad* quad = &((_textureAtlas->getQuads())[particleIndex]); + V3F_C4F_T2F_Quad* quad = &((_textureAtlas->getQuads())[particleIndex]); quad->br.vertices.x = quad->br.vertices.y = quad->tr.vertices.x = quad->tr.vertices.y = quad->tl.vertices.x = quad->tl.vertices.y = quad->bl.vertices.x = quad->bl.vertices.y = 0.0f; } diff --git a/core/2d/ParticleSystem.h b/core/2d/ParticleSystem.h index e10941a7a1e1..6834583c18bd 100644 --- a/core/2d/ParticleSystem.h +++ b/core/2d/ParticleSystem.h @@ -818,45 +818,45 @@ class AX_DLL ParticleSystem : public Node, public TextureProtocol, public Playab * * @return The start color of each particle. */ - const Color4F& getStartColor() const { return _startColor; } + const Color& getStartColor() const { return _startColor; } /** Sets the start color of each particle. * * @param color The start color of each particle. */ - void setStartColor(const Color4F& color) { _startColor = color; } + void setStartColor(const Color& color) { _startColor = color; } /** Gets the start color variance of each particle. * * @return The start color variance of each particle. */ - const Color4F& getStartColorVar() const { return _startColorVar; } + const Color& getStartColorVar() const { return _startColorVar; } /** Sets the start color variance of each particle. * * @param color The start color variance of each particle. */ - void setStartColorVar(const Color4F& color) { _startColorVar = color; } + void setStartColorVar(const Color& color) { _startColorVar = color; } /** Gets the end color and end color variation of each particle. * * @return The end color and end color variation of each particle. */ - const Color4F& getEndColor() const { return _endColor; } + const Color& getEndColor() const { return _endColor; } /** Sets the end color and end color variation of each particle. * * @param color The end color and end color variation of each particle. */ - void setEndColor(const Color4F& color) { _endColor = color; } + void setEndColor(const Color& color) { _endColor = color; } /** Gets the end color variance of each particle. * * @return The end color variance of each particle. */ - const Color4F& getEndColorVar() const { return _endColorVar; } + const Color& getEndColorVar() const { return _endColorVar; } /** Sets the end color variance of each particle. * * @param color The end color variance of each particle. */ - void setEndColorVar(const Color4F& color) { _endColorVar = color; } + void setEndColorVar(const Color& color) { _endColorVar = color; } /** Sets wether to use HSV color system. * WARNING: becareful when using HSV with too many particles because it's expensive. @@ -1588,13 +1588,13 @@ class AX_DLL ParticleSystem : public Node, public TextureProtocol, public Playab /** end size variance in pixels of each particle */ float _endSizeVar; /** start color of each particle */ - Color4F _startColor; + Color _startColor; /** start color variance of each particle */ - Color4F _startColorVar; + Color _startColorVar; /** end color and end color variation of each particle */ - Color4F _endColor; + Color _endColor; /** end color variance of each particle */ - Color4F _endColorVar; + Color _endColorVar; /** hsv color of each particle */ HSV _hsv; /** hsv color variance of each particle */ diff --git a/core/2d/ParticleSystemQuad.cpp b/core/2d/ParticleSystemQuad.cpp index 10f1e0cc7973..f1870c6e371b 100644 --- a/core/2d/ParticleSystemQuad.cpp +++ b/core/2d/ParticleSystemQuad.cpp @@ -176,7 +176,7 @@ void ParticleSystemQuad::initTexCoordsWithRect(const Rect& pointRect) // Important. Texture in cocos2d are inverted, so the Y component should be inverted std::swap(top, bottom); - V3F_C4B_T2F_Quad* quads = nullptr; + V3F_C4F_T2F_Quad* quads = nullptr; unsigned int start = 0, end = 0; if (_batchNode) { @@ -260,7 +260,7 @@ void ParticleSystemQuad::initIndices() } } -inline void updatePosWithParticle(V3F_C4B_T2F_Quad* quad, +inline void updatePosWithParticle(V3F_C4F_T2F_Quad* quad, const Vec2& newPosition, float size, float scaleInSize, @@ -323,11 +323,11 @@ void ParticleSystemQuad::updateParticleQuads() currentPosition = _position; } - V3F_C4B_T2F_Quad* startQuad; + V3F_C4F_T2F_Quad* startQuad; Vec2 pos = Vec2::ZERO; if (_batchNode) { - V3F_C4B_T2F_Quad* batchQuads = _batchNode->getTextureAtlas()->getQuads(); + V3F_C4F_T2F_Quad* batchQuads = _batchNode->getTextureAtlas()->getQuads(); startQuad = &(batchQuads[_atlasIndex]); pos = _position; } @@ -352,7 +352,7 @@ void ParticleSystemQuad::updateParticleQuads() float* sr = _particleData.staticRotation; float* sid = _particleData.scaleInDelta; float* sil = _particleData.scaleInLength; - V3F_C4B_T2F_Quad* quadStart = startQuad; + V3F_C4F_T2F_Quad* quadStart = startQuad; if (_isScaleInAllocated) { for (int i = 0; i < _particleCount; @@ -393,7 +393,7 @@ void ParticleSystemQuad::updateParticleQuads() float* sr = _particleData.staticRotation; float* sid = _particleData.scaleInDelta; float* sil = _particleData.scaleInLength; - V3F_C4B_T2F_Quad* quadStart = startQuad; + V3F_C4F_T2F_Quad* quadStart = startQuad; if (_isScaleInAllocated) { for (int i = 0; i < _particleCount; @@ -430,7 +430,7 @@ void ParticleSystemQuad::updateParticleQuads() float* sr = _particleData.staticRotation; float* sid = _particleData.scaleInDelta; float* sil = _particleData.scaleInLength; - V3F_C4B_T2F_Quad* quadStart = startQuad; + V3F_C4F_T2F_Quad* quadStart = startQuad; if (_isScaleInAllocated) { for (int i = 0; i < _particleCount; @@ -450,7 +450,7 @@ void ParticleSystemQuad::updateParticleQuads() } } - V3F_C4B_T2F_Quad* quad = startQuad; + V3F_C4F_T2F_Quad* quad = startQuad; float* r = _particleData.colorR; float* g = _particleData.colorG; float* b = _particleData.colorB; @@ -478,7 +478,7 @@ void ParticleSystemQuad::updateParticleQuads() hsv.h += *hue; hsv.s = abs(*sat); hsv.v = abs(*val); - auto colF = hsv.toColor4F(); + auto colF = hsv.toRgba(); quad->bl.colors.set(colF.r * colF.a * 255.0F, colF.g * colF.a * 255.0F, colF.b * colF.a * 255.0F, colF.a * 255.0F); quad->br.colors.set(colF.r * colF.a * 255.0F, colF.g * colF.a * 255.0F, colF.b * colF.a * 255.0F, @@ -558,7 +558,7 @@ void ParticleSystemQuad::updateParticleQuads() hsv.h += *hue; hsv.s = abs(*sat); hsv.v = abs(*val); - auto colF = hsv.toColor4F(); + auto colF = hsv.toRgba(); quad->bl.colors.set(colF.r * colF.a * 255.0F, colF.g * colF.a * 255.0F, colF.b * colF.a * 255.0F, colF.a * 255.0F); quad->br.colors.set(colF.r * colF.a * 255.0F, colF.g * colF.a * 255.0F, colF.b * colF.a * 255.0F, @@ -628,7 +628,7 @@ void ParticleSystemQuad::updateParticleQuads() // It was proved to be effective especially for low-end devices. if ((_isLifeAnimated || _isEmitterAnimated || _isLoopAnimated) && _isAnimAllocated) { - V3F_C4B_T2F_Quad* quad = startQuad; + V3F_C4F_T2F_Quad* quad = startQuad; unsigned short* cellIndex = _particleData.animCellIndex; ParticleFrameDescriptor index; @@ -700,7 +700,7 @@ void ParticleSystemQuad::setTotalParticles(int tp) AXLOGW("Particle system: not enough memory"); return; } - V3F_C4B_T2F_Quad* quadsNew = (V3F_C4B_T2F_Quad*)realloc(_quads, quadsSize); + V3F_C4F_T2F_Quad* quadsNew = (V3F_C4F_T2F_Quad*)realloc(_quads, quadsSize); unsigned short* indicesNew = (unsigned short*)realloc(_indices, indicesSize); if (quadsNew && indicesNew) @@ -780,7 +780,7 @@ bool ParticleSystemQuad::allocMemory() AX_SAFE_FREE(_quads); AX_SAFE_FREE(_indices); - _quads = (V3F_C4B_T2F_Quad*)malloc(_totalParticles * sizeof(V3F_C4B_T2F_Quad)); + _quads = (V3F_C4F_T2F_Quad*)malloc(_totalParticles * sizeof(V3F_C4F_T2F_Quad)); _indices = (unsigned short*)malloc(_totalParticles * 6 * sizeof(unsigned short)); if (!_quads || !_indices) @@ -792,7 +792,7 @@ bool ParticleSystemQuad::allocMemory() return false; } - memset(_quads, 0, _totalParticles * sizeof(V3F_C4B_T2F_Quad)); + memset(_quads, 0, _totalParticles * sizeof(V3F_C4F_T2F_Quad)); memset(_indices, 0, _totalParticles * 6 * sizeof(unsigned short)); return true; @@ -818,8 +818,8 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode* batchNode) else if (!oldBatch) { // copy current state to batch - V3F_C4B_T2F_Quad* batchQuads = _batchNode->getTextureAtlas()->getQuads(); - V3F_C4B_T2F_Quad* quad = &(batchQuads[_atlasIndex]); + V3F_C4F_T2F_Quad* batchQuads = _batchNode->getTextureAtlas()->getQuads(); + V3F_C4F_T2F_Quad* quad = &(batchQuads[_atlasIndex]); memcpy(quad, _quads, _totalParticles * sizeof(_quads[0])); AX_SAFE_FREE(_quads); diff --git a/core/2d/ParticleSystemQuad.h b/core/2d/ParticleSystemQuad.h index a62c24252308..c41809c4d47f 100644 --- a/core/2d/ParticleSystemQuad.h +++ b/core/2d/ParticleSystemQuad.h @@ -169,7 +169,7 @@ class AX_DLL ParticleSystemQuad : public ParticleSystem bool allocMemory(); - V3F_C4B_T2F_Quad* _quads = nullptr; // quads to be rendered + V3F_C4F_T2F_Quad* _quads = nullptr; // quads to be rendered unsigned short* _indices = nullptr; // indices QuadCommand _quadCommand; // quad command diff --git a/core/2d/ProgressTimer.cpp b/core/2d/ProgressTimer.cpp index a4d9df0810e7..cc4fa33a9a58 100644 --- a/core/2d/ProgressTimer.cpp +++ b/core/2d/ProgressTimer.cpp @@ -57,17 +57,17 @@ backend::ProgramState* initPipelineDescriptor(ax::CustomCommand& command, AX_SAFE_RELEASE(pipelieDescriptor.programState); pipelieDescriptor.programState = programState; - // set custom vertexLayout according to V2F_C4B_T2F structure + // set custom vertexLayout according to V2F_C4F_T2F structure auto vertexLayout = programState->getMutableVertexLayout(); vertexLayout->setAttrib("a_position", program->getAttributeLocation(backend::Attribute::POSITION), backend::VertexFormat::FLOAT2, 0, false); vertexLayout->setAttrib("a_texCoord", program->getAttributeLocation(backend::Attribute::TEXCOORD), backend::VertexFormat::FLOAT2, - offsetof(V2F_C4B_T2F, texCoords), false); + offsetof(V2F_C4F_T2F, texCoords), false); vertexLayout->setAttrib("a_color", program->getAttributeLocation(backend::Attribute::COLOR), - backend::VertexFormat::UBYTE4, - offsetof(V2F_C4B_T2F, colors), true); - vertexLayout->setStride(sizeof(V2F_C4B_T2F)); + backend::VertexFormat::FLOAT4, + offsetof(V2F_C4F_T2F, colors), false); + vertexLayout->setStride(sizeof(V2F_C4F_T2F)); if (ridal) { @@ -202,7 +202,7 @@ Tex2F ProgressTimer::textureCoordFromAlphaPoint(Vec2 alpha) { return ret; } - V3F_C4B_T2F_Quad quad = _sprite->getQuad(); + V3F_C4F_T2F_Quad quad = _sprite->getQuad(); Vec2 min(quad.bl.texCoords.u, quad.bl.texCoords.v); Vec2 max(quad.tr.texCoords.u, quad.tr.texCoords.v); // Fix bug #1303 so that progress timer handles sprite frame texture rotation @@ -220,7 +220,7 @@ Vec2 ProgressTimer::vertexFromAlphaPoint(Vec2 alpha) { return ret; } - V3F_C4B_T2F_Quad quad = _sprite->getQuad(); + V3F_C4F_T2F_Quad quad = _sprite->getQuad(); Vec2 min(quad.bl.vertices.x, quad.bl.vertices.y); Vec2 max(quad.tr.vertices.x, quad.tr.vertices.y); ret.x = min.x * (1.f - alpha.x) + max.x * alpha.x; @@ -263,7 +263,7 @@ void ProgressTimer::updateColor() sc.a = sc.a * _sprite->getOpacity() / 255.0f; for (auto& d : _vertexData) { - d.colors = sc; + d.colors = ax::Color{sc}; } } } diff --git a/core/2d/ProgressTimer.h b/core/2d/ProgressTimer.h index 1a40e53a0939..4fdebfaa69b9 100644 --- a/core/2d/ProgressTimer.h +++ b/core/2d/ProgressTimer.h @@ -31,7 +31,7 @@ THE SOFTWARE. #include "2d/Node.h" #include "renderer/PipelineDescriptor.h" -#include +#include "base/axstd.h" namespace ax { @@ -187,8 +187,8 @@ class AX_DLL ProgressTimer : public Node Vec2 _barChangeRate; float _percentage = 0.0f; Sprite* _sprite = nullptr; - std::vector _vertexData; - std::vector _indexData; + axstd::pod_vector _vertexData; + axstd::pod_vector _indexData; bool _reverseDirection = false; CustomCommand _customCommand; diff --git a/core/2d/RenderTexture.cpp b/core/2d/RenderTexture.cpp index 05066f951aac..bc79d205bfba 100644 --- a/core/2d/RenderTexture.cpp +++ b/core/2d/RenderTexture.cpp @@ -318,7 +318,7 @@ void RenderTexture::beginWithClear(float r, int stencilValue, ClearFlag flags) { - setClearColor(Color4F(r, g, b, a)); + setClearColor(Color(r, g, b, a)); setClearDepth(depthValue); setClearStencil(stencilValue); setClearFlags(flags); @@ -704,7 +704,7 @@ void RenderTexture::clearColorAttachment() }; renderer->addCommand(beforeClearAttachmentCommand); - Color4F color(0.f, 0.f, 0.f, 0.f); + Color color(0.f, 0.f, 0.f, 0.f); renderer->clear(ClearFlag::COLOR, color, 1, 0, _globalZOrder); // auto renderer = _director->getRenderer(); diff --git a/core/2d/RenderTexture.h b/core/2d/RenderTexture.h index bdec00a49991..aa8ef93c3855 100644 --- a/core/2d/RenderTexture.h +++ b/core/2d/RenderTexture.h @@ -261,13 +261,13 @@ class AX_DLL RenderTexture : public Node * * @return Color value. */ - inline const Color4F& getClearColor() const { return _clearColor; } + inline const Color& getClearColor() const { return _clearColor; } /** Set color value. * * @param clearColor Color value. */ - inline void setClearColor(const Color4F& clearColor) { _clearColor = clearColor; } + inline void setClearColor(const Color& clearColor) { _clearColor = clearColor; } /** Value for clearDepth. Valid only when "autoDraw" is true. * @@ -407,7 +407,7 @@ class AX_DLL RenderTexture : public Node RefPtr _UITextureImage = nullptr; backend::PixelFormat _pixelFormat = backend::PixelFormat::RGBA8; - Color4F _clearColor; + Color _clearColor; float _clearDepth = 1.f; int _clearStencil = 0; bool _autoDraw = false; diff --git a/core/2d/Sprite.cpp b/core/2d/Sprite.cpp index 62b67e9d78b5..7f98952a2300 100644 --- a/core/2d/Sprite.cpp +++ b/core/2d/Sprite.cpp @@ -296,10 +296,10 @@ bool Sprite::initWithTexture(Texture2D* texture, const Rect& rect, bool rotated) memset(&_quad, 0, sizeof(_quad)); // Atlas: Color - _quad.bl.colors = Color4B::WHITE; - _quad.br.colors = Color4B::WHITE; - _quad.tl.colors = Color4B::WHITE; - _quad.tr.colors = Color4B::WHITE; + _quad.bl.colors = Color::WHITE; + _quad.br.colors = Color::WHITE; + _quad.tl.colors = Color::WHITE; + _quad.tr.colors = Color::WHITE; // update texture (calls updateBlendFunc) setTexture(texture); @@ -683,7 +683,7 @@ void Sprite::updatePoly() }; // needed in order to get color from "_quad" - V3F_C4B_T2F_Quad tmpQuad = _quad; + V3F_C4F_T2F_Quad tmpQuad = _quad; for (int i = 0; i < 9; ++i) { @@ -736,7 +736,7 @@ void Sprite::setCenterRectNormalized(const ax::Rect& rectTopLeft) { _renderMode = RenderMode::SLICE9; // 9 quads + 7 exterior points = 16 - _trianglesVertex = (V3F_C4B_T2F*)malloc(sizeof(*_trianglesVertex) * (9 + 3 + 4)); + _trianglesVertex = (V3F_C4F_T2F*)malloc(sizeof(*_trianglesVertex) * (9 + 3 + 4)); // 9 quads, each needs 6 vertices = 54 _trianglesIndex = (unsigned short*)malloc(sizeof(*_trianglesIndex) * 6 * 9); @@ -808,7 +808,7 @@ void Sprite::setTextureCoords(const Rect& rectInPoints) setTextureCoords(rectInPoints, &_quad); } -void Sprite::setTextureCoords(const Rect& rectInPoints, V3F_C4B_T2F_Quad* outQuad) +void Sprite::setTextureCoords(const Rect& rectInPoints, V3F_C4F_T2F_Quad* outQuad) { Texture2D* tex = (_renderMode == RenderMode::QUAD_BATCHNODE) ? _textureAtlas->getTexture() : _texture; @@ -878,7 +878,7 @@ void Sprite::setTextureCoords(const Rect& rectInPoints, V3F_C4B_T2F_Quad* outQua } } -void Sprite::setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad) +void Sprite::setVertexCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad) { float relativeOffsetX = _unflippedOffsetPositionFromCenter.x; float relativeOffsetY = _unflippedOffsetPositionFromCenter.y; @@ -924,7 +924,7 @@ void Sprite::setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad) } } -void Sprite::populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad) +void Sprite::populateTriangle(int quadIndex, const V3F_C4F_T2F_Quad& quad) { AXASSERT(quadIndex < 9, "Invalid quadIndex"); // convert Quad intro Triangle since it takes less memory @@ -1499,23 +1499,23 @@ void Sprite::flipY() void Sprite::updateColor() { - Color4B color4(_displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity); + Color color(_displayedColor, _displayedOpacity / 255.0f); // special opacity for premultiplied textures if (_opacityModifyRGB) { - color4.r *= _displayedOpacity / 255.0f; - color4.g *= _displayedOpacity / 255.0f; - color4.b *= _displayedOpacity / 255.0f; + color.r *= color.a; + color.g *= color.a; + color.b *= color.a; } for (unsigned int i = 0; i < _polyInfo.triangles.vertCount; i++) - _polyInfo.triangles.verts[i].colors = color4; + _polyInfo.triangles.verts[i].colors = color; // related to issue #17116 // when switching from Quad to Slice9, the color will be obtained from _quad // so it is important to update _quad colors as well. - _quad.bl.colors = _quad.tl.colors = _quad.br.colors = _quad.tr.colors = color4; + _quad.bl.colors = _quad.tl.colors = _quad.br.colors = _quad.tr.colors = color; // renders using batch node if (_renderMode == RenderMode::QUAD_BATCHNODE) diff --git a/core/2d/Sprite.h b/core/2d/Sprite.h index 453cc01a2410..bee0bf2a9d84 100644 --- a/core/2d/Sprite.h +++ b/core/2d/Sprite.h @@ -402,7 +402,7 @@ class AX_DLL Sprite : public Node, public TextureProtocol * @js NA * @lua NA */ - const V3F_C4B_T2F_Quad& getQuad() const { return _quad; } + const V3F_C4F_T2F_Quad& getQuad() const { return _quad; } /** * Returns whether or not the texture rectangle is rotated. @@ -660,8 +660,8 @@ class AX_DLL Sprite : public Node, public TextureProtocol protected: virtual void updateColor() override; virtual void setTextureCoords(const Rect& rect); - virtual void setTextureCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad); - virtual void setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad); + virtual void setTextureCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad); + virtual void setVertexCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad); virtual void updateBlendFunc(); virtual void setReorderChildDirtyRecursively(); virtual void setDirtyRecursively(bool value); @@ -670,7 +670,7 @@ class AX_DLL Sprite : public Node, public TextureProtocol void updatePoly(); void updateStretchFactor(); - void populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad); + void populateTriangle(int quadIndex, const V3F_C4F_T2F_Quad& quad); void setMVPMatrixUniform(); // // Data used when the sprite is rendered using a SpriteSheet @@ -715,8 +715,8 @@ class AX_DLL Sprite : public Node, public TextureProtocol Vec2 _unflippedOffsetPositionFromCenter; // vertex coords, texture coords and color info - V3F_C4B_T2F_Quad _quad; - V3F_C4B_T2F* _trianglesVertex = nullptr; + V3F_C4F_T2F_Quad _quad; + V3F_C4F_T2F* _trianglesVertex = nullptr; unsigned short* _trianglesIndex = nullptr; PolygonInfo _polyInfo; diff --git a/core/2d/SpriteBatchNode.cpp b/core/2d/SpriteBatchNode.cpp index a05657e83466..f3fcbe214f12 100644 --- a/core/2d/SpriteBatchNode.cpp +++ b/core/2d/SpriteBatchNode.cpp @@ -397,7 +397,7 @@ void SpriteBatchNode::swap(ssize_t oldIndex, ssize_t newIndex) oldIndex >= 0 && oldIndex < (int)_descendants.size() && newIndex >= 0 && newIndex < (int)_descendants.size(), "Invalid index"); - V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads(); + V3F_C4F_T2F_Quad* quads = _textureAtlas->getQuads(); std::swap(quads[oldIndex], quads[newIndex]); // update the index of other swapped item diff --git a/core/2d/SpriteSheetLoader.cpp b/core/2d/SpriteSheetLoader.cpp index a1bbba484333..72fa3392e321 100644 --- a/core/2d/SpriteSheetLoader.cpp +++ b/core/2d/SpriteSheetLoader.cpp @@ -19,10 +19,10 @@ void SpriteSheetLoader::initializePolygonInfo(const Vec2& textureSize, const auto scaleFactor = AX_CONTENT_SCALE_FACTOR(); - auto* vertexData = new V3F_C4B_T2F[vertexCount]; + auto* vertexData = new V3F_C4F_T2F[vertexCount]; for (size_t i = 0; i < vertexCount / 2; i++) { - vertexData[i].colors = Color4B::WHITE; + vertexData[i].colors = Color::WHITE; vertexData[i].vertices = Vec3(vertices[i * 2] / scaleFactor, (spriteSize.height - vertices[i * 2 + 1]) / scaleFactor, 0); vertexData[i].texCoords = diff --git a/core/2d/TileMapAtlas.cpp b/core/2d/TileMapAtlas.cpp index d4b9ce6abbaf..976612e6e144 100644 --- a/core/2d/TileMapAtlas.cpp +++ b/core/2d/TileMapAtlas.cpp @@ -163,7 +163,7 @@ void TileMapAtlas::updateAtlasValueAt(const Vec2& pos, const Color3B& value, int { AXASSERT(index >= 0 && index < _textureAtlas->getCapacity(), "updateAtlasValueAt: Invalid index"); - V3F_C4B_T2F_Quad* quad = &((_textureAtlas->getQuads())[index]); + V3F_C4F_T2F_Quad* quad = &((_textureAtlas->getQuads())[index]); int x = pos.x; int y = pos.y; @@ -210,7 +210,7 @@ void TileMapAtlas::updateAtlasValueAt(const Vec2& pos, const Color3B& value, int quad->tr.vertices.y = (float)(y * _itemHeight + _itemHeight); quad->tr.vertices.z = 0.0f; - Color4B color(_displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity); + Color color(_displayedColor, _displayedOpacity / 255.0f); quad->tr.colors = color; quad->tl.colors = color; quad->br.colors = color; @@ -243,7 +243,7 @@ void TileMapAtlas::updateAtlasValues() { this->updateAtlasValueAt(Vec2(x, y), value, total); - std::string key = StringUtils::toString(x) + "," + StringUtils::toString(y); + std::string key = fmt::format("{},{}", x, y); _posToAtlasIndex[key] = total; total++; diff --git a/core/3d/MeshRenderer.cpp b/core/3d/MeshRenderer.cpp index badafaf50c4e..b102947769bf 100644 --- a/core/3d/MeshRenderer.cpp +++ b/core/3d/MeshRenderer.cpp @@ -869,7 +869,7 @@ void MeshRenderer::draw(Renderer* renderer, const Mat4& transform, uint32_t flag if (_skeleton) _skeleton->updateBoneMatrix(); - Color4F color(getDisplayedColor()); + Color color(getDisplayedColor()); color.a = getDisplayedOpacity() / 255.0f; // check light and determine the shader used diff --git a/core/3d/Skybox.cpp b/core/3d/Skybox.cpp index bc155b41c7d4..03558c846ec1 100644 --- a/core/3d/Skybox.cpp +++ b/core/3d/Skybox.cpp @@ -149,7 +149,7 @@ void Skybox::draw(Renderer* renderer, const Mat4& transform, uint32_t flags) // prescale the matrix to account for the camera fov cameraModelMat.scale(1 / projectionMat.m[0], 1 / projectionMat.m[5], 1.0); - Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f); + Color color(_displayedColor, 1.f); _programState->setUniform(_uniformColorLoc, &color, sizeof(color)); _programState->setUniform(_uniformCameraRotLoc, cameraModelMat.m, sizeof(cameraModelMat.m)); diff --git a/core/base/Director.cpp b/core/base/Director.cpp index c57d172fbca3..dea038f9285e 100644 --- a/core/base/Director.cpp +++ b/core/base/Director.cpp @@ -690,7 +690,7 @@ float Director::getZEye() const return (_winSizeInPoints.height / 1.154700538379252f); //(2 * tanf(M_PI/6)) } -void Director::setClearColor(const Color4F& clearColor) +void Director::setClearColor(const Color& clearColor) { _clearColor = clearColor; } diff --git a/core/base/Director.h b/core/base/Director.h index b5d017bfb4c9..b1797c1d1965 100644 --- a/core/base/Director.h +++ b/core/base/Director.h @@ -379,7 +379,7 @@ class AX_DLL Director * value range of each element is [0.0, 1.0]. * @js NA */ - void setClearColor(const Color4F& clearColor); + void setClearColor(const Color& clearColor); void mainLoop(); /** Invoke main loop with delta time. Then `calculateDeltaTime` can just use the delta time directly. @@ -662,7 +662,7 @@ class AX_DLL Director /* Renderer for the Director */ Renderer* _renderer = nullptr; - Color4F _clearColor = {0, 0, 0, 1}; + Color _clearColor = {0, 0, 0, 1}; #ifdef AX_ENABLE_CONSOLE /* Console for the director */ Console* _console = nullptr; diff --git a/core/base/StencilStateManager.cpp b/core/base/StencilStateManager.cpp index 542663725aa7..9fe19c451031 100644 --- a/core/base/StencilStateManager.cpp +++ b/core/base/StencilStateManager.cpp @@ -52,7 +52,7 @@ StencilStateManager::StencilStateManager() _customCommand.createIndexBuffer(CustomCommand::IndexFormat::U_SHORT, 6, CustomCommand::BufferUsage::STATIC); _customCommand.updateIndexBuffer(indices, sizeof(indices)); - Color4F color(1, 1, 1, 1); + Color color(1, 1, 1, 1); pipelineDescriptor.programState->setUniform(_colorUniformLocation, &color, sizeof(color)); } diff --git a/core/base/Types.h b/core/base/Types.h index 6f9b88607cbe..a9ad6e060261 100644 --- a/core/base/Types.h +++ b/core/base/Types.h @@ -50,20 +50,10 @@ namespace ax */ typedef Vec2 Tex2F; -/** @struct PointSprite - * Vec2 Sprite component. - */ -struct AX_DLL PointSprite -{ - Vec2 pos; // 8 bytes - Color4B color; // 4 bytes - float size = 0.f; // 4 bytes -}; - /** @struct Quad2 * A 2D Quad. 4 * 2 floats. */ -struct AX_DLL Quad2 +struct Quad2 { Vec2 tl; Vec2 tr; @@ -74,7 +64,7 @@ struct AX_DLL Quad2 /** @struct Quad3 * A 3D Quad. 4 * 3 floats. */ -struct AX_DLL Quad3 +struct Quad3 { Vec3 bl; Vec3 br; @@ -82,55 +72,29 @@ struct AX_DLL Quad3 Vec3 tr; }; -/** @struct V2F_C4B_T2F - * A Vec2 with a vertex point, a tex coord point and a color 4B. - */ -struct V2F_C4B_T2F -{ - /// vertices (2F) - Vec2 vertices; - /// colors (4B) - Color4B colors; - /// tex coords (2F) - Tex2F texCoords; -}; - -/** @struct V2F_C4B_PF - * - */ -struct V2F_C4B_PF -{ - /// vertices (2F) - Vec2 vertices; - /// colors (4B) - Color4B colors; - /// pointsize - float pointSize = 0.f; -}; - /** @struct V2F_C4F_T2F * A Vec2 with a vertex point, a tex coord point and a color 4F. */ -struct AX_DLL V2F_C4F_T2F +struct V2F_C4F_T2F { /// vertices (2F) Vec2 vertices; /// colors (4F) - Color4F colors; + Color colors; /// tex coords (2F) Tex2F texCoords; }; -/** @struct V3F_C4B_T2F +/** @struct V3F_C4F_T2F aka PosColorTex * A Vec2 with a vertex point, a tex coord point and a color 4B. */ -struct AX_DLL V3F_C4B_T2F +struct V3F_C4F_T2F { /// vertices (3F) Vec3 vertices; // 12 bytes /// colors (4B) - Color4B colors; // 4 bytes + Color colors; // 4 bytes // tex coords (2F) Tex2F texCoords; // 8 bytes @@ -139,7 +103,7 @@ struct AX_DLL V3F_C4B_T2F /** @struct V3F_T2F * A Vec2 with a vertex point, a tex coord point. */ -struct AX_DLL V3F_T2F +struct V3F_T2F { /// vertices (2F) Vec3 vertices; @@ -150,18 +114,12 @@ struct AX_DLL V3F_T2F /** @struct V3F_C4F * A Vec3 with a vertex point, a color. */ -struct AX_DLL V3F_C4F +struct V3F_C4F { /// vertices (3F) Vec3 vertices; /// vertices (4F) - Color4F colors; -}; - -struct V3F_C4B -{ - Vec3 vertices; - Color4B colors; + Color colors; }; struct V3F_T2F_C4F @@ -178,50 +136,32 @@ struct V3F_T2F_N3F Vec3 normal; }; -/** @struct V2F_C4B_T2F_Triangle - * A Triangle of V2F_C4B_T2F. - */ -struct AX_DLL V2F_C4B_T2F_Triangle +struct V2F_C4F_T2F_Triangle { - V2F_C4B_T2F a; - V2F_C4B_T2F b; - V2F_C4B_T2F c; -}; - -/** @struct V2F_C4B_T2F_Quad - * A Quad of V2F_C4B_T2F. - */ -struct AX_DLL V2F_C4B_T2F_Quad -{ - /// bottom left - V2F_C4B_T2F bl; - /// bottom right - V2F_C4B_T2F br; - /// top left - V2F_C4B_T2F tl; - /// top right - V2F_C4B_T2F tr; + V2F_C4F_T2F a; + V2F_C4F_T2F b; + V2F_C4F_T2F c; }; -/** @struct V3F_C4B_T2F_Quad +/** @struct V3F_C4F_T2F_Quad * 4 Vertex3FTex2FColor4B. */ -struct AX_DLL V3F_C4B_T2F_Quad +struct V3F_C4F_T2F_Quad { /// top left - V3F_C4B_T2F tl; + V3F_C4F_T2F tl; /// bottom left - V3F_C4B_T2F bl; + V3F_C4F_T2F bl; /// top right - V3F_C4B_T2F tr; + V3F_C4F_T2F tr; /// bottom right - V3F_C4B_T2F br; + V3F_C4F_T2F br; }; /** @struct V2F_C4F_T2F_Quad * 4 Vertex2FTex2FColor4F Quad. */ -struct AX_DLL V2F_C4F_T2F_Quad +struct V2F_C4F_T2F_Quad { /// bottom left V2F_C4F_T2F bl; @@ -236,7 +176,7 @@ struct AX_DLL V2F_C4F_T2F_Quad /** @struct V3F_T2F_Quad * */ -struct AX_DLL V3F_T2F_Quad +struct V3F_T2F_Quad { /// bottom left V3F_T2F bl; diff --git a/core/math/Color.cpp b/core/math/Color.cpp index c337b6ea5cba..6a7d41cf606c 100644 --- a/core/math/Color.cpp +++ b/core/math/Color.cpp @@ -46,9 +46,9 @@ bool Color3B::operator==(const Color4B& right) const return (r == right.r && g == right.g && b == right.b && 255 == right.a); } -bool Color3B::operator==(const Color4F& right) const +bool Color3B::operator==(const Color& right) const { - return (right.a == 1.0f && Color4F(*this) == right); + return (right.a == 1.0f && Color(*this) == right); } bool Color3B::operator!=(const Color3B& right) const @@ -61,7 +61,7 @@ bool Color3B::operator!=(const Color4B& right) const return !(*this == right); } -bool Color3B::operator!=(const Color4F& right) const +bool Color3B::operator!=(const Color& right) const { return !(*this == right); } @@ -80,7 +80,7 @@ bool Color4B::operator==(const Color3B& right) const return (r == right.r && g == right.g && b == right.b && a == 255); } -bool Color4B::operator==(const Color4F& right) const +bool Color4B::operator==(const Color& right) const { return (*this == Color4B(right)); } @@ -95,31 +95,31 @@ bool Color4B::operator!=(const Color3B& right) const return !(*this == right); } -bool Color4B::operator!=(const Color4F& right) const +bool Color4B::operator!=(const Color& right) const { return !(*this == right); } /** - * Color4F + * Color */ -bool Color4F::operator==(const Color3B& right) const +bool Color::operator==(const Color3B& right) const { return (a == 1.0f && Color3B(*this) == right); } -bool Color4F::operator==(const Color4B& right) const +bool Color::operator==(const Color4B& right) const { - return (*this == Color4F(right)); + return (*this == Color(right)); } -bool Color4F::operator!=(const Color3B& right) const +bool Color::operator!=(const Color3B& right) const { return !(*this == right); } -bool Color4F::operator!=(const Color4B& right) const +bool Color::operator!=(const Color4B& right) const { return !(*this == right); } @@ -149,16 +149,16 @@ const Color4B Color4B::ORANGE(255, 127, 0, 255); const Color4B Color4B::GRAY(166, 166, 166, 255); const Color4B Color4B::TRANSPARENT(0, 0, 0, 0); -const Color4F Color4F::WHITE(1, 1, 1, 1); -const Color4F Color4F::YELLOW(1, 1, 0, 1); -const Color4F Color4F::GREEN(0, 1, 0, 1); -const Color4F Color4F::BLUE(0, 0, 1, 1); -const Color4F Color4F::RED(1, 0, 0, 1); -const Color4F Color4F::MAGENTA(1, 0, 1, 1); -const Color4F Color4F::BLACK(0, 0, 0, 1); -const Color4F Color4F::ORANGE(1, 0.5f, 0, 1); -const Color4F Color4F::GRAY(0.65f, 0.65f, 0.65f, 1); -const Color4F Color4F::TRANSPARENT(0, 0, 0, 0); +const Color Color::WHITE(1, 1, 1, 1); +const Color Color::YELLOW(1, 1, 0, 1); +const Color Color::GREEN(0, 1, 0, 1); +const Color Color::BLUE(0, 0, 1, 1); +const Color Color::RED(1, 0, 0, 1); +const Color Color::MAGENTA(1, 0, 1, 1); +const Color Color::BLACK(0, 0, 0, 1); +const Color Color::ORANGE(1, 0.5f, 0, 1); +const Color Color::GRAY(0.65f, 0.65f, 0.65f, 1); +const Color Color::TRANSPARENT(0, 0, 0, 0); HSV::HSV() {} @@ -166,20 +166,20 @@ HSV::HSV(float _h, float _s, float _v, float _a) : Vec4Base(_h, _s, _v, _a) {} HSV::HSV(const Color3B& c) { - fromRgba(Color4F(c)); + fromRgba(Color(c)); }; HSV::HSV(const Color4B& c) { - fromRgba(Color4F(c)); + fromRgba(Color(c)); } -HSV::HSV(const Color4F& c) +HSV::HSV(const Color& c) { fromRgba(c); } -void HSV::fromRgba(const Color4F& rgba) +void HSV::fromRgba(const Color& rgba) { float fcmax = MAX(MAX(rgba.r, rgba.g), rgba.b); float fcmin = MIN(MIN(rgba.r, rgba.g), rgba.b); @@ -226,9 +226,9 @@ void HSV::fromRgba(const Color4F& rgba) this->a = rgba.a; } -Color4F HSV::toRgba() const +Color HSV::toRgba() const { - auto rgba = Color4F(0, 0, 0, a); + auto rgba = Color(0, 0, 0, a); float hue = remainder(std::fabs(h), 360); hue += 360; @@ -298,30 +298,25 @@ Color4B HSV::toColor4B() const return Color4B(toRgba()); } -Color4F HSV::toColor4F() const -{ - return toRgba(); -} - HSL::HSL() {} HSL::HSL(float _h, float _s, float _l, float _a) : Vec4Base(_h, _s, _l, _a) {} HSL::HSL(const Color3B& c) { - fromRgba(Color4F(c)); + fromRgba(Color(c)); } HSL::HSL(const Color4B& c) { - fromRgba(Color4F(c)); + fromRgba(Color(c)); } -HSL::HSL(const Color4F& c) +HSL::HSL(const Color& c) { fromRgba(c); } -void HSL::fromRgba(const Color4F& rgba) +void HSL::fromRgba(const Color& rgba) { float max = MAX(MAX(rgba.r, rgba.g), rgba.b); float min = MIN(MIN(rgba.r, rgba.g), rgba.b); @@ -372,9 +367,9 @@ float HSL::hue2rgb(float p, float q, float t) return p; } -Color4F HSL::toRgba() const +Color HSL::toRgba() const { - auto rgba = Color4F(0, 0, 0, a); + auto rgba = Color(0, 0, 0, a); float hue = remainder(std::fabs(h), 360); hue += 360; @@ -406,11 +401,6 @@ Color4B HSL::toColor4B() const return Color4B(toRgba()); } -Color4F HSL::toColor4F() const -{ - return Color4F(toRgba()); -} - NS_AX_MATH_END #if defined(_WIN32) diff --git a/core/math/Color.h b/core/math/Color.h index 3bcdd35eb47b..7a6ad7204ff0 100644 --- a/core/math/Color.h +++ b/core/math/Color.h @@ -35,7 +35,7 @@ THE SOFTWARE. NS_AX_MATH_BEGIN struct Color4B; -struct Color4F; +struct Color; struct HSV; /** @@ -47,14 +47,14 @@ struct AX_DLL Color3B Color3B() {}; Color3B(uint8_t _r, uint8_t _g, uint8_t _b) : r(_r), g(_g), b(_b) {} explicit Color3B(const Color4B& color); - explicit Color3B(const Color4F& color); + explicit Color3B(const Color& color); bool operator==(const Color3B& right) const; bool operator==(const Color4B& right) const; - bool operator==(const Color4F& right) const; + bool operator==(const Color& right) const; bool operator!=(const Color3B& right) const; bool operator!=(const Color4B& right) const; - bool operator!=(const Color4F& right) const; + bool operator!=(const Color& right) const; bool equals(const Color3B& other) const { return (*this == other); } @@ -82,7 +82,7 @@ struct AX_DLL Color4B Color4B() {} Color4B(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {} explicit Color4B(const Color3B& color, uint8_t _a = 255) : r(color.r), g(color.g), b(color.b), a(_a) {} - Color4B(const Color4F& color); + Color4B(const Color& color); inline void set(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) { @@ -94,10 +94,10 @@ struct AX_DLL Color4B bool operator==(const Color4B& right) const; bool operator==(const Color3B& right) const; - bool operator==(const Color4F& right) const; + bool operator==(const Color& right) const; bool operator!=(const Color4B& right) const; bool operator!=(const Color3B& right) const; - bool operator!=(const Color4F& right) const; + bool operator!=(const Color& right) const; uint8_t r = 0; uint8_t g = 0; @@ -120,16 +120,16 @@ struct AX_DLL Color4B * RGBA color composed of 4 floats. * @since v3.0 */ -struct AX_DLL Color4F : public Vec4Base +struct AX_DLL Color : public Vec4Base { - using Vec4Base = Vec4Base; + using Vec4Base = Vec4Base; - Color4F() {} - Color4F(float _r, float _g, float _b, float _a) : Vec4Base(_r, _g, _b, _a) {} - explicit Color4F(const Color3B& color, float _a = 1.0f) + Color() {} + Color(float _r, float _g, float _b, float _a) : Vec4Base(_r, _g, _b, _a) {} + explicit Color(const Color3B& color, float _a = 1.0f) : Vec4Base(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, _a) {} - explicit Color4F(const Color4B& color) + explicit Color(const Color4B& color) : Vec4Base(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f) {} @@ -138,19 +138,20 @@ struct AX_DLL Color4F : public Vec4Base bool operator!=(const Color3B& rhs) const; bool operator!=(const Color4B& rhs) const; - bool equals(const Color4F& other) const { return (*this == other); } - - static const Color4F WHITE; - static const Color4F YELLOW; - static const Color4F BLUE; - static const Color4F GREEN; - static const Color4F RED; - static const Color4F MAGENTA; - static const Color4F BLACK; - static const Color4F ORANGE; - static const Color4F GRAY; - static const Color4F TRANSPARENT; // TRANSPARENT is defined on wingdi.h /*Background Modes*/ + bool equals(const Color& other) const { return (*this == other); } + + static const Color WHITE; + static const Color YELLOW; + static const Color BLUE; + static const Color GREEN; + static const Color RED; + static const Color MAGENTA; + static const Color BLACK; + static const Color ORANGE; + static const Color GRAY; + static const Color TRANSPARENT; // TRANSPARENT is defined on wingdi.h /*Background Modes*/ }; +using Color4F = Color; // DEPRECATED /** * Hue Saturation Value color space composed of 4 floats. @@ -165,16 +166,15 @@ struct AX_DLL HSV : public Vec4Base explicit HSV(const Color3B& c); explicit HSV(const Color4B& c); - explicit HSV(const Color4F& c); + explicit HSV(const Color& c); bool equals(const HSV& other) const { return (*this == other); } - void fromRgba(const Color4F& rgba); - Color4F toRgba() const; + void fromRgba(const Color& rgba); + Color toRgba() const; Color3B toColor3B() const; Color4B toColor4B() const; - Color4F toColor4F() const; }; /** @@ -190,24 +190,23 @@ struct AX_DLL HSL : public Vec4Base explicit HSL(const Color3B& c); explicit HSL(const Color4B& c); - explicit HSL(const Color4F& c); + explicit HSL(const Color& c); bool equals(const HSL& other) const { return (*this == other); } - void fromRgba(const Color4F& rgba); - Color4F toRgba() const; + void fromRgba(const Color& rgba); + Color toRgba() const; static float hue2rgb(float p, float q, float t); Color3B toColor3B() const; Color4B toColor4B() const; - Color4F toColor4F() const; }; inline Color3B::Color3B(const Color4B& color) : r(color.r), g(color.g), b(color.b) {} -inline Color3B::Color3B(const Color4F& color) : r(color.r * 255.0f), g(color.g * 255.0f), b(color.b * 255.0f) {} +inline Color3B::Color3B(const Color& color) : r(color.r * 255.0f), g(color.g * 255.0f), b(color.b * 255.0f) {} -inline Color4B::Color4B(const Color4F& color) : r(color.r * 255), g(color.g * 255), b(color.b * 255), a(color.a * 255) {} +inline Color4B::Color4B(const Color& color) : r(color.r * 255), g(color.g * 255), b(color.b * 255), a(color.a * 255) {} NS_AX_MATH_END diff --git a/core/math/MathUtil.cpp b/core/math/MathUtil.cpp index f2ca2ce8dd1d..e7346dbabf76 100644 --- a/core/math/MathUtil.cpp +++ b/core/math/MathUtil.cpp @@ -283,13 +283,13 @@ void MathUtil::crossVec3(const float* v1, const float* v2, float* dst) #endif } -void MathUtil::transformVertices(V3F_C4B_T2F* dst, const V3F_C4B_T2F* src, size_t count, const Mat4& transform) +void MathUtil::transformVertices(V3F_C4F_T2F* dst, const V3F_C4F_T2F* src, size_t count, const Mat4& transform) { // Check some assumptions made by optimizations - static_assert(sizeof(V3F_C4B_T2F) == 24); - static_assert(offsetof(V3F_C4B_T2F, vertices) == 0); - static_assert(offsetof(V3F_C4B_T2F, colors) == 12); - static_assert(offsetof(V3F_C4B_T2F, texCoords) == 16); + static_assert(sizeof(V3F_C4F_T2F) == 36); + static_assert(offsetof(V3F_C4F_T2F, vertices) == 0); + static_assert(offsetof(V3F_C4F_T2F, colors) == 12); + static_assert(offsetof(V3F_C4F_T2F, texCoords) == 28); #if defined(AX_SSE_INTRINSICS) MathUtilSSE::transformVertices(dst, src, count, transform); #elif defined(AX_NEON_INTRINSICS) diff --git a/core/math/MathUtil.h b/core/math/MathUtil.h index a01f67227e3c..b2d4b1dc9743 100644 --- a/core/math/MathUtil.h +++ b/core/math/MathUtil.h @@ -29,7 +29,7 @@ namespace ax { - struct V3F_C4B_T2F; + struct V3F_C4F_T2F; } /** @@ -119,7 +119,7 @@ class AX_DLL MathUtil static void crossVec3(const float* v1, const float* v2, float* dst); - static void transformVertices(V3F_C4B_T2F* dst, const V3F_C4B_T2F* src, size_t count, const Mat4& transform); + static void transformVertices(V3F_C4F_T2F* dst, const V3F_C4F_T2F* src, size_t count, const Mat4& transform); static void transformIndices(uint16_t* dst, const uint16_t* src, size_t count, uint16_t offset); }; diff --git a/core/math/MathUtil.inl b/core/math/MathUtil.inl index 649cb0426786..19ee3d678915 100644 --- a/core/math/MathUtil.inl +++ b/core/math/MathUtil.inl @@ -191,7 +191,7 @@ public: dst[2] = z; } - inline static void transformVertices(V3F_C4B_T2F* dst, const V3F_C4B_T2F* src, size_t count, const Mat4& transform) + inline static void transformVertices(V3F_C4F_T2F* dst, const V3F_C4F_T2F* src, size_t count, const Mat4& transform) { auto end = dst + count; auto& t = transform; // Make copy for better aliasing inference @@ -203,7 +203,7 @@ public: dst->vertices.x = pos.x * m[0] + pos.y * m[4] + pos.z * m[8] + m[12]; dst->vertices.y = pos.x * m[1] + pos.y * m[5] + pos.z * m[9] + m[13]; dst->vertices.z = pos.x * m[2] + pos.y * m[6] + pos.z * m[10] + m[14]; - memcpy(&dst->colors, &src->colors, sizeof(V3F_C4B_T2F::colors) + sizeof(V3F_C4B_T2F::texCoords)); + memcpy(&dst->colors, &src->colors, sizeof(V3F_C4F_T2F::colors) + sizeof(V3F_C4F_T2F::texCoords)); ++dst; ++src; } diff --git a/core/math/MathUtilNeon.inl b/core/math/MathUtilNeon.inl index d85324ddc541..f238e2487ecd 100644 --- a/core/math/MathUtilNeon.inl +++ b/core/math/MathUtilNeon.inl @@ -147,7 +147,7 @@ struct MathUtilNeon } #if AX_64BITS - inline static void transformVertices(V3F_C4B_T2F* dst, const V3F_C4B_T2F* src, size_t count, const Mat4& transform) + inline static void transformVertices(V3F_C4F_T2F* dst, const V3F_C4F_T2F* src, size_t count, const Mat4& transform) { auto end = dst + count; @@ -280,8 +280,8 @@ struct MathUtilNeon } } #else - inline static void transformVertices(ax::V3F_C4B_T2F* dst, - const ax::V3F_C4B_T2F* src, + inline static void transformVertices(ax::V3F_C4F_T2F* dst, + const ax::V3F_C4F_T2F* src, size_t count, const ax::Mat4& transform) { diff --git a/core/math/MathUtilSSE.inl b/core/math/MathUtilSSE.inl index 4869fe98b1de..a4c82ad9e1a7 100644 --- a/core/math/MathUtilSSE.inl +++ b/core/math/MathUtilSSE.inl @@ -230,7 +230,7 @@ struct MathUtilSSE # endif } - static void transformVertices(V3F_C4B_T2F* dst, const V3F_C4B_T2F* src, size_t count, const Mat4& transform) + static void transformVertices(V3F_C4F_T2F* dst, const V3F_C4F_T2F* src, size_t count, const Mat4& transform) { auto& m = transform.col; @@ -246,7 +246,7 @@ struct MathUtilSSE // Copy tex coords and colors // dst[i].texCoords = src[i].texCoords; // dst[i].colors = src[i].colors; - memcpy(&dst[i].colors, &src[i].colors, sizeof(V3F_C4B_T2F::colors) + sizeof(V3F_C4B_T2F::texCoords)); + memcpy(&dst[i].colors, &src[i].colors, sizeof(V3F_C4F_T2F::colors) + sizeof(V3F_C4F_T2F::texCoords)); } } diff --git a/core/navmesh/NavMeshDebugDraw.cpp b/core/navmesh/NavMeshDebugDraw.cpp index b863eb9178f9..53ab4538d4ce 100644 --- a/core/navmesh/NavMeshDebugDraw.cpp +++ b/core/navmesh/NavMeshDebugDraw.cpp @@ -44,7 +44,7 @@ NavMeshDebugDraw::NavMeshDebugDraw() _programState = new backend::ProgramState(program); _locMVP = _programState->getUniformLocation("u_MVPMatrix"); - // the POSITION_COLOR default vertex layout is: V3F_C4B, so we need modify it + // the POSITION_COLOR default vertex layout is: V3F_C4F, so we need modify it auto vertexLayout = _programState->getMutableVertexLayout(); vertexLayout->setAttrib("a_position", _programState->getAttributeLocation(backend::Attribute::POSITION), diff --git a/core/physics3d/Physics3DDebugDrawer.cpp b/core/physics3d/Physics3DDebugDrawer.cpp index ef3551354035..d478f981353c 100644 --- a/core/physics3d/Physics3DDebugDrawer.cpp +++ b/core/physics3d/Physics3DDebugDrawer.cpp @@ -46,9 +46,9 @@ void Physics3DDebugDrawer::drawLine(const btVector3& from, const btVector3& to, V3F_C4F a, b; a.vertices = convertbtVector3ToVec3(from); - a.colors = Color4F(col.x, col.y, col.z, 1.0f); + a.colors = Color(col.x, col.y, col.z, 1.0f); b.vertices = convertbtVector3ToVec3(to); - b.colors = Color4F(col.x, col.y, col.z, 1.0f); + b.colors = Color(col.x, col.y, col.z, 1.0f); _buffer.emplace_back(a); _buffer.emplace_back(b); diff --git a/core/renderer/QuadCommand.cpp b/core/renderer/QuadCommand.cpp index a60af606eccc..06f3f5b98349 100644 --- a/core/renderer/QuadCommand.cpp +++ b/core/renderer/QuadCommand.cpp @@ -92,7 +92,7 @@ void QuadCommand::reIndex(int indicesCount) void QuadCommand::init(float globalOrder, Texture2D* texture, const BlendFunc& blendType, - V3F_C4B_T2F_Quad* quads, + V3F_C4F_T2F_Quad* quads, ssize_t quadCount, const Mat4& mv, uint32_t flags) diff --git a/core/renderer/QuadCommand.h b/core/renderer/QuadCommand.h index 2e69659731fd..070937d96d66 100644 --- a/core/renderer/QuadCommand.h +++ b/core/renderer/QuadCommand.h @@ -64,7 +64,7 @@ class AX_DLL QuadCommand : public TrianglesCommand void init(float globalOrder, Texture2D* texture, const BlendFunc& blendType, - V3F_C4B_T2F_Quad* quads, + V3F_C4F_T2F_Quad* quads, ssize_t quadCount, const Mat4& mv, uint32_t flags); diff --git a/core/renderer/Renderer.cpp b/core/renderer/Renderer.cpp index c8810d27273a..a46f4c11b195 100644 --- a/core/renderer/Renderer.cpp +++ b/core/renderer/Renderer.cpp @@ -868,7 +868,7 @@ void Renderer::endRenderPass() _commandBuffer->endRenderPass(); } -void Renderer::clear(ClearFlag flags, const Color4F& color, float depth, unsigned int stencil, float globalOrder) +void Renderer::clear(ClearFlag flags, const Color& color, float depth, unsigned int stencil, float globalOrder) { _clearFlag = flags; @@ -913,7 +913,7 @@ CallbackCommand* Renderer::nextCallbackCommand() return cmd; } -const Color4F& Renderer::getClearColor() const +const Color& Renderer::getClearColor() const { return _clearColor; } diff --git a/core/renderer/Renderer.h b/core/renderer/Renderer.h index 0e09f1609d40..3a9ea0d8ec85 100644 --- a/core/renderer/Renderer.h +++ b/core/renderer/Renderer.h @@ -209,13 +209,13 @@ class AX_DLL Renderer @depth The clear depth value. @stencil The clear stencil value. */ - void clear(ClearFlag flags, const Color4F& color, float depth, unsigned int stencil, float globalOrder); + void clear(ClearFlag flags, const Color& color, float depth, unsigned int stencil, float globalOrder); /** * Get color clear value. * @return Color clear value. */ - const Color4F& getClearColor() const; + const Color& getClearColor() const; /** * Get depth clear value. @@ -509,7 +509,7 @@ class AX_DLL Renderer std::vector _groupCommandPool; // for TrianglesCommand - V3F_C4B_T2F _verts[VBO_SIZE]; + V3F_C4F_T2F _verts[VBO_SIZE]; unsigned short _indices[INDEX_VBO_SIZE]; backend::Buffer* _vertexBuffer = nullptr; backend::Buffer* _indexBuffer = nullptr; @@ -556,7 +556,7 @@ class AX_DLL Renderer backend::RenderTarget* _offscreenRT = nullptr; - Color4F _clearColor = Color4F::BLACK; + Color _clearColor = Color::BLACK; ClearFlag _clearFlag; struct ScissorState diff --git a/core/renderer/TextureAtlas.cpp b/core/renderer/TextureAtlas.cpp index 074566e44c1a..eae1ad693148 100644 --- a/core/renderer/TextureAtlas.cpp +++ b/core/renderer/TextureAtlas.cpp @@ -87,14 +87,14 @@ void TextureAtlas::setTexture(Texture2D* var) _texture = var; } -V3F_C4B_T2F_Quad* TextureAtlas::getQuads() +V3F_C4F_T2F_Quad* TextureAtlas::getQuads() { // if someone accesses the quads directly, presume that changes will be made _dirty = true; return _quads; } -void TextureAtlas::setQuads(V3F_C4B_T2F_Quad* quads) +void TextureAtlas::setQuads(V3F_C4F_T2F_Quad* quads) { _quads = quads; } @@ -156,7 +156,7 @@ bool TextureAtlas::initWithTexture(Texture2D* texture, ssize_t capacity) // Re-initialization is not allowed AXASSERT(_quads == nullptr && _indices == nullptr, "_quads and _indices should be nullptr."); - _quads = (V3F_C4B_T2F_Quad*)malloc(_capacity * sizeof(V3F_C4B_T2F_Quad)); + _quads = (V3F_C4F_T2F_Quad*)malloc(_capacity * sizeof(V3F_C4F_T2F_Quad)); _indices = (uint16_t*)malloc(_capacity * 6 * sizeof(uint16_t)); if (!(_quads && _indices) && _capacity > 0) @@ -171,7 +171,7 @@ bool TextureAtlas::initWithTexture(Texture2D* texture, ssize_t capacity) return false; } - memset(_quads, 0, _capacity * sizeof(V3F_C4B_T2F_Quad)); + memset(_quads, 0, _capacity * sizeof(V3F_C4F_T2F_Quad)); memset(_indices, 0, _capacity * 6 * sizeof(uint16_t)); this->setupIndices(); @@ -206,7 +206,7 @@ void TextureAtlas::setupIndices() // TextureAtlas - Update, Insert, Move & Remove -void TextureAtlas::updateQuad(const V3F_C4B_T2F_Quad& quad, ssize_t index) +void TextureAtlas::updateQuad(const V3F_C4F_T2F_Quad& quad, ssize_t index) { AXASSERT(index >= 0 && index < _capacity, "updateQuadWithTexture: Invalid index"); @@ -217,7 +217,7 @@ void TextureAtlas::updateQuad(const V3F_C4B_T2F_Quad& quad, ssize_t index) _dirty = true; } -void TextureAtlas::insertQuad(const V3F_C4B_T2F_Quad& quad, ssize_t index) +void TextureAtlas::insertQuad(const V3F_C4F_T2F_Quad& quad, ssize_t index) { AXASSERT(index >= 0 && index < _capacity, "insertQuadWithTexture: Invalid index"); @@ -239,7 +239,7 @@ void TextureAtlas::insertQuad(const V3F_C4B_T2F_Quad& quad, ssize_t index) _dirty = true; } -void TextureAtlas::insertQuads(V3F_C4B_T2F_Quad* quads, ssize_t index, ssize_t amount) +void TextureAtlas::insertQuads(V3F_C4F_T2F_Quad* quads, ssize_t index, ssize_t amount) { AXASSERT(index >= 0 && amount >= 0 && index + amount <= _capacity, "insertQuadWithTexture: Invalid index + amount"); @@ -290,7 +290,7 @@ void TextureAtlas::insertQuadFromIndex(ssize_t oldIndex, ssize_t newIndex) } // texture coordinates - V3F_C4B_T2F_Quad quadsBackup = _quads[oldIndex]; + V3F_C4F_T2F_Quad quadsBackup = _quads[oldIndex]; memmove(&_quads[dst], &_quads[src], sizeof(_quads[0]) * howMany); _quads[newIndex] = quadsBackup; @@ -351,7 +351,7 @@ bool TextureAtlas::resizeCapacity(ssize_t newCapacity) _totalQuads = MIN(_totalQuads, newCapacity); _capacity = newCapacity; - V3F_C4B_T2F_Quad* tmpQuads = nullptr; + V3F_C4F_T2F_Quad* tmpQuads = nullptr; uint16_t* tmpIndices = nullptr; // when calling initWithTexture(fileName, 0) on bada device, calloc(0, 1) will fail and return nullptr, @@ -361,7 +361,7 @@ bool TextureAtlas::resizeCapacity(ssize_t newCapacity) ssize_t new_quads_size = _capacity * _quads_size; if (_quads == nullptr) { - tmpQuads = (V3F_C4B_T2F_Quad*)malloc(new_quads_size); + tmpQuads = (V3F_C4F_T2F_Quad*)malloc(new_quads_size); if (tmpQuads != nullptr) { memset(tmpQuads, 0, new_quads_size); @@ -369,7 +369,7 @@ bool TextureAtlas::resizeCapacity(ssize_t newCapacity) } else { - tmpQuads = (V3F_C4B_T2F_Quad*)realloc(_quads, new_quads_size); + tmpQuads = (V3F_C4F_T2F_Quad*)realloc(_quads, new_quads_size); if (tmpQuads != nullptr && _capacity > oldCapacity) { memset(tmpQuads + oldCapacity, 0, (_capacity - oldCapacity) * _quads_size); @@ -436,8 +436,8 @@ void TextureAtlas::moveQuadsFromIndex(ssize_t oldIndex, ssize_t amount, ssize_t return; } // create buffer - size_t quadSize = sizeof(V3F_C4B_T2F_Quad); - V3F_C4B_T2F_Quad* tempQuads = (V3F_C4B_T2F_Quad*)malloc(quadSize * amount); + size_t quadSize = sizeof(V3F_C4F_T2F_Quad); + V3F_C4F_T2F_Quad* tempQuads = (V3F_C4F_T2F_Quad*)malloc(quadSize * amount); memcpy(tempQuads, &_quads[oldIndex], quadSize * amount); if (newIndex < oldIndex) @@ -468,7 +468,7 @@ void TextureAtlas::moveQuadsFromIndex(ssize_t index, ssize_t newIndex) void TextureAtlas::fillWithEmptyQuadsFromIndex(ssize_t index, ssize_t amount) { AXASSERT(index >= 0 && amount >= 0, "values must be >= 0"); - V3F_C4B_T2F_Quad quad; + V3F_C4F_T2F_Quad quad; memset(&quad, 0, sizeof(quad)); auto to = index + amount; diff --git a/core/renderer/TextureAtlas.h b/core/renderer/TextureAtlas.h index b5bfd32d4d7a..7b0da516a7c2 100644 --- a/core/renderer/TextureAtlas.h +++ b/core/renderer/TextureAtlas.h @@ -113,14 +113,14 @@ class AX_DLL TextureAtlas : public Object @param index Index must be between 0 and the atlas capacity - 1. @since v0.8 */ - void updateQuad(const V3F_C4B_T2F_Quad& quad, ssize_t index); + void updateQuad(const V3F_C4F_T2F_Quad& quad, ssize_t index); /** Inserts a Quad (texture, vertex and color) at a certain index. @param quad Quad that are going to be rendered. @param index Index must be between 0 and the atlas capacity - 1. @since v0.8 */ - void insertQuad(const V3F_C4B_T2F_Quad& quad, ssize_t index); + void insertQuad(const V3F_C4F_T2F_Quad& quad, ssize_t index); /** Inserts a c array of quads at a given index. @param quads Quad that are going to be rendered. @@ -129,7 +129,7 @@ class AX_DLL TextureAtlas : public Object @attention This method doesn't enlarge the array when amount + index > totalQuads. @since v1.1 */ - void insertQuads(V3F_C4B_T2F_Quad* quads, ssize_t index, ssize_t amount); + void insertQuads(V3F_C4F_T2F_Quad* quads, ssize_t index, ssize_t amount); /** Removes the quad that is located at a certain index and inserts it at a new index. This operation is faster than removing and inserting in a quad in 2 different steps. @@ -214,10 +214,10 @@ class AX_DLL TextureAtlas : public Object void setTexture(Texture2D* texture); /** Gets the quads that are going to be rendered. */ - V3F_C4B_T2F_Quad* getQuads(); + V3F_C4F_T2F_Quad* getQuads(); /** Sets the quads that are going to be rendered. */ - void setQuads(V3F_C4B_T2F_Quad* quads); + void setQuads(V3F_C4F_T2F_Quad* quads); inline unsigned short* getIndices() { return _indices; } @@ -239,7 +239,7 @@ class AX_DLL TextureAtlas : public Object /** Texture of the texture atlas */ Texture2D* _texture = nullptr; /** Quads that are going to be rendered */ - V3F_C4B_T2F_Quad* _quads = nullptr; + V3F_C4F_T2F_Quad* _quads = nullptr; #if AX_ENABLE_CACHE_TEXTURE_DATA EventListenerCustom* _rendererRecreatedListener = nullptr; diff --git a/core/renderer/TrianglesCommand.h b/core/renderer/TrianglesCommand.h index 7f297b2e95ad..fc546a87c8bc 100644 --- a/core/renderer/TrianglesCommand.h +++ b/core/renderer/TrianglesCommand.h @@ -54,14 +54,14 @@ class AX_DLL TrianglesCommand : public RenderCommand /**The structure of Triangles. */ struct Triangles { - Triangles(V3F_C4B_T2F* _verts, unsigned short* _indices, unsigned int _vertCount, unsigned int _indexCount) + Triangles(V3F_C4F_T2F* _verts, unsigned short* _indices, unsigned int _vertCount, unsigned int _indexCount) : verts(_verts), indices(_indices), vertCount(_vertCount), indexCount(_indexCount) {} Triangles() {} /**Vertex data pointer.*/ - V3F_C4B_T2F* verts = nullptr; + V3F_C4F_T2F* verts = nullptr; /**Index data pointer.*/ unsigned short* indices = nullptr; /**The number of vertices.*/ @@ -98,7 +98,7 @@ class AX_DLL TrianglesCommand : public RenderCommand /**Get the index count of the triangles.*/ size_t getIndexCount() const { return _triangles.indexCount; } /**Get the vertex data pointer.*/ - const V3F_C4B_T2F* getVertices() const { return _triangles.verts; } + const V3F_C4F_T2F* getVertices() const { return _triangles.verts; } /**Get the index data pointer.*/ const unsigned short* getIndices() const { return _triangles.indices; } /**Get the model view matrix.*/ diff --git a/core/renderer/backend/Program.cpp b/core/renderer/backend/Program.cpp index c6c48f63de2b..3282501a5c82 100644 --- a/core/renderer/backend/Program.cpp +++ b/core/renderer/backend/Program.cpp @@ -62,12 +62,12 @@ struct VertexLayoutHelper /// a_texCoord vertexLayout->setAttrib(backend::ATTRIBUTE_NAME_TEXCOORD, program->getAttributeLocation(backend::Attribute::TEXCOORD), - backend::VertexFormat::FLOAT2, offsetof(V3F_C4B_T2F, texCoords), false); + backend::VertexFormat::FLOAT2, offsetof(V3F_C4F_T2F, texCoords), false); /// a_color vertexLayout->setAttrib(backend::ATTRIBUTE_NAME_COLOR, program->getAttributeLocation(backend::Attribute::COLOR), - backend::VertexFormat::UBYTE4, offsetof(V3F_C4B_T2F, colors), true); - vertexLayout->setStride(sizeof(V3F_C4B_T2F)); + backend::VertexFormat::FLOAT4, offsetof(V3F_C4F_T2F, colors), false); + vertexLayout->setStride(sizeof(V3F_C4F_T2F)); } static void setupDrawNode(Program* program) @@ -80,12 +80,12 @@ struct VertexLayoutHelper vertexLayout->setAttrib(backend::ATTRIBUTE_NAME_TEXCOORD, program->getAttributeLocation(backend::Attribute::TEXCOORD), - backend::VertexFormat::FLOAT2, offsetof(V2F_C4B_T2F, texCoords), false); + backend::VertexFormat::FLOAT2, offsetof(V2F_C4F_T2F, texCoords), false); vertexLayout->setAttrib(backend::ATTRIBUTE_NAME_COLOR, program->getAttributeLocation(backend::Attribute::COLOR), - backend::VertexFormat::UBYTE4, offsetof(V2F_C4B_T2F, colors), true); + backend::VertexFormat::FLOAT4, offsetof(V2F_C4F_T2F, colors), true); - vertexLayout->setStride(sizeof(V2F_C4B_T2F)); + vertexLayout->setStride(sizeof(V2F_C4F_T2F)); } static void setupDrawNode3D(Program* program) @@ -97,9 +97,9 @@ struct VertexLayoutHelper backend::VertexFormat::FLOAT3, 0, false); vertexLayout->setAttrib(backend::ATTRIBUTE_NAME_COLOR, program->getAttributeLocation(backend::Attribute::COLOR), - backend::VertexFormat::UBYTE4, offsetof(V3F_C4B, colors), true); + backend::VertexFormat::FLOAT4, offsetof(V3F_C4F, colors), true); - vertexLayout->setStride(sizeof(V3F_C4B)); + vertexLayout->setStride(sizeof(V3F_C4F)); } static void setupSkyBox(Program* program) diff --git a/core/renderer/backend/Program.h b/core/renderer/backend/Program.h index 071d33ba05b4..6d88f4db8069 100644 --- a/core/renderer/backend/Program.h +++ b/core/renderer/backend/Program.h @@ -51,12 +51,12 @@ enum class VertexLayoutType Unspec, // needs binding after program load Pos, // V2F Texture, // T2F - Sprite, // V3F_C4B_T2F posTexColor - DrawNode, // V2F_C4B_T2F - DrawNode3D, // V3F_C4B + Sprite, // V3F_C4F_T2F posTexColor + DrawNode, // V2F_C4F_T2F + DrawNode3D, // V3F_C4F SkyBox, // V3F - PU3D, // V3F_C4B_T2F // same with sprite, TODO: reuse spriete - posColor, // V3F_C4B + PU3D, // V3F_C4F_T2F // same with sprite, TODO: reuse sprite + posColor, // V3F_C4F Terrain3D, // V3F_T2F_V3F Instanced, // builtin instanced vertex format for 3D transform Count diff --git a/core/ui/UILayout.cpp b/core/ui/UILayout.cpp index 3cd3262a7361..78b3b2972dcd 100644 --- a/core/ui/UILayout.cpp +++ b/core/ui/UILayout.cpp @@ -449,7 +449,7 @@ void Layout::setStencilClippingSize(const Vec2& /*size*/) if (_clippingEnabled && _clippingType == ClippingType::STENCIL) { _clippingStencil->clear(); - _clippingStencil->drawSolidRect(Vec2::ZERO, _contentSize, Color4B::GREEN); // Fix issue #1546 + _clippingStencil->drawSolidRect(Vec2::ZERO, _contentSize, Color::GREEN); // Fix issue #1546 } } diff --git a/core/ui/UIMediaPlayer.cpp b/core/ui/UIMediaPlayer.cpp index bf564f386c46..e0f512e67a3f 100644 --- a/core/ui/UIMediaPlayer.cpp +++ b/core/ui/UIMediaPlayer.cpp @@ -220,7 +220,7 @@ void createMediaControlTexture() auto DrawStop = [&](const Vec2& middle) -> void { auto s = Vec2(middle.x - iconW / 2.f, middle.y + iconH / 2.f); - drawNode->drawSolidRect(s, s + Vec2(iconW, -iconH), Color4B::WHITE); + drawNode->drawSolidRect(s, s + Vec2(iconW, -iconH), Color::WHITE); }; auto DrawPlay = [&](const Vec2& middle) -> void { @@ -228,15 +228,15 @@ void createMediaControlTexture() auto p2 = Vec2(middle.x + iconW / 2.f, middle.y); auto p3 = Vec2(middle.x - iconW / 2.f, middle.y - iconH / 2.f); - drawNode->drawTriangle(p1, p2, p3, Color4B::WHITE); + drawNode->drawTriangle(p1, p2, p3, Color::WHITE); }; auto DrawPause = [&](const Vec2& middle) -> void { auto start = Vec2(middle.x - 3, middle.y + iconH / 2.f); - drawNode->drawSolidRect(start, start + Vec2(-6, -iconH), Color4B::WHITE); + drawNode->drawSolidRect(start, start + Vec2(-6, -iconH), Color::WHITE); start = Vec2(middle.x + 3, middle.y + iconH / 2.f); - drawNode->drawSolidRect(start, start + Vec2(6, -iconH), Color4B::WHITE); + drawNode->drawSolidRect(start, start + Vec2(6, -iconH), Color::WHITE); }; auto DrawEnterFullscreen = [&](const Vec2& middle) -> void { @@ -246,20 +246,20 @@ void createMediaControlTexture() auto bottomRight = Vec2(middle.x + panelW / 2.f - 6, middle.y - panelH / 2.f + 6); // Top left - drawNode->drawSolidRect(topLeft, topLeft + Vec2(20, -6), Color4B::WHITE); - drawNode->drawSolidRect(topLeft, topLeft + Vec2(6, -20), Color4B::WHITE); + drawNode->drawSolidRect(topLeft, topLeft + Vec2(20, -6), Color::WHITE); + drawNode->drawSolidRect(topLeft, topLeft + Vec2(6, -20), Color::WHITE); // Top right - drawNode->drawSolidRect(topRight, topRight + Vec2(-20, -6), Color4B::WHITE); - drawNode->drawSolidRect(topRight, topRight + Vec2(-6, -20), Color4B::WHITE); + drawNode->drawSolidRect(topRight, topRight + Vec2(-20, -6), Color::WHITE); + drawNode->drawSolidRect(topRight, topRight + Vec2(-6, -20), Color::WHITE); // Bottom left - drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(20, 6), Color4B::WHITE); - drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(6, 20), Color4B::WHITE); + drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(20, 6), Color::WHITE); + drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(6, 20), Color::WHITE); // Bottom right - drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(-20, 6), Color4B::WHITE); - drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(-6, 20), Color4B::WHITE); + drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(-20, 6), Color::WHITE); + drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(-6, 20), Color::WHITE); }; auto DrawExitFullScreen = [&](const Vec2& middle) -> void { @@ -269,24 +269,24 @@ void createMediaControlTexture() auto bottomRight = Vec2(middle.x + 4, middle.y - 4); // Top left - drawNode->drawSolidRect(topLeft, topLeft + Vec2(-20, 6), Color4B::WHITE); - drawNode->drawSolidRect(topLeft, topLeft + Vec2(-6, 20), Color4B::WHITE); + drawNode->drawSolidRect(topLeft, topLeft + Vec2(-20, 6), Color::WHITE); + drawNode->drawSolidRect(topLeft, topLeft + Vec2(-6, 20), Color::WHITE); // Top right - drawNode->drawSolidRect(topRight, topRight + Vec2(20, 6), Color4B::WHITE); - drawNode->drawSolidRect(topRight, topRight + Vec2(6, 20), Color4B::WHITE); + drawNode->drawSolidRect(topRight, topRight + Vec2(20, 6), Color::WHITE); + drawNode->drawSolidRect(topRight, topRight + Vec2(6, 20), Color::WHITE); // Bottom left - drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(-20, -6), Color4B::WHITE); - drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(-6, -20), Color4B::WHITE); + drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(-20, -6), Color::WHITE); + drawNode->drawSolidRect(bottomLeft, bottomLeft + Vec2(-6, -20), Color::WHITE); // Bottom right - drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(20, -6), Color4B::WHITE); - drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(6, -20), Color4B::WHITE); + drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(20, -6), Color::WHITE); + drawNode->drawSolidRect(bottomRight, bottomRight + Vec2(6, -20), Color::WHITE); }; auto DrawSliderControlButton = [&](const Vec2& middle) -> void { - drawNode->drawSolidCircle(middle, panelW / 2, 0, 180, Color4B::WHITE); + drawNode->drawSolidCircle(middle, panelW / 2, 0, 180, Color::WHITE); }; std::map> items = { diff --git a/core/ui/UIText.cpp b/core/ui/UIText.cpp index 03c7ad8d2f1b..84fcc90f18f2 100644 --- a/core/ui/UIText.cpp +++ b/core/ui/UIText.cpp @@ -382,7 +382,7 @@ float Text::getShadowBlurRadius() const } Color4B Text::getShadowColor() const { - Color4F effect = _labelRenderer->getShadowColor(); + Color effect = _labelRenderer->getShadowColor(); return Color4B(effect.r * 255, effect.g * 255, effect.b * 255, effect.a * 255); } @@ -396,7 +396,7 @@ LabelEffect Text::getLabelEffectType() const } Color4B Text::getEffectColor() const { - Color4F effect = _labelRenderer->getEffectColor(); + Color effect = _labelRenderer->getEffectColor(); return Color4B(effect.r * 255, effect.g * 255, effect.b * 255, effect.a * 255); } diff --git a/extensions/DragonBones/src/DragonBones/CCSlot.cpp b/extensions/DragonBones/src/DragonBones/CCSlot.cpp index 300508e69756..21652aa13227 100644 --- a/extensions/DragonBones/src/DragonBones/CCSlot.cpp +++ b/extensions/DragonBones/src/DragonBones/CCSlot.cpp @@ -1,4 +1,4 @@ -#include "CCSlot.h" +#include "CCSlot.h" #include "CCTextureAtlasData.h" #include "CCArmatureDisplay.h" @@ -92,7 +92,7 @@ void CCSlot::_updateFrame() const auto& region = currentTextureData->region; const auto& textureAtlasSize = currentTextureData->spriteFrame->getTexture()->getContentSizeInPixels(); - auto vertices = new ax::V3F_C4B_T2F[vertexCount]; // does cocos2dx release it? + auto vertices = new ax::V3F_C4F_T2F[vertexCount]; // does cocos2dx release it? auto vertexIndices = new unsigned short[triangleCount * 3]; // does cocos2dx release it? ax::Rect boundsRect(999999.0f, 999999.0f, -999999.0f, -999999.0f); @@ -103,7 +103,7 @@ void CCSlot::_updateFrame() const auto y = floatArray[vertexOffset + i + 1]; auto u = floatArray[uvOffset + i]; auto v = floatArray[uvOffset + i + 1]; - ax::V3F_C4B_T2F vertexData; + ax::V3F_C4F_T2F vertexData; vertexData.vertices.set(x, -y, 0.0f); if (currentTextureData->rotated) @@ -117,7 +117,7 @@ void CCSlot::_updateFrame() vertexData.texCoords.v = (region.y + v * region.height) / textureAtlasSize.height; } - vertexData.colors = ax::Color4B::WHITE; + vertexData.colors = ax::Color::WHITE; vertices[iH] = vertexData; if (boundsRect.origin.x > x) diff --git a/extensions/cocostudio/src/cocostudio/CSParseBinary_generated.h b/extensions/cocostudio/src/cocostudio/CSParseBinary_generated.h index d06850e7844c..f0a6b092ab31 100644 --- a/extensions/cocostudio/src/cocostudio/CSParseBinary_generated.h +++ b/extensions/cocostudio/src/cocostudio/CSParseBinary_generated.h @@ -154,7 +154,7 @@ struct FVec2; struct FVec3; -struct Color; +struct FColor; struct FlatSize; @@ -220,7 +220,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) FVec3 FLATBUFFERS_FINAL_CLASS { }; FLATBUFFERS_STRUCT_END(FVec3, 12); -FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) Color FLATBUFFERS_FINAL_CLASS { +FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) FColor FLATBUFFERS_FINAL_CLASS { private: uint8_t a_; uint8_t r_; @@ -228,13 +228,13 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) Color FLATBUFFERS_FINAL_CLASS { uint8_t b_; public: - Color() + FColor() : a_(0), r_(0), g_(0), b_(0) { } - Color(uint8_t _a, uint8_t _r, uint8_t _g, uint8_t _b) + FColor(uint8_t _a, uint8_t _r, uint8_t _g, uint8_t _b) : a_(::flatbuffers::EndianScalar(_a)), r_(::flatbuffers::EndianScalar(_r)), g_(::flatbuffers::EndianScalar(_g)), @@ -253,7 +253,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) Color FLATBUFFERS_FINAL_CLASS { return ::flatbuffers::EndianScalar(b_); } }; -FLATBUFFERS_STRUCT_END(Color, 4); +FLATBUFFERS_STRUCT_END(FColor, 4); FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) FlatSize FLATBUFFERS_FINAL_CLASS { private: @@ -650,8 +650,8 @@ struct WidgetOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { const flatbuffers::FVec2 *anchorPoint() const { return GetStruct(VT_ANCHORPOINT); } - const flatbuffers::Color *color() const { - return GetStruct(VT_COLOR); + const flatbuffers::FColor *color() const { + return GetStruct(VT_COLOR); } const flatbuffers::FlatSize *size() const { return GetStruct(VT_SIZE); @@ -702,7 +702,7 @@ struct WidgetOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyField(verifier, VT_POSITION, 4) && VerifyField(verifier, VT_SCALE, 4) && VerifyField(verifier, VT_ANCHORPOINT, 4) && - VerifyField(verifier, VT_COLOR, 1) && + VerifyField(verifier, VT_COLOR, 1) && VerifyField(verifier, VT_SIZE, 4) && VerifyField(verifier, VT_FLIPX, 1) && VerifyField(verifier, VT_FLIPY, 1) && @@ -758,7 +758,7 @@ struct WidgetOptionsBuilder { void add_anchorPoint(const flatbuffers::FVec2 *anchorPoint) { fbb_.AddStruct(WidgetOptions::VT_ANCHORPOINT, anchorPoint); } - void add_color(const flatbuffers::Color *color) { + void add_color(const flatbuffers::FColor *color) { fbb_.AddStruct(WidgetOptions::VT_COLOR, color); } void add_size(const flatbuffers::FlatSize *size) { @@ -820,7 +820,7 @@ inline ::flatbuffers::Offset CreateWidgetOptions( const flatbuffers::FVec2 *position = nullptr, const flatbuffers::FVec2 *scale = nullptr, const flatbuffers::FVec2 *anchorPoint = nullptr, - const flatbuffers::Color *color = nullptr, + const flatbuffers::FColor *color = nullptr, const flatbuffers::FlatSize *size = nullptr, bool flipX = false, bool flipY = false, @@ -872,7 +872,7 @@ inline ::flatbuffers::Offset CreateWidgetOptionsDirect( const flatbuffers::FVec2 *position = nullptr, const flatbuffers::FVec2 *scale = nullptr, const flatbuffers::FVec2 *anchorPoint = nullptr, - const flatbuffers::Color *color = nullptr, + const flatbuffers::FColor *color = nullptr, const flatbuffers::FlatSize *size = nullptr, bool flipX = false, bool flipY = false, @@ -1735,8 +1735,8 @@ struct ButtonOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { int32_t fontSize() const { return GetField(VT_FONTSIZE, 0); } - const flatbuffers::Color *textColor() const { - return GetStruct(VT_TEXTCOLOR); + const flatbuffers::FColor *textColor() const { + return GetStruct(VT_TEXTCOLOR); } const flatbuffers::CapInsets *capInsets() const { return GetStruct(VT_CAPINSETS); @@ -1753,8 +1753,8 @@ struct ButtonOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool outlineEnabled() const { return GetField(VT_OUTLINEENABLED, 0) != 0; } - const flatbuffers::Color *outlineColor() const { - return GetStruct(VT_OUTLINECOLOR); + const flatbuffers::FColor *outlineColor() const { + return GetStruct(VT_OUTLINECOLOR); } int32_t outlineSize() const { return GetField(VT_OUTLINESIZE, 1); @@ -1762,8 +1762,8 @@ struct ButtonOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool shadowEnabled() const { return GetField(VT_SHADOWENABLED, 0) != 0; } - const flatbuffers::Color *shadowColor() const { - return GetStruct(VT_SHADOWCOLOR); + const flatbuffers::FColor *shadowColor() const { + return GetStruct(VT_SHADOWCOLOR); } float shadowOffsetX() const { return GetField(VT_SHADOWOFFSETX, 2.0f); @@ -1780,8 +1780,8 @@ struct ButtonOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool glowEnabled() const { return GetField(VT_GLOWENABLED, 0) != 0; } - const flatbuffers::Color *glowColor() const { - return GetStruct(VT_GLOWCOLOR); + const flatbuffers::FColor *glowColor() const { + return GetStruct(VT_GLOWCOLOR); } bool boldEnabled() const { return GetField(VT_BOLDENABLED, 0) != 0; @@ -1812,22 +1812,22 @@ struct ButtonOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyOffset(verifier, VT_FONTNAME) && verifier.VerifyString(fontName()) && VerifyField(verifier, VT_FONTSIZE, 4) && - VerifyField(verifier, VT_TEXTCOLOR, 1) && + VerifyField(verifier, VT_TEXTCOLOR, 1) && VerifyField(verifier, VT_CAPINSETS, 4) && VerifyField(verifier, VT_SCALE9SIZE, 4) && VerifyField(verifier, VT_SCALE9ENABLED, 1) && VerifyField(verifier, VT_DISPLAYSTATE, 1) && VerifyField(verifier, VT_OUTLINEENABLED, 1) && - VerifyField(verifier, VT_OUTLINECOLOR, 1) && + VerifyField(verifier, VT_OUTLINECOLOR, 1) && VerifyField(verifier, VT_OUTLINESIZE, 4) && VerifyField(verifier, VT_SHADOWENABLED, 1) && - VerifyField(verifier, VT_SHADOWCOLOR, 1) && + VerifyField(verifier, VT_SHADOWCOLOR, 1) && VerifyField(verifier, VT_SHADOWOFFSETX, 4) && VerifyField(verifier, VT_SHADOWOFFSETY, 4) && VerifyField(verifier, VT_SHADOWBLURRADIUS, 4) && VerifyField(verifier, VT_ISLOCALIZED, 1) && VerifyField(verifier, VT_GLOWENABLED, 1) && - VerifyField(verifier, VT_GLOWCOLOR, 1) && + VerifyField(verifier, VT_GLOWCOLOR, 1) && VerifyField(verifier, VT_BOLDENABLED, 1) && VerifyField(verifier, VT_UNDERLINEENABLED, 1) && VerifyField(verifier, VT_ITALICSENABLED, 1) && @@ -1864,7 +1864,7 @@ struct ButtonOptionsBuilder { void add_fontSize(int32_t fontSize) { fbb_.AddElement(ButtonOptions::VT_FONTSIZE, fontSize, 0); } - void add_textColor(const flatbuffers::Color *textColor) { + void add_textColor(const flatbuffers::FColor *textColor) { fbb_.AddStruct(ButtonOptions::VT_TEXTCOLOR, textColor); } void add_capInsets(const flatbuffers::CapInsets *capInsets) { @@ -1882,7 +1882,7 @@ struct ButtonOptionsBuilder { void add_outlineEnabled(bool outlineEnabled) { fbb_.AddElement(ButtonOptions::VT_OUTLINEENABLED, static_cast(outlineEnabled), 0); } - void add_outlineColor(const flatbuffers::Color *outlineColor) { + void add_outlineColor(const flatbuffers::FColor *outlineColor) { fbb_.AddStruct(ButtonOptions::VT_OUTLINECOLOR, outlineColor); } void add_outlineSize(int32_t outlineSize) { @@ -1891,7 +1891,7 @@ struct ButtonOptionsBuilder { void add_shadowEnabled(bool shadowEnabled) { fbb_.AddElement(ButtonOptions::VT_SHADOWENABLED, static_cast(shadowEnabled), 0); } - void add_shadowColor(const flatbuffers::Color *shadowColor) { + void add_shadowColor(const flatbuffers::FColor *shadowColor) { fbb_.AddStruct(ButtonOptions::VT_SHADOWCOLOR, shadowColor); } void add_shadowOffsetX(float shadowOffsetX) { @@ -1909,7 +1909,7 @@ struct ButtonOptionsBuilder { void add_glowEnabled(bool glowEnabled) { fbb_.AddElement(ButtonOptions::VT_GLOWENABLED, static_cast(glowEnabled), 0); } - void add_glowColor(const flatbuffers::Color *glowColor) { + void add_glowColor(const flatbuffers::FColor *glowColor) { fbb_.AddStruct(ButtonOptions::VT_GLOWCOLOR, glowColor); } void add_boldEnabled(bool boldEnabled) { @@ -1945,22 +1945,22 @@ inline ::flatbuffers::Offset CreateButtonOptions( ::flatbuffers::Offset<::flatbuffers::String> text = 0, ::flatbuffers::Offset<::flatbuffers::String> fontName = 0, int32_t fontSize = 0, - const flatbuffers::Color *textColor = nullptr, + const flatbuffers::FColor *textColor = nullptr, const flatbuffers::CapInsets *capInsets = nullptr, const flatbuffers::FlatSize *scale9Size = nullptr, bool scale9Enabled = false, bool displaystate = true, bool outlineEnabled = false, - const flatbuffers::Color *outlineColor = nullptr, + const flatbuffers::FColor *outlineColor = nullptr, int32_t outlineSize = 1, bool shadowEnabled = false, - const flatbuffers::Color *shadowColor = nullptr, + const flatbuffers::FColor *shadowColor = nullptr, float shadowOffsetX = 2.0f, float shadowOffsetY = -2.0f, int32_t shadowBlurRadius = 0, bool isLocalized = false, bool glowEnabled = false, - const flatbuffers::Color *glowColor = nullptr, + const flatbuffers::FColor *glowColor = nullptr, bool boldEnabled = false, bool underlineEnabled = false, bool italicsEnabled = false, @@ -2007,22 +2007,22 @@ inline ::flatbuffers::Offset CreateButtonOptionsDirect( const char *text = nullptr, const char *fontName = nullptr, int32_t fontSize = 0, - const flatbuffers::Color *textColor = nullptr, + const flatbuffers::FColor *textColor = nullptr, const flatbuffers::CapInsets *capInsets = nullptr, const flatbuffers::FlatSize *scale9Size = nullptr, bool scale9Enabled = false, bool displaystate = true, bool outlineEnabled = false, - const flatbuffers::Color *outlineColor = nullptr, + const flatbuffers::FColor *outlineColor = nullptr, int32_t outlineSize = 1, bool shadowEnabled = false, - const flatbuffers::Color *shadowColor = nullptr, + const flatbuffers::FColor *shadowColor = nullptr, float shadowOffsetX = 2.0f, float shadowOffsetY = -2.0f, int32_t shadowBlurRadius = 0, bool isLocalized = false, bool glowEnabled = false, - const flatbuffers::Color *glowColor = nullptr, + const flatbuffers::FColor *glowColor = nullptr, bool boldEnabled = false, bool underlineEnabled = false, bool italicsEnabled = false, @@ -2700,8 +2700,8 @@ struct TextOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool outlineEnabled() const { return GetField(VT_OUTLINEENABLED, 0) != 0; } - const flatbuffers::Color *outlineColor() const { - return GetStruct(VT_OUTLINECOLOR); + const flatbuffers::FColor *outlineColor() const { + return GetStruct(VT_OUTLINECOLOR); } int32_t outlineSize() const { return GetField(VT_OUTLINESIZE, 1); @@ -2709,8 +2709,8 @@ struct TextOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool shadowEnabled() const { return GetField(VT_SHADOWENABLED, 0) != 0; } - const flatbuffers::Color *shadowColor() const { - return GetStruct(VT_SHADOWCOLOR); + const flatbuffers::FColor *shadowColor() const { + return GetStruct(VT_SHADOWCOLOR); } float shadowOffsetX() const { return GetField(VT_SHADOWOFFSETX, 2.0f); @@ -2727,8 +2727,8 @@ struct TextOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool glowEnabled() const { return GetField(VT_GLOWENABLED, 0) != 0; } - const flatbuffers::Color *glowColor() const { - return GetStruct(VT_GLOWCOLOR); + const flatbuffers::FColor *glowColor() const { + return GetStruct(VT_GLOWCOLOR); } bool boldEnabled() const { return GetField(VT_BOLDENABLED, 0) != 0; @@ -2760,16 +2760,16 @@ struct TextOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyField(verifier, VT_TOUCHSCALEENABLE, 1) && VerifyField(verifier, VT_ISCUSTOMSIZE, 1) && VerifyField(verifier, VT_OUTLINEENABLED, 1) && - VerifyField(verifier, VT_OUTLINECOLOR, 1) && + VerifyField(verifier, VT_OUTLINECOLOR, 1) && VerifyField(verifier, VT_OUTLINESIZE, 4) && VerifyField(verifier, VT_SHADOWENABLED, 1) && - VerifyField(verifier, VT_SHADOWCOLOR, 1) && + VerifyField(verifier, VT_SHADOWCOLOR, 1) && VerifyField(verifier, VT_SHADOWOFFSETX, 4) && VerifyField(verifier, VT_SHADOWOFFSETY, 4) && VerifyField(verifier, VT_SHADOWBLURRADIUS, 4) && VerifyField(verifier, VT_ISLOCALIZED, 1) && VerifyField(verifier, VT_GLOWENABLED, 1) && - VerifyField(verifier, VT_GLOWCOLOR, 1) && + VerifyField(verifier, VT_GLOWCOLOR, 1) && VerifyField(verifier, VT_BOLDENABLED, 1) && VerifyField(verifier, VT_UNDERLINEENABLED, 1) && VerifyField(verifier, VT_ITALICSENABLED, 1) && @@ -2818,7 +2818,7 @@ struct TextOptionsBuilder { void add_outlineEnabled(bool outlineEnabled) { fbb_.AddElement(TextOptions::VT_OUTLINEENABLED, static_cast(outlineEnabled), 0); } - void add_outlineColor(const flatbuffers::Color *outlineColor) { + void add_outlineColor(const flatbuffers::FColor *outlineColor) { fbb_.AddStruct(TextOptions::VT_OUTLINECOLOR, outlineColor); } void add_outlineSize(int32_t outlineSize) { @@ -2827,7 +2827,7 @@ struct TextOptionsBuilder { void add_shadowEnabled(bool shadowEnabled) { fbb_.AddElement(TextOptions::VT_SHADOWENABLED, static_cast(shadowEnabled), 0); } - void add_shadowColor(const flatbuffers::Color *shadowColor) { + void add_shadowColor(const flatbuffers::FColor *shadowColor) { fbb_.AddStruct(TextOptions::VT_SHADOWCOLOR, shadowColor); } void add_shadowOffsetX(float shadowOffsetX) { @@ -2845,7 +2845,7 @@ struct TextOptionsBuilder { void add_glowEnabled(bool glowEnabled) { fbb_.AddElement(TextOptions::VT_GLOWENABLED, static_cast(glowEnabled), 0); } - void add_glowColor(const flatbuffers::Color *glowColor) { + void add_glowColor(const flatbuffers::FColor *glowColor) { fbb_.AddStruct(TextOptions::VT_GLOWCOLOR, glowColor); } void add_boldEnabled(bool boldEnabled) { @@ -2885,16 +2885,16 @@ inline ::flatbuffers::Offset CreateTextOptions( bool touchScaleEnable = false, bool isCustomSize = false, bool outlineEnabled = false, - const flatbuffers::Color *outlineColor = nullptr, + const flatbuffers::FColor *outlineColor = nullptr, int32_t outlineSize = 1, bool shadowEnabled = false, - const flatbuffers::Color *shadowColor = nullptr, + const flatbuffers::FColor *shadowColor = nullptr, float shadowOffsetX = 2.0f, float shadowOffsetY = -2.0f, int32_t shadowBlurRadius = 0, bool isLocalized = false, bool glowEnabled = false, - const flatbuffers::Color *glowColor = nullptr, + const flatbuffers::FColor *glowColor = nullptr, bool boldEnabled = false, bool underlineEnabled = false, bool italicsEnabled = false, @@ -2943,16 +2943,16 @@ inline ::flatbuffers::Offset CreateTextOptionsDirect( bool touchScaleEnable = false, bool isCustomSize = false, bool outlineEnabled = false, - const flatbuffers::Color *outlineColor = nullptr, + const flatbuffers::FColor *outlineColor = nullptr, int32_t outlineSize = 1, bool shadowEnabled = false, - const flatbuffers::Color *shadowColor = nullptr, + const flatbuffers::FColor *shadowColor = nullptr, float shadowOffsetX = 2.0f, float shadowOffsetY = -2.0f, int32_t shadowBlurRadius = 0, bool isLocalized = false, bool glowEnabled = false, - const flatbuffers::Color *glowColor = nullptr, + const flatbuffers::FColor *glowColor = nullptr, bool boldEnabled = false, bool underlineEnabled = false, bool italicsEnabled = false, @@ -3483,14 +3483,14 @@ struct PanelOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool clipEnabled() const { return GetField(VT_CLIPENABLED, 0) != 0; } - const flatbuffers::Color *bgColor() const { - return GetStruct(VT_BGCOLOR); + const flatbuffers::FColor *bgColor() const { + return GetStruct(VT_BGCOLOR); } - const flatbuffers::Color *bgStartColor() const { - return GetStruct(VT_BGSTARTCOLOR); + const flatbuffers::FColor *bgStartColor() const { + return GetStruct(VT_BGSTARTCOLOR); } - const flatbuffers::Color *bgEndColor() const { - return GetStruct(VT_BGENDCOLOR); + const flatbuffers::FColor *bgEndColor() const { + return GetStruct(VT_BGENDCOLOR); } int32_t colorType() const { return GetField(VT_COLORTYPE, 0); @@ -3517,9 +3517,9 @@ struct PanelOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyOffset(verifier, VT_BACKGROUNDIMAGEDATA) && verifier.VerifyTable(backGroundImageData()) && VerifyField(verifier, VT_CLIPENABLED, 1) && - VerifyField(verifier, VT_BGCOLOR, 1) && - VerifyField(verifier, VT_BGSTARTCOLOR, 1) && - VerifyField(verifier, VT_BGENDCOLOR, 1) && + VerifyField(verifier, VT_BGCOLOR, 1) && + VerifyField(verifier, VT_BGSTARTCOLOR, 1) && + VerifyField(verifier, VT_BGENDCOLOR, 1) && VerifyField(verifier, VT_COLORTYPE, 4) && VerifyField(verifier, VT_BGCOLOROPACITY, 1) && VerifyField(verifier, VT_COLORVECTOR, 4) && @@ -3543,13 +3543,13 @@ struct PanelOptionsBuilder { void add_clipEnabled(bool clipEnabled) { fbb_.AddElement(PanelOptions::VT_CLIPENABLED, static_cast(clipEnabled), 0); } - void add_bgColor(const flatbuffers::Color *bgColor) { + void add_bgColor(const flatbuffers::FColor *bgColor) { fbb_.AddStruct(PanelOptions::VT_BGCOLOR, bgColor); } - void add_bgStartColor(const flatbuffers::Color *bgStartColor) { + void add_bgStartColor(const flatbuffers::FColor *bgStartColor) { fbb_.AddStruct(PanelOptions::VT_BGSTARTCOLOR, bgStartColor); } - void add_bgEndColor(const flatbuffers::Color *bgEndColor) { + void add_bgEndColor(const flatbuffers::FColor *bgEndColor) { fbb_.AddStruct(PanelOptions::VT_BGENDCOLOR, bgEndColor); } void add_colorType(int32_t colorType) { @@ -3586,9 +3586,9 @@ inline ::flatbuffers::Offset CreatePanelOptions( ::flatbuffers::Offset widgetOptions = 0, ::flatbuffers::Offset backGroundImageData = 0, bool clipEnabled = false, - const flatbuffers::Color *bgColor = nullptr, - const flatbuffers::Color *bgStartColor = nullptr, - const flatbuffers::Color *bgEndColor = nullptr, + const flatbuffers::FColor *bgColor = nullptr, + const flatbuffers::FColor *bgStartColor = nullptr, + const flatbuffers::FColor *bgEndColor = nullptr, int32_t colorType = 0, uint8_t bgColorOpacity = 255, const flatbuffers::FVec2 *colorVector = nullptr, @@ -3642,14 +3642,14 @@ struct ScrollViewOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table bool clipEnabled() const { return GetField(VT_CLIPENABLED, 0) != 0; } - const flatbuffers::Color *bgColor() const { - return GetStruct(VT_BGCOLOR); + const flatbuffers::FColor *bgColor() const { + return GetStruct(VT_BGCOLOR); } - const flatbuffers::Color *bgStartColor() const { - return GetStruct(VT_BGSTARTCOLOR); + const flatbuffers::FColor *bgStartColor() const { + return GetStruct(VT_BGSTARTCOLOR); } - const flatbuffers::Color *bgEndColor() const { - return GetStruct(VT_BGENDCOLOR); + const flatbuffers::FColor *bgEndColor() const { + return GetStruct(VT_BGENDCOLOR); } int32_t colorType() const { return GetField(VT_COLORTYPE, 0); @@ -3694,9 +3694,9 @@ struct ScrollViewOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table VerifyOffset(verifier, VT_BACKGROUNDIMAGEDATA) && verifier.VerifyTable(backGroundImageData()) && VerifyField(verifier, VT_CLIPENABLED, 1) && - VerifyField(verifier, VT_BGCOLOR, 1) && - VerifyField(verifier, VT_BGSTARTCOLOR, 1) && - VerifyField(verifier, VT_BGENDCOLOR, 1) && + VerifyField(verifier, VT_BGCOLOR, 1) && + VerifyField(verifier, VT_BGSTARTCOLOR, 1) && + VerifyField(verifier, VT_BGENDCOLOR, 1) && VerifyField(verifier, VT_COLORTYPE, 4) && VerifyField(verifier, VT_BGCOLOROPACITY, 1) && VerifyField(verifier, VT_COLORVECTOR, 4) && @@ -3726,13 +3726,13 @@ struct ScrollViewOptionsBuilder { void add_clipEnabled(bool clipEnabled) { fbb_.AddElement(ScrollViewOptions::VT_CLIPENABLED, static_cast(clipEnabled), 0); } - void add_bgColor(const flatbuffers::Color *bgColor) { + void add_bgColor(const flatbuffers::FColor *bgColor) { fbb_.AddStruct(ScrollViewOptions::VT_BGCOLOR, bgColor); } - void add_bgStartColor(const flatbuffers::Color *bgStartColor) { + void add_bgStartColor(const flatbuffers::FColor *bgStartColor) { fbb_.AddStruct(ScrollViewOptions::VT_BGSTARTCOLOR, bgStartColor); } - void add_bgEndColor(const flatbuffers::Color *bgEndColor) { + void add_bgEndColor(const flatbuffers::FColor *bgEndColor) { fbb_.AddStruct(ScrollViewOptions::VT_BGENDCOLOR, bgEndColor); } void add_colorType(int32_t colorType) { @@ -3787,9 +3787,9 @@ inline ::flatbuffers::Offset CreateScrollViewOptions( ::flatbuffers::Offset widgetOptions = 0, ::flatbuffers::Offset backGroundImageData = 0, bool clipEnabled = false, - const flatbuffers::Color *bgColor = nullptr, - const flatbuffers::Color *bgStartColor = nullptr, - const flatbuffers::Color *bgEndColor = nullptr, + const flatbuffers::FColor *bgColor = nullptr, + const flatbuffers::FColor *bgStartColor = nullptr, + const flatbuffers::FColor *bgEndColor = nullptr, int32_t colorType = 0, uint8_t bgColorOpacity = 255, const flatbuffers::FVec2 *colorVector = nullptr, @@ -3849,14 +3849,14 @@ struct PageViewOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool clipEnabled() const { return GetField(VT_CLIPENABLED, 0) != 0; } - const flatbuffers::Color *bgColor() const { - return GetStruct(VT_BGCOLOR); + const flatbuffers::FColor *bgColor() const { + return GetStruct(VT_BGCOLOR); } - const flatbuffers::Color *bgStartColor() const { - return GetStruct(VT_BGSTARTCOLOR); + const flatbuffers::FColor *bgStartColor() const { + return GetStruct(VT_BGSTARTCOLOR); } - const flatbuffers::Color *bgEndColor() const { - return GetStruct(VT_BGENDCOLOR); + const flatbuffers::FColor *bgEndColor() const { + return GetStruct(VT_BGENDCOLOR); } int32_t colorType() const { return GetField(VT_COLORTYPE, 0); @@ -3883,9 +3883,9 @@ struct PageViewOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyOffset(verifier, VT_BACKGROUNDIMAGEDATA) && verifier.VerifyTable(backGroundImageData()) && VerifyField(verifier, VT_CLIPENABLED, 1) && - VerifyField(verifier, VT_BGCOLOR, 1) && - VerifyField(verifier, VT_BGSTARTCOLOR, 1) && - VerifyField(verifier, VT_BGENDCOLOR, 1) && + VerifyField(verifier, VT_BGCOLOR, 1) && + VerifyField(verifier, VT_BGSTARTCOLOR, 1) && + VerifyField(verifier, VT_BGENDCOLOR, 1) && VerifyField(verifier, VT_COLORTYPE, 4) && VerifyField(verifier, VT_BGCOLOROPACITY, 1) && VerifyField(verifier, VT_COLORVECTOR, 4) && @@ -3909,13 +3909,13 @@ struct PageViewOptionsBuilder { void add_clipEnabled(bool clipEnabled) { fbb_.AddElement(PageViewOptions::VT_CLIPENABLED, static_cast(clipEnabled), 0); } - void add_bgColor(const flatbuffers::Color *bgColor) { + void add_bgColor(const flatbuffers::FColor *bgColor) { fbb_.AddStruct(PageViewOptions::VT_BGCOLOR, bgColor); } - void add_bgStartColor(const flatbuffers::Color *bgStartColor) { + void add_bgStartColor(const flatbuffers::FColor *bgStartColor) { fbb_.AddStruct(PageViewOptions::VT_BGSTARTCOLOR, bgStartColor); } - void add_bgEndColor(const flatbuffers::Color *bgEndColor) { + void add_bgEndColor(const flatbuffers::FColor *bgEndColor) { fbb_.AddStruct(PageViewOptions::VT_BGENDCOLOR, bgEndColor); } void add_colorType(int32_t colorType) { @@ -3952,9 +3952,9 @@ inline ::flatbuffers::Offset CreatePageViewOptions( ::flatbuffers::Offset widgetOptions = 0, ::flatbuffers::Offset backGroundImageData = 0, bool clipEnabled = false, - const flatbuffers::Color *bgColor = nullptr, - const flatbuffers::Color *bgStartColor = nullptr, - const flatbuffers::Color *bgEndColor = nullptr, + const flatbuffers::FColor *bgColor = nullptr, + const flatbuffers::FColor *bgStartColor = nullptr, + const flatbuffers::FColor *bgEndColor = nullptr, int32_t colorType = 0, uint8_t bgColorOpacity = 255, const flatbuffers::FVec2 *colorVector = nullptr, @@ -4009,14 +4009,14 @@ struct ListViewOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool clipEnabled() const { return GetField(VT_CLIPENABLED, 0) != 0; } - const flatbuffers::Color *bgColor() const { - return GetStruct(VT_BGCOLOR); + const flatbuffers::FColor *bgColor() const { + return GetStruct(VT_BGCOLOR); } - const flatbuffers::Color *bgStartColor() const { - return GetStruct(VT_BGSTARTCOLOR); + const flatbuffers::FColor *bgStartColor() const { + return GetStruct(VT_BGSTARTCOLOR); } - const flatbuffers::Color *bgEndColor() const { - return GetStruct(VT_BGENDCOLOR); + const flatbuffers::FColor *bgEndColor() const { + return GetStruct(VT_BGENDCOLOR); } int32_t colorType() const { return GetField(VT_COLORTYPE, 0); @@ -4064,9 +4064,9 @@ struct ListViewOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyOffset(verifier, VT_BACKGROUNDIMAGEDATA) && verifier.VerifyTable(backGroundImageData()) && VerifyField(verifier, VT_CLIPENABLED, 1) && - VerifyField(verifier, VT_BGCOLOR, 1) && - VerifyField(verifier, VT_BGSTARTCOLOR, 1) && - VerifyField(verifier, VT_BGENDCOLOR, 1) && + VerifyField(verifier, VT_BGCOLOR, 1) && + VerifyField(verifier, VT_BGSTARTCOLOR, 1) && + VerifyField(verifier, VT_BGENDCOLOR, 1) && VerifyField(verifier, VT_COLORTYPE, 4) && VerifyField(verifier, VT_BGCOLOROPACITY, 1) && VerifyField(verifier, VT_COLORVECTOR, 4) && @@ -4100,13 +4100,13 @@ struct ListViewOptionsBuilder { void add_clipEnabled(bool clipEnabled) { fbb_.AddElement(ListViewOptions::VT_CLIPENABLED, static_cast(clipEnabled), 0); } - void add_bgColor(const flatbuffers::Color *bgColor) { + void add_bgColor(const flatbuffers::FColor *bgColor) { fbb_.AddStruct(ListViewOptions::VT_BGCOLOR, bgColor); } - void add_bgStartColor(const flatbuffers::Color *bgStartColor) { + void add_bgStartColor(const flatbuffers::FColor *bgStartColor) { fbb_.AddStruct(ListViewOptions::VT_BGSTARTCOLOR, bgStartColor); } - void add_bgEndColor(const flatbuffers::Color *bgEndColor) { + void add_bgEndColor(const flatbuffers::FColor *bgEndColor) { fbb_.AddStruct(ListViewOptions::VT_BGENDCOLOR, bgEndColor); } void add_colorType(int32_t colorType) { @@ -4164,9 +4164,9 @@ inline ::flatbuffers::Offset CreateListViewOptions( ::flatbuffers::Offset widgetOptions = 0, ::flatbuffers::Offset backGroundImageData = 0, bool clipEnabled = false, - const flatbuffers::Color *bgColor = nullptr, - const flatbuffers::Color *bgStartColor = nullptr, - const flatbuffers::Color *bgEndColor = nullptr, + const flatbuffers::FColor *bgColor = nullptr, + const flatbuffers::FColor *bgStartColor = nullptr, + const flatbuffers::FColor *bgEndColor = nullptr, int32_t colorType = 0, uint8_t bgColorOpacity = 255, const flatbuffers::FVec2 *colorVector = nullptr, @@ -4208,9 +4208,9 @@ inline ::flatbuffers::Offset CreateListViewOptionsDirect( ::flatbuffers::Offset widgetOptions = 0, ::flatbuffers::Offset backGroundImageData = 0, bool clipEnabled = false, - const flatbuffers::Color *bgColor = nullptr, - const flatbuffers::Color *bgStartColor = nullptr, - const flatbuffers::Color *bgEndColor = nullptr, + const flatbuffers::FColor *bgColor = nullptr, + const flatbuffers::FColor *bgStartColor = nullptr, + const flatbuffers::FColor *bgEndColor = nullptr, int32_t colorType = 0, uint8_t bgColorOpacity = 255, const flatbuffers::FVec2 *colorVector = nullptr, @@ -4296,14 +4296,14 @@ struct TextFieldExOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table int32_t maxLength() const { return GetField(VT_MAXLENGTH, 0); } - const flatbuffers::Color *textColor() const { - return GetStruct(VT_TEXTCOLOR); + const flatbuffers::FColor *textColor() const { + return GetStruct(VT_TEXTCOLOR); } - const flatbuffers::Color *placeholderColor() const { - return GetStruct(VT_PLACEHOLDERCOLOR); + const flatbuffers::FColor *placeholderColor() const { + return GetStruct(VT_PLACEHOLDERCOLOR); } - const flatbuffers::Color *cursorColor() const { - return GetStruct(VT_CURSORCOLOR); + const flatbuffers::FColor *cursorColor() const { + return GetStruct(VT_CURSORCOLOR); } bool enabled() const { return GetField(VT_ENABLED, 1) != 0; @@ -4331,9 +4331,9 @@ struct TextFieldExOptions FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table VerifyOffset(verifier, VT_PASSWORDSTYLETEXT) && verifier.VerifyString(passwordStyleText()) && VerifyField(verifier, VT_MAXLENGTH, 4) && - VerifyField(verifier, VT_TEXTCOLOR, 1) && - VerifyField(verifier, VT_PLACEHOLDERCOLOR, 1) && - VerifyField(verifier, VT_CURSORCOLOR, 1) && + VerifyField(verifier, VT_TEXTCOLOR, 1) && + VerifyField(verifier, VT_PLACEHOLDERCOLOR, 1) && + VerifyField(verifier, VT_CURSORCOLOR, 1) && VerifyField(verifier, VT_ENABLED, 1) && VerifyField(verifier, VT_EDITABLE, 1) && VerifyField(verifier, VT_ISLOCALIZED, 1) && @@ -4372,13 +4372,13 @@ struct TextFieldExOptionsBuilder { void add_maxLength(int32_t maxLength) { fbb_.AddElement(TextFieldExOptions::VT_MAXLENGTH, maxLength, 0); } - void add_textColor(const flatbuffers::Color *textColor) { + void add_textColor(const flatbuffers::FColor *textColor) { fbb_.AddStruct(TextFieldExOptions::VT_TEXTCOLOR, textColor); } - void add_placeholderColor(const flatbuffers::Color *placeholderColor) { + void add_placeholderColor(const flatbuffers::FColor *placeholderColor) { fbb_.AddStruct(TextFieldExOptions::VT_PLACEHOLDERCOLOR, placeholderColor); } - void add_cursorColor(const flatbuffers::Color *cursorColor) { + void add_cursorColor(const flatbuffers::FColor *cursorColor) { fbb_.AddStruct(TextFieldExOptions::VT_CURSORCOLOR, cursorColor); } void add_enabled(bool enabled) { @@ -4412,9 +4412,9 @@ inline ::flatbuffers::Offset CreateTextFieldExOptions( bool passwordEnabled = false, ::flatbuffers::Offset<::flatbuffers::String> passwordStyleText = 0, int32_t maxLength = 0, - const flatbuffers::Color *textColor = nullptr, - const flatbuffers::Color *placeholderColor = nullptr, - const flatbuffers::Color *cursorColor = nullptr, + const flatbuffers::FColor *textColor = nullptr, + const flatbuffers::FColor *placeholderColor = nullptr, + const flatbuffers::FColor *cursorColor = nullptr, bool enabled = true, bool editable = true, bool isLocalized = false) { @@ -4448,9 +4448,9 @@ inline ::flatbuffers::Offset CreateTextFieldExOptionsDirect( bool passwordEnabled = false, const char *passwordStyleText = nullptr, int32_t maxLength = 0, - const flatbuffers::Color *textColor = nullptr, - const flatbuffers::Color *placeholderColor = nullptr, - const flatbuffers::Color *cursorColor = nullptr, + const flatbuffers::FColor *textColor = nullptr, + const flatbuffers::FColor *placeholderColor = nullptr, + const flatbuffers::FColor *cursorColor = nullptr, bool enabled = true, bool editable = true, bool isLocalized = false) { @@ -5274,8 +5274,8 @@ struct ColorFrame FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { bool tween() const { return GetField(VT_TWEEN, 1) != 0; } - const flatbuffers::Color *color() const { - return GetStruct(VT_COLOR); + const flatbuffers::FColor *color() const { + return GetStruct(VT_COLOR); } const flatbuffers::EasingData *easingData() const { return GetPointer(VT_EASINGDATA); @@ -5284,7 +5284,7 @@ struct ColorFrame FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { return VerifyTableStart(verifier) && VerifyField(verifier, VT_FRAMEINDEX, 4) && VerifyField(verifier, VT_TWEEN, 1) && - VerifyField(verifier, VT_COLOR, 1) && + VerifyField(verifier, VT_COLOR, 1) && VerifyOffset(verifier, VT_EASINGDATA) && verifier.VerifyTable(easingData()) && verifier.EndTable(); @@ -5301,7 +5301,7 @@ struct ColorFrameBuilder { void add_tween(bool tween) { fbb_.AddElement(ColorFrame::VT_TWEEN, static_cast(tween), 1); } - void add_color(const flatbuffers::Color *color) { + void add_color(const flatbuffers::FColor *color) { fbb_.AddStruct(ColorFrame::VT_COLOR, color); } void add_easingData(::flatbuffers::Offset easingData) { @@ -5322,7 +5322,7 @@ inline ::flatbuffers::Offset CreateColorFrame( ::flatbuffers::FlatBufferBuilder &_fbb, int32_t frameIndex = 0, bool tween = true, - const flatbuffers::Color *color = nullptr, + const flatbuffers::FColor *color = nullptr, ::flatbuffers::Offset easingData = 0) { ColorFrameBuilder builder_(_fbb); builder_.add_easingData(easingData); diff --git a/extensions/cocostudio/src/cocostudio/FlatBuffersSerialize.cpp b/extensions/cocostudio/src/cocostudio/FlatBuffersSerialize.cpp index d08c6fdf216c..83eccf7daced 100644 --- a/extensions/cocostudio/src/cocostudio/FlatBuffersSerialize.cpp +++ b/extensions/cocostudio/src/cocostudio/FlatBuffersSerialize.cpp @@ -902,7 +902,7 @@ Offset FlatBuffersSerialize::createColorFrame(pugi::xml child = child.next_sibling(); } - Color f_color(255, color.r, color.g, color.b); + FColor f_color(255, color.r, color.g, color.b); return CreateColorFrame(*_builder, frameIndex, tween, &f_color, createEasingData(objectData.first_child())); } diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp index b33a32516e1e..60bee16ff977 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp @@ -638,12 +638,12 @@ Offset ButtonReader::createOptionsWithFlatBuffers(pugi::xml_node objectDa child = child.next_sibling(); } - Color f_textColor(255, textColor.r, textColor.g, textColor.b); + FColor f_textColor(255, textColor.r, textColor.g, textColor.b); CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); FlatSize f_scale9Size(scale9Size.width, scale9Size.height); - flatbuffers::Color f_outlineColor(outlineColor.a, outlineColor.r, outlineColor.g, outlineColor.b); - flatbuffers::Color f_shadowColor(shadowColor.a, shadowColor.r, shadowColor.g, shadowColor.b); - flatbuffers::Color f_glowColor(glowColor.a, glowColor.r, glowColor.g, glowColor.b); + FColor f_outlineColor(outlineColor.a, outlineColor.r, outlineColor.g, outlineColor.b); + FColor f_shadowColor(shadowColor.a, shadowColor.r, shadowColor.g, shadowColor.b); + FColor f_glowColor(glowColor.a, glowColor.r, glowColor.g, glowColor.b); auto options = CreateButtonOptions( *builder, widgetOptions, diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index 93674cd8c7f9..b10c251ebaae 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -525,9 +525,9 @@ Offset
LayoutReader::createOptionsWithFlatBuffers(pugi::xml_node objectDa child = child.next_sibling(); } - Color f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); - Color f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); - Color f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); + FColor f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); + FColor f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); + FColor f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); FVec2 f_colorVector(colorVector.x, colorVector.y); CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); FlatSize f_scale9Size(scale9Size.width, scale9Size.height); diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp index a1a097eefdcd..22472548fa65 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp @@ -362,9 +362,9 @@ Offset
ListViewReader::createOptionsWithFlatBuffers(pugi::xml_node object child = child.next_sibling(); } - Color f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); - Color f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); - Color f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); + FColor f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); + FColor f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); + FColor f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); FVec2 f_colorVector(colorVector.x, colorVector.y); CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); FlatSize f_scale9Size(scale9Size.width, scale9Size.height); diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp index a4a48f24d37d..9ebc6c12abbc 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp @@ -253,7 +253,7 @@ Offset
Node3DReader::createOptionsWithFlatBuffersForNode(pugi::xml_node o FVec2 f_position(position.x, position.y); FVec2 f_scale(scale.x, scale.y); FVec2 f_anchortpoint(anchorPoint.x, anchorPoint.y); - Color f_color(color.a, color.r, color.g, color.b); + FColor f_color(color.a, color.r, color.g, color.b); FlatSize f_size(size.x, size.y); auto f_layoutComponent = CreateLayoutComponentTable( *builder, positionXPercentEnabled, positionYPercentEnabled, positionXPercent, positionYPercent, diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/NodeReader/NodeReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/NodeReader/NodeReader.cpp index ac5bc8b64240..f929f262a0ef 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/NodeReader/NodeReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/NodeReader/NodeReader.cpp @@ -414,7 +414,7 @@ Offset
NodeReader::createOptionsWithFlatBuffers(pugi::xml_node objectData FVec2 f_position(position.x, position.y); FVec2 f_scale(scale.x, scale.y); FVec2 f_anchortpoint(anchorPoint.x, anchorPoint.y); - Color f_color(color.a, color.r, color.g, color.b); + FColor f_color(color.a, color.r, color.g, color.b); FlatSize f_size(size.x, size.y); auto f_layoutComponent = CreateLayoutComponentTable( *builder, positionXPercentEnabled, positionYPercentEnabled, positionXPercent, positionYPercent, diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp index 1fc875b34591..8fcb3d789b93 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp @@ -278,9 +278,9 @@ Offset
PageViewReader::createOptionsWithFlatBuffers(pugi::xml_node object child = child.next_sibling(); } - Color f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); - Color f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); - Color f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); + FColor f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); + FColor f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); + FColor f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); FVec2 f_colorVector(colorVector.x, colorVector.y); CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); FlatSize f_scale9Size(scale9Size.width, scale9Size.height); diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp index 9eb164cae59b..f08a61057223 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp @@ -375,9 +375,9 @@ Offset
ScrollViewReader::createOptionsWithFlatBuffers(pugi::xml_node obje child = child.next_sibling(); } - Color f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); - Color f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); - Color f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); + FColor f_bgColor(255, bgColor.r, bgColor.g, bgColor.b); + FColor f_bgStartColor(255, bgStartColor.r, bgStartColor.g, bgStartColor.b); + FColor f_bgEndColor(255, bgEndColor.r, bgEndColor.g, bgEndColor.b); FVec2 f_colorVector(colorVector.x, colorVector.y); CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); FlatSize f_scale9Size(scale9Size.width, scale9Size.height); diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/CSTabControl_generated.h b/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/CSTabControl_generated.h index 87641ed82b63..668d6d5be258 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/CSTabControl_generated.h +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/CSTabControl_generated.h @@ -189,8 +189,8 @@ struct TabHeaderOption FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { const ::flatbuffers::String *titleText() const { return GetPointer(VT_TITLETEXT); } - const flatbuffers::Color *textColor() const { - return GetStruct(VT_TEXTCOLOR); + const flatbuffers::FColor *textColor() const { + return GetStruct(VT_TEXTCOLOR); } const flatbuffers::ResourceData *normalBackFile() const { return GetPointer(VT_NORMALBACKFILE); @@ -216,7 +216,7 @@ struct TabHeaderOption FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyField(verifier, VT_FONTSIZE, 4) && VerifyOffset(verifier, VT_TITLETEXT) && verifier.VerifyString(titleText()) && - VerifyField(verifier, VT_TEXTCOLOR, 1) && + VerifyField(verifier, VT_TEXTCOLOR, 1) && VerifyOffset(verifier, VT_NORMALBACKFILE) && verifier.VerifyTable(normalBackFile()) && VerifyOffset(verifier, VT_PRESSBACKFILE) && @@ -247,7 +247,7 @@ struct TabHeaderOptionBuilder { void add_titleText(::flatbuffers::Offset<::flatbuffers::String> titleText) { fbb_.AddOffset(TabHeaderOption::VT_TITLETEXT, titleText); } - void add_textColor(const flatbuffers::Color *textColor) { + void add_textColor(const flatbuffers::FColor *textColor) { fbb_.AddStruct(TabHeaderOption::VT_TEXTCOLOR, textColor); } void add_normalBackFile(::flatbuffers::Offset normalBackFile) { @@ -282,7 +282,7 @@ inline ::flatbuffers::Offset CreateTabHeaderOption( ::flatbuffers::Offset fontRes = 0, int32_t fontSize = 0, ::flatbuffers::Offset<::flatbuffers::String> titleText = 0, - const flatbuffers::Color *textColor = nullptr, + const flatbuffers::FColor *textColor = nullptr, ::flatbuffers::Offset normalBackFile = 0, ::flatbuffers::Offset pressBackFile = 0, ::flatbuffers::Offset disableBackFile = 0, @@ -308,7 +308,7 @@ inline ::flatbuffers::Offset CreateTabHeaderOptionDirect( ::flatbuffers::Offset fontRes = 0, int32_t fontSize = 0, const char *titleText = nullptr, - const flatbuffers::Color *textColor = nullptr, + const flatbuffers::FColor *textColor = nullptr, ::flatbuffers::Offset normalBackFile = 0, ::flatbuffers::Offset pressBackFile = 0, ::flatbuffers::Offset disableBackFile = 0, diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp index 7d21abe6fa5d..0d699e750482 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp @@ -505,7 +505,7 @@ flatbuffers::Offset TabHeaderReader::createOptionsWithFlatBu child = child.next_sibling(); } - Color f_textColor(255, textColor.r, textColor.g, textColor.b); + FColor f_textColor(255, textColor.r, textColor.g, textColor.b); auto option = CreateTabHeaderOption( *builder, nodeOptions, CreateResourceData(*builder, builder->CreateString(fontResourcePath), diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/TextFieldReader/TextFieldExReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/TextFieldReader/TextFieldExReader.cpp index b1b84cfca6da..4286d86db747 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/TextFieldReader/TextFieldExReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/TextFieldReader/TextFieldExReader.cpp @@ -16,12 +16,12 @@ using namespace ax; using namespace ui; using namespace flatbuffers; -inline Color4B Color4BFromFb(const flatbuffers::Color* pColor) +inline Color4B Color4BFromFb(const flatbuffers::FColor* pColor) { return Color4B(pColor->r(), pColor->g(), pColor->b(), pColor->a()); } -inline Color3B Color3BFromFb(const flatbuffers::Color* pColor) +inline Color3B Color3BFromFb(const flatbuffers::FColor* pColor) { return Color3B(pColor->r(), pColor->g(), pColor->b()); } @@ -259,9 +259,9 @@ Offset
TextFieldExReader::createOptionsWithFlatBuffers(pugi::xml_node obj child = child.next_sibling(); } - Color f_textColor(textColor.a, textColor.r, textColor.g, textColor.b); - Color f_placeholderColor(placeholderColor.a, placeholderColor.r, placeholderColor.g, placeholderColor.b); - Color f_cursorColor(255, cursorColor.r, cursorColor.g, cursorColor.b); + FColor f_textColor(textColor.a, textColor.r, textColor.g, textColor.b); + FColor f_placeholderColor(placeholderColor.a, placeholderColor.r, placeholderColor.g, placeholderColor.b); + FColor f_cursorColor(255, cursorColor.r, cursorColor.g, cursorColor.b); auto options = CreateTextFieldExOptions( *builder, widgetOptions, CreateResourceData(*builder, builder->CreateString(path), builder->CreateString(plistFile), resourceType), diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/TextReader/TextReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/TextReader/TextReader.cpp index 9e921d10e167..ad096b02d489 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/TextReader/TextReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/TextReader/TextReader.cpp @@ -413,9 +413,9 @@ Offset
TextReader::createOptionsWithFlatBuffers(pugi::xml_node objectData child = child.next_sibling(); } - flatbuffers::Color f_outlineColor(outlineColor.a, outlineColor.r, outlineColor.g, outlineColor.b); - flatbuffers::Color f_shadowColor(shadowColor.a, shadowColor.r, shadowColor.g, shadowColor.b); - flatbuffers::Color f_glowColor(glowColor.a, glowColor.r, glowColor.g, glowColor.b); + FColor f_outlineColor(outlineColor.a, outlineColor.r, outlineColor.g, outlineColor.b); + FColor f_shadowColor(shadowColor.a, shadowColor.r, shadowColor.g, shadowColor.b); + FColor f_glowColor(glowColor.a, glowColor.r, glowColor.g, glowColor.b); auto options = CreateTextOptions( *builder, widgetOptions, diff --git a/extensions/cocostudio/src/cocostudio/WidgetReader/WidgetReader.cpp b/extensions/cocostudio/src/cocostudio/WidgetReader/WidgetReader.cpp index 482ae971d469..41dcb3066eb2 100644 --- a/extensions/cocostudio/src/cocostudio/WidgetReader/WidgetReader.cpp +++ b/extensions/cocostudio/src/cocostudio/WidgetReader/WidgetReader.cpp @@ -751,7 +751,7 @@ Offset
WidgetReader::createOptionsWithFlatBuffers(pugi::xml_node objectDa FVec2 f_position(position.x, position.y); FVec2 f_scale(scale.x, scale.y); FVec2 f_anchortpoint(anchorPoint.x, anchorPoint.y); - Color f_color(color.a, color.r, color.g, color.b); + FColor f_color(color.a, color.r, color.g, color.b); FlatSize f_size(size.x, size.y); auto f_layoutComponent = CreateLayoutComponentTable( *builder, positionXPercentEnabled, positionYPercentEnabled, positionXPercent, positionYPercent, diff --git a/extensions/fairygui/src/fairygui/GGraph.cpp b/extensions/fairygui/src/fairygui/GGraph.cpp index d2223dbc188b..ee5fdf5a6d23 100644 --- a/extensions/fairygui/src/fairygui/GGraph.cpp +++ b/extensions/fairygui/src/fairygui/GGraph.cpp @@ -5,7 +5,7 @@ NS_FGUI_BEGIN using namespace ax; -static void drawVertRect(ax::DrawNode* shape, float x, float y, float width, float height, const ax::Color4B& color) +static void drawVertRect(ax::DrawNode* shape, float x, float y, float width, float height, const ax::Color& color) { float mx = x + width; float my = y + height; @@ -40,7 +40,7 @@ void GGraph::handleInit() _displayObject = _shape; } -void GGraph::drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor) +void GGraph::drawRect(float aWidth, float aHeight, int lineSize, const ax::Color& lineColor, const ax::Color& fillColor) { _type = 0; //avoid updateshape call in handleSizeChange setSize(aWidth, aHeight); @@ -51,7 +51,7 @@ void GGraph::drawRect(float aWidth, float aHeight, int lineSize, const ax::Color updateShape(); } -void GGraph::drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor) +void GGraph::drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color& lineColor, const ax::Color& fillColor) { _type = 0; //avoid updateshape call in handleSizeChange setSize(aWidth, aHeight); @@ -62,7 +62,7 @@ void GGraph::drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Co updateShape(); } -void GGraph::drawPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, const ax::Vec2* points, int count) +void GGraph::drawPolygon(int lineSize, const ax::Color& lineColor, const ax::Color& fillColor, const ax::Vec2* points, int count) { _type = 3; _lineSize = lineSize; @@ -83,7 +83,7 @@ void GGraph::drawPolygon(int lineSize, const ax::Color4B& lineColor, const ax::C updateShape(); } -void GGraph::drawRegularPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, +void GGraph::drawRegularPolygon(int lineSize, const ax::Color& lineColor, const ax::Color& fillColor, int sides, float startAngle, const float* distances, int count) { _type = 4; @@ -189,7 +189,7 @@ ax::Color3B GGraph::getColor() const void GGraph::setColor(const ax::Color3B& value) { - _fillColor = Color4B(value, _fillColor.a); + _fillColor = ax::Color{value, _fillColor.a}; updateShape(); } @@ -247,8 +247,8 @@ void GGraph::setup_beforeAdd(ByteBuffer* buffer, int beginPos) if (_type != 0) { _lineSize = buffer->readInt(); - _lineColor = (Color4B)buffer->readColor(); - _fillColor = (Color4B)buffer->readColor(); + _lineColor = ax::Color{buffer->readColor()}; + _fillColor = ax::Color{buffer->readColor()}; if (buffer->readBool()) { _cornerRadius = new float[4]; diff --git a/extensions/fairygui/src/fairygui/GGraph.h b/extensions/fairygui/src/fairygui/GGraph.h index d2dc512690be..4906d18b0ec4 100644 --- a/extensions/fairygui/src/fairygui/GGraph.h +++ b/extensions/fairygui/src/fairygui/GGraph.h @@ -15,10 +15,10 @@ class GGraph : public GObject CREATE_FUNC(GGraph); - void drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor); - void drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor); - void drawPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, const ax::Vec2* points, int count); - void drawRegularPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, int sides, float startAngle = 0, const float* distances = nullptr, int distanceCount = 0); + void drawRect(float aWidth, float aHeight, int lineSize, const ax::Color& lineColor, const ax::Color& fillColor); + void drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color& lineColor, const ax::Color& fillColor); + void drawPolygon(int lineSize, const ax::Color& lineColor, const ax::Color& fillColor, const ax::Vec2* points, int count); + void drawRegularPolygon(int lineSize, const ax::Color& lineColor, const ax::Color& fillColor, int sides, float startAngle = 0, const float* distances = nullptr, int distanceCount = 0); bool isEmpty() const { return _type == 0; } ax::Color3B getColor() const; @@ -36,8 +36,8 @@ class GGraph : public GObject void updateShape(); int _type; - ax::Color4B _lineColor; - ax::Color4B _fillColor; + ax::Color _lineColor; + ax::Color _fillColor; int _lineSize; float* _cornerRadius; std::vector* _polygonPoints; diff --git a/extensions/fairygui/src/fairygui/display/FUISprite.cpp b/extensions/fairygui/src/fairygui/display/FUISprite.cpp index e7b2badeadd9..76cf3f16165c 100644 --- a/extensions/fairygui/src/fairygui/display/FUISprite.cpp +++ b/extensions/fairygui/src/fairygui/display/FUISprite.cpp @@ -193,7 +193,7 @@ Tex2F FUISprite::textureCoordFromAlphaPoint(Vec2 alpha) { Tex2F ret(0.0f, 0.0f); - V3F_C4B_T2F_Quad quad = getQuad(); + V3F_C4F_T2F_Quad quad = getQuad(); Vec2 min(quad.bl.texCoords.u, quad.bl.texCoords.v); Vec2 max(quad.tr.texCoords.u, quad.tr.texCoords.v); // Fix bug #1303 so that progress timer handles sprite frame texture rotation @@ -208,7 +208,7 @@ Vec3 FUISprite::vertexFromAlphaPoint(Vec2 alpha) { Vec3 ret(0.0f, 0.0f, 0.0f); - V3F_C4B_T2F_Quad quad = getQuad(); + V3F_C4F_T2F_Quad quad = getQuad(); Vec2 min(quad.bl.vertices.x, quad.bl.vertices.y); Vec2 max(quad.tr.vertices.x, quad.tr.vertices.y); ret.x = min.x * (1.f - alpha.x) + max.x * alpha.x; @@ -222,7 +222,7 @@ void FUISprite::updateColor(void) if (_vertexData) { - Color4B sc = getQuad().tl.colors; + Color sc = getQuad().tl.colors; for (int i = 0; i < _vertexDataCount; ++i) { _vertexData[i].colors = sc; @@ -344,7 +344,7 @@ void FUISprite::updateRadial(void) { _vertexDataCount = index + 3; triangleCount = _vertexDataCount - 2; - _vertexData = (V3F_C4B_T2F*)malloc(_vertexDataCount * sizeof(*_vertexData)); + _vertexData = (V3F_C4F_T2F*)malloc(_vertexDataCount * sizeof(*_vertexData)); _vertexIndex = (unsigned short *)malloc(triangleCount * 3 * sizeof(*_vertexIndex)); AXASSERT(_vertexData, "FUISprite. Not enough memory"); } @@ -433,7 +433,7 @@ void FUISprite::updateBar(void) if (!_vertexData) { _vertexDataCount = 4; - _vertexData = (V3F_C4B_T2F*)malloc(_vertexDataCount * sizeof(*_vertexData)); + _vertexData = (V3F_C4F_T2F*)malloc(_vertexDataCount * sizeof(*_vertexData)); _vertexIndex = (unsigned short*)malloc(6 * sizeof(*_vertexIndex)); AXASSERT(_vertexData, "FUISprite. Not enough memory"); } diff --git a/extensions/fairygui/src/fairygui/display/FUISprite.h b/extensions/fairygui/src/fairygui/display/FUISprite.h index 6755c070309a..e1a540f541d3 100644 --- a/extensions/fairygui/src/fairygui/display/FUISprite.h +++ b/extensions/fairygui/src/fairygui/display/FUISprite.h @@ -55,7 +55,7 @@ class FUISprite : public ax::Sprite bool _scaleByTile; int _vertexDataCount; ax::TrianglesCommand::Triangles _fillTriangles; - ax::V3F_C4B_T2F *_vertexData; + ax::V3F_C4F_T2F *_vertexData; unsigned short *_vertexIndex; static ax::Texture2D* _empty; diff --git a/extensions/scripting/lua-bindings/auto/axlua_base_auto.cpp b/extensions/scripting/lua-bindings/auto/axlua_base_auto.cpp index 98492d0a7356..56556b86eaae 100644 --- a/extensions/scripting/lua-bindings/auto/axlua_base_auto.cpp +++ b/extensions/scripting/lua-bindings/auto/axlua_base_auto.cpp @@ -21064,9 +21064,9 @@ int lua_ax_base_PolygonInfo_setQuad(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - ax::V3F_C4B_T2F_Quad* arg0; + ax::V3F_C4F_T2F_Quad* arg0; - #pragma warning NO CONVERSION TO NATIVE FOR V3F_C4B_T2F_Quad* + #pragma warning NO CONVERSION TO NATIVE FOR V3F_C4F_T2F_Quad* ok = false; if(!ok) { @@ -21115,10 +21115,10 @@ int lua_ax_base_PolygonInfo_setQuads(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 2) { - ax::V3F_C4B_T2F_Quad* arg0; + ax::V3F_C4F_T2F_Quad* arg0; int arg1; - #pragma warning NO CONVERSION TO NATIVE FOR V3F_C4B_T2F_Quad* + #pragma warning NO CONVERSION TO NATIVE FOR V3F_C4F_T2F_Quad* ok = false; ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ax.PolygonInfo:setQuads"); diff --git a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp index ccf907b6f733..1042fcaeec65 100644 --- a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -1885,7 +1885,7 @@ bool luaval_to_tex2f(lua_State* L, int lo, ax::Tex2F* outValue, const char* func return ok; } -bool luaval_to_v3f_c4b_t2f(lua_State* L, int lo, ax::V3F_C4B_T2F* outValue, const char* funcName) +bool luaval_to_v3f_c4b_t2f(lua_State* L, int lo, ax::V3F_C4F_T2F* outValue, const char* funcName) { if (nullptr == L || nullptr == outValue) return false; @@ -2040,7 +2040,7 @@ bool luaval_to_std_vector_vec3(lua_State* L, int lo, std::vector* ret, bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, int lo, - std::vector* ret, + std::vector* ret, const char* funcName) { if (nullptr == L || nullptr == ret || lua_gettop(L) < lo) @@ -2060,7 +2060,7 @@ bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, if (ok) { size_t len = lua_objlen(L, lo); - ax::V3F_C4B_T2F value; + ax::V3F_C4F_T2F value; for (size_t i = 0; i < len; i++) { lua_pushnumber(L, i + 1); @@ -2075,7 +2075,7 @@ bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, } else { - AXASSERT(false, "V3F_C4B_T2F type is needed"); + AXASSERT(false, "V3F_C4F_T2F type is needed"); } lua_pop(L, 1); } diff --git a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h index f7e9d205dc07..6c9d21e3c8ff 100644 --- a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h +++ b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h @@ -799,17 +799,17 @@ extern bool luaval_to_quaternion(lua_State* L, int lo, ax::Quaternion* outValue, extern bool luaval_to_texparams(lua_State* L, int lo, ax::Texture2D::TexParams* outValue, const char* funcName = ""); /** - * Get a ax::V3F_C4B_T2F object value from the given acceptable index of stack. + * Get a ax::V3F_C4F_T2F object value from the given acceptable index of stack. * If the value at the given acceptable index of stack is a table it returns true, otherwise returns false. * If the table has the `vertices`, `colors`, and `texCoords` keys and the corresponding values are not nil, this * function would assign the values to the corresponding members of outValue. * @param L the current lua_State. * @param lo the given acceptable index of stack. - * @param outValue the pointer to a ax::V3F_C4B_T2F object which stores the values from the Lua table. + * @param outValue the pointer to a ax::V3F_C4F_T2F object which stores the values from the Lua table. * @param funcName the name of calling function, it is used for error output in the debug model. * @return true if the value at the given acceptable index of stack is a table, otherwise return false. */ -extern bool luaval_to_v3f_c4b_t2f(lua_State* L, int lo, ax::V3F_C4B_T2F* outValue, const char* funcName = ""); +extern bool luaval_to_v3f_c4b_t2f(lua_State* L, int lo, ax::V3F_C4F_T2F* outValue, const char* funcName = ""); /** * Get a ax::Tex2F object value from the given acceptable index of stack. @@ -825,17 +825,17 @@ extern bool luaval_to_v3f_c4b_t2f(lua_State* L, int lo, ax::V3F_C4B_T2F* outValu extern bool luaval_to_tex2f(lua_State* L, int lo, ax::Tex2F* outValue, const char* funcName = ""); /** - * Get a pointer points to a std::vector from a Lua array table in the stack. + * Get a pointer points to a std::vector from a Lua array table in the stack. * * @param L the current lua_State. * @param lo the given acceptable index of stack. - * @param ret a pointer points to a std::vector. + * @param ret a pointer points to a std::vector. * @param funcName the name of calling function, it is used for error output in the debug model. * @return Return true if the value at the given acceptable index of stack is a table, otherwise return false. */ extern bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, int lo, - std::vector* ret, + std::vector* ret, const char* funcName = ""); /** diff --git a/extensions/scripting/lua-bindings/script/core/Axmol.lua b/extensions/scripting/lua-bindings/script/core/Axmol.lua index 08d1be92b392..1e1fe29b084c 100644 --- a/extensions/scripting/lua-bindings/script/core/Axmol.lua +++ b/extensions/scripting/lua-bindings/script/core/Axmol.lua @@ -379,28 +379,18 @@ function cc.Quad3(_tl, _tr, _bl, _br) return { tl = _tl, tr = _tr, bl = _bl, br = _br } end ---V2F_C4B_T2F -function cc.V2F_C4B_T2F(_vertices, _colors, _texCoords) - return { vertices = _vertices, colors = _colors, texCoords = _texCoords } -end - --V2F_C4F_T2F function cc.V2F_C4F_T2F(_vertices, _colors, _texCoords) return { vertices = _vertices, colors = _colors, texCoords = _texCoords } end ---V3F_C4B_T2F -function cc.V3F_C4B_T2F(_vertices, _colors, _texCoords) +--V3F_C4F_T2F +function cc.V3F_C4F_T2F(_vertices, _colors, _texCoords) return { vertices = _vertices, colors = _colors, texCoords = _texCoords } end ---V2F_C4B_T2F_Quad -function cc.V2F_C4B_T2F_Quad(_bl, _br, _tl, _tr) - return { bl = _bl, br = _br, tl = _tl, tr = _tr } -end - ---V3F_C4B_T2F_Quad -function cc.V3F_C4B_T2F_Quad(_tl, _bl, _tr, _br) +--V3F_C4F_T2F_Quad +function cc.V3F_C4F_T2F_Quad(_tl, _bl, _tr, _br) return { tl = _tl, bl = _bl, tr = _tr, br = _br } end diff --git a/extensions/spine/src/spine/SkeletonBatch.cpp b/extensions/spine/src/spine/SkeletonBatch.cpp index f6be3fdd12b6..d2b9db95b375 100644 --- a/extensions/spine/src/spine/SkeletonBatch.cpp +++ b/extensions/spine/src/spine/SkeletonBatch.cpp @@ -107,11 +107,11 @@ namespace spine { reset(); } - axmol::V3F_C4B_T2F *SkeletonBatch::allocateVertices(uint32_t numVertices) { + axmol::V3F_C4F_T2F *SkeletonBatch::allocateVertices(uint32_t numVertices) { if (_vertices.size() - _numVertices < numVertices) { - axmol::V3F_C4B_T2F *oldData = _vertices.data(); + axmol::V3F_C4F_T2F *oldData = _vertices.data(); _vertices.resize((_vertices.size() + numVertices) * 2 + 1); - axmol::V3F_C4B_T2F *newData = _vertices.data(); + axmol::V3F_C4F_T2F *newData = _vertices.data(); for (uint32_t i = 0; i < this->_nextFreeCommand; i++) { SkeletonCommand *command = _commandsPool[i]; SkeletonCommand::Triangles &triangles = (SkeletonCommand::Triangles &) command->getTriangles(); @@ -119,7 +119,7 @@ namespace spine { } } - axmol::V3F_C4B_T2F *vertices = _vertices.data() + _numVertices; + axmol::V3F_C4F_T2F *vertices = _vertices.data() + _numVertices; _numVertices += numVertices; return vertices; } diff --git a/extensions/spine/src/spine/SkeletonBatch.h b/extensions/spine/src/spine/SkeletonBatch.h index 4768bece33cf..c94d2d4779ab 100644 --- a/extensions/spine/src/spine/SkeletonBatch.h +++ b/extensions/spine/src/spine/SkeletonBatch.h @@ -49,7 +49,7 @@ namespace spine { void update(float delta); - axmol::V3F_C4B_T2F *allocateVertices(uint32_t numVertices); + axmol::V3F_C4F_T2F *allocateVertices(uint32_t numVertices); void deallocateVertices(uint32_t numVertices); unsigned short *allocateIndices(uint32_t numIndices); void deallocateIndices(uint32_t numVertices); @@ -74,7 +74,7 @@ namespace spine { uint32_t _nextFreeCommand; // pool of vertices - std::vector _vertices; + std::vector _vertices; uint32_t _numVertices; // pool of indices diff --git a/extensions/spine/src/spine/SkeletonRenderer.cpp b/extensions/spine/src/spine/SkeletonRenderer.cpp index e4fd0b16b5d6..cb5aa2bfcabb 100644 --- a/extensions/spine/src/spine/SkeletonRenderer.cpp +++ b/extensions/spine/src/spine/SkeletonRenderer.cpp @@ -44,7 +44,7 @@ namespace spine { BlendFunc makeBlendFunc(BlendMode blendMode, bool premultipliedAlpha); void transformWorldVertices(float *dstCoord, int coordCount, Skeleton &skeleton, int startSlotIndex, int endSlotIndex); bool cullRectangle(Renderer *renderer, const Mat4 &transform, const axmol::Rect &rect); - Color4B ColorToColor4B(const Color &color); + ax::Color toAXColor(const spine::Color &color); bool slotIsOutRange(Slot &slot, int startSlotIndex, int endSlotIndex); bool nothingToDraw(Slot &slot, int startSlotIndex, int endSlotIndex); }// namespace @@ -291,7 +291,7 @@ namespace spine { texCoords.u = attachment->getUVs()[i]; texCoords.v = attachment->getUVs()[i + 1]; } - dstStride = sizeof(V3F_C4B_T2F) / sizeof(float); + dstStride = sizeof(V3F_C4F_T2F) / sizeof(float); dstTriangleVertices = reinterpret_cast(triangles.verts); } else { trianglesTwoColor.indices = quadIndices; @@ -330,7 +330,7 @@ namespace spine { texCoords.v = attachment->getUVs()[i + 1]; } dstTriangleVertices = (float *) triangles.verts; - dstStride = sizeof(V3F_C4B_T2F) / sizeof(float); + dstStride = sizeof(V3F_C4F_T2F) / sizeof(float); dstVertexCount = triangles.vertCount; } else { trianglesTwoColor.indices = attachment->getTriangles().buffer(); @@ -385,14 +385,14 @@ namespace spine { color.b *= color.a; } - const axmol::Color4B color4B = ColorToColor4B(color); - const axmol::Color4B darkColor4B = ColorToColor4B(darkColor); + const axmol::Color color4B = toAXColor(color); + const axmol::Color darkColor4B = toAXColor(darkColor); const BlendFunc blendFunc = makeBlendFunc(slot->getData().getBlendMode(), texture->hasPremultipliedAlpha()); _blendFunc = blendFunc; if (hasSingleTint) { if (_clipper->isClipping()) { - _clipper->clipTriangles((float *) &triangles.verts[0].vertices, triangles.indices, triangles.indexCount, (float *) &triangles.verts[0].texCoords, sizeof(axmol::V3F_C4B_T2F) / 4); + _clipper->clipTriangles((float *) &triangles.verts[0].vertices, triangles.indices, triangles.indexCount, (float *) &triangles.verts[0].texCoords, sizeof(axmol::V3F_C4F_T2F) / 4); batch->deallocateVertices(triangles.vertCount); if (_clipper->getClippedTriangles().size() == 0) { @@ -408,7 +408,7 @@ namespace spine { const float* verts = _clipper->getClippedVertices().buffer(); const float* uvs = _clipper->getClippedUVs().buffer(); - V3F_C4B_T2F* vertex = triangles.verts; + V3F_C4F_T2F* vertex = triangles.verts; for (int v = 0, vn = triangles.vertCount, vv = 0; v < vn; ++v, vv += 2, ++vertex) { @@ -421,7 +421,7 @@ namespace spine { batch->addCommand(renderer, _globalZOrder, texture, _programState, blendFunc, triangles, transform, transformFlags); } else { // Not clipping. - V3F_C4B_T2F* vertex = triangles.verts; + V3F_C4F_T2F* vertex = triangles.verts; for (int v = 0, vn = triangles.vertCount; v < vn; ++v, ++vertex) { @@ -539,13 +539,13 @@ namespace spine { {brect.origin.x + brect.size.width, brect.origin.y}, {brect.origin.x + brect.size.width, brect.origin.y + brect.size.height}, {brect.origin.x, brect.origin.y + brect.size.height}}; - drawNode->drawPoly(points, 4, true, Color4B::GREEN, 2.0f); + drawNode->drawPoly(points, 4, true, ax::Color::GREEN, 2.0f); } if (_debugSlots) { // Slots. // DrawPrimitives::setDrawColor4B(0, 0, 255, 255); - V3F_C4B_T2F_Quad quad; + V3F_C4F_T2F_Quad quad; for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; i++) { Slot *slot = _skeleton->getDrawOrder()[i]; @@ -565,7 +565,7 @@ namespace spine { {worldVertices[2], worldVertices[3]}, {worldVertices[4], worldVertices[5]}, {worldVertices[6], worldVertices[7]}}; - drawNode->drawPoly(points, 4, true, Color4B::BLUE, 2.0f); + drawNode->drawPoly(points, 4, true, ax::Color::BLUE, 2.0f); } } @@ -576,15 +576,15 @@ namespace spine { if (!bone->isActive()) continue; float x = bone->getData().getLength() * bone->getA() + bone->getWorldX(); float y = bone->getData().getLength() * bone->getC() + bone->getWorldY(); - drawNode->drawLine(Vec2(bone->getWorldX(), bone->getWorldY()), Vec2(x, y), Color4B::RED, 2.0f); + drawNode->drawLine(Vec2(bone->getWorldX(), bone->getWorldY()), Vec2(x, y), ax::Color::RED, 2.0f); } // Bone origins. - auto color = Color4B::BLUE;// Root bone is blue. + auto color = ax::Color::BLUE; // Root bone is blue. for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) { Bone *bone = _skeleton->getBones()[i]; if (!bone->isActive()) continue; drawNode->drawPoint(Vec2(bone->getWorldX(), bone->getWorldY()), 4, color); - if (i == 0) color = Color4B::GREEN; + if (i == 0) color = ax::Color::GREEN; } } @@ -607,7 +607,7 @@ namespace spine { worldCoord + (idx0 * 2), worldCoord + (idx1 * 2), worldCoord + (idx2 * 2)}; - drawNode->drawPoly(v, 3, true, Color4B::YELLOW, 2.0f); + drawNode->drawPoly(v, 3, true, ax::Color::YELLOW, 2.0f); } VLA_FREE(worldCoord); } @@ -917,8 +917,8 @@ namespace spine { } - Color4B ColorToColor4B(const Color &color) { - return {(uint8_t) (color.r * 255.f), (uint8_t) (color.g * 255.f), (uint8_t) (color.b * 255.f), (uint8_t) (color.a * 255.f)}; + ax::Color toAXColor(const spine::Color &color) { + return {color.r, color.g, color.b, color.a}; } }// namespace diff --git a/tests/cpp-tests/Source/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Source/ClippingNodeTest/ClippingNodeTest.cpp index 738f2ab7e9c5..a1f890edd5ee 100644 --- a/tests/cpp-tests/Source/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Source/ClippingNodeTest/ClippingNodeTest.cpp @@ -1084,14 +1084,14 @@ void UniqueChildStencilTest::addChildStencils() // Child stencil 1 constexpr auto radius = 30.f; auto* drawNode = DrawNode::create(); - drawNode->drawSolidCircle(Vec2(50, 50), radius, 360, 180, 1, 1, Color4B::MAGENTA); + drawNode->drawSolidCircle(Vec2(50, 50), radius, 360, 180, 1, 1, Color::MAGENTA); _parentStencil->addChild(drawNode); // Child stencil 2 drawNode = DrawNode::create(); drawNode->drawSolidRect(Vec2(contentSize.width - 75, contentSize.height - 75), - Vec2(contentSize.width - 25, contentSize.height - 25), Color4B::MAGENTA); + Vec2(contentSize.width - 25, contentSize.height - 25), Color::MAGENTA); _parentStencil->addChild(drawNode); // Child stencil 3 diff --git a/tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp b/tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp index 6f8bafad0d45..68463d4b424b 100644 --- a/tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp +++ b/tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp @@ -1358,7 +1358,7 @@ DrawNodeTests::DrawNodeTests() DrawNodeBaseTest::DrawNodeBaseTest() { auto director = Director::getInstance(); - director->setClearColor(Color4F(0, 0, 0, 0)); + director->setClearColor(Color(0, 0, 0, 0)); origin = director->getVisibleOrigin(); size = director->getVisibleSize(); @@ -1590,7 +1590,7 @@ DrawNodeMorphTest_SolidPolygon::DrawNodeMorphTest_SolidPolygon() addChild(drawNodeArray[n]); drawNodeArray[n]->setPosition( Vec2(AXRANDOM_MINUS1_1() * size.width / 4, AXRANDOM_MINUS1_1() * size.height / 4) + Vec2(100, 100)); - color[n] = Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f); + color[n] = Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f); rad[n] = 90 + AXRANDOM_0_1() * 10; state[n] = (AXRANDOM_0_1() > 0.5f) ? false : true; @@ -1677,7 +1677,7 @@ void DrawNodeMorphTest_SolidPolygon::update(float dt) drawNodeArray[n]->properties.setScale(Vec2(0.5f, 0.5f)); drawNodeArray[n]->drawSolidPolygon(verticesObjMorph[n], segments, color[n], sliderValue[sliderType::Thickness], - Color4B::YELLOW); + Color::YELLOW); } } @@ -1720,7 +1720,7 @@ DrawNodeMorphTest_Polygon::DrawNodeMorphTest_Polygon() addChild(drawNodeArray[n]); drawNodeArray[n]->setPosition( Vec2(AXRANDOM_MINUS1_1() * size.width / 4, AXRANDOM_MINUS1_1() * size.height / 4) + Vec2(100, 100)); - color[n] = Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f); + color[n] = Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f); rad[n] = 90 + AXRANDOM_0_1() * 10; state[n] = (AXRANDOM_0_1() > 0.5f) ? false : true; @@ -1877,8 +1877,8 @@ void DrawNodePictureTest::update(float dt) int sph_la = 0; do { - Color4F color = Color4F(sph_xx[sph_la + 1], sph_yy[sph_la + 1], sph_xx[sph_la + 2], sph_yy[sph_la + 2] * 255); - // color = Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1); + Color color(sph_xx[sph_la + 1] / 255, sph_yy[sph_la + 1] / 255, sph_xx[sph_la + 2] / 255, sph_yy[sph_la + 2]); + // color = Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1); Vec2* vertices = new Vec2[(int)(sph_cmb - 3)]; for (int n = 3; n < sph_cmb; n++) { @@ -1891,7 +1891,7 @@ void DrawNodePictureTest::update(float dt) drawNode->properties.setCenter(vertices[0]); drawNode->properties.setRotation(rot); drawNode->drawPolygon(vertices, sph_cmb - 3, color, /*rot*/ 0.f, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), true); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), true); sph_la += sph_cmb; sph_cmb = sph_yy[sph_la]; @@ -1922,22 +1922,22 @@ void DrawNodeThicknessTest::update(float dt) drawNode->clear(); - drawNode->drawCircle(VisibleRect::center(), 60, AX_DEGREES_TO_RADIANS(77), 30, false, Color4F::GREEN, + drawNode->drawCircle(VisibleRect::center(), 60, AX_DEGREES_TO_RADIANS(77), 30, false, Color::GREEN, sliderValue[sliderType::Thickness]); - drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color4F::YELLOW, + drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color::YELLOW, sliderValue[sliderType::Thickness]); - drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(size.width, size.height - 20), Color4F::YELLOW, + drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(size.width, size.height - 20), Color::YELLOW, sliderValue[sliderType::Thickness]); // drawNode a rectangles - drawNode->drawRect(Vec2(123, 123), Vec2(227, 227), Color4F(1, 1, 0, 1), sliderValue[sliderType::Thickness]); - drawNode->drawRect(Vec2(115, 130), Vec2(130, 115), Vec2(115, 100), Vec2(100, 115), Color4F::MAGENTA, + drawNode->drawRect(Vec2(123, 123), Vec2(227, 227), Color(1, 1, 0, 1), sliderValue[sliderType::Thickness]); + drawNode->drawRect(Vec2(115, 130), Vec2(130, 115), Vec2(115, 100), Vec2(100, 115), Color::MAGENTA, sliderValue[sliderType::Thickness]); - drawNode->drawLine(Vec2(200.0f, size.height - 20), Vec2(size.width - 100, size.height - 20), Color4F::YELLOW, + drawNode->drawLine(Vec2(200.0f, size.height - 20), Vec2(size.width - 100, size.height - 20), Color::YELLOW, sliderValue[sliderType::Thickness]); - drawNode->drawLine(Vec2(300.0f, 100.0f), Vec2(size.width - 200, size.height - 120), Color4F::GREEN, + drawNode->drawLine(Vec2(300.0f, 100.0f), Vec2(size.width - 200, size.height - 120), Color::GREEN, sliderValue[sliderType::Thickness]); Vec2 vertices24[] = { @@ -1955,35 +1955,35 @@ void DrawNodeThicknessTest::update(float dt) {135.250000f, 108.625000f}, {151.000000f, 124.125000f}, {90.500000f, 131.875000f}, {113.250000f, 120.875000f}, {88.000000f, 116.875000f}, {106.000000f, 103.875000f}, {88.000000f, 97.875000f}, }; - drawNode->drawPolygon(vertices24, sizeof(vertices24) / sizeof(vertices24[0]), Color4B::TRANSPARENT, - sliderValue[sliderType::Thickness] / 2, Color4F::RED); + drawNode->drawPolygon(vertices24, sizeof(vertices24) / sizeof(vertices24[0]), Color::TRANSPARENT, + sliderValue[sliderType::Thickness] / 2, Color::RED); // open random color poly Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f), Vec2(50.0f, 100.0f)}; - drawNode->drawPoly(vertices, 5, false, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + drawNode->drawPoly(vertices, 5, false, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); // closed random color poly Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)}; - drawNode->drawPoly(vertices2, 3, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + drawNode->drawPoly(vertices2, 3, true, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); // drawNode some beziers drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10), - Vec2(size.width - 10, size.height - 10), 10, Color4F::BLUE, + Vec2(size.width - 10, size.height - 10), 10, Color::BLUE, sliderValue[sliderType::Thickness]); drawNode->drawQuadBezier(Vec2(0.0f + 100, size.height - 100), Vec2(size.width / 2, size.height / 2), - Vec2(size.width - 100, size.height - 100), 50, Color4F::RED, + Vec2(size.width - 100, size.height - 100), 50, Color::RED, sliderValue[sliderType::Thickness]); drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(), - 100, Color4F::WHITE, sliderValue[sliderType::Thickness]); + 100, Color::WHITE, sliderValue[sliderType::Thickness]); drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f), - Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 10, Color4F::GRAY, + Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 10, Color::GRAY, sliderValue[sliderType::Thickness]); auto array = ax::PointArray::create(20); @@ -1994,7 +1994,7 @@ void DrawNodeThicknessTest::update(float dt) array->addControlPoint(Vec2(80.0f, size.height - 80)); array->addControlPoint(Vec2(80.0f, 80.0f)); array->addControlPoint(Vec2(size.width / 2, size.height / 2)); - drawNode->drawCardinalSpline(array, 0.5f, 50, Color4F::MAGENTA, sliderValue[sliderType::Thickness]); + drawNode->drawCardinalSpline(array, 0.5f, 50, Color::MAGENTA, sliderValue[sliderType::Thickness]); auto array2 = ax::PointArray::create(20); array2->addControlPoint(Vec2(size.width / 2, 30.0f)); @@ -2002,51 +2002,51 @@ void DrawNodeThicknessTest::update(float dt) array2->addControlPoint(Vec2(size.width - 80, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, 30.0f)); - drawNode->drawCatmullRom(array2, 50, Color4F::ORANGE, sliderValue[sliderType::Thickness]); + drawNode->drawCatmullRom(array2, 50, Color::ORANGE, sliderValue[sliderType::Thickness]); auto s = Director::getInstance()->getWinSize(); drawNode->drawPoint(Vec2(s.width / 2 - 120, s.height / 2 - 120), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); drawNode->drawPoint(Vec2(s.width / 2 + 120, s.height / 2 + 120), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode 4 small points Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)}; - drawNode->drawPoints(position, 4, 5, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + drawNode->drawPoints(position, 4, 5, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode a line - drawNode->drawLine(Vec2(0, 0), Vec2(s.width, s.height), Color4F(1.0, 0.0, 0.0, 0.5)); + drawNode->drawLine(Vec2(0, 0), Vec2(s.width, s.height), Color(1.0, 0.0, 0.0, 0.5)); // drawNode a rectangle - drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color4F(1, 1, 0, 1)); + drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color(1, 1, 0, 1)); drawNode->drawRect(Vec2(15, 30), Vec2(30, 15), Vec2(15, 0), Vec2(0, 15), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode a circle drawNode->drawCircle(VisibleRect::center() + Vec2(140, 0), 100, AX_DEGREES_TO_RADIANS(90), 50, true, 1.0f, 2.0f, - Color4F(1.0f, 0.0f, 0.0f, 0.5f)); + Color(1.0f, 0.0f, 0.0f, 0.5f)); drawNode->drawCircle(VisibleRect::center() - Vec2(140, 0), 50, AX_DEGREES_TO_RADIANS(90), 30, false, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // drawNode some beziers drawNode->drawQuadBezier(Vec2(s.width - 150, s.height - 150), Vec2(s.width - 70, s.height - 10), Vec2(s.width - 10, s.height - 10), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); drawNode->drawQuadBezier(Vec2(0.0f, s.height), Vec2(s.width / 2, s.height / 2), Vec2(s.width, s.height), 50, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(), - 100, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + 100, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); drawNode->drawCubicBezier(Vec2(s.width - 250, 40.0f), Vec2(s.width - 70, 100.0f), Vec2(s.width - 30, 250.0f), Vec2(s.width - 10, s.height - 50), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); auto array3 = PointArray::create(20); array3->addControlPoint(Vec2(0.0f, 0.0f)); @@ -2056,7 +2056,7 @@ void DrawNodeThicknessTest::update(float dt) array3->addControlPoint(Vec2(80.0f, s.height - 80)); array3->addControlPoint(Vec2(80.0f, 80.0f)); array3->addControlPoint(Vec2(s.width / 2, s.height / 2)); - drawNode->drawCardinalSpline(array3, 0.5f, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + drawNode->drawCardinalSpline(array3, 0.5f, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); auto array4 = PointArray::create(20); array4->addControlPoint(Vec2(s.width / 2, 30.0f)); @@ -2064,28 +2064,28 @@ void DrawNodeThicknessTest::update(float dt) array4->addControlPoint(Vec2(s.width - 80, s.height - 80)); array4->addControlPoint(Vec2(s.width / 2, s.height - 80)); array4->addControlPoint(Vec2(s.width / 2, 30.0f)); - drawNode->drawCatmullRom(array4, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + drawNode->drawCatmullRom(array4, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); // open random color poly Vec2 verticesA[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f), Vec2(50.0f, 100.0f)}; - drawNode->drawPoly(verticesA, 5, false, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + drawNode->drawPoly(verticesA, 5, false, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // closed random color poly Vec2 verticesB[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)}; - drawNode->drawPoly(verticesB, 3, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + drawNode->drawPoly(verticesB, 3, true, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // drawNode 10 circles for (int i = 0; i < 10; i++) { drawNode->drawDot(Vec2(s.width / 2, s.height / 2), 10.f * (10 - i), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } // drawNode polygons Vec2 points[] = {Vec2(s.height / 4, 0.0f), Vec2(s.width, s.height / 5), Vec2(s.width / 3 * 2, s.height)}; - drawNode->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 4, - Color4F(0.0f, 0.0f, 1.0f, 0.5f)); + drawNode->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 4, + Color(0.0f, 0.0f, 1.0f, 0.5f)); // star poly (triggers buggs) { @@ -2099,8 +2099,8 @@ void DrawNodeThicknessTest::update(float dt) // {o -h, o+w}, {o,o}, // left spike }; - drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 1, - Color4F(0.0f, 0.0f, 1.0f, 1.0f)); + drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1, + Color(0.0f, 0.0f, 1.0f, 1.0f)); } // star poly (doesn't trigger bug... order is important un tesselation is supported. @@ -2119,40 +2119,40 @@ void DrawNodeThicknessTest::update(float dt) Vec2(o - h, o + w), // left spike }; - drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 1, - Color4F(0.0f, 0.0f, 1.0f, 1.0f)); + drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1, + Color(0.0f, 0.0f, 1.0f, 1.0f)); } // drawNode a solid polygon Vec2 vertices3[] = {Vec2(60.0f, 160.0f), Vec2(70.0f, 190.0f), Vec2(100.0f, 190.0f), Vec2(90.0f, 160.0f)}; - drawNode->drawSolidPoly(vertices3, 4, Color4F(1.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSolidPoly(vertices3, 4, Color(1.0f, 1.0f, 0.0f, 1.0f)); // drawNode a solid rectangle - drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color4F(1.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color(1.0f, 1.0f, 0.0f, 1.0f)); // drawNode a solid circle drawNode->drawSolidCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 40, AX_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f, - Color4F(0.0f, 1.0f, 0.0f, 1.0f)); + Color(0.0f, 1.0f, 0.0f, 1.0f)); // drawNode segment - drawNode->drawSegment(Vec2(20.0f, s.height), Vec2(20.0f, s.height / 2), 10, Color4F(0.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSegment(Vec2(20.0f, s.height), Vec2(20.0f, s.height / 2), 10, Color(0.0f, 1.0f, 0.0f, 1.0f)); drawNode->drawSegment(Vec2(10.0f, s.height / 2), Vec2(s.width / 2, s.height / 2), 40, - Color4F(1.0f, 0.0f, 1.0f, 0.5f)); + Color(1.0f, 0.0f, 1.0f, 0.5f)); // drawNode triangle drawNode->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); for (int i = 0; i < 100; i++) { drawNode->drawPoint(Vec2(i * 7.0f, 5.0f), (float)i / 5 + 1, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } - drawNode->drawLine(Vec2(0.0f, s.height), Vec2(s.width, s.height - 20), Color4F::YELLOW); - drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(s.width, s.height - 20), Color4F::YELLOW); + drawNode->drawLine(Vec2(0.0f, s.height), Vec2(s.width, s.height - 20), Color::YELLOW); + drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(s.width, s.height - 20), Color::YELLOW); drawNode->runAction(RepeatForever::create(Sequence::create(FadeIn::create(1.2f), FadeOut::create(1.2f), NULL))); } @@ -2197,13 +2197,13 @@ void DrawNodeThicknessStressTest::update(float dt) drawNode->clear(); - drawNode->drawCircle(VisibleRect::center(), 60, AX_DEGREES_TO_RADIANS(77), 30, false, Color4F::GREEN, + drawNode->drawCircle(VisibleRect::center(), 60, AX_DEGREES_TO_RADIANS(77), 30, false, Color::GREEN, negativThickness); - drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color4F::YELLOW, negativThickness); + drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color::YELLOW, negativThickness); // drawNode a rectangles - drawNode->drawRect(Vec2(123, 123), Vec2(227, 227), Color4F(1, 1, 0, 1), negativThickness); + drawNode->drawRect(Vec2(123, 123), Vec2(227, 227), Color(1, 1, 0, 1), negativThickness); Vec2 vertices24[] = { {45.750000f, 144.375000f}, {75.500000f, 136.875000f}, {75.500000f, 159.125000f}, {100.250000f, 161.375000f}, @@ -2220,27 +2220,27 @@ void DrawNodeThicknessStressTest::update(float dt) {135.250000f, 108.625000f}, {151.000000f, 124.125000f}, {90.500000f, 131.875000f}, {113.250000f, 120.875000f}, {88.000000f, 116.875000f}, {106.000000f, 103.875000f}, {88.000000f, 97.875000f}, }; - drawNode->drawPolygon(vertices24, sizeof(vertices24) / sizeof(vertices24[0]), Color4B::TRANSPARENT, - negativThickness, Color4F::RED); + drawNode->drawPolygon(vertices24, sizeof(vertices24) / sizeof(vertices24[0]), Color::TRANSPARENT, + negativThickness, Color::RED); // open random color poly Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f), Vec2(50.0f, 100.0f)}; - drawNode->drawPoly(vertices, 5, false, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + drawNode->drawPoly(vertices, 5, false, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), negativThickness); // closed random color poly Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)}; - drawNode->drawPoly(vertices2, 3, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + drawNode->drawPoly(vertices2, 3, true, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), negativThickness); // drawNode some beziers drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10), - Vec2(size.width - 10, size.height - 10), 10, Color4F::BLUE, negativThickness); + Vec2(size.width - 10, size.height - 10), 10, Color::BLUE, negativThickness); drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(), - 100, Color4F::WHITE, negativThickness); + 100, Color::WHITE, negativThickness); auto array = ax::PointArray::create(20); array->addControlPoint(Vec2(0.0f, 0.0f)); @@ -2250,7 +2250,7 @@ void DrawNodeThicknessStressTest::update(float dt) array->addControlPoint(Vec2(80.0f, size.height - 80)); array->addControlPoint(Vec2(80.0f, 80.0f)); array->addControlPoint(Vec2(size.width / 2, size.height / 2)); - drawNode->drawCardinalSpline(array, 0.5f, 50, Color4F::MAGENTA, negativThickness); + drawNode->drawCardinalSpline(array, 0.5f, 50, Color::MAGENTA, negativThickness); auto array2 = ax::PointArray::create(20); array2->addControlPoint(Vec2(size.width / 2, 30.0f)); @@ -2258,28 +2258,28 @@ void DrawNodeThicknessStressTest::update(float dt) array2->addControlPoint(Vec2(size.width - 80, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, 30.0f)); - drawNode->drawCatmullRom(array2, 50, Color4F::ORANGE, negativThickness); + drawNode->drawCatmullRom(array2, 50, Color::ORANGE, negativThickness); auto s = Director::getInstance()->getWinSize(); drawNode->drawPoint(Vec2(s.width / 2 - 120, s.height / 2 - 120), negativThickness, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode 4 small points Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)}; - drawNode->drawPoints(position, 4, 5, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), DrawNode::Rect); + drawNode->drawPoints(position, 4, 5, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), DrawNode::Rect); Vec2 position1[] = {Vec2(100, 100), Vec2(170, 170), Vec2(260, 170), Vec2(170, 260)}; - drawNode->drawPoints(position1, 4, 25, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), DrawNode::Rect); + drawNode->drawPoints(position1, 4, 25, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), DrawNode::Rect); // drawNode a rectangle - drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color4F(1, 1, 0, 1), negativThickness); + drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color(1, 1, 0, 1), negativThickness); // drawNode 10 circles for (int i = 0; i < 10; i++) { drawNode->drawDot(Vec2(s.width / 2, s.height / 2), negativThickness, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } // star poly (doesn't trigger bug... order is important un tesselation is supported. @@ -2298,27 +2298,27 @@ void DrawNodeThicknessStressTest::update(float dt) Vec2(o - h, o + w), // left spike }; - drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 1, - Color4F(0.0f, 0.0f, 1.0f, 1.0f)); + drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1, + Color(0.0f, 0.0f, 1.0f, 1.0f)); } // drawNode a solid polygon Vec2 vertices3[] = {Vec2(60.0f, 160.0f), Vec2(70.0f, 190.0f), Vec2(100.0f, 190.0f), Vec2(90.0f, 160.0f)}; - drawNode->drawSolidPoly(vertices3, 4, Color4F(1.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSolidPoly(vertices3, 4, Color(1.0f, 1.0f, 0.0f, 1.0f)); // drawNode a solid rectangle - drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color4F(1.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color(1.0f, 1.0f, 0.0f, 1.0f)); // drawNode a solid circle drawNode->drawSolidCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 40, AX_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f, - Color4F(0.0f, 1.0f, 0.0f, 1.0f)); + Color(0.0f, 1.0f, 0.0f, 1.0f)); // drawNode segment - drawNode->drawSegment(Vec2(20.0f, s.height), Vec2(20.0f, s.height / 2), 10, Color4F(0.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSegment(Vec2(20.0f, s.height), Vec2(20.0f, s.height / 2), 10, Color(0.0f, 1.0f, 0.0f, 1.0f)); // drawNode triangle drawNode->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); } void DrawNodeThicknessStressTest::onEnter() @@ -2364,31 +2364,31 @@ void DrawNodePieTest::update(float dt) // Filled drawNode->drawPie(VisibleRect::center() - Vec2(190.0f, -35.0f), 40, sliderValue[sliderType::Rotation], - sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, Color4F::RED, - Color4F::BLUE, drawNode->DrawMode::Fill, sliderValue[sliderType::Thickness]); + sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, Color::RED, + Color::BLUE, drawNode->DrawMode::Fill, sliderValue[sliderType::Thickness]); // Outlined drawNode->drawPie(VisibleRect::center() - Vec2(95.0f, -35.0f), 40, sliderValue[sliderType::Rotation], sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, - Color4F::TRANSPARENT, Color4F::BLUE, drawNode->DrawMode::Outline, + Color::TRANSPARENT, Color::BLUE, drawNode->DrawMode::Outline, sliderValue[sliderType::Thickness]); // Line drawNode->drawPie(VisibleRect::center() + Vec2(0.0f, 35.0f), 40, sliderValue[sliderType::Rotation], sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, - Color4F::TRANSPARENT, Color4F::BLUE, drawNode->DrawMode::Line, + Color::TRANSPARENT, Color::BLUE, drawNode->DrawMode::Line, sliderValue[sliderType::Thickness]); // Semi drawNode->drawPie(VisibleRect::center() + Vec2(95.0f, 35.0f), 40, sliderValue[sliderType::Rotation], sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, - Color4F::TRANSPARENT, Color4F::BLUE, drawNode->DrawMode::Semi, + Color::TRANSPARENT, Color::BLUE, drawNode->DrawMode::Semi, sliderValue[sliderType::Thickness]); // Semi (Filled) drawNode->drawPie(VisibleRect::center() + Vec2(190.0f, 35.0f), 40, sliderValue[sliderType::Rotation], - sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, Color4F::RED, - Color4F::BLUE, drawNode->DrawMode::Semi, sliderValue[sliderType::Thickness]); + sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, Color::RED, + Color::BLUE, drawNode->DrawMode::Semi, sliderValue[sliderType::Thickness]); } void DrawNodePieTest::onEnter() @@ -2532,11 +2532,11 @@ void DrawNodeMethodsTest::drawAll() for (int i = 0; i < 100; i++) { drawNode->drawLine(Vec2(-size.x / 2, -size.y / 2 + i * 4), Vec2(size.x - 50, -size.y / 2 + i * 4), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); drawNode->drawLine(Vec2(-size.x + 50, -size.y + AXRANDOM_0_1() * 2 * size.y), Vec2(size.x - 50, -size.y + AXRANDOM_0_1() * 2 * size.y), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); } @@ -2549,11 +2549,11 @@ void DrawNodeMethodsTest::drawAll() { rec = Vec2(i * 3, i * 3); drawNode->drawRect(center / 2 - rec, center / 2 + rec, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); drawNode->drawRect(Vec2(AXRANDOM_MINUS1_1() * 300, AXRANDOM_MINUS1_1() * 300), Vec2(AXRANDOM_MINUS1_1() * 400, AXRANDOM_MINUS1_1() * 400), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); } @@ -2564,14 +2564,14 @@ void DrawNodeMethodsTest::drawAll() for (int i = 0; i < 100; i++) { drawNode->drawCircle(VisibleRect::center(), 3 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); Vec2 pos = Vec2(-100, -100) + Vec2(AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x, AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y); drawNode->drawCircle(VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 30, true, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness]); } @@ -2580,10 +2580,10 @@ void DrawNodeMethodsTest::drawAll() case drawMethodes::QuadBezier: { drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10), - Vec2(size.width - 10, size.height - 10), 10, Color4F::BLUE, + Vec2(size.width - 10, size.height - 10), 10, Color::BLUE, sliderValue[sliderType::Thickness]); drawNode->drawQuadBezier(Vec2(0.0f + 100, size.height - 100), Vec2(size.width / 2, size.height / 2), - Vec2(size.width - 100, size.height - 100), 50, Color4F::RED, + Vec2(size.width - 100, size.height - 100), 50, Color::RED, sliderValue[sliderType::Thickness]); for (int i = 0; i < 360;) @@ -2593,7 +2593,7 @@ void DrawNodeMethodsTest::drawAll() Vec2 p3 = pts->getControlPointAtIndex(i); drawNode->properties.setPosition(Vec2(-100, -100)); - drawNode->drawQuadBezier(p1, p2, p3, 30, Color4B::RED, + drawNode->drawQuadBezier(p1, p2, p3, 30, Color::RED, sliderValue[sliderType::Thickness]); } @@ -2604,7 +2604,7 @@ void DrawNodeMethodsTest::drawAll() Vec2 p3 = pts2->getControlPointAtIndex(i); drawNode->properties.setPosition(Vec2(-100, -100)); - drawNode->drawQuadBezier(p1, p2, p3, 30, Color4B::GREEN, + drawNode->drawQuadBezier(p1, p2, p3, 30, Color::GREEN, sliderValue[sliderType::Thickness]); } @@ -2615,10 +2615,10 @@ void DrawNodeMethodsTest::drawAll() drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), - VisibleRect::right(), 20, Color4F::WHITE, sliderValue[sliderType::Thickness]); + VisibleRect::right(), 20, Color::WHITE, sliderValue[sliderType::Thickness]); drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f), Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 20, - Color4F::GRAY, sliderValue[sliderType::Thickness]); + Color::GRAY, sliderValue[sliderType::Thickness]); for (int i = 0; i < 360;) { @@ -2627,7 +2627,7 @@ void DrawNodeMethodsTest::drawAll() Vec2 p3 = pts->getControlPointAtIndex(i++); Vec2 p4 = pts->getControlPointAtIndex(i); drawNode->properties.setPosition(Vec2(-100, -100)); - drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color4F::RED, sliderValue[sliderType::Thickness]); + drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color::RED, sliderValue[sliderType::Thickness]); } for (int i = 0; i < 360;) @@ -2637,7 +2637,7 @@ void DrawNodeMethodsTest::drawAll() Vec2 p3 = pts2->getControlPointAtIndex(i++); Vec2 p4 = pts2->getControlPointAtIndex(i); drawNode->properties.setPosition(Vec2(-100, -100)); - drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color4F::GREEN, sliderValue[sliderType::Thickness]); + drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color::GREEN, sliderValue[sliderType::Thickness]); } break; @@ -2653,7 +2653,7 @@ void DrawNodeMethodsTest::drawAll() array->addControlPoint(Vec2(80.0f, size.height - 80)); array->addControlPoint(Vec2(80.0f, 80.0f)); array->addControlPoint(Vec2(size.width / 2, size.height / 2)); - drawNode->drawCardinalSpline(array, 0.5f, 120, Color4F::MAGENTA, sliderValue[sliderType::Thickness]); + drawNode->drawCardinalSpline(array, 0.5f, 120, Color::MAGENTA, sliderValue[sliderType::Thickness]); auto array2 = ax::PointArray::create(5); array2->addControlPoint(Vec2(size.width / 2, 80.0f)); @@ -2661,11 +2661,11 @@ void DrawNodeMethodsTest::drawAll() array2->addControlPoint(Vec2(size.width - 80, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, 80.0f)); - drawNode->drawCardinalSpline(array2, 5.0f, 120, Color4F::ORANGE, sliderValue[sliderType::Thickness]); + drawNode->drawCardinalSpline(array2, 5.0f, 120, Color::ORANGE, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(Vec2(-100, -100)); - drawNode->drawCardinalSpline(pts, 0.001f, 360, Color4F::RED, sliderValue[sliderType::Thickness]); - drawNode->drawCardinalSpline(pts2, 0.001f, 360, Color4F::GREEN, sliderValue[sliderType::Thickness]); + drawNode->drawCardinalSpline(pts, 0.001f, 360, Color::RED, sliderValue[sliderType::Thickness]); + drawNode->drawCardinalSpline(pts2, 0.001f, 360, Color::GREEN, sliderValue[sliderType::Thickness]); break; } @@ -2677,7 +2677,7 @@ void DrawNodeMethodsTest::drawAll() array2->addControlPoint(Vec2(size.width - 80, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, 80.0f)); - drawNode->drawCatmullRom(array2, 20, Color4F::ORANGE, sliderValue[sliderType::Thickness]); + drawNode->drawCatmullRom(array2, 20, Color::ORANGE, sliderValue[sliderType::Thickness]); auto array = ax::PointArray::create(7); array->addControlPoint(Vec2(0.0f, 0.0f)); @@ -2687,11 +2687,11 @@ void DrawNodeMethodsTest::drawAll() array->addControlPoint(Vec2(80.0f, size.height - 80)); array->addControlPoint(Vec2(80.0f, 80.0f)); array->addControlPoint(Vec2(size.width / 2, size.height / 2)); - drawNode->drawCatmullRom(array, 20, Color4F::MAGENTA, sliderValue[sliderType::Thickness]); + drawNode->drawCatmullRom(array, 20, Color::MAGENTA, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(Vec2(-100, -100)); - drawNode->drawCatmullRom(pts, 360, Color4F::RED, sliderValue[sliderType::Thickness]); - drawNode->drawCatmullRom(pts2, 360, Color4F::GREEN, sliderValue[sliderType::Thickness]); + drawNode->drawCatmullRom(pts, 360, Color::RED, sliderValue[sliderType::Thickness]); + drawNode->drawCatmullRom(pts2, 360, Color::GREEN, sliderValue[sliderType::Thickness]); break; } @@ -2699,42 +2699,42 @@ void DrawNodeMethodsTest::drawAll() { Vec2 vertices[5] = {{0.0f, 0.0f}, {50.0f, 50.0f}, {100.0f, 50.0f}, {100.0f, 100.0f}, {50.0f, 100.0f}}; drawNode->properties.setPosition(Vec2(-200, -300)); - drawNode->drawPoly(vertices, 5, false, Color4B::BLUE, sliderValue[sliderType::Thickness]); + drawNode->drawPoly(vertices, 5, false, Color::BLUE, sliderValue[sliderType::Thickness]); Vec2 vertices2[3] = {{30.0f, 130.0f}, {30.0f, 230.0f}, {50.0f, 200.0f}}; - drawNode->drawPoly(vertices2, 3, true, Color4B::GREEN, sliderValue[sliderType::Thickness]); + drawNode->drawPoly(vertices2, 3, true, Color::GREEN, sliderValue[sliderType::Thickness]); drawNode->properties.setDefaultValues(); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4B::RED, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::RED, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(Vec2(0, -300)); drawNode->properties.setRotation(sliderValue[sliderType::Rotation]); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::GREEN, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::GREEN, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(Vec2(-100, -300)); drawNode->properties.setRotation(sliderValue[sliderType::Rotation]); drawNode->properties.setCenter(vertices1[0]); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::MAGENTA, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::MAGENTA, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(Vec2(200, 0)); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::RED, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::RED, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(Vec2(0.0f, -300.0f)); drawNode->properties.setRotation(rotation / 10.0f); drawNode->properties.setScale(Vec2(2.0f, 2.0f)); drawNode->properties.setCenter(vertices1[4]); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::BLUE, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::BLUE, sliderValue[sliderType::Thickness]); drawNode->properties.setRotation(rotation); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::YELLOW, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::YELLOW, sliderValue[sliderType::Thickness]); drawNode->properties.setRotation(-rotation / 5); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::WHITE, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::WHITE, sliderValue[sliderType::Thickness]); drawNode->properties.setDefaultValues(); - drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color4F::GREEN, + drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::GREEN, sliderValue[sliderType::Thickness]); break; } @@ -2742,34 +2742,34 @@ void DrawNodeMethodsTest::drawAll() { drawNode->properties.setPosition(Vec2(0, -300)); drawNode->properties.setRotation(sliderValue[sliderType::Rotation]); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::GREEN, - sliderValue[sliderType::Thickness], Color4F::YELLOW); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::GREEN, + sliderValue[sliderType::Thickness], Color::YELLOW); drawNode->properties.setPosition(Vec2(-100, -300)); drawNode->properties.setRotation(sliderValue[sliderType::Rotation]); drawNode->properties.setCenter(vertices1[0]); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::MAGENTA, - sliderValue[sliderType::Thickness], Color4F::GRAY); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::MAGENTA, + sliderValue[sliderType::Thickness], Color::GRAY); drawNode->properties.setPosition(Vec2(200, 0)); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::RED, - sliderValue[sliderType::Thickness], Color4F::YELLOW); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::RED, + sliderValue[sliderType::Thickness], Color::YELLOW); drawNode->properties.setPosition(Vec2(0.0f, -300.0f)); drawNode->properties.setRotation(rotation / 10.0f); drawNode->properties.setScale(Vec2(2.0f, 2.0f)); drawNode->properties.setCenter(vertices1[4]); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::BLUE, - sliderValue[sliderType::Thickness], Color4F::WHITE); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::BLUE, + sliderValue[sliderType::Thickness], Color::WHITE); drawNode->properties.setRotation(rotation); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::YELLOW, - sliderValue[sliderType::Thickness], Color4F::GREEN); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::YELLOW, + sliderValue[sliderType::Thickness], Color::GREEN); ; drawNode->properties.setRotation(-rotation / 5); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::WHITE, - sliderValue[sliderType::Thickness], Color4F::YELLOW); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::WHITE, + sliderValue[sliderType::Thickness], Color::YELLOW); drawNode->properties.setDefaultValues(); - drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::GREEN, - sliderValue[sliderType::Thickness], Color4F::BLUE); + drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::GREEN, + sliderValue[sliderType::Thickness], Color::BLUE); break; } @@ -2779,7 +2779,7 @@ void DrawNodeMethodsTest::drawAll() { drawNode->drawDot(Vec2(AXRANDOM_MINUS1_1() * 400 + 200, AXRANDOM_MINUS1_1() * 400), 20 + sliderValue[sliderType::Thickness], - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } break; @@ -2790,7 +2790,7 @@ void DrawNodeMethodsTest::drawAll() { drawNode->drawPoint(Vec2(AXRANDOM_MINUS1_1() * 400 + 200, AXRANDOM_MINUS1_1() * 400), 30 + sliderValue[sliderType::Thickness], - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } break; } @@ -2809,7 +2809,7 @@ void DrawNodeMethodsTest::drawAll() {70 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x, 70 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y / 2}}; drawNode->drawPoints(position, 4, 10 + 2 * sliderValue[sliderType::Thickness], - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); } break; } @@ -2825,9 +2825,9 @@ void DrawNodeMethodsTest::drawAll() drawNode->drawTriangle(Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, - Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color4B::RED); + Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color::RED); - drawNode->drawTriangle(triangle, Color4B::GREEN); + drawNode->drawTriangle(triangle, Color::GREEN); } break; } @@ -2843,11 +2843,11 @@ void DrawNodeMethodsTest::drawAll() drawNode->drawSolidTriangle(Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, - Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color4B::RED, - Color4B::BLUE, sliderValue[sliderType::Thickness]); + Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color::RED, + Color::BLUE, sliderValue[sliderType::Thickness]); drawNode->properties.setPosition(center-Vec2(200,200)); - drawNode->drawSolidTriangle(triangle, Color4B::GREEN, Color4B::BLUE, sliderValue[sliderType::Thickness]); + drawNode->drawSolidTriangle(triangle, Color::GREEN, Color::BLUE, sliderValue[sliderType::Thickness]); } break; } @@ -2860,17 +2860,17 @@ void DrawNodeMethodsTest::drawAll() int yy1 = 150; int yy = 0; drawNode->drawSegment(Vec2(-150.0f, yy - yy1), Vec2(200, yy - yy1), 20 + 5 * sliderValue[sliderType::Thickness], - Color4F::GREEN, DrawNode::Round, DrawNode::Round); + Color::GREEN, DrawNode::Round, DrawNode::Round); labelRound->setPosition(Vec2(250.0f, 85)); yy += 170; drawNode->drawSegment(Vec2(-150.0f, yy - yy1), Vec2(200, yy - yy1), 20 + 5 * sliderValue[sliderType::Thickness], - Color4F::BLUE, DrawNode::Square, DrawNode::Square); + Color::BLUE, DrawNode::Square, DrawNode::Square); labelSquare->setPosition(Vec2(250.0f, 170)); yy += 170; drawNode->drawSegment(Vec2(-150.0f, yy - yy1), Vec2(200, yy - yy1), 20 + 5 * sliderValue[sliderType::Thickness], - Color4F::RED, DrawNode::Butt, DrawNode::Butt); + Color::RED, DrawNode::Butt, DrawNode::Butt); labelButt->setPosition(Vec2(250.0f, 255)); break; @@ -2884,30 +2884,30 @@ void DrawNodeMethodsTest::drawAll() drawNode->drawSolidCircle( VisibleRect::center(), AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, 1.0f, - 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness], - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + 1.0f, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness], + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); drawNode->drawSolidCircle( VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, - 1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), - sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + 1.0f, 1.0f, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + sliderValue[sliderType::Thickness], Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); drawNode->drawSolidCircle( VisibleRect::center() - pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, - 1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), - sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + 1.0f, 1.0f, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + sliderValue[sliderType::Thickness], Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // for (int i = 5; i > 1; i--) //{ // drawNode->drawSolidCircle( // VisibleRect::center(), 3 * i, AX_DEGREES_TO_RADIANS(90), AXRANDOM_0_1() * 20.f + 20.f, 1.0f, 1.0f, - // Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness], - // Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + // Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness], + // Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); // drawNode->drawSolidCircle( // VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), - // 10, 1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), - // sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + // 10, 1.0f, 1.0f, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + // sliderValue[sliderType::Thickness], Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); //} break; @@ -2921,14 +2921,14 @@ void DrawNodeMethodsTest::drawAll() drawNode->properties.setRotation(rotation / 10.0f); drawNode->properties.setScale(Vec2(2.0f, 2.0f)); drawNode->properties.setCenter(vertices1[4]); - drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::BLUE); + drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::BLUE); drawNode->properties.setRotation(rotation); - drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::YELLOW); + drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::YELLOW); drawNode->properties.setRotation(-rotation / 5); - drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::WHITE); + drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::WHITE); drawNode->properties.setDefaultValues(); - drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color4F::GREEN); + drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::GREEN); break; } @@ -2940,7 +2940,7 @@ void DrawNodeMethodsTest::drawAll() AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y); drawNode->drawSolidRect( pos, pos + Vec2(20.0f * sliderValue[sliderType::Thickness], 20.0f * sliderValue[sliderType::Thickness]), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f), sliderValue[sliderType::Thickness]); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f), sliderValue[sliderType::Thickness]); } break; @@ -2955,29 +2955,29 @@ void DrawNodeMethodsTest::drawAll() drawNode->properties.setRotation(rotation + 45); drawNode->properties.setCenter(gear1); - drawNode->drawStar(Vec2(gear1), 30, 60, 8, Color4F::BLUE, 4.0); + drawNode->drawStar(Vec2(gear1), 30, 60, 8, Color::BLUE, 4.0); drawNode->properties.setRotation(-rotation); drawNode->properties.setCenter(gear2); - drawNode->drawStar(gear2, 30, 60, 8, Color4F::GREEN, 4.0); + drawNode->drawStar(gear2, 30, 60, 8, Color::GREEN, 4.0); drawNode->properties.setDefaultValues(); - drawNode->drawLine(gear2, gear1, Color4F::RED, sliderValue[sliderType::Thickness]); // line + drawNode->drawLine(gear2, gear1, Color::RED, sliderValue[sliderType::Thickness]); // line drawNode->properties.setCenter(gear4); drawNode->properties.setRotation(rotation + 45); - drawNode->drawStar(gear3, 30, 60, 18, Color4F::RED, 1.0); - drawNode->drawLine(gear3, gear4, Color4F::YELLOW, sliderValue[sliderType::Thickness]); // line + drawNode->drawStar(gear3, 30, 60, 18, Color::RED, 1.0); + drawNode->drawLine(gear3, gear4, Color::YELLOW, sliderValue[sliderType::Thickness]); // line // drawNode->properties.setDefaultValues(); drawNode->properties.setRotation(rotation - 45); drawNode->properties.setCenter(gear4); - drawNode->drawStar(gear4, 40, 60, 60, Color4F::GREEN, 1.0); + drawNode->drawStar(gear4, 40, 60, 60, Color::GREEN, 1.0); drawNode->properties.setRotation(rotation); drawNode->properties.setCenter(Vec2(-110, 250)); - drawNode->drawStar(Vec2(-110, 250), 30, 70, 5, Color4F::GREEN, 1.0); + drawNode->drawStar(Vec2(-110, 250), 30, 70, 5, Color::GREEN, 1.0); drawNode->properties.setCenter(Vec2(-150, 100)); - drawNode->drawStar(Vec2(-150, 100), 80, 100, 40, Color4F::GREEN, 1.0); + drawNode->drawStar(Vec2(-150, 100), 80, 100, 40, Color::GREEN, 1.0); drawNode->properties.setCenter(Vec2(-150, -100)); - drawNode->drawStar(Vec2(-150, -100), 5, 70, 3, Color4F::GREEN, 1.0); + drawNode->drawStar(Vec2(-150, -100), 5, 70, 3, Color::GREEN, 1.0); drawNode->properties.setRotation(0); for (int i = 0; i < 10; i++) @@ -2986,7 +2986,7 @@ void DrawNodeMethodsTest::drawAll() drawNode->properties.setPosition(Vec2(ppp)); drawNode->drawStar( Vec2::ZERO, 40, 60, AXRANDOM_0_1() * 60 + 3, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), sliderValue[sliderType::Thickness])); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), sliderValue[sliderType::Thickness])); } break; } @@ -2999,29 +2999,29 @@ void DrawNodeMethodsTest::drawAll() drawNode->properties.setRotation(rotation + 45); drawNode->properties.setCenter(gear1); - drawNode->drawSolidStar(Vec2(gear1), 30, 60, 8, Color4F::BLUE, Color4F::YELLOW, 4.0); + drawNode->drawSolidStar(Vec2(gear1), 30, 60, 8, Color::BLUE, Color::YELLOW, 4.0); drawNode->properties.setRotation(-rotation); drawNode->properties.setCenter(gear2); - drawNode->drawSolidStar(gear2, 30, 60, 8, Color4F::GREEN, Color4F::YELLOW, 4.0); + drawNode->drawSolidStar(gear2, 30, 60, 8, Color::GREEN, Color::YELLOW, 4.0); drawNode->properties.setDefaultValues(); - drawNode->drawLine(gear2, gear1, Color4F::RED, sliderValue[sliderType::Thickness]); // line + drawNode->drawLine(gear2, gear1, Color::RED, sliderValue[sliderType::Thickness]); // line drawNode->properties.setCenter(gear4); drawNode->properties.setRotation(rotation + 45); - drawNode->drawSolidStar(gear3, 30, 60, 18, Color4F::RED, Color4F::YELLOW, 1.0); - drawNode->drawLine(gear3, gear4, Color4F::YELLOW, sliderValue[sliderType::Thickness]); // line + drawNode->drawSolidStar(gear3, 30, 60, 18, Color::RED, Color::YELLOW, 1.0); + drawNode->drawLine(gear3, gear4, Color::YELLOW, sliderValue[sliderType::Thickness]); // line drawNode->properties.setDefaultValues(); drawNode->properties.setRotation(rotation - 45); drawNode->properties.setCenter(gear4); - drawNode->drawSolidStar(gear4, 40, 60, 60, Color4F::GREEN, Color4F::YELLOW, 1.0); + drawNode->drawSolidStar(gear4, 40, 60, 60, Color::GREEN, Color::YELLOW, 1.0); drawNode->properties.setRotation(rotation); drawNode->properties.setCenter(Vec2(-110, 250)); - drawNode->drawSolidStar(Vec2(-110, 250), 30, 70, 5, Color4F::GREEN, Color4F::YELLOW, 1.0); + drawNode->drawSolidStar(Vec2(-110, 250), 30, 70, 5, Color::GREEN, Color::YELLOW, 1.0); drawNode->properties.setCenter(Vec2(-150, 100)); - drawNode->drawSolidStar(Vec2(-150, 100), 80, 100, 40, Color4F::GREEN, Color4F::YELLOW, 1.0); + drawNode->drawSolidStar(Vec2(-150, 100), 80, 100, 40, Color::GREEN, Color::YELLOW, 1.0); drawNode->properties.setCenter(Vec2(-150, -100)); - drawNode->drawSolidStar(Vec2(-150, -100), 5, 70, 3, Color4F::GREEN, Color4F::YELLOW, 1.0); + drawNode->drawSolidStar(Vec2(-150, -100), 5, 70, 3, Color::GREEN, Color::YELLOW, 1.0); drawNode->properties.setRotation(0); for (int i = 0; i < 10; i++) @@ -3029,8 +3029,8 @@ void DrawNodeMethodsTest::drawAll() Vec2 ppp = Vec2(AXRANDOM_MINUS1_1() * size.x / 2, AXRANDOM_MINUS1_1() * size.y / 2); drawNode->properties.setPosition(Vec2(ppp)); drawNode->drawSolidStar(Vec2::ZERO, 40, 60, AXRANDOM_0_1() * 60 + 3, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } break; @@ -3063,7 +3063,7 @@ void DrawNodeDrawInWrongOrder_Issue1888::update(float dt) drawNode->clear(); - drawNode->drawLine(Vec2(20, 140), Vec2(450, 110), Color4B::RED, 20.0f); + drawNode->drawLine(Vec2(20, 140), Vec2(450, 110), Color::RED, 20.0f); for (int i = 0; i < 200; i++) { @@ -3072,20 +3072,20 @@ void DrawNodeDrawInWrongOrder_Issue1888::update(float dt) {70 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 70 + AXRANDOM_0_1() * VisibleRect::rightTop().y}, {60 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 60 + AXRANDOM_0_1() * VisibleRect::rightTop().y}, {70 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 70 + AXRANDOM_0_1() * VisibleRect::rightTop().y}}; - drawNode->drawPoints(position1, 4, 10, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + drawNode->drawPoints(position1, 4, 10, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); } - drawNode->drawSolidRect(Vec2(150, 80), Vec2(400, 220), Color4B::YELLOW); + drawNode->drawSolidRect(Vec2(150, 80), Vec2(400, 220), Color::YELLOW); for (int i = 0; i < 50; i++) { drawNode->drawPoint(Vec2(i * 7.0f, 120.0f), (float)i / 5 + 1, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } - drawNode->drawLine(Vec2(20, 100), Vec2(450, 220), Color4B::GREEN, 8.0f); + drawNode->drawLine(Vec2(20, 100), Vec2(450, 220), Color::GREEN, 8.0f); - drawNode->drawLine(Vec2(200, 100), Vec2(450, 250), Color4B::BLUE, 6.0f); + drawNode->drawLine(Vec2(200, 100), Vec2(450, 250), Color::BLUE, 6.0f); } DrawNodeAxmolTest2::DrawNodeAxmolTest2() @@ -3175,47 +3175,47 @@ void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder) drawNode->properties.setDrawOrder(drawOrder); drawNode->drawPoint(Vec2(size.width / 2 - 120, size.height / 2 - 120), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); drawNode->drawPoint(Vec2(size.width / 2 + 120, size.height / 2 + 120), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode 4 small points Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)}; - drawNode->drawPoints(position, 4, 5, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + drawNode->drawPoints(position, 4, 5, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode a line - drawNode->drawLine(Vec2(0, 0), Vec2(size.width, size.height), Color4F(1.0, 0.0, 0.0, 0.5)); + drawNode->drawLine(Vec2(0, 0), Vec2(size.width, size.height), Color(1.0, 0.0, 0.0, 0.5)); // drawNode a rectangle - drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color4F::RED); + drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color::RED); drawNode->drawRect(Vec2(15, 30), Vec2(30, 15), Vec2(15, 0), Vec2(0, 15), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // drawNode a circle drawNode->drawCircle(VisibleRect::center() + Vec2(140, 0), 100, AX_DEGREES_TO_RADIANS(90), 30, true, 1.0f, 2.0f, - Color4F(1.0f, 0.0f, 0.0f, 0.5f)); + Color(1.0f, 0.0f, 0.0f, 0.5f)); drawNode->drawCircle(VisibleRect::center() - Vec2(140, 0), 50, AX_DEGREES_TO_RADIANS(90), 30, false, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // drawNode some beziers drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10), Vec2(size.width - 10, size.height - 10), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); drawNode->drawQuadBezier(Vec2(0.0f, size.height), Vec2(size.width / 2, size.height / 2), Vec2(size.width, size.height), 50, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(), - 100, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + 100, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f), Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 10, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); auto array = PointArray::create(20); array->addControlPoint(Vec2(0.0f, 0.0f)); @@ -3225,7 +3225,7 @@ void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder) array->addControlPoint(Vec2(80.0f, size.height - 80)); array->addControlPoint(Vec2(80.0f, 80.0f)); array->addControlPoint(Vec2(size.width / 2, size.height / 2)); - drawNode->drawCardinalSpline(array, 0.5f, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + drawNode->drawCardinalSpline(array, 0.5f, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); auto array2 = PointArray::create(20); array2->addControlPoint(Vec2(size.width / 2, 30.0f)); @@ -3233,29 +3233,29 @@ void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder) array2->addControlPoint(Vec2(size.width - 80, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, size.height - 80)); array2->addControlPoint(Vec2(size.width / 2, 30.0f)); - drawNode->drawCatmullRom(array2, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + drawNode->drawCatmullRom(array2, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); // open random color poly Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f), Vec2(50.0f, 100.0f)}; - drawNode->drawPoly(vertices, 5, false, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + drawNode->drawPoly(vertices, 5, false, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // closed random color poly Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)}; - drawNode->drawPoly(vertices2, 3, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + drawNode->drawPoly(vertices2, 3, true, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // drawNode 10 circles for (int i = 0; i < 10; i++) { drawNode->drawDot(Vec2(size.width / 2, size.height / 2), 10.f * (10 - i), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } // drawNode polygons Vec2 points[] = {Vec2(size.height / 4, 0.0f), Vec2(size.width, size.height / 5), Vec2(size.width / 3 * 2, size.height)}; - drawNode->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 4, - Color4F(0.0f, 0.0f, 1.0f, 0.5f)); + drawNode->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 4, + Color(0.0f, 0.0f, 1.0f, 0.5f)); // star poly (triggers buggs) { @@ -3269,8 +3269,8 @@ void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder) //{o -h, o+w}, {o,o}, // left spike }; - drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 1, - Color4F(0.0f, 0.0f, 1.0f, 1.0f)); + drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1, + Color(0.0f, 0.0f, 1.0f, 1.0f)); } // star poly (doesn't trigger bug... order is important un tesselation is supported. @@ -3290,40 +3290,40 @@ void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder) Vec2(o, o), // left spike }; - drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color4F(1.0f, 0.0f, 0.0f, 0.5f), 1, - Color4F(0.0f, 0.0f, 1.0f, 1.0f)); + drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1, + Color(0.0f, 0.0f, 1.0f, 1.0f)); } // drawNode a solid polygon Vec2 vertices3[] = {Vec2(60.0f, 160.0f), Vec2(70.0f, 190.0f), Vec2(100.0f, 190.0f), Vec2(90.0f, 160.0f)}; - drawNode->drawSolidPoly(vertices3, 4, Color4F(1.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSolidPoly(vertices3, 4, Color(1.0f, 1.0f, 0.0f, 1.0f)); // drawNode a solid rectangle - drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color4F(1.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color(1.0f, 1.0f, 0.0f, 1.0f)); // drawNode a solid circle drawNode->drawSolidCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 40, AX_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f, - Color4F(0.0f, 1.0f, 0.0f, 1.0f)); + Color(0.0f, 1.0f, 0.0f, 1.0f)); // drawNode segment - drawNode->drawSegment(Vec2(20.0f, size.height), Vec2(20.0f, size.height / 2), 10, Color4F(0.0f, 1.0f, 0.0f, 1.0f)); + drawNode->drawSegment(Vec2(20.0f, size.height), Vec2(20.0f, size.height / 2), 10, Color(0.0f, 1.0f, 0.0f, 1.0f)); drawNode->drawSegment(Vec2(10.0f, size.height / 2), Vec2(size.width / 2, size.height / 2), 40, - Color4F(1.0f, 0.0f, 1.0f, 0.5f)); + Color(1.0f, 0.0f, 1.0f, 0.5f)); // drawNode triangle drawNode->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f), - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); for (int i = 0; i < 100; i++) { drawNode->drawPoint(Vec2(i * 7.0f, 5.0f), (float)i / 5 + 1, - Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); + Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } - drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color4F::YELLOW); - drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(size.width, size.height - 20), Color4F::YELLOW); + drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color::YELLOW); + drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(size.width, size.height - 20), Color::YELLOW); } string DrawNodeAxmolTest2::title() const @@ -3344,26 +3344,26 @@ DrawNodeIssueTester::DrawNodeIssueTester() // drawNode->properties.setPosition(Vec2(5, 150)); // drawNode->setLineWidth(1); - // drawNode->drawPoly(vertices, verticesCount, false, Color4F::GREEN); + // drawNode->drawPoly(vertices, verticesCount, false, Color::GREEN); // auto draw = DrawNode::create(); // addChild(draw, 10); // draw->setPosition(70, 150); - // draw->drawPoly(vertices, verticesCount, false, Color4F::BLUE); + // draw->drawPoly(vertices, verticesCount, false, Color::BLUE); // drawNode->properties.setPosition(Vec2(140, 150)); // drawNode->setLineWidth(1); - // drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED); + // drawNode->drawPoly(vertices, verticesCount, false, Color::RED); // drawNode->properties.setPosition(Vec2(200, 150)); // drawNode->setLineWidth(1); - // drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED, 3); - // drawNode->drawPoly(vertices, verticesCount, false, Color4F::WHITE); + // drawNode->drawPoly(vertices, verticesCount, false, Color::RED, 3); + // drawNode->drawPoly(vertices, verticesCount, false, Color::WHITE); // drawNode->properties.setPosition(Vec2(270, 150)); // drawNode->setLineWidth(1); - // drawNode->drawPoly(vertices, verticesCount, false, Color4F(0.0f, 0.5f, 0.5f, 0.5f), 10); - // drawNode->drawPoly(vertices, verticesCount, false, Color4F::BLACK); + // drawNode->drawPoly(vertices, verticesCount, false, Color(0.0f, 0.5f, 0.5f, 0.5f), 10); + // drawNode->drawPoly(vertices, verticesCount, false, Color::BLACK); // float thick = 0.0f; // float y = -90.0f; @@ -3372,7 +3372,7 @@ DrawNodeIssueTester::DrawNodeIssueTester() //{ // thick += 0.5f; // y += thick + 1; - // drawNode->drawLine(Vec2(140, y), Vec2(180, y), Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), + // drawNode->drawLine(Vec2(140, y), Vec2(180, y), Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), // thick); // } // drawNode->drawPie(Vec2(-220, 150), 20, 0, 100, 300, 1, 1, Color4B::TRANSPARENT, Color4B::BLUE, @@ -3382,7 +3382,7 @@ DrawNodeIssueTester::DrawNodeIssueTester() // for (int i = 2; i < 30; i++) //{ // drawNode->drawCircle(center, 5 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f, - // Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), 0.5f); + // Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), 0.5f); // } // Vec2* fbHorse = new Vec2[856 / 2]; @@ -3393,18 +3393,18 @@ DrawNodeIssueTester::DrawNodeIssueTester() // for (size_t i = 0; i < sizeof(verticesFB) / sizeof(verticesFB[0]); i += 4) //{ // drawNode->drawLine(Vec2(verticesFB[i] * scale, verticesFB[i + 1] * scale) + pos, - // Vec2(verticesFB[i + 2] * scale, verticesFB[i + 3] * scale) + pos, Color4F::RED, 0.5f); + // Vec2(verticesFB[i + 2] * scale, verticesFB[i + 3] * scale) + pos, Color::RED, 0.5f); // } drawNode->properties.setPosition(VisibleRect::center() - Vec2(100, 50)); - drawNode->drawSolidCircle(Vec2::ZERO, 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color4F::GREEN, 6, - Color4F::BLUE, false); - drawNode->drawSolidCircle(Vec2(100, 0), 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color4F::RED, 6, - Color4F::BLUE, true); + drawNode->drawSolidCircle(Vec2::ZERO, 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color::GREEN, 6, + Color::BLUE, false); + drawNode->drawSolidCircle(Vec2(100, 0), 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color::RED, 6, + Color::BLUE, true); - drawNode->drawCircle(Vec2(100, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, true, 1.0f, 1.0f, Color4F::GREEN, 6); + drawNode->drawCircle(Vec2(100, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, true, 1.0f, 1.0f, Color::GREEN, 6); - drawNode->drawCircle(Vec2(0, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, false, 1.0f, 1.0f, Color4F::RED, 6); + drawNode->drawCircle(Vec2(0, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, false, 1.0f, 1.0f, Color::RED, 6); // scheduleUpdate(); } @@ -3509,33 +3509,33 @@ void DrawNodeSpLinesTest::update(float dt) int boxSize = 3; for (auto&& p : points) { - drawNodeCP->drawRect(Vec2(p.x - boxSize, p.y - boxSize), Vec2(p.x + boxSize, p.y + boxSize), Color4F::BLUE); + drawNodeCP->drawRect(Vec2(p.x - boxSize, p.y - boxSize), Vec2(p.x + boxSize, p.y + boxSize), Color::BLUE); array->addControlPoint(Vec2(p.x, p.y)); } - drawNode->drawCardinalSpline(array, 0.2f, points.size() * 8, Color4F::GREEN, 20.0f); - drawNode->drawCardinalSpline(array, 0.2f, points.size() * 8, Color4F::BLUE); + drawNode->drawCardinalSpline(array, 0.2f, points.size() * 8, Color::GREEN, 20.0f); + drawNode->drawCardinalSpline(array, 0.2f, points.size() * 8, Color::BLUE); - drawNode->drawCardinalSpline(array, 0.2f, points.size() * 16, Color4F(1.0f, 1.0f, 0.5f, 1.0f), 10.0f); + drawNode->drawCardinalSpline(array, 0.2f, points.size() * 16, Color(1.0f, 1.0f, 0.5f, 1.0f), 10.0f); - // drawNode->drawCatmullRom(array, points.size() * 8, Color4F::YELLOW,5); + // drawNode->drawCatmullRom(array, points.size() * 8, Color::YELLOW,5); // if (points.size()>3) //{ // int step = points.size()/4; // drawNode->drawCubicBezier(points.at(0), points.at(step),points.at(step*2),points.at(points.size()-1), - // points.size(), Color4F::BLUE); + // points.size(), Color::BLUE); //} - drawNode->drawCardinalSpline(pts, 0.5f, 360, Color4F::RED, 5.0f); - drawNode->drawCardinalSpline(pts2, 0.5f, 360, Color4F::GREEN, 2.0f); + drawNode->drawCardinalSpline(pts, 0.5f, 360, Color::RED, 5.0f); + drawNode->drawCardinalSpline(pts2, 0.5f, 360, Color::GREEN, 2.0f); int i1 = RandomHelper::random_int(0, n - 1); int i2 = RandomHelper::random_int(0, n - 1); - drawNode->drawDot(pts->getControlPointAtIndex(i1), 7, Color4F(0, 1, 0, 0.3)); - drawNode->drawDot(pts->getControlPointAtIndex(i1), 4, Color4F::GREEN); + drawNode->drawDot(pts->getControlPointAtIndex(i1), 7, Color(0, 1, 0, 0.3)); + drawNode->drawDot(pts->getControlPointAtIndex(i1), 4, Color::GREEN); - drawNode->drawDot(pts2->getControlPointAtIndex(i2), 7, Color4F(0, 1, 0, 0.3)); - drawNode->drawDot(pts2->getControlPointAtIndex(i2), 4, Color4F::GREEN); + drawNode->drawDot(pts2->getControlPointAtIndex(i2), 7, Color(0, 1, 0, 0.3)); + drawNode->drawDot(pts2->getControlPointAtIndex(i2), 4, Color::GREEN); } #if defined(AX_PLATFORM_PC) @@ -3557,7 +3557,7 @@ std::string CandyMixEeffect::subtitle() const return ""; } -void CandyMixEeffect::renderLine(float x1, float x2, float y, ax::Color4F color, float angle) +void CandyMixEeffect::renderLine(float x1, float x2, float y, ax::Color color, float angle) { static float WID = 400; @@ -3580,7 +3580,7 @@ void CandyMixEeffect::renderLine(float x1, float x2, float y, ax::Color4F color, float rr = MIN(mm, r * sf + sp); float gg = MIN(mm, g * sf + sp); float bb = MIN(mm, b * sf + sp); - drawNode->drawPoint(Vec2(y, x - 50), 2.0f, Color4F(rr, gg, bb, 1.0f)); + drawNode->drawPoint(Vec2(y, x - 50), 2.0f, Color(rr, gg, bb, 1.0f)); } } @@ -3605,13 +3605,13 @@ void CandyMixEeffect::update(float dt) float x3 = xa + sin(rot + (float)M_PI) * rad; float x4 = xa + sin(rot + (float)M_PI * 1.5f) * rad; if (x1 < x2) - renderLine(x1, x2, y, Color4F::RED, rot); + renderLine(x1, x2, y, Color::RED, rot); if (x2 < x3) - renderLine(x2, x3, y, Color4F::GREEN, rot + (float)M_PI * 0.5f); + renderLine(x2, x3, y, Color::GREEN, rot + (float)M_PI * 0.5f); if (x3 < x4) - renderLine(x3, x4, y, Color4F::BLUE, rot + (float)M_PI); + renderLine(x3, x4, y, Color::BLUE, rot + (float)M_PI); if (x4 < x1) - renderLine(x4, x1, y, Color4F::YELLOW, rot + (float)M_PI * 1.5f); + renderLine(x4, x1, y, Color::YELLOW, rot + (float)M_PI * 1.5f); t += sin(ta + ya) * tb; xa += sin(t + ta) * 0.1f; } diff --git a/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.cpp b/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.cpp index d70826688c06..3737f0ddc6ea 100644 --- a/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.cpp +++ b/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.cpp @@ -65,7 +65,7 @@ void DrawNode3D::ensureCapacity(int count) if (!_customCommand.getVertexBuffer() || _customCommand.getVertexBuffer()->getSize() < (EXTENDED_SIZE * sizeof(_bufferLines[0]))) { - _customCommand.createVertexBuffer(sizeof(V3F_C4B), EXTENDED_SIZE + (EXTENDED_SIZE >> 1), + _customCommand.createVertexBuffer(sizeof(V3F_C4F), EXTENDED_SIZE + (EXTENDED_SIZE >> 1), CustomCommand::BufferUsage::DYNAMIC); } } @@ -90,7 +90,7 @@ bool DrawNode3D::init() _customCommand.setDrawType(CustomCommand::DrawType::ARRAY); _customCommand.setPrimitiveType(CustomCommand::PrimitiveType::LINE); - _customCommand.createVertexBuffer(sizeof(V3F_C4B), INITIAL_VERTEX_BUFFER_LENGTH, + _customCommand.createVertexBuffer(sizeof(V3F_C4F), INITIAL_VERTEX_BUFFER_LENGTH, CustomCommand::BufferUsage::DYNAMIC); _isDirty = true; @@ -147,15 +147,8 @@ void DrawNode3D::drawLine(const Vec3& from, const Vec3& to, const Color4F& color unsigned int vertex_count = 2; ensureCapacity(vertex_count); - Color4B col = Color4B(color); - V3F_C4B a = {Vec3(from.x, from.y, from.z), col}; - V3F_C4B b = { - Vec3(to.x, to.y, to.z), - col, - }; - - _bufferLines.emplace_back(a); - _bufferLines.emplace_back(b); + _bufferLines.emplace_back(from); + _bufferLines.emplace_back(to); _isDirty = true; } diff --git a/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.h b/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.h index 83682058fdf7..7180e4a3a9bb 100644 --- a/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.h +++ b/tests/cpp-tests/Source/MeshRendererTest/DrawNode3D.h @@ -98,7 +98,7 @@ class DrawNode3D : public ax::Node backend::ProgramState* _programStateLine = nullptr; backend::DepthStencilDescriptor* _depthstencilDescriptor = nullptr; backend::UniformLocation _locMVPMatrix; - std::vector _bufferLines; + std::vector _bufferLines; private: AX_DISALLOW_COPY_AND_ASSIGN(DrawNode3D); diff --git a/tests/cpp-tests/Source/NodeTest/NodeTest.cpp b/tests/cpp-tests/Source/NodeTest/NodeTest.cpp index bf7960cbc88a..c794036bcbde 100644 --- a/tests/cpp-tests/Source/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Source/NodeTest/NodeTest.cpp @@ -963,8 +963,8 @@ bool MySprite::setProgramState(backend::ProgramState* programState, bool ownPS/* _customCommand.setDrawType(CustomCommand::DrawType::ARRAY); _customCommand.setPrimitiveType(CustomCommand::PrimitiveType::TRIANGLE_STRIP); - _customCommand.createVertexBuffer(sizeof(V3F_C4B_T2F), 4, CustomCommand::BufferUsage::STATIC); - _customCommand.updateVertexBuffer(&_quad, 4 * sizeof(V3F_C4B_T2F)); + _customCommand.createVertexBuffer(sizeof(V3F_C4F_T2F), 4, CustomCommand::BufferUsage::STATIC); + _customCommand.updateVertexBuffer(&_quad, 4 * sizeof(V3F_C4F_T2F)); return true; } return false;