mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-16 07:24:15 +02:00
remove tex_size defaults for textured_tile, vnf_vertex_array
This commit is contained in:
@@ -1334,10 +1334,9 @@ function textured_tile(
|
|||||||
) =
|
) =
|
||||||
assert(is_undef(tex_reps) || is_int(tex_reps) || (all_integer(tex_reps) && len(tex_reps)==2), "tex_reps must be an integer or list of two integers")
|
assert(is_undef(tex_reps) || is_int(tex_reps) || (all_integer(tex_reps) && len(tex_reps)==2), "tex_reps must be an integer or list of two integers")
|
||||||
assert(is_undef(tex_size) || is_vector(tex_size,2) || is_finite(tex_size))
|
assert(is_undef(tex_size) || is_vector(tex_size,2) || is_finite(tex_size))
|
||||||
assert(num_defined([tex_size, tex_reps])<2, "Cannot give both tex_size and tex_reps")
|
assert(num_defined([tex_size, tex_reps])==1, "Must give exactly one of tex_size and tex_reps")
|
||||||
assert(is_undef(size) || is_num(size) || is_vector(size,2) || is_vector(size,3), "size must be a 2-vector or 3-vector")
|
assert(is_undef(size) || is_num(size) || is_vector(size,2) || is_vector(size,3), "size must be a 2-vector or 3-vector")
|
||||||
assert(is_undef(size) || num_defined([ysize,h, height, thickness, w1,w2,ang])==0, "Cannot combine size with any other dimensional specifications")
|
assert(is_undef(size) || num_defined([ysize,h, height, thickness, w1,w2,ang])==0, "Cannot combine size with any other dimensional specifications")
|
||||||
|
|
||||||
let(
|
let(
|
||||||
inset = is_num(tex_inset)? tex_inset : tex_inset? 1 : 0,
|
inset = is_num(tex_inset)? tex_inset : tex_inset? 1 : 0,
|
||||||
default_thick = inset>0 ? 0.1+abs(tex_depth)*inset : 0.1,
|
default_thick = inset>0 ? 0.1+abs(tex_depth)*inset : 0.1,
|
||||||
@@ -1362,7 +1361,7 @@ function textured_tile(
|
|||||||
texture = _get_texture(texture, tex_rot),
|
texture = _get_texture(texture, tex_rot),
|
||||||
|
|
||||||
tex_reps = is_def(tex_reps) ? force_list(tex_reps,2)
|
tex_reps = is_def(tex_reps) ? force_list(tex_reps,2)
|
||||||
: let(tex_size=is_undef(tex_size)? [5,5] : force_list(tex_size,2))
|
: let(tex_size=force_list(tex_size,2))
|
||||||
[round(size.x/tex_size.x), round(size.y/tex_size.y)],
|
[round(size.x/tex_size.x), round(size.y/tex_size.y)],
|
||||||
extra = is_undef(extra)? tex_reps == [1,1] ? [0,0] : [1,1]
|
extra = is_undef(extra)? tex_reps == [1,1] ? [0,0] : [1,1]
|
||||||
: force_list(tex_extra,2),
|
: force_list(tex_extra,2),
|
||||||
|
11
skin.scad
11
skin.scad
@@ -1182,7 +1182,7 @@ function rotate_sweep(
|
|||||||
style="min_edge", cp="centroid",
|
style="min_edge", cp="centroid",
|
||||||
atype="hull", anchor="origin",
|
atype="hull", anchor="origin",
|
||||||
spin=0, orient=UP, start=0,
|
spin=0, orient=UP, start=0,
|
||||||
_tex_inhibit_y_slicing=false
|
_tex_inhibit_y_slicing
|
||||||
) =
|
) =
|
||||||
assert(num_defined([tex_reps,tex_counts])<2, "In rotate_sweep() the 'tex_counts' parameters has been replaced by 'tex_reps'. You cannot give both.")
|
assert(num_defined([tex_reps,tex_counts])<2, "In rotate_sweep() the 'tex_counts' parameters has been replaced by 'tex_reps'. You cannot give both.")
|
||||||
assert(num_defined([tex_scale,tex_depth])<2, "In linear_sweep() the 'tex_scale' parameter has been replaced by 'tex_depth'. You cannot give both.")
|
assert(num_defined([tex_scale,tex_depth])<2, "In linear_sweep() the 'tex_scale' parameter has been replaced by 'tex_depth'. You cannot give both.")
|
||||||
@@ -4498,7 +4498,7 @@ function _tile_edge_path_list(vnf, axis, maxopen=1) =
|
|||||||
/// Arguments:
|
/// Arguments:
|
||||||
/// shape = The path or region to sweep/extrude.
|
/// shape = The path or region to sweep/extrude.
|
||||||
/// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to the revolution surface. See {{texture()}} for what named textures are supported.
|
/// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to the revolution surface. See {{texture()}} for what named textures are supported.
|
||||||
/// tex_size = An optional 2D target size for the textures. Actual texture sizes are scaled somewhat to evenly fit the available surface. Default: `[5,5]`
|
/// tex_size = An optional 2D target size for the textures. Actual texture sizes are scaled somewhat to evenly fit the available surface.
|
||||||
/// tex_scale = Scaling multiplier for the texture depth.
|
/// tex_scale = Scaling multiplier for the texture depth.
|
||||||
/// ---
|
/// ---
|
||||||
/// inset = If numeric, lowers the texture into the surface by that amount, before the tex_scale multiplier is applied. If `true`, insets by exactly `1`. Default: `false`
|
/// inset = If numeric, lowers the texture into the surface by that amount, before the tex_scale multiplier is applied. If `true`, insets by exactly `1`. Default: `false`
|
||||||
@@ -4522,7 +4522,7 @@ function _textured_revolution(
|
|||||||
shape, texture, tex_size, tex_scale=1,
|
shape, texture, tex_size, tex_scale=1,
|
||||||
inset=false, rot=false, shift=[0,0],
|
inset=false, rot=false, shift=[0,0],
|
||||||
taper, closed=true, angle=360,
|
taper, closed=true, angle=360,
|
||||||
inhibit_y_slicing=false,tex_aspect, pixel_aspect,
|
inhibit_y_slicing,tex_aspect, pixel_aspect,
|
||||||
counts, samples, start=0,tex_extra,
|
counts, samples, start=0,tex_extra,
|
||||||
style="min_edge", atype="intersect",
|
style="min_edge", atype="intersect",
|
||||||
anchor=CENTER, spin=0, orient=UP
|
anchor=CENTER, spin=0, orient=UP
|
||||||
@@ -4541,6 +4541,7 @@ function _textured_revolution(
|
|||||||
assert(num_defined([tex_aspect, pixel_aspect])<=1, "Cannot give both tex_aspect and pixel_aspect")
|
assert(num_defined([tex_aspect, pixel_aspect])<=1, "Cannot give both tex_aspect and pixel_aspect")
|
||||||
//assert(num_defined([tex_aspect, pixel_aspect])==0 || is_undef(angle), "Cannot give tex_aspect or pixel_aspect if you give angle")
|
//assert(num_defined([tex_aspect, pixel_aspect])==0 || is_undef(angle), "Cannot give tex_aspect or pixel_aspect if you give angle")
|
||||||
let(
|
let(
|
||||||
|
inhibit_y_slicing = default(inhibit_y_slicing, is_path(shape) && len(path)==2 ? true : false),
|
||||||
regions = !is_path(shape,2)? region_parts(shape)
|
regions = !is_path(shape,2)? region_parts(shape)
|
||||||
: closed? region_parts([shape])
|
: closed? region_parts([shape])
|
||||||
: let(
|
: let(
|
||||||
@@ -4861,7 +4862,7 @@ function _textured_point_array(points, texture, tex_reps, tex_size, tex_samples,
|
|||||||
col_wrap=false, tex_depth=1, row_wrap=false, caps, cap1, cap2, reverse=false, style="min_edge", tex_extra, tex_skip, sidecaps,sidecap1,sidecap2,normals) =
|
col_wrap=false, tex_depth=1, row_wrap=false, caps, cap1, cap2, reverse=false, style="min_edge", tex_extra, tex_skip, sidecaps,sidecap1,sidecap2,normals) =
|
||||||
assert(tex_reps==undef || is_int(tex_reps) || (all_integer(tex_reps) && len(tex_reps)==2), "tex_reps must be an integer or list of two integers")
|
assert(tex_reps==undef || is_int(tex_reps) || (all_integer(tex_reps) && len(tex_reps)==2), "tex_reps must be an integer or list of two integers")
|
||||||
assert(tex_size==undef || is_num(tex_size) || is_vector(tex_size,2), "tex_size must be a scalar or 2-vector")
|
assert(tex_size==undef || is_num(tex_size) || is_vector(tex_size,2), "tex_size must be a scalar or 2-vector")
|
||||||
assert(num_defined([tex_size, tex_reps])<2, "Cannot give both tex_size and tex_reps")
|
assert(num_defined([tex_size, tex_reps])==1, "Must give exactly one of tex_size and tex_reps")
|
||||||
assert(in_list(style,["default","alt","quincunx", "convex","concave", "min_edge","min_area","flip1","flip2"]))
|
assert(in_list(style,["default","alt","quincunx", "convex","concave", "min_edge","min_area","flip1","flip2"]))
|
||||||
assert(is_matrix(points[0], n=3),"Point array has the wrong shape or points are not 3d")
|
assert(is_matrix(points[0], n=3),"Point array has the wrong shape or points are not 3d")
|
||||||
assert(is_consistent(points), "Non-rectangular or invalid point array")
|
assert(is_consistent(points), "Non-rectangular or invalid point array")
|
||||||
@@ -4877,7 +4878,7 @@ function _textured_point_array(points, texture, tex_reps, tex_size, tex_samples,
|
|||||||
ptsize=[len(points[0]), len(points)],
|
ptsize=[len(points[0]), len(points)],
|
||||||
tex_reps = is_def(tex_reps) ? force_list(tex_reps,2)
|
tex_reps = is_def(tex_reps) ? force_list(tex_reps,2)
|
||||||
: let(
|
: let(
|
||||||
tex_size = is_undef(tex_size) ? [5,5] : force_list(tex_size,2),
|
tex_size = force_list(tex_size,2),
|
||||||
xsize = norm(points[0][0]-points[0][1])*(ptsize.x+(col_wrap?1:0)),
|
xsize = norm(points[0][0]-points[0][1])*(ptsize.x+(col_wrap?1:0)),
|
||||||
ysize = norm(points[0][0]-points[1][0])*(ptsize.y+(row_wrap?1:0))
|
ysize = norm(points[0][0]-points[1][0])*(ptsize.y+(row_wrap?1:0))
|
||||||
)
|
)
|
||||||
|
2
vnf.scad
2
vnf.scad
@@ -86,7 +86,7 @@ EMPTY_VNF = [[],[]]; // The standard empty VNF with no vertices or faces.
|
|||||||
// triangulate = If true, triangulates endcaps to resolve possible CGAL issues. This can be an expensive operation if the endcaps are complex. Default: false
|
// triangulate = If true, triangulates endcaps to resolve possible CGAL issues. This can be an expensive operation if the endcaps are complex. Default: false
|
||||||
// convexity = (module) Max number of times a line could intersect a wall of the shape.
|
// convexity = (module) Max number of times a line could intersect a wall of the shape.
|
||||||
// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported.
|
// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported.
|
||||||
// tex_size = An optional 2D target size for the textures at `points[0][0]`. Actual texture sizes are scaled somewhat to evenly fit the available surface. Default: `[5,5]`
|
// tex_size = An optional 2D target size for the textures at `points[0][0]`. Actual texture sizes are scaled somewhat to evenly fit the available surface.
|
||||||
// tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the horizontal and vertical directions.
|
// tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the horizontal and vertical directions.
|
||||||
// tex_inset = If numeric, lowers the texture into the surface by the specified proportion, e.g. 0.5 would lower it half way into the surface. If `true`, insets by exactly its full depth. Default: `false`
|
// tex_inset = If numeric, lowers the texture into the surface by the specified proportion, e.g. 0.5 would lower it half way into the surface. If `true`, insets by exactly its full depth. Default: `false`
|
||||||
// tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. Default: 0
|
// tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. Default: 0
|
||||||
|
Reference in New Issue
Block a user