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

examples: fix typos (#18229)

This commit is contained in:
Turiiya
2023-05-25 15:54:46 +02:00
committed by GitHub
parent caee3935a5
commit 993546a0a2
28 changed files with 89 additions and 89 deletions

View File

@ -255,7 +255,7 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo
// println("Vertex line: $c")
break
}
// parameteres uvw
// parameters uvw
`p` {
obj_part.vp << parse_3f(row, i + 2)
// println("Vertex line: ${obj_part.vp.len}")
@ -350,7 +350,7 @@ fn (mut obj_part ObjPart) load_materials() {
break
}
}
// trasparency
// transparency
`d` {
if row[i + 1] == ` ` {
value, _ := get_float(row, i + 2)
@ -396,7 +396,7 @@ fn (mut obj_part ObjPart) load_materials() {
// vertex data struct
pub struct Vertex_pnct {
pub mut:
x f32 // poistion
x f32 // position
y f32
z f32
nx f32 // normal
@ -562,7 +562,7 @@ pub fn tst() {
//fname := "Forklift.obj"
fname := "cube.obj"
//fname := "Orange Robot 3D ObjPart.obj"
mut obj := ObjPart{}
buf := os.read_lines(fname) or { panic(err.msg) }
obj.parse_obj_buffer(buf)

View File

@ -143,7 +143,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
/******************************************************************************
* Render functions
******************************************************************************/
// agregate all the part by materials
// aggregate all the part by materials
pub fn (mut obj_part ObjPart) init_render_data(texture gfx.Image) {
// create shader
// One shader for all the model
@ -188,12 +188,12 @@ pub fn (mut obj_part ObjPart) init_render_data(texture gfx.Image) {
}
pub fn (obj_part ObjPart) bind_and_draw(rend_data_index int, in_data Shader_data) u32 {
// apply the pipline and bindings
// apply the pipeline and bindings
mut part_render_data := obj_part.rend_data[rend_data_index]
// pass light position
mut tmp_fs_params := Tmp_fs_param{}
tmp_fs_params.ligth = in_data.fs_data.ligth
tmp_fs_params.light = in_data.fs_data.light
if part_render_data.material in obj_part.mat_map {
mat_index := obj_part.mat_map[part_render_data.material]
@ -215,7 +215,7 @@ pub fn (obj_part ObjPart) bind_and_draw(rend_data_index int, in_data Shader_data
if 'Ns' in mat.ns {
tmp_fs_params.ks.e[3] = mat.ns['Ns'] / 1000.0
} else {
// defautl value is 10
// default value is 10
tmp_fs_params.ks.e[3] = f32(10) / 1000.0
}

View File

@ -13,7 +13,7 @@ module obj
import gg.m4
import sokol.gfx
// part struct mantain the fae indexes list
// part struct maintaining the face indices
pub struct Part {
pub mut:
faces [][][3]int // v n t index order, if -1 not available
@ -21,7 +21,7 @@ pub mut:
material string
}
// materias struct, all Ks and Ns are stored as maps of string
// material struct, all Ks and Ns are stored as maps of string
pub struct Material {
pub mut:
name string
@ -50,14 +50,14 @@ pub mut:
name string
part []Part // parts of the ObjPart
mat []Material // list of the materials of the ObjPart
mat_map map[string]int // maping material name to its material index
mat_map map[string]int // mapping material name to its material index
texture map[string]gfx.Image // GPU loaded texture map
material_file string // .mtl file name for the .obj
rend_data []Render_data // render data used for the rendering
t_m m4.Mat4 = m4.unit_m4() // transform matrix for this ObjPart
// child []ObjPart // childs
// child []ObjPart
// stats
min m4.Vec4 // min 3d position in the ObjPart
max m4.Vec4 // max 3d position in the ObjPart
@ -83,7 +83,7 @@ pub mut:
// data passed to the pixel shader
pub struct Tmp_fs_param {
pub mut:
ligth m4.Vec4
light m4.Vec4
ka m4.Vec4 = m4.Vec4{
e: [f32(0.1), 0.0, 0.0, 1.0]!
}