Skip to content

feat(types): create ogl augmented defs #28

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
wants to merge 12 commits into from
Closed

Conversation

CodyJasonBennett
Copy link
Member

@CodyJasonBennett CodyJasonBennett commented May 28, 2022

Prob move to DefinitelyTyped or OGL org under @types/ogl. Related: oframe/ogl#24.

@eXponenta
Copy link
Contributor

Good choose because i see that ogl-typescript has wrong and outdate definitions.
I already thought about fork ogl too and rewrite to TS with some fixies, but this is not good idea.
Gordon not fully friendly or very busy and some critical place changings very slow =(

@CodyJasonBennett
Copy link
Member Author

CodyJasonBennett commented May 31, 2022

I did reference ogl-typescript but came to the same conclusion. A bunch of depreciations were made since gLTF stuff was added, and it looks like they crudely auto-generated a bunch of stuff with some MS tools since the interfaces were confusingly incorrect or incomplete.

I'm vetting types by hand, but I'm a few days into it now. I'll have to find a system to A/B these with OGL source and try it out on examples.

@CodyJasonBennett
Copy link
Member Author

CodyJasonBennett commented Jun 1, 2022

Can possibly fill in OGL's uniform types based on allowed values -- float/ints, float/int arrays, samplers/samplerarrays, and structs.

react-ogl allows some shorthand for material.uniform = value where value can also be a stringified color name or a literal array that gets converted into a math class, but otherwise the same.

react-ogl/src/types.ts

Lines 216 to 229 in 1c9874e

export type UniformValue = keyof typeof COLORS | number | number[] | OGL.Texture | OGL.Texture[]
export type UniformRepresentation = UniformValue | { [structName: string]: UniformValue }
// Core
export type GeometryProps = Node<OGL.Geometry, typeof OGL.Geometry> & {
[attributes: string]: { data: ArrayBufferView; size?: number }
}
export type ProgramProps = Omit<Node<OGL.Program, typeof OGL.Program>, 'uniforms'> & {
vertex?: string
fragment?: string
uniforms?: {
[uniform: string]: UniformRepresentation | { value: UniformRepresentation }
}
}

@CodyJasonBennett
Copy link
Member Author

Continuing in #51. See https://github.com/CodyJasonBennett/ogl-types for OGL types.

@CodyJasonBennett CodyJasonBennett deleted the ts-ogl-types branch June 15, 2022 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants