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


C++ SLNode::addMesh方法代码示例

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


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

示例1: SLCylinder

//-----------------------------------------------------------------------------
TurnTableGameScene::TurnTableGameScene(SkeletonData* defaultSkeletonData,  SLint localPlayerIndex, SLint maxPlayers, SLMat4f* playerPositions, VR_MODEL* models) :
	GameScene(defaultSkeletonData, localPlayerIndex, maxPlayers, playerPositions, models)
{
	_matTable = new SLMaterial[3];
	_matTable[0].name("matTableLeg");
	_matTable[0].ambient(SLVec4f(0.0f, 0.0f, 0.0f, 1.0f));
	_matTable[0].diffuse(SLVec4f(0.0f, 0.0f, 0.0f, 1.0f));

	_matTable[1].name("matTablePlate");
	_matTable[1].ambient(SLVec4f(1.0f, 1.0f, 1.0f, 0.6f));
	_matTable[1].diffuse(SLVec4f(1.0f, 1.0f, 1.0f, 0.6f));

	_matTable[2].name("matTestBox");
	_matTable[2].ambient(SLVec4f(1.0f, 0.5f, 0.0f, 1.0f));
	_matTable[2].diffuse(SLVec4f(1.0f, 0.5f, 0.0f, 1.0f));

	SLCylinder* cylinder = new SLCylinder(0.15f, 0.8f, 1, 32, true, true, "tableLeg", &_matTable[0]);
	SLNode* tableLeg = new SLNode("Table Leg");
	tableLeg->addMesh(cylinder);
	tableLeg->rotate(-90, 1, 0, 0);
	_rootNode->addChild(tableLeg);

	_table = new SLNode("turnTable");
	_table->translate(0, 0.8f, 0);
	
	cylinder = new SLCylinder(0.5f, 0.04f, 1, 32, true, true, "tablePlate", &_matTable[1]);
	SLNode* tablePlate = new SLNode("Table Plate");
	tablePlate->addMesh(cylinder);
	tablePlate->rotate(-90, 1, 0, 0);
	_table->addChild(tablePlate);

	SLNode* tableObjects = new SLNode("tableObjects");
	_table->addChild(tableObjects);
	tableObjects->translate(0, 0.04f, 0);

	// test object
	SLNode* pot = SLAssImp::load("../_data/models/teapot.obj");


	pot->translate(0, 0.138f, 0);
	pot->scale(0.2f);
	tableObjects->addChild(pot);

	_rootNode->addChild(_table);
}
开发者ID:flair2005,项目名称:VirtualRoom,代码行数:46,代码来源:VRTurnTableGameScene.cpp

示例2: SLMaterial

//-----------------------------------------------------------------------------
ColorSphereGameScene::ColorSphereGameScene(SkeletonData* defaultSkeletonData,  SLint localPlayerIndex, SLint maxPlayers, SLMat4f* playerPositions, VR_MODEL* models) :
	GameScene(defaultSkeletonData, localPlayerIndex, maxPlayers, playerPositions, models)
{
	// material
	this->_matSphere = new SLMaterial("matSphere", SLCol4f::BLACK);

	this->_sphere = new SLSphere(0.2f, 32, 32, "Color Sphere Game 1", this->_matSphere);
	SLNode* sphereNode = new SLNode;
	sphereNode->translate(0.0f, 1.0f, 0.0f);
	sphereNode->addMesh(_sphere);

	this->_rootNode->addChild(sphereNode);
}
开发者ID:flair2005,项目名称:VirtualRoom,代码行数:14,代码来源:VRColorSphereGameScene.cpp

示例3: copyRec

/*! 
Copies the nodes meshes and children recursively.
*/ 
SLNode* SLNode::copyRec()
{
    SLNode* copy = new SLNode(name());
    copy->_om = _om;
    copy->_depth = _depth;
    copy->_isAABBUpToDate = _isAABBUpToDate;
    copy->_isAABBUpToDate = _isWMUpToDate;
    copy->_drawBits = _drawBits;
    copy->_aabb = _aabb;

    if (_animation) 
         copy->_animation = new SLAnimation(*_animation);
    else copy->_animation = 0;

    for (auto mesh : _meshes) copy->addMesh(mesh);
    for (auto child : _children) copy->addChild(child->copyRec());
   
    return copy;
}
开发者ID:h3ll5ur7er,项目名称:SLProject,代码行数:22,代码来源:SLNode.cpp


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