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

vlib: fix missing else{} in match statements

This commit is contained in:
Alexander Medvednikov
2019-12-07 17:13:25 +03:00
parent 2fb7fba856
commit ad6adf327e
15 changed files with 88 additions and 85 deletions

View File

@ -6,7 +6,7 @@ module glm
import math
/*
/*
#flag -lmyglm
# f32* myglm_ortho(f32, f32, f32, f32);
# f32* myglm_translate(f32, f32, f32);
@ -117,11 +117,11 @@ fn (a Vec3) print() {
x := a.x
y := a.y
z := a.z
C.printf('vec3{%f,%f,%f}\n',x,y,z)
C.printf('vec3{%f,%f,%f}\n',x,y,z)
// println('vec3{$x,$y,$z}')
}
/*
/*
fn rotate(m Mat4, angle f32, vec Vec3) Mat4 {
// # t_mat4 m;
// println('rotate done')
@ -154,7 +154,7 @@ pub fn translate(m Mat4, v Vec3) Mat4 {
return mat4(out)
}
/*
/*
fn normalize(vec Vec3) Vec3 {
# return myglm_normalize(vec);
return Vec3{}
@ -165,13 +165,13 @@ pub fn ortho(left, right, bottom, top f32) Mat4 {
//println('glm ortho($left, $right, $bottom, $top)')
// mat<4, 4, T, defaultp> Result(static_cast<T>(1));
n := 16
mut res := f32_calloc(n)
res[0] = 2.0 / f32(right - left)
res[5] = 2.0 / f32(top - bottom)
res[10] = 1.0
res[12] = - (right + left) / (right - left)
res[13] = - (top + bottom) / (top - bottom)
res[15] = 1.0
mut res := f32_calloc(n)
res[0] = 2.0 / (right - left)
res[5] = 2.0 / (top - bottom)
res[10] = 1.0
res[12] = - (right + left) / (right - left)
res[13] = - (top + bottom) / (top - bottom)
res[15] = 1.0
return mat4(res)
}
@ -277,24 +277,24 @@ fn ortho_js(left, right, bottom, top f32) &f32 {
lr := 1.0 / (left - right)
bt := 1.0 / (bottom - top)
nf := 1.0 / 1.0// (mynear -myfar)
mut out := (*f32)( malloc (sizeof(f32) * 16))
out[0] = -2.0 * lr
out[1] = 0
out[2] = 0
out[3] = 0
out[4] = 0
out[5] = -2.0 * bt
out[6] = 0
out[7] = 0
out[8] = 0
out[9] = 0
out[10] = 2.0 * nf
out[11] = 0
out[12] = (left + right) * lr
out[13] = (top + bottom) * bt
mut out := (*f32)( malloc (sizeof(f32) * 16))
out[0] = -2.0 * lr
out[1] = 0
out[2] = 0
out[3] = 0
out[4] = 0
out[5] = -2.0 * bt
out[6] = 0
out[7] = 0
out[8] = 0
out[9] = 0
out[10] = 2.0 * nf
out[11] = 0
out[12] = (left + right) * lr
out[13] = (top + bottom) * bt
out[14] = 1.0 * nf//(far + near) * nf;
out[15] = 1
return out
out[15] = 1
return out
//f := 0.0
//return &f
}
@ -307,7 +307,7 @@ fn cross(a, b Vec3) Vec3 {
return Vec3{}
}
/*
/*
fn perspective(degrees f32, ratio f32, a, b f32) Mat4 {
// println('lang per degrees=$degrees ratio=$ratio a=$a b=$b')
// # printf("lang pers degrees=%f ratio=%f a=%f b=%f\n", degrees, ratio, a,b);