mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
chore(gx): improve parameter and variable names in TEXTLINETEXTURE::WriteGeometry
This commit is contained in:
parent
1f160ebd06
commit
30fd02c942
@ -28,8 +28,8 @@ void TEXTLINETEXTURE::Recycle(TEXTLINETEXTURE* ptr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buf, const CImVector& fontColor, const C2Vector& shadowOffset, const CImVector& shadowColor, const C3Vector& viewTranslation, bool hasShadow, bool a8, int32_t ofs, int32_t size) {
|
void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buffer, const CImVector& fontColor, const C2Vector& shadowOffset, const CImVector& shadowColor, const C3Vector& viewTranslation, bool hasShadow, bool a8, int32_t vertexOffset, int32_t vertexCount) {
|
||||||
if (!size || !this->m_vert.Count()) {
|
if (!vertexCount || !this->m_vert.Count()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,14 +37,14 @@ void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buf, const CImVector& fontColo
|
|||||||
? this->m_colors.Count()
|
? this->m_colors.Count()
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
if (ofs >= this->m_vert.Count()) {
|
if (vertexOffset >= this->m_vert.Count()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t v24 = this->m_vert.Count() - ofs;
|
uint32_t v24 = this->m_vert.Count() - vertexOffset;
|
||||||
|
|
||||||
if (size >= v24) {
|
if (vertexCount >= v24) {
|
||||||
size = v24;
|
vertexCount = v24;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasShadow) {
|
if (hasShadow) {
|
||||||
@ -54,19 +54,19 @@ void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buf, const CImVector& fontColo
|
|||||||
viewTranslation.z
|
viewTranslation.z
|
||||||
};
|
};
|
||||||
|
|
||||||
auto color = colorCount ? this->m_colors[ofs] : fontColor;
|
auto color = colorCount ? this->m_colors[vertexOffset] : fontColor;
|
||||||
|
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < vertexCount; i++) {
|
||||||
auto& vert = this->m_vert[i + ofs];
|
auto& vertex = this->m_vert[vertexOffset + i];
|
||||||
|
|
||||||
C3Vector p = {
|
C3Vector p = {
|
||||||
vert.vc.x + shadowTranslation.x,
|
vertex.vc.x + shadowTranslation.x,
|
||||||
vert.vc.y + shadowTranslation.y,
|
vertex.vc.y + shadowTranslation.y,
|
||||||
vert.vc.z + shadowTranslation.z
|
vertex.vc.z + shadowTranslation.z
|
||||||
};
|
};
|
||||||
|
|
||||||
buf->p = p;
|
buffer->p = p;
|
||||||
buf->tc[0] = vert.tc;
|
buffer->tc[0] = vertex.tc;
|
||||||
|
|
||||||
auto formattedShadowColor = shadowColor;
|
auto formattedShadowColor = shadowColor;
|
||||||
if (a8 && colorCount) {
|
if (a8 && colorCount) {
|
||||||
@ -75,9 +75,9 @@ void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buf, const CImVector& fontColo
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
GxFormatColor(formattedShadowColor);
|
GxFormatColor(formattedShadowColor);
|
||||||
buf->c = formattedShadowColor;
|
buffer->c = formattedShadowColor;
|
||||||
|
|
||||||
buf++;
|
buffer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,10 +85,10 @@ void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buf, const CImVector& fontColo
|
|||||||
// // TODO
|
// // TODO
|
||||||
// }
|
// }
|
||||||
|
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < vertexCount; i++) {
|
||||||
auto& vert = this->m_vert[i + ofs];
|
auto& vertex = this->m_vert[vertexOffset + i];
|
||||||
|
|
||||||
auto color = colorCount ? this->m_colors[i + ofs] : fontColor;
|
auto color = colorCount ? this->m_colors[vertexOffset + i] : fontColor;
|
||||||
GxFormatColor(color);
|
GxFormatColor(color);
|
||||||
|
|
||||||
// if (BATCHEDRENDERFONTDESC::s_billboarded) {
|
// if (BATCHEDRENDERFONTDESC::s_billboarded) {
|
||||||
@ -97,17 +97,17 @@ void TEXTLINETEXTURE::WriteGeometry(CGxVertexPCT* buf, const CImVector& fontColo
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
C3Vector p = {
|
C3Vector p = {
|
||||||
vert.vc.x + viewTranslation.x,
|
vertex.vc.x + viewTranslation.x,
|
||||||
vert.vc.y + viewTranslation.y,
|
vertex.vc.y + viewTranslation.y,
|
||||||
vert.vc.z + viewTranslation.z
|
vertex.vc.z + viewTranslation.z
|
||||||
};
|
};
|
||||||
|
|
||||||
buf->p = p;
|
buffer->p = p;
|
||||||
buf->tc[0] = vert.tc;
|
buffer->tc[0] = vertex.tc;
|
||||||
|
|
||||||
buf->c = color;
|
buffer->c = color;
|
||||||
|
|
||||||
buf++;
|
buffer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class TEXTLINETEXTURE {
|
|||||||
TSGrowableArray<CImVector> m_colors;
|
TSGrowableArray<CImVector> m_colors;
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
void WriteGeometry(CGxVertexPCT*, const CImVector&, const C2Vector&, const CImVector&, const C3Vector&, bool hasShadow, bool, int32_t, int32_t);
|
void WriteGeometry(CGxVertexPCT*, const CImVector&, const C2Vector&, const CImVector&, const C3Vector&, bool hasShadow, bool, int32_t vertexOffset, int32_t vertexCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGxString : public TSLinkedNode<CGxString> {
|
class CGxString : public TSLinkedNode<CGxString> {
|
||||||
|
|||||||
@ -173,14 +173,14 @@ void BATCHEDRENDERFONTDESC::RenderBatch() {
|
|||||||
int32_t sliceOffset = 0;
|
int32_t sliceOffset = 0;
|
||||||
|
|
||||||
while (vertsNeeded) {
|
while (vertsNeeded) {
|
||||||
int32_t sliceSize = std::min(vertsNeeded, batchCapacity);
|
int32_t sliceCount = std::min(vertsNeeded, batchCapacity);
|
||||||
|
|
||||||
string->WriteGeometry(vertexBuf, i, sliceOffset, sliceSize);
|
string->WriteGeometry(vertexBuf, i, sliceOffset, sliceCount);
|
||||||
|
|
||||||
vertsNeeded -= sliceSize;
|
vertsNeeded -= sliceCount;
|
||||||
sliceOffset += sliceSize;
|
sliceOffset += sliceCount;
|
||||||
batchCapacity -= sliceSize;
|
batchCapacity -= sliceCount;
|
||||||
vertexBuf += sliceSize;
|
vertexBuf += sliceCount;
|
||||||
|
|
||||||
if (!batchCapacity) {
|
if (!batchCapacity) {
|
||||||
vertexBuf = this->UnlockVertexPtrAndRender(vertexStream, maxBatchCapacity);
|
vertexBuf = this->UnlockVertexPtrAndRender(vertexStream, maxBatchCapacity);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user