From bd10c026f7da62701d78c8f758cbdc644057229c Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Wed, 29 Oct 2025 16:11:46 -0500 Subject: [PATCH] pumpkin_man: include eye object --- drm/pumpkin_man.c | 43 ++++--- model/pumpkin/pumpkin.h | 244 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 264 insertions(+), 23 deletions(-) diff --git a/drm/pumpkin_man.c b/drm/pumpkin_man.c index 6ac4cf3..a927489 100644 --- a/drm/pumpkin_man.c +++ b/drm/pumpkin_man.c @@ -430,9 +430,9 @@ int _3d_object(int ix, // VAP_PVS ////////////////////////////////////////////////////////////////////////////// - float theta1 = theta; + float theta1 = 3.2 * 3.14f / 2; //float theta2 = 3.14f * theta; - float theta2 = theta; + float theta2 = 2 * 3.14f / 2 + theta; const float consts[] = { I_PI_2, 0.5f, PI_2, -PI, theta1, theta2, 0.1f, 0.5f, @@ -1098,11 +1098,12 @@ int main() int vertexbuffer_handle; int flush_handle; + void * colorbuffer_ptr[2]; void * vertexbuffer_ptr; // colorbuffer - colorbuffer_handle[0] = create_colorbuffer(fd, colorbuffer_size, NULL); - colorbuffer_handle[1] = create_colorbuffer(fd, colorbuffer_size, NULL); + colorbuffer_handle[0] = create_colorbuffer(fd, colorbuffer_size, &colorbuffer_ptr[0]); + colorbuffer_handle[1] = create_colorbuffer(fd, colorbuffer_size, &colorbuffer_ptr[1]); zbuffer_handle = create_colorbuffer(fd, colorbuffer_size, NULL); vertexbuffer_handle = create_colorbuffer(fd, vertexbuffer_size, &vertexbuffer_ptr); @@ -1266,28 +1267,24 @@ int main() // next state theta += 0.01f; colorbuffer_ix = (colorbuffer_ix + 1) & 1; + } - /* - int out_fd = open("colorbuffer.data", O_RDWR|O_CREAT); - assert(out_fd >= 0); - ssize_t write_length = write(out_fd, colorbuffer_ptr, colorbuffer_size); - assert(write_length == colorbuffer_size); - close(out_fd); - - int mm_fd = open("/sys/kernel/debug/radeon_vram_mm", O_RDONLY); - assert(mm_fd >= 0); - char buf[4096]; - while (true) { - ssize_t read_length = read(mm_fd, buf, 4096); - assert(read_length >= 0); - write(STDOUT_FILENO, buf, read_length); - if (read_length < 4096) { - break; - } + { + int out_fd = open("colorbuffer0.data", O_RDWR|O_CREAT, 0644); + assert(out_fd >= 0); + ssize_t write_length = write(out_fd, colorbuffer_ptr[0], colorbuffer_size); + assert(write_length == colorbuffer_size); + close(out_fd); + } + + { + int out_fd = open("colorbuffer1.data", O_RDWR|O_CREAT, 0644); + assert(out_fd >= 0); + ssize_t write_length = write(out_fd, colorbuffer_ptr[1], colorbuffer_size); + assert(write_length == colorbuffer_size); + close(out_fd); } - close(mm_fd); - */ close(fd); } diff --git a/model/pumpkin/pumpkin.h b/model/pumpkin/pumpkin.h index 3b4d30c..29d4a10 100644 --- a/model/pumpkin/pumpkin.h +++ b/model/pumpkin/pumpkin.h @@ -89419,6 +89419,240 @@ static const struct mesh mesh_chestmesh = { .edge_polygons_length = (sizeof (mesh_chestmesh_edge_polygons)) / (sizeof (mesh_chestmesh_edge_polygons[0])), }; +static const vec3 mesh_eyemesh_position[] = { + {0.227941, -0.470618, 2.041824}, + {0.224004, -0.470465, 2.057800}, + {0.640827, -0.500394, 2.143699}, + {0.578803, -0.497984, 2.395446}, + {0.207094, -0.610637, 2.031570}, + {0.202835, -0.610471, 2.048857}, + {0.653878, -0.642858, 2.141808}, + {0.586762, -0.640249, 2.414223}, + {-0.227941, -0.470618, 2.041824}, + {-0.224004, -0.470465, 2.057800}, + {-0.640827, -0.500394, 2.143699}, + {-0.578803, -0.497984, 2.395446}, + {-0.207094, -0.610637, 2.031570}, + {-0.202835, -0.610471, 2.048857}, + {-0.653878, -0.642858, 2.141808}, + {-0.586762, -0.640249, 2.414223}, +}; + +static const vec2 mesh_eyemesh_UVMap_uvmap[] = { + {0.625000, 0.203130}, + {0.375000, 0.250000}, + {0.375000, 0.203130}, + {0.625000, 0.250000}, + {0.375000, 0.500000}, + {0.375000, 0.250000}, + {0.625000, 0.500000}, + {0.875000, 0.546870}, + {0.625000, 0.546870}, + {0.375000, 0.500000}, + {0.125000, 0.546870}, + {0.125000, 0.500000}, + {0.625000, 0.500000}, + {0.375000, 0.546870}, + {0.375000, 0.500000}, + {-0.000000, 0.000000}, + {0.038812, 1.000000}, + {0.000213, 0.999941}, + {0.375000, 0.250000}, + {0.625000, 0.203130}, + {0.375000, 0.203130}, + {0.375000, 0.500000}, + {0.625000, 0.250000}, + {0.375000, 0.250000}, + {0.625000, 0.500000}, + {0.875000, 0.546870}, + {0.875000, 0.500000}, + {0.125000, 0.546870}, + {0.375000, 0.500000}, + {0.125000, 0.500000}, + {0.375000, 0.546870}, + {0.625000, 0.500000}, + {0.375000, 0.500000}, + {-0.000000, 0.000000}, + {0.038812, 1.000000}, + {0.608206, 0.000000}, + {0.625000, 0.203130}, + {0.625000, 0.250000}, + {0.375000, 0.250000}, + {0.625000, 0.250000}, + {0.625000, 0.500000}, + {0.375000, 0.500000}, + {0.625000, 0.500000}, + {0.875000, 0.500000}, + {0.875000, 0.546870}, + {0.375000, 0.500000}, + {0.375000, 0.546870}, + {0.125000, 0.546870}, + {0.625000, 0.500000}, + {0.625000, 0.546870}, + {0.375000, 0.546870}, + {-0.000000, 0.000000}, + {0.608206, 0.000000}, + {0.038812, 1.000000}, + {0.375000, 0.250000}, + {0.625000, 0.250000}, + {0.625000, 0.203130}, + {0.375000, 0.500000}, + {0.625000, 0.500000}, + {0.625000, 0.250000}, + {0.625000, 0.500000}, + {0.625000, 0.546870}, + {0.875000, 0.546870}, + {0.125000, 0.546870}, + {0.375000, 0.546870}, + {0.375000, 0.500000}, + {0.375000, 0.546870}, + {0.625000, 0.546870}, + {0.625000, 0.500000}, + {-0.000000, 0.000000}, + {0.000213, 0.999941}, + {0.038812, 1.000000}, +}; + +static const vec3 mesh_eyemesh_normal[] = { + {-0.354104, 0.644168, -0.677981}, + {-0.692379, 0.680001, 0.241270}, + {0.692122, 0.584607, -0.423322}, + {0.224766, 0.594573, 0.771986}, + {-0.481440, -0.503712, -0.717279}, + {-0.822130, -0.531116, 0.204981}, + {0.704466, -0.571323, -0.421092}, + {0.241645, -0.516756, 0.821323}, + {0.354103, 0.644168, -0.677982}, + {0.692378, 0.680001, 0.241268}, + {-0.692122, 0.584607, -0.423322}, + {-0.224766, 0.594573, 0.771986}, + {0.481441, -0.503713, -0.717278}, + {0.822130, -0.531116, 0.204982}, + {-0.704466, -0.571323, -0.421092}, + {-0.241645, -0.516756, 0.821323}, +}; + +static const vec3 mesh_eyemesh_polygon_normal[] = { + {-0.958090, 0.160044, -0.237590}, + {0.070035, 0.997515, 0.007703}, + {-0.685905, 0.057374, 0.725426}, + {0.241787, 0.035019, -0.969697}, + {0.967601, 0.085492, 0.237572}, + {-0.070038, -0.997515, -0.007711}, + {0.958091, 0.160042, -0.237588}, + {-0.070036, 0.997515, 0.007701}, + {0.685905, 0.057374, 0.725426}, + {-0.241787, 0.035019, -0.969697}, + {-0.967600, 0.085492, 0.237572}, + {0.070038, -0.997515, -0.007703}, + {-0.958091, 0.160039, -0.237588}, + {0.070038, 0.997515, 0.007704}, + {-0.685905, 0.057374, 0.725426}, + {0.241787, 0.035020, -0.969697}, + {0.967600, 0.085492, 0.237572}, + {-0.070038, -0.997515, -0.007703}, + {0.958091, 0.160040, -0.237590}, + {-0.070038, 0.997515, 0.007704}, + {0.685905, 0.057374, 0.725426}, + {-0.241787, 0.035020, -0.969697}, + {-0.967600, 0.085492, 0.237572}, + {0.070038, -0.997515, -0.007711}, +}; + +static const struct polygon mesh_eyemesh_polygons[] = { + {5, 0, 4, 6}, + {1, 2, 0, 6}, + {3, 5, 7, 6}, + {2, 4, 0, 6}, + {3, 6, 2, 6}, + {6, 5, 4, 6}, + {8, 13, 12, 6}, + {10, 9, 8, 6}, + {11, 13, 9, 6}, + {12, 10, 8, 6}, + {14, 11, 10, 6}, + {14, 13, 15, 6}, + {5, 1, 0, 6}, + {1, 3, 2, 6}, + {3, 1, 5, 6}, + {2, 6, 4, 6}, + {3, 7, 6, 6}, + {6, 7, 5, 6}, + {8, 9, 13, 6}, + {10, 11, 9, 6}, + {11, 15, 13, 6}, + {12, 14, 10, 6}, + {14, 15, 11, 6}, + {14, 12, 13, 6}, +}; + +static const struct edge_polygon mesh_eyemesh_edge_polygons[] = { + {{0, 5}, {0, 12}}, + {{0, 4}, {0, 3}}, + {{4, 5}, {0, 5}}, + {{1, 2}, {1, 13}}, + {{0, 2}, {1, 3}}, + {{0, 1}, {1, 12}}, + {{3, 5}, {2, 14}}, + {{5, 7}, {2, 17}}, + {{3, 7}, {2, 16}}, + {{2, 4}, {3, 15}}, + {{3, 6}, {4, 16}}, + {{2, 6}, {4, 15}}, + {{2, 3}, {4, 13}}, + {{5, 6}, {5, 17}}, + {{4, 6}, {5, 15}}, + {{8, 13}, {6, 18}}, + {{12, 13}, {6, 23}}, + {{8, 12}, {6, 9}}, + {{9, 10}, {7, 19}}, + {{8, 9}, {7, 18}}, + {{8, 10}, {7, 9}}, + {{11, 13}, {8, 20}}, + {{9, 13}, {8, 18}}, + {{9, 11}, {8, 19}}, + {{10, 12}, {9, 21}}, + {{11, 14}, {10, 22}}, + {{10, 11}, {10, 19}}, + {{10, 14}, {10, 21}}, + {{13, 14}, {11, 23}}, + {{13, 15}, {11, 20}}, + {{14, 15}, {11, 22}}, + {{1, 5}, {12, 14}}, + {{1, 3}, {13, 14}}, + {{6, 7}, {16, 17}}, + {{11, 15}, {20, 22}}, + {{12, 14}, {21, 23}}, +}; + +static const struct mesh_material mesh_eyemesh_materials[] = { + { // eyemat eyetext + .width = 1024, + .height = 1024, + .texture_id = 6, + }, +}; +static const vec2 * mesh_eyemesh_uv_layers[] = { + mesh_eyemesh_UVMap_uvmap, +}; + +static const struct mesh mesh_eyemesh = { + .position = mesh_eyemesh_position, + .position_length = (sizeof (mesh_eyemesh_position)) / (sizeof (mesh_eyemesh_position[0])), + .normal = mesh_eyemesh_normal, + .normal_length = (sizeof (mesh_eyemesh_normal)) / (sizeof (mesh_eyemesh_normal[0])), + .polygon_normal = mesh_eyemesh_polygon_normal, + .polygon_normal_length = (sizeof (mesh_eyemesh_polygon_normal)) / (sizeof (mesh_eyemesh_polygon_normal[0])), + .polygons = mesh_eyemesh_polygons, + .polygons_length = (sizeof (mesh_eyemesh_polygons)) / (sizeof (mesh_eyemesh_polygons[0])), + .uv_layers = mesh_eyemesh_uv_layers, + .uv_layers_length = (sizeof (mesh_eyemesh_uv_layers)) / (sizeof (mesh_eyemesh_uv_layers[0])), + .materials = mesh_eyemesh_materials, + .materials_length = (sizeof (mesh_eyemesh_materials)) / (sizeof (mesh_eyemesh_materials[0])), + .edge_polygons = mesh_eyemesh_edge_polygons, + .edge_polygons_length = (sizeof (mesh_eyemesh_edge_polygons)) / (sizeof (mesh_eyemesh_edge_polygons[0])), +}; + static const struct object objects[] = { { // object_arms .mesh = &mesh_armmesh, @@ -89444,6 +89678,12 @@ static const struct object objects[] = { .rotation = {0.000000, 0.000000, 0.000000, 1.000000}, // quaternion (XYZW) .location = {0.000000, 0.000000, 0.000000}, }, + { // object_eyes + .mesh = &mesh_eyemesh, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {0.000000, 0.000000, 0.000000, 1.000000}, // quaternion (XYZW) + .location = {0.000000, 0.000000, 0.000000}, + }, { // object_legs .mesh = &mesh_legmesh, .scale = {1.000000, 1.000000, 1.000000}, @@ -89483,5 +89723,9 @@ static const struct material materials[] = { .name = "chesttext", .texture_id = 5, }, + { + .name = "eyetext", + .texture_id = 6, + }, };