forked from andkok/MWS_2021
turtle3D dodanie modeli unity dla slonecznika
This commit is contained in:
parent
61af639af1
commit
00795b7141
22
unity_artifitial_world-st/Assets/LSystem/Vogel.txt
Normal file
22
unity_artifitial_world-st/Assets/LSystem/Vogel.txt
Normal file
@ -0,0 +1,22 @@
|
||||
#axiom
|
||||
C(0)
|
||||
#rules
|
||||
|
||||
|
||||
# kat 137.3 nie daje takie optymalnego upakowania parastychow - jest tylko jedna strona spirali i dziury pomiedzy nimi
|
||||
# kat 147.6 nalogicznie jedna strona spirali nieupakowanych optymalnie tylko ida w przeciwnym kieruku (kierunke nie zgodny z zegarem)
|
||||
# http://algorithmicbotany.org/papers/abop/abop-ch4.pdf
|
||||
|
||||
# S rysuje sfere - kulke najmldosze kwiatki najbardziej w srodku
|
||||
C(n) : n<100 -> C(n+1)[+(137.5*n)f(0.03*n^0.5)S]
|
||||
|
||||
# Y - kwiatki takie bardizje rozwiniete z czubkami
|
||||
C(n) : n<200 ; n>= 100 -> C(n+1)[+(137.5*n)f(0.03*n^0.5)Y]
|
||||
|
||||
# A -dorosly kwiat
|
||||
C(n) : n<300 ; n>=200 -> C(n+1)[+(137.5*n)f(0.03*n^0.5)A]
|
||||
|
||||
# p - petal czyli platek
|
||||
C(n) : n>=300 -> C(n+1)[+(137.5*n)f(0.03*n^0.5)P]
|
||||
|
||||
#rules end
|
7
unity_artifitial_world-st/Assets/LSystem/Vogel.txt.meta
Normal file
7
unity_artifitial_world-st/Assets/LSystem/Vogel.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e12b0b07289743148af373876bac0d6c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
unity_artifitial_world-st/Assets/LSystem/sunflower.txt
Normal file
19
unity_artifitial_world-st/Assets/LSystem/sunflower.txt
Normal file
@ -0,0 +1,19 @@
|
||||
#axiom
|
||||
C(0)
|
||||
# F++F++F++
|
||||
#rules
|
||||
|
||||
|
||||
#i - wartosc indesku wpisywane a pozniej wykorzstywana
|
||||
# środkowe najmniej dorosle kwiatki - sam srodek - sfery/kulki
|
||||
C(i) : i < 200 -> C(i+1)[S(i)]
|
||||
|
||||
# drugie bardzije rozwiniete kwiatki
|
||||
C(i) : i < 400 -> C(i+1)[Y(i)]
|
||||
|
||||
# ostatnie ze srodka dorosle kwiatki
|
||||
C(i) : i < 600 -> C(i+1)[O(i)]
|
||||
|
||||
# P - petal platek
|
||||
c(i) -> C(i+1)[P(i)]
|
||||
#end rules
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 767ae3f3081ae9c4e8a7f183409d8f32
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ using System;
|
||||
public class Turtle3D : TurtleLSystem {
|
||||
public GameObject obj;
|
||||
public GameObject sphere;
|
||||
public GameObject flower;
|
||||
public float angle;
|
||||
|
||||
private Func<float[], Matrix4x4> _roation(Vector3 axis) {
|
||||
@ -28,6 +29,19 @@ public class Turtle3D : TurtleLSystem {
|
||||
//turtleInterpretation
|
||||
var transformation = Matrix4x4.Translate(new Vector3(0.0f, 0.1f, 0)) * Matrix4x4.Scale(new Vector3 (0.05f, 0.1f, 0.05f));
|
||||
|
||||
|
||||
// import modeli z gry do rysowania - AnabaenaTurtle.cs ma import z glownej sciezki
|
||||
var path = "Assets/Models/sunflower/{0}.fbx"; // nazwa.fbx
|
||||
// srodek najmlodszy kwiatek - domyslnmie tutaj C i sfera
|
||||
var bud = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "bud"), typeof(GameObject));
|
||||
// drugi najmblodszy kwiatek
|
||||
var flower_young = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "flower_young"), typeof(GameObject));
|
||||
// dorosły kwiat - na końcu
|
||||
var flower_old = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "flower_old"), typeof(GameObject));
|
||||
// petal - płatek
|
||||
var petal = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "petal"), typeof(GameObject));
|
||||
|
||||
|
||||
//turtleInterpretation.Add("+", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(0, 0, -angle))));
|
||||
//turtleInterpretation.Add("-", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Rotate(Quaternion.Euler(0, 0, angle))));
|
||||
|
||||
@ -49,7 +63,34 @@ public class Turtle3D : TurtleLSystem {
|
||||
|
||||
turtleInterpretation.Add("f", (float[] args) => new Tuple<GameObject, Matrix4x4>(null, Matrix4x4.Translate(Vector3.up * args[0])));
|
||||
|
||||
turtleInterpretation.Add("S", (float[] args) => new Tuple<GameObject, Matrix4x4>(sphere,Matrix4x4.identity));
|
||||
// odpowiada za rysowanie kulek ze słonecznika - po pierwszej ewoluacji wychodzi sfera/kulka mała ze słonecznika
|
||||
// jakoś podpiete są pod symbole obiekty/modele z Unity
|
||||
// turtleInterpretation.Add("S", (float[] args) => new Tuple<GameObject, Matrix4x4>(sphere,Matrix4x4.identity));
|
||||
// turtleInterpretation.Add("S", (float[] args) => new Tuple<GameObject, Matrix4x4>(flower,Matrix4x4.identity));
|
||||
turtleInterpretation.Add("S", (float[] args) => new Tuple<GameObject, Matrix4x4>(bud,Matrix4x4.identity));
|
||||
|
||||
// słonecznik modele do symboli
|
||||
//Y - młode kwiatki drugie od śrdoka słonecznika
|
||||
// turtleInterpretation.Add("Y", (float[] args) => new Tuple<GameObject, Matrix4x4>(Flower, Matrix4x4.identity));
|
||||
|
||||
|
||||
// negowanie symbolu C, żeby w słoneczniku Vogel.txt nie dostawać pierwszego cylidra jako obiektu unity
|
||||
// Vogel.txt parastychy - te spirale w srodku paratychy (l.poij) kilka parastychów
|
||||
// parastychów jest tyle bo liczba ich jest taka jak kolejne liczby ciągu fibonacciego
|
||||
// http://algorithmicbotany.org/papers/abop/abop-ch4.pdf
|
||||
turtleInterpretation.Add("C", (float[] args) => new Tuple<GameObject, Matrix4x4>(bud, transformation));
|
||||
|
||||
// Y - bardziej rozwiniete - mlode kwiatki
|
||||
turtleInterpretation.Add("Y", (float[] args) => new Tuple<GameObject, Matrix4x4>(flower_young, transformation));
|
||||
|
||||
//litera O albo sybol A- dorole kwiatki
|
||||
turtleInterpretation.Add("O", (float[] args) => new Tuple<GameObject, Matrix4x4>(flower_old, transformation));
|
||||
turtleInterpretation.Add("A", (float[] args) => new Tuple<GameObject, Matrix4x4>(flower_old, transformation));
|
||||
|
||||
|
||||
// P - petla płatki
|
||||
turtleInterpretation.Add("P", (float[] args) => new Tuple<GameObject, Matrix4x4>(petal, transformation));
|
||||
|
||||
|
||||
|
||||
//Wildcard how to represent any other symbol
|
||||
|
@ -9,10 +9,10 @@ EditorUserSettings:
|
||||
value: 22424703114646680e0b0227036c73230f040c2f217a027e38271427fb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c73230f040c2f217b027e38271427fb
|
||||
value: 22424703114646680e0b0227036c73230f040c2f210b293e392c0527acf53a31f6fe
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c73230f040c2f210b293e392c0527acf53a31f6fe
|
||||
value: 22424703114646680e0b0227036c73230f040c2f217b027e38271427fb
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
Loading…
Reference in New Issue
Block a user