Skip to content

Commit 802bc7e

Browse files
committed
Add 1080p resolution and proper Eye of the Universe coordinates
1 parent 9262415 commit 802bc7e

6 files changed

+50
-29
lines changed

.DS_Store

-10 KB
Binary file not shown.

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ movie*
22
mandelbrot*
33
test.png
44
.vscode
5-
.git_backup
5+
.git_backup
6+
compile_flags.txt
7+
.DS_Store
8+
leak_ignores.supp

compile_flags.txt

-7
This file was deleted.

dec2hex.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
dec = []
2+
for char in input("Dec? 0."):
3+
dec.append(int(char))
4+
5+
print("0x0.", end="")
6+
max_hex_digits = 48
7+
curr_binary = []
8+
for _ in range(0, max_hex_digits * 4):
9+
carry = 0
10+
for i in range(len(dec) - 1, -1, -1):
11+
dec[i] *= 2
12+
dec[i] += carry
13+
carry = 0
14+
if dec[i] > 9:
15+
dec[i] -= 10
16+
carry = 1
17+
curr_binary.append(str(carry))
18+
if len(curr_binary) == 4:
19+
print(hex(int("".join(curr_binary), 2))[2:].upper(), end="")
20+
curr_binary = []
21+
print("")

leak_ignores.supp

-2
This file was deleted.

main.c

+25-19
Original file line numberDiff line numberDiff line change
@@ -460,22 +460,23 @@ struct complex complex_mul(struct complex a, struct complex b)
460460
// First, let's define some properties for full-sized rendering. We assume that
461461
// full-size is 1:1 to the window, and thus window size = full-size dimensions.
462462

463-
#define WINDOW_WIDTH 900
464-
#define WINDOW_HEIGHT 600
463+
#define WINDOW_WIDTH 1920
464+
#define WINDOW_HEIGHT 1080
465465

466466
// Here, we also define reciprocals (1/x) of the width and height, as our big
467467
// float implementation is currently unable to divide; only multiply. We will
468468
// elaborate on the big float implementation later. Currently, this represents
469469
// the raw hexadecimal value of the big float as converting from a decimal
470470
// value is too difficult.
471471

472-
#define WINDOW_WIDTH_RECIPROCAL (struct fp256){ SIGN_POS, { 0, 0x0048d159e26af37c, 0x048d159e26af37c0, 0x48d159e26af37c04 } }
473-
#define WINDOW_HEIGHT_RECIPROCAL (struct fp256){ SIGN_POS, { 0, 0x006d3a06d3a06d3a, 0x06d3a06d3a06d3a0, 0x6d3a06d3a06d3a06 } }
472+
#define WINDOW_WIDTH_RECIPROCAL (struct fp256){ SIGN_POS, { 0, 0x0022222222222222, 0x2222222222222222, 0x2222222222222222 } }
473+
#define WINDOW_HEIGHT_RECIPROCAL (struct fp256){ SIGN_POS, { 0, 0x003CAE759203CAE7, 0x59203CAE759203CA, 0xE759203CAE759203 } }
474474

475475
// This defines how many columns of pixels we draw before presenting a frame
476476
// to the user. Doing this after too little columns results in slower rendering.
477+
// This should be a factor of FULL_THREAD_X_SIZE below.
477478

478-
#define FULL_SHOW_X_INTERVAL 5
479+
#define FULL_SHOW_X_INTERVAL 10
479480

480481
// We are going to render multicore, and the simplest way to do so is to divide
481482
// up fixed blocks of pixels for each core to render.
@@ -492,21 +493,24 @@ struct thread_block
492493

493494
const struct thread_block full_thread_blocks[THREADS] =
494495
{
495-
{ 0, 224, 0, 299 },
496-
{ 225, 449, 0, 299 },
497-
{ 450, 674, 0, 299 },
498-
{ 675, 899, 0, 299 },
499-
{ 0, 224, 300, 599 },
500-
{ 225, 449, 300, 599 },
501-
{ 450, 674, 300, 599 },
502-
{ 675, 899, 300, 599 },
496+
{ 0, 479, 0, 539 },
497+
{ 480, 959, 0, 539 },
498+
{ 960, 1439, 0, 539 },
499+
{ 1440, 1919, 0, 539 },
500+
{ 0, 479, 540, 1079 },
501+
{ 480, 959, 540, 1079 },
502+
{ 960, 1439, 540, 1079 },
503+
{ 1440, 1919, 540, 1079 },
503504
};
504505

505506
// Since this is multicore, the program must be able to know how many columns
506507
// it should render for each block; it can't just loop through the entire
507508
// window.
509+
//
510+
// This must be the difference between x_start and x_end in full_thread_blocks.
511+
// And yes, all of them must have the same width.
508512

509-
#define FULL_THREAD_X_SIZE 225
513+
#define FULL_THREAD_X_SIZE 480
510514

511515
// When switching from preview to full-mode rendering, the user might want to
512516
// see a black screen so the progress of the render might be easier to see,
@@ -519,6 +523,7 @@ const struct thread_block full_thread_blocks[THREADS] =
519523
// preview mode differs in that it is much smaller and faster to render, but
520524
// is almost identical in every other way.
521525

526+
// TODO: Need new resolution
522527
#define PREVIEW_WIDTH 240
523528
#define PREVIEW_HEIGHT 160
524529
#define PREVIEW_WIDTH_RECIPROCAL (struct fp256){ SIGN_POS, { 0, 0x0111111111111111, 0x1111111111111111, 0x1111111111111111 } }
@@ -579,7 +584,7 @@ const struct color gradient_stops[GRADIENT_STOP_COUNT + 1] =
579584
#define INITIAL_CENTER_X (struct fp256){ SIGN_NEG, { 0, 0x8000000000000000, 0, 0 } } // -0.5
580585
#define INITIAL_CENTER_Y (struct fp256){ SIGN_ZERO, {0} } // 0
581586
#define INITIAL_SIZE (struct fp256){ SIGN_POS, { 2, 0, 0, 0 }} // 2
582-
#define SIZE_RATIO_X (struct fp256){ SIGN_POS, { 1, 0x8000000000000000, 0, 0 } } // 1.5
587+
#define SIZE_RATIO_X (struct fp256){ SIGN_POS, { 1, 0xC71C71C71C71C71C, 0x71C71C71C71C71C7, 0x1C71C71C71C71C71 } } // 1920/1080
583588

584589
// The program uses a click-to-zoom mechanic, and thus we need to show the user
585590
// an image so the user knows where they will be zooming into. As with all
@@ -603,11 +608,12 @@ const struct color gradient_stops[GRADIENT_STOP_COUNT + 1] =
603608
#define ZOOM_IMAGE_SIZE_X 225
604609
#define ZOOM_IMAGE_SIZE_Y 150
605610

606-
#define MOVIE 1
611+
#define MOVIE 0
607612
#define MOVIE_FULL_SHOW_X_INTERVAL 75
608-
#define MOVIE_INITIAL_CENTER_X (struct fp256){ SIGN_NEG, { 1, 0xFFF1315BACAC51F1, 0xD039000000000000 } }
609-
#define MOVIE_INITIAL_CENTER_Y (struct fp256){ SIGN_NEG, { 0, 0x0000000E217005DA, 0x86D3000000000000 } }
610-
#define MOVIE_ZOOM_PER_FRAME (struct fp256){ SIGN_POS, { 0, 0x8000000000000000 } } // 0.5
613+
// Coordinates from "Eye of the Universe"
614+
#define MOVIE_INITIAL_CENTER_X (struct fp256){ SIGN_POS, { 0, 0x5C38B7BB42D6E499, 0x134BFE5798655AA0, 0xCB8925EC9853B954 } }
615+
#define MOVIE_INITIAL_CENTER_Y (struct fp256){ SIGN_NEG, { 0, 0xA42D17BFC55EFB99, 0x9B8E8100EB7161E1, 0xCA1080A9F02EBC2A } }
616+
#define MOVIE_ZOOM_PER_FRAME (struct fp256){ SIGN_POS, { 0, 0xFD0F413D0D9C5EF1, 0xDBE485CFBA44A80F, 0x30D9409A2D2212AF } } // 0.5 / 60
611617
#define MOVIE_PREFIX "movie/frame"
612618
#define MOVIE_PREFIX_LEN 11
613619

0 commit comments

Comments
 (0)