+ | mode : uint |
指示器模式,分为Global模式和Local模式
|
+ | rotationGridSize : number |
旋转格子尺寸
|
+ | scalingGridSize : number |
缩放格子尺寸
|
+ | state : int |
显示和操作状态,可以为下列枚举值:0移动目标位置,1旋转目标,2缩放目标。
|
+ | transform : _Matrix3D |
绑定的transform。
|
+ | translationGridSize : number |
平移格子尺寸
|
+ | Global : uint |
指示器世界模式,以世界坐标系为基准
|
+ | Local : uint |
指示器自身模式,以模型自身坐标系为基准
|
+ | Rotation : uint |
指示器旋转状态
|
+ | Scale : uint |
指示器缩放状态
|
+ | Translation : uint |
指示器平移状态
|
+ | function draw(x : int, y : int) |
绘制自己。
|
+ | function onChange(change : function) |
_Indicator发生改变时的回调。
|
+ | function operEnd() |
接收鼠标抬起的消息。 示例
|
+ | function operMove(x : int, y : int) |
用于接收鼠标移动的消息。
|
+ | function operStart(x : int, y : int) |
用于接收鼠标按下的消息。
|
_sys:addPath('res')curMesh = _Mesh.new("earth.msh");mat = _Matrix3D.new();indicator = _Indicator.new();indicator.transform = mat;font = _Font.new('Arial', 10)font.textColor = _Color.Yellow_app:onKeyDown(function(key) if key == _System.Key1 then indicator.state = 0 elseif key == _System.Key2 then indicator.state = 1 elseif key == _System.Key3 then indicator.state = 2 endend)function render( e ) font:drawText(0, 0, 'Press 1 to adjust by move') font:drawText(0, 14, 'Press 2 to adjust by revolve') font:drawText(0, 28, 'Press 3 to adjust by zoom') _rd:push3DMatrix(mat); curMesh:drawMesh( ); _rd:pop3DMatrix(); indicator:draw();end_app:onIdle( render );function mouseDown(button , x , y ) indicator:operStart( x , y );end_app:onMouseDown( mouseDown )--operMove must write in onMouseMovefunction mouseMove( x , y ) indicator:operMove( x , y );end_app:onMouseMove( mouseMove )--operEnd must write in onMouseUpfunction mouseUp( x , y ) indicator:operEnd( x , y );end_app:onMouseUp( mouseUp )