Skip to content

Commit

Permalink
Examples rendering enhanced
Browse files Browse the repository at this point in the history
  • Loading branch information
syanenko committed Jan 24, 2023
1 parent 241cbd3 commit 5e5ea63
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
Binary file modified examples/ex_csg.mlx
Binary file not shown.
6 changes: 2 additions & 4 deletions examples/ex_csg_utf8.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
pl.include("shapes");

pl.global_settings("assumed_gamma 1");
pl.axis('length', [4 4 4]);

% Camera
pl.camera('angle', 35, 'location', [28 15 10], 'look_at', [0 6 3.5], 'type', 'perspective');
Expand All @@ -28,7 +27,6 @@
% 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', -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 @@ -49,9 +47,9 @@

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_red);
pl.cylinder('base_point', [1 1 -1], 'cap_point', [1 1 8], 'radius', 1, 'texture', tex_blue, 'translate', [3.5 0 0]);
pl.cylinder('base_point', [1 1 -1], 'cap_point', [1 1 8], 'radius', 1, 'texture', tex_red, 'translate', [2.5 2.5 0]);
pl.cylinder('base_point', [1 1 -1], 'cap_point', [1 1 8], 'radius', 1, 'texture', tex_green, 'translate', [2.5 2.5 0]);
pl.cylinder('base_point', [0 0 -8], 'cap_point', [0 0 10], 'radius', 1, 'texture', tex_green, 'translate', [0 2 4.5], 'rotate', [90 90 90]);
pl.difference_end('translate', [0 1.8 0]);

Expand Down
Binary file modified examples/ex_lathe.mlx
Binary file not shown.
34 changes: 19 additions & 15 deletions examples/ex_lathe_utf8.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,43 @@
pl.global_settings("assumed_gamma 1");

% Camera
pl.camera('angle', 33, 'location', [23 7 7], 'look_at', [0 4 1.5], 'type', 'perspective');
pl.camera('angle', 35, 'location', [23 7 7], 'look_at', [0 4 1.5], 'type', 'perspective');

% Light
pl.light('location', [23 6 11], 'color', [0.6 0.6 0.6]);

% Floor
tex = pl.declare("tex", pl.texture('pigment_odd', [4 4 4], 'pigment_even', [0 0 0], 'finish', "phong 1 reflection {0.4 metallic 0.2}"));
pl.plane('normal', [0,0,1], 'distance', 0, 'texture', tex, 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);

% Limit
tex_gray = pl.declare("tex_gray", pl.texture('pigment', [0.4 0.4 0.4], 'finish', "phong 1 reflection {0.4 metallic 0.2}"));
pl.plane('normal', [1,0,1], 'distance', -20, 'texture', tex_gray, 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);
pl.light('location', [2.5 4.7 12], 'color', [0.2 0.2 0.2]);
pl.light('location', [8 2.7 12], 'color', [0.2 0.2 0.2]);
pl.light('location', [7.5 7.5 12], 'color', [0.1 0.1 0.1]);

pl.light('location', [23 7 7], 'color', [0.1 0.1 0.1]);

% 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', -10, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 1]);
pl.plane('normal', [0,0,1], 'distance', 0, 'texture', tex_plane', 'scale', [1 1 1], 'rotate', [0 0 0], 'translate', [0 0 0]);

% Bottle 1
tex_bottle1 = pl.declare("tex_bottle1", pl.texture('base', 'T_Vicksbottle_Glass', 'pigment', [17.5 4.2 3.2], 'finish', "ambient 0.001 diffuse 0.2 reflection 0.04 specular 24.4 roughness .0004"));
pl.lathe('points', [0.00 0.00; 0.35 0.00; 0.62 0.54; 0.21 0.83; 0.19 1.46; 0.29 1.50; 0.26 1.53],...
'spline_type', 'quadratic_spline',...
'sturm', true,...
'texture', 'Dark_Green_Glass',...
'scale', [4 4 4], 'rotate', [ 90 0 0], 'translate', [6 2.8 0]);
'texture', tex_bottle1,...
'scale', [4 4 4], 'rotate', [ 90 0 0], 'translate', [7 2.7 0]);

% Bottle 2
tex_bottle2 = pl.declare("tex_bottle3", pl.texture('base', 'T_Vicksbottle_Glass', 'pigment', [2.8 3.8 0.1], 'finish', "ambient 0.001 diffuse 0.3 reflection 0.04 specular 24.4 roughness .0004"));
pl.lathe('points', [0.00 0.00; 0.36 0.00; 0.62 0.54; 0.21 0.83; 0.19 1.46; 0.29 1.50; 0.26 1.53],...
'spline_type', 'quadratic_spline',...
'sturm', true,...
'texture', 'Orange_Glass',...
'texture', tex_bottle2,...
'scale', [2.7 3.7 2.7], 'rotate', [ 90 0 0], 'translate', [6.5 7.5 0]);

% Bottle 3
tex_bottle3 = pl.declare("tex_bottle3", pl.texture('base', 'T_Vicksbottle_Glass', 'pigment', [4.8 1.8 0], 'finish', "ambient 0.001 diffuse 0.3 reflection 0.04 specular 24.4 roughness .0004"));
pl.lathe('points', [0.00 0.00; 0.36 0.00; 0.62 0.54; 0.21 0.83; 0.19 1.46; 0.29 1.50; 0.26 1.53],...
'spline_type', 'quadratic_spline',...
'sturm', true,...
'texture', 'T_Winebottle_Glass',...
'scale', [5 3 5], 'rotate', [ 90 0 0], 'translate', [-2 4.5 0]);
'texture', tex_bottle3,...
'scale', [5 3 4], 'rotate', [ 90 0 0], 'translate', [1.5 4.7 0]);

pl.scene_end();
% Render and display
Expand Down
Binary file modified examples/ex_lights_peaks.mlx
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/ex_lights_peaks_utf8.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
pl.include("shapes");
pl.global_settings("assumed_gamma 1");

% Camare
pl.camera('angle', 25, 'location', [24 20 15], 'look_at', [0 0 2.5], 'type', 'perspective');

% Light
pl.light('location', [10 10 10], 'color', [1 1 1]);

% Light marks
Expand Down

0 comments on commit 5e5ea63

Please sign in to comment.