Skip to content

Commit

Permalink
barrel oil test
Browse files Browse the repository at this point in the history
  • Loading branch information
gramosomi committed May 26, 2024
1 parent 2d9c220 commit 56e66bf
Show file tree
Hide file tree
Showing 6 changed files with 680 additions and 14,479 deletions.
31 changes: 25 additions & 6 deletions generator/src/shapes/cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,41 @@ calculateCylinder(const float radius, const float height, const int slices) {

float r = 0;

Point2D t_top_center = Point2D(7.f / 16.f, 3.f / 16.f);
Point2D t_bot_center = Point2D(13.f / 16.f, 3.f / 16.f);
Point2D t_side = Point2D(0.f, 3.f / 8.f);
float t_side_height = 5.f / 8.f;
float t_radius = 3.f / 16.f;

float curr_alpha = 0;
float next_alpha = 0;

for (int i = 0; i < slices; i++) {
next_alpha = alpha * (i+1);

// base
float px = radius * sin(r);
float pz = radius * cos(r);
points.push_back(Point(px, -half, pz));
points.push_back(Point(0, -half, 0));

textures.push_back(Point2D(t_bot_center.x + t_radius * sin(r), t_bot_center.y + t_radius * cos(r)));
textures.push_back(t_bot_center);


r += alpha;
px = radius * sin(r);
pz = radius * cos(r);
points.push_back(Point(px, -half, pz));

textures.push_back(Point2D(t_bot_center.x + t_radius * sin(r), t_bot_center.y + t_radius * cos(r)));

Point n1(0.0f, -1.0f, 0.0f);
for (int j = 0; j < 3; j++) {
normals.push_back(n1); // Push normals to normals vector
}

textures.push_back(Point2D(0.5f, 0.5f));
textures.push_back(Point2D(0.5f, 0.5f));
textures.push_back(Point2D(0.5f, 0.5f));


// face
points.push_back(Point(px, -half, pz));
Expand Down Expand Up @@ -89,19 +105,22 @@ calculateCylinder(const float radius, const float height, const int slices) {
pz = radius * cos(r);
points.push_back(Point(px, half, pz));
points.push_back(Point(0, half, 0));

textures.push_back(Point2D(t_top_center.x + t_radius * sin(curr_alpha), t_top_center.y + t_radius * cos(curr_alpha)));
textures.push_back(t_top_center);
r -= alpha;
px = radius * sin(r);
pz = radius * cos(r);
points.push_back(Point(px, half, pz));

textures.push_back(Point2D(t_top_center.x + t_radius * sin(next_alpha), t_top_center.y + t_radius * cos(next_alpha)));

Point n4(0.0f, 1.0f, 0.0f);
for (int j = 0; j < 3; j++) {
normals.push_back(n4); // Push normals to normals vector
}

textures.push_back(Point2D(0.5f, 0.5f));
textures.push_back(Point2D(0.5f, 0.5f));
textures.push_back(Point2D(0.5f, 0.5f));
curr_alpha = next_alpha;
}

return std::make_pair(std::make_pair(points, normals), textures);
Expand Down
6 changes: 3 additions & 3 deletions imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Collapsed=0

[Window][Infos]
Pos=15,18
Size=353,116
Collapsed=0
Size=367,116
Collapsed=1

[Window][Options]
Pos=14,141
Size=312,124
Collapsed=1
Collapsed=0

110 changes: 49 additions & 61 deletions models/advanced/cylinder.3d
Original file line number Diff line number Diff line change
@@ -1,61 +1,49 @@
# 60
p 0 -2.5 5 0 -1 0 0.5 0.5
p 0 -2.5 0 0 -1 0 0.5 0.5
p 4.75528 -2.5 1.54508 0 -1 0 0.5 0.5
p 4.75528 -2.5 1.54508 4.75528 0 1.54508 0.5 0.5
p 4.75528 2.5 1.54508 4.75528 0 1.54508 0.5 0.5
p 0 2.5 5 0 0 5 0.5 0.5
p 0 2.5 5 0 0 5 0.5 0.5
p 0 -2.5 5 0 0 5 0.5 0.5
p 4.75528 -2.5 1.54508 4.75528 0 1.54508 0.5 0.5
p 2.93893 2.5 -4.04508 0 1 0 0.5 0.5
p 0 2.5 0 0 1 0 0.5 0.5
p 4.75528 2.5 1.54508 0 1 0 0.5 0.5
p 4.75528 -2.5 1.54508 0 -1 0 0.5 0.5
p 0 -2.5 0 0 -1 0 0.5 0.5
p 2.93893 -2.5 -4.04508 0 -1 0 0.5 0.5
p 2.93893 -2.5 -4.04508 2.93893 0 -4.04508 0.5 0.5
p 2.93893 2.5 -4.04508 2.93893 0 -4.04508 0.5 0.5
p 4.75528 2.5 1.54508 4.75528 0 1.54508 0.5 0.5
p 4.75528 2.5 1.54508 4.75528 0 1.54508 0.5 0.5
p 4.75528 -2.5 1.54508 4.75528 0 1.54508 0.5 0.5
p 2.93893 -2.5 -4.04508 2.93893 0 -4.04508 0.5 0.5
p -2.93893 2.5 -4.04508 0 1 0 0.5 0.5
p 0 2.5 0 0 1 0 0.5 0.5
p 2.93893 2.5 -4.04508 0 1 0 0.5 0.5
p 2.93893 -2.5 -4.04508 0 -1 0 0.5 0.5
p 0 -2.5 0 0 -1 0 0.5 0.5
p -2.93893 -2.5 -4.04508 0 -1 0 0.5 0.5
p -2.93893 -2.5 -4.04508 -2.93893 0 -4.04508 0.5 0.5
p -2.93893 2.5 -4.04508 -2.93893 0 -4.04508 0.5 0.5
p 2.93893 2.5 -4.04508 2.93893 0 -4.04508 0.5 0.5
p 2.93893 2.5 -4.04508 2.93893 0 -4.04508 0.5 0.5
p 2.93893 -2.5 -4.04508 2.93893 0 -4.04508 0.5 0.5
p -2.93893 -2.5 -4.04508 -2.93893 0 -4.04508 0.5 0.5
p -4.75528 2.5 1.54509 0 1 0 0.5 0.5
p 0 2.5 0 0 1 0 0.5 0.5
p -2.93893 2.5 -4.04508 0 1 0 0.5 0.5
p -2.93893 -2.5 -4.04508 0 -1 0 0.5 0.5
p 0 -2.5 0 0 -1 0 0.5 0.5
p -4.75528 -2.5 1.54509 0 -1 0 0.5 0.5
p -4.75528 -2.5 1.54509 -4.75528 0 1.54509 0.5 0.5
p -4.75528 2.5 1.54509 -4.75528 0 1.54509 0.5 0.5
p -2.93893 2.5 -4.04508 -2.93893 0 -4.04508 0.5 0.5
p -2.93893 2.5 -4.04508 -2.93893 0 -4.04508 0.5 0.5
p -2.93893 -2.5 -4.04508 -2.93893 0 -4.04508 0.5 0.5
p -4.75528 -2.5 1.54509 -4.75528 0 1.54509 0.5 0.5
p 8.74228e-07 2.5 5 0 1 0 0.5 0.5
p 0 2.5 0 0 1 0 0.5 0.5
p -4.75528 2.5 1.54509 0 1 0 0.5 0.5
p -4.75528 -2.5 1.54509 0 -1 0 0.5 0.5
p 0 -2.5 0 0 -1 0 0.5 0.5
p 8.74228e-07 -2.5 5 0 -1 0 0.5 0.5
p 8.74228e-07 -2.5 5 8.74228e-07 0 5 0.5 0.5
p 8.74228e-07 2.5 5 8.74228e-07 0 5 0.5 0.5
p -4.75528 2.5 1.54509 -4.75528 0 1.54509 0.5 0.5
p -4.75528 2.5 1.54509 -4.75528 0 1.54509 0.5 0.5
p -4.75528 -2.5 1.54509 -4.75528 0 1.54509 0.5 0.5
p 8.74228e-07 -2.5 5 8.74228e-07 0 5 0.5 0.5
p 4.75528 2.5 1.54508 0 1 0 0.5 0.5
p 0 2.5 0 0 1 0 0.5 0.5
p 8.74228e-07 2.5 5 0 1 0 0.5 0.5
# 48
p 0 -2.5 3 0 -1 0 0.8125 0.375
p 0 -2.5 0 0 -1 0 0.8125 0.1875
p 3 -2.5 -1.31134e-07 0 -1 0 1 0.1875
p 3 -2.5 -1.31134e-07 3 0 -1.31134e-07 0.5 0.5
p 3 2.5 -1.31134e-07 3 0 -1.31134e-07 0.5 0.5
p 0 2.5 3 0 0 3 0.5 0.5
p 0 2.5 3 0 0 3 0.5 0.5
p 0 -2.5 3 0 0 3 0.5 0.5
p 3 -2.5 -1.31134e-07 3 0 -1.31134e-07 0.5 0.5
p -2.62268e-07 2.5 -3 0 1 0 0.4375 0.375
p 0 2.5 0 0 1 0 0.4375 0.1875
p 3 2.5 -1.31134e-07 0 1 0 0.625 0.1875
p 3 -2.5 -1.31134e-07 0 -1 0 1 0.1875
p 0 -2.5 0 0 -1 0 0.8125 0.1875
p -2.62268e-07 -2.5 -3 0 -1 0 0.8125 7.21645e-16
p -2.62268e-07 -2.5 -3 -2.62268e-07 0 -3 0.5 0.5
p -2.62268e-07 2.5 -3 -2.62268e-07 0 -3 0.5 0.5
p 3 2.5 -1.31134e-07 3 0 -1.31134e-07 0.5 0.5
p 3 2.5 -1.31134e-07 3 0 -1.31134e-07 0.5 0.5
p 3 -2.5 -1.31134e-07 3 0 -1.31134e-07 0.5 0.5
p -2.62268e-07 -2.5 -3 -2.62268e-07 0 -3 0.5 0.5
p -3 2.5 3.57746e-08 0 1 0 0.625 0.1875
p 0 2.5 0 0 1 0 0.4375 0.1875
p 4.52987e-07 2.5 -3 0 1 0 0.4375 7.21645e-16
p 4.52987e-07 -2.5 -3 0 -1 0 0.8125 2.13718e-15
p 0 -2.5 0 0 -1 0 0.8125 0.1875
p -3 -2.5 3.57746e-08 0 -1 0 0.625 0.1875
p -3 -2.5 3.57746e-08 -3 0 3.57746e-08 0.5 0.5
p -3 2.5 3.57746e-08 -3 0 3.57746e-08 0.5 0.5
p 4.52987e-07 2.5 -3 4.52987e-07 0 -3 0.5 0.5
p 4.52987e-07 2.5 -3 4.52987e-07 0 -3 0.5 0.5
p 4.52987e-07 -2.5 -3 4.52987e-07 0 -3 0.5 0.5
p -3 -2.5 3.57746e-08 -3 0 3.57746e-08 0.5 0.5
p 5.24537e-07 2.5 3 0 1 0 0.4375 7.21645e-16
p 0 2.5 0 0 1 0 0.4375 0.1875
p -3 2.5 3.57746e-08 0 1 0 0.25 0.1875
p -3 -2.5 3.57746e-08 0 -1 0 0.625 0.1875
p 0 -2.5 0 0 -1 0 0.8125 0.1875
p 5.24537e-07 -2.5 3 0 -1 0 0.8125 0.375
p 5.24537e-07 -2.5 3 5.24537e-07 0 3 0.5 0.5
p 5.24537e-07 2.5 3 5.24537e-07 0 3 0.5 0.5
p -3 2.5 3.57746e-08 -3 0 3.57746e-08 0.5 0.5
p -3 2.5 3.57746e-08 -3 0 3.57746e-08 0.5 0.5
p -3 -2.5 3.57746e-08 -3 0 3.57746e-08 0.5 0.5
p 5.24537e-07 -2.5 3 5.24537e-07 0 3 0.5 0.5
p 3 2.5 -1.0133e-06 0 1 0 0.25 0.1875
p 0 2.5 0 0 1 0 0.4375 0.1875
p 5.24537e-07 2.5 3 0 1 0 0.4375 0.375
Loading

0 comments on commit 56e66bf

Please sign in to comment.