// Start is called before the first frame update void Start() { //Isn't this what we wanted to avoid via the L_System Laboratory? //Soon we will find ourselves re-compiling and twisting these parameters endlessly, rather than an interactive editor... ObjectModule leaf_module = new ObjectModule('O', 0, 1, GrowthList.LOGISTIC, "Prefabs/ModuleObjects/ManilkaraLeaf"); leaf_module.scale = Vector3.one * 5f; MeshModule stem_module = new MeshModule('F', 0, 1, GrowthList.LINEAR); RotationModule rotation_module = new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(0, 0, 1), 75f); SystemModule branch_open_module = new BranchModule('[', 0, 1, GrowthList.NON_DEVELOPMENTAL, true); SystemModule branch_close_module = new BranchModule(']', 0, 1, GrowthList.NON_DEVELOPMENTAL, false); List <SystemModule> main_axis = new List <SystemModule>(); main_axis.Add(stem_module); for (int i = 0; i < BranchWhorls; i++) { main_axis.Add(branch_open_module); main_axis.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, new Vector3(0, 1, 0), i * 360f / BranchWhorls)); main_axis.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(0, 0, 1), 90f)); main_axis.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); main_axis.Add(branch_close_module); } main_axis.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, Vector3.up, 45f)); main_axis.Add(new ApexModule('1', 0, 1, GrowthList.LOGISTIC, "Prefabs/ModuleObjects/Apex")); system.Productions.Add('1', main_axis); List <SystemModule> whorl_axis = new List <SystemModule>(); whorl_axis.Add(stem_module.CopyModule()); whorl_axis.Add(branch_open_module.CopyModule()); whorl_axis.Add(new ApexModule('3', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); whorl_axis.Add(branch_close_module.CopyModule()); whorl_axis.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); system.Productions.Add('2', whorl_axis); List <SystemModule> flowering_axis = new List <SystemModule>(); flowering_axis.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(0, 0, 1), -90f)); flowering_axis.Add(stem_module.CopyModule()); flowering_axis.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, Vector3.up, 90f)); system.Productions.Add('3', flowering_axis); List <SystemModule> leaf_whorl = new List <SystemModule>(); for (int i = 0; i < 4; i++) { leaf_whorl.Add(branch_open_module.CopyModule()); leaf_whorl.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, Vector3.right, -45f)); leaf_whorl.Add(leaf_module.CopyModule()); leaf_whorl.Add(branch_close_module.CopyModule()); leaf_whorl.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, Vector3.up, 90f)); } leaf_whorl.Add(stem_module.CopyModule()); system.Productions.Add('M', leaf_whorl); }
// Start is called before the first frame update void Start() { MeshModule mm = new MeshModule('M', 0, 1, GrowthList.LINEAR); RotationModule rm = new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(0, 0, 1), 75f); SystemModule bom = new BranchModule('[', 0, 1, GrowthList.NON_DEVELOPMENTAL, true); SystemModule bcm = new BranchModule(']', 0, 1, GrowthList.NON_DEVELOPMENTAL, false); List <SystemModule> lm = new List <SystemModule>(); lm.Add(mm); lm.Add(bom); lm.Add(rm); lm.Add(mm.CopyModule()); lm.Add(new ApexModule('1', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); lm.Add(bcm); lm.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); mesh_system.Productions.Add('1', lm); List <SystemModule> lm2 = new List <SystemModule>(); lm2.Add(mm.CopyModule()); lm2.Add(bom.CopyModule()); lm2.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(0, 0, 1), -75f)); lm2.Add(mm.CopyModule()); lm2.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); lm2.Add(bcm.CopyModule()); lm2.Add(new ApexModule('1', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); mesh_system.Productions.Add('2', lm2); }
// Start is called before the first frame update void Start() { LineModule stem_module = new LineModule('F', 0, 1, GrowthList.LINEAR); stem_module.LineWidth = 0.5f; stem_module.LineLength = 5.0f; //MeshModule stem_module = new MeshModule('M', 0, 1, GrowthList.LINEAR); //stem_module.x = 0.1f; //stem_module.y = 1f; //stem_module.z = 0.1f; RotationModule rotation_module = new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, new Vector3(0, 0, 1), 0f, true); SystemModule branch_open_module = new BranchModule('[', 0, 1, GrowthList.NON_DEVELOPMENTAL, true); SystemModule branch_close_module = new BranchModule(']', 0, 1, GrowthList.NON_DEVELOPMENTAL, false); ObjectModule leaf_module = new ObjectModule('O', 0, 1, GrowthList.LOGISTIC, "Prefabs/ModuleObjects/ManilkaraLeaf"); leaf_module.scale = Vector3.one * 2.5f; List <SystemModule> main_axis = new List <SystemModule>(); //main_axis.Add(branch_open_module); main_axis.Add(rotation_module); main_axis.Add(stem_module); main_axis.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/PlatformApex")); //main_axis.Add(branch_close_module); main_axis.Add(new ApexModule('1', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/Apex")); system.Productions.Add('1', main_axis); List <SystemModule> platform_axis = new List <SystemModule>(); platform_axis.Add(branch_open_module); platform_axis.Add(rotation_module); platform_axis.Add(stem_module); platform_axis.Add(new PhysicsMoverModule('3', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/LeafWhorlMover")); platform_axis.Add(branch_close_module); system.Productions.Add('2', platform_axis); List <SystemModule> leaf_whorl = new List <SystemModule>(); leaf_whorl.Add(branch_open_module); for (int i = 0; i < 4; i++) { leaf_whorl.Add(branch_open_module.CopyModule()); leaf_whorl.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, Vector3.right, -45f, false)); leaf_whorl.Add(leaf_module.CopyModule()); leaf_whorl.Add(branch_close_module.CopyModule()); leaf_whorl.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, Vector3.up, 90f, false)); } leaf_whorl.Add(branch_close_module); system.Productions.Add('3', leaf_whorl); ApexModule axiom_apex = system.Axiom as ApexModule; turtle.TurtleAnalysis(0f); axiom_apex.Apex.ActivateApex(); }
// Start is called before the first frame update void Start() { //Set the axiom's current age to 1 so that it derives at time 0 system.Axiom = new ApexModule('1', 1, 1, GrowthList.LOGISTIC, "Prefabs/ModuleObjects/AubrevilleApex", true); turtle.apexStack.Push(system.Axiom as ApexModule); system.Axiom.InstantiateModule(turtle); ApexModule am = (system.Axiom as ApexModule); am.Children.RemoveAt(am.Children.Count - 1); ObjectModule leaf_module = new ObjectModule('O', 0, 1, GrowthList.LOGISTIC, "Prefabs/ModuleObjects/ManilkaraLeaf"); leaf_module.scale = Vector3.one * 3f; MeshModule stem_module = new MeshModule('F', 0, 1, GrowthList.LINEAR); BezierMeshModule branch_module = new BezierMeshModule('F', 0, 1, GrowthList.LINEAR); branch_module.apposition = true; BezierMeshModule flowering_branch = new BezierMeshModule('F', 0, 1, GrowthList.LINEAR); flowering_branch.height = 0.25f; RotationModule rotation_module = new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(0, 0, 1), 75f); SystemModule branch_open_module = new BranchModule('[', 0, 1, GrowthList.NON_DEVELOPMENTAL, true); SystemModule branch_close_module = new BranchModule(']', 0, 1, GrowthList.NON_DEVELOPMENTAL, false); SystemModule branch_close_module_no_apex = new BranchModule(']', 0, 1, GrowthList.NON_DEVELOPMENTAL, false, false); List <SystemModule> main_axis = new List <SystemModule>(); main_axis.Add(stem_module); for (int i = 0; i < BranchWhorls; i++) { main_axis.Add(branch_open_module); main_axis.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, new Vector3(0, 1, 0), i * 360f / BranchWhorls)); main_axis.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(1, 0, 0), 90f)); main_axis.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/AubrevilleApex")); main_axis.Add(branch_close_module); } main_axis.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, Vector3.up, 45f)); main_axis.Add(branch_open_module.CopyModule()); main_axis.Add(new ApexModule('1', 0, 1, GrowthList.LOGISTIC, "Prefabs/ModuleObjects/AubrevilleApex", true)); main_axis.Add(branch_close_module.CopyModule()); system.Productions.Add('1', main_axis); List <SystemModule> whorl_axis = new List <SystemModule>(); whorl_axis.Add(branch_module.CopyModule()); whorl_axis.Add(branch_open_module.CopyModule()); whorl_axis.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(1, 0, 0), -90f)); whorl_axis.Add(new ApexModule('3', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/AubrevilleApex")); whorl_axis.Add(branch_close_module.CopyModule()); whorl_axis.Add(branch_open_module.CopyModule()); whorl_axis.Add(new ApexModule('2', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/AubrevilleApex")); whorl_axis.Add(branch_close_module.CopyModule()); system.Productions.Add('2', whorl_axis); List <SystemModule> flowering_axis = new List <SystemModule>(); flowering_axis.Add(flowering_branch.CopyModule()); flowering_axis.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, Vector3.up, 90f)); flowering_axis.Add(branch_open_module.CopyModule()); flowering_axis.Add(new ApexModule('4', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/AubrevilleApex")); flowering_axis.Add(branch_close_module.CopyModule()); system.Productions.Add('3', flowering_axis); List <SystemModule> leaf_whorl = new List <SystemModule>(); leaf_whorl.Add(new PhysicsMoverModule('M', 0, 1, GrowthList.LINEAR, "Prefabs/ModuleObjects/AubrevilleLeafWhorl")); for (int i = 0; i < 4; i++) { leaf_whorl.Add(branch_open_module.CopyModule()); leaf_whorl.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, Vector3.right, -45f)); leaf_whorl.Add(leaf_module.CopyModule()); leaf_whorl.Add(branch_close_module_no_apex.CopyModule()); leaf_whorl.Add(new RotationModule('+', 0, 1, GrowthList.NON_DEVELOPMENTAL, Vector3.up, 90f)); } system.Productions.Add('4', leaf_whorl); }