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 RENDER_MESH_H 17 #define RENDER_MESH_H 18 19 #include "base/render_base.h" 20 #include "graphic/render_context.h" 21 #include "graphic/render_general_program.h" 22 #include "image_effect_marco_define.h" 23 24 namespace OHOS { 25 namespace Media { 26 namespace Effect { 27 constexpr int RENDERMESH_VERTEX_SIZE = 3; 28 constexpr int RENDERMESH_TEXCOORD_SIZE = 2; 29 constexpr int RENDERMESH_ONE_VEC_SIZE = 5; 30 constexpr int RENDERMESH_BUFFER_SIZE = 2; 31 class RenderMesh { 32 public: 33 IMAGE_EFFECT_EXPORT explicit RenderMesh(const std::vector<std::vector<float>> &meshData); 34 IMAGE_EFFECT_EXPORT ~RenderMesh(); 35 IMAGE_EFFECT_EXPORT void Bind(RenderGeneralProgram *shader); 36 37 GLuint *vboIds_ = nullptr; 38 GLuint vaoId_ = 0; 39 GLenum primitiveType_ = GL_TRIANGLE_STRIP; 40 GLint startVertex_ = 0; 41 GLsizei vertexNum_ = 4; 42 std::vector<std::vector<float>> meshData_; 43 }; 44 } // namespace Effect 45 } // namespace Media 46 } // namespace OHOS 47 #endif