GetSortMode

This function gets the material sort mode. Most materials with a blend mode other than Blend::Solid should use sorting to draw surfaces back to front.

Syntax

Returns

Returns true if the material is drawn sorted, 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();
Light* light = DirectionalLight::Create();
light->SetRotation(45, 35, 0);

Material* material = Material::Create();
material->SetColor(1, 1, 1, 0.5);
material->SetBlendMode(Blend::Alpha);
material->SetSortMode(true);
Debug::Assert(material->GetSortMode());// should always be true

Model* model = NULL;

model = Model::Box();
model->SetMaterial(material);
model->SetPosition(1.5, 0, 3);

model = Model::Box();
model->SetMaterial(material);
model->SetPosition(1.5, 0, 5);

model = Model::Box();
model->SetMaterial(material);
model->SetPosition(1.5, 0, 7);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
return 0;
}