扩展:3DAlloy
3DAlloy 发布状态: 稳定版 |
|
---|---|
![]() |
|
实现 | 解析器函数 , 标签 , ContentHandler , 链接标记 |
描述 | Adds support of 3D files viewing at your MediaWiki |
作者 | Dolfinus |
最新版本 | 1.0 (2017-02-05) |
MediaWiki | 1.25+ |
数据庫更改 | 否 |
许可协议 | MIT授權條款 |
下载 | README |
例子 | Example of 3D Viewer at file page |
$wg3DAlloy |
|
<3d> |
|
描述
MediaWiki extension which allows to add 3D models viewer to site pages. Based on THREE.js, renders image with CanvasRenderer. There you can see example 3D model page.
支援的檔案扩展
THREE.js模型格式:
- .json
- .3djson
- .3dj * .three
THREE.js model buffer geometry format:
- .buff
- .buffjson
OBJ文件格式:
- .obj
STL (binary) file format:
- .stl
- .stlb
安装
Download the latest snapshot and extract it to your extensions directory. Then include it in your LocalSettings.php file as in the following example:
wfLoadExtension( '3DAlloy' );
$wgFileExtensions = array_merge(
$wgFileExtensions, array(
'json', '3dj', '3djson', 'three',
'buff', 'buffjson',
'obj',
'stl', 'stlb'
)
);
Then add these lines to the end of your MediaWiki includes/mime.types file:
application/json json 3djson 3dj three buff buffjson application/obj obj application/stl stl stlb
And then to includes/mime.info file:
application/json [TEXT] application/obj [TEXT] application/stl [TEXT]
用法
As Image Handler
[[File:Model.json|300x300px|color=,opacity=,...]]
As Parser function
{{#3d:Model.json}} {{#3d:Model.json|width}} {{#3d:Model.json|width|height}} ... {{#3d:Model.json|width|height|color|opacity|norotate|scale|z|style|class}}
Instead of uploaded filename you can use an url for file located in external site.
As Parser tag
<3d file="Model.json" width="" height="" ... ></3d> or <3d width="" height="" ... >Model.json</3d>
You also can use url instead of short filename.
Parameters
名称 | 描述 | Default value |
---|---|---|
width | Canvas width in pixels | 300 |
height | Canvas height in pixels | 300 |
color | Model RGB color as hex | 0xff00ff |
opacity | Model opacity as decimal between 0...1 | 0.8 |
norotate | If true or 1, model does not rotate | false |
scale | Model scale, in percent | 100 |
z | Model z coordinate | 75 |
style | Additional canvas CSS style | |
class | Additional canvas HTML class |
Width and height can be set to 0 value, so size of viewer will be set according to user screen dimensions.
配置
All default values can be changed in your LocalSettings.php file:
$wg3DAlloy["width"] = 500;
$wg3DAlloy["height"] = 400;
...
$wg3DAlloy["class"] = 'someclass';
Controls and hotkeys
操作 | 控制 |
---|---|
Camera rotate | Swipe, left mouse key hold and move |
Camera pan | Right key hold and move |
Camera zoom | Mouse wheel, hold wheel and move, pinch |
Model rotate | ←↑→↓键 |
Model rotation reset | Home键 |
Model rotation play/pause | 双击、双点按 |
Model rotation play/pause all models at page | 回车、空格键 |
Model rotation speed | -和+键 |
Hotkeys automatically disables while you edit or submit wiki page.
- Stable extensions/zh
- Parser function extensions/zh
- Tag extensions/zh
- ContentHandler extensions/zh
- Link markup extensions/zh
- MIT licensed extensions/zh
- Extensions in GitHub version control/zh
- ParserMakeImageParams extensions/zh
- ParserFirstCallInit extensions/zh
- ImageBeforeProduceHTML extensions/zh
- ImageOpenShowImageInlineBefore extensions/zh
- BeforePageDisplay extensions/zh
- BeforePageDisplayMobile extensions/zh
- All extensions/zh
- 3D extensions/zh