Yes.
If you own DBv1 with DarkMatter patch , you can use memblock to make Double-Texturing.
Simply using 1 function called :
Function FLX_Double_Texturing(_object,_texture1,_texture2,_alpha)
_object = number of the object to double-texture
_texture1 = number of the image for the 1st texture
_texture2 = number of the image for the 2nd texture
_alpha = percentage for texture transition ( from 0% up to 100% )
( _alpha=0 will only display texture 1 and _alpha=100 only texture 2 )
Rem Exemple sur comment faire un double-texturage d'objet en utilisant les memblocks.
Rem Restrictions : les 2 textures utilisées doivent avoir les mêmes dimensions et la même profondeur.
Rem
Rem Example on how to make a double-texturing using memblocks.
Rem Restrictions : the 2 used textures must use the same size and same depth.
Rem
Rem Vous devez créer ce tableau pour obtenir un effet maximum pour le système.
Rem You must défine that value to make real-time calculation faster
dim _dt(5)
Rem on définit le mode d'écran et le frame-rate.
Rem we define screen resolution and frame-rate.
set display mode 1024,768,16
sync rate 75 : sync on
Rem Chargement des images et créations des objets 3D de la démo.
Rem Loading textures and create objects for demo.
load image "gfx\texture1.jpg",1
load image "gfx\texture2.jpg",2
for boucle=1 to 3
make object cube boucle,128
position object boucle,(boucle-2)*160,-128,0
next boucle
position camera 0,0,-384
texture object 1,1
texture object 3,2
FLX_Double_Texturing(2,1,2,50)
Rem On montre le résultat avec des cubes en rotations . . .
Rem We show the résult with rotating cubes.
x1#=0.0 : y1#=0.0 : x2#=0.0 : y2#=0.0 : x3#=0.0 : y3#=0.0
_addpercent#=0.5 : _percent#=50.0
Repeat
set cursor 0,0
print "DarkBasic Memblock's double texturing demo"
Print "Made by freddix ( freddbprojects@wanadoo.fr )"
print " "
print " Press left mouse button to switch between simple and real-time DT-Alpha% mode"
print " press space key to quit the demo "
print " "
if _mode=0 then print "MODE : simple" else print "MODE : Real-time double-texturing calculation"
x1#=wrapvalue(x1#+1) : x2#=wrapvalue(x2#+2) : x3#=wrapvalue(x3#+0.5)
y1#=wrapvalue(y1#+1) : y2#=wrapvalue(y2#+2) : y3#=wrapvalue(y3#+0.5)
rotate object 1,x1#,y1#,0 : rotate object 2,x2#,y2#,0 : rotate object 3,x3#,y3#,0
print " FPS : ",screen fps()
if mouseclick()=1
inc _mode,1
repeat
until mouseclick()=0
endif
if _mode=1
_percent#=_percent#+_addpercent#
if _percent#=100.0 then _addpercent#=-0.5
if _percent#=0.0 then _addpercent#=0.5
FLX_Double_Texturing(2,1,2,int(_percent#))
endif
if _mode=2
_mode=0
endif
sync
Until spacekey()=1
Rem On efface tout ce qui existe encore . . .
Rem We delete all things.
for boucle=1 to 3
if object exist(boucle)=1 then delete object boucle
if image exist(boucle)=1 then delete image boucle
next boucle
end
Rem ********************************************************************************************************
Rem Le double texturage nécessite le fait que les 2 images aient les mêmes dimensions et la même profondeur !
Rem Double-Texturing need the 2 images to own the same sizes and same depth !
Function FLX_Double_Texturing(_object,_texture1,_texture2,_alpha)
Rem ********************************************************************************************************
if _dt(1)=0
Rem On recherche 3 memblocks de libres pour créer les 3 buffers de texture ( texture1 , texture2 , mélange )
Rem We look for 3 available memblocks to create 3 buffers ( 1st Texture , 2nd Texture , Melting )
_memblock1=256
repeat
dec _memblock1,1
until memblock exist(_memblock1)=0 or _memblock10
_memblock2=_memblock1
repeat
dec _memblock2,1
until memblock exist(_memblock2)=0 or _memblock20
_memblock3=_memblock2
repeat
dec _memblock3,1
until memblock exist(_memblock3)=0 or _memblock30 and _memblock2>0 and _memblock3>0 and _texture3>0
make memblock from image _memblock1,_texture1
make memblock from image _memblock2,_texture2
_length=get memblock size(_memblock1)
make memblock _memblock3,_length
_xsize=memblock dword(_memblock1,0) : write memblock dword _memblock3,0,_xsize
_Ysize=memblock dword(_memblock1,4) : write memblock dword _memblock3,4,_ysize
_Depth=memblock dword(_memblock1,8) : write memblock dword _memblock3,8,_depth
endif
_dt(1)=_memblock1 : _dt(2)=_memblock2 : _dt(3)=_memblock3 : _dt(4)=_texture3 : _dt(5)=_length
endif
if _dt(1)>0
_memblock1=_dt(1) : _memblock2=_dt(2) : _memblock3=_dt(3) : _texture3=_dt(4) : _length=_dt(5)
_bytepos=12
Rem
_flt1=2048 : _flt2=32
if _alpha(0-1)
_alpha1=_alpha : _alpha2=100-_alpha
else
_alpha1=50 : _alpha2=50
endif
repeat
_pixel1=memblock word(_memblock1,_bytepos)
_pixel2=memblock word(_memblock2,_bytepos)
_r1=_pixel1/_flt1 : _v1=(_pixel1-(_r1*_flt1))/_flt2 : _b1=(_pixel1-((_r1*_flt1)+(_v1*_flt2)))
_r2=_pixel2/_flt1 : _v2=(_pixel2-(_r2*_flt1))/_flt2 : _b2=(_pixel2-((_r2*_flt1)+(_v2*_flt2)))
_r3=((_r1*_alpha1)+(_r2*_alpha2))/100 : _v3=((_v1*_alpha1)+(_v2*_alpha2))/100
_b3=((_b1*_alpha1)+(_b2*_alpha2))/100
_pixel3=(_r3*_flt1)+(_v3*_flt2)+_b3
write memblock word _memblock3,_bytepos,_pixel3
inc _bytepos,2
until _bytepos>_length-1
Rem On crée l'image finale et on texture l'objet si il existe.
Rem We create the final image and texture object if it exist.
make image from memblock _texture3,_memblock3
if object exist(_object)=1 then texture object _object,_texture3
Rem delete memblock _memblock1 : delete memblock _memblock2 : delete memblock _memblock3
delete image _texture3
_SUCCESS=1
else
_SUCCESS=0
endif
EndFunction _SUCCESS