Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / matrix tiles

Author
Message
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 26th Feb 2003 08:15
i have been trying to figure out how to set different textures to the matrix but it hasnt been working out right any help would be appreciated thankyou
Baneblade
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: Ireland
Posted: 26th Feb 2003 17:38
This might help

Rem * Title : Matrix Texturing
Rem * Author : Baneblade
rem ===========================================
rem Based on the DARK BASIC EXAMPLE PROGRAM 3
rem ===========================================
rem This program will texture and tile a matrix
rem -------------------------------------------


rem This program will cover a matrix with "Grass" and place 1 "Ice" tile
rem The bmp file used is taken from the Example program
rem Play around with the "rem" statements in the loop to see different effects

rem This loads the bitmap for the matrix
load bitmap "floor1.bmp",1
get image 1,0,0,256,256
delete bitmap 1

rem Make a matrix
rem *MAKE MATRIX Matrix Number, Width, Depth, Xsegmented, Zsegmented*
make matrix 1,1000,1000,11,11

rem Prepare matrix with a texture cut into a 2x2 texture grid
rem *PREPARE MATRIX TEXTURE Matrix Number, Image Value, Across, Down*
prepare matrix texture 1,1,2,2

rem Fill matrix with first texture tile
rem *FILL MATRIX Matrix Number, Height, Tile Number*
fill matrix 1,0.0,1

for x=0 to 10
for y=0 to 10
rem *SET MATRIX TILE Matrix Number, X, Z, Tile Number*
rem if rnd(2)=0 then set matrix tile 1,x,y,2
set matrix tile 1,0,10,3
rem set matrix tile 1,10,y,3
rem set matrix tile 1,x,0,3
rem set matrix tile 1,x,5,4
next y
next x
update matrix 1

rem Place and point camera to see matrix properly
position camera 500,500,-200
point camera 500,0,500

rem Wait for key press
suspend for key

rem Delete the matrix
delete matrix 1

rem End the program
end

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 27th Feb 2003 03:19
how could u use more than one texture file on a matrix though? i know that u can slice the image2x2 but that doesnt let u load another image for texturing..

xxxpetratxxx
B. R. W

Login to post a reply

Server time is: 2025-08-08 20:39:50
Your offset time is: 2025-08-08 20:39:50