AngouriMath
Navigation
Hlsl(System.Collections.Generic.IReadOnlyList{System.Collections.Generic.KeyValuePair{System.String,AngouriMath.Entity}},System.Collections.Generic.IReadOnlyDictionary{AngouriMath.Entity.Variable,System.String})
Method (no overloads)
Summary
HLSL statements assigning each output: float locals for the shared
subexpressions, then one assignment per output, in the order given.
subexpressions, then one assignment per output, in the order given.
Parameter "outputs"
The target of each assignment — a variable, an
out parameter, a swizzle such as n.x — and the expression it gets.
Parameter "names"
What each variable is called in the shader, such as p.x for x . A
variable not listed keeps its own name, which has to be an identifier.
variable not listed keeps its own name, which has to be an identifier.
Returns
The source, or which subexpression could not be printed faithfully and why.
Example
using System;
using System.Collections.Generic;
using AngouriMath;
Entity r = "sqrt(x^2 + y^2)";
var source = MathS.Shaders.Hlsl(new Dictionary<string, Entity>
{
["g.x"] = r.Differentiate("x"),
["g.y"] = r.Differentiate("y"),
}.ToList(), new Dictionary<Entity.Variable, string> { ["x"] = "p.x", ["y"] = "p.y" });
Console.Write(source.Code);Prints
float am0 = (0.5 * rsqrt(((p.x * p.x) + (p.y * p.y))));
g.x = (am0 * (2.0 * p.x));
g.y = (am0 * (2.0 * p.y));Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6003 pages online