Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 3d elements, plugin #5597

Merged
merged 14 commits into from Mar 29, 2024
Merged

feat: add 3d elements, plugin #5597

merged 14 commits into from Mar 29, 2024

Conversation

Aarebecca
Copy link
Contributor

Mar-26-2024 20-02-03
image
image

  • 添加 3D 元素:球体、立方体、圆柱体、圆锥体、平面、圆环、胶囊
  • 添加 3D 插件:光照

  • Added 3D elements: Sphere, Cube, Cylinder, Cone, Plane, Torus, Capsule
  • Added 3D plugin: Light

用法 / Usage

import { Graph, register } from '@antv/g6';
import { Light, Line3D, Sphere, renderer } from '@antv/g6-extension-3d';

// 注册光照插件 / Register light plugin
register('plugin', '3d-light', Light);
// 注册球体元素 / Register sphere element
register('node', 'sphere', Sphere);
// 注册边元素 / Register edge element
register('edge', 'line3d', Line3D);

const graph = new Graph({
  data: ...,
  renderer, // 使用 3D 渲染器 / Use 3D renderer
  node: {
    style: { type: 'spere' }
  },
  edge: {
    style: { type: 'line3d' }
  },
  plugins: [
    // 配置光照 / Config light
    {
      type: '3d-light'
      // 配置平行光 / Config directional light
      directional: {
        direction: [0, 0, 1],
      },
    }
  ]
});

graph.render()

@hustcc
Copy link
Member

hustcc commented Mar 29, 2024

  • 依赖项写具体版本号,不依赖 pnpm 发布前的动作
  • 一些依赖改成 pure dept
  • 默认的 tsconfig 是 build,其他为 test dev

@hustcc hustcc merged commit da5297c into v5 Mar 29, 2024
5 checks passed
@hustcc hustcc deleted the feat/3d branch March 29, 2024 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants