当前位置: 首页>>代码示例>>C++>>正文


C++ IAnimatedMeshSceneNode::setScale方法代码示例

本文整理汇总了C++中IAnimatedMeshSceneNode::setScale方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMeshSceneNode::setScale方法的具体用法?C++ IAnimatedMeshSceneNode::setScale怎么用?C++ IAnimatedMeshSceneNode::setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAnimatedMeshSceneNode的用法示例。


在下文中一共展示了IAnimatedMeshSceneNode::setScale方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createNode

ISceneNode* Render::createNode(bool isMD2, IAnimatedMesh* mesh, ITexture* texture, bool light,core::vector3df scale, core::vector3df pos, core::vector3df rotation)
{
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh, NULL, IDFlag_IsPickable);
	
	if(node)
	{
		pos.Y += -node->getBoundingBox().MinEdge.Y * scale.Y;
		node->setPosition(pos);
		node->setRotation(rotation);
		node->setScale(scale);
		node->setAnimationSpeed(20.f);
		scene::ITriangleSelector* selector = 0;
		selector = smgr->createTriangleSelector(node);
		node->setTriangleSelector(selector);
		selector->drop();
		
		//Autoscale
		//f32 scale = 0.25f;
		node->setScale(scale);
		
		if (texture)
		{
			//node->setMaterialFlag(EMF_LIGHTING, false);
			node->setMaterialTexture(0, texture);
		}

		node->setMD2Animation(EMAT_STAND);
	}

	return node;
}
开发者ID:insolite,项目名称:RPG,代码行数:31,代码来源:Render.cpp

示例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);
	}
}
开发者ID:dg8fv2010,项目名称:WonderLandNet,代码行数:51,代码来源:scene.cpp

示例3: mLoadMesh

IAnimatedMeshSceneNode* MyIrrlichtComposition::mLoadMesh(vector3df pos,vector3df rot,vector3df scale, std::string name1, std::string name2)
{
	IAnimatedMeshSceneNode* obj = smgr->addAnimatedMeshSceneNode(smgr->getMesh(name1.c_str()));
	if(obj)
	{
		obj->setPosition(pos);
		obj->setMD2Animation(scene::EMAT_RUN);
		obj->setRotation(rot); 
		obj->setScale(scale);
		obj->setMaterialTexture(0, driver->getTexture(name2.c_str()));
		obj->addShadowVolumeSceneNode();
		return obj;
	}
	else 
		exit(2);
}
开发者ID:tetricas,项目名称:First_Irrlicht_Turn,代码行数:16,代码来源:MyIrrlichtDevice.cpp

示例4: addModel

void Unit::addModel() {
	IAnimatedMeshSceneNode* modelNode = Game::getInstance().sceneManager->addAnimatedMeshSceneNode( model, node );
	if (modelNode)
    {
		modelNode->setMaterialTexture( 0, texture );
		modelNode->getMaterial(0).Shininess = 0;
		modelNode->setScale(vector3df(0.15f, 0.15f, 0.15f) );
		modelNode->addShadowVolumeSceneNode(0, 0, false);
		modelNode->setID(0);

		currentAnimation = IDLE_ANIMATION;
		
		float randX = rand() % 8 - 4;
		float randZ =rand() % 8 - 4;
		modelNode->setPosition(vector3df(randX, 0.0f, randZ));
    }

	modelNodes.push_back(modelNode);
}
开发者ID:MegaR,项目名称:ARiseofWar,代码行数:19,代码来源:Unit.cpp

示例5: 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));
	}
}
开发者ID:beothorn,项目名称:HiddenObjects,代码行数:24,代码来源:AnnyFactory.cpp

示例6: runExample

void CCharacterExample::runExample()
{
    for(s32 i=0; i<KEY_KEY_CODES_COUNT; i++)
        KeyIsDown[i] = false;

    debugDraw = true;
    drawProperties = true;
    drawWireFrame = false;

    rows = 10;
	columns = 10;

    device =
        createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
            false, false, false, this);


    device->setWindowCaption(L"irrBullet Character Example - Josiah Hartzell");

	device->getFileSystem()->addFileArchive("./media/");


    device->getSceneManager()->addLightSceneNode(0, vector3df(20, 40, -50), SColorf(1.0f, 1.0f, 1.0f), 4000.0f);


    ////////////////////////////
    // Create irrBullet World //
    ////////////////////////////
    world = createIrrBulletWorld(device, true, debugDraw);

    world->setDebugMode(EPDM_DrawAabb |
            EPDM_DrawContactPoints);

    world->setGravity(vector3df(0,-10,0));


    camera = device->getSceneManager()->addCameraSceneNodeMaya();
	camera->setPosition(vector3df(50,15,200));
	camera->bindTargetAndRotation(true);


	createGround();
	createBoxes();

	IKinematicCharacterController* character = new IKinematicCharacterController(world);

	IAnimatedMeshSceneNode* sydney = device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->getMesh("sydney.md2"));
	sydney->setScale(vector3df(0.14,0.14,0.14));
	sydney->getMaterial(0).setTexture(0, device->getVideoDriver()->getTexture("sydney.bmp"));
	sydney->setMD2Animation(scene::EMAT_STAND);


    // Set our delta time and time stamp
    u32 TimeStamp = device->getTimer()->getTime();
    u32 DeltaTime = 0;
    EMD2_ANIMATION_TYPE animation = EMAT_STAND;
    EMD2_ANIMATION_TYPE newAnimation = EMAT_RUN;
    bool jump = false;
    while(device->run())
    {
        device->getVideoDriver()->beginScene(true, true, SColor(255,100,101,140));

        DeltaTime = device->getTimer()->getTime() - TimeStamp;
		TimeStamp = device->getTimer()->getTime();


		/*sydney->setPosition(character->getWorldTransform().getTranslation()+vector3df(0,-((sydney->getBoundingBox().MaxEdge.Y-sydney->getBoundingBox().MinEdge.Y)*0.1*0.5f),0));
        vector3df dir = camera->getAbsolutePosition()-sydney->getAbsolutePosition();
        dir.normalize();
        dir.Y = 0;
        dir *= -1;

        character->setWalkDirection(dir*0.3f);*/

        if(IsKeyDown(KEY_KEY_W))
        {
            DirZ = -1.0f;
        }

        else if(IsKeyDown(KEY_KEY_S))
        {
            DirZ = 1.0f;
        }

        else
        {
            DirZ = 0.0f;
        }

        if(IsKeyDown(KEY_KEY_A))
        {
            DirX = 1.0f;
        }

        else if(IsKeyDown(KEY_KEY_D))
        {
            DirX = -1.0f;
        }

        else
//.........这里部分代码省略.........
开发者ID:pdpdds,项目名称:Win32OpenSourceSample,代码行数:101,代码来源:characterexample.cpp

示例7: main

int main()
{


/*		shadowDimen = dimension2du(1024,1024);
		shadowDimen = dimension2du(2048,2048);
		shadowDimen = dimension2du(4096,4096);
		shadowDimen = dimension2du(2048,2048);
		filterType = EFT_NONE;
		filterType = EFT_4PCF;
		filterType = EFT_8PCF;
		filterType = EFT_4PCF;
*/
	dimension2du shadowDimen = dimension2du(1024,1024);
    E_FILTER_TYPE filterType = EFT_4PCF;
    filterType = EFT_NONE;
////


IrrlichtDevice* device = createDevice(EDT_OPENGL,dimension2du(800,600),32);

ISceneManager* smgr = device->getSceneManager();
IVideoDriver* driver = device->getVideoDriver();

ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0,100,.5);
cam->setPosition(vector3df(0,10,0));

// Create the effect handler, passing the device and RTT size (as a dimension2d) .
effectHandler* effect = new effectHandler(device,shadowDimen);


ITerrainSceneNode* terrain = smgr->addTerrainSceneNode("media/terrain.bmp",0,-1,vector3df(0,0,0),vector3df(0,0,0),vector3df(1,1,1),SColor(255,255,255,255),1,ETPS_33);
terrain->setMaterialTexture(0,driver->getTexture("media/terrain.jpg"));
terrain->setMaterialTexture(1, driver->getTexture("media/detailmap.jpg"));
terrain->scaleTexture(1,10);
terrain->setScale(core::vector3df(4, 0.01f, 4));
terrain->setPosition(vector3df(-120,-1.5f,-120));
terrain->setMaterialType(EMT_DETAIL_MAP);

// Make the terrain recieve a shadow with the specified filter type.
// (NOTE: 12PCF is only available in Direct3D9, all others work with OpenGL)
effect->addShadowToNode(terrain,filterType);

IAnimatedMeshSceneNode* sydney;
IAnimatedMesh* sydneymesh = smgr->getMesh("media/dwarf.x");

for(int g = 0;g < 1;g++)
{
	for(int v = 0;v < 3;v++)
	{
		sydney = smgr->addAnimatedMeshSceneNode(sydneymesh);
		sydney->setScale(vector3df(0.05f,0.05f,0.05f));
		sydney->setPosition(vector3df(g * 4,0.5f,v * 4));
		sydney->setMaterialFlag(EMF_NORMALIZE_NORMALS,true);

		sydney->setAutomaticCulling(EAC_FRUSTUM_BOX);

		sydney->setMaterialType(EMT_SOLID);

		// Add the nodes to the depth pass so that they cast a shadow.
		effect->addNodeToDepthPass(sydney);

	}
}


effect->getLightCamera()->addAnimator(smgr->createFlyCircleAnimator(sydney->getPosition() + vector3df(0,15,0),25,0.0002f));

effect->getLightCamera()->setNearValue(5);

effect->setMaxShadowDistanceFromLight(120);

smgr->addLightSceneNode(effect->getLightCamera());


MyEventReceiver receiver(cam);
device->setEventReceiver(&receiver);

// Parent a sphere to the light camera so we can see its position.
smgr->addSphereSceneNode(1,8,effect->getLightCamera())->setMaterialFlag(EMF_LIGHTING,false);



while(device->run())
{
	wchar_t tmp[255];
	swprintf(tmp,255,L"Shadow Map Demo (FPS: %d)",driver->getFPS());
	device->setWindowCaption(tmp);

	driver->beginScene(true,true,SColor(0,0,0,0));

	// Point the light camera at one of the nodes as it rotates around them.
	effect->setLightTarget(sydney->getPosition());

	// Update the effect  handler, remember to always do this BEFORE smgr->drawAll and AFTER beginscene!
	effect->update();

	smgr->drawAll();

	// If user wishes we can display the shadow map to the screen. (May not work in OpenGL)
//.........这里部分代码省略.........
开发者ID:tecan,项目名称:Luna,代码行数:101,代码来源:example.cpp


注:本文中的IAnimatedMeshSceneNode::setScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。