本文整理汇总了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);
}
示例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);
}
示例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;
}