mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 01:55:21 +03:00
chore(gx): tweak style in GxPrimVertexPtr
This commit is contained in:
parent
1ef7d46ba3
commit
0003d5bd4b
@ -242,6 +242,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
|
|
||||||
if (pos && normal && color) {
|
if (pos && normal && color) {
|
||||||
format = GxVBF_PNC;
|
format = GxVBF_PNC;
|
||||||
|
|
||||||
if (tex0 && tex1) {
|
if (tex0 && tex1) {
|
||||||
format = GxVBF_PNCT2;
|
format = GxVBF_PNCT2;
|
||||||
} else if (tex0) {
|
} else if (tex0) {
|
||||||
@ -249,6 +250,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
}
|
}
|
||||||
} else if (pos && normal) {
|
} else if (pos && normal) {
|
||||||
format = GxVBF_PN;
|
format = GxVBF_PN;
|
||||||
|
|
||||||
if (tex0 && tex1) {
|
if (tex0 && tex1) {
|
||||||
format = GxVBF_PNT2;
|
format = GxVBF_PNT2;
|
||||||
} else if (tex0) {
|
} else if (tex0) {
|
||||||
@ -256,6 +258,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
}
|
}
|
||||||
} else if (pos && color) {
|
} else if (pos && color) {
|
||||||
format = GxVBF_PC;
|
format = GxVBF_PC;
|
||||||
|
|
||||||
if (tex0 && tex1) {
|
if (tex0 && tex1) {
|
||||||
format = GxVBF_PCT2;
|
format = GxVBF_PCT2;
|
||||||
} else if (tex0) {
|
} else if (tex0) {
|
||||||
@ -281,6 +284,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
|
|
||||||
auto bufPos = reinterpret_cast<C3Vector*>(bufData + GxVertexAttribOffset(format, GxVA_Position));
|
auto bufPos = reinterpret_cast<C3Vector*>(bufData + GxVertexAttribOffset(format, GxVA_Position));
|
||||||
auto bufPosStride = vertexSize;
|
auto bufPosStride = vertexSize;
|
||||||
|
|
||||||
auto bufNormal = reinterpret_cast<C3Vector*>(bufData + GxVertexAttribOffset(format, GxVA_Normal));
|
auto bufNormal = reinterpret_cast<C3Vector*>(bufData + GxVertexAttribOffset(format, GxVA_Normal));
|
||||||
auto bufNormalStride = vertexSize;
|
auto bufNormalStride = vertexSize;
|
||||||
if (!normal) {
|
if (!normal) {
|
||||||
@ -289,6 +293,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
bufNormal = &emptyNormal;
|
bufNormal = &emptyNormal;
|
||||||
bufNormalStride = 0;
|
bufNormalStride = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bufColor = reinterpret_cast<CImVector*>(bufData + GxVertexAttribOffset(format, GxVA_Color0));
|
auto bufColor = reinterpret_cast<CImVector*>(bufData + GxVertexAttribOffset(format, GxVA_Color0));
|
||||||
auto bufColorStride = vertexSize;
|
auto bufColorStride = vertexSize;
|
||||||
if (!color) {
|
if (!color) {
|
||||||
@ -297,6 +302,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
bufColor = &emptyColor;
|
bufColor = &emptyColor;
|
||||||
bufColorStride = 0;
|
bufColorStride = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bufTex0 = reinterpret_cast<C2Vector*>(bufData + GxVertexAttribOffset(format, GxVA_TexCoord0));
|
auto bufTex0 = reinterpret_cast<C2Vector*>(bufData + GxVertexAttribOffset(format, GxVA_TexCoord0));
|
||||||
auto bufTex0Stride = vertexSize;
|
auto bufTex0Stride = vertexSize;
|
||||||
if (!tex0) {
|
if (!tex0) {
|
||||||
@ -305,6 +311,7 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
bufTex0 = &emptyTex0;
|
bufTex0 = &emptyTex0;
|
||||||
bufTex0Stride = 0;
|
bufTex0Stride = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bufTex1 = reinterpret_cast<C2Vector*>(bufData + GxVertexAttribOffset(format, GxVA_TexCoord1));
|
auto bufTex1 = reinterpret_cast<C2Vector*>(bufData + GxVertexAttribOffset(format, GxVA_TexCoord1));
|
||||||
auto bufTex1Stride = vertexSize;
|
auto bufTex1Stride = vertexSize;
|
||||||
if (!tex1) {
|
if (!tex1) {
|
||||||
@ -314,31 +321,27 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri
|
|||||||
bufTex1Stride = 0;
|
bufTex1Stride = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertexCount != 0) {
|
for (uint32_t i = 0; i < vertexCount; i++) {
|
||||||
C3Vector* bufPos = reinterpret_cast<C3Vector*>(reinterpret_cast<uintptr_t>(bufData) + uintptr_t(GxVertexAttribOffset(format, GxVA_Position)));
|
*bufPos = *pos;
|
||||||
|
pos = reinterpret_cast<const C3Vector*>(reinterpret_cast<uintptr_t>(pos) + posStride);
|
||||||
|
bufPos = reinterpret_cast<C3Vector*>(reinterpret_cast<uintptr_t>(bufPos) + bufPosStride);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < vertexCount; i++) {
|
*bufNormal = *normal;
|
||||||
*bufPos = *pos;
|
normal = reinterpret_cast<const C3Vector*>(reinterpret_cast<uintptr_t>(normal) + normalStride);
|
||||||
pos = reinterpret_cast<const C3Vector*>(reinterpret_cast<uintptr_t>(pos) + posStride);
|
bufNormal = reinterpret_cast<C3Vector*>(reinterpret_cast<uintptr_t>(bufNormal) + bufNormalStride);
|
||||||
bufPos = reinterpret_cast<C3Vector*>(reinterpret_cast<uintptr_t>(bufPos) + bufPosStride);
|
|
||||||
|
|
||||||
*bufNormal = *normal;
|
*bufColor = *color;
|
||||||
normal = reinterpret_cast<const C3Vector*>(reinterpret_cast<uintptr_t>(normal) + normalStride);
|
GxFormatColor(*bufColor);
|
||||||
bufNormal = reinterpret_cast<C3Vector*>(reinterpret_cast<uintptr_t>(bufNormal) + bufNormalStride);
|
color = reinterpret_cast<const CImVector*>(reinterpret_cast<uintptr_t>(color) + colorStride);
|
||||||
*bufColor = *color;
|
bufColor = reinterpret_cast<CImVector*>(reinterpret_cast<uintptr_t>(bufColor) + bufColorStride);
|
||||||
|
|
||||||
GxFormatColor(*bufColor);
|
*bufTex0 = *tex0;
|
||||||
color = reinterpret_cast<const CImVector*>(reinterpret_cast<uintptr_t>(color) + colorStride);
|
tex0 = reinterpret_cast<const C2Vector*>(reinterpret_cast<uintptr_t>(tex0) + tex0Stride);
|
||||||
bufColor = reinterpret_cast<CImVector*>(reinterpret_cast<uintptr_t>(bufColor) + bufColorStride);
|
bufTex0 = reinterpret_cast<C2Vector*>(reinterpret_cast<uintptr_t>(bufTex0) + bufTex0Stride);
|
||||||
|
|
||||||
*bufTex0 = *tex0;
|
*bufTex1 = *tex1;
|
||||||
tex0 = reinterpret_cast<const C2Vector*>(reinterpret_cast<uintptr_t>(tex0) + tex0Stride);
|
tex1 = reinterpret_cast<const C2Vector*>(reinterpret_cast<uintptr_t>(tex1) + tex1Stride);
|
||||||
bufTex0 = reinterpret_cast<C2Vector*>(reinterpret_cast<uintptr_t>(bufTex0) + bufTex0Stride);
|
bufTex1 = reinterpret_cast<C2Vector*>(reinterpret_cast<uintptr_t>(bufTex1) + bufTex1Stride);
|
||||||
|
|
||||||
*bufTex1 = *tex1;
|
|
||||||
tex1 = reinterpret_cast<const C2Vector*>(reinterpret_cast<uintptr_t>(tex1) + tex1Stride);
|
|
||||||
bufTex1 = reinterpret_cast<C2Vector*>(reinterpret_cast<uintptr_t>(bufTex1) + bufTex1Stride);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GxBufUnlock(buf, vertexSize * vertexCount);
|
GxBufUnlock(buf, vertexSize * vertexCount);
|
||||||
|
Loading…
Reference in New Issue
Block a user