Skip to content

如何创建圆角矩形平面? #98

Discussion options

You must be logged in to vote

引擎没有内置,但是你可以参考一些构建顶点的方法来构建 圆角矩形圆形 或者 椭圆形

下方代码通过顶点生成算法(借鉴了 pixi ),并将数据填充到 ModelMesh 通过 MeshRenderer 渲染显示

import {
  Buffer,
  BufferBindFlag,
  Camera,
  Entity,
  MeshRenderer,
  MeshTopology,
  ModelMesh,
  RenderFace,
  Script,
  SubMesh,
  UnlitMaterial,
  VertexAttribute,
  VertexBufferBinding,
  VertexElement,
  VertexElementFormat,
  WebGLEngine,
} from "@galacean/engine";

// Create engine
WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
  engine.canvas.resizeByClientSize();

  const root: Entity | null = engine.sceneManager.scenes[0].createRootEntity();
  const cameraEntity = root.createChild("camera");
  cameraEntity.transform.setPosition(0, 0, 600);
  const ca…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cptbtptpbcptdtptp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Engine
Labels
None yet
3 participants