FindSurface

This function will search for and return a surface with the specified material.

Syntax

Parameters

Returns

Returns the first surface found with the specified material. If no surface is found, NULL will be 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(0,180,0);
camera->Move(0,1,-2);
Light* light = DirectionalLight::Create();
light->SetRotation(35,35,0);

Model* model = Model::Load("Models/Characters/Barbarian/barbarian.mdl");
Material* material = Material::Load("Models/Characters/Barbarian/barbarian.mat");
Surface* surface = model->FindSurface(material);
material->Release();

for (int v=0; v < surface-> CountVertices(); v++)
{
surface->SetVertexColor(v,2,0.5,2,1);
}

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

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