Пример #1
0
// 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)))
}
Пример #2
0
Файл: ovr.go Проект: 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(),
	}
}
Пример #3
0
Файл: ovr.go Проект: 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
}
Пример #4
0
Файл: ovr.go Проект: 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])}
}
Пример #5
0
Файл: ovr.go Проект: postfix/ovr
func (hmd *Hmd) GetRenderDesc(eye EyeType, fov FovPort) EyeRenderDesc {
	return newEyeRenderDesc(C.ovrHmd_GetRenderDesc(hmd.hmdRef, C.ovrEyeType(eye), fov.toC()))
}
Пример #6
0
Файл: ovr.go Проект: postfix/ovr
func (hmd *Hmd) GetEyePose(eye EyeType) Posef {
	return newPosef(C.ovrHmd_GetEyePose(hmd.hmdRef, C.ovrEyeType(eye)))
}
Пример #7
0
Файл: ovr.go Проект: 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)))
}
Пример #8
0
// 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
}
Пример #9
0
// 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)))
}
Пример #10
0
func (this *Hmd) GetRenderDesc(eyeType EyeType, fov FovPort) EyeRenderDesc {
	return eyeRenderDesc(C.ovrHmd_GetRenderDesc(this.cptr(), C.ovrEyeType(eyeType), c_fovPort(fov)))
}
Пример #11
0
func (this *Hmd) EndEyeRender(eye EyeType, renderPose Posef, eyeTexture *Texture) {
	C.ovrHmd_EndEyeRender(this.cptr(), C.ovrEyeType(eye), c_posef(renderPose), eyeTexture.cptr())
}
Пример #12
0
func (this *Hmd) BeginEyeRender(eye EyeType) Posef {
	return posef(C.ovrHmd_BeginEyeRender(this.cptr(), C.ovrEyeType(eye)))
}