@three-campus/core
v0.1.0
Published
基于Three.js的3D园区渲染核心库
Downloads
58
Readme
@three-campus/core
基于Three.js的3D园区渲染核心库
安装
pnpm add @three-campus/core three使用
import { CampusRenderer } from '@three-campus/core';
import * as THREE from 'three';
const container = document.getElementById('canvas-container');
const renderer = new CampusRenderer({
container: container!,
});
// 获取场景管理器
const scene = renderer.getScene();
// 添加一些对象
const box = new THREE.Mesh(
new THREE.BoxGeometry(1, 1, 1),
new THREE.MeshStandardMaterial({ color: 0x00ff00 })
);
scene.add(box);
// 添加光照
scene.addAmbientLight(0xffffff, 0.5);
scene.addDirectionalLight(0xffffff, 1, { x: 5, y: 10, z: 5 });
// 开始渲染
renderer.start();开发
pnpm install
pnpm run dev # 监听模式构建
pnpm run build # 生产构建