Change O3DVertex struct

FossilOrigin-Name: 2bf3eabe2875f0326928d79864923dab8a34d4d0a706d21bcf9370cb456fdd0d
This commit is contained in:
Jonathan Schleifer 2023-01-13 14:43:43 +00:00
parent cdf559f8e3
commit 95fd0d1a5d
3 changed files with 20 additions and 14 deletions

View file

@ -212,12 +212,14 @@ grGlideShutdownCdecl(void)
GrVertex *glideVertices = OFAllocZeroedMemory(count, sizeof(GrVertex));
@try {
for (size_t i = 0; i < count; i++) {
glideVertices[i].x = (vertices[i].x + 1) * halfWidth;
glideVertices[i].y = (vertices[i].y + 1) * halfHeight;
glideVertices[i].r = vertices[i].r * 255;
glideVertices[i].g = vertices[i].g * 255;
glideVertices[i].b = vertices[i].b * 255;
glideVertices[i].a = vertices[i].a * 255;
glideVertices[i].x =
(vertices[i].position.x + 1) * halfWidth;
glideVertices[i].y =
(vertices[i].position.y + 1) * halfHeight;
glideVertices[i].r = vertices[i].color.r * 255;
glideVertices[i].g = vertices[i].color.g * 255;
glideVertices[i].b = vertices[i].color.b * 255;
glideVertices[i].a = vertices[i].color.a * 255;
}
grDrawPolygonVertexList((int)count, glideVertices);

View file

@ -18,8 +18,12 @@
OF_ASSUME_NONNULL_BEGIN
typedef struct OF_BOXABLE {
float x, y;
float r, g, b, a;
struct {
float x, y;
} position;
struct {
float r, g, b, a;
} color;
} O3DVertex;
@protocol O3DRenderer <OFObject>

View file

@ -32,14 +32,14 @@ OF_APPLICATION_DELEGATE(TestsAppDelegate)
options: nil] autorelease];
const O3DVertex outerTriangle[] = {
{ -1, -1, 1, 0, 0 },
{ 0, 1, 0, 1, 0 },
{ 1, -1, 0, 0, 1 }
{{ -1, -1 }, { 1, 0, 0 }},
{{ 0, 1 }, { 0, 1, 0 }},
{{ 1, -1 }, { 0, 0, 1 }}
};
const O3DVertex innerTriangle[] = {
{ -0.5, 0.5, 1, 1, 0 },
{ 0, -0.5, 0, 1, 1 },
{ 0.5, 0.5, 1, 0, 1 }
{{ -0.5, 0.5 }, { 1, 1, 0 }},
{{ 0, -0.5 }, { 0, 1, 1 }},
{{ 0.5, 0.5 }, { 1, 0, 1 }}
};
OFDate *startDate = [OFDate date];