2012-10-13 13:12:07 +00:00
|
|
|
using System;
|
2012-09-14 06:19:05 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using ANX.Framework.Graphics;
|
|
|
|
using ANX.Framework.NonXNA;
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
|
|
|
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
|
|
|
|
namespace ANX.RenderSystem.GL3
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Native OpenGL implementation of an effect technique.
|
|
|
|
/// </summary>
|
|
|
|
public class EffectTechniqueGL3 : INativeEffectTechnique
|
|
|
|
{
|
|
|
|
#region Private
|
|
|
|
/// <summary>
|
|
|
|
/// The native shader handle.
|
|
|
|
/// </summary>
|
|
|
|
internal int programHandle;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The active attributes of this technique.
|
|
|
|
/// </summary>
|
|
|
|
internal ShaderAttributeGL3[] activeAttributes;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// We currently have only one pass per technique.
|
|
|
|
/// </summary>
|
|
|
|
private EffectPass pass;
|
|
|
|
|
2015-10-18 13:37:39 +02:00
|
|
|
private EffectGL3 parentEffect;
|
2012-09-14 06:19:05 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Public
|
2012-10-13 13:12:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The name of the effect technique.
|
|
|
|
/// </summary>
|
|
|
|
public string Name { get; private set; }
|
2012-09-14 06:19:05 +00:00
|
|
|
|
2012-10-13 13:12:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The passes of the technique.
|
|
|
|
/// </summary>
|
|
|
|
public IEnumerable<EffectPass> Passes
|
|
|
|
{
|
|
|
|
get { yield return pass; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public EffectAnnotationCollection Annotations
|
|
|
|
{
|
|
|
|
get { throw new NotImplementedException(); }
|
|
|
|
}
|
2015-10-18 13:37:39 +02:00
|
|
|
|
|
|
|
public EffectGL3 Parent
|
|
|
|
{
|
|
|
|
get { return parentEffect; }
|
|
|
|
}
|
2012-09-14 06:19:05 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
|
|
/// Create a ne effect technique object.
|
|
|
|
/// </summary>
|
2015-10-18 13:37:39 +02:00
|
|
|
internal EffectTechniqueGL3(EffectGL3 setParentEffect, string setName, int setProgramHandle)
|
2012-09-14 06:19:05 +00:00
|
|
|
{
|
|
|
|
parentEffect = setParentEffect;
|
|
|
|
Name = setName;
|
|
|
|
programHandle = setProgramHandle;
|
|
|
|
|
|
|
|
GetAttributes();
|
|
|
|
|
2015-10-18 13:37:39 +02:00
|
|
|
pass = new EffectPass(new EffectPassGL3(this));
|
2012-09-14 06:19:05 +00:00
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region GetAttributes
|
|
|
|
private void GetAttributes()
|
|
|
|
{
|
|
|
|
int attributeCount;
|
2015-02-20 14:49:45 +00:00
|
|
|
GL.GetProgram(programHandle, GetProgramParameterName.ActiveAttributes,
|
2012-09-14 06:19:05 +00:00
|
|
|
out attributeCount);
|
|
|
|
activeAttributes = new ShaderAttributeGL3[attributeCount];
|
|
|
|
for (int index = 0; index < attributeCount; index++)
|
|
|
|
{
|
|
|
|
activeAttributes[index] = new ShaderAttributeGL3(programHandle, index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
2015-10-18 13:37:39 +02:00
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2012-09-14 06:19:05 +00:00
|
|
|
}
|