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


C++ ISceneNode类代码示例

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


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

示例1: LOG_DEBUG

void CScene::eraseScene()
{
    LOG_DEBUG("Erasing scene\n");
    setActiveCamera(NULL);

    for(u32 Type = 0; Type < ENT_COUNT; Type++)
    {

        u32 ListSize = SceneNode_Types_list[Type].size();
        for(u32 i = 0; i < ListSize; i++)
        {
            // Store node in temp varible and set pointer in null
            // because SceneNode::UnRegisterNode recall Scene::UnRegisterNode
            ISceneNode* Node = SceneNode_Types_list[Type][i];
            SceneNode_Types_list[Type][i] = NULL;
            if(Node == NULL)
                break;

            Node->UnRegisterNode(false);
            Node->release();
        }

        SceneNode_Types_list[Type].clear();
    }
    SceneNode_Full_list.clear();
}
开发者ID:mrangryhumster,项目名称:NovaEngine,代码行数:26,代码来源:CScene.cpp

示例2: Java_zte_irrlib_scene_Scene_nativeAddBillboardSceneNode

	int Java_zte_irrlib_scene_Scene_nativeAddBillboardSceneNode(
		JNIEnv *env, jobject defaultObj, jdouble px, jdouble py, jdouble pz,
		jdouble sx, jdouble sy, jint id, jint parent, jboolean isLight)
	{
		core::vector3df pos = core::vector3df(px,py,pz);
		core::dimension2d<f32> size = core::dimension2d<f32>(sx,sy);
		
		ISceneNode* node = NULL;
		ISceneNode* parentNode = NULL;
		if(parent != 0){
			parentNode = smgr->getSceneNodeFromId(parent);
			if (!parentNode) 
			{
				WARN_PARENT_NOT_FOUND(parent, AddBillboardSceneNode);
				return -1;
			}
		}
		node = smgr->addBillboardSceneNode(parentNode,size,pos,id);

		if (node)
		{
			if (!isLight) node->setMaterialFlag(video::EMF_LIGHTING, false);
			return 0;
		}
		else 
		{
			ERROR_ADD_FAILD(id, AddBillboardSceneNode);
			return -3;
		}
	}
开发者ID:yours321dog,项目名称:IrrAPI,代码行数:30,代码来源:android-Scene.cpp

示例3: computePickingRay

void EditorScene::PickingObject(u32 sx, u32 sy)
{
	math::SRay ray = computePickingRay(sx, sy);

	f32 dist;
	ISceneNode* node = mSceneManager->intersectRayWithTag(ray, &dist, 1, ENT_SOLID_NODE);

	if (node)
	{
		mPickingCubeNode->setVisible(true);
		//mPickingCubeNode->setPosition(node->getPosition());

		math::SOrientedBox obb = node->getOrientedBox();
		XMMATRIX scaleMatrix = XMMatrixScaling(obb.Extents.x * 2, obb.Extents.y * 2, obb.Extents.z * 2);
		XMMATRIX rotMatrix = XMMATRIX(
			obb.Axis[0].x, obb.Axis[0].y, obb.Axis[0].z, 0,
			obb.Axis[1].x, obb.Axis[1].y, obb.Axis[1].z, 0,
			obb.Axis[2].x, obb.Axis[2].y, obb.Axis[2].z, 0,
			0, 0, 0, 1.0f);

		XMMATRIX transMatrix = XMMatrixTranslation(obb.Center.x, obb.Center.y, obb.Center.z);
		XMMATRIX M = scaleMatrix * rotMatrix * transMatrix;
		mPickingCubeNode->setTransform(M);
	}
	else
	{
		mPickingCubeNode->setVisible(false);
	}
}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:29,代码来源:EditorScene.cpp

示例4: Java_zte_irrlib_scene_Scene_nativeAddLightSceneNode

	int Java_zte_irrlib_scene_Scene_nativeAddLightSceneNode(
		JNIEnv *env, jobject defaultObj, jdouble px, jdouble py, jdouble pz,
		jdouble radius, jint r, jint g, jint b, jint id, jint parent, jboolean isLight)
	{	
		ISceneNode* node = NULL;
		ISceneNode* parentNode = NULL;
		if(parent != 0){
			parentNode = smgr->getSceneNodeFromId(parent);
			if (!parentNode) 
			{
				WARN_PARENT_NOT_FOUND(parent, AddLightSceneNode);
				return -2;
			}
		}
		node = smgr->addLightSceneNode(parentNode,vector3df(px,py,pz),SColor(0xff,r,g,b),radius,id);
		
		if (node)
		{
			if (!isLight) node->setMaterialFlag(video::EMF_LIGHTING, false);
			return 0;
		}
		else 
		{
			ERROR_ADD_FAILD(id, AddLightSceneNode);
			return -3;
		}
	}
开发者ID:yours321dog,项目名称:IrrAPI,代码行数:27,代码来源:android-Scene.cpp

示例5: Create

void CPlayer::Create()
{
	m_pHead->Create();
	ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
	pRootNode->AddChild(m_pHead);
	
}
开发者ID:SeventhMage,项目名称:MagicX,代码行数:7,代码来源:CPlayer.cpp

示例6: addItem

// ----------------------------------------------------------------------------
void Editor::addItem(u32 id)
{
    ISceneNode* node = 0;
    switch (id)
    {
    case ExtraPanel::BTN_BANANA:
        node = m_scene_manager->addAnimatedMeshSceneNode(
            m_scene_manager->getMesh("models/banana.b3d"));
        node->setName("banana");
        break;
    case ExtraPanel::BTN_ITEM:
        node = m_scene_manager->addAnimatedMeshSceneNode(
            m_scene_manager->getMesh("models/gift-box.b3d"));
        node->setName("item");
        break;
    case ExtraPanel::BTN_SNITRO:
        node = m_scene_manager->addAnimatedMeshSceneNode(
            m_scene_manager->getMesh("models/nitrotank-small.b3d"));
        node->setName("small-nitro");
        break;
    case ExtraPanel::BTN_BNITRO:
        node = m_scene_manager->addAnimatedMeshSceneNode(
            m_scene_manager->getMesh("models/nitrotank-big.b3d"));
        node->setName("big-nitro");
        break;
    default:
        break;
    }
    m_viewport->setNewEntity(node);
} // addItem
开发者ID:CruzR,项目名称:stk-editor,代码行数:31,代码来源:editor.cpp

示例7: isNeedMoveToStartPos

    //-----------------------------------------------------------------------
    Bool CCSEntityLineMoveAcion::isNeedMoveToStartPos()
    {
        if ( !mEntity )
            return false;

        if ( !mEntity->getEntity() )
            return false ;

        ISceneNode* sceneNode = mEntity->getEntity()->getSceneNode();
        if( !sceneNode )
        {
            return false ;
        }

        Vec3 currPos;
        sceneNode->getPosition(currPos);

        Vec3 ec = mEndPos - currPos;
        Vec3 es = mEndPos - mStartPos;

        ec.y = 0;
        es.y = 0;

        Flt currDis = ec.length();
        Flt dis     = es.length();

        if ( currDis > dis  )
            return true;

        return false;
    }
开发者ID:dnjsflagh1,项目名称:code,代码行数:32,代码来源:SceneEntityAction.cpp

示例8: addChild

void IrrGameObjectImpl::addChild(GameObject *o)
{
	ISceneNode *n = ((IrrGameObjectImpl*)o->getImplementor())->node;
	children->insert(std::pair<GameObject*,ISceneNode*>(o,n));
	node->addChild(n);
	n->setParent(node);
}
开发者ID:helderbpf,项目名称:Blute-Engine,代码行数:7,代码来源:IrrGameObjectImpl.cpp

示例9: Java_zte_irrlib_scene_Scene_nativeAddCubeSceneNode

	int Java_zte_irrlib_scene_Scene_nativeAddCubeSceneNode(
		JNIEnv*  env, jobject defaultObj, jdouble x, jdouble y, jdouble z,
		jdouble size, jint id, jint parent, jboolean isLight)
	{
		core::vector3df pos = core::vector3df(x,y,z);

		ISceneNode* node = NULL;
		ISceneNode* parentNode = NULL;
		if(parent != 0){
			parentNode = smgr->getSceneNodeFromId(parent);
			if (!parentNode) 
			{
				WARN_PARENT_NOT_FOUND(parent, AddCubeSceneNode);
				return -2;
			}
		}
		node = smgr->addCubeSceneNode(size,parentNode,id,pos);

		if (node)
		{
			if (!isLight) node->setMaterialFlag(video::EMF_LIGHTING, false);
			return 0;
		}
		else 
		{
			ERROR_ADD_FAILD(id, AddCubeSceneNode);
			return -3;
		}
	}
开发者ID:yours321dog,项目名称:IrrAPI,代码行数:29,代码来源:android-Scene.cpp

示例10: runTestWithDriver

static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice( driverType, dimension2d<s32>(640, 480));
	if (!device)
		return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
	
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager * smgr = device->getSceneManager();
	
	// Draw a cube to check that the pixels' alpha is working.
	ISceneNode * cube = smgr->addCubeSceneNode(50.f, 0, -1, vector3df(0, 0, 60));
	cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
	cube->setMaterialFlag(video::EMF_LIGHTING, false);
	(void)smgr->addCameraSceneNode();

	driver->beginScene(true, true, SColor(255,100,101,140));
	smgr->drawAll();

	// Test for offscreen values as well as onscreen.
	for(s32 x = -10; x < 650; ++x)
	{
		s32 y = 480 * x / 640;
		driver->drawPixel((u32)x, (u32)y, SColor(255, 255 * x / 640, 255 * (640 - x) / 640, 0));
		y = 480 - y;
		driver->drawPixel((u32)x, (u32)y, SColor(255 * x / 640, 0, 255, 255));
	}

	driver->endScene();

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawPixel.jpg");

	device->drop();

	return result;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:35,代码来源:drawPixel.cpp

示例11: CSphereEntity

void CPlayer::Increase()
{
	if (!m_pHead)
	{			
		m_pHead = new CSphereEntity(m_pReflectObject, GetHeadRadius(), GetSlice(), GetSlice());

		CSphereEntity *pBody = new CSphereEntity(m_pColorLightObject, GetBodyRadius(), GetSlice(), GetSlice());
		pBody->Create();
		m_listBody.push_back(pBody);
		m_pTail = new CSphereEntity(m_pColorLightObject, GetBodyRadius(), GetSlice(), GetSlice());
		m_pTail->Create();

		ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
		pRootNode->AddChild(pBody);
		pRootNode->AddChild(m_pTail);
		InitPosition();
	}
	else
	{
		CSphereEntity *body = new CSphereEntity(m_pColorLightObject, GetBodyRadius(), GetSlice(), GetSlice());
		body->Create();			
		CVector3 vBackBody = m_listBody.back()->GetPosition();
		CVector3 vSrcTail = m_pTail->GetPosition();
		body->SetPosition(vSrcTail);
		m_listBody.push_back(body);
		m_pTail->SetPosition(vBackBody + 1.5f * (vSrcTail - vBackBody));

		ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
		pRootNode->AddChild(body);
	}
}
开发者ID:SeventhMage,项目名称:MagicX,代码行数:31,代码来源:CPlayer.cpp

示例12: SceneNodeTags

ISceneNode* BinaryStreamArchiveReader::ReadNode() {
    SceneNodeTags tag = SceneNodeTags(ReadInt(TAG_KEY));
    ISceneNode *node = NULL;
    // Read a node

    switch (tag) {
#define SCENE_NODE(type)                            \
        case NODE_##type :                          \
            node = new type();                      \
            break;
#include <Scene/SceneNodes.def>
#undef SCENE_NODE
    case NODE_NULL:
        return NULL;
    case NODE_END:
        throw Core::Exception("Unknown node tag in ReadScene");
        break;
    }
    // Read children...
    unsigned int size = Begin(CHILD_KEY);

    for (unsigned int i=0; i<size; i++) {
        node->AddNode(ReadNode());
    }

    End(CHILD_KEY);

    node->Deserialize(*this);
    return node;

}
开发者ID:OpenEngineDK,项目名称:branches-OpenEngineMultiCore,代码行数:31,代码来源:BinaryStreamArchive.cpp

示例13: getCollMan

	// pick a node using the mouse cursor location 
	ISceneNode* CSLevel::selectNode(int screenX, int screenY, long objectflags)
	{
		// attempt to select a node. use the passed in mask
		ISceneNode* node = getCollMan()->getSceneNodeFromScreenCoordinatesBB(position2d<s32>(screenX, screenY), objectflags, true);
		if (node) CS_LOG(CSLOGTYPE::CSL_DEBUG, "SELECTED NODE %i", node->getID());
		return node;
	}
开发者ID:SevenGameMaker,项目名称:CobbleStones,代码行数:8,代码来源:CSLevel.cpp

示例14: Java_zte_irrlib_scene_SceneNode_nativeSetParent

	int Java_zte_irrlib_scene_SceneNode_nativeSetParent(
		JNIEnv *env, jobject defaultObj, jint parent, jint id)
	{
		//LOGD("PARENT %d", id);
		ISceneNode *node = smgr->getSceneNodeFromId(id);
		ISceneNode *parentNode = NULL;
		
		if (!node)
		{
			WARN_NODE_NOT_FOUND(id, SetParent);
			return -1;
		}
		
		if (parent == 0)
		{
			node->setParent(smgr->getRootSceneNode());
		}
		else 
		{
			parentNode = smgr->getSceneNodeFromId(parent);
			if (!parentNode)
			{
				WARN_PARENT_NOT_FOUND(id, SetParent);
				return -2;
			}
			node->setParent(parentNode);
		}
		return 0;
	}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例15: CreateBox

// Create a box rigid body
void Application::CreateBox(const btVector3 &TPosition, const vector3df &TScale, btScalar TMass, const char *texture) {

	ISceneNode *Node = irrScene->addCubeSceneNode(1.0f);
	Node->setScale(TScale);
	Node->setMaterialFlag(EMF_LIGHTING, 1);
	Node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
	Node->setMaterialTexture(0, irrDriver->getTexture(texture));

	// Set the initial position of the object
	btTransform Transform;
	Transform.setIdentity();
	Transform.setOrigin(TPosition);

	btDefaultMotionState *MotionState = new btDefaultMotionState(Transform);

	// Create the shape
	btVector3 HalfExtents(TScale.X * 0.5f, TScale.Y * 0.5f, TScale.Z * 0.5f);
	btCollisionShape *Shape = new btBoxShape(HalfExtents);

	// Add mass
	btVector3 LocalInertia;
	Shape->calculateLocalInertia(TMass, LocalInertia);

	// Create the rigid body object
	btRigidBody *RigidBody = new btRigidBody(TMass, MotionState, Shape, LocalInertia);

	// Store a pointer to the irrlicht node so we can update it later
	RigidBody->setUserPointer((void *)(Node));

	// Add it to the world
	World->addRigidBody(RigidBody);
	Objects.push_back(RigidBody);
}
开发者ID:mkschreder,项目名称:bettercopter,代码行数:34,代码来源:Application.cpp


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