home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
_
/
3deditor
/
!3DEditor
/
Modules
/
RotScale
/
Module
(
.txt
)
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-01-07
|
13KB
|
476 lines
Rotator/Scale Module
0,"To use this module run the !3DEditor application"
rotscale_info
)ModulePurpose$="Rotation and scaling"
#ModuleAuthor$="Simon Wilkinson"
rotscale_closed(win%):=0
rotscale_priority:=25
rotscale_initialise(data%)
PutStr(data%,"rotate1")
!data%=0:data%+=4
PutStr(data%,"scale1")
!data%=0:data%+=4
PutStr(data%,"rotscale1")
!data%=0:data%+=4
b="-type creator -items 3 -windows -variables -menus -toggle -version 2.05 -atleast 2.15 -info"
rotscale_windows(
IndrPos%,task%)
block%
block%=Block%
GRotate_Ybox%=
Window_CreateYbox("rotateybox",IndrPos%,block%,task%)
EScale_Ybox%=
Window_CreateYbox("scaleybox",IndrPos%,block%,task%)
JRotScale_Ybox%=
Window_CreateYbox("rotscleybox",IndrPos%,block%,task%)
rotscale_menus(task%)
Menu_BuildMenu("Mirror","Mirror",12)
Menu_AddSubMenu("Items","Mirror","Mirror",0,MenuNormal%)
GRotScl_0%=
Menu_AddItem("Mirror",task%,1,"X-axis",-1,0,MenuNormal%)
GRotScl_1%=
Menu_AddItem("Mirror",task%,2,"Y-axis",-1,0,MenuNormal%)
GRotScl_2%=
Menu_AddItem("Mirror",task%,3,"Z-axis",-1,0,MenuNormal%)
rotscale_menuwarning
Selected%<>-1
opt%=0
opt%=1
Menu_GreyOut("Mirror",RotScl_0%,opt%)
Menu_GreyOut("Mirror",RotScl_1%,opt%)
Menu_GreyOut("Mirror",RotScl_2%,opt%)
rotscale_variables
rs_x%(3),rs_y%(3),rs_z%(3)
RS_Xstep%=5
RS_Ystep%=5
RS_Zstep%=5
rotscale_toolclick(tool$,num%)
Selected%<>-1
rotscale_toolstart(tool$,num%)
1 ok%=
Selected%<>-1
rs_objectdata
rotate_ybox
Window_NewYbox(Rotate_Ybox%,
8 ok%=
rs_objectdata
scale_ybox
Window_NewYbox(Scale_Ybox%,
= ok%=
rs_rotscalesetup
Window_NewYbox(RotScale_Ybox%,
A ok%=
rotscale_toolrestart(tool$,num%)
rotscale_toolclick(tool$,num%)
rotscale_toolend(tool$,num%)
Window_LooseYbox(Rotate_Ybox%)
Window_LooseYbox(Scale_Ybox%)
rs_rotscaleend
Window_LooseYbox(RotScale_Ybox%)
rotscale_toolpause(tool$,num%)
num%<>3
dum%=
rotscale_toolend(tool$,num%)
=(num%<>3)
rotscale_click(win%,icon%,x%,y%,button%)
ToolNum%=3
rs_click(win%,icon%,x%,y%,button%)
Rotate_Ybox%
\gup%=
Window_ClickYboxNoSnap(win%,icon%,Rotate_X%,Rotate_Y%,Rotate_Z%,RS_Xstep%,RS_Ystep%,RS_Zstep%)
icon%=18
Window_Coord("Enter rotation",Rotate_X%,Rotate_Y%,Rotate_Z%,win%,1)
rotate_update
Scale_Ybox%
baup%=
Window_ClickYboxNoSnap(win%,icon%,Scale_X,Scale_Y,Scale_Z,RS_Xstep%,RS_Ystep%,RS_Zstep%)
icon%=15
Window_Coord("Enter scales",Scale_X,Scale_Y,Scale_Z,win%,2)
scale_update
rotscale_menuselect(name$,num%)
rs_objectdata
Object_UpdatePos(CurrentObj%,Selected%,0,0,0,0,0,0,-Scale_X,Scale_Y,Scale_Z,%001)
Object_UpdatePos(CurrentObj%,Selected%,0,0,0,0,0,0,Scale_X,-Scale_Y,Scale_Z,%001)
Object_UpdatePos(CurrentObj%,Selected%,0,0,0,0,0,0,Scale_X,Scale_Y,-Scale_Z,%001)
Tool_Clear
rotscale_coords(num%,x,y,z)
RS_Xstep%=x
RS_Ystep%=y
RS_Zstep%=z
Icon_UpText(Ybox%,11,"("+
RS_Xstep%+","+
RS_Ystep%+","+
RS_Zstep%+")")
Icon_Redraw(Ybox%,11)
Rotate_X%=x
Rotate_Y%=y
Rotate_Z%=z
rotate_update
Scale_X=x
Scale_Y=y
Scale_Z=z
scale_update
CursorOn%=
!s%=(rs_editing%
2)*2+(num%-3)
rs_x%(s%)=x
rs_y%(s%)=y
rs_z%(s%)=z
rs_update
Display_Cursor(x,y,z)
rotscale_dragged(num%,x%,y%,z%)
0,1,2,3
CursorOn%=
Display_ConvXY(x%,y%)
Display_XYtoXYZ(rs_x%(num%),rs_y%(num%),rs_z%(num%),x%,y%,z%)
0rs_x%(num%)=x%:rs_y%(num%)=y%:rs_z%(num%)=z%
rs_update
Display_Cursor(x%,y%,z%)
CursorOn%=
!rs_x%(3)=rs_x%(3)-rs_x%(2)+x%
!rs_y%(3)=rs_y%(3)-rs_y%(2)+y%
!rs_z%(3)=rs_z%(3)-rs_z%(2)+z%
rs_x%(2)=x%
rs_y%(2)=y%
rs_z%(2)=z%
rs_update
e%=rs_editing%
Display_Cursor(rs_x%(e%),rs_y%(e%),rs_z%(e%))
rotscale_redrawnotify
rs_redraw3D
rs_objectdata
Selected%<>-2
<pos%=
Object_FindItem(CurrentObj%,Selected%)+ObjectItem%
Select_Type%=?pos%
Rotate_X%=pos%!20
Rotate_Y%=pos%!16
Rotate_Z%=pos%!24
Scale_X=pos%!28/1000
Scale_Y=pos%!32/1000
Scale_Z=pos%!36/1000
'Rotate_X%=0:Rotate_Y%=0:Rotate_Z%=0
!Scale_X=1:Scale_Y=1:Scale_Z=1
rotate_ybox
pos%,type$
Icon_UpText(Rotate_Ybox%,11,"("+
RS_Xstep%+","+
RS_Ystep%+","+
RS_Zstep%+")")
Icon_Redraw(Rotate_Ybox%,11)
Icon_UpText(Rotate_Ybox%,16,"Rotating "+
Object_NameItem(Select_Type%))
Icon_UpText(Rotate_Ybox%,18,"("+
Rotate_X%+"
Rotate_Y%+"
Rotate_Z%+"
Icon_Redraw(Rotate_Ybox%,14)
scale_ybox
pos%,type$
Icon_UpText(Scale_Ybox%,11,"("+
RS_Xstep%+","+
RS_Ystep%+","+
RS_Zstep%+")")
Icon_Redraw(Scale_Ybox%,11)
Icon_UpText(Scale_Ybox%,16,"Scaling "+
Object_NameItem(Select_Type%))
Icon_UpText(Scale_Ybox%,15,"("+
scl_txt(Scale_X)+","++
scl_txt(Scale_Y)+","+
scl_txt(Scale_Z)+")")
Icon_Redraw(Scale_Ybox%,14)
rotate_update
Rotate_X%>=360
Rotate_X%-=360
Rotate_Y%>=360
Rotate_Y%-=360
Rotate_Z%>=360
Rotate_Z%-=360
Rotate_X%<0
Rotate_X%+=360
Rotate_Y%<0
Rotate_Y%+=360
Rotate_Z%<0
Rotate_Z%+=360
Object_UpdatePos(CurrentObj%,Selected%,0,0,0,Rotate_Y%,Rotate_X%,Rotate_Z%,0,0,0,%010)
Selected%=-2
'Rotate_X%=0:Rotate_Y%=0:Rotate_Z%=0
Icon_UpText(Rotate_Ybox%,18,"("+
Rotate_X%+"
Rotate_Y%+"
Rotate_Z%+"
Icon_Redraw(Rotate_Ybox%,18)
scale_update
Object_UpdatePos(CurrentObj%,Selected%,0,0,0,0,0,0,Scale_X,Scale_Y,Scale_Z,%001)
Selected%=-2
!Scale_X=1:Scale_Y=1:Scale_Z=1
Icon_UpText(Scale_Ybox%,15,"("+
scl_txt(Scale_X)+","+
scl_txt(Scale_Y)+","+
scl_txt(Scale_Z)+")")
Icon_Redraw(Scale_Ybox%,15)
rs_rotscalesetup
rs_editing%=0
rs_orig%=Selected%
$rs_x%(0)=0:rs_y%(0)=0:rs_z%(0)=0
&rs_x%(1)=0:rs_y%(1)=100:rs_z%(1)=0
Display_PointTrans(CurrentObj%,rs_orig%,rs_x%(0),rs_y%(0),rs_z%(0))
Display_PointTrans(CurrentObj%,rs_orig%,rs_x%(1),rs_y%(1),rs_z%(1))
Ars_x%(2)=rs_x%(0)+100:rs_y%(2)=rs_y%(0)+100:rs_z%(2)=rs_z%(0)
Ars_x%(3)=rs_x%(1)+100:rs_y%(3)=rs_y%(1)+100:rs_z%(3)=rs_z%(1)
jrs_new%=
Object_CloneItem(CurrentObj%,Selected%,rs_x%(2)-rs_x%(0),rs_y%(2)-rs_y%(0),rs_z%(2)-rs_z%(0))
ItemGreyed%=rs_orig%
Selected%=-1
Display_RedrawAll
Display_Cursor(rs_x%(0),rs_y%(0),rs_z%(0))
Notify3DRedraw%=CurrentTask%
rs_redraw3D
rs_ybox
rs_rotscaleend
ItemGreyed%=-1
Display_LoseCursor
Object_DeleteItem(CurrentObj%,rs_orig%)
Selected%=rs_new%-1
Notify3DRedraw%=-1
Display_RedrawAll
rs_redraw3D
Selected%=Items%
Display_Start3DAdding
(rs_editing%
Display_Colour3D(11)
Display_Colour3D(8)
Display_Move3D(rs_x%(0),rs_y%(0),rs_z%(0))
Display_Draw3D(rs_x%(1),rs_y%(1),rs_z%(1))
(rs_editing%
Display_Colour3D(11)
Display_Colour3D(8)
Display_Move3D(rs_x%(2),rs_y%(2),rs_z%(2))
Display_Draw3D(rs_x%(3),rs_y%(3),rs_z%(3))
Display_End3DAdding
rs_ybox
add%=(rs_editing%
Icon_UpText(RotScale_Ybox%,20,"("+
rs_x%(add%)+","+
rs_y%(add%)+","+
rs_z%(add%)+")")
Icon_UpText(RotScale_Ybox%,21,"("+
rs_x%(add%+1)+","+
rs_y%(add%+1)+","+
rs_z%(add%+1)+")")
Icon_UpText(RotScale_Ybox%,11,"("+
RS_Xstep%+","+
RS_Ystep%+","+
RS_Zstep%+")")
add%=0
Icon_UpState(RotScale_Ybox%,15,1)
Icon_UpState(RotScale_Ybox%,16,0)
Icon_UpState(RotScale_Ybox%,15,0)
Icon_UpState(RotScale_Ybox%,16,1)
add%=(rs_editing%
add%=0
Icon_UpState(RotScale_Ybox%,22,1)
Icon_UpState(RotScale_Ybox%,23,0)
Icon_UpState(RotScale_Ybox%,22,0)
Icon_UpState(RotScale_Ybox%,23,1)
rs_click(win%,icon%,x%,y%,but%)
z%,l%,o%,e%
CurrentMain%
button%
RSClicked%=
ox%=x%:oy%=y%
Display_ConvXY(x%,y%)
--x1%=rs_x%(l%):y1%=rs_y%(l%):z1%=rs_z%(l%)
Display_XYZtoXY(x1%,y1%,z1%)
(x1%-x%)<8
(y1%-y%)<8
rs_editing%=l%
RSClicked%=
RSClicked%
52RSClicked%=
Display_ClickedOn(ox%,oy%,rs_new%)
RSClicked%
RSClicked%=4:rs_editing%=2
93RSClicked%=
Display_ClickedOn(ox%,oy%,rs_orig%)
RSClicked%
RSClicked%=
:rs_editing%=0
Display_MoveCursor(rs_x%(rs_editing%),rs_y%(rs_editing%),rs_z%(rs_editing%))
rs_ybox
%100*16
RSClicked%
RSClicked%
Drag_StartLines
o%=(rs_editing%
e%=rs_editing%
x1%=rs_x%(e%+1)
y1%=rs_y%(e%+1)
z1%=rs_z%(e%+1)
x1%=rs_x%(e%-1)
y1%=rs_y%(e%-1)
z1%=rs_z%(e%-1)
Display_XYZtoXY(x1%,y1%,z1%)
Drag_Move(x1%,y1%)
Drag_Draw(&FFFF,&FFFF)
Drag_Node2(&FFFF,&FFFF)
Drag_Node(&FFFF,&FFFF)
T*x%=rs_x%(e%):y%=rs_y%(e%):z%=rs_z%(e%)
Display_XYZtoXY(x%,y%,z%)
Display_Screen(x%,y%)
Drag_ReadyNew(x%,y%,e%,
Drag_Item(rs_new%,RotScale_Ybox%,4,rs_x%(2),rs_y%(2),rs_z%(2))
RotScale_Ybox%
Window_ClickYboxNoSnap(win%,icon%,rs_x%(rs_editing%),rs_y%(rs_editing%),rs_z%(rs_editing%),RS_Xstep%,RS_Ystep%,RS_Zstep%)
CursorOn%=
rs_update
Display_Cursor(rs_x%(rs_editing%),rs_y%(rs_editing%),rs_z%(rs_editing%))
icon%
rs_editing%>1
rs_editing%-=2
Display_MoveCursor(rs_x%(rs_editing%),rs_y%(rs_editing%),rs_z%(rs_editing%))
rs_editing%<2
rs_editing%+=2
Display_MoveCursor(rs_x%(rs_editing%),rs_y%(rs_editing%),rs_z%(rs_editing%))