Esempio n. 1
0
File: ovr.go Progetto: krux02/libovr
// Calculates texture size recommended for rendering one eye within HMD, given FOV cone.
// Higher FOV will generally require larger textures to maintain quality.
//  - pixelsPerDisplayPixel specifies that number of render target pixels per display
//    pixel at center of distortion; 1.0 is the default value. Lower values
//    can improve performance.
func (hmd *Hmd) GetFovTextureSize(eye EyeType, fov FovPort, pixelsPerDisplayPixel float32) Sizei {
	var cFov C.ovrFovPort
	cFov.DownTan = C.float(fov.DownTan)
	cFov.LeftTan = C.float(fov.LeftTan)
	cFov.RightTan = C.float(fov.RightTan)
	cFov.UpTan = C.float(fov.UpTan)
	return sizei(C.ovrHmd_GetFovTextureSize(hmd.cptr(), C.ovrEyeType(eye), cFov, C.float(pixelsPerDisplayPixel)))
}
Esempio n. 2
0
File: ovr.go Progetto: postfix/ovr
func (desc EyeRenderDesc) toC() C.ovrEyeRenderDesc {
	return C.ovrEyeRenderDesc{
		Eye:                       C.ovrEyeType(desc.Eye),
		Fov:                       desc.Fov.toC(),
		DistortedViewport:         desc.DistortedViewport.toC(),
		PixelsPerTanAngleAtCenter: desc.PixelsPerTanAngleAtCenter.toC(),
		ViewAdjust:                desc.ViewAdjust.toC(),
	}
}
Esempio n. 3
0
File: ovr.go Progetto: postfix/ovr
func (hmd *Hmd) CreateDistortionMesh(eye EyeType, fov FovPort, distortionCaps uint) (*DistortionMesh, error) {
	meshData := DistortionMesh{}

	if C.ovrHmd_CreateDistortionMesh(hmd.hmdRef, C.ovrEyeType(eye), fov.toC(), C.uint(distortionCaps), (*C.ovrDistortionMesh)(unsafe.Pointer(&meshData))) == 0 {
		if lastError := hmd.GetLastError(); lastError != nil {
			return nil, errors.New(*lastError)
		}

		return nil, errors.New("An unknown error occured")
	}

	return &meshData, nil
}
Esempio n. 4
0
File: ovr.go Progetto: postfix/ovr
func (hmd *Hmd) GetEyeTimewarpMatrices(eye EyeType, renderPose Posef) [2]Matrix4f {
	twmOut := [2]C.ovrMatrix4f{}
	C.ovrHmd_GetEyeTimewarpMatrices(hmd.hmdRef, C.ovrEyeType(eye), renderPose.toC(), &twmOut[0])

	return [2]Matrix4f{newMatrix4f(twmOut[0]), newMatrix4f(twmOut[1])}
}
Esempio n. 5
0
File: ovr.go Progetto: postfix/ovr
func (hmd *Hmd) GetRenderDesc(eye EyeType, fov FovPort) EyeRenderDesc {
	return newEyeRenderDesc(C.ovrHmd_GetRenderDesc(hmd.hmdRef, C.ovrEyeType(eye), fov.toC()))
}
Esempio n. 6
0
File: ovr.go Progetto: postfix/ovr
func (hmd *Hmd) GetEyePose(eye EyeType) Posef {
	return newPosef(C.ovrHmd_GetEyePose(hmd.hmdRef, C.ovrEyeType(eye)))
}
Esempio n. 7
0
File: ovr.go Progetto: postfix/ovr
func (hmd *Hmd) GetFovTextureSize(eye EyeType, fov FovPort, pixelsPerDisplayPixel float32) Sizei {
	return newSizei(C.ovrHmd_GetFovTextureSize(hmd.hmdRef, C.ovrEyeType(eye), fov.toC(), C.float(pixelsPerDisplayPixel)))
}
Esempio n. 8
0
File: ovr.go Progetto: krux02/libovr
// Computes timewarp matrices used by distortion mesh shader, these are used to adjust
// for orientation change since the last call to ovrHmd_GetEyePose for this eye.
// The ovrDistortionVertex::TimeWarpFactor is used to blend between the matrices,
// usually representing two different sides of the screen.
// Must be called on the same thread as ovrHmd_BeginFrameTiming.
func (hmd *Hmd) GetEyeTimewarpMatrices(eye EyeType, renderPose Posef) (twmOut [2]Matrix4f) {
	C.ovrHmd_GetEyeTimewarpMatrices(hmd.cptr(), C.ovrEyeType(eye), c_posef(renderPose), twmOut[0].cptr())
	return
}
Esempio n. 9
0
File: ovr.go Progetto: krux02/libovr
// Predicts and returns Pose that should be used rendering the specified eye.
// Must be called between ovrHmd_BeginFrameTiming & ovrHmd_EndFrameTiming.
func (this *Hmd) GetEyePose(eye EyeType) Posef {
	return posef(C.ovrHmd_GetEyePose(this.cptr(), C.ovrEyeType(eye)))
}
Esempio n. 10
0
File: ovr.go Progetto: krux02/libovr
func (this *Hmd) GetRenderDesc(eyeType EyeType, fov FovPort) EyeRenderDesc {
	return eyeRenderDesc(C.ovrHmd_GetRenderDesc(this.cptr(), C.ovrEyeType(eyeType), c_fovPort(fov)))
}
Esempio n. 11
0
File: ovr.go Progetto: krux02/libovr
func (this *Hmd) EndEyeRender(eye EyeType, renderPose Posef, eyeTexture *Texture) {
	C.ovrHmd_EndEyeRender(this.cptr(), C.ovrEyeType(eye), c_posef(renderPose), eyeTexture.cptr())
}
Esempio n. 12
0
File: ovr.go Progetto: krux02/libovr
func (this *Hmd) BeginEyeRender(eye EyeType) Posef {
	return posef(C.ovrHmd_BeginEyeRender(this.cptr(), C.ovrEyeType(eye)))
}