Skip to content

Commit eae98df

Browse files
committed
Change underlaying color type to Color4F aka ax::Color
1 parent 4176cc4 commit eae98df

File tree

88 files changed

+981
-1065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+981
-1065
lines changed

core/2d/AnchoredSprite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ AnchoredSprite* AnchoredSprite::create()
147147
return nullptr;
148148
}
149149

150-
void AnchoredSprite::setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad)
150+
void AnchoredSprite::setVertexCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad)
151151
{
152152
float relativeOffsetX = _unflippedOffsetPositionFromCenter.x - getContentSize().x * _spriteVertexAnchor.x;
153153
float relativeOffsetY = _unflippedOffsetPositionFromCenter.y - getContentSize().y * _spriteVertexAnchor.y;

core/2d/AnchoredSprite.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class AX_DLL AnchoredSprite : public Sprite
143143
virtual Rect getTouchRect();
144144

145145
protected:
146-
virtual void setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad) override;
146+
virtual void setVertexCoords(const Rect& rect, V3F_C4F_T2F_Quad* outQuad) override;
147147
Vec2 _spriteVertexAnchor = Vec2::ANCHOR_MIDDLE;
148148
};
149149

core/2d/AutoPolygon.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PolygonInfo::PolygonInfo(const PolygonInfo& other) : triangles(), _isVertsOwner(
6363
_filename = other._filename;
6464
_isVertsOwner = true;
6565
_rect = other._rect;
66-
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
66+
triangles.verts = new V3F_C4F_T2F[other.triangles.vertCount];
6767
triangles.indices = new unsigned short[other.triangles.indexCount];
6868
AXASSERT(triangles.verts && triangles.indices, "not enough memory");
6969
triangles.vertCount = other.triangles.vertCount;
@@ -80,7 +80,7 @@ PolygonInfo& PolygonInfo::operator=(const PolygonInfo& other)
8080
_filename = other._filename;
8181
_isVertsOwner = true;
8282
_rect = other._rect;
83-
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
83+
triangles.verts = new V3F_C4F_T2F[other.triangles.vertCount];
8484
triangles.indices = new unsigned short[other.triangles.indexCount];
8585
AXASSERT(triangles.verts && triangles.indices, "not enough memory");
8686
triangles.vertCount = other.triangles.vertCount;
@@ -97,17 +97,17 @@ PolygonInfo::~PolygonInfo()
9797
releaseVertsAndIndices();
9898
}
9999

100-
void PolygonInfo::setQuad(V3F_C4B_T2F_Quad* quad)
100+
void PolygonInfo::setQuad(V3F_C4F_T2F_Quad* quad)
101101
{
102102
releaseVertsAndIndices();
103103
_isVertsOwner = false;
104104
triangles.indices = quadIndices9;
105105
triangles.vertCount = 4;
106106
triangles.indexCount = 6;
107-
triangles.verts = (V3F_C4B_T2F*)quad;
107+
triangles.verts = (V3F_C4F_T2F*)quad;
108108
}
109109

110-
void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads)
110+
void PolygonInfo::setQuads(V3F_C4F_T2F_Quad* quad, int numberOfQuads)
111111
{
112112
AXASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads");
113113

@@ -116,7 +116,7 @@ void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads)
116116
triangles.indices = quadIndices9;
117117
triangles.vertCount = 4 * numberOfQuads;
118118
triangles.indexCount = 6 * numberOfQuads;
119-
triangles.verts = (V3F_C4B_T2F*)quad;
119+
triangles.verts = (V3F_C4F_T2F*)quad;
120120
}
121121

122122
void PolygonInfo::setTriangles(const TrianglesCommand::Triangles& other)
@@ -159,7 +159,7 @@ unsigned int PolygonInfo::getTrianglesCount() const
159159
float PolygonInfo::getArea() const
160160
{
161161
float area = 0;
162-
V3F_C4B_T2F* verts = triangles.verts;
162+
V3F_C4F_T2F* verts = triangles.verts;
163163
unsigned short* indices = triangles.indices;
164164
for (unsigned int i = 0; i < triangles.indexCount; i += 3)
165165
{
@@ -610,7 +610,7 @@ TrianglesCommand::Triangles AutoPolygon::triangulate(const std::vector<Vec2>& po
610610
std::vector<p2t::Triangle*> tris = cdt.GetTriangles();
611611

612612
axstd::pod_vector<unsigned short> indices(tris.size() * 3);
613-
axstd::pod_vector<V3F_C4B_T2F> verts;
613+
axstd::pod_vector<V3F_C4F_T2F> verts;
614614
verts.reserve(indices.size() / 2); // we won't know the size of verts until we process all of the triangles!
615615

616616
unsigned short idx = 0;
@@ -641,9 +641,9 @@ TrianglesCommand::Triangles AutoPolygon::triangulate(const std::vector<Vec2>& po
641641
else
642642
{
643643
// vert does not exist yet, so we need to create a new one,
644-
auto c4b = Color4B::WHITE;
644+
auto c = Color::WHITE;
645645
auto t2f = Tex2F(0, 0); // don't worry about tex coords now, we calculate that later
646-
verts.push_back(V3F_C4B_T2F{v3, c4b, t2f});
646+
verts.push_back(V3F_C4F_T2F{v3, c, t2f});
647647
indices[idx++] = vdx++;;
648648
}
649649
}
@@ -656,7 +656,7 @@ TrianglesCommand::Triangles AutoPolygon::triangulate(const std::vector<Vec2>& po
656656
return triangles;
657657
}
658658

659-
void AutoPolygon::calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t count)
659+
void AutoPolygon::calculateUV(const Rect& rect, V3F_C4F_T2F* verts, ssize_t count)
660660
{
661661
/*
662662
whole texture UV coordination

core/2d/AutoPolygon.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ class AX_DLL PolygonInfo
8080
* set the data to be a pointer to a quad
8181
* the member verts will not be released when this PolygonInfo destructs
8282
* as the verts memory are managed by other objects
83-
* @param quad a pointer to the V3F_C4B_T2F_Quad object
83+
* @param quad a pointer to the V3F_C4F_T2F_Quad object
8484
*/
85-
void setQuad(V3F_C4B_T2F_Quad* quad);
85+
void setQuad(V3F_C4F_T2F_Quad* quad);
8686

8787
/**
8888
* set the data to be a pointer to a number of Quads
8989
* the member verts will not be released when this PolygonInfo destructs
9090
* as the verts memory are managed by other objects
91-
* @param quad a pointer to the V3F_C4B_T2F_Quad quads
91+
* @param quad a pointer to the V3F_C4F_T2F_Quad quads
9292
*/
93-
void setQuads(V3F_C4B_T2F_Quad* quads, int numberOfQuads);
93+
void setQuads(V3F_C4F_T2F_Quad* quads, int numberOfQuads);
9494

9595
/**
9696
* set the data to be a pointer to a triangles
@@ -225,7 +225,7 @@ class AX_DLL AutoPolygon
225225
* ap.calculateUV(rect, myPolygons.verts, 20);
226226
* @endcode
227227
*/
228-
void calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t count);
228+
void calculateUV(const Rect& rect, V3F_C4F_T2F* verts, ssize_t count);
229229

230230
/**
231231
* a helper function, packing trace, reduce, expand, triangulate and calculate uv in one function

core/2d/CameraBackgroundBrush.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ CameraBackgroundBrush* CameraBackgroundBrush::createNoneBrush()
6262
return ret;
6363
}
6464

65-
CameraBackgroundColorBrush* CameraBackgroundBrush::createColorBrush(const Color4F& color, float depth)
65+
CameraBackgroundColorBrush* CameraBackgroundBrush::createColorBrush(const Color& color, float depth)
6666
{
6767
return CameraBackgroundColorBrush::create(color, depth);
6868
}
@@ -138,7 +138,7 @@ bool CameraBackgroundDepthBrush::init()
138138
_vertices[2].vertices = Vec3(1, 1, 0);
139139
_vertices[3].vertices = Vec3(-1, 1, 0);
140140

141-
_vertices[0].colors = _vertices[1].colors = _vertices[2].colors = _vertices[3].colors = Color4B(0, 0, 0, 1);
141+
_vertices[0].colors = _vertices[1].colors = _vertices[2].colors = _vertices[3].colors = Color(0, 0, 0, 1);
142142

143143
_vertices[0].texCoords = Tex2F(0, 0);
144144
_vertices[1].texCoords = Tex2F(1, 0);
@@ -231,16 +231,16 @@ void CameraBackgroundColorBrush::drawBackground(Camera* camera)
231231
CameraBackgroundDepthBrush::drawBackground(camera);
232232
}
233233

234-
void CameraBackgroundColorBrush::setColor(const Color4F& color)
234+
void CameraBackgroundColorBrush::setColor(const Color& color)
235235
{
236236
for (auto&& vert : _vertices)
237237
{
238-
vert.colors = Color4B(color);
238+
vert.colors = color;
239239
}
240240
_customCommand.updateVertexBuffer(_vertices.data(), sizeof(_vertices[0]) * _vertices.size());
241241
}
242242

243-
CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& color, float depth)
243+
CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color& color, float depth)
244244
{
245245
auto ret = new CameraBackgroundColorBrush();
246246

core/2d/CameraBackgroundBrush.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class AX_DLL CameraBackgroundBrush : public Object
9595
* @param depth Depth used to clear depth buffer
9696
* @return Created brush
9797
*/
98-
static CameraBackgroundColorBrush* createColorBrush(const Color4F& color, float depth);
98+
static CameraBackgroundColorBrush* createColorBrush(const Color& color, float depth);
9999

100100
/** Creates a Skybox brush with 6 textures.
101101
@param positive_x texture for the right side of the texture cube face.
@@ -179,7 +179,7 @@ class AX_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
179179
CustomCommand _customCommand;
180180

181181
bool _clearColor;
182-
std::vector<V3F_C4B_T2F> _vertices;
182+
std::vector<V3F_C4F_T2F> _vertices;
183183
struct
184184
{
185185
uint32_t stencilWriteMask = 0;
@@ -206,7 +206,7 @@ class AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush
206206
* @param depth Depth used to clear the depth buffer
207207
* @return Created brush
208208
*/
209-
static CameraBackgroundColorBrush* create(const Color4F& color, float depth);
209+
static CameraBackgroundColorBrush* create(const Color& color, float depth);
210210

211211
/**
212212
* Draw background
@@ -217,15 +217,15 @@ class AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush
217217
* Set clear color
218218
* @param color Color used to clear the color buffer
219219
*/
220-
void setColor(const Color4F& color);
220+
void setColor(const Color& color);
221221

222222
CameraBackgroundColorBrush();
223223
virtual ~CameraBackgroundColorBrush();
224224

225225
virtual bool init() override;
226226

227227
protected:
228-
Color4F _color;
228+
Color _color;
229229
};
230230

231231
class TextureCube;

0 commit comments

Comments
 (0)