本文整理汇总了C++中IAnimatedMeshSceneNode::setFrameLoop方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMeshSceneNode::setFrameLoop方法的具体用法?C++ IAnimatedMeshSceneNode::setFrameLoop怎么用?C++ IAnimatedMeshSceneNode::setFrameLoop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnimatedMeshSceneNode
的用法示例。
在下文中一共展示了IAnimatedMeshSceneNode::setFrameLoop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testTransparentVertexAlphaMore
bool testTransparentVertexAlphaMore(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice(driverType, dimension2d<u32>(160, 120));
if (!device)
return true;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
if (driver->getColorFormat() != video::ECF_A8R8G8B8)
{
device->closeDevice();
device->run();
device->drop();
return true;
}
logTestString("Testing driver %ls\n", driver->getName());
IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
IMeshSceneNode* cube = smgr->addCubeSceneNode(10.0f,0,-1,vector3df(-5,3,-15));
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
node->setMaterialTexture( 0, driver->getTexture("../media/sydney.bmp") );
}
if (cube)
{
cube->getMaterial(0).MaterialType = EMT_TRANSPARENT_VERTEX_ALPHA;
cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
cube->setMaterialFlag(EMF_LIGHTING, false);
smgr->getMeshManipulator()->setVertexColorAlpha(cube->getMesh(),128);
}
// second cube without texture
cube = smgr->addCubeSceneNode(10.0f,0,-1,vector3df(5,3,-15));
if (cube)
{
cube->getMaterial(0).MaterialType = EMT_TRANSPARENT_VERTEX_ALPHA;
cube->setMaterialFlag(EMF_LIGHTING, false);
smgr->getMeshManipulator()->setVertexColorAlpha(cube->getMesh(),128);
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-transparentVertexAlphaChannelMore.png", 99.18f);
device->closeDevice();
device->run();
device->drop();
return result;
}
示例2: addNinja
static ISceneNode* addNinja(ISceneManager* smgr, core::vector3df pos)
{
IAnimatedMeshSceneNode* ninja = smgr->addAnimatedMeshSceneNode(
smgr->getMesh("Assets/model/ninja/ninja.b3d"));
ninja->setFrameLoop(182, 204);
ninja->setMaterialFlag(video::EMF_LIGHTING, false);
ninja->setAnimationSpeed(12);
ninja->setPosition(pos);
return ninja;
}
示例3: main
/*
This is the main method. We can use void main() on every platform.
On Windows platforms, we could also use the WinMain method
if we would want to get rid of the console window, which pops up when
starting a program with main(), but to keep this example simple,
we use main().
*/
int main(int argc, char** argv)
{
/*
The most important function of the engine is the 'createDevice'
function. The Irrlicht Device can be created with it, which is the
root object for doing everything with the engine.
createDevice() has 7 paramters:
deviceType: Type of the device. This can currently be the Null-device,
the Software device, DirectX8, DirectX9, or OpenGL. In this example we use
EDT_SOFTWARE, but to try out, you might want to change it to
EDT_NULL, EDT_DIRECTX8 , EDT_DIRECTX9, or EDT_OPENGL.
windowSize: Size of the Window or FullscreenMode to be created. In this
example we use 640x480.
bits: Amount of bits per pixel when in fullscreen mode. This should
be 16 or 32. This parameter is ignored when running in windowed mode.
fullscreen: Specifies if we want the device to run in fullscreen mode
or not.
stencilbuffer: Specifies if we want to use the stencil buffer for drawing shadows.
vsync: Specifies if we want to have vsync enabled, this is only useful in fullscreen
mode.
eventReceiver: An object to receive events. We do not want to use this
parameter here, and set it to 0.
*/
IrrlichtDevice *device =
createDevice(EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
/*
Set the caption of the window to some nice text. Note that there is
a 'L' in front of the string. The Irrlicht Engine uses wide character
strings when displaying text.
*/
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
/*
Get a pointer to the video driver, the SceneManager and the
graphical user interface environment, so that
we do not always have to write device->getVideoDriver(),
device->getSceneManager() and device->getGUIEnvironment().
*/
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
/*
We add a hello world label to the window, using the GUI environment.
*/
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<int>(10,10,200,22), true);
/*
To display something interesting, we load a Quake 2 model
and display it. We only have to get the Mesh from the Scene
Manager (getMesh()) and add a SceneNode to display the mesh.
(addAnimatedMeshSceneNode()). Instead of writing the filename
sydney.md2, it would also be possible to load a Maya object file
(.obj), a complete Quake3 map (.bsp) or a Milshape file (.ms3d).
By the way, that cool Quake 2 model called sydney was modelled
by Brian Collins.
*/
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
/*
To let the mesh look a little bit nicer, we change its material a
little bit: We disable lighting because we do not have a dynamic light
in here, and the mesh would be totally black. Then we set the frame
loop, so that the animation is looped between the frames 0 and 310.
And at last, we apply a texture to the mesh. Without it the mesh
would be drawn using only a color.
*/
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
}
/*
To look at the mesh, we place a camera into 3d space at the position
(0, 30, -40). The camera looks from there to (0,5,0).
*/
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
/*
Ok, now we have set up the scene, lets draw everything:
We run the device in a while() loop, until the device does not
want to run any more. This would be when the user closed the window
or pressed ALT+F4 in windows.
*/
while(device->run())
{
//.........这里部分代码省略.........
示例4: CProcLoginEventReceiver
void
CProcTitle::Init()
{
// Get scean manager.
m_pSceneMgr = m_pDevice->getSceneManager();
if (!m_pSceneMgr)
{
return;
}
// Get gui environment
m_pGuiEnv = m_pDevice->getGUIEnvironment();
if (!m_pGuiEnv)
{
return;
}
m_pGuiEnv->addStaticText(L"ProcTitle", rect<int>(10,10,200,22), true);
//-----------------------------------------------------
//
// set event receiver
//
//-----------------------------------------------------
m_pEvtReceiver = new CProcLoginEventReceiver(this);
m_pDevice->setEventReceiver(m_pEvtReceiver);
//-----------------------------------------------------
//
// create light
//
//-----------------------------------------------------
m_pSceneMgr->addLightSceneNode(0,
core::vector3df(100,100,-100),
video::SColorf(1.0f, 1.0f, 1.0f, 1.0f),
1200.0f);
//-----------------------------------------------------
//
// object
//
//-----------------------------------------------------
// load water
{
/*scene::IAnimatedMesh* mesh;
scene::ISceneNode* node;
mesh = m_pSceneMgr->addHillPlaneMesh("myHill",
core::dimension2d<f32>(20,20),
core::dimension2d<u32>(40,40), 0, 0,
core::dimension2d<f32>(0,0),
core::dimension2d<f32>(10,10));
node = m_pSceneMgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
node->setPosition(core::vector3df(0,0,0));
node->setMaterialTexture(0, m_pDriver->getTexture("media/stones.jpg"));
node->setMaterialTexture(1, m_pDriver->getTexture("media/water.jpg"));
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);*/
}
// load sydney
{
IAnimatedMesh* pMesh;
IAnimatedMeshSceneNode* pNode;
// load mesh, mesh's ref count will be 1
pMesh = m_pSceneMgr->getMesh("media/sydney.md2");
// add node, mesh's ref count will be 2
pNode = m_pSceneMgr->addAnimatedMeshSceneNode(pMesh);
// load material
if (pNode)
{
pNode->setMaterialFlag(EMF_LIGHTING, false);
pNode->setFrameLoop(0, 310);
ITexture* pTexture = m_pDriver->getTexture("media/sydney.bmp");
pNode->setMaterialTexture(0, pTexture);
}
// create agent
m_pAgent = new CPlayer(this, pMesh, pNode, NULL, m_pSceneMgr);
}
// load dwarf
{
/*IAnimatedMesh* pMesh;
IAnimatedMeshSceneNode* pNode;
pMesh = m_pSceneMgr->getMesh("media/dwarf.x");
pNode = m_pSceneMgr->addAnimatedMeshSceneNode(pMesh);
pNode->setPosition(core::vector3df(30,0,0));
pNode->setScale(core::vector3df(0.5f,0.5f,0.5f));
pNode->setAnimationSpeed(15);
pNode->setName("dwarf");
pNode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); */
}
//-----------------------------------------------------
//.........这里部分代码省略.........
示例5: dns_cache_prune
void dns_cache_prune(DnsCache *c) {
usec_t t = 0;
assert(c);
/* Remove all entries that are past their TTL */
for (;;) {
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
DnsCacheItem *i;
i = prioq_peek(c->by_expiry);
if (!i)
break;
if (t <= 0)
t = now(CLOCK_BOOTTIME);
if (i->until > t)
break;
/* Take an extra reference to the key so that it
* doesn't go away in the middle of the remove call */
key = dns_resource_key_ref(i->key);
dns_cache_remove(c, key);
}
}
static int dns_cache_item_prioq_compare_func(const void *a, const void *b) {
const DnsCacheItem *x = a, *y = b;
if (x->until < y->until)
return -1;
if (x->until > y->until)
return 1;
return 0;
}
static int dns_cache_init(DnsCache *c) {
int r;
assert(c);
r = prioq_ensure_allocated(&c->by_expiry, dns_cache_item_prioq_compare_func);
if (r < 0)
return r;
r = hashmap_ensure_allocated(&c->by_key, &dns_resource_key_hash_ops);
if (r < 0)
return r;
return r;
}
static int dns_cache_link_item(DnsCache *c, DnsCacheItem *i) {
DnsCacheItem *first;
int r;
assert(c);
assert(i);
r = prioq_put(c->by_expiry, i, &i->prioq_idx);
if (r < 0)
return r;
first = hashmap_get(c->by_key, i->key);
if (first) {
LIST_PREPEND(by_key, first, i);
assert_se(hashmap_replace(c->by_key, first->key, first) >= 0);
} else {
r = hashmap_put(c->by_key, i->key, i);
if (r < 0) {
prioq_remove(c->by_expiry, i, &i->prioq_idx);
return r;
}
}
return 0;
}
static DnsCacheItem* dns_cache_get(DnsCache *c, DnsResourceRecord *rr) {
DnsCacheItem *i;
assert(c);
assert(rr);
LIST_FOREACH(by_key, i, hashmap_get(c->by_key, rr->key))
if (i->rr && dns_resource_record_equal(i->rr, rr) > 0)
return i;
return NULL;
}
static void dns_cache_item_update_positive(DnsCache *c, DnsCacheItem *i, DnsResourceRecord *rr, usec_t timestamp) {
assert(c);
assert(i);
assert(rr);
i->type = DNS_CACHE_POSITIVE;
//.........这里部分代码省略.........