Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

733 B
Raw Blame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
#pragma once

#include "../RenderTypePlugin.hpp"

namespace esengine {

class Shader;

class ShapePlugin : public RenderTypePlugin {
public:
    void init(RenderFrameContext& ctx) override;
    void shutdown() override;

    void collect(RenderCollectContext& ctx) override;
    const char* collectScope() const override { return "render.collect.shape"; }

private:
    struct ShapeVertex {
        f32 px, py;
        f32 ux, uy;
        f32 cr, cg, cb, ca;
        f32 shapeType, halfW, halfH, cornerRadius;
    };

    resource::ShaderHandle shape_shader_handle_;
    u32 shape_shader_id_ = 0;
};

}  // namespace esengine