Load
This function loads a shape from a shape (*.phy) file.
Returns
Returns the loaded shape. If the shape cannot be loaded, NULL 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();
camera->SetRotation(35,0,0);
camera->Move(0,0,-6);
Light* light = DirectionalLight::Create();
light->SetRotation(35,35,0);
//Create the ground
Model* ground = Model::Box(10,1,10);
ground->SetPosition(0,-0.5,0);
ground->SetColor(0,1,0);
//Create a shape
Shape* shape = Shape::Box(0,0,0, 0,0,0, 10,1,10);
ground->SetShape(shape);
shape->Release();
//Load a model
Model* model = Model::Load("Models/Containers/oildrum.mdl");
model->SetPosition(0,5,0);
model->SetRotation(45,45,0);
model->SetMass(1);
//Load a shape and apply it to the model
shape = Shape::Load("Models/Containers/oildrum_convexhull.phy");
model->SetShape(shape);
shape->Release();
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
return 0;
}