2012-09-15 13:43:31 +00:00
|
|
|
#region Using Statements
|
|
|
|
using System;
|
2011-11-16 14:27:53 +00:00
|
|
|
using System.Collections.Generic;
|
2012-09-04 21:36:46 +00:00
|
|
|
using ANX.Framework.Graphics;
|
2011-11-16 14:27:53 +00:00
|
|
|
using ANX.Framework.NonXNA;
|
2012-09-15 13:43:31 +00:00
|
|
|
|
|
|
|
#endregion
|
2011-11-16 14:27:53 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// 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
|
2011-11-16 14:27:53 +00:00
|
|
|
|
2012-09-15 13:43:31 +00:00
|
|
|
using Dx10 = SharpDX.Direct3D10;
|
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
namespace ANX.RenderSystem.Windows.DX10
|
2011-11-16 14:27:53 +00:00
|
|
|
{
|
2012-09-15 13:43:31 +00:00
|
|
|
public class EffectTechnique_DX10 : INativeEffectTechnique
|
2012-09-04 21:36:46 +00:00
|
|
|
{
|
2012-10-13 13:12:07 +00:00
|
|
|
private readonly Effect parentEffect;
|
2015-10-14 23:59:27 +02:00
|
|
|
private readonly EffectPass[] effectPasses;
|
2012-09-15 13:43:31 +00:00
|
|
|
|
|
|
|
public EffectTechnique_DX10(Effect parentEffect, Dx10.EffectTechnique nativeTechnique)
|
|
|
|
{
|
|
|
|
if (parentEffect == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException("parentEffect");
|
|
|
|
}
|
|
|
|
|
|
|
|
this.parentEffect = parentEffect;
|
|
|
|
NativeTechnique = nativeTechnique;
|
2015-10-14 23:59:27 +02:00
|
|
|
|
|
|
|
var description = NativeTechnique.Description;
|
|
|
|
|
|
|
|
this.Name = description.Name;
|
|
|
|
|
|
|
|
var passCounts = description.PassCount;
|
|
|
|
this.effectPasses = new EffectPass[passCounts];
|
|
|
|
|
|
|
|
for (int i = 0; i < passCounts; i++)
|
|
|
|
{
|
|
|
|
this.effectPasses[i] = new EffectPass(new EffectPass_DX10(this.parentEffect, NativeTechnique.GetPassByIndex(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
var annotationCount = description.AnnotationCount;
|
|
|
|
var annotations = new EffectAnnotation[annotationCount];
|
|
|
|
for (int i = 0; i < annotationCount; i++)
|
|
|
|
annotations[i] = new EffectAnnotation(new DxEffectAnnotation(nativeTechnique.GetAnnotationByIndex(i)));
|
|
|
|
|
|
|
|
this.Annotations = new EffectAnnotationCollection(annotations);
|
2012-09-15 13:43:31 +00:00
|
|
|
}
|
|
|
|
|
2015-10-14 23:59:27 +02:00
|
|
|
public Dx10.EffectTechnique NativeTechnique { get; private set; }
|
|
|
|
|
2012-09-15 13:43:31 +00:00
|
|
|
public string Name
|
2015-10-14 23:59:27 +02:00
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
2012-09-04 21:36:46 +00:00
|
|
|
|
|
|
|
public IEnumerable<EffectPass> Passes
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2015-10-14 23:59:27 +02:00
|
|
|
return this.effectPasses;
|
2012-09-04 21:36:46 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-13 13:12:07 +00:00
|
|
|
|
|
|
|
public EffectAnnotationCollection Annotations
|
|
|
|
{
|
2015-10-14 23:59:27 +02:00
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
this.Dispose(true);
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void Dispose(bool disposeManaged)
|
|
|
|
{
|
|
|
|
if (disposeManaged)
|
|
|
|
{
|
|
|
|
if (NativeTechnique != null)
|
|
|
|
{
|
|
|
|
NativeTechnique.Dispose();
|
|
|
|
NativeTechnique = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var pass in this.effectPasses)
|
|
|
|
pass.NativeEffectPass.Dispose();
|
|
|
|
|
|
|
|
foreach (var annotation in this.Annotations)
|
|
|
|
annotation.NativeAnnotation.Dispose();
|
|
|
|
}
|
2012-10-13 13:12:07 +00:00
|
|
|
}
|
2015-10-14 23:59:27 +02:00
|
|
|
}
|
2011-11-16 14:27:53 +00:00
|
|
|
}
|