This function creates a new box model with a physics collider.
Parameter | Description |
---|---|
world | world to create the model in |
size, (width, height, depth) | uniform size or dimensions of the box |
xsegs, ysegs, zsegs | number of segments on each axis |
type | can be MESH_TRIANGLES or MESH_QUADS |
For materials that use tessellation, set the quad parameter to true.
Returns a new model.
#include "UltraEngine.h"
using namespace UltraEngine;
int main(int argc, const char* argv[])
{
//Get the displays
auto displays = GetDisplays();
//Create a window
auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
//Create a world
auto world = CreateWorld();
//Create a framebuffer
auto framebuffer = CreateFramebuffer(window);
//Create a camera
auto camera = CreateCamera(world);
camera->SetClearColor(0.125);
camera->SetPosition(0, 0, -4);
//Create a light
auto light = CreateBoxLight(world);
light->SetRotation(45, 35, 0);
light->SetRange(-10, 10);
light->SetColor(2);
//Create a model
auto model = CreateBox(world);
model->SetColor(0, 0, 1);
//Main loop
while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
{
model->Turn(0, 1, 0);
world->Update();
world->Render(framebuffer);
}
return 0;
}