1 Star 4 Fork 1

阿伟 / vue-3d-model

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

vue-3d-model

Version Build License 996.icu

vue.js 3D model viewer component, based on threejs, inspired by model-tag

一个展示三维模型的Vue组件,支持模型操作和模型点击事件,能自动缩放模型到合适大小并校正偏移,支持多种格式的模型。

Example

DEMO

Install

using npm

npm install vue-3d-model --save

Or using script tag for global use

<script src="https://unpkg.com/vue-3d-model/dist/vue-3d-model.umd.js"></script>

Or Download vue-3d-model.js and include it in your html

Usage

<template>
  <model-obj src="example/models/obj/LeePerrySmith.obj"></model-obj>
</template>
<script>
import { ModelObj } from 'vue-3d-model';
export default {
  components: { ModelObj }
}
</script>

Or

<!DOCTYPE html>
<html>
<head>
 <meta charset="UTF-8"></head>
<body>
  <div id="app">
    <model-obj src="example/models/obj/LeePerrySmith.obj"></model-obj>
  </div>
<script src="vue.js"></script>
<script src="vue-3d-model.js"></script>
<script>
  new Vue({ el: '#app' });
</script>
</body>

Documents

props

prop type default example
src string - './exapmle.obj'
width number - 300
height number - 300
position object { x: 0, y: 0, z: 0 } { x: 100, y: 20, z: -10 }
rotation object { x: 0, y: 0, z: 0 } { x: Math.PI / 2, y: 0, z: - Math.PI / 4 }
cameraPosition object { x: 0, y: 0, z: 0 } { x: 1, y: 2, z: -3 }
cameraRotation object { x: 0, y: 0, z: 0 } { x: 3, y: 2, z: -1 }
scale object { x: 1, y: 1, z: 1 } { x: 2, y: 2, z: 3 }
lights array -
backgroundColor number/string 0xffffff 0xffffff/'#f00'/'rgb(255,255,255)'
backgroundAlpha number 1 0.5
controlsOptions object - see OrbitControls Properties
crossOrigin string anonymous anonymous/use-credentials
gammaOutput boolean false true/false
glOptions object { antialias: true, alpha: true } see WebGLRenderer Parameters

events

event
on-mousedown
on-mousemove
on-mouseup
on-click
on-load
on-progress
on-error

Model Format Support

model format component tag
obj <model-obj>
json <model-three>
stl <model-stl>
dae <model-collada>
ply <model-ply>
gltf(2.0) <model-gltf>

Browser Support

Modern browsers and IE 11.

You can click on this for more information.

TODO List

  • Support for more model formats
  • Animation
  • Post-processing

LICENSE

MIT

The MIT License (MIT) Copyright (c) 2017-present, Jiulong Hu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/happinessllw/vue-3d-model.git
git@gitee.com:happinessllw/vue-3d-model.git
happinessllw
vue-3d-model
vue-3d-model
master

搜索帮助