Skip to content

x/mobile/exp/f32: Add some functionality #13786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
star-tek-mb opened this issue Dec 31, 2015 · 1 comment
Closed

x/mobile/exp/f32: Add some functionality #13786

star-tek-mb opened this issue Dec 31, 2015 · 1 comment

Comments

@star-tek-mb
Copy link

Package f32 - is good now. But there are no some functions. I want add functions *f32.Mat4.Raw() and *f32.Mat4.Ortho.

// Returns raw matrix (row-major)
func (m *Mat4) Raw() []float32 {
    out := make([]float32, 16)
    for i := 0; i < 4; i++ {
        for j := 0; j < 4; j++ {
            out[i*4+j] = m[i][j]
        }
    }
    return out
}

// Usage:
glctx.UniformMatrix4fv(mvp, MVP.Raw())

And Ortho:

// Ortho sets m to be the GL orthographic matrix
func (m *Mat4) Ortho(width, height, near, far float32) {
    m[0][0] = 2 / width
    m[1][1] = -2 / height
    m[2][2] = -2 / (far - near)
    m[3][2] = -(far + near) / (far - near)
    m[3][3] = 1 
}

And some structures, like Mat2 (for full functionality) and Vec2 (for UV).
Final update - support for float64 (x/mobilfef32 and x/mobile/f64 packages).

P.S: sorry for my english

@hyangah
Copy link
Contributor

hyangah commented Jan 15, 2016

This is about the future plan for the highly experimental f32, .. packages.
Let's discuss in golang-nuts mailing list.

/cc @nigeltao

@hyangah hyangah closed this as completed Jan 15, 2016
@golang golang locked and limited conversation to collaborators Jan 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants