BlackBurn
Member
|
Multiple Boxes In a Scene
Hello everyone, my query is on the creating multiple boxes in a a scene say Box[0] .... Box[n] which i can access later on the main loop for gameplay and key board interrupt purpose. I saw a code in the tutorials of Ambient Occlusion as follows that generates randomly rotated boxes and spheres.
Code:
// This is to create the actual mesh
mbackground.create(1).base(0).create( Box(3 ),VTX_TEX0|VTX_NRM|VTX_TNG).reverse(); // create background box
mbox .create(1).base(0).create( Box(0.5),VTX_TEX0|VTX_NRM|VTX_TNG); // create box
mball .create(1).base(0).create(Ball(0.5),VTX_TEX0|VTX_NRM|VTX_TNG); // create ball
// This should set the material
mbackground.setMaterial(brick).setRender().setBox();
mbox .setMaterial(glass).setRender().setBox();
mball .setMaterial(glass).setRender().setBox();
// I didn't understand this piece of code with the "i"
// setup random matrixes
REPA(matrix_ball)matrix_ball[i].setRotateXY(RandomF(PI2),RandomF(PI2)).move(Random(mbackground.box));
REPA(matrix_box )matrix_box [i].setRotateXY(RandomF(PI2),RandomF(PI2)).move(Random(mbackground.box));
Say I want to stack a set of 10 blocks, usually i use it in a for loop with a matrix of box with variations in height.
And Draw it on the Render Loop.
|
|
09-09-2009 07:03 AM |
|
BlackBurn
Member
|
Re: Multiple Boxes In a Scene
To be frank, I am confused with the way of clubbing multiple meshes in a single way, could anyone post a very simple way of clubbing it?
Ambient Occlusion method shows a method and Custom Object shows another ( I don't get why the spheres are only 3 in number? Where is it mentioned?)!
|
|
09-09-2009 09:13 AM |
|
Esenthel
Administrator
|
Re: Multiple Boxes In a Scene
I dont exactly understand what are you requesting.
If you need to render a lot of the same boxes, then you can use only 1 mesh with different matrixes.
But if you need the boxes to be of different proportions, then you must create each mesh for them separately.
Quote:Ambient Occlusion method shows a method and Custom Object shows another ( I don't get why the spheres are only 3 in number? Where is it mentioned?)!
if you mean the custom object class tutorial from game basics, then look what World it loads. when youll check that world in the world editor youll notice that there are 3 items set (I guess barrels), the code uses those objects to create the items but not as usual items but as a custom class.
|
|
09-09-2009 11:05 AM |
|