oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.71k stars 211 forks source link

TypeScript support #188

Closed pschroen closed 12 months ago

pschroen commented 1 year ago

Nearly complete typings for OGL v1.0.0, includes everything needed for all 46 examples (48 if you include the readme examples).

There's only 4 files left where I've included stubs for the declarations but they weren't needed for my Angular project or the examples:

I was able to compile TypeScript versions of all the examples with the above just as stubs, but we should complete these as well at some point, or as needed if anyone has a need for them in their own project.

I've also included the standard Type definitions header at the top of the types entry point.

// Type definitions for ogl 1.0.0
// Project: https://github.com/oframe/ogl
// Definitions by: Xin Chen <https://github.com/nshen>
//                 Cody Bennett <https://github.com/CodyJasonBennett>
//                 Patrick Schroen <https://github.com/pschroen>
// Definitions: https://github.com/oframe/ogl

@nshen @CodyJasonBennett I hope you guys are ok with the credit given here, these typings are mostly based on the original TypeScript version, ogl-types used by the React version and the core/math declarations in #177.

I've made further updates and filled-in any missing declarations, building on the work by @CodyJasonBennett.

@gordonnl if you can review the comments above each of the classes, the descriptions are mostly based on @types/three.

I've also included inline descriptions for each of the Transform properties and methods, if you did ever want to write documentation for the library this could be used as a starting-point to generate docs if you like.

Thanks guys, and lmk what you think! 😊

Related PR:

Closes #24

gordonnl commented 12 months ago

Massive thank you @pschroen and @CodyJasonBennett 🙏