6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
reading BMAP's
#277911
07/11/09 12:27
07/11/09 12:27
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
I'm having some issues with reading hit.skin2...I just simply don't know how to return the values from it....lol here is what I am basically trying to accomplish....
function get_ambient()
{
c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
my.ambient = -55;
my.ambient = my.ambient + ((hit.red + hit.green + hit.blue) / 3);
}
I want to read from skin 2 though...any pointers would be appreciated.
|
|
|
Re: reading BMAP's
[Re: Nowherebrain]
#277917
07/11/09 12:58
07/11/09 12:58
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
The following is out of the manual. If you search for "hit", so this is telling me that it is already reading the second skin, but I can tell it is not.
"hit.blue,green,red... Pixel color of the second texture (f.i. a lightmap) at the contact position, for 24-bit textures only." I want to return the values from hit.skin2.
Last edited by Nowherebrain; 07/11/09 12:58.
|
|
|
Re: reading BMAP's
[Re: Nowherebrain]
#277918
07/11/09 13:03
07/11/09 13:03
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
According to the manual, hit.blue/green/red IS from the second skin. Or do I misunderstand the question? (note, you arent checking a hit was made before changing values in your example)[EDIT] you posted while I was typing. But according the the manual blah, blah, again. ANOTHER way would be to...(untested code)
function get_ambient()
{
c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
my.ambient = -55;
/////
var fmt, pxl; COLOR tmpC;
fmt = bmap_lock(hit.skin2,0);
pxl = pixel_for_bmap(hit.skin2,hit.u1,hit.v1);
bmap_unlock(hit.skin2);
pixel_to_vec(tmpC, NULL, fmt, pxl);
/////
my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3);
}
//
Last edited by EvilSOB; 07/11/09 13:16.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: reading BMAP's
[Re: Nowherebrain]
#277942
07/11/09 14:57
07/11/09 14:57
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Couple of ideas, for when you get back to it. 1> You werent checking for a valid hit...
function get_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 = -55;
fmt = bmap_lock(hit.skin2,0);
pxl = pixel_for_bmap(hit.skin2,hit.u1,hit.v1);
bmap_unlock(hit.skin2);
pixel_to_vec(tmpC, NULL, fmt, pxl);
my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3);
}
}
//
2> Does a second skin even exists if it is a WED block? This could generate the error.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: reading BMAP's
[Re: EvilSOB]
#277947
07/11/09 15:42
07/11/09 15:42
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
I am getting the vec color from a terrain(hmp)and yes a second skin exists.
I do not understand the following line.... var fmt, pxl; COLOR tmpC; the "var" seems to be an array???I'm not a well rounded programmer..lol I'm guessing "COLOR" is a "C" prdefined vector. should there be a "wait" in there for bmap_unlock/lock? I am calling this from the same player action you helped me with before BTW...
Last edited by Nowherebrain; 07/11/09 15:54.
|
|
|
Re: reading BMAP's
[Re: Nowherebrain]
#277949
07/11/09 15:57
07/11/09 15:57
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
Here is the entire piece.
var run_speed = 550;
function get_ambient()
{
// c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
// my.ambient = -55;
// my.ambient = my.ambient + ((hit.red + hit.green + hit.blue) / 3);
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;
fmt = bmap_lock(hit.skin2,0);
pxl = pixel_for_bmap(hit.skin2,hit.u1,hit.v1);
bmap_unlock(hit.skin2);
pixel_to_vec(tmpC, NULL, fmt, pxl);
my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3);
}
}
//
action guss()
{
var anim_cycle;
var ground_dist;
VECTOR ground_00;
player = my;
c_updatehull(my,11);
wait(1);
// set(my,SHADOW);
my.material = mat_alphatest;
while(1)
{
player_exists = 1;
get_ambient();///////here I call it, obviously
c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES);//|USE_BOX
if(hit.z != 0)
{
hit.z += 24;
player.z = hit.z;
}
if(key_w == 1)
{
c_move(my,vector(run_speed*time_step/16,0,0),nullvector,IGNORE_PASSABLE|IGNORE_SPRITES|GLIDE);
ent_animate(my,"run",anim_cycle,ANM_CYCLE);
anim_cycle += 10 * time_step;
anim_cycle %= 100;
}
if(key_any == 0)
{
ent_animate(my,"stand",anim_cycle,ANM_CYCLE);
anim_cycle += 8 * time_step;
anim_cycle %= 100;
}
my.pan -= mouse_force.x + mouse_force.x;
wait(1);
}
}
|
|
|
|