Skip to content

Commit

Permalink
CSG example improved
Browse files Browse the repository at this point in the history
  • Loading branch information
syanenko committed Jan 23, 2023
1 parent 89fe880 commit 05f640f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Binary file modified examples/ex_csg.mlx
Binary file not shown.
12 changes: 6 additions & 6 deletions examples/ex_csg_utf8.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
pl.global_settings("assumed_gamma 1");

% Camera
pl.camera('angle', 50, 'location', [18 8 10], 'look_at', [0 3 2], 'type', 'perspective');
pl.camera('angle', 35, 'location', [28 15 10], 'look_at', [0 6 3.5], 'type', 'perspective');

% Light
pl.light('location', [100 200 300], 'color', [0.4 0.4 0.4], 'shadowless', false);
pl.light('location', [100 100 300], 'color', [0.4 0.4 0.4], 'shadowless', false);

% Walls
tex_plane = pl.declare("tex_plane", pl.texture('pigment_odd', [1.5 1.5 1.5], 'pigment_even', [0.1 0.1 0.1], 'finish', "phong 1 reflection {0.05 metallic 0.4}"));
pl.plane('normal', [1,0,0], 'distance', 0, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 1]);
pl.plane('normal', [0,1,0], 'distance', 0, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);
pl.plane('normal', [1,0,0], 'distance', -10, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 1]);
% pl.plane('normal', [0,1,0], 'distance', 0, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);
pl.plane('normal', [0,0,1], 'distance', 0, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);

% Objects textures
Expand All @@ -43,15 +43,15 @@
pl.sphere('position', [2 3 1], 'radius', 0.8, 'texture', tex_blue, 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);
pl.sphere('position', [1 2 3], 'radius', 1.0, 'texture', tex_pink, 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);
pl.union_end('translate', [0.3 0.3 0.3]);
pl.difference_end('scale', [1 1 1], 'rotate', [0 0 0], 'translate', [3 6 4]);
pl.difference_end('translate', [0 8 4]);

pl.difference_begin();
pl.cone('base_point', [1 1 0], 'base_radius', 4, 'cap_point', [1 1 6], 'cap_radius', 1.5, 'texture', tex_pink);
pl.cylinder('base_point', [1 1 -1], 'cap_point', [1 1 8], 'radius', 1, 'texture', tex_pink);
pl.cylinder('base_point', [1 1 -1], 'cap_point', [1 1 8], 'radius', 1, 'texture', tex_pink, 'translate', [3.5 0 0]);
pl.cylinder('base_point', [1 1 -1], 'cap_point', [1 1 8], 'radius', 1, 'texture', tex_pink, 'translate', [2.5 2.5 0]);
pl.cylinder('base_point', [0 0 -0], 'cap_point', [0 0 8], 'radius', 1, 'texture', tex_pink, 'translate', [0 2 4.5], 'rotate', [90 90 90]);
pl.difference_end('translate', [1.7 1.7 0]);
pl.difference_end('translate', [0 1.8 0]);

pl.scene_end();
% Render and display
Expand Down

0 comments on commit 05f640f

Please sign in to comment.