1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef API_3D_RENDER_IRENDER_DATA_STORE_DEFAULT_CAMERA_H 17 #define API_3D_RENDER_IRENDER_DATA_STORE_DEFAULT_CAMERA_H 18 19 #include <3d/render/render_data_defines_3d.h> 20 #include <base/containers/array_view.h> 21 #include <core/namespace.h> 22 #include <render/datastore/intf_render_data_store.h> 23 CORE3D_BEGIN_NAMESPACE()24CORE3D_BEGIN_NAMESPACE() 25 /** @ingroup group_render_irenderdatastoredefaultcamera */ 26 /** Interface to add cameras to rendering. 27 * Not internally synchronized. 28 */ 29 class IRenderDataStoreDefaultCamera : public RENDER_NS::IRenderDataStore { 30 public: 31 static constexpr BASE_NS::Uid UID { "9a13e890-2a33-4b45-beee-be39eaecce57" }; 32 33 ~IRenderDataStoreDefaultCamera() override = default; 34 35 /** Add camera to scene. 36 * @param camera A camera to be added. 37 */ 38 virtual void AddCamera(const RenderCamera& camera) = 0; 39 40 /** Get all cameras for particular scene id. 41 * @return array view to all cameras. 42 */ 43 virtual BASE_NS::array_view<const RenderCamera> GetCameras() const = 0; 44 45 /** Get named camera. 46 * @return render camera. 47 */ 48 virtual RenderCamera GetCamera(const BASE_NS::string_view name) const = 0; 49 50 /** Get camera by id. 51 * @return render camera. 52 */ 53 virtual RenderCamera GetCamera(const uint64_t id) const = 0; 54 55 /** Get index of a named camera. 56 * @return Index of camera in RenderCamera array. ~0u if not found. 57 */ 58 virtual uint32_t GetCameraIndex(const BASE_NS::string_view name) const = 0; 59 60 /** Get index of a camera id. 61 * @return Index of camera in RenderCamera array. ~0u if not found. 62 */ 63 virtual uint32_t GetCameraIndex(const uint64_t id) const = 0; 64 65 /** Get camera count. 66 * @return Count of cameras in RenderCamera array. 67 */ 68 virtual uint32_t GetCameraCount() const = 0; 69 70 /** Add environment to scene. 71 * @param environment A environment to be added. 72 */ 73 virtual void AddEnvironment(const RenderCamera::Environment& environment) = 0; 74 75 /** Get all environments for particular scene id. 76 * @return array view to all environments. 77 */ 78 virtual BASE_NS::array_view<const RenderCamera::Environment> GetEnvironments() const = 0; 79 80 /** Get environment by id. 81 * @return render environment. 82 */ 83 virtual RenderCamera::Environment GetEnvironment(const uint64_t id) const = 0; 84 85 /** Get environment count. 86 * @return Count of environments. 87 */ 88 virtual uint32_t GetEnvironmentCount() const = 0; 89 90 protected: 91 IRenderDataStoreDefaultCamera() = default; 92 }; 93 CORE3D_END_NAMESPACE() 94 95 #endif // API_3D_RENDER_IRENDER_DATA_STORE_DEFAULT_CAMERA_H 96