0 registered members (),
1,103
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
[help] cutting the same image in many entities
#268160
05/27/09 18:11
05/27/09 18:11
|
Joined: Apr 2002
Posts: 117 Spain
Abstracto
OP
Member
|
OP
Member
Joined: Apr 2002
Posts: 117
Spain
|
Hi, im trying to make a simple puzzle game. The puzzle is a big image, and im using it as a texture. I made a box tile model (puzzle piece), so it can show a small part of the big image (it has been placed as the skin of the box). My idea was to create many tiles, and then displace the texture or the UV coordinates for every tile model, so each model shows a part of the complete image. (Then the player can touch and move the tiles, well, you know)
Im not sure how to change the UV mapping of each tile model (it seems im changing the UV coordinates of ALL models at the same time), how can i do this? is there a better way (i.e: cutting the bitmap image on many squares, and then assign each to one model, or others ideas)?
Thanks!
|
|
|
Re: [help] cutting the same image in many entities
[Re: KiwiBoy]
#268219
05/28/09 07:34
05/28/09 07:34
|
Joined: Apr 2002
Posts: 117 Spain
Abstracto
OP
Member
|
OP
Member
Joined: Apr 2002
Posts: 117
Spain
|
im using lite-c, free version for this game, i own a A6 version too, i don't own A7,
well, i will take a look at materials, thanks!
i have found that i can "copy" entities using clone, i think this way i can modify each model UV coordinates individually... as every model has only 12 triangles, i think its not a big memory waste.
Edit: using ent_clone on lite-c free version, crashes. On the lite-c help file, there is no ent_clone function.... Another way can be to load a big bitmap, and then copy smaller rectangles of this bitmap, for the models skin, so each model has a small skin, and all different, what do you think its better?
Thanks!
Last edited by Abstracto; 05/28/09 14:09.
|
|
|
Re: [help] cutting the same image in many entities
[Re: Abstracto]
#268504
05/29/09 17:55
05/29/09 17:55
|
Joined: Apr 2002
Posts: 117 Spain
Abstracto
OP
Member
|
OP
Member
Joined: Apr 2002
Posts: 117
Spain
|
well, i have found that i can write something like this BMAP* name = "filename#(x)#(y)#(width)#(height)"; to get part of a image file, but i need to make the cut on runtime, i cannot define all tiles this way, because i want to load de image on runtime (the player selects an image, and the the program loads it)
i found this function also: bmap_blitpart, but it is missin on the help files, so im not sure i can use it, anyway, ent_clone keeps crashing, i dont know why
|
|
|
Re: [help] cutting the same image in many entities
[Re: Abstracto]
#268563
05/29/09 23:46
05/29/09 23:46
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Try this. Im using A7.77 commercial, but if blitpart works for you, this function will do the job BMAP* bmap_create_blitpart(BMAP* SourceBMAP, var x_map, var y_map, var x_size, var y_size)
{ if(SourceBMAP==NULL) return((BMAP*)NULL);
VECTOR tmpV0, tmpV1;
BMAP* TargetBMAP = bmap_createblack(x_size,y_size,24);
//bmap_fill(TargetBMAP, vector(128,128,128), 100);
vec_set(tmpV0, vector(x_map*x_size,y_map*y_size,0));
vec_set(tmpV1, vector(x_size,y_size,0));
bmap_blitpart(TargetBMAP, SourceBMAP, NULL, NULL, tmpV0, tmpV1);
return(TargetBMAP);
}
Example: BMAP* ThisSkin = bmap_create_blitpart(SourceBMAP, startpos_x, startpos_y, target_width, target_height); NOTE : this only creates bmaps with "power of two" sizes. The data it retrieves is correct though.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: [help] cutting the same image in many entities
[Re: EvilSOB]
#268679
05/30/09 16:33
05/30/09 16:33
|
Joined: Apr 2002
Posts: 117 Spain
Abstracto
OP
Member
|
OP
Member
Joined: Apr 2002
Posts: 117
Spain
|
ok, thanks guys!,
with the bmap_create_blitpart and some changes, i at last got it working, i have now a 1024x1024 image, and 16x16 entities, with a 64x64 texture each, so putting all tiles on the right position, side by side , i can see the whole image. I have noticed a small image distortion on the borders of each tile, but its not very noticeable. im now tryin to continue the game, i will post an image of the game as i get it to evolve to a real game.
Last edited by Abstracto; 05/30/09 16:34.
|
|
|
Re: [help] cutting the same image in many entities
[Re: MMike]
#325522
05/27/10 00:46
05/27/10 00:46
|
Joined: May 2010
Posts: 13
IvanOFF
Newbie
|
Newbie
Joined: May 2010
Posts: 13
|
Help //bmap_fill(TargetBMAP, vector(128,128,128), 100); vec_set(tmpV0, vector(x_map*x_size,y_map*y_size,0)); vec_set(tmpV1, vector(x_size,y_size,0)); uninamble files! plz Help!
|
|
|
|