18bf80f4bSopenharmony_ci/*
28bf80f4bSopenharmony_ci * Copyright (C) 2024 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_ENVIRONMENTJS_H
178bf80f4bSopenharmony_ci#define OHOS_RENDER_3D_ENVIRONMENTJS_H
188bf80f4bSopenharmony_ci#include "BaseObjectJS.h"
198bf80f4bSopenharmony_ci#include "SceneResourceImpl.h"
208bf80f4bSopenharmony_ci#include "Vec4Proxy.h"
218bf80f4bSopenharmony_ciclass EnvironmentJS : public BaseObject<EnvironmentJS>, SceneResourceImpl {
228bf80f4bSopenharmony_cipublic:
238bf80f4bSopenharmony_ci    static constexpr uint32_t ID = 90;
248bf80f4bSopenharmony_ci    static void Init(napi_env env, napi_value exports);
258bf80f4bSopenharmony_ci
268bf80f4bSopenharmony_ci    EnvironmentJS(napi_env, napi_callback_info);
278bf80f4bSopenharmony_ci    ~EnvironmentJS() override;
288bf80f4bSopenharmony_ci    void* GetInstanceImpl(uint32_t id) override;
298bf80f4bSopenharmony_ci
308bf80f4bSopenharmony_ciprivate:
318bf80f4bSopenharmony_ci    napi_value Dispose(NapiApi::FunctionContext<>& ctx);
328bf80f4bSopenharmony_ci    void DisposeNative() override;
338bf80f4bSopenharmony_ci    void Finalize(napi_env env) override;
348bf80f4bSopenharmony_ci    // JS properties
358bf80f4bSopenharmony_ci    enum EnvironmentBackgroundType {
368bf80f4bSopenharmony_ci        /**
378bf80f4bSopenharmony_ci         * The background is none.
388bf80f4bSopenharmony_ci         *
398bf80f4bSopenharmony_ci         * @syscap SystemCapability.ArkUi.Graphics3D
408bf80f4bSopenharmony_ci         * @since 12
418bf80f4bSopenharmony_ci         */
428bf80f4bSopenharmony_ci        BACKGROUND_NONE = 0,
438bf80f4bSopenharmony_ci
448bf80f4bSopenharmony_ci        /**
458bf80f4bSopenharmony_ci         * The background is image.
468bf80f4bSopenharmony_ci         *
478bf80f4bSopenharmony_ci         * @syscap SystemCapability.ArkUi.Graphics3D
488bf80f4bSopenharmony_ci         * @since 12
498bf80f4bSopenharmony_ci         */
508bf80f4bSopenharmony_ci        BACKGROUND_IMAGE = 1,
518bf80f4bSopenharmony_ci
528bf80f4bSopenharmony_ci        /**
538bf80f4bSopenharmony_ci         * The background is cubmap.
548bf80f4bSopenharmony_ci         *
558bf80f4bSopenharmony_ci         * @syscap SystemCapability.ArkUi.Graphics3D
568bf80f4bSopenharmony_ci         * @since 12
578bf80f4bSopenharmony_ci         */
588bf80f4bSopenharmony_ci        BACKGROUND_CUBEMAP = 2,
598bf80f4bSopenharmony_ci
608bf80f4bSopenharmony_ci        /**
618bf80f4bSopenharmony_ci         * The background is equirectangular.
628bf80f4bSopenharmony_ci         *
638bf80f4bSopenharmony_ci         * @syscap SystemCapability.ArkUi.Graphics3D
648bf80f4bSopenharmony_ci         * @since 12
658bf80f4bSopenharmony_ci         */
668bf80f4bSopenharmony_ci        BACKGROUND_EQUIRECTANGULAR = 3,
678bf80f4bSopenharmony_ci    };
688bf80f4bSopenharmony_ci
698bf80f4bSopenharmony_ci    napi_value GetBackgroundType(NapiApi::FunctionContext<>& ctx);
708bf80f4bSopenharmony_ci    void SetBackgroundType(NapiApi::FunctionContext<uint32_t>& ctx);
718bf80f4bSopenharmony_ci    napi_value GetEnvironmentImage(NapiApi::FunctionContext<>& ctx);
728bf80f4bSopenharmony_ci    void SetEnvironmentImage(NapiApi::FunctionContext<NapiApi::Object>& ctx);
738bf80f4bSopenharmony_ci    napi_value GetRadianceImage(NapiApi::FunctionContext<>& ctx);
748bf80f4bSopenharmony_ci    void SetRadianceImage(NapiApi::FunctionContext<NapiApi::Object>& ctx);
758bf80f4bSopenharmony_ci    napi_value GetIrradianceCoefficients(NapiApi::FunctionContext<>& ctx);
768bf80f4bSopenharmony_ci    void SetIrradianceCoefficients(NapiApi::FunctionContext<NapiApi::Array>& ctx);
778bf80f4bSopenharmony_ci
788bf80f4bSopenharmony_ci    napi_value GetIndirectDiffuseFactor(NapiApi::FunctionContext<>& ctx);
798bf80f4bSopenharmony_ci    void SetIndirectDiffuseFactor(NapiApi::FunctionContext<NapiApi::Object>& ctx);
808bf80f4bSopenharmony_ci
818bf80f4bSopenharmony_ci    napi_value GetIndirectSpecularFactor(NapiApi::FunctionContext<>& ctx);
828bf80f4bSopenharmony_ci    void SetIndirectSpecularFactor(NapiApi::FunctionContext<NapiApi::Object>& ctx);
838bf80f4bSopenharmony_ci
848bf80f4bSopenharmony_ci    napi_value GetEnvironmentMapFactor(NapiApi::FunctionContext<>& ctx);
858bf80f4bSopenharmony_ci    void SetEnvironmentMapFactor(NapiApi::FunctionContext<NapiApi::Object>& ctx);
868bf80f4bSopenharmony_ci    BASE_NS::unique_ptr<Vec4Proxy> diffuseFactor_;
878bf80f4bSopenharmony_ci    BASE_NS::unique_ptr<Vec4Proxy> specularFactor_;
888bf80f4bSopenharmony_ci    BASE_NS::unique_ptr<Vec4Proxy> environmentFactor_;
898bf80f4bSopenharmony_ci
908bf80f4bSopenharmony_ci    // weak reference to the owning scene.
918bf80f4bSopenharmony_ci};
928bf80f4bSopenharmony_ci#endif // OHOS_RENDER_3D_ENVIRONMENTJS_H