SetSkybox
This function can be used to set add a skybox to a camera. The sky will be drawn everywhere and appear behind all rendered objects.
Syntax
- void SetSkybox(Asset* asset)
- bool SetSkybox(const std::string& path)
Parameters
- asset: the material or texture to use for the skybox.
- path: the path to the material or texture to load.
Returns
The second function overload will return true if the asset is loaded, otherwise false is returned.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
//Set skybox
Texture* skybox = Texture::Load("Materials/Sky/skybox_texture.tex");
camera->SetSkybox(skybox);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) break;
Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
return 0;
}