Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 779 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
reading BMAP's #277911
07/11/09 12:27
07/11/09 12:27
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline OP
Serious User
Nowherebrain  Offline 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....
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;
	my.ambient = my.ambient + ((hit.red + hit.green + hit.blue) / 3);
}


I want to read from skin 2 though...any pointers would be appreciated.


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
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 Offline OP
Serious User
Nowherebrain  Offline 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.

Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
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 Offline
Expert
EvilSOB  Offline
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)
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: EvilSOB] #277925
07/11/09 13:30
07/11/09 13:30
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline OP
Serious User
Nowherebrain  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
EvilSOB to the rescue again.
Copy>Paste>test...brb


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
Re: reading BMAP's [Re: Nowherebrain] #277927
07/11/09 13:36
07/11/09 13:36
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Does this mean the code was okay, but the trace was too short?^^

Re: reading BMAP's [Re: Nowherebrain] #277933
07/11/09 14:11
07/11/09 14:11
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline OP
Serious User
Nowherebrain  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Getting a crash invalid pointer>then crash inside the function.....I have company over now...will check more later.


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
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 Offline
Expert
EvilSOB  Offline
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...
Code:
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 Offline OP
Serious User
Nowherebrain  Offline 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.

Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
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 Offline OP
Serious User
Nowherebrain  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Here is the entire piece.
Code:
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);
	}
}




Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
Re: reading BMAP's [Re: Nowherebrain] #277951
07/11/09 16:13
07/11/09 16:13
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
var fmt, pxl; COLOR tmpC;

is the same as:

var fmt;
var pxl;
COLOR tmpC;

And yes, COLOR is a Vector (tmpC.red, tmpC.green, tmpC.blue)

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1