private static void init(ShaderI shader, Loader.LoadedCallbackMethod loadedCallback)
{
try
{
CameraConstant = shader.Variable("Camera");LightDirectionConstant = shader.Variable("LightDirection");LightColorConstant = shader.Variable("LightColor");TransformConstant = shader.Variable("Transform");DiffuseConstant = shader.Resource("Diffuse");
var elements = new List<BufferLayoutElement>();
elements.Add(new BufferLayoutElement(BufferLayoutElementTypes.Vector3, BufferLayoutElementUsages.Position, 0, 0, 0));elements.Add(new BufferLayoutElement(BufferLayoutElementTypes.Vector3, BufferLayoutElementUsages.Normal, 0, 0, 3));elements.Add(new BufferLayoutElement(BufferLayoutElementTypes.Vector2, BufferLayoutElementUsages.UV, 0, 0, 6));
BufferLayoutDesc = BufferLayoutDescAPI.New(elements);
BufferLayout = BufferLayoutAPI.New(shader, shader, BufferLayoutDesc);
}
catch (Exception e)
{
FailedToLoad = true;
Loader.AddLoadableException(e);
Dispose();
if (loadedCallback != null) loadedCallback(null, false);
return;
}
Loaded = true;
if (loadedCallback != null) loadedCallback(null, true);
}