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 / Prepare Matrix Texture problem

Author
Message
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 16th Aug 2009 19:33
I understand (from TDK's tutorials) that if you use the PREPARE MATRIX TEXTURE command and there is only one texture, it will automatically FILL MATRIX with that texture. I am using a 128x128 bitmap image loaded as image 5 with four textures. When I use command:

PREPARE MATRIX TEXTURE 1,5,2,2

It automatically fils the matrix with the first texture. I know the four textures are loaded because I can use them and the command:

MATRIX TILE COUNT(1)

Returns 4

I know from searching the forums that there is a bug in DBP but I didn't know if the same bug exist in DBC. If so, is there any fix or workaround?
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Aug 2009 23:14
I think that no matter how many divisions you make in the image (matrix tiles), after PREPARE MATRIX TEXTURE, the matrix is always textured with the first tile. To texture the matrix how you want, you have to assign individual texture tiles to each cell of the matrix using SET MATRIX TILE.

This example randomly chooses between 4 tile textures and places them on the matrix:



Enjoy your day.
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 16th Aug 2009 23:24
I am working on a level/world editor and wanted to leave the matrix blank until the user paints the tiles. I guess I'll have to set the first tile of the image to some neutral color.

Thanks Latch
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Aug 2009 01:56
I think that's the best way to go. If you look at MatEdit or Level Maker 3d they both use No Texture as the default for a matrix.

Enjoy your day.
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 20th Aug 2009 05:42
Ok, thanks. By the way, I'm using your copy object function (October 2006) from the codebase in my level editor.

It works great!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Aug 2009 08:39
Quote: "By the way, I'm using your copy object function (October 2006) from the codebase in my level editor."


Huh? I don't even know what that is. 2006 ? I wrote that when I started using DarkBasic if that's the date. I better find it to see if it's badly written.

[a little later]

Ah ha! There's code in it referencing a memblock that isn't necessary, and two calls to extra functions that aren't necessary.

Here's an updated version, if you want to use it. I eliminate the 2 extra functions to get a memblock or a mesh and just include it in the function. That speeds it up a bit. However, the added scale feature probably brings it back to the original speed. It will allow you to scale the copied object all in one shot. If you leave the scale values at zero, it won't scale. So a scale value of 0 or 100 = original scale. 200 would be 200% or twice the original object's x y or z dimension.



Enjoy your day.
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 20th Aug 2009 17:49
Cool, I'll swap in this new function. I'm not even going to attempt to understand memblocks at this point. Just trying to become proficient with the other DBC commands/concepts.

Thanks Latch!

Login to post a reply

Server time is: 2024-05-01 21:33:33
Your offset time is: 2024-05-01 21:33:33