41 lines
786 B
C#
41 lines
786 B
C#
using Godot;
|
|
using System.Reflection;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Rokojori
|
|
{
|
|
public class ShaderGenerationContext
|
|
{
|
|
public ShaderPhase phase;
|
|
|
|
|
|
public List<ShaderVariant> variants = new List<ShaderVariant>();
|
|
|
|
public ShaderGenerationContext()
|
|
{
|
|
variants.Add( new ShaderVariant() );
|
|
}
|
|
|
|
public void Add( List<ShaderCode> code )
|
|
{
|
|
if ( code == null || code.Count == 0 )
|
|
{
|
|
return;
|
|
}
|
|
|
|
var newVariants = new List<ShaderVariant>();
|
|
|
|
for ( int i = 0; i < variants.Count; i++ )
|
|
{
|
|
var v = variants[ i ];
|
|
|
|
for ( int j = 0; j < code.Count; j++ )
|
|
{
|
|
newVariants.Add( v.Extend( code[ j ] ) );
|
|
}
|
|
}
|
|
|
|
variants = newVariants;
|
|
}
|
|
}
|
|
} |