Include# - DOLOOP
MEAT:
do
GetFrameTimes()
oldmouseongui=mouseongui
oldmcli=mcli
McLi =MOUSECLICK()
MX =MOUSEX()
my =MOUSEY()
mMX =MOUSEMOVEX()
mMy =MOUSEMOVEY()
mMz =MOUSEMOVEZ()
shftKEY=shiftkey()
cntrl=controlkey()
alt=keystate(56)
mouseongui=MOG()
IF MCLI=0 THEN cirkmode=0
spacePUSH=keystate(57)
text sprite x(60080)+48,sprite y(60080)+75,str$(transpmode)
if keystate(63)=1 then saveUVmap()
if keystate(64)=1 then loadUVmap("temp.UVdata")
if direct=1
if shftKEY=1 then TimeOfDay#=TimeOfDay#+0.0005+mmz*0.01
if TimeOfDay#>24 then TimeOfDay#=0
if TimeOfDay#<0 then TimeOfDay#=23.9
TimeOfDay_SetTime(TimeOfDay#)
endif
if inkey$()="/"
rotateBrush()
endif
if inkey$()="."
FlipHBrush()
endif
if inkey$()=","
FlipVBrush()
endif
if keystate(62)=1 then refilter()
if keystate(36)=1
position camera 0,0,0,0
rotate camera 0,0,0,0
position object look_PointObj,0,0,0
rotate object look_PointObj,0,0,0
OLDCDIST#=0.0
look_selobjX#=0
look_selobjy#=0
look_selobjz#=0
look_newCamDist#=0
look_dist#=0
look_speed#=0
look_uskor#=0
look_dx#=0
look_dy#=0
look_dz#=0
endif
if OLDCDIST#<1000
d3d_line3d -50,0,-50,-50,0,50,rgb(50,250,250,250),1
d3d_line3d -50,0,-50,50,0,-50,rgb(50,0,250,250),1
d3d_line3d 50,0,50,-50,0,50,rgb(50,250,0,250),1
d3d_line3d 50,0,50,50,0,-50,rgb(50,250,250,0),1
d3d_line3d -50,100,-50,-50,100,50,rgb(50,250,250,250),1
d3d_line3d -50,100,-50,50,100,-50,rgb(50,0,250,250),1
d3d_line3d 50,100,50,-50,100,50,rgb(50,250,0,250),1
d3d_line3d 50,100,50,50,100,-50,rgb(50,250,250,0),1
d3d_line3d -50,0,-50,-50,100,-50,rgb(50,250,250,250),1
d3d_line3d -50,0,50,-50,100,50,rgb(50,0,250,250),1
d3d_line3d 50,0,-50,50,100,-50,rgb(50,250,0,250),1
d3d_line3d 50,0,50,50,100,50,rgb(50,250,250,0),1
endif
d3d_line 0,0,sw-1,0
d3d_line 0,0,0,sh-1
d3d_line sw-1,0,sw-1,sh-1
d3d_line 0,sh-1,sw-1,sh-1
if inkey$()="o" or inkey$()="p"
if inkey$()="o" then lightangle=lightangle-(0.1*Elapsed)
if inkey$()="p" then lightangle=lightangle+(0.1*Elapsed)
position object lightorient,0,0,0
yrotate object lightorient,lightangle
move object lightorient,100
endif
PointLight_Set_Position(pl1,object position x(lightorient),100,object position z(lightorient))
PointLight_Set_Position(pl2,CAMERA position x(),CAMERA position y(),CAMERA position z())
GETEVENT
EVT = EVENTTYPE()
sou = EVENTSOURCE()
datF = eventData()
dat = EVENTDATAEX()
undmou = GADGETUNDERMOUSE()
if evt=LEFTBUTTONDOUBLECLICK
if sou=listView
item=selectedListViewItem(listView)
BrushName=cats(item)
load image BrushDIR+BrushName+"DIFFUSE.DDS",origBrushDiffIMGnum
load image BrushDIR+BrushName+"NORMAL.DDS",origBrushNormalIMGnum
load image BrushDIR+BrushName+"ALPHA.DDS",origBrushAlphaIMGnum
load image BrushDIR+BrushName+"ICO.bmp",STAMPsprite
sprite STAMPsprite,214,sh-42,STAMPsprite
IK copy image EditBrushDiffIMGnum , origBrushDiffIMGnum
IK copy image EditBrushNormalIMGnum , origBrushNormalIMGnum
IK copy image EditBrushAlphaIMGnum , origBrushAlphaIMGnum
IK resize image EditBrushDiffIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK resize image EditBrushNormalIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK resize image EditBrushAlphaIMGnum,BRUSHSIZE,BRUSHSIZE,0
setGadgetVisible UI_lib,0
sleep 300:mcli=0
endif
endif
IF UVMODE=0
sprite 60050,SW-32,0,60050
IF SPRITE EXIST(60061)=1 THEN DELETE SPRITE 60061
IF SPRITE EXIST(60062)=1 THEN DELETE SPRITE 60062
IF SPRITE EXIST(60063)=1 THEN DELETE SPRITE 60063
IF SPRITE EXIST(60064)=1 THEN DELETE SPRITE 60064
IF SPRITE EXIST(60065)=1 THEN DELETE SPRITE 60065
IF SPRITE EXIST(60066)=1 THEN DELETE SPRITE 60066
IF SPRITE EXIST(60070)=1 THEN DELETE SPRITE 60070
IF SPRITE EXIST(60071)=1 THEN DELETE SPRITE 60071
IF SPRITE EXIST(60072)=1 THEN DELETE SPRITE 60072
ELSE
SPRITE 60070,SW-98,0,60070
SPRITE 60071,SW-66,34,60071
SPRITE 60072,SW-66,68,60072
if mx>SW-66 and mx<SW-66+32 and my>34 and my<66
if mcli=1 then fliphorizontal():tmmp()
endif
if mx>SW-66 and mx<SW-66+32 and my>68 and my<100
if mcli=1 then flipvertical():tmmp()
endif
if mx>SW-98 and mx<SW-98+64 and my>0 and my<32
if mcli=1
AutoUVMapping(1,0,0,TECimagesize,TECimagesize,TXscaX,TXscaY,TXPOSX,TXPOSY)
tmmp()
endif
endif
ink rgb(255,255,255)
if mcli=1
if pick object(MX,MY,UVOBJECT,UVOBJECT+1)>0
dis=get pick distance()
pick screen MX,MY,dis
TX#=((get pick vector x()+camera position x()))*(TECimagesize/200.0)
TY#=(200-(get pick vector y()+camera position Y() ) )*(TECimagesize/200.0)
for fc=1 to tri
Ax0#=tris(fc).u1*TECimagesize
Ax1#=tris(fc).u2*TECimagesize
Ax2#=tris(fc).u3*TECimagesize
Ay0#=tris(fc).v1*TECimagesize
Ay1#=tris(fc).v2*TECimagesize
Ay2#=tris(fc).v3*TECimagesize
Az0#=100
Az1#=100
Az2#=100
w# = onplane( Ax0#,Ay0#,Az0# ,Ax1#,Ay1#,Az1# ,Ax2#,Ay2#,Az2# ,TX#,TY#,100 )
if abs(w#)<= tolerance#
dde=PinTRI()
if dde>0 and shftKEY=0 and cntrl=1 and alt=0
SELECTelementUV=tris(fc).elementTRI
SELECTelementPLUS(SELECTelementUV)
goto extseltrimouse
endif
if dde>0 and shftKEY=0 and cntrl=0 and alt=1
IF tris(fc).SEL=0
tris(fc).SEL=1
tmmpexitTriangle(fc)
ELSE
tris(fc).SEL=0
tmmpexitTriangleZERO(fc)
endif
setbatch()
BatchADDcompound()
endif
endif
next fc
endif
endif
extseltrimouse:
if PTmode2=0
if pick object(MX,MY,UVOBJECT,UVOBJECT+1)>0
dis=get pick distance()
pick screen MX,MY,dis
TX#=((get pick vector x()+camera position x()))*(TECimagesize/200.0)
TY#=(200-(get pick vector y()+camera position Y() ) )*(TECimagesize/200.0)
TEXT MX+50,MY+50,STR$(TX#)
TEXT MX+50,MY+70,STR$(TY#)
if startlelect=1 and spacePUSH=1 and mouseongui=0
selXsc2=TX#:selYsc2=TY#:startlelect=0
triselect(selXsc1/TECimagesize,selysc1/TECimagesize,selXsc2/TECimagesize,selYsc2/TECimagesize):sleep 500
spacePUSH=0
tmmp()
ENDIF
if startlelect=0 and spacePUSH=1 and mouseongui=0
selXsc1=TX#:selYsc1=TY#:startlelect=1:sleep 500
spacePUSH=0
ENDIF
if keystate(1)=1 then startlelect=0
if startlelect=1
d3d_line3D selXsc1/(TECimagesize/200.0),200-selYsc1/(TECimagesize/200.0),100,TX#/(TECimagesize/200.0),200-selYsc1/(TECimagesize/200.0),100,RGB(255,255,255,255),0
d3d_line3D TX#/(TECimagesize/200.0),200-selYsc1/(TECimagesize/200.0),100,TX#/(TECimagesize/200.0),200-TY#/(TECimagesize/200.0),100,RGB(255,255,255,255),0
d3d_line3D selXsc1/(TECimagesize/200.0),200-selYsc1/(TECimagesize/200.0),100,selXsc1/(TECimagesize/200.0),200-TY#/(TECimagesize/200.0),100,RGB(255,255,255,255),0
d3d_line3D selXsc1/(TECimagesize/200.0),200-TY#/(TECimagesize/200.0),100,TX#/(TECimagesize/200.0),200-TY#/(TECimagesize/200.0),100,RGB(255,255,255,255),0
endif
ENDIF
endif
sprite 60050,SW-32,0,60051
IF UVmMM=1
sprite 60061,SW-32,34,60061
else
sprite 60061,SW-32,34,60062
endif
IF UVmMr=1
sprite 60063,SW-32,68,60063
else
sprite 60063,SW-32,68,60064
endif
IF UVmMs=1
sprite 60065,SW-32,102,60065
else
sprite 60065,SW-32,102,60066
endif
IF UVmMM=1 and mouseongui=0
if mcli=1 and movmap=0 then movmap=1
if mcli=0 and oldmcli=1 and movmap=2
updateUVmodify()
tmmp()
endif
if mcli=0 then movmap=0
if movmap>0 then posUVdata()
endif
IF UVmMR=1 and mouseongui=0
if mcli=1 and rotmap=0 then rotmap=1
if mcli=0 and oldmcli=1 and rotmap=2
updateUVmodify()
tmmp()
endif
if mcli=0 then rotmap=0
if rotmap>0 then rotUVdata()
endif
IF UVmMS=1 and mouseongui=0
if mcli=1 and scamap=0 then scamap=1
if mcli=0 and oldmcli=1 and scamap=2
updateUVmodify()
tmmp()
endif
if mcli=0 then scamap=0
if scamap>0 then scaUVdata()
endif
endif
if PTmode=M_color
sprite 60007,sprite x(60777),sprite y(60777)+4,60007
sprite 60016,sw-350,sh-120,60016
RGBASNH()
else
if sprite exist(60016)=1 then delete sprite 60016
if sprite exist(60200)=1 then delete sprite 60200
if sprite exist(60201)=1 then delete sprite 60201
if sprite exist(60202)=1 then delete sprite 60202
if sprite exist(60203)=1 then delete sprite 60203
if sprite exist(60204)=1 then delete sprite 60204
if sprite exist(60035)=1 then delete sprite 60035
if sprite exist(60036)=1 then delete sprite 60036
if sprite exist(60037)=1 then delete sprite 60037
if sprite exist(60038)=1 then delete sprite 60038
if sprite exist(60039)=1 then delete sprite 60039
if sprite exist(60040)=1 then delete sprite 60040
if sprite exist(60041)=1 then delete sprite 60041
endif
if PTmode=M_image
sprite 60007,sprite x(60777)+41,sprite y(60777)+4,60007
else
if sprite exist(60800)=1 then delete sprite 60800
endif
if PTmode=M_BURN
sprite 60007,sprite x(60777)+125,sprite y(60777)+4,60007
endif
if PTmode=M_FLY
sprite 60007,sprite x(60777)+167,sprite y(60777)+4,60007
endif
if PTmode=M_STAMP
sprite 60007,sprite x(60777)+209,sprite y(60777)+4,60007
endif
MODE_TEXT:
if PTmode=M_TEXT
sprite 60007,sprite x(60777)+294,sprite y(60777)+4,60007
endif
if PTmode=M_PLimg
sprite 60007,sprite x(60777)+336,sprite y(60777)+4,60007
endif
sprite 60001,sprite x(60777)+5,sprite y(60777)+10,60001
sprite 60002,sprite x(60777)+46,sprite y(60777)+10,60002
sprite 60003,sprite x(60777)+88,sprite y(60777)+10,60003
sprite 62000,sprite x(60777)+130,sprite y(60777)+10,62000
sprite 62001,sprite x(60777)+172,sprite y(60777)+10,62001
sprite STAMPsprite,sprite x(60777)+214,sprite y(60777)+10,STAMPsprite
sprite 62002,sprite x(60777)+257,sprite y(60777)+10,62002
sprite 64000,sprite x(60777)+299,sprite y(60777)+10,64000
sprite 64030,sprite x(60777)+340,sprite y(60777)+10,64030
if POmode=M_sel
sprite 60008,sprite x(66201)+6,sprite y(66201)+94,60008
endif
if POmode=M_desel
sprite 60008,sprite x(66201)+6,sprite y(66201)+50,60008
endif
if POmode=M_all
sprite 60008,sprite x(66201)+6,sprite y(66201)+8,60008
endif
sprite 60500,sprite x(60000)+5,sprite y(60000)+3,60500
set sprite priority 60500,1
if editD=1
SPRITE 60020,sprite x(62300)+10,sprite y(62300),60020
else
SPRITE 60020,sprite x(62300)+10,sprite y(62300),60030
endif
if editN=1
SPRITE 60021,sprite x(62300)+10,sprite y(62300)+35,60021
else
SPRITE 60021,sprite x(62300)+10,sprite y(62300)+35,60031
endif
if editS=1
SPRITE 60022,sprite x(62300)+10,sprite y(62300)+70,60022
else
SPRITE 60022,sprite x(62300)+10,sprite y(62300)+70,60032
endif
// if editH=1
// SPRITE 60023,sprite x(62300)+10,sprite y(62300)+105,60023
// else
// SPRITE 60023,sprite x(62300)+10,sprite y(62300)+105,60033
// endif
if editA=1
SPRITE 60024,sprite x(62300)+10,sprite y(62300)+105,60024
else
SPRITE 60024,sprite x(62300)+10,sprite y(62300)+105,60034
endif
sprite 60180,sprite x(62300)+3,sprite y(62300)+145,60180
if inkey$()="q" then hide object 2:exclude object on 2
if inkey$()="Q" then show object 2:exclude object off 2
D3D_ROUNDED_BOX sprite x(60777)+5, sprite y(60777)-20 , sprite x(60777)+115 , sprite y(60777)-3 , 3 , 1,rgb(255,150,150,10)
D3D_ROUNDED_BOX sprite x(60777)+5, sprite y(60777)-20 , sprite x(60777)+115 , sprite y(60777)-3 , 3 , 0
sprite 60075,intensiveBRUSH+sprite x(60777)+5,sprite y(60777)-20,60017
D3D_ROUNDED_BOX sprite x(60777)+75, sprite y(60777)-38 , sprite x(60777)+115 , sprite y(60777)-22 , 3 , 1 ,rgb(255,150,150,10)
D3D_ROUNDED_BOX sprite x(60777)+75, sprite y(60777)-38 , sprite x(60777)+115 , sprite y(60777)-22 , 3 , 0 ,rgb(255,250,250,250)
text sprite x(60777)+79, sprite y(60777)-37 , str$(intensiveBRUSH)
text sprite x(60777)+10, sprite y(60777)-18 , "intensive"
if mx>sprite x(60777)+5 and mx<sprite x(60777)+115 and my>sprite y(60777)-20 and my<sprite y(60777)-2
if mouseongui=9531 or mouseongui=987987456
mouseongui=9531
if mmz>0 then intensiveBRUSH=intensiveBRUSH+1
if mmz<0 then intensiveBRUSH=intensiveBRUSH-1
if mcli=1 and mmx<>0
if mmx>0 then intensiveBRUSH=intensiveBRUSH+1
if mmx<0 then intensiveBRUSH=intensiveBRUSH-1
if intensiveBRUSH>100 then intensiveBRUSH=100
if intensiveBRUSH<1 then intensiveBRUSH=1
position mouse sprite x(60075)+5,sprite y(60075)+9
endif
endif
endif
D3D_ROUNDED_BOX sprite x(60777)+120, sprite y(60777)-20 , sprite x(60777)+233 , sprite y(60777)-3 , 3 , 1 ,rgb(255,150,150,10)
D3D_ROUNDED_BOX sprite x(60777)+120, sprite y(60777)-20 , sprite x(60777)+233 , sprite y(60777)-3 , 3 , 0 ,rgb(255,250,250,250)
sprite 60175,(BRUSHsize/(512/100))+sprite x(60777)+121,sprite y(60777)-20,60017
D3D_ROUNDED_BOX sprite x(60777)+120, sprite y(60777)-38 , sprite x(60777)+160 , sprite y(60777)-22 , 3 , 1 ,rgb(255,150,150,10)
D3D_ROUNDED_BOX sprite x(60777)+120, sprite y(60777)-38 , sprite x(60777)+160 , sprite y(60777)-22 , 3 , 0 ,rgb(255,250,250,250)
text sprite x(60777)+124, sprite y(60777)-37 , str$(BRUSHsize)
text sprite x(60777)+125, sprite y(60777)-18 , "brush size"
if mx>sprite x(60777)+120 and mx<sprite x(60777)+233 and my>sprite y(60777)-20 and my<sprite y(60777)-2
if mouseongui=9531 or mouseongui=987987456
mouseongui=9531
if mmz>0
BRUSHsize=BRUSHsize+1
if BRUSHsize>512 then BRUSHsize=512
position mouse sprite x(60175)+5,sprite y(60175)+9
circMAXnum=BRUSHsize/2
set current bitmap -30
cls rgb(0,0,0,0)
D3D_CIRCLE (sh/TECimagesize)*xxx,(sh/TECimagesize)*yyy, (sh/TECimagesize)*(brushsize/2.0) , 0,rgb(rgba(paintcolor),rgbr(paintcolor),rgbg(paintcolor),rgbb(paintcolor))
IF PTmode=M_STAMP
ik copy image EditBrushDiffIMGnum+1020,EditBrushDiffIMGnum
ik resize image EditBrushDiffIMGnum+1020,(sh/TECimagesize)*((brushsize)),(sh/TECimagesize)*((brushsize)),0
paste image EditBrushDiffIMGnum+1020,((sh/TECimagesize)*xxx)-(sh/TECimagesize)*((brushsize)/2.0),((sh/TECimagesize)*yyy)-(sh/TECimagesize)*((brushsize)/2.0),1
endif
set current bitmap 0
texture object 2,0,30
if PTmode=M_STAMP
delete image EditBrushDiffIMGnum
delete image EditBrushNormalIMGnum
delete image EditBrushAlphaIMGnum
IK copy image EditBrushDiffIMGnum , origBrushDiffIMGnum
IK copy image EditBrushNormalIMGnum , origBrushNormalIMGnum
IK copy image EditBrushAlphaIMGnum , origBrushAlphaIMGnum
IK resize image EditBrushDiffIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK resize image EditBrushNormalIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK resize image EditBrushAlphaIMGnum,BRUSHSIZE,BRUSHSIZE,0
endif
endif
if mmz<0
BRUSHsize=BRUSHsize-1
if BRUSHsize<1 then BRUSHsize=1
position mouse sprite x(60175)+5,sprite y(60175)+9
circMAXnum=BRUSHsize/2
` Acirc
set current bitmap -30
cls rgb(0,0,0,0)
`FcircleCOLOR(xxx,yyy)
D3D_CIRCLE (sh/TECimagesize)*xxx,(sh/TECimagesize)*yyy, (sh/TECimagesize)*(brushsize/2.0) , 0,RGB(RGBA(paintcolor),RGBR(paintcolor),RGBG(paintcolor),RGBB(paintcolor))
`if cirkmode=1 then cirk(xxx,yyy)
IF PTmode=M_STAMP
ik copy image EditBrushDiffIMGnum+1020,EditBrushDiffIMGnum
ik resize image EditBrushDiffIMGnum+1020,(sh/TECimagesize)*((brushsize)),(sh/TECimagesize)*((brushsize)),0
paste image EditBrushDiffIMGnum+1020,((sh/TECimagesize)*xxx)-(sh/TECimagesize)*((brushsize)/2.0),((sh/TECimagesize)*yyy)-(sh/TECimagesize)*((brushsize)/2.0),1
endif
set current bitmap 0
texture object 2,0,30
if PTmode=M_STAMP
delete image EditBrushDiffIMGnum
delete image EditBrushNormalIMGnum
delete image EditBrushAlphaIMGnum
IK copy image EditBrushDiffIMGnum , origBrushDiffIMGnum
IK copy image EditBrushNormalIMGnum , origBrushNormalIMGnum
IK copy image EditBrushAlphaIMGnum , origBrushAlphaIMGnum
IK resize image EditBrushDiffIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK RESIZE IMAGE EditBrushNormalIMGnum,brushsize,brushsize,0
IK resize image EditBrushAlphaIMGnum,BRUSHSIZE,BRUSHSIZE,0
endif
endif
if mcli=1 and mmx<>0
if mmx>0 then BRUSHsize=BRUSHsize+5
if mmx<0 then BRUSHsize=BRUSHsize-5
if BRUSHsize>512 then BRUSHsize=512
if BRUSHsize<1 then BRUSHsize=1
circMAXnum=BRUSHsize/2
position mouse sprite x(60175)+5,sprite y(60175)+9
` Acirc
set current bitmap -30
cls rgb(0,0,0,0)
`FcircleCOLOR(xxx,yyy)
D3D_CIRCLE (sh/TECimagesize)*xxx,(sh/TECimagesize)*yyy, (sh/TECimagesize)*(brushsize/2.0) , 0,rgb(rgba(paintcolor),rgbr(paintcolor),rgbg(paintcolor),rgbb(paintcolor))
`if cirkmode=1 then cirk(xxx,yyy)
IF PTmode=M_STAMP
ik copy image EditBrushDiffIMGnum+1020,EditBrushDiffIMGnum
ik resize image EditBrushDiffIMGnum+1020,(sh/TECimagesize)*((brushsize)),(sh/TECimagesize)*((brushsize)),0
paste image EditBrushDiffIMGnum+1020,((sh/TECimagesize)*xxx)-(sh/TECimagesize)*((brushsize)/2.0),((sh/TECimagesize)*yyy)-(sh/TECimagesize)*((brushsize)/2.0),1
endif
set current bitmap 0
texture object 2,0,30
if PTmode=M_STAMP
delete image EditBrushDiffIMGnum
delete image EditBrushNormalIMGnum
delete image EditBrushAlphaIMGnum
IK copy image EditBrushDiffIMGnum , origBrushDiffIMGnum
IK copy image EditBrushNormalIMGnum , origBrushNormalIMGnum
IK copy image EditBrushAlphaIMGnum , origBrushAlphaIMGnum
IK resize image EditBrushDiffIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK resize image EditBrushNormalIMGnum,BRUSHSIZE,BRUSHSIZE,0
IK resize image EditBrushAlphaIMGnum,BRUSHSIZE,BRUSHSIZE,0
endif
endif
endif
endif
`text 200,200,str$(OLDCDIST#)
if OLDCDIST#<1000
distAAA# = abs(Sqrt((object position x(1)-OBJECT POSITION X(look_PointObj))^2)+((object position y(1)-OBJECT POSITION y(look_PointObj))^2)+((object position z(1)-OBJECT POSITION z(look_PointObj))^2))
distBBB# = abs(Sqrt((object position x(UVobject)-OBJECT POSITION X(look_PointObj))^2)+((object position y(UVobject)-OBJECT POSITION y(look_PointObj))^2)+((object position z(UVobject)-OBJECT POSITION z(look_PointObj))^2))
if distAAA#<distBBB#
D3D_BATCH_DRAW_LINE3D 0, 1, 0
D3D_BATCH_DRAW_DOT3D 0, 1, 0
else
D3D_BATCH_DRAW_LINE3D 0, 0, 0
D3D_BATCH_DRAW_DOT3D 0, 0, 0
endif
endif
dis=0
if pick object(mx,my,1,1)>0
dis=get pick distance()
xp=get pick vector x():yp=get pick vector y():zp=get pick vector z()
endif
pick screen mx,my,dis
dx=get pick vector x()+camera position x():dy=get pick vector y()+camera position y():dz=get pick vector z()+camera position z()
intriangle=0
if dis>0 and mouseongui=0 and UVMODE=0
for jjj=1 to tri
w# = onplane( tris(jjj).xa1,tris(jjj).ya1,tris(jjj).za1,tris(jjj).xa2,tris(jjj).ya2,tris(jjj).za2, tris(jjj).xa3,tris(jjj).ya3,tris(jjj).za3,(dx-move),dy,(dz-move) )
if abs(w#)<= tolerance#
dde=PinTRI()
`print "------- OK"
if dde>0 then intriangle=jjj:goto ext
`if dde=2 then end:exit
endif
next jjj
goto ext2
ext:
if mcli<>4
d3d_line3d (tris(intriangle).xa1) ,(tris(intriangle).ya1),(tris(intriangle).za1) ,(tris(intriangle).xa2) ,(tris(intriangle).ya2),(tris(intriangle).za2) ,rgb(150,150,150),0
d3d_line3d (tris(intriangle).xa2) ,(tris(intriangle).ya2),(tris(intriangle).za2) ,(tris(intriangle).xa3) ,(tris(intriangle).ya3),(tris(intriangle).za3) ,rgb(150,150,150),0
d3d_line3d (tris(intriangle).xa3) ,(tris(intriangle).ya3),(tris(intriangle).za3) ,(tris(intriangle).xa1) ,(tris(intriangle).ya1),(tris(intriangle).za1) ,rgb(150,150,150),0
endif
set vector3 11, tris(intriangle).xa1, tris(intriangle).ya1, tris(intriangle).za1
set vector3 12, tris(intriangle).xa2, tris(intriangle).ya2, tris(intriangle).za2
set vector3 13, tris(intriangle).xa3, tris(intriangle).ya3, tris(intriangle).za3
subtract vector3 15, 12, 11
subtract vector3 16, 13, 11
cross product vector3 14,15,16
normalize vector3 14,14
UAm#=(tris(intriangle).u1)
UBm#=(tris(intriangle).u2)
UCm#=(tris(intriangle).u3)
VAm#=(tris(intriangle).v1)
VBm#=(tris(intriangle).v2)
VCm#=(tris(intriangle).v3)
UPt# = (UAm# + u# * (UBm#-UAm#) + v# * (UCm#-UAm#))*TECimagesize
LFt# = (VAm# + u# * (VBm#-VAm#) + v# * (VCm#-VAm#))*TECimagesize
xxx=upt#
yyy=lft#
XPX =XXX
YPY =YYY
` Acirc1
if PTMode2<>M_Line
set current bitmap -30
cls rgb(0,0,0,0)
D3D_CIRCLE (sh/TECimagesize)*xxx,(sh/TECimagesize)*yyy, (sh/TECimagesize)*(brushsize/2.0) , 0,rgb(rgba(paintcolor),rgbr(paintcolor),rgbg(paintcolor),rgbb(paintcolor))
if PTmode=M_STAMP
ik copy image EditBrushDiffIMGnum+1020,EditBrushDiffIMGnum
ik resize image EditBrushDiffIMGnum+1020,(sh/TECimagesize)*((brushsize)),(sh/TECimagesize)*((brushsize)),0
paste image EditBrushDiffIMGnum+1020,((sh/TECimagesize)*xxx)-(sh/TECimagesize)*((brushsize)/2.0),((sh/TECimagesize)*yyy)-(sh/TECimagesize)*((brushsize)/2.0),1
endif
set current bitmap 0
texture object 2,0,30
position object 5,(tris(intriangle).xa1) ,(tris(intriangle).ya1),(tris(intriangle).za1)
if mcli=1
if PTmode=M_STAMP
if POmode=M_all
brushSTAMP(xxx,yyy)
endif
if POmode=M_sel
if tris(intriangle).SEL=1
brushSTAMPYES(xxx,yyy)
endif
endif
if POmode=M_desel
if tris(intriangle).SEL=0
brushSTAMPNO(xxx,yyy)
endif
endif
endif
if PTmode=M_BURN
if POmode=M_all
brushBURN(xxx,yyy)
endif
if POmode=M_sel
if tris(intriangle).SEL=1
brushBURNYES(xxx,yyy)
endif
endif
if POmode=M_desel
if tris(intriangle).SEL=0
brushBURNNO(xxx,yyy)
endif
endif
endif
if PTmode=M_fly
if POmode=M_all
brushFLY(xxx,yyy)
endif
if POmode=M_sel
if tris(intriangle).SEL=1
brushFLYYES(xxx,yyy)
endif
endif
if POmode=M_desel
if tris(intriangle).SEL=0
brushFLYNO(xxx,yyy)
endif
endif
endif
if PTmode=M_image
if POmode=M_all
brushimage(xxx,yyy)
endif
if POmode=M_sel
if tris(intriangle).SEL=1
brushimageYES(xxx,yyy)
endif
endif
if POmode=M_desel
if tris(intriangle).SEL=0
brushimageNO(xxx,yyy)
endif
endif
endif
if PTmode=M_color
if POmode=M_all
brushcolor( xxx,yyy )
endif
if POmode=M_sel
if tris(intriangle).SEL=1
brushcolorYES( xxx,yyy )
endif
endif
if POmode=M_desel
if tris(intriangle).SEL=0
brushcolorNO( xxx,yyy )
endif
endif
endif
endif
if mouseongui=0
if keystate(57)=1 and PTmode2<>M_element and PTmode<>M_PLimg
tris(intriangle).SEL=1
setbatch()
BatchADDcompound()
tmmpexitTriangle(intriangle)
endif
if shftKEY=1
tris(intriangle).SEL=0
setbatch()
BatchADDcompound()
tmmpexitTriangleZERO(intriangle)
endif
endif
endif
endif
ext2:
if PTmode2=M_Line
sprite 60025,252,sprite y(60777)+4,60007
TX#=XPX
TY#=YPY
TEXT MX+50,MY+50,STR$(TX#)
TEXT MX+50,MY+70,STR$(TY#)
if startlelect=1 and mcli=1 and mouseongui=0 and oldmcli=0
selXsc2=TX#:selYsc2=TY#:startlelect=0 :sleep 500
LineDraw(selXsc1,selysc1,selXsc2,selYsc2)
mcli=0
set current bitmap -30
cls rgb(0,0,0,0)
set current bitmap 0
texture object 2,0,30
ENDIF
if startlelect=0 and mcli=1 and mouseongui=0 and oldmcli=0
selXsc1=TX#:selYsc1=TY#:startlelect=1:sleep 500
mcli=0
ENDIF
if keystate(1)=1 then startlelect=0
if startlelect=1
set current bitmap -30
cls rgb(0,0,0,0)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*TX#,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
set current bitmap 0
texture object 2,0,30
endif
else
if sprite exist(60025)=1 AND PTmode2=0 then delete sprite 60025
endif
if PTmode=M_PLimg
PTmode2=0
TX#=XPX
TY#=YPY
TEXT MX+50,MY+50,STR$(TX#)
TEXT MX+50,MY+70,STR$(TY#)
if startlelect=1 and spacePUSH=1 and mouseongui=0
selXsc2=TX#:selYsc2=TY#:startlelect=0
if selXsc1>selXsc2
At1#=selXsc1
selXsc1=selXsc2
selXsc2 =At1#
endif
if selysc1>selYsc2
At2#=selysc1
selYsc1=selysc2
selysc2 =At2#
endif
PLACEIMAGE(selXsc1,selysc1,selXsc2,selYsc2):sleep 500
spacePUSH=0
ENDIF
if startlelect=0 and spacePUSH=1 and mouseongui=0
selXsc1=TX#:selYsc1=TY#:startlelect=1:sleep 500
spacePUSH=0
ENDIF
if keystate(1)=1 then startlelect=0
if startlelect=1
set current bitmap -30
cls rgb(0,0,0,0)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*TX#,(sh/TECimagesize)*selYsc1,RGB(255,255,100,100),RGB(255,100,255,100)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*selXsc1,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
d3d_line (sh/TECimagesize)*TX#,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*TX#,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*TY#,(sh/TECimagesize)*TX#,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
set current bitmap 0
texture object 2,0,30
endif
endif
if PTmode2=M_element
sprite 60025,83,sprite y(60777)+4,60007
TX#=XPX
TY#=YPY
TEXT MX+50,MY+50,STR$(TX#)
TEXT MX+50,MY+70,STR$(TY#)
if startlelect=1 and spacePUSH=1 and mouseongui=0
selXsc2=TX#:selYsc2=TY#:startlelect=0
if selXsc1>selXsc2
At1#=selXsc1
selXsc1=selXsc2
selXsc2 =At1#
endif
if selysc1>selYsc2
At2#=selysc1
selYsc1=selysc2
selysc2 =At2#
endif
fillselect(selXsc1,selysc1,selXsc2,selYsc2):sleep 500
spacePUSH=0
ENDIF
if startlelect=0 and spacePUSH=1 and mouseongui=0
selXsc1=TX#:selYsc1=TY#:startlelect=1:sleep 500
spacePUSH=0
ENDIF
if keystate(1)=1 then startlelect=0
if startlelect=1
set current bitmap -30
cls rgb(0,0,0,0)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*TX#,(sh/TECimagesize)*selYsc1,RGB(255,255,100,100),RGB(255,100,255,100)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*selXsc1,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
d3d_line (sh/TECimagesize)*TX#,(sh/TECimagesize)*selYsc1,(sh/TECimagesize)*TX#,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
d3d_line (sh/TECimagesize)*selXsc1,(sh/TECimagesize)*TY#,(sh/TECimagesize)*TX#,(sh/TECimagesize)*TY#,RGB(255,255,100,100),RGB(255,100,255,100)
set current bitmap 0
texture object 2,0,30
endif
else
if sprite exist(60025)=1 AND PTmode2=0 then delete sprite 60025
endif
center text sw/2+200,0, "FPS- "+str$(screen fps())
center text sw/2+200,20, "object triangles- "+str$(tri)
center text sw/2+200,40, "vc count- "+str$(vc)
center text sw/2+200,60, "ic count- "+str$(ic)
IF UVMODE=0
if inkey$()="1" then matimg=1: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
if inkey$()="2" then matimg=2: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
if inkey$()="3" then matimg=3: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
if inkey$()="4" then matimg=4: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
if inkey$()="5" then matimg=5: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
if inkey$()="6" then matimg=6: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
if inkey$()="7" then matimg=7: scIMTL( matimg ):sprite 60009,86+((matimg-1)*60),0,60009
set sprite priority 60009,10100
endif
if keystate(28)=1 or keystate(156)=1
coltri=0
tectri=0
dim temptri(tri) as integer
for h=1 to tri
if tris(H).SEL=1 then inc coltri : temptri(coltri)=h
next h
////// ik create image SelectTRIimage,TECimagesize,TECimagesize
////// av as vect : bv as vect : cv as vect : pv as vect
////// altrtec=0
////// for f=1 to coltri
////// inc altrtec
////// ll=4096
////// up=4096
////// rr=0
////// dd=0
////// if (tris(temptri(f)).u1*TECimagesize)<=ll then ll=tris(temptri(f)).u1*TECimagesize
////// if (tris(temptri(f)).u2*TECimagesize)<=ll then ll=tris(temptri(f)).u2*TECimagesize
////// if (tris(temptri(f)).u3*TECimagesize)<=ll then ll=tris(temptri(f)).u3*TECimagesize
////// if (tris(temptri(f)).u1*TECimagesize)>=rr then rr=tris(temptri(f)).u1*TECimagesize
////// if (tris(temptri(f)).u2*TECimagesize)>=rr then rr=tris(temptri(f)).u2*TECimagesize
////// if (tris(temptri(f)).u3*TECimagesize)>=rr then rr=tris(temptri(f)).u3*TECimagesize
////// if (tris(temptri(f)).v1*TECimagesize)<=up then up=tris(temptri(f)).v1*TECimagesize
////// if (tris(temptri(f)).v2*TECimagesize)<=up then up=tris(temptri(f)).v2*TECimagesize
////// if (tris(temptri(f)).v3*TECimagesize)<=up then up=tris(temptri(f)).v3*TECimagesize
////// if (tris(temptri(f)).v1*TECimagesize)>=dd then dd=tris(temptri(f)).v1*TECimagesize
////// if (tris(temptri(f)).v2*TECimagesize)>=dd then dd=tris(temptri(f)).v2*TECimagesize
////// if (tris(temptri(f)).v3*TECimagesize)>=dd then dd=tris(temptri(f)).v3*TECimagesize
////// for XXX=ll-2 to rr+2
////// for YYY= up-2 to dd+2
////// pv.x=xxx : pv.y=yyy
////// av.x=tris(temptri(f)).u1*TECimagesize : av.y=tris(temptri(f)).v1*TECimagesize
////// bv.x=tris(temptri(f)).u2*TECimagesize : bv.y=tris(temptri(f)).v2*TECimagesize
////// cv.x=tris(temptri(f)).u3*TECimagesize : cv.y=tris(temptri(f)).v3*TECimagesize
////// if PointInTRI(pv ,av ,bv ,cv )
////// image dot SelectTRIimage, XXX,YYY , rgb(255,255,255,255)
////// endif
////// next YYY
////// next XXX
////// if altrtec=coltri/16
////// altrtec=0
////// set object effect UVobject,16
////// texture object UVobject ,0,SelectTRIimage
////// McLi =MOUSECLICK()
////// MX =MOUSEX()
////// my =MOUSEY()
////// inc tectri
////// D3D_ROUNDED_BOX sw/2-105 ,sh/2-55 ,sw/2+105 ,sh/2+55 , 1,0
////// D3D_PROGRESS_BAR sw/2-100, sh/2-50, 200, 100, 1, coltri, tectri, matimg
////// D3D_ROUNDED_BOX sw/2-50 ,(sh/2)-20+100 ,sw/2+50 ,(sh/2)+20+100 , 3,1
////// ink rgb(255,0,0)
////// center text sw/2 ,(sh/2)+90 ,"STOP filling"
////// if mcli=1
////// if mx>sw/2-50 and mx<sw/2+50 and my>(sh/2)-20+100 and my<(sh/2)+20+100 then f=coltri
////// mcli=1
////// ENDIF
////// sync
////// endif
//////
////// next f
ik copy image 8000,SelectTRIimage
if BRUSHsize>10
ik blur image SelectTRIimage,25
else
ik blur image SelectTRIimage,BRUSHsize-1
endif
altrtec=0
for yyy=1 to TECimagesize
inc altrtec
for xxx=1 to TECimagesize
if image point (SelectTRIimage, XXX,YYY )<> rgb(0,0,0,0)
if PTmode=M_image
pdot( XXX,YYY,matimg,ShotImg,intensiveBRUSH )
endif
if PTmode=M_color
pcol( XXX,YYY,intensiveBRUSH )
endif
endif
next xxx
if altrtec=TECimagesize/10
altrtec=0
set object effect UVobject,16
texture object UVobject ,0,ShotImg
inc tectri
D3D_ROUNDED_BOX sw/2-105 ,sh/2-55 ,sw/2+105 ,sh/2+55 , 1,0
D3D_PROGRESS_BAR sw/2-100, sh/2-50, 200, 100, 1, TECimagesize, yyy, matimg
D3D_ROUNDED_BOX sw/2-50 ,(sh/2)-20+100 ,sw/2+50 ,(sh/2)+20+100 , 3,1
ink rgb(255,0,0)
center text sw/2 ,(sh/2)+90 ,"STOP RENDER"
sync
endif
McLi =MOUSECLICK()
MX =MOUSEX()
my =MOUSEY()
if mcli=1
if mx>sw/2-50 and mx<sw/2+50 and my>(sh/2)-20+100 and my<(sh/2)+20+100 then yyy=TECimagesize
ENDIF
next yyy
set dir glavcat
undim temptri()
ik copy image SelectTRIimage,8000
ik resize image ShotImg,TECimagesize,TECimagesize,0
ik resize image normalmap,TECimagesize,TECimagesize,0
if useheightmap=1 then ik resize image heightmap,TECimagesize,TECimagesize,0
texture object 1,0,ShotImg
texture object 1,1,normalmap
if useheightmap=1 then texture object 1,2,heightmap
setbatch()
BatchADDcompound()
ink rgb(255,255,255)
endif
if mouseongui=0 then gosub look
if AdvancedLightingEnabled=1
if POSTEFF=1
`Control motion blur
if Bloom=1 or DOF=1
fpsg#=screen fps()
set effect constant float FrameTarget(FrameTarget).Effect,"PixelBlur",fpsg#/100
endif
endif
`Set wireframe
if keystate(59)=1 then execute file glavcat+"\help\Page-1.html","",""
if keystate(60)=1 then Global_Set_Wireframe(1):backdrop on FrameCamera:color backdrop FrameCamera,0
if keystate(61)=1 then Global_Set_Wireframe(0):backdrop off FrameCamera
hide object 2:exclude object on 2
AdvancedLighting_Update()
show object 2:exclude object off 2
endif
if keystate(68)=1 then AdvancedLightingEnabled=1-AdvancedLightingEnabled:sleep 300
BT()
mult()
sync
loop
.....already beside.....