Gamestudio Links
Zorro Links
Newest Posts
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
folder management functions
by 7th_zorro. 04/15/24 10:10
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
SGT_FW
by Aku_Aku. 04/10/24 16:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, Quad), 373 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
View flags get applied to main camera #472031
04/02/18 20:15
04/02/18 20:15
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I have successfully implemented my top down mapping camera, however, I am left with some odd errors.

On some levels, it seems like the flags I have set for my second VIEW bitmap get applied to the main camera view.

On the map, I set it to NOSHADOW and NOPARTICLE, and indeed on some levels, in the main camera, particles that should be there do not show, and shadows do not appear up to a certain distance (roughly the distance that would be covered by the second VIEW's camera).

This does not happen on every level, just some. Sometimes if I revisit that level, it will behave properly.

Here is my code for the actual entity on which the secondary view is projected.

Quote:
action scan_screen()
{
set(my,PASSABLE | UNLIT | LIGHT);
my.material = mtl_scanner;
ent_screen = my;

while(scan_view == NULL)
{
wait(1);
}

sys_marker("SC2");
if(scan_view != NULL)
{
testing_var -= 10000;
scan_view.bmap = scan_bmp;
scan_view.layer = -1;
scan_view.pos_x = 0;
scan_view.pos_y = 0;
scan_view.size_x = 256;
scan_view.size_y = 256;
scan_view.arc = 120;
scan_view.aspect = 1;
scan_view.ambient = 100;
scan_view.clip_near = 0;
scan_view.clip_far = 12000;
set(scan_view,SHOW|NOPARTICLE|NOSHADOW|UNTOUCHABLE|ISOMETRIC);
}

while(player_started != 1)
{
wait(1);
}

scan_bmp = bmap_for_entity(my,1);

sys_marker("SC5");
while(level_loading == 0 && planet_character != NULL)
{
vec_set(my.x,ent_scanner.x);
vec_set(my.pan,ent_scanner.pan);
vec_set(scan_view.x,vector(planet_character.x,planet_character.y,planet_character.z + 1200)); // set the view positions here
vec_set(scan_view.pan,vector(planet_character.pan,-90,0)); // set the view angles here

scan_view.bmap = scan_bmp;

wait(1);
}

// //REMOVE THE SCANNER AND ALL REFERENCES TO IT
sys_marker("SCC");
reset(scan_view,SHOW);
bmap_purge(scan_bmp);
ptr_remove(scan_view);
ptr_remove(scan_bmp);
ent_purge(me);
ent_remove(me);
ent_remove(ent_scanner);
scan_bmp = NULL;
scan_view = NULL;
ent_scanner = NULL;
ent_screen = NULL;

}

Re: View flags get applied to main camera [Re: Dooley] #472032
04/02/18 21:57
04/02/18 21:57
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I have this bad habit of answering my own questions. I think I may have solved this by adding
Quote:
bmap_zbuffer(scan_bmp);
just after setting up the scan_view VIEW.

My biggest question about using bmap_zbuffer is whether this needs to be called for each new level, or just once in the beginning of the game?

I don't fully understand how this works. But so far I have not seen the errors I mentioned. I am reading up in the manual, but a lot of the language about "views" "render targets" is hard to understand.

Last edited by Dooley; 04/02/18 22:05.
Re: View flags get applied to main camera [Re: Dooley] #472047
04/03/18 12:27
04/03/18 12:27
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
As far as I understand, bmap_zbuffer only resizes the engine internal buffers, so it has to be called only once.

Do you wait a frame between setting the variable that breaks the last loop and the new level load? If not, the last code block will never be executed since level_load deletes the entity from the scene and the action from the scheduler.

You have to set scan_view.bmap to NULL. Otherway it points to a removed bmap.

Both problems could be the cause of that ZTARG error you wrote about.

Morover, you are deleting scan_bmp and it is an entity skin. You should not do such a thing. It will be removed with the entity.

Re: View flags get applied to main camera [Re: txesmi] #472067
04/03/18 20:58
04/03/18 20:58
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Thanks! I will try that.


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