18bf80f4bSopenharmony_ci/* 28bf80f4bSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 38bf80f4bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 48bf80f4bSopenharmony_ci * you may not use this file except in compliance with the License. 58bf80f4bSopenharmony_ci * You may obtain a copy of the License at 68bf80f4bSopenharmony_ci * 78bf80f4bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 88bf80f4bSopenharmony_ci * 98bf80f4bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 108bf80f4bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 118bf80f4bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128bf80f4bSopenharmony_ci * See the License for the specific language governing permissions and 138bf80f4bSopenharmony_ci * limitations under the License. 148bf80f4bSopenharmony_ci */ 158bf80f4bSopenharmony_ci 168bf80f4bSopenharmony_ci#ifndef OHOS_RENDER_3D_I_ENGINE_H 178bf80f4bSopenharmony_ci#define OHOS_RENDER_3D_I_ENGINE_H 188bf80f4bSopenharmony_ci 198bf80f4bSopenharmony_ci#include <cstdint> 208bf80f4bSopenharmony_ci#include <string> 218bf80f4bSopenharmony_ci#include <memory> 228bf80f4bSopenharmony_ci 238bf80f4bSopenharmony_ci#include <EGL/egl.h> 248bf80f4bSopenharmony_ci#include <GLES/gl.h> 258bf80f4bSopenharmony_ci 268bf80f4bSopenharmony_ci#include "custom/custom_render_descriptor.h" 278bf80f4bSopenharmony_ci#include "custom/shader_input_buffer.h" 288bf80f4bSopenharmony_ci#include "data_type/constants.h" 298bf80f4bSopenharmony_ci#include "data_type/geometry/cube.h" 308bf80f4bSopenharmony_ci#include "data_type/geometry/cone.h" 318bf80f4bSopenharmony_ci#include "data_type/geometry/sphere.h" 328bf80f4bSopenharmony_ci#include "data_type/gltf_animation.h" 338bf80f4bSopenharmony_ci#include "data_type/light.h" 348bf80f4bSopenharmony_ci#include "data_type/position.h" 358bf80f4bSopenharmony_ci#include "data_type/pointer_event.h" 368bf80f4bSopenharmony_ci#include "data_type/quaternion.h" 378bf80f4bSopenharmony_ci#include "data_type/vec3.h" 388bf80f4bSopenharmony_ci#include "platform_data.h" 398bf80f4bSopenharmony_ci#include "texture_info.h" 408bf80f4bSopenharmony_ci 418bf80f4bSopenharmony_cinamespace OHOS::Render3D { 428bf80f4bSopenharmony_ciclass IEngine { 438bf80f4bSopenharmony_cipublic: 448bf80f4bSopenharmony_ci virtual ~IEngine() = default; 458bf80f4bSopenharmony_ci virtual void Clone(IEngine* proto) = 0; 468bf80f4bSopenharmony_ci virtual bool LoadEngineLib() = 0; 478bf80f4bSopenharmony_ci virtual bool InitEngine(EGLContext eglContext, const PlatformData& data) = 0; 488bf80f4bSopenharmony_ci virtual void DeInitEngine() = 0; 498bf80f4bSopenharmony_ci virtual void UnloadEngineLib() = 0; 508bf80f4bSopenharmony_ci 518bf80f4bSopenharmony_ci virtual void InitializeScene(uint32_t key) = 0; 528bf80f4bSopenharmony_ci virtual void SetupCameraViewPort(uint32_t width, uint32_t height) = 0; 538bf80f4bSopenharmony_ci virtual void SetupCameraTransform(const OHOS::Render3D::Position& position, const OHOS::Render3D::Vec3& lookAt, 548bf80f4bSopenharmony_ci const OHOS::Render3D::Vec3& up, const OHOS::Render3D::Quaternion& rotation) = 0; 558bf80f4bSopenharmony_ci virtual void SetupCameraViewProjection(float zNear, float zFar, float fovDegrees) = 0; 568bf80f4bSopenharmony_ci 578bf80f4bSopenharmony_ci virtual void LoadSceneModel(const std::string& modelPath) = 0; 588bf80f4bSopenharmony_ci virtual void LoadEnvModel(const std::string& modelPath, BackgroundType type) = 0; 598bf80f4bSopenharmony_ci virtual void UnloadSceneModel() = 0; 608bf80f4bSopenharmony_ci virtual void UnloadEnvModel() = 0; 618bf80f4bSopenharmony_ci 628bf80f4bSopenharmony_ci virtual void OnTouchEvent(const PointerEvent& event) = 0; 638bf80f4bSopenharmony_ci virtual void OnWindowChange(const TextureInfo& textureInfo) = 0; 648bf80f4bSopenharmony_ci 658bf80f4bSopenharmony_ci virtual void DrawFrame() = 0; 668bf80f4bSopenharmony_ci 678bf80f4bSopenharmony_ci virtual void UpdateGeometries(const std::vector<std::shared_ptr<Geometry>>& shapes) = 0; 688bf80f4bSopenharmony_ci virtual void UpdateGLTFAnimations(const std::vector<std::shared_ptr<GLTFAnimation>>& animations) = 0; 698bf80f4bSopenharmony_ci virtual void UpdateLights(const std::vector<std::shared_ptr<OHOS::Render3D::Light>>& lights) = 0; 708bf80f4bSopenharmony_ci virtual void UpdateCustomRender(const std::shared_ptr<CustomRenderDescriptor>& customRender) = 0; 718bf80f4bSopenharmony_ci virtual void UpdateShaderPath(const std::string& shaderPath) = 0; 728bf80f4bSopenharmony_ci virtual void UpdateImageTexturePaths(const std::vector<std::string>& imageTextures) = 0; 738bf80f4bSopenharmony_ci virtual void UpdateShaderInputBuffer( 748bf80f4bSopenharmony_ci const std::shared_ptr<OHOS::Render3D::ShaderInputBuffer>& shaderInputBuffer) = 0; 758bf80f4bSopenharmony_ci 768bf80f4bSopenharmony_ci virtual bool NeedsRepaint() = 0; 778bf80f4bSopenharmony_ci 788bf80f4bSopenharmony_ci#if defined(MULTI_ECS_UPDATE_AT_ONCE) && (MULTI_ECS_UPDATE_AT_ONCE == 1) 798bf80f4bSopenharmony_ci virtual void DeferDraw() = 0 ; 808bf80f4bSopenharmony_ci virtual void DrawMultiEcs(const std::unordered_map<void*, void*>& ecss) = 0; 818bf80f4bSopenharmony_ci#endif 828bf80f4bSopenharmony_ci}; 838bf80f4bSopenharmony_ci} // namespace OHOS::Render3D 848bf80f4bSopenharmony_ci#endif // OHOS_RENDER_3D_I_ENGINE_H 85