本文整理汇总了C++中ogre::SceneNode::_update方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::_update方法的具体用法?C++ SceneNode::_update怎么用?C++ SceneNode::_update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::_update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupBottomWall
void DefaultGameObjectFactory::SetupBottomWall(GameObject* wall) {
Ogre::SceneNode* node = scene_manager_->getSceneNode("bottom_wall");
node->_update(true, true);
const Ogre::AxisAlignedBox& wall_rect = node->_getWorldAABB();
Ogre::Vector3 wall_size = wall_rect.getSize();
Size size = { wall_size.x , wall_size.y, wall_size.z };
wall->set_position(center_x_, size.y / 2.f);
wall->set_size(size);
}
示例2: SetupBall
void DefaultGameObjectFactory::SetupBall(GameObject* ball) {
Ogre::SceneNode* node = scene_manager_->getSceneNode("ball");
node->_update(true, true);
const Ogre::AxisAlignedBox& ball_rect = node->_getWorldAABB();
Ogre::Vector3 ball_size = ball_rect.getSize();
Size size = { ball_size.x, ball_size.y, ball_size.z };
ball->set_position(center_x_, center_y_);
ball->set_size(size);
ball->set_movement_velocity(50.f);
ball->set_rotation_velocity(10.f);
Clamp clamp = { { 0.f, 500.f }, { 0.f, 10.f } };
ball->set_clamp(clamp);
}
示例3:
void DefaultGameObjectFactory::SetupPlayer1(GameObject* player) {
Ogre::MeshManager& mesh_manager = Ogre::MeshManager::getSingleton();
const Ogre::AxisAlignedBox& wall_rect = static_cast<Ogre::MeshPtr>(
mesh_manager.getByName("wall.mesh"))->getBounds();
Ogre::SceneNode* node = scene_manager_->getSceneNode("pad_1");
node->_update(true, true);
const Ogre::AxisAlignedBox& pad_rect = node->_getWorldAABB();
mxgame::Real offset = wall_rect.getSize().y + pad_rect.getHalfSize().y;
pad_1_lower_limit_ = offset - center_y_;
pad_1_upper_limit_ = center_y_ - offset;
Ogre::Vector3 pad_size = pad_rect.getSize();
Size size = { pad_size.x, pad_size.y, pad_size.z };
player->set_position(x_border_offset_, center_y_);
player->set_size(size);
player->set_movement_velocity(250.f);
}
示例4: TOSTRING
//.........这里部分代码省略.........
size_t offset = 0;
mesh->sharedVertexData->vertexDeclaration->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_POSITION);
offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);
mesh->sharedVertexData->vertexDeclaration->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES);
// Create and bind vertex buffer
mesh->sharedVertexData->vertexCount = 14;
Ogre::HardwareVertexBufferSharedPtr vertexBuffer =
Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(
mesh->sharedVertexData->vertexDeclaration->getVertexSize(0),
mesh->sharedVertexData->vertexCount,
Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
mesh->sharedVertexData->vertexBufferBinding->setBinding(0, vertexBuffer);
// Vertex data
static const float vertexData[] = {
// Position Texture coordinates // Index
0.0, 2.0, -1.0, 1.0, 1.0, // 0
0.0, 1.0, -1.0, -1.0, 1.0, // 1
1.0, 2.0, -1.0, 1.0, -1.0, // 2
1.0, 1.0, -1.0, -1.0, -1.0, // 3
2.0, 2.0, 1.0, 1.0, -1.0, // 4
2.0, 1.0, 1.0, -1.0, -1.0, // 5
3.0, 2.0, 1.0, 1.0, 1.0, // 6
3.0, 1.0, 1.0, -1.0, 1.0, // 7
4.0, 2.0, -1.0, 1.0, 1.0, // 8
4.0, 1.0, -1.0, -1.0, 1.0, // 9
1.0, 3.0, -1.0, 1.0, 1.0, // 10
2.0, 3.0, 1.0, 1.0, 1.0, // 11
1.0, 0.0, -1.0, -1.0, 1.0, // 12
2.0, 0.0, 1.0, -1.0, 1.0, // 13
};
// Fill vertex buffer
float* pData = static_cast<float*>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));
for (size_t vertex = 0, i = 0; vertex < mesh->sharedVertexData->vertexCount; vertex++)
{
// Position
*pData++ = position.x + scale * vertexData[i++];
*pData++ = position.y + scale * vertexData[i++];
*pData++ = 0.0;
// Texture coordinates
*pData++ = vertexData[i++];
*pData++ = vertexData[i++];
*pData++ = vertexData[i++];
}
vertexBuffer->unlock();
// Create index buffer
sub->indexData->indexCount = 36;
Ogre::HardwareIndexBufferSharedPtr indexBuffer =
Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(
Ogre::HardwareIndexBuffer::IT_16BIT,
sub->indexData->indexCount,
Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
sub->indexData->indexBuffer = indexBuffer;
// Index data
static const Ogre::uint16 indexData[] = {
// Indices // Face
0, 1, 2, // 0
2, 1, 3, // 1
2, 3, 4, // 2
4, 3, 5, // 3
4, 5, 6, // 4
6, 5, 7, // 5
6, 7, 8, // 6
8, 7, 9, // 7
10, 2, 11, // 8
11, 2, 4, // 9
3, 12, 5, // 10
5, 12, 13, // 11
};
// Fill index buffer
indexBuffer->writeData(0, indexBuffer->getSizeInBytes(), indexData, true);
mesh->_setBounds(Ogre::AxisAlignedBox::BOX_INFINITE);
mesh->_setBoundingSphereRadius(10);
mesh->load();
Ogre::Entity* e = gEnv->sceneManager->createEntity(mesh->getName());
e->setCastShadows(false);
e->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
e->setVisible(true);
e->setMaterialName("tracks/EnvMapDebug");
Ogre::SceneNode* mDebugSceneNode = new Ogre::SceneNode(gEnv->sceneManager);
mDebugSceneNode->attachObject(e);
mDebugSceneNode->setPosition(Ogre::Vector3(0, 0, -5));
mDebugSceneNode->setFixedYawAxis(true, Ogre::Vector3::UNIT_Y);
mDebugSceneNode->setVisible(true);
mDebugSceneNode->_update(true, true);
mDebugSceneNode->_updateBounds();
overlay->add3D(mDebugSceneNode);
overlay->show();
}
}
}