Mapping a Cube from a texture sheet

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Lupo
Posts: 76
Joined: Wed Sep 09, 2009 6:21 pm
Location: Montevideo, Uruguay

Mapping a Cube from a texture sheet

Post by Lupo »

Hi all,

I'd been many years away from ZGE, bear with me with questions...

Now i'm teaching my son to program games and we are working on a kinda of "Minecraft clone" (I know, nobody tried it ;-) ).
Everything is working great, we are creating a bitmap for each texture, but its a way to map a cube using a texture of a texture sheet, like having a big bitmap with all textures and using it like we used to using a tile or a sprite IRC?

Sorry if the question is too stupid.

Kind regards,
Luis.

PS. Nice to come back and I can't believe the ZX exporter... I was using Jonathan Cauldwell's MPAGD... but I think I would love ZGE zx generator...
I need to try it...
Close, but not there yet.
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Mapping a Cube from a texture sheet

Post by Kjell »

Hi Luis,

There's a couple of ways to do this, but generally you want to calculate ( or look-up ) the appropriate texture coordinates for each cube "type". See attached file for a basic example.

The thing is though .. since Minecraft uses so many cubes it isn't really viable ( performance-wise ) to render each cube as a individual mesh / model. So if you're aiming for a similar number of cubes as Minecraft you're going to have to use OpenGL calls to speed things up.

K
Attachments
Block.zgeproj
(101.87 KiB) Downloaded 306 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Mapping a Cube from a texture sheet

Post by VilleK »

Welcome back Luis :)
User avatar
Lupo
Posts: 76
Joined: Wed Sep 09, 2009 6:21 pm
Location: Montevideo, Uruguay

Re: Mapping a Cube from a texture sheet

Post by Lupo »

Kjell wrote: Mon Jul 27, 2020 9:45 am Hi Luis,

There's a couple of ways to do this, but generally you want to calculate ( or look-up ) the appropriate texture coordinates for each cube "type". See attached file for a basic example.

The thing is though .. since Minecraft uses so many cubes it isn't really viable ( performance-wise ) to render each cube as a individual mesh / model. So if you're aiming for a similar number of cubes as Minecraft you're going to have to use OpenGL calls to speed things up.

K
Thanks KJell for the example.

I understand the perf issue, Its more a proof of concepts of sorts, so I don't think we're gonna hit that.
Its difficult to work with the little attention span of this generation (I feel really old) ;-)

Another questions:

1. Is it possible to generate a bitmap from a region of another bitmap (like Bitmap Load)?
2. Is it possible to render a font into a mesh, can I rendertext to another surface and use it?

Kind regards,
Luis.
Close, but not there yet.
User avatar
Lupo
Posts: 76
Joined: Wed Sep 09, 2009 6:21 pm
Location: Montevideo, Uruguay

Re: Mapping a Cube from a texture sheet

Post by Lupo »

VilleK wrote: Mon Jul 27, 2020 11:40 am Welcome back Luis :)
Thanks for the welcome!
Close, but not there yet.
Post Reply