Ocean
Loading...
Searching...
No Matches
GLFrameView.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_PLATFORM_ANDROID_APPLICATION_GL_FRAME_VIEW_H
9#define META_OCEAN_PLATFORM_ANDROID_APPLICATION_GL_FRAME_VIEW_H
10
13
15
17
18namespace Ocean
19{
20
21namespace Platform
22{
23
24namespace Android
25{
26
27namespace Application
28{
29
30/**
31 * This class implements an OpenGLES-based view with a frame medium background for Android platform applications.
32 * The main view is implemented as singleton object.
33 * @ingroup platformandroidapplication
34 */
35class OCEAN_PLATFORM_ANDROID_APPLICATION_EXPORT GLFrameView : public GLRendererView
36{
37 public:
38
39 /**
40 * Initializes the view.
41 * @return True, if succeeded
42 */
43 bool initialize() override;
44
45 /**
46 * Releases the view.
47 * @return True, if succeeded
48 */
49 bool release() override;
50
51 /**
52 * Sets the background medium of this view by the medium's url and several further parameters.
53 * @param url URL of the media object to be used as background medium
54 * @param type Hint defining the media object in more detail, possible values are "LIVE_VIDEO", "IMAGE", "MOVIE", "IMAGE_SEQUENCE" or "FRAME_STREAM", if no hint is given the first possible media object will be created
55 * @param preferredWidth Preferred width of the medium in pixel, use 0 to use the default width
56 * @param preferredHeight Preferred height of the medium in pixel, use 0 to use the default height
57 * @param adjustFov True, to adjust the view's field of view to the field of the background automatically
58 * @return True, if succeeded
59 */
60 virtual bool setBackgroundMedium(const std::string& url, const std::string& type, const int preferredWidth, const int preferredHeight, const bool adjustFov);
61
62 /**
63 * Sets the background medium of this view.
64 * @param frameMedium Background media object to set
65 * @param adjustFov True, to adjust the view's field of view to the field of view of the medium automatically
66 * @return True, if succeeded
67 */
68 virtual bool setBackgroundMedium(const Media::FrameMediumRef& frameMedium, const bool adjustFov = false);
69
70 /**
71 * Returns the background medium.
72 * @return The view's background medium, if any
73 */
75
76 /**
77 * Converts the given screen positions into frame positions.
78 * @param xScreen Horizontal screen position, with range [0, infinity)
79 * @param yScreen Vertical screen position, with range [0, infinity)
80 * @param xFrame Resulting horizontal frame position, with range [0, infinity)
81 * @param yFrame Resulting vertical frame position, with range [0, infinity)
82 * @return True, if succeeded
83 */
84 virtual bool screen2frame(const Scalar xScreen, const Scalar yScreen, Scalar& xFrame, Scalar& yFrame);
85
86 /**
87 * Creates an instance of this object.
88 * @return The new instance
89 */
90 static inline GLView* createInstance();
91
92 protected:
93
94 /**
95 * Creates a new view object.
96 */
97 GLFrameView() = default;
98
99 /**
100 * Destructs a view object.
101 */
102 ~GLFrameView() override;
103
104 protected:
105
106 /// Rendering undistorted background object.
108
109 /// The frame medium of the background which is stored as long as the view hasn't been initialized.
111
112 /// True, to adjust the field of view of the view automatically so that the background medium is entirely covered.
113 bool intermediateBackgroundAdjustFov_ = false;
114};
115
120
121}
122
123}
124
125}
126
127}
128
129#endif // META_OCEAN_PLATFORM_ANDROID_APPLICATION_GL_FRAME_VIEW_H
This class implements an OpenGLES-based view with a frame medium background for Android platform appl...
Definition GLFrameView.h:36
virtual bool setBackgroundMedium(const Media::FrameMediumRef &frameMedium, const bool adjustFov=false)
Sets the background medium of this view.
bool initialize() override
Initializes the view.
virtual Media::FrameMediumRef backgroundMedium() const
Returns the background medium.
static GLView * createInstance()
Creates an instance of this object.
Definition GLFrameView.h:116
Rendering::UndistortedBackgroundRef background_
Rendering undistorted background object.
Definition GLFrameView.h:107
bool release() override
Releases the view.
~GLFrameView() override
Destructs a view object.
virtual bool setBackgroundMedium(const std::string &url, const std::string &type, const int preferredWidth, const int preferredHeight, const bool adjustFov)
Sets the background medium of this view by the medium's url and several further parameters.
Media::FrameMediumRef intermediateBackgroundFrameMedium_
The frame medium of the background which is stored as long as the view hasn't been initialized.
Definition GLFrameView.h:110
virtual bool screen2frame(const Scalar xScreen, const Scalar yScreen, Scalar &xFrame, Scalar &yFrame)
Converts the given screen positions into frame positions.
GLFrameView()=default
Creates a new view object.
This class implements an OpenGLES-based view using the OpenGELESceneGraph renderer for Android platfo...
Definition GLRendererView.h:37
This class implements the base class for all OpenGL-ES-based views.
Definition GLView.h:33
float Scalar
Definition of a scalar type.
Definition Math.h:129
SmartMediumRef< FrameMedium > FrameMediumRef
Definition of a smart medium reference holding a frame medium object.
Definition FrameMedium.h:39
The namespace covering the entire Ocean framework.
Definition Accessor.h:15