remove # from gg and glm

pull/1095/head
Alexander Medvednikov 2019-07-12 06:42:34 +02:00
parent e15c2da1f4
commit 5b3295db94
3 changed files with 35 additions and 36 deletions

View File

@ -130,8 +130,7 @@ fn (p mut Parser) parse() {
} }
p.fgenln('\n') p.fgenln('\n')
p.builtin_pkg = p.mod == 'builtin' p.builtin_pkg = p.mod == 'builtin'
p.can_chash = p.mod == 'gg' || p.mod == 'glm' || p.mod == 'gl' || p.can_chash = p.mod == 'ft' || p.mod == 'http' || p.mod == 'glfw' || p.mod=='ui' // TODO tmp remove
p.mod == 'http' || p.mod == 'glfw' || p.mod=='ui' // TODO tmp remove
// Import pass - the first and the smallest pass that only analyzes imports // Import pass - the first and the smallest pass that only analyzes imports
p.table.register_package(p.mod) p.table.register_package(p.mod)
if p.run == .imports { if p.run == .imports {

View File

@ -112,13 +112,13 @@ pub fn new_context(cfg Cfg) *GG {
if cfg.retina { if cfg.retina {
scale = 2 scale = 2
} }
gl.enable(GL_BLEND) //gl.enable(GL_BLEND)
# glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //# glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//println('new gg text context VAO=$VAO') //println('new gg text context VAO=$VAO')
gl.bind_vao(VAO) //gl.bind_vao(VAO)
gl.bind_buffer(GL_ARRAY_BUFFER, VBO) //gl.bind_buffer(GL_ARRAY_BUFFER, VBO)
gl.enable_vertex_attrib_array(0) //gl.enable_vertex_attrib_array(0)
gl.vertex_attrib_pointer(0, 4, GL_FLOAT, false, 4, 0) //gl.vertex_attrib_pointer(0, 4, GL_FLOAT, false, 4, 0)
todo_remove_me(cfg, scale) todo_remove_me(cfg, scale)
mut ctx := &GG { mut ctx := &GG {
shader: shader shader: shader
@ -263,7 +263,7 @@ fn todo_remove_me(cfg Cfg, scale int) {
mut height := cfg.height * scale mut height := cfg.height * scale
font_size := cfg.font_size * scale font_size := cfg.font_size * scale
gl.enable(GL_BLEND) 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 := gl.new_shader('text')
shader.use() shader.use()
projection := glm.ortho(0, width, 0, height)// 0 at BOT projection := glm.ortho(0, width, 0, height)// 0 at BOT

View File

@ -166,12 +166,12 @@ pub fn ortho(left, right, bottom, top f32) Mat4 {
// mat<4, 4, T, defaultp> Result(static_cast<T>(1)); // mat<4, 4, T, defaultp> Result(static_cast<T>(1));
n := 16 n := 16
mut res := f32_calloc(n) mut res := f32_calloc(n)
# res[0] = 2 / (right - left) ; res[0] = 2.0 / f32(right - left)
# res[5] = 2.0 / (top - bottom); res[5] = 2.0 / f32(top - bottom)
# res[10] = (1); res[10] = 1.0
# res[12] = - (right + left) / (right - left); res[12] = - (right + left) / (right - left)
# res[13] = - (top + bottom) / (top - bottom); res[13] = - (top + bottom) / (top - bottom)
res[15] = 1 res[15] = 1.0
return mat4(res) return mat4(res)
} }
@ -277,26 +277,26 @@ fn ortho_js(left, right, bottom, top f32) *f32 {
lr := 1.0 / (left - right) lr := 1.0 / (left - right)
bt := 1.0 / (bottom - top) bt := 1.0 / (bottom - top)
nf := 1.0 / 1.0// (mynear -myfar) nf := 1.0 / 1.0// (mynear -myfar)
# f32* out = malloc (sizeof(f32) * 16); mut out := (*f32)( malloc (sizeof(f32) * 16))
# out[0] = -2 * lr; out[0] = -2.0 * lr
# out[1] = 0; out[1] = 0
# out[2] = 0; out[2] = 0
# out[3] = 0; out[3] = 0
# out[4] = 0; out[4] = 0
# out[5] = -2 * bt; out[5] = -2.0 * bt
# out[6] = 0; out[6] = 0
# out[7] = 0; out[7] = 0
# out[8] = 0; out[8] = 0
# out[9] = 0; out[9] = 0
# out[10] = 2 * nf; out[10] = 2.0 * nf
# out[11] = 0; out[11] = 0
# out[12] = (left + right) * lr; out[12] = (left + right) * lr
# out[13] = (top + bottom) * bt; out[13] = (top + bottom) * bt
# out[14] = 1 * nf;//(far + near) * nf; out[14] = 1.0 * nf//(far + near) * nf;
# out[15] = 1; out[15] = 1
# return out; return out
f := 0.0 //f := 0.0
return &f //return &f
} }
// fn ortho_old(a, b, c, d f32) *f32 { // fn ortho_old(a, b, c, d f32) *f32 {