forked from andkok/MWS_2021
chaber
This commit is contained in:
parent
1d982a7039
commit
d3cd1ddd53
BIN
materiałyHelloWorld/chaber.PNG
Normal file
BIN
materiałyHelloWorld/chaber.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
@ -0,0 +1,10 @@
|
|||||||
|
#axiom
|
||||||
|
l
|
||||||
|
#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: 93e007dbb11d5d242a5809faa044b47c
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,17 @@ public class Turtle3D : TurtleLSystem {
|
|||||||
|
|
||||||
protected override void initLiteralInterpretation() {
|
protected override void initLiteralInterpretation() {
|
||||||
turtleInterpretation = new Dictionary<string, Func<float[], Tuple<GameObject, Matrix4x4>>>();
|
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));
|
||||||
|
|
||||||
//turtleInterpretation
|
//turtleInterpretation
|
||||||
var transformation = Matrix4x4.Translate(new Vector3(0.0f, 0.1f, 0)) * Matrix4x4.Scale(new Vector3 (0.05f, 0.1f, 0.05f));
|
var transformation = Matrix4x4.Translate(new Vector3(0.0f, 0.1f, 0)) * Matrix4x4.Scale(new Vector3 (0.05f, 0.1f, 0.05f));
|
||||||
|
|
||||||
@ -20,6 +31,17 @@ public class Turtle3D : TurtleLSystem {
|
|||||||
|
|
||||||
//Wildcard how to represent any other symbol
|
//Wildcard how to represent any other symbol
|
||||||
turtleInterpretation.Add("*.*", (float[] args) => new Tuple<GameObject, Matrix4x4>(obj, transformation));
|
turtleInterpretation.Add("*.*", (float[] args) => new Tuple<GameObject, Matrix4x4>(obj, transformation));
|
||||||
|
|
||||||
|
// & - 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))));
|
||||||
|
// ^ 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
|
||||||
|
turtleInterpretation.Add("\\", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(0, -angle, 0))));
|
||||||
|
// / 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))));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,10 +6,13 @@ EditorUserSettings:
|
|||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
m_ConfigSettings:
|
m_ConfigSettings:
|
||||||
RecentlyUsedScenePath-0:
|
RecentlyUsedScenePath-0:
|
||||||
value: 22424703114646680e0b0227036c73230f040c2f217a027e38271427fb
|
value: 22424703114646680e0b0227036c73230f040c2f210b293e392c0527acf53a31f6fe
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedScenePath-1:
|
RecentlyUsedScenePath-1:
|
||||||
value: 22424703114646680e0b0227036c73230f040c2f210e343f200f143fe7ae2136ebf32f
|
value: 22424703114646680e0b0227036c73230f040c2f217a027e38271427fb
|
||||||
|
flags: 0
|
||||||
|
RecentlyUsedScenePath-2:
|
||||||
|
value: 22424703114646680e0b0227036c73230f040c2f217b027e38271427fb
|
||||||
flags: 0
|
flags: 0
|
||||||
vcSharedLogLevel:
|
vcSharedLogLevel:
|
||||||
value: 0d5e400f0650
|
value: 0d5e400f0650
|
||||||
|
Loading…
Reference in New Issue
Block a user