本文整理汇总了C++中IFileSystem::createMemoryReadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ IFileSystem::createMemoryReadFile方法的具体用法?C++ IFileSystem::createMemoryReadFile怎么用?C++ IFileSystem::createMemoryReadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileSystem
的用法示例。
在下文中一共展示了IFileSystem::createMemoryReadFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*
The start of the main function starts like in most other example. We ask the
user for the desired renderer and start it up. This time with the advanced
parameter handling.
*/
int main()
{
// create device with full flexibility over creation parameters
// you can add more parameters if desired, check irr::SIrrlichtCreationParameters
irr::SIrrlichtCreationParameters params;
params.DriverType= video::EDT_DIRECT3D9;
params.WindowSize=core::dimension2d<u32>(1024, 768);
IrrlichtDevice* device = createDeviceEx(params);
if (device == 0)
return 1; // could not create selected driver.
/*
First, we add standard stuff to the scene: A nice irrlicht engine
logo, a small help text, a user controlled camera, and we disable
the mouse cursor.
*/
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
gui::IGUIEnvironment* env = device->getGUIEnvironment();
IFileSystem* filesys = device->getFileSystem();
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
SKeyMap keyMap[4];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_BACKWARD;
keyMap[1].KeyCode = KEY_DOWN;
keyMap[2].Action = EKA_STRAFE_LEFT;
keyMap[2].KeyCode = KEY_LEFT;
keyMap[3].Action = EKA_STRAFE_RIGHT;
keyMap[3].KeyCode = KEY_RIGHT;
// add camera
camera = smgr->addCameraSceneNodeFPS(0,100.0f,0.5f, -1, keyMap, 4);
camera->setPosition(core::vector3df(-168, 283, -168));
camera->setTarget(core::vector3df(60,137,83));
camera->setFarValue(42000.0f);
// disable mouse cursor
device->getCursorControl()->setVisible(false);
// create event receiver
MyEventReceiver receiver;
device->setEventReceiver(&receiver);
smgr->setAmbientLight(video::SColorf(0.1,0.1,0.1,1));
ITerrainSceneNode* floorNode = smgr->addTerrainSceneNode(0, 0, -1, vector3df(0, 0, 0), vector3df(0, 0, 0), vector3df(1, 1, 1), SColor(255, 255, 255, 255), 5, ETPS_17, 0, true);
char floor[32 * 32] = {0};
IReadFile* floorfile = filesys->createMemoryReadFile(floor, sizeof(char) * 32 * 32, "m2");
floorNode->loadHeightMapRAW(floorfile);
//floorNode->setMaterialFlag(EMF_LIGHTING, false);
floorNode->setScale(vector3df(100, 1, 100));
floorNode->setPosition(vector3df(-800, 1, -800));
floorNode->getMaterial(0).EmissiveColor.set(255,10,10,10);
//floorNode->setVisible(false);
smgr->addSphereSceneNode(10);
tool = smgr->addSphereSceneNode(TOOL_R);
ISceneNodeAnimator* anim = smgr->createRotationAnimator(core::vector3df(0,1,0));
tool->addAnimator(anim);
tool->setPosition(vector3df(0, 120, 0));
tool->setMaterialFlag(EMF_WIREFRAME, true);
node = smgr->addTerrainSceneNode(0, 0, -1, vector3df(0, 0, 0), vector3df(0, 0, 0), vector3df(1, 1, 1), SColor(255, 255, 255, 255), 0, ETPS_17, 0, true);
for (int i = OFFSET; i < (MATERIAL_SIZE + OFFSET); ++i)
{
for (int j = OFFSET; j < (MATERIAL_SIZE + OFFSET); ++j)
{
material[i * REAL_SIZE + j] = 100;
}
}
file = filesys->createMemoryReadFile(material, sizeof(float) * REAL_SIZE * REAL_SIZE, "m1");
node->loadHeightMapRAW(file, 32, false, true, REAL_SIZE);
node->getMaterial(0).AmbientColor.set(255,0,0,255);
//node->getMaterial(0).Shininess = 20.0f;
//node->setMaterialFlag(EMF_LIGHTING, false);
//node->setMaterialFlag(EMF_WIREFRAME, true);
node->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
node->setPosition(vector3df(-OFFSET, 0, -OFFSET));
//.........这里部分代码省略.........