- Notifications
You must be signed in to change notification settings - Fork20
kotlin-graphics/glm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is the Kotlin port ofOpenGL Mathematics (GLM), written byg-truc (repository), a header only C++ mathematics library for graphics software based on theOpenGL Shading Language (GLSL) specifications.
GLM provides classes and functions designed and implemented with the same naming conventions and functionality thanGLSL so that anyone who knowsGLSL, can useGLM as well in Kotlin and Java.
This project isn't limited toGLSL features. An extension system, based on theGLSL extension conventions, provides extended capabilities: matrix transformations, quaternions, data packing, random numbers, noise, etc...
This library works perfectly withOpenGL but it also ensures interoperability with other third party libraries and SDK. It is a good candidate for software rendering (raytracing / rasterisation), image processing, physic simulations and any development context that requires a simple and convenient mathematics library.
GLM is written entirely in Kotlin, but can be also used from Java. It is a platform independent library with no dependences other thankotlin-unsigned for unsigned support andkotlin-test for testing.
For more information aboutGLM, please have a look at themanual and the originalAPI reference documentation.The source code and the documentation are licensed under both theHappy Bunny License (Modified MIT) or the MIT License.
Don't hesitate to contribute to the project by submittingissues orpull requests for bugs and features. Any feedback is welcome atelect86@gmail.com.
importglm_.vec2.Vec2importglm_.vec3.Vec3importglm_.mat4x4.Mat4importglm_.glmfuncamera(translate:Float,rotate:Vec2):Mat4 {val projection= glm.perspective(glm.PIf*0.25f,4.0f/3.0f,0.1f,100.0f)var view= glm.translate(Mat4(1.0f),Vec3(0.0f,0.0f,-translate)) view= glm.rotate(view, rotate.y,Vec3(-1.0f,0.0f,0.0f)) view= glm.rotate(view, rotate.x,Vec3(0.0f,1.0f,0.0f))val model= glm.scale(Mat4(1.0f),Vec3(0.5f))return projection* view* model}
repositories { maven("https://raw.githubusercontent.com/kotlin-graphics/mary/master")// or with magik plugin//github("kotlin-graphics/mary")}dependencies { implementation("kotlin.graphics:glm:0.9.9.1-11")}
dependencies { implementation("io.github.kotlin-graphics:glm:0.9.9.1-12")}
You can find more info bymary