Method: CGLM::Mat4#project
- Defined in:
- ext/cglm/rb_cglm_project.c
#project(pos, viewport[, dest]) ⇒ dest | new Vec3
Maps the given object-space coordinates into window coordinates using
self as the projection matrix.
posis a Vec3 specifying the object-space coordinates.viewportis a Vec4 specifying the dimensions of the viewport in[x, y, width, height]format.destis the Vec3 to place the results into, and will be created if omitted.
87 88 89 90 91 92 93 |
# File 'ext/cglm/rb_cglm_project.c', line 87
VALUE rb_cglm_project_project(int argc, VALUE *argv, VALUE self) {
VALUE pos, viewport, dest;
rb_scan_args(argc, argv, "21", &pos, &viewport, &dest);
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
glm_project(VAL2VEC3(pos), VAL2MAT4(self), VAL2VEC4(viewport), VAL2VEC3(dest));
return dest;
}
|