Jump to content

Load scene and road/river


Joh
 Share

Recommended Posts

Hi all,

I know that lua doesn't need to do this but i wanna do it.. so:

How can i manage road or river after loaded the scene?

I did my own process scene (and didn't debug it at all yet) but before doing this i wanna know if i should do something in particular.

Opening the sbx file i saw there is some data, are those mesh data? Did i need to create it or loadscene do for me and i only need to process it?

Thanks in advice.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

This is a c++ snip that inits lua and loads a scene containg road/river/lights etc.. correctly, but not sure if it's that you need (or I didn't understand the question)

 

#include "engine.h"

int main(int argc, char** argv)
{
	Initialize();
	RegisterAbstractPath("C:Leadwerks Engine SDK");
	Graphics(1280,960);

	AFilter() ;
	TFilter() ;

	TFramework framework=CreateFramework();
	TLayer layer = GetFrameworkLayer(0);
	TCamera cam=GetLayerCamera(layer);
	PositionEntity(cam,Vec3(0,0,0));

	//Set Lua variable
	BP L=GetLuaState();
	lua_pushobject(L,framework);
	lua_setglobal(L,"fw");
	lua_pop(L,1);

	// Setup Initial Post Processing FX
	//SetGodRays(1);
	SetHDR(1);
	SetSSAO(1);
	SetBloom(1);
	SetAntialias(1);
	SetStats(2);

	LoadScene("abstract::riverscene.sbx");

	// Setup spectator
	TBody spectator=CreateBodySphere();
	SetBodyMass(spectator,1);
	SetBodyGravityMode(spectator,0);
	SetBodyDamping(spectator,1.0);
	EntityType(spectator,3);
	SetBodyBuoyancyMode(spectator,0);
	PositionEntity(spectator,Vec3(0,5,-10));

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

	HideMouse();
	MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

	// MAIN LOOP
	while (!KeyHit(KEY_ESCAPE))
	{

	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(cam,camrotation);

	move=KeyDown(KEY_W)-KeyDown(KEY_S);
	strafe=KeyDown(KEY_D)-KeyDown(KEY_A);
	TVec3 force = Vec3(strafe*10.0,0,move*10.0);
	force=TFormVector(force,cam,0);
	AddBodyForce(spectator,force);

	PositionEntity(cam,EntityPosition(spectator));

	// Update timing and world
	UpdateFramework();

	// Render
	RenderFramework();

	// Send to screen
	Flip(0) ;
	}

	return Terminate();
}

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Well no, my english isn't really good :)

 

I wanna load it without using lua, just by code, as i told i already did the process scene for other things, but still don't know how implement road/river.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

Guest Red Ocktober

yes... opening up the .sbx file in notepad and searching for your river and road should key you into loading it the same way you did the other stuff...... if i'm not mistaken...

 

but...

 

why not take advantage of what's already there and let lua load the scene... you'll still be able to find each of the entities and manipulate em in c++...

 

--Mike

Link to comment
Share on other sites

I saw it there are voice called river node or road node.

In those string there is a voice called "data" (or something similar) and this is not saved as string, i am wondering how it saved.

If i could have the "specifications" in how it's saved i could load it.

Also i am not sure which kind of data those are, maybe are the mesh data.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

Josh would need to tell you how this is stored as the user data associated with the nodes is binary data and you would need to know the format.

  • Upvote 1

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Yeah that's was my question!

Thaks to "fix" my english! :)

 

But anyway i think i can use lua just to load the whole scene and forget about it! :)

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

You're welcome. Unless you are intending to modify this data in some way when loading it then I guess that is your best solution.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Well not necessary..

I just wanna get some data, that i have put on it using the editor but as now there is a command to seek all the entities i suppose it can be done later on.

 

I am an "old" LE coder, when i used it there wasn't this command so it was a little bit harder, also i did many commercial games and i admit that i never used an easy engine as Leadwerks, that's why i always try to do everything by myself!

 

Thanks again Pixel.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...