public static Grammar SimpleBubble() { var grammar = new Grammar(); grammar.name = "SimpleBubble"; { var initRule = new Rule(); initRule.name = "BULB"; var s1 = new Replacement(); s1.id = "WHEEL"; var s2 = new Replacement(); s2.id = "BULB"; s2.transform *= Matrix4x4.Translate(new Vector3(2f, 0, 0)); s2.transform *= Matrix4x4.Rotate(Quaternion.Euler(new Vector3(0, 0, 95))); s2.transform *= Matrix4x4.Scale(new Vector3(0.9f, 0.9f, 1f)); initRule.replacements = new[] { s1, s2 }; grammar.startShape = "BULB"; grammar.AddRule(initRule); } { var squareRule = new Rule(); squareRule.name = "WHEEL"; var s1 = new Replacement(); s1.SetCircle(); var s2 = new Replacement(); s2.SetCircle(); s2.color = new HsvColor() { v = 1 }; s2.transform *= Matrix4x4.Scale(new Vector3(0.9f, 0.9f, 1f)); squareRule.replacements = new[] { s1, s2 }; grammar.AddRule(squareRule); } return(grammar); }
public static Grammar FourCircles() { var grammar = new Grammar(); grammar.name = "FourCircles"; { var initRule = new Rule(); initRule.name = "Circles"; var s1 = new Replacement(); s1.id = "FourCircles"; initRule.replacements = new[] { s1 }; grammar.startShape = "Circles"; grammar.AddRule(initRule); } { var squareRule = new Rule(); squareRule.name = "FourCircles"; var s1 = new Replacement(); s1.SetCircle(); s1.transform *= Matrix4x4.Translate(new Vector3(1.5f, 0, 0)); s1.transform *= Matrix4x4.Scale(new Vector3(0.9f, 0.9f, 1f)); s1.color = new HsvColor() { h = 60, s = 1, v = 1 }; var s2 = new Replacement(); s2.SetCircle(); s2.transform *= Matrix4x4.Translate(new Vector3(-1.5f, 0, 0)); s2.transform *= Matrix4x4.Scale(new Vector3(0.3f, 0.3f, 1f)); s2.color = new HsvColor() { h = 60, s = 0.1f, v = 1 }; var s3 = new Replacement(); s3.SetCircle(); s3.transform *= Matrix4x4.Translate(new Vector3(0, 1.5f, 0)); s3.transform *= Matrix4x4.Scale(new Vector3(0.5f, 0.5f, 1f)); s3.color = new HsvColor() { h = 60, s = -1, v = 0.5f }; var s4 = new Replacement(); s4.SetCircle(); s4.transform *= Matrix4x4.Translate(new Vector3(0f, -1.5f, 0)); s4.transform *= Matrix4x4.Scale(new Vector3(0.7f, 0.7f, 1f)); s4.color = new HsvColor() { h = 60, s = 0.1f, v = 1 }; squareRule.replacements = new[] { s1, s2, s3, s4 }; grammar.AddRule(squareRule); } return(grammar); }
public static Grammar UnitShapes() { var grammar = new Grammar(); grammar.name = "UnitShapes"; { var initRule = new Rule(); initRule.name = "init"; var s1 = new Replacement(); s1.id = "layer"; s1.transform *= Matrix4x4.Translate(new Vector3(0f, 0, 0)); var s2 = new Replacement(); s2.id = "layer"; s2.transform *= Matrix4x4.Translate(new Vector3(0f, 1, 0)); var s3 = new Replacement(); s3.id = "layer"; s3.transform *= Matrix4x4.Translate(new Vector3(0f, 2, 0)); initRule.replacements = new[] { s1, s2, s3 }; grammar.startShape = "init"; grammar.AddRule(initRule); } { var initRule = new Rule(); initRule.name = "layer"; var s1 = new Replacement(); s1.SetSquare(); s1.transform *= Matrix4x4.Translate(new Vector3(0f, 0, 0)); s1.color = new HsvColor() { h = 160, s = 1, v = 1 }; var s2 = new Replacement(); s2.SetCircle(); s2.transform *= Matrix4x4.Translate(new Vector3(0f, 0.25f, 0)); s2.color = new HsvColor() { h = 100, s = 1, v = 1 }; var s3 = new Replacement(); s3.SetTriangle(); s3.transform *= Matrix4x4.Translate(new Vector3(0f, 0.5f, 0)); s3.color = new HsvColor() { h = 60, s = 1, v = 1 }; initRule.replacements = new[] { s1, s2, s3 }; grammar.AddRule(initRule); } return(grammar); }