1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi
2022-11-15 21:53:13 +08:00
committed by GitHub
parent 56239b4a23
commit 017ace6ea7
859 changed files with 7156 additions and 7135 deletions

View File

@ -291,10 +291,10 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo
}
// if c == 2 { break }
if c % 100000 == 0 && c > 0 {
println('$c rows parsed')
println('${c} rows parsed')
}
}
println('$row_count .obj Rows parsed')
println('${row_count} .obj Rows parsed')
// remove default part if empty
if obj_part.part.len > 1 && obj_part.part[0].faces.len == 0 {
obj_part.part = obj_part.part[1..]
@ -304,7 +304,7 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo
// load the materials if found the .mtl file
fn (mut obj_part ObjPart) load_materials() {
rows := read_lines_from_file(obj_part.material_file)
println('Material file [$obj_part.material_file] $rows.len Rows.')
println('Material file [${obj_part.material_file}] ${rows.len} Rows.')
for row in rows {
// println("$row")
mut i := 0
@ -479,7 +479,7 @@ pub fn (mut obj_part ObjPart) get_buffer(in_part_list []int) Skl_buffer {
v_index := face[vertex_index][0] // vertex index
n_index := face[vertex_index][1] // normal index
t_index := face[vertex_index][2] // uv texture index
key := '${v_index}_${n_index}_$t_index'
key := '${v_index}_${n_index}_${t_index}'
if key !in cache {
cache[key] = v_count_index
mut pnct := Vertex_pnct{
@ -529,10 +529,10 @@ pub fn (mut obj_part ObjPart) get_buffer(in_part_list []int) Skl_buffer {
// print on the console the summary of the .obj model loaded
pub fn (obj_part ObjPart) summary() {
println('---- Stats ----')
println('vertices: $obj_part.v.len')
println('normals : $obj_part.vn.len')
println('uv : $obj_part.vt.len')
println('parts : $obj_part.part.len')
println('vertices: ${obj_part.v.len}')
println('normals : ${obj_part.vn.len}')
println('uv : ${obj_part.vt.len}')
println('parts : ${obj_part.part.len}')
// Parts
println('---- Parts ----')
for c, x in obj_part.part {
@ -540,17 +540,17 @@ pub fn (obj_part ObjPart) summary() {
}
// Materials
println('---- Materials ----')
println('Material dict: $obj_part.mat_map.keys()')
println('Material dict: ${obj_part.mat_map.keys()}')
for c, mat in obj_part.mat {
println('${c:3} [${mat.name:-16}]')
for k, v in mat.ks {
print('$k = $v')
print('${k} = ${v}')
}
for k, v in mat.ns {
println('$k = $v')
println('${k} = ${v}')
}
for k, v in mat.maps {
println('$k = $v')
println('${k} = ${v}')
}
}
}

View File

@ -50,7 +50,7 @@ pub fn load_texture(file_name string) gfx.Image {
buffer := read_bytes_from_file(file_name)
stbi.set_flip_vertically_on_load(true)
img := stbi.load_from_memory(buffer.data, buffer.len) or {
eprintln('Texure file: [$file_name] ERROR!')
eprintln('Texure file: [${file_name}] ERROR!')
exit(0)
}
res := create_texture(int(img.width), int(img.height), img.data)

View File

@ -9,14 +9,14 @@ pub fn read_lines_from_file(file_path string) []string {
$if android {
path = 'models/' + file_path
bts := os.read_apk_asset(path) or {
eprintln('File [$path] NOT FOUND!')
eprintln('File [${path}] NOT FOUND!')
return rows
}
rows = bts.bytestr().split_into_lines()
} $else {
path = os.resource_abs_path('assets/models/' + file_path)
rows = os.read_lines(path) or {
eprintln('File [$path] NOT FOUND! file_path: $file_path')
eprintln('File [${path}] NOT FOUND! file_path: ${file_path}')
return rows
}
}
@ -30,13 +30,13 @@ pub fn read_bytes_from_file(file_path string) []u8 {
$if android {
path = 'models/' + file_path
buffer = os.read_apk_asset(path) or {
eprintln('Texure file: [$path] NOT FOUND!')
eprintln('Texure file: [${path}] NOT FOUND!')
exit(0)
}
} $else {
path = os.resource_abs_path('assets/models/' + file_path)
buffer = os.read_bytes(path) or {
eprintln('Texure file: [$path] NOT FOUND!')
eprintln('Texure file: [${path}] NOT FOUND!')
exit(0)
}
}