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

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:SetRotation(0,180,0)
camera:Move(0,1,-2)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

local model = Model:Load("Models/Characters/Barbarian/barbarian.mdl")
local material = Material:Load("Models/Characters/Barbarian/barbarian.mat")
local surface = model:FindSurface(material)
material:Release()

for v=0,surface:CountVertices()-1 do

surface:SetVertexColor(v,2,0.5,2,1)
end

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()
context:Sync()

end