// \brief Return the 4x4 matrix of a transform // This function returns a pointer to an array of 16 floats // containing the transform elements as a 4x4 matrix, which // is directly compatible with OpenGL functions. // \code // sfTransform* transform = ...; // glLoadMatrixf(sfTransform_getMatrix(transform)); // \endcode // \param transform Transform object // \return Pointer to a 4x4 matrix // const float* sfTransform_getMatrix(const sfTransform* transform); func (self Transform) Matrix() [16]float32 { //size := 2 carr := C.sfTransform_getMatrix(self.Cref) arr := [16]float32{} p := unsafe.Pointer(carr) ptr := uintptr(p) for i := 0; i < 16; i++ { arr[i] = float32(*(*C.float)(p)) ptr += 4 p = unsafe.Pointer(ptr) } return arr }
// \brief Return the 4x4 matrix of a transform // // This function fills an array of 16 floats with the transform // converted as a 4x4 matrix, which is directly compatible with // OpenGL functions. // // \code // sfTransform transform = ...; // float matrix[16]; // sfTransform_getMatrix(&transform, matrix) // glLoadMatrixf(matrix); // \endcode // // \param transform Transform object // \param matrix Pointer to the 16-element array to fill with the matrix // /////////////////////////////////////////////////////////// // CSFML_GRAPHICS_API void sfTransform_getMatrix(const sfTransform* transform, float* matrix); func (self Transform) GetMatrix(matrix [16]float32) { p := unsafe.Pointer(&matrix[0]) C.sfTransform_getMatrix(self.Cref, (*C.float)(p)) }