Hi ! From what i can see, there are two types of materials in the shader library : Predefined Materials and Predefined Surface Shaders
for an example of how to load a Predefined Surface Shader (a shader that uses a .fx file) follow this link to an example (there is also a download link to an example) : shader example
If you on the other hand want to assign a Predefined Material, then you only have to assign the corresponding EngVar. Here's an example :
Code:
using System;
using System.Collections.Generic;
using AcknexWrapper;
namespace ShaderTest
{
class Program
{
static void Main(string[] args)
{
EngFun.engine_open(null, null);
Scheduler.StartScheduler(MyMainMethod);
}
private static IEnumerable<ScheduleMethod> MyMainMethod()
{
// load an empty level
EngFun.level_load(null);
// create a cube (_CUBE.mdl is a predefined model - CUBE_MDL in lite-c)
ENTITY cube =
ENTITY.ent_create(
"_CUBE.mdl",
new Vector(60, -20, 0),
CubeMethod);
yield break;
}
private static IEnumerable<ScheduleMethod> CubeMethod(IntPtr p)
{
ENTITY cube =
ENTITY.createFromPointer(p);
// now assign the standard metal material
cube.material =
EngVar.mtl_metal;
// change the ambient vector of the standard metal material
EngVar.mtl_metal.ambient_red = 255;
while (true)
{
// rotate the cube
cube.pan += 2 * EngVar.time_step;
cube.tilt += 1.5 * EngVar.time_step;
// wait one frame
yield return 1;
}
}
}
}