For those who want to test it but are too lazy to do the code
Code: Select all
#include "Irrlicht.h"
using namespace irr;
using namespace video;
using namespace scene;
#pragma comment (lib, "Irrlicht.lib")
void makeCubeArray(int arrSize, f32 cubeSize, f32 spacing, scene::ISceneManager* smgr)
{
float off = (arrSize * (cubeSize + spacing)) / 2;
for (int i = 0; i < arrSize; i++)
{
for (int j = 0; j < arrSize; j++)
{
for (int k = 0; k < arrSize; k++)
{
scene::IMeshSceneNode* node = smgr->addCubeSceneNode(cubeSize);
node->setPosition(core::vector3df(
(i * (cubeSize + spacing)) - off,
(j * (cubeSize + spacing)) - off,
(k * (cubeSize + spacing)) - off));
if (node)
node->setMaterialFlag(video::EMF_LIGHTING, false);
}
}
}
}
int main()
{
IrrlichtDevice* device = createDevice(EDT_DIRECT3D9);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();
cam->setPosition(core::vector3df(0,0,0));
cam->setTarget(core::vector3df(0,0,0));
makeCubeArray(100, 10, 10, smgr);
core::stringw title;
while (device->run()) if (device->isWindowActive())
{
driver->beginScene(true,true,SColor(255,200,200,200));
smgr->drawAll();
title = L"FPS :";
title += driver->getFPS();
device->setWindowCaption(title.c_str());
driver->endScene();
}
smgr->clear();
device->drop();
}
In my case I tried with 27 000 cubescene node before the makeCubeArray I got exactly 13 888K after the creation of the cube scene node 54 620K so approximatly 1.5K per node.
with the folowing line (I computed the size of member involved in the creation) :
Code: Select all
int memory = sizeof(SMaterial) + sizeof(IMeshSceneNode) + sizeof(f32) + sizeof(SMesh) + sizeof(SMeshBuffer)+ sizeof(S3DVertex)*12 + sizeof(u16)*36;
I got 1108 Bytes and I should have missed some other variable so they are no more mystery behind it .. I think . And Blindside this result is on the loading no matter what the angle of the camera. But may be FPS performance can improve.