content :
- 1. KornJungle : the headers and cpps needed
- 2. bin : precompiled binary and resources needed
![Image](https://kornwaretm.files.wordpress.com/2016/07/jungle.jpg?w=460)
how to use
firstly create the jungle node. this node require a terrain scene node for height reference.
Code: Select all
// create jungle.
// terrain texture is 256 x 256 scaled by 40.0
// lets create density of one tree every 8x8 pixel
jungleScene::Jungle *jungle =
new jungleScene::Jungle(
10240, // world size
8,// chunk size. "chunk size" * "chunk size" = "tree count per chunk"
16,// max tree dimension diameter
4,// tree circular detail
terrain,
smgr,
-1);
smgr->getRootSceneNode()->addChild(jungle);
jungle->getMaterial(0).setFlag(EMF_LIGHTING, false);
//jungle->getMaterial(0).setFlag(EMF_BACK_FACE_CULLING, false);
jungle->getMaterial(0).setTexture(0, driver->getTexture("./media/bark.png"));
jungle->getMaterial(0).MaterialType = EMT_SOLID;
jungle->getMaterial(1).setFlag(EMF_LIGHTING, false);
jungle->getMaterial(1).setFlag(EMF_BACK_FACE_CULLING, false);
jungle->getMaterial(1).setTexture(0,driver->getTexture("./media/leaf.png"));
jungle->getMaterial(1).MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
create a tree. for easier usage, a tree struct can be create to store all configuration. maybe a json file next time. pay attention on the last parameter. you can create a tree with "instant grow" means it suddenly mature and tall, or "growing slowly".
Code: Select all
jungle->addTreeAt(core::vector3df(cx, terrain->getHeight(cx,cy), cy),
16,// segment count per branch, the more the better curve
5,// min rotation allowed
30,// max rotation allowed
800.0f, // length
2, // branching count, how many branch may appear from single trunk
7.5f, // max radius, the widest radius
3, // ground root, max number of ground root.
200.0f, // leaf width. maximum leaf dimension
200.0f, // leaf height. maximum leaf dimension
2, // leaf segments, number of leaf segment (for now not working yet, just use 2, reserved for palm trees)
1.0, // leaf stiffness (not working for now, reserved to generate palm trees)
0, //leaf type, this is leaf texture selector, for now 0-7, next release user defined
0, // bark type, this is bark texture selector, for now 0-7, next release user defined
seed, // seed, random seed, integer value to make every tree unique
true // instant grow or use animated growing, bad if the chunk are too large since an update at a chunk means an update to whole tree collection in it.
);
check it here https://github.com/kornwaretm/korn-irrl ... -generator