Jump to content

Skybox in C++?


Birdman
 Share

Recommended Posts

I have a sbx which haves a skybox that works on the editor, on my c++ code the sky is totally black.

 

I checked the log and the enviroment object is loading OK.

 

Also i tried this:

//Set SkyBox

SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));

 

It results on the Shader of objects reflecting the Sky, but the sky i still black.

 

Im using:

TFramework fw=CreateFramework();

TEntity scene=LoadScene("..");

Loop

RenderFramework();

UpdateFramework();

Etc..

 

Maybe im missing something to initalize the enviroment on the Framework.

 

Any idea?

Link to comment
Share on other sites

For the C++ code when using the SetSkyBox() command, you have to set the background color: http://www.leadwerks.com/wiki/index.php?title=Framework#SetBackgroundColor. The default is Vec4(0,0,0,0). Set it to Vec4(1,1,1,1). The atmosphere script also does this.

 

For the C++ code when using the atmosphere object script, you need to make sure you are passing the framework to the lua state since the script is using the 'fw' framework variable:

TFramework framework=CreateFramework();

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

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

For the C++ code when using the atmosphere object script, you need to make sure you are passing the framework to the lua state since the script is using the 'fw' framework variable:

 

The scripts are loading OK, even the Atmosphere object of the Scene is loading, i can check that in the log, i already have that lines of code to setup script, most scripts do their work, except for the skybox.

 

I will check setting the background but im a bit lost on what im missing to be honest.

Link to comment
Share on other sites

I had to use the background command when I loaded it manually in my code or I too got a black sky, but as Mack suggests, if you have the atmosphere object in your level then the Lua script should take care of that.

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

I had the 4 LUA lines commented, now i got it workiong, since most scripts were working i didn't cared to check that until now.

Thanks for your response guys.

 

Edit:This lines were giving me problems with physics in general, vehicle related mostly, there was a script that was messing up my c++ code, thats why i had this lines commented, now i at least found the real problem, and got all working.

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...