forked from andkok/MWS_2021
symbole L i F sa gdzies zajete zmiana na K i P
This commit is contained in:
parent
0dddd2ed5e
commit
385aebdd15
10
unity_artifitial_world-st/Assets/LSystem/zadanie_chaber.txt
Normal file
10
unity_artifitial_world-st/Assets/LSystem/zadanie_chaber.txt
Normal file
@ -0,0 +1,10 @@
|
||||
#axiom
|
||||
lP
|
||||
#rules
|
||||
# l -> #stochastic
|
||||
# p=3 lL
|
||||
# p=1 [+rl]rl
|
||||
# p=1 [-rl]rl
|
||||
# p=1 R
|
||||
#stochastic end
|
||||
#rules end
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a0a2ef51e3bfb7408d7a3e5fcc2e05c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -14,15 +14,16 @@ public class Turtle3D : TurtleLSystem {
|
||||
turtleInterpretation = new Dictionary<string, Func<float[], Tuple<GameObject, Matrix4x4>>>();
|
||||
|
||||
var path = "Assets/Models/{0}.fbx";
|
||||
// obiekty takie jak L, R, l, r symbolizujące kwiaty i liście
|
||||
// wilekie L - liśc
|
||||
|
||||
var bigL = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "bigL"), typeof(GameObject));
|
||||
// wielkie R - kwiat
|
||||
var bigR = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "bigR"), typeof(GameObject));
|
||||
//male l, r odgałęzienia
|
||||
var l = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "l"), typeof(GameObject));
|
||||
var r = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "r"), typeof(GameObject));
|
||||
|
||||
var flower = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "Flower"), typeof(GameObject));
|
||||
var leaf = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "leaf"), typeof(GameObject));
|
||||
|
||||
//turtleInterpretation
|
||||
var transformation = Matrix4x4.Translate(new Vector3(0.0f, 0.1f, 0)) * Matrix4x4.Scale(new Vector3 (0.05f, 0.1f, 0.05f));
|
||||
|
||||
@ -34,7 +35,7 @@ public class Turtle3D : TurtleLSystem {
|
||||
|
||||
// & - obrót do góry względem osi X o kąt $\delta$ - args[0] zaiwera infiormacje o kącie powinny być w zmiennej Unity angle
|
||||
// x, y, z
|
||||
turtleInterpretation.Add("$", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(angle, 0, 0))));
|
||||
turtleInterpretation.Add("&", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(angle, 0, 0))));
|
||||
// ^ obrót o kąt -1*delta w osi X
|
||||
turtleInterpretation.Add("^", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(-angle, 0, 0))));
|
||||
// \ backslash obrót w prawo roll - obrót względem osi Y o kąt -delata
|
||||
@ -42,6 +43,14 @@ public class Turtle3D : TurtleLSystem {
|
||||
// / slash forward slash obrót w lewo - kąt -1*delta w osi Y
|
||||
turtleInterpretation.Add("/", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(0, -angle, 0))));
|
||||
|
||||
// gdzies walniete sa symbole L i F
|
||||
//dodanie obiektu kwiata z modeli Unity
|
||||
//kwiat K-kwiat, F gdzieś już jest zarezerwowane i pokazuje sie tylko łodyka dla wielkiego F
|
||||
turtleInterpretation.Add("K", (float[] args) => new Tuple<GameObject, Matrix4x4>(flower, Matrix4x4.Translate(new Vector3(0, 0, 0)) * Matrix4x4.Scale(new Vector3 (0.1f, 0.1f, 0.1f))));
|
||||
// L symbol liśc nie działa - proporcje trzeba zwiekszyc dla liscia
|
||||
turtleInterpretation.Add("P", (float[] args) => new Tuple<GameObject, Matrix4x4>(leaf, Matrix4x4.Translate(new Vector3(0, 0, 0)) * Matrix4x4.Scale(new Vector3 (1, 1, 1))));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user