This function will create a new sphere model using the specified parameters.
Returns a new sphere model.
#include "Leadwerks.h"
using namespace Leadwerks;
Light* light = NULL;
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();
camera->SetRotation(35, 0, 0);
camera->Move(0, 0, -6);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);
Model* model = NULL;
model = Model::Box();
model->SetColor(1.0, 0.0, 0.0);
model->SetPosition(-4, 0, 0);
model = Model::Cylinder();
model->SetColor(0.0, 1.0, 0.0);
model->SetPosition(-2, 0, 0);
model = Model::Cone();
model->SetColor(0.0, 0.0, 1.0);
model->SetPosition(0, 0, 0);
model = Model::Sphere();
model->SetColor(0.0, 1.0, 1.0);
model->SetPosition(2, 0, 0);
model = Model::Create();
model->SetColor(1.0, 0.0, 1.0);
model->SetPosition(4, 0, 0);
Surface* surface = model->AddSurface();
surface->AddVertex(-0.5, -0.5, 0, 0, 0, -1);
surface->AddVertex(0.5, -0.5, 0, 0, 0, -1);
surface->AddVertex(0.5, 0.5, 0, 0, 0, -1);
surface->AddVertex(-0.5, 0.5, 0, 0, 0, -1);
surface->AddTriangle(2, 1, 0);
surface->AddTriangle(0, 3, 2);
surface->UpdateAABB();
model->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
return 0;
}