本文整理汇总了C++中IAnimatedMeshSceneNode::setMaterialFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMeshSceneNode::setMaterialFlag方法的具体用法?C++ IAnimatedMeshSceneNode::setMaterialFlag怎么用?C++ IAnimatedMeshSceneNode::setMaterialFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnimatedMeshSceneNode
的用法示例。
在下文中一共展示了IAnimatedMeshSceneNode::setMaterialFlag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSceneObject
SceneObject* PhysicsSim::loadSceneObject(stringw mesh_file, stringw texture_file)
{
IAnimatedMesh *mesh = smgr->getMesh(mediaDirectory + mesh_file);
IAnimatedMeshSceneNode* Node = smgr->addAnimatedMeshSceneNode(mesh, smgr->getRootSceneNode());
stringw tex_file = texture_file;
if(tex_file == L"")
{
tex_file = mesh_file;
if(tex_file.find(".dae") > -1)
tex_file.remove(".dae");
if(tex_file.find(".3ds") > -1)
tex_file.remove(".3ds");
tex_file.append(".jpg");
}
tex_file = mediaDirectory + tex_file;
if(smgr->getFileSystem()->existFile(tex_file))
Node->setMaterialTexture(0, driver->getTexture(tex_file));
Node->setMaterialFlag(EMF_LIGHTING, true);
Node->setMaterialFlag(EMF_TEXTURE_WRAP, false);
Node->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
Node->addShadowVolumeSceneNode(0,-1,false);
Node->getMaterial(0).AmbientColor.set(255,255,255,255);
updateObjects();
return Node;
}
示例2: UpdateScene
void CScene::UpdateScene(vector<vector3df> otherClientPosition, ICameraSceneNode* camera)
{
ISceneManager* smgr=device->getSceneManager();
IVideoDriver* driver=device->getVideoDriver();
// 测试用
IAnimatedMesh* personMeshTest=smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* personNode = smgr->addAnimatedMeshSceneNode( personMeshTest );
if (!personMeshTest)
{
device->drop();
return ;
}
if (personNode)
{
personNode->setScale(vector3df(0.4f,0.4f,0.4f));
personNode->setPosition(vector3df(0.0f,10.0f,0.0f));
personNode->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
personNode->setMaterialFlag(EMF_LIGHTING, false);
personNode->getMaterial(0).Shininess=28.0f;
personNode->getMaterial(0).NormalizeNormals=true;
personNode->setMD2Animation ( scene::EMAT_STAND );
}
personMeshTest->setMaterialFlag(EMF_LIGHTING,false);
// 显示其他客户端
for (int i=0;i!=otherClientPosition.size();i++)
{
IAnimatedMesh* personMesh=smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* personNode = smgr->addAnimatedMeshSceneNode( personMesh );
if (!personMesh)
{
device->drop();
return ;
}
if (personNode && personNode->getPosition()!=camera->getPosition())
{
// personNode->setPosition(vector3df(10,20,0));
// personNode->setScale(vector3df(0.5,0.5,0.5));
personNode->setPosition(otherClientPosition[i]);
personNode->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
personNode->setMaterialFlag(EMF_LIGHTING, false);
personNode->getMaterial(0).Shininess=28.0f;
personNode->getMaterial(0).NormalizeNormals=true;
personNode->setMD2Animation ( scene::EMAT_STAND );
}
personMesh->setMaterialFlag(EMF_LIGHTING,false);
}
}
示例3: main
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(800, 600));
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
smgr->addCameraSceneNode(0, vector3df(0,10,-10), vector3df(0,5,0));
IAnimatedMesh* mesh = smgr->getMesh("ninja.b3d");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialTexture( 0, driver->getTexture("nskinrd.jpg") );
node->setRotation(vector3df(0,180,0)); // let ninja be in front to us
node->setJointMode(EJUOR_CONTROL); // tell irrlicht that you want to control joint positions
IBoneSceneNode* bone = node->getJointNode("Joint10"); // create IBoneSceneNode and select the desired bone
while(device->run()) {
bone->setRotation(bone->getRotation() + vector3df(1,0,0)); // rotate bone
driver->beginScene();
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
示例4: init
void TestLevel::init() {
IAnimatedMesh* mesh = smgr->getMesh("img/sydney.md2");
IAnimatedMeshSceneNode * tmpnode = smgr->addAnimatedMeshSceneNode(mesh);
if (tmpnode) {
tmpnode->setMaterialFlag(EMF_LIGHTING, false);
tmpnode->setMD2Animation(scene::EMAT_STAND);
tmpnode->setMaterialTexture(0, driver->getTexture("img/sydney.bmp"));
}
tmpnode->setPosition(vector3df(-222,0,0));
vector3df wsp(0,5,-10);
ship = new TestPlayerShip(TestPlayerShip::createTestPlayerShipNode(context));
ship->attachNewCamera(new StaticCamera(context,ship));
// ship.attachCamera(cam);
this->node = new NonPlayerShip(tmpnode);
testPlanet = Planet::createTestPlanet(context);
}
示例5: 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;
}
示例6: getModel
IAnimatedMeshSceneNode* getModel(ISceneManager* smgr, IVideoDriver* drv) {
//load mesh
IAnimatedMesh* mesh = smgr->getMesh("../model/box.obj");
//set mesh to new node
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
//if node is created, add some texture on it
if(node) {
node->setMaterialFlag(EMF_LIGHTING, false);
//node->setMaterialTexture(0,drv->getTexture("../model/kuva2.bmp"));
//node->setMaterialType( EMT_SOLID );
node->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
node->setMaterialFlag(EMF_FRONT_FACE_CULLING, false);
std::cout << "node ok\n";
}
return node;
}
示例7: 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;
}
示例8: main
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Have a go here: Chapter 3");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IAnimatedMesh* mesh = smgr->getMesh("/home/fuyajun/Documents/irrlicht-1.7.2/media/sydney.md2");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
MyAnimationEndCallback animEndCallback;
//连续动画
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture( 0, driver->getTexture("/home/fuyajun/Documents/irrlicht-1.7.2/media/sydney.bmp") );
node->setLoopMode(false);
node->setAnimationEndCallback(&animEndCallback);
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
示例9: example_helloworld
int example_helloworld()
{
// create device
IrrlichtDevice *device = startup();
if (device == 0)
return 1; // could not create selected driver.
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
/*
To let the mesh look a little bit nicer, we change its material. We
disable lighting because we do not have a dynamic light in here, and
the mesh would be totally black otherwise. Then we set the frame loop,
such that the predefined STAND animation is used. And 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->setMD2Animation(scene::EMAT_STAND);
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), which is
approximately the place where our md2 model is.
*/
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
EventReceiver_basic receiver(device);
device->setEventReceiver(&receiver);
return run ( device );
}
示例10: getParentNode
bool PlayerObject::initWithLevel(int level)
{
// IMesh* mesh = _assets->getMesh(PLAYER, MESH, 0);
// if (!mesh)
// return false;
//
// IMeshSceneNode* node = _smgr->addMeshSceneNode(mesh);
// _node = node;
// if (node)
// {
// node->setMaterialFlag(EMF_LIGHTING, true);
//// node->setMaterialFlag(EMF_FOG_ENABLE, true);
// node->setMaterialTexture(0, _assets->getTexture(PLAYER, TEXTURE, 0));
//// for (int i = 0; i < 9; i++)//TODO : comment faire pour ne pas mettre le nombre de textures en dur
//// {
//// node->setMaterialTexture(0, _ressources->getTexture(PLAYER, TEXTURE, 0));
//// }
//
// this->scaleOnCase();
// this->updateNodePosition();
// return true;
// }
_level = level;
IAnimatedMesh* mesh = static_cast<IAnimatedMesh*>(_assets->getMesh(PLAYER, MESH, _level));
if (!mesh)
return false;
IAnimatedMeshSceneNode* node = _smgr->addAnimatedMeshSceneNode(mesh, getParentNode(), NODE_ID_PLAYER);
_node = node;
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
// node->setMaterialFlag(EMF_FOG_ENABLE, true);
startNewAnim(EMAT_STAND, REPEAT);
startNewAnim(EMAT_SALUTE, ONCE);
// node->setMD2Animation(EMAT_STAND);
this->scaleOnCase();
this->updateNodePosition();
node->setMaterialTexture(0, _assets->getTexture(PLAYER, TEXTURE, _level));
return true;
}
return false;
}
示例11: main
int main()
{
eventReceiver receiver;
IrrlichtDevice *device = createDevice( video::EDT_OPENGL, dimension2d<u32>(1366, 768), 16,true, false, false,&receiver);
device->setWindowCaption(L"(WhizGeek || Mclightning).com");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
scene::ICameraSceneNode* kam= smgr->addCameraSceneNode(NULL,vector3df(0,0,200),vector3df(0,0,0));
//kam->setPosition(vector3df(0,0,200));
ISceneNode* kutu=smgr->addCubeSceneNode(50,0,2,vector3df(50,0,0));
ISceneNode* kutu2=smgr->addCubeSceneNode(50,0,2,vector3df(-50,0,0));
ITexture *duvar=driver->getTexture("wall.jpg");
kutu->setMaterialTexture(0,duvar);
kutu->setMaterialFlag(video::EMF_LIGHTING, false);
kutu2->setMaterialTexture(0,duvar);
kutu2->setMaterialFlag(video::EMF_LIGHTING, false);
IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
node->setRotation(vector3df(0,270,0));
irFinder ir("test",true,230,255);
CvPoint in;
while(device->run())
{
if(receiver.IsKeyDown(KEY_ESCAPE))
{
device->drop();
return 0;
}
driver->beginScene(true, true, SColor(255,0,0,255));
in=ir.yenile();
//node->setPosition(vector3df(30*in.x/320,30*(240-in.y)/240,0));
kam->setPosition(vector3df(in.x-160,(240-in.y),200));
smgr->drawAll();
driver->endScene();
}
device->drop();
}
示例12: md2Animation
/** At the moment, this just verifies that the last frame of the animation produces the expected bitmap. */
bool md2Animation(void)
{
// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
IrrlichtDevice *device = createDevice( EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
assert(device);
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
IAnimatedMeshSceneNode* node;
assert(mesh);
if(mesh)
{
node = smgr->addAnimatedMeshSceneNode(mesh);
assert(node);
if(node)
{
node->setPosition(vector3df(20, 0, 30));
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialTexture(0, driver->getTexture("../media/sydney.bmp"));
node->setLoopMode(false);
(void)smgr->addCameraSceneNode();
// Just jump to the last frame since that's all we're interested in.
node->setMD2Animation(EMAT_DEATH_FALLBACK);
node->setCurrentFrame((f32)(node->getEndFrame()));
device->run();
driver->beginScene(true, true, SColor(255, 255, 255, 0));
smgr->drawAll();
driver->endScene();
}
}
bool result = takeScreenshotAndCompareAgainstReference(driver, "-md2Animation.png");
device->drop();
return result;
}
示例13: main
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
cout<<"error";
else
{
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
}
cout<<"hello world2";
}
示例14: produce
void AnnyFactory::produce(int x,int y,int z){
std::string sydneyMesh = "monkey.obj";
std::string sydneyMaterial = "unwrappedPainted.png";//"monkey.bmp";
IAnimatedMesh* mesh = sceneManager->getMesh((RESOURCES+sydneyMesh).c_str());
if (!mesh)
{
exit(1);
}
IAnimatedMeshSceneNode* node = sceneManager->addAnimatedMeshSceneNode( mesh );
const wchar_t* name = L"Monkey head";
objectList->addObject(name);
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_RUN);
node->setMaterialTexture( 0, driver->getTexture((RESOURCES+sydneyMaterial).c_str()) );
node->setName(name);
node->setPosition(core::vector3df(x,y,z));
node->setScale(core::vector3df(10,10,10));
node->setRotation(core::vector3df(0,200,0));
}
}
示例15: createTank
void CRaycastTankExample::createTank(const stringw file, const stringw collFile, const vector3df &pos, const f32 mass)
{
IAnimatedMeshSceneNode *Node = device->getSceneManager()->addAnimatedMeshSceneNode(
device->getSceneManager()->getMesh(file.c_str()));
Node->setPosition(pos);
//Node->setRotation(vector3df(-40,90,0));
Node->setMaterialFlag(video::EMF_LIGHTING, true);
//Node->setScale(vector3df(2,2,4));
IGImpactMeshShape *shape = new IGImpactMeshShape(Node, device->getSceneManager()->getMesh(collFile.c_str()), mass);
tank = world->addRigidBody(shape);
// When using a raycast vehicle, we don't want this rigid body to deactivate.
tank->setActivationState(EAS_DISABLE_DEACTIVATION);
// Set some damping on the rigid body because the raycast vehicles tend to bounce a lot without a lot of tweaking.
// (cheap fix for the example only)
tank->setDamping(0.4, 0.4);
// We create our vehicle, passing our newly created rigid body as a parameter.
vehicle = world->addRaycastVehicle(tank);
// Set up our wheel construction info. These values can be changed for each wheel,
// and the values that you want to keep will stay the same, that way
// all parameters for each wheel can stay the same for what needs to remain equal,
// such as directions and suspension rest length.
SWheelInfoConstructionInfo wheel;
wheel.chassisConnectionPointCS = vector3df(0.0,-0.88,4.0);
wheel.wheelDirectionCS = vector3df(0.0,-0.1,0.0);
wheel.wheelAxleCS = vector3df(-0.5,0.0,0.0);
wheel.suspensionRestLength = 0.6;
wheel.wheelRadius = 8.0;
wheel.isFrontWheel = true;
// The bones are in the center of the mesh on the X axis, so we just set the width ourselves.
// Do the left row of wheels.
for(u32 i=0; i < Node->getJointCount(); i++)
{
// The bones that we need in this mesh are all named "RoadWheels" with a numerical suffix.
// So we do a quick check to make sure that no unwanted bones get through as wheels.
if(Node->getJointNode(i)->getName()[0] == 'R')
{
wheel.chassisConnectionPointCS = vector3df(-4, Node->getJointNode(i)->getPosition().Y,Node->getJointNode(i)->getPosition().Z);
vehicle->addWheel(wheel);
}
}
wheel.wheelAxleCS = vector3df(0.5,0.0,0.0);
// Do the right row of wheels.
for(u32 i=0; i < Node->getJointCount(); i++)
{
if(Node->getJointNode(i)->getName()[0] == 'R')
{
wheel.chassisConnectionPointCS = vector3df(4, Node->getJointNode(i)->getPosition().Y,Node->getJointNode(i)->getPosition().Z);
vehicle->addWheel(wheel);
}
}
for (u32 i=0;i<vehicle->getNumWheels();i++)
{
SWheelInfo &info = vehicle->getWheelInfo(i);
info.suspensionStiffness = 0.08f;
info.wheelDampingRelaxation = 20.0f;
info.wheelDampingCompression = 20.0f;
info.frictionSlip = 1000;
info.rollInfluence = 0.1f;
// We call updateWheel, which takes SWheelInfo as the first parameter,
// and the ID of the wheel to apply that info to. This must
// be called after any changes in order for the changes to actually take effect.
vehicle->updateWheelInfo(i);
}
}