6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: reading BMAP's
[Re: Widi]
#277953
07/11/09 16:24
07/11/09 16:24
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
thank you...I considered the fact that as long as I do not assign a value to a var I can go on forever(just about). var ah, ba, ca, da, ga, ma, re = 0; that would initialize all to 0 correct? or am I on some sort of drug?
|
|
|
Re: reading BMAP's
[Re: Widi]
#277966
07/11/09 17:51
07/11/09 17:51
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
The big question is, does it work? It wont work for the wiki's "Terrain MultiTex" terrain. Here If thats the case, use this
var fmt, pxl; COLOR tmpC;
c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
if(trace_hit)
{
my.ambient = -55;
BMAP* shadows = ent_getskin(you,3); //<<shadowmap skin number
fmt = bmap_lock(shadows,0);
pxl = pixel_for_bmap(shadows,hit.u1,hit.v1);
bmap_unlock(shadows);
pixel_to_vec(tmpC, NULL, fmt, pxl);
my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3);
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: reading BMAP's
[Re: Nowherebrain]
#277973
07/11/09 18:13
07/11/09 18:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Sounds like youre going the wrong way, this should go into the PLAYER action. And you have to stick with HIT.skin2 as the entity structure doesnt have a skin1 or skin2 property. I take it your trying to get your player to change his brightness according to the ground (shadowmap) underneath him. Try this, just before the wait(1) at the end of the player-action main loop.
...
my.ambient = -55;
var fmt, pxl; COLOR tmpC;
you = NULL;
c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_MAPS|IGNORE_MODELSS|IGNORE_SPRITES|SCAN_TEXTURE);
if(you)
{
fmt = bmap_lock(hit.skin2,0);
pxl = pixel_for_bmap(hit.skin2,hit.u2,hit.v2);
bmap_unlock(hit.skin2);
pixel_to_vec(tmpC, NULL, fmt, pxl);
my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3);
}
...
...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: reading BMAP's
[Re: EvilSOB]
#277980
07/11/09 18:40
07/11/09 18:40
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
I wanted to keep it separate as I will likely call it for many models during their first few frames(static models)...I initially am setting it for the player..who in time will get it called only at key intervals...key_pressed/key_any or whatever best will suit it. here is how I set it now...
function player_ambient()
{
var fmt, pxl; COLOR tmpC;
c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
if(trace_hit)
{
my.ambient = -120;
BMAP* shadows = ent_getskin(you,2); //<<shadowmap skin number
fmt = bmap_lock(shadows,0);
pxl = pixel_for_bmap(shadows,hit.u1,hit.v1);
bmap_unlock(shadows);
pixel_to_vec(tmpC, NULL, fmt, pxl);
my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3) * 0.784;
}
}
|
|
|
Re: reading BMAP's
[Re: Nowherebrain]
#277983
07/11/09 18:58
07/11/09 18:58
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Aha, so its working well. Tis good. Catch ya round...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|