当前位置: 首页>>代码示例>>Golang>>正文


Golang C.float函数代码示例

本文整理汇总了Golang中C.float函数的典型用法代码示例。如果您正苦于以下问题:Golang float函数的具体用法?Golang float怎么用?Golang float使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了float函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: c_fovPort

func c_fovPort(that FovPort) (this C.ovrFovPort) {
	this.DownTan = C.float(that.DownTan)
	this.LeftTan = C.float(that.LeftTan)
	this.RightTan = C.float(that.RightTan)
	this.UpTan = C.float(that.UpTan)
	return
}
开发者ID:krux02,项目名称:libovr,代码行数:7,代码来源:ovr.go

示例2: Image

// Image returns image for given page number
func (f *Document) Image(page int) (image.Image, error) {
	var ctm C.fz_matrix
	C.fz_scale(&ctm, C.float(4.0), C.float(4.0))

	cs := C.fz_device_rgb(f.ctx)
	defer C.fz_drop_colorspace(f.ctx, cs)

	pixmap := C.fz_new_pixmap_from_page_number(f.ctx, f.doc, C.int(page), &ctm, cs)
	if pixmap == nil {
		return nil, errors.New("fitz: cannot create pixmap")
	}
	defer C.fz_drop_pixmap(f.ctx, pixmap)

	var bbox C.fz_irect
	C.fz_pixmap_bbox(f.ctx, pixmap, &bbox)

	pixels := C.fz_pixmap_samples(f.ctx, pixmap)
	if pixels == nil {
		return nil, errors.New("fitz: cannot get pixmap samples")
	}

	rect := image.Rect(int(bbox.x0), int(bbox.y0), int(bbox.x1), int(bbox.y1))
	bytes := C.GoBytes(unsafe.Pointer(pixels), 4*bbox.x1*bbox.y1)
	img := &image.RGBA{bytes, 4 * rect.Max.X, rect}

	return img, nil
}
开发者ID:lambdaX,项目名称:go-fitz,代码行数:28,代码来源:fitz.go

示例3: TextField

func TextField(x, y, w, h int, corners CornerFlags, state WidgetState, label string, cstart, cend int) {
	clabel := C.CString(label)
	defer C.free(unsafe.Pointer(clabel))
	C.bndTextField(vg, C.float(x), C.float(y), C.float(w), C.float(h),
		C.int(corners), C.BNDwidgetState(state), -1, clabel,
		C.int(cstart), C.int(cend))
}
开发者ID:james4k,项目名称:exp,代码行数:7,代码来源:blendish.go

示例4: madgwick

func (f *Filter) madgwick(timestamp int64, values []float32) {
	C.madgwick_update_array(
		f.orientation, C.float(sampleFreq), C.float(beta),
		(*_Ctype_float)(&values[0]))

	// quaternion slice
	o := f.orientation
	q := []float32{
		float32(o.q0),
		float32(o.q1),
		float32(o.q2),
		float32(o.q3),
	}
	q1 := float64(o.q0)
	q2 := float64(o.q1)
	q3 := float64(o.q2)
	q4 := float64(o.q3)

	// euler angles in radians (madgwick 2010)
	z := math.Atan2(2*q2*q3-2*q1*q4, 2*q1*q1+2*q2*q2-1) * rad2deg
	y := -math.Asin(2*q2*q4+2*q1*q3) * rad2deg
	x := math.Atan2(2*q3*q4-2*q1*q2, 2*q1*q1+2*q4*q4-1) * rad2deg
	e := []float64{z, y, x}

	if false {
		log.Println("qtn", timestamp, q)
		log.Println("eul", timestamp, e)
	}

	broadcast(timestamp, "qtn", q)
}
开发者ID:jlep,项目名称:steps,代码行数:31,代码来源:filter.go

示例5: toC

func (v *Vector) toC() C.FMOD_VECTOR {
	var cv C.FMOD_VECTOR
	cv.x = C.float(v.X)
	cv.y = C.float(v.Y)
	cv.z = C.float(v.Z)
	return cv
}
开发者ID:theaidem,项目名称:fmod,代码行数:7,代码来源:vector.go

示例6: DrawRectAt

// DrawRectAt draws a portion of the image specified w
// at the specified position.
func (img *Image) DrawRectAt(rx, ry, rw, rh, x, y int) {
	C.textureDraw(img.id,
		C.int(img.W), C.int(img.H),
		C.int(rx), C.int(ry),
		C.int(rw), C.int(rh),
		C.float(x), C.float(y))
}
开发者ID:PragmaticCypher,项目名称:gogol,代码行数:9,代码来源:image.go

示例7: SetListenerDirection

func SetListenerDirection(x, y, z float32) {
	C.sfListener_setDirection(C.sfVector3f{
		C.float(x),
		C.float(y),
		C.float(z),
	})
}
开发者ID:num5,项目名称:steven,代码行数:7,代码来源:audio.go

示例8: SetPosition

func (s Sound) SetPosition(x, y, z float32) {
	C.sfSound_setPosition(s.internal, C.sfVector3f{
		C.float(x),
		C.float(y),
		C.float(z),
	})
}
开发者ID:num5,项目名称:steven,代码行数:7,代码来源:audio.go

示例9: PickRay

func PickRay(cameraNode H3DNode, nwx float32, nwy float32, ox *float32, oy *float32, oz *float32,
	dx *float32, dy *float32, dz *float32) {
	C.h3dutPickRay(C.H3DNode(cameraNode), C.float(nwx), C.float(nwy), (*C.float)(unsafe.Pointer(ox)),
		(*C.float)(unsafe.Pointer(oy)), (*C.float)(unsafe.Pointer(oz)),
		(*C.float)(unsafe.Pointer(dx)), (*C.float)(unsafe.Pointer(dy)),
		(*C.float)(unsafe.Pointer(dz)))
}
开发者ID:floffel03,项目名称:gohorde,代码行数:7,代码来源:horde3dUtils.go

示例10: SetFloat3Parameter

// \brief Change a 3-components vector parameter of a shader
// \a name is the name of the variable to change in the shader.
// The corresponding parameter in the shader must be a 3x1 vector
// (vec3 GLSL type).
// Example:
// \code
// uniform vec3 myparam; // this is the variable in the shader
// \endcode
// \code
// sfShader_setFloat3Parameter(shader, "myparam", 5.2f, 6.0f, -8.1f);
// \endcode
// \param shader Shader object
// \param name   Name of the parameter in the shader
// \param x      First component of the value to assign
// \param y      Second component of the value to assign
// \param z      Third component of the value to assign
// void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
func (self Shader) SetFloat3Parameter(name string, x, y, z float32) {
	n := C.CString(name)
	x1 := C.float(x)
	y1 := C.float(y)
	z1 := C.float(z)
	C.sfShader_setFloat3Parameter(self.Cref, n, x1, y1, z1)
}
开发者ID:drhodes,项目名称:go-sfml,代码行数:24,代码来源:gfx-shader.go

示例11: DrawTintedRotated

func (b *Bitmap) DrawTintedRotated(cx, cy, dx, dy, angle float32, flags int, color Color) {

	C.al_draw_tinted_rotated_bitmap((*C.ALLEGRO_BITMAP)(b), (C.ALLEGRO_COLOR)(color),
		C.float(cx), C.float(cy),
		C.float(dx), C.float(dy), C.float(angle), C.int(flags))

}
开发者ID:bluepeppers,项目名称:allegro,代码行数:7,代码来源:graphics.go

示例12: DrawRotated

func (b *Bitmap) DrawRotated(cx, cy, dx, dy, angle float32, flags int) {

	C.al_draw_rotated_bitmap((*C.ALLEGRO_BITMAP)(b),
		C.float(cx), C.float(cy), C.float(dx), C.float(dy),
		C.float(angle), C.int(flags))

}
开发者ID:bluepeppers,项目名称:allegro,代码行数:7,代码来源:graphics.go

示例13: MatrixProjection

// Used to generate projection from ovrEyeDesc::Fov.
func MatrixProjection(fov FovPort, znear, zfar float32, rightHanded bool) Matrix4f {
	if rightHanded {
		return matrix4f(C.ovrMatrix4f_Projection(c_fovPort(fov), C.float(znear), C.float(zfar), 1))
	} else {
		return matrix4f(C.ovrMatrix4f_Projection(c_fovPort(fov), C.float(znear), C.float(zfar), 0))
	}
}
开发者ID:krux02,项目名称:libovr,代码行数:8,代码来源:ovr.go

示例14: c_quatf

func c_quatf(that Quatf) (this C.ovrQuatf) {
	this.x = C.float(that.X)
	this.y = C.float(that.Y)
	this.z = C.float(that.Z)
	this.w = C.float(that.W)
	return
}
开发者ID:krux02,项目名称:libovr,代码行数:7,代码来源:ovr.go

示例15: DrawJustified

func (f *Font) DrawJustified(color Color, x1, x2, y, diff float32, flags int, text string) {
	ctext := C.CString(text)
	defer C.free(unsafe.Pointer(ctext))

	C.al_draw_justified_text((*C.ALLEGRO_FONT)(f), C.ALLEGRO_COLOR(color),
		C.float(x1), C.float(x2), C.float(y), C.float(diff), C.int(flags), ctext)

}
开发者ID:bluepeppers,项目名称:allegro,代码行数:8,代码来源:font.go


注:本文中的C.float函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。