Jump to content
This Topic

Recommended Posts

Posted

Hello, im trying load the scene in c++, but im having the following problem. The models auto disappear. If i pass with the camera in a certain limit, all models, that are not vegetation, disappear. I was directly changing the file .sbx, and realized that when have few models, the problem is less, but if have lot models, the problem is greater.

 

 

My code is this:

 

//	====================================================================
//	This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard
//	Written by Rimfrost Software
//	http://www.rimfrost.com 
//	====================================================================

#include "engine.h"

void Fxs();

int main( int argn, char* argv[] )
{

//Resolution
int width=1680,height=1050;

Initialize() ;
RegisterAbstractPath("D:/Projetos/Rally");
SetAppTitle( "Rally" ) ;
Graphics( width, height,32 ) ;
AFilter() ;
TFilter() ;

// Cria FrameWork
TFramework framework=CreateFramework();
// Pega Layer da Camera main
TLayer layer = GetFrameworkLayer(0);
// Pega Camera principal(main)
TCamera camera=GetLayerCamera(layer);

//Load Scene - Pista1
LoadScene("abstract::pista1.sbx");

// CONFIGURA O CENARIO ##################
//Camera
PositionEntity(camera,Vec3(-818,19,832));
//CameraRange(camera,0.1,1000);




//SkyBox
SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));
SetBackgroundColor(Vec4(1,1,1,1));

//Lights
// Direcional
TLight light=CreateDirectionalLight();
RotateEntity(light,Vec3(39,159,54));


//Luz ambiente
//AmbientLight(Vec3(0.5,0.43,0.34));
//EntityColor(light,Vec4(0,0,0,1.5));

Fxs();
// ######################################

TVec3 camrotation=Vec3(0);
float mx=0,my=0;
float move=0,strafe=0.0;


// Game loop
while( !KeyHit() && !AppTerminate() )
{
	if( !AppSuspended() ) // We are not in focus!
	{
		//FREE LOOK
		mx = Curve(MouseX()-GraphicsWidth()/2, mx,6);
           my = Curve(MouseY()-GraphicsHeight()/2, my,6);
           MoveMouse(GraphicsWidth()/2, GraphicsHeight()/2);               
           camrotation.X = camrotation.X+my/10.0;
           camrotation.Y = camrotation.Y-mx/10.0;
           RotateEntity(camera, camrotation);

		//MOVE CAMERA
		move   = Curve(KeyDown(KEY_W)-KeyDown(KEY_S),move,10);
		strafe = Curve(KeyDown(KEY_D)-KeyDown(KEY_A),strafe,10);
		MoveEntity(camera,Vec3(strafe,0,move));


		// Update timing and world
		UpdateAppTime();
		UpdateWorld(AppSpeed()) ;

		// Render
		UpdateFramework();
		RenderFramework();

		// Send to screen
		Flip(0) ;
	}
}

// Done
return Terminate() ;
}

void Fxs(){
//GodRays
SetGodRays(1);

//HDR
SetHDR(1);

//Bloom
SetBloom(1);

//SSAO
//SetSSAO(1); 

//AnitAliasing
SetAntialias(1);

//Vegetation Shadow
SetVegetationShadowMode(1);

}

 

Anyone had the same problem? i dont know what do.

Posted

i cant, show this error:

 

error C3861: 'SetEntityViewRange': identifier not found

 

I do:

 

TEntity scene = LoadScene("abstract::pista1.sbx");
SetEntityViewRange(scene,3,1);

 

:D

Posted

I think it's because the Lua script is doing calculations all the time. It could be fixed by having a global Lua variable like "nocalc=1", which would stop all all Lua scripts from doing anything.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

hmm..i understand..

i will test this about the road scripr, because is making the lot diference in the FPS.

 

Now, about the camera, i test this command, it compile, but continue to dont work, the models hide in a certain distance from camera to some model, that i dont know what is.

 

Thanks lumooja

Posted

No Aggror, i see script by script, and none is be setting this.

 

I found this function in Wiki: SetWorldCullRange(), but ever time that i execute, resulted in "C Stack Overflow". I deleted the "atmosphere" entity from editor, to set this function in own code. My code is this now:

 

//	====================================================================
//	This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard
//	Written by Rimfrost Software
//	http://www.rimfrost.com 
//	====================================================================

#include "engine.h"

void Fxs();

int main( int argn, char* argv[] )
{

//Resolution
int width=800,height=600;

Initialize() ;
RegisterAbstractPath("D:/Projetos/Rally");
SetAppTitle( "Rally" ) ;
Graphics( width, height ) ;
AFilter() ;
TFilter() ;

// Cria FrameWork
TFramework framework=CreateFramework();
// Pega Layer da Camera main
TLayer layer = GetFrameworkLayer(0);
// Pega Camera principal(main)
TCamera camera=GetLayerCamera(layer);

//Load Scene - Pista1
TEntity scene = LoadScene("abstract::pista1.sbx");

// CONFIGURA O CENARIO ##################
//Camera
PositionEntity(camera,Vec3(-818,19,832));
CameraRange(camera,0.1,1000);
//EntityViewRange(scene,3,1);
SetWorldCullRange(50,125,500);



//SkyBox
SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));
SetBackgroundColor(Vec4(1,1,1,1));

//Lights
// Direcional
TLight light=CreateDirectionalLight();
RotateEntity(light,Vec3(39,159,54));


//Luz ambiente
//AmbientLight(Vec3(0.5,0.43,0.34));
//EntityColor(light,Vec4(0,0,0,1.5));

Fxs();
// ######################################

TVec3 camrotation=Vec3(0);
float mx=0,my=0;
float move=0,strafe=0.0;


// Game loop
while( !KeyHit() && !AppTerminate() )
{
	if( !AppSuspended() ) // We are not in focus!
	{
		//FREE LOOK
		mx = Curve(MouseX()-GraphicsWidth()/2, mx,6);
           my = Curve(MouseY()-GraphicsHeight()/2, my,6);
           MoveMouse(GraphicsWidth()/2, GraphicsHeight()/2);               
           camrotation.X = camrotation.X+my/10.0;
           camrotation.Y = camrotation.Y-mx/10.0;
           RotateEntity(camera, camrotation);

		//MOVE CAMERA
		move   = Curve(KeyDown(KEY_W)-KeyDown(KEY_S),move,10);
		strafe = Curve(KeyDown(KEY_D)-KeyDown(KEY_A),strafe,10);
		MoveEntity(camera,Vec3(strafe,0,move));


		// Update timing and world
		UpdateAppTime();
		UpdateWorld(AppSpeed()) ;

		// Render
		UpdateFramework();
		RenderFramework();

		// Send to screen
		Flip(0) ;
	}
}

// Done
return Terminate() ;
}

void Fxs(){
//GodRays
SetGodRays(1);

//HDR
SetHDR(1);

//Bloom
SetBloom(1);

//SSAO
//SetSSAO(1); 

//AnitAliasing
SetAntialias(1);

//Vegetation Shadow
SetVegetationShadowMode(1);

}

Posted

It really seems issue with view range, in your previous code you called (now commented):

 

EntityViewRange(scene,3,1);

 

But it is not intended to be used in that way, you should cycle through all the scene entities/children and call EntityViewRange for each of them and not just to the scene. But since you are using a SBX and calls LoadScene then I think it's easier if you set the view range to INFINITE directly from the editor interface for each object.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted
  On 10/11/2010 at 2:07 PM, ZioRed said:

It really seems issue with view range, in your previous code you called (now commented):

 

EntityViewRange(scene,3,1);

 

But it is not intended to be used in that way, you should cycle through all the scene entities/children and call EntityViewRange for each of them and not just to the scene. But since you are using a SBX and calls LoadScene then I think it's easier if you set the view range to INFINITE directly from the editor interface for each object.

Well, after thinking that all the objects in the scene loaded with LoadScene are children, I tried your code with "EntityViewRange(scene,3,1);" (whose third parameter is recursion) on a sample scene with a house on a terrain and it works, when I move far away from the house it is ever visible, so make sure you have the latest 2.4 engine/newton/shaders.pak

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted

Thanks guys for the helps..

 

So, i saw script by script, and none has this function. I tried change in itself editor the view range, but the problem continue.

 

Uptdated all files, and try ever again, but same problem.

The strange is that ever models hidden when I'm in a certain position, until the models that on my side.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...