Back to the thread.....

Its all gone up in smoke .... again ....

Below you will find two scripts. The first is the 'entire' script for testing.
It is utilising the SUPPOSEDLY fixed version of my original post.

The second script is just the active portion of it that is utilising my version
of Superku's solution.

Both work fine as they stand.

!! BUT !! I need to be able to turn the NOSKY flag on for that view/function.
AND still have the screen-buffer (and z-buffer?) being cleared. I think!
Reason being is that there is a sky-entity (ent_createlayer) that must be
active in the camera view, but hidden in mine. AND the renderings of these
previews want to be transparent where the background is showing through.

Ive been d**king around for hours now, and just cant find a way.
BUT I am a mere noob when it comes to handling views and view-materials...

Also bear in mind, IN CASE it makes a difference, that there will potentially
be up to 20 of these functions active during the same frame, and maybe overlapping.


So, heres the scripts...

COMPLETE script
Click to reveal..
Code:
#include <acknex.h>
#include <default.c>
#define PRAGMA_PATH "Models\Mapobjects";
#define PRAGMA_PATH "G:\GStudio8\templates\models";
//
//
//=======================================================================================
function SnapShot_Event()	{  if(me!=render_view.genius)  return(1);  else  return(0);	}
MATERIAL *SnapShot_mat =	{  event=SnapShot_Event;  flags=ENABLE_RENDER;					}
//=======================================================================================
void preview_create(STRING* ent_name, BMAP* targ_bmap)
{	if((!ent_name)||(!targ_bmap))		return;	//invalid capture parameter/s.
	ENTITY* targ_ent = NULL;			var old_mode=preload_mode;		preload_mode = 3+4+8;
	targ_ent = ent_create(ent_name, nullvector, NULL);
	preload_mode=old_mode;				if(targ_ent==NULL)	return;	//invalid entity name
	vec_set(targ_ent.pan,vector(35,10,0));		vec_set(targ_ent.x,vector(-999,-999,-999));
	//------------------------------------------------------------------------------------
	VIEW *view  = view_create(1000);		view.genius = targ_ent;		view.bmap = targ_bmap;
	view.size_x = targ_bmap.width;		view.size_y = targ_bmap.height;
	c_updatehull(targ_ent, targ_ent.frame);		vec_set(view.x, targ_ent.x);
	view.x -= vec_dist(targ_ent.min_x, targ_ent.max_x); 		
 	vec_to_angle(view.pan,vec_diff(0,targ_ent.x,view.x));		view.material=SnapShot_mat;			
	//------------------------------------------------------------------------------------
	set(view, SHOW | NOENT);		wait(1);					ptr_remove(view);
//
//**  DEBUGGING ONLY  *********************************************************************
STRING* tmp = str_create("@testing\\");		str_cat(tmp, str_for_int(0,(long)random(99999)));
str_cat(tmp, ".bmp");	bmap_save(targ_bmap, tmp);		str_remove(tmp);
//*****************************************************************************************
//
	ent_purge(targ_ent);		ent_remove(targ_ent);													}
//=======================================================================================
//
//
BMAP* targ_map;
//
void test_1()	{	preview_create("Stair.mdl", targ_map);				}
void test_2()	{	preview_create("Pyramide.mdl", targ_map);			}
void test_3()	{	preview_create("Flamezylinder2.mdl", targ_map);	}
void test_4()	{	preview_create("Diagonal.mdl", targ_map);			}
void test_5()	{	preview_create("earth.mdl", targ_map);				}

void test_many()
{
	STRING* filename = str_create("");
	TEXT *dir = txt_create(50,1);		reset(dir, SHOW);
	var i, count = txt_for_dir(dir, "G:\\GStudio8\\templates\\models\\*.mdl");
	BMAP** bmaps = (BMAP**)sys_malloc(sizeof(BMAP*)*count);
	for(i=0; i<count; i++)
	{
		bmaps[i] = bmap_createblack(64,64,32);
		str_cpy(filename, (dir.pstring)[i]);
		preview_create(filename, bmaps[i]);	
	}
	beep();
}
//
void main()
{
	wait(1);					level_load(NULL);		wait(1);				diag("\n\n\n");
	draw_textmode("Times",0,32,100);				warn_level = 3;	
	on_esc=on_f1=on_f2=on_f3=on_f4=on_f5=on_f6=on_f7=on_f8=on_f9= NULL;
	//------------------------------------------------------------------------------------
	//
	targ_map = bmap_createblack(64,64,32);	bmap_fill(targ_map, COLOR_BLACK, 100);

	on_f1 = test_1;
	on_f2 = test_2;
	on_f3 = test_3;
	on_f4 = test_4;
	on_f5 = test_5;
	on_space = test_many;
	//
	while(!key_esc)
	{
		DEBUG_BMAP(targ_map, 10, 2);
		wait(1);
	}
	//
	//
	//
	//------------------------------------------------------------------------------------
	if(key_shift)	exec("notepad.exe", "acklog.txt");
	sys_exit(0);
}


"preview_create" snippet with material config
Click to reveal..
Code:
//=========================================================================================
function SnapShot_Event()	{ 	if(render_view == camera)  return(1);	return 0;	}
MATERIAL *SnapShot_mat =	{  event=SnapShot_Event;  		flags=ENABLE_RENDER;		}
//-----------------------------------------------------------------------------------------
void preview_create(STRING* ent_name, BMAP* targ_bmap)
{	if((!ent_name)||(!targ_bmap))		return;	//invalid capture parameter/s.
	ENTITY* targ_ent = NULL;			var old_mode=preload_mode;		preload_mode = 3+4+8;
	targ_ent = ent_create(ent_name, nullvector, NULL);					preload_mode=old_mode;
	if(targ_ent==NULL)	return;	//invalid entity name
	vec_set(targ_ent.pan,vector(35,10,0));						vec_set(targ_ent.x, nullvector);
	//--------------------------------------------------------------------------------------
	VIEW *view  = view_create(1000);		view.bmap = targ_bmap;		view.genius = targ_ent;
	view.size_x = targ_bmap.width;		view.size_y = targ_bmap.height;
	c_updatehull(targ_ent, targ_ent.frame);						vec_set(view.x, targ_ent.x);
	view.x -= vec_dist(targ_ent.min_x, targ_ent.max_x); 
	vec_to_angle(view.pan,vec_diff(0,targ_ent.x,view.x));		targ_ent.material=SnapShot_mat;			
	//--------------------------------------------------------------------------------------
	set(view, SHOW | NOENT);		wait(1);					ptr_remove(view);
//
//**  DEBUGGING ONLY  *********************************************************************
STRING* tmp = str_create("@testing\\");		str_cat(tmp, str_for_int(0,(long)random(99999)));
str_cat(tmp, ".bmp");	bmap_save(targ_bmap, tmp);		str_remove(tmp);
//*****************************************************************************************
//
	ent_purge(targ_ent);				ent_remove(targ_ent);												}
//=========================================================================================



You will need to reset the PRAGMA_PATH to match your GStudio8 location, and create a folder called "@testing"
in the folder where this script is, to capture all the BMAPS Im diagnosing with...

Remember, both these scripts work perfectly as they are. Like this it produces the type of output I want (in the @testing folder).
To get it to fail, you need to add the NOSKY flag to the "set(view,SHOW|NOENT);" at line 24.

F1 -> F5 are one-at-a-time tests, but hitting the space-bar is the REAL test.

[EvilSOB looks at you with sad puppydog eyes] wink


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial