blob: 71aebef3947aeeffcff9c3555629e2c85aa95d89 [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001#ifndef ANDROID_DVR_RENDER_TEXTURE_PARAMS_H_
2#define ANDROID_DVR_RENDER_TEXTURE_PARAMS_H_
3
4#include <private/dvr/types.h>
5
6namespace android {
7namespace dvr {
8
9// Encapsulates information about the render texture, includes the size
10// of the render texture, and the left/right viewport which define the
11// portion each eye is rendering onto. This struct will be passed to
12// PresentFrame every frame before the client actually drawing the scene.
13struct RenderTextureParams {
14 RenderTextureParams() {}
15
16 RenderTextureParams(vec2i target_texture_size,
17 const Range2i& eye_viewport_bounds_left,
18 const Range2i& eye_viewport_bounds_right,
19 const FieldOfView& eye_fov_left,
20 const FieldOfView& eye_fov_right)
21 : texture_size(target_texture_size) {
22 eye_viewport_bounds[kLeftEye] = eye_viewport_bounds_left;
23 eye_viewport_bounds[kRightEye] = eye_viewport_bounds_right;
24 eye_fov[kLeftEye] = eye_fov_left;
25 eye_fov[kRightEye] = eye_fov_right;
26 }
27
28 explicit RenderTextureParams(vec2i target_texture_size,
29 const FieldOfView& eye_fov_left,
30 const FieldOfView& eye_fov_right) {
31 texture_size = target_texture_size;
32 eye_viewport_bounds[0] = Range2i::FromSize(
33 vec2i(0, 0), vec2i(texture_size[0] / 2, texture_size[1]));
34 eye_viewport_bounds[1] =
35 Range2i::FromSize(vec2i(texture_size[0] / 2, 0),
36 vec2i(texture_size[0] / 2, texture_size[1]));
37
38 eye_fov[kLeftEye] = eye_fov_left;
39 eye_fov[kRightEye] = eye_fov_right;
40 }
41
42 // The render texture size.
43 vec2i texture_size;
44
45 // The viewport bounds on the render texture for each eye.
46 Range2i eye_viewport_bounds[2];
47
48 // The field of view for each eye in degrees.
49 FieldOfView eye_fov[2];
50};
51
52} // namespace dvr
53} // namespace android
54
55#endif // ANDROID_DVR_RENDER_TEXTURE_PARAMS_H_