From 5b3295db94a15532b537b3f2973ab0182d2a4bf9 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 12 Jul 2019 06:42:34 +0200 Subject: [PATCH] remove # from gg and glm --- compiler/parser.v | 3 +-- vlib/gg/gg.v | 14 ++++++------ vlib/glm/glm.v | 54 +++++++++++++++++++++++------------------------ 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/compiler/parser.v b/compiler/parser.v index 804d6b3af0..efa90f2186 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -130,8 +130,7 @@ fn (p mut Parser) parse() { } p.fgenln('\n') p.builtin_pkg = p.mod == 'builtin' - p.can_chash = p.mod == 'gg' || p.mod == 'glm' || p.mod == 'gl' || - p.mod == 'http' || p.mod == 'glfw' || p.mod=='ui' // TODO tmp remove + p.can_chash = p.mod == 'ft' || p.mod == 'http' || p.mod == 'glfw' || p.mod=='ui' // TODO tmp remove // Import pass - the first and the smallest pass that only analyzes imports p.table.register_package(p.mod) if p.run == .imports { diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index f0c2c1a64b..647cc1cf10 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -112,13 +112,13 @@ pub fn new_context(cfg Cfg) *GG { if cfg.retina { scale = 2 } - gl.enable(GL_BLEND) - # glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //gl.enable(GL_BLEND) + //# glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //println('new gg text context VAO=$VAO') - gl.bind_vao(VAO) - gl.bind_buffer(GL_ARRAY_BUFFER, VBO) - gl.enable_vertex_attrib_array(0) - gl.vertex_attrib_pointer(0, 4, GL_FLOAT, false, 4, 0) + //gl.bind_vao(VAO) + //gl.bind_buffer(GL_ARRAY_BUFFER, VBO) + //gl.enable_vertex_attrib_array(0) + //gl.vertex_attrib_pointer(0, 4, GL_FLOAT, false, 4, 0) todo_remove_me(cfg, scale) mut ctx := &GG { shader: shader @@ -263,7 +263,7 @@ fn todo_remove_me(cfg Cfg, scale int) { mut height := cfg.height * scale font_size := cfg.font_size * scale gl.enable(GL_BLEND) - # glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //# glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); shader := gl.new_shader('text') shader.use() projection := glm.ortho(0, width, 0, height)// 0 at BOT diff --git a/vlib/glm/glm.v b/vlib/glm/glm.v index 3b3de63df7..1932dbbc68 100644 --- a/vlib/glm/glm.v +++ b/vlib/glm/glm.v @@ -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(1)); n := 16 - mut res := f32_calloc(n) - # res[0] = 2 / (right - left) ; - # res[5] = 2.0 / (top - bottom); - # res[10] = (1); - # res[12] = - (right + left) / (right - left); - # res[13] = - (top + bottom) / (top - bottom); - res[15] = 1 + 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 return mat4(res) } @@ -277,26 +277,26 @@ 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) - # f32* out = malloc (sizeof(f32) * 16); - # out[0] = -2 * lr; - # out[1] = 0; - # out[2] = 0; - # out[3] = 0; - # out[4] = 0; - # out[5] = -2 * bt; - # out[6] = 0; - # out[7] = 0; - # out[8] = 0; - # out[9] = 0; - # out[10] = 2 * nf; - # out[11] = 0; - # out[12] = (left + right) * lr; - # out[13] = (top + bottom) * bt; - # out[14] = 1 * nf;//(far + near) * nf; - # out[15] = 1; - # return out; - f := 0.0 - return &f + 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 + //f := 0.0 + //return &f } // fn ortho_old(a, b, c, d f32) *f32 {