Cylinder
This function creates s new cylinder shape.
Syntax
- static Shape* Cylinder(float x=0, float y=0, float z=0, float pitch=0, float yaw = 0, float roll=0, float width=1, float height =1, float depth=1)
Parameters
- x: x offset of the shape.
- y: y offset of the shape.
- z: z offset of the shape.
- pitch: x rotation of the shape.
- yaw: y rotation of the shape.
- roll: z rotation of the shape.
- width: size of the shape along the x axis.
- height: size of the shape along the y axis.
- depth: size of the shape along the z axis.
Returns
Returns a new shape.
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,-0.5);
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();
//Create a model
Model* model = Model::Cylinder();
model->SetPosition(0,5,0);
model->SetColor(0,0,1);
model->SetMass(1);
model->SetRotation(0,0,85);
//Create a shape
shape = Shape::Cylinder(0,0,0, 0,0,0, 1,1,1);
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;
}