1 /*
2  * Copyright (c) 2021-2023 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 WEBGL_VERTEX_ARRAY_OBJECT_H
17 #define WEBGL_VERTEX_ARRAY_OBJECT_H
18 
19 #include "napi/n_exporter.h"
20 #include "webgl_object.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class WebGLVertexArrayObject final : public NExporter, public WebGLObject {
25 public:
26     inline static const std::string className = "WebGLVertexArrayObject";
27     inline static const int objectType = WEBGL_OBJECT_VERTEX_ARRAY;
28     inline static const int DEFAULT_VERTEX_ARRAY_OBJECT = 0;
29 
30     bool Export(napi_env env, napi_value exports) override;
31     std::string GetClassName() override;
32     static napi_value Constructor(napi_env env, napi_callback_info info);
CreateObjectInstance(napi_env env,WebGLVertexArrayObject ** instance)33     static NVal CreateObjectInstance(napi_env env, WebGLVertexArrayObject** instance)
34     {
35         return WebGLObject::CreateObjectInstance<WebGLVertexArrayObject>(env, instance);
36     }
37 
SetVertexArrays(uint32_t vertexArrays)38     void SetVertexArrays(uint32_t vertexArrays)
39     {
40         vertexArrays_ = vertexArrays;
41     }
42 
GetVertexArrays()43     uint32_t GetVertexArrays() const
44     {
45         return vertexArrays_;
46     }
47 
WebGLVertexArrayObject()48     explicit WebGLVertexArrayObject() : vertexArrays_(0) {};
WebGLVertexArrayObject(napi_env env,napi_value exports)49     WebGLVertexArrayObject(napi_env env, napi_value exports) : NExporter(env, exports), vertexArrays_(0) {};
~WebGLVertexArrayObject()50     ~WebGLVertexArrayObject() {};
51 private:
52     uint32_t vertexArrays_;
53 };
54 } // namespace Rosen
55 } // namespace OHOS
56 #endif // WEBGL_VERTEX_ARRAY_OBJECT_H
57