Exemplo n.º 1
0
 public void Write(ShaderGenerationContext context)
 {
     context.WriteLine($"#define __SAMPLETEXTURE{Name.ToUpper()}(uv) ");
     if (KeywordProperty.HasProperty(context, PropertyType.Texture, Name))
     {
         context.Write($"tex2D({Name}, uv)");
         context.WriteLine($"#define __HASETEXTURE{Name.ToUpper()} True");
     }
     else
     {
         context.Write($" float4({DefaultValue.x}, {DefaultValue.y}, {DefaultValue.z}, {DefaultValue.w})");
     }
 }
Exemplo n.º 2
0
        public void WriteAttributeDefinition(ShaderGenerationContext context, int attributeIndex, bool isFragmentShader)
        {
            context.WriteLine($"{DataTypeAndDimensionsString} {Name} : ");
            if (AttributeType == AttributeType.Anonymous)
            {
                context.Write($"COLOR1{attributeIndex}");
            }
            else
            {
                if (isFragmentShader && AttributeType == AttributeType.Position)
                {
                    context.Write("SV_POSITION");
                }
                else
                {
                    context.Write(AttributeType.ToString().ToUpper());
                }
            }

            context.Write(";");
        }