|
draw on models textur?
#124902
04/18/07 22:11
04/18/07 22:11
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
maybe it's already asked sometimes?
How can i draw (pixels/sprites) on a models texture at runtime? And can i determin the color of a pixel of a models texture at runtime?
thanx mercuryus
Last edited by mercuryus; 04/18/07 22:13.
|
|
|
Re: draw on models textur?
[Re: ]
#124903
04/19/07 02:25
04/19/07 02:25
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
check the manual, lol. It's a combination of functions... Code:
bmap IDK = "Whatever.bmp"; var Color[4]; // Function readThis(_x, _y, _format, &outColor) { var pixel; pixel = pixel_for_bmap(mapIDK, _x, _y); pixel_to_vec(color, color[3], _format, pixel); }
Input X, Y, and FORMAT of bmap. outColor is the return vector of length 4. The fourth (really [3]) is the alpha value...
xXxGuitar511 - Programmer
|
|
|
Re: draw on models textur?
[Re: xXxGuitar511]
#124904
04/19/07 05:58
04/19/07 05:58
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
thanx - i knew this would be that apparent but sometime it's hard to remember where to be found  .
|
|
|
Re: draw on models textur?
[Re: xXxGuitar511]
#124905
04/19/07 09:16
04/19/07 09:16
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
now i can draw on a bmp but how do i access to a MODELS TEXTURE (skin) this way?
edit: fixed! (it works, maybe there are better ways...)
entity* ent_cube; // assign the model with "ent_cube=me;" bmap* bmp_skin;
var gv_format = 0; var gv_pixel = 0; var gv_alpha = 0; var gv_col[3];
// get bmap from models texture bmp_skin = bmap_for_entity(ent_cube,0);
// lock bmap gv_format = bmap_lock(bmp_skin, 0); // get pixel (x/y = 10/10) gv_pixel=pixel_for_bmap(bmp_skin, 10, 10); // get pixel color & alpha pixel_to_vec(gv_col,gv_alpha, gv_format, gv_pixel); // set color temp.red = 55; temp.green = 55; temp.blue = 55;
// create pixel gv_pixel = pixel_for_vec(temp,100,gv_format); // set pixel pixel_to_bmap(bmp_skin,10,10,gv_pixel);
// unlock skin bmap_unlock(bmp_skin);
thanx, mercuryus
Last edited by mercuryus; 04/19/07 10:21.
|
|
|
Re: draw on models textur?
[Re: ]
#124906
04/19/07 11:44
04/19/07 11:44
|
Joined: May 2005
Posts: 155 C:\Program files\GStudio6
alphaindigo
Member
|
Member
Joined: May 2005
Posts: 155
C:\Program files\GStudio6
|
could i use this to let userd draw on the blend map in the first skin of my terrain? i want this so that users can create custom maps. and can i draw on a seriese of pixels such as in a small circle: ............... ...#.........##... .###....#####. ...#.........##... etc. ...............
Last edited by alphaindigo; 04/19/07 11:47.
|
|
|
Re: draw on models textur?
[Re: alphaindigo]
#124907
04/19/07 14:10
04/19/07 14:10
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
yeah.. you could. I'm not sure how fast these methods are though. And I THINK that there is code on the wiki in the terrain shadow-map gen for saving tga's...
xXxGuitar511 - Programmer
|
|
|
|