Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
drawing onto models #251069
02/11/09 13:57
02/11/09 13:57
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline OP
Serious User
MrGuest  Offline OP
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Hey all,

I'm trying to find a way of drawing realtime onto terrain, but, unfortunately have no success as of yet...

I can draw pixels onto bmaps in panels, but these don't update on terrains...

Is anyone able to point me in the right direction for this?



Many thanks in advance!

Re: [SORTED] drawing onto models [Re: MrGuest] #251087
02/11/09 15:24
02/11/09 15:24
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline OP
Serious User
MrGuest  Offline OP
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
found it!, need to set the skin again after drawing on the bmap

Re: [SORTED] drawing onto models [Re: MrGuest] #253704
02/26/09 06:57
02/26/09 06:57
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
Can you explain how you draw on terrain?
It would be great to know how you did it


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: [SORTED] drawing onto models [Re: Carlos3DGS] #253747
02/26/09 15:23
02/26/09 15:23
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline OP
Serious User
MrGuest  Offline OP
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
heya,

1stly find where the mouse is hitting,

Code:
function mouse_3d(){
	
	VECTOR from, to;
	
	from.x = mouse_pos.x;
	from.y = mouse_pos.y;
	from.z = 1000;
	
	to.x = mouse_pos.x;
	to.y = mouse_pos.y;
	to.z = -1000;
	
	vec_for_screen(from, camera);
	vec_for_screen(to, camera);
	
	c_trace(from, to, IGNORE_PASSABLE | SCAN_TEXTURE);
	
	return(you);
}


make the terrain recognisable as being able to be drawn on
Code:
#define __class skill1
#define _class_scribe 1

action terrain(){
	my.__class = _class_scribe;
}

then make sure you've hit somethign and it's terrain you can write on
[code]function scribe_sand(){
	VECTOR vec_hit;
	while(1)
		if(you){
			if(your.__class == _class_scribe){
				if(mouse_left){ //find the pixel that was hit and mark it
					vec_set(vec_hit.x, target.x);
					mark_sand(bmp_sand_scribe, vector(0, 255, 0), (_vec_hit.x + ent_terrain.max_x) * 1.524, (-_vec_hit.y + ent_terrain.max_y) * 1.524);

				}
			}
		wait(1);
	}
}


then write on the terrain
Code:
function mark_sand(BMAP* _bmp, VECTOR* _col, _pos_x, _pos_y){
	
	var format; var pixel;
	
	format = bmap_lock(_bmp, 0);
	pixel = pixel_for_vec(_col, 100, format);
	
	pixel_to_bmap(_bmp, _pos_x + 0, _pos_y - 2, pixel);
	
	pixel_to_bmap(_bmp, _pos_x - 1, _pos_y - 1, pixel);
	pixel_to_bmap(_bmp, _pos_x + 0, _pos_y - 1, pixel);
	pixel_to_bmap(_bmp, _pos_x + 1, _pos_y - 1, pixel);
	
	pixel_to_bmap(_bmp, _pos_x - 2, _pos_y + 0, pixel);
	pixel_to_bmap(_bmp, _pos_x - 1, _pos_y + 0, pixel);
	pixel_to_bmap(_bmp, _pos_x + 0, _pos_y + 0, pixel);
	pixel_to_bmap(_bmp, _pos_x + 1, _pos_y + 0, pixel);
	pixel_to_bmap(_bmp, _pos_x + 2, _pos_y + 0, pixel);
	
	pixel_to_bmap(_bmp, _pos_x - 1, _pos_y + 1, pixel);
	pixel_to_bmap(_bmp, _pos_x + 0, _pos_y + 1, pixel);
	pixel_to_bmap(_bmp, _pos_x + 1, _pos_y + 1, pixel);
	
	pixel_to_bmap(_bmp, _pos_x + 0, _pos_y + 2, pixel);
	
	bmap_unlock(_bmp);
	
	ent_setskin(ent_terrain, _bmp, 3);
}


these will need to be rearrange in the proper order, i've just ripped them out of my code, so there may be a couple of mistakes in there

one problem which i haven't had the time to fix yet is moving at a high pace and only placing dots rather than a line

hope this helps

Re: [SORTED] drawing onto models [Re: MrGuest] #264370
05/05/09 22:07
05/05/09 22:07
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
thanks for the info smile


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1

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