okay so here is what i've decided to do
1) Make the base texture / load the base texture and scale it to my liking
2) Make a memblock (not make mem. from image) and set all color and alpha to zero. this is the alpha map for the next image. Convert to image
3) Make / load third image for 2nd stage on object.
4) Scale the third image in memblock commands, not texture commands.
5) draw to the alpha map and report its values to the third image.
this way the first image can be scaled, the alpha image can be reset for new textures and the other textures can be scaled as well. I am having trouble with the blending... can anyone take a look
global Dist# as float
Global Object as integer
Global PX# as float
Global PY# as float
Global PZ# as float
global alpha=100
global amem=40
for a=0 to 256
for b=0 to 256
dot a,b,RGB(rnd(255), Rnd(255), Rnd(255))
NEXT
NEXT
GET IMAGE 1, 0,0,256,256
MAKE MEMBLOCK FROM IMAGE 1, 1
MAKE MEMBLOCK amem, 256*256*4+12
WRITE MEMBLOCK DWORD amem, 0, 256
WRITE MEMBLOCK DWORD amem, 4, 256
WRITE MEMBLOCK DWORD amem, 8, 32
for X=0 to 256
Memlocation=(256*y+x)*4+12
WRITE MEMBLOCK BYTE amem, memlocation+0, 0
WRITE MEMBLOCK BYTE amem, memlocation+1, 0
WRITE MEMBLOCK BYTE amem, memlocation+2, 0
WRITE MEMBLOCK BYTE amem, memlocation+3, 0
next X
MAKE IMAGE FROM MEMBLOCK Alpha, amem
cls 0
SYNC ON : SYNC RATE 0
Size=Get memblock size(1)
sync
cls 0
text 10,10, "The memblock's size is : "+Str$(Size)
text 10, 25, "Press any key to check"
sync
WAIT KEY
For Check = 12 to size-12 step 4
PixelX=((check-8)/4)/IMAGE WIDTH(1)
PixelY=((check-8)/4)/IMAGE Height(1)
NEXT
sync
MAKE OBJECT PLAIN 1, 1000, 1000
ROTATE OBJECT 1, 90, 180, 180
COLOR BACKDROP 0
TEXTURE OBJECT 1, 0, 1
AUTOCAM OFF
SET CAMERA RANGE 0.001, 1000
position camera 500, 300, 0
POINT CAMERA 0,0,0
SET BLEND MAPPING ON 1,0, alpha, 0, 2
TEXTURE OBJECT 1, 1, alpha
do
sync
Color=Rnd(255)
DivX#=(Object Size X(1)/IMAGE WIDTH(1))
DivY#=(Object Size Z(1)/IMAGE HEIGHT(1))
if mouseclick()=1
Obj=location()
if Obj>0
X=Convert3dto2dX(1,1, -PX#)
Y=Convert3dto2dZ(1,1, PZ#)
Size#=10.0+Brush(1.0)
Paint(amem, alpha, 1, 255, X, Y, Size#,1)
endif
sync
endif
If Obj>0
Handle$=Report3D()
HandleB$=Report2D(1, 1, int(U#), int(V#))
Text mouseX(), mouseY(), Handle$
Text mouseX(), mouseY()+10, HandleB$
TEXT mouseX(), MouseY()+20, "UV locations are: U= "+Str$((U#))+ ", V= "+Str$((V#))
endif
LOOP
end
function location()
Dist#=Get pick Distance()
Object=Pick object(MouseX(), MouseY(), 1, 1)
PX#=Get pick Vector X()+Camera Position X()
PY#=Get pick Vector Y()+Camera Position Y()
PZ#=Get pick Vector Z()+Camera Position Z()
ENDFUNCTION Object
Function Report3D()
Answer$="The current position in 3D - X= "+Str$(int(PX#))+", Y= "+Str$(int(PY#))+", Z= "+Str$(int(PZ#))
ENDFUNCTION Answer$
Function Report2D(ImgNum, ObjNum, U, V)
ScaleX#=Get2DscaleX(ImgNum, ObjNum)
ScaleY#=Get2DscaleY(ImgNum, ObjNum)
Answer$="The current position in 2D - X= "+Str$((int(PX#/ScaleX#)+IMAGE WIDTH(imgnum)/2))+", Y= "+Str$((int(PZ#/ScaleY#)+IMAGE HEIGHT(imgnum)/2))
ENDFUNCTION Answer$
function Convert3dto2dX(ImgNum, ObjNum, PickX# as float)
ScaleX#=Get2DscaleX(ImgNum, ObjNum)
X=(int(PICKX#/ScaleX#)+IMAGE WIDTH(imgnum)/2)
ENDFUNCTION X
function Convert3dto2dZ(ImgNum, ObjNum, PickZ# as float)
ScaleZ#=Get2DscaleY(ImgNum, ObjNum)
Y=(int(PICKZ#/ScaleZ#)+IMAGE HEIGHT(imgnum)/2)
ENDFUNCTION Y
Function Get2DscaleX(ImgNum, ObjNum)
Scale#=(Object Size X(ObjNum)/IMAGE WIDTH(ImgNum))
ENDFUNCTION Scale#
Function Get2DscaleY(ImgNum, ObjNum)
Scale#=(Object Size y(ObjNum)/IMAGE HEIGHT(ImgNum))
ENDFUNCTION Scale#
function paint(memblock, imgnum, ObjNum,Alpha, CursorX, CursorY, Size#, stagenum)
For X=0 to image width(imgnum)-1
For y=0 to image height(imgnum)-1
MemLoc=(IMAGE WIDTH(imgnum)*y+x)*4+12
D#=Distance2D(CursorX, CursorY, X, y)
if D#<Size#
write memblock byte memblock, Memloc + 0, 0
write memblock byte memblock, Memloc + 1, 0
write memblock byte memblock, Memloc + 2, 0
write memblock byte memblock, memloc + 3, Alpha-D#
ENDIF
NEXT y
NEXT x
If IMAGE EXIST(imgnum)=1
MAKE IMAGE FROM MEMBLOCK imgnum, memblock
`TEXTURE OBJECT objnum, stagenum, imgnum
ENDIF
ENDFUNCTION
Function Brush(Speed)
Newmousez = MousemoveZ()
If oldmousez <> newmousez
If oldmousez < newmousez
mousezz=speed
endif
If oldmousez > newmousez
mousezz=-speed
endif
Oldmousez=Mousemovez()
Mousezz=0
endif
ENDFUNCTION Mousezz
function Distance2D(X1, Y1, X2, Y2)
if VECTOR EXIST(1)=0
temp=MAKE VECTOR2(1)
ENDIF
SET VECTOR2 1, X2-X1, Y2-Y1
Distance#=LENGTH VECTOR2(1)
ENDFUNCTION Distance#
Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
