本文整理汇总了C++中ogre::AxisAlignedBox::setInfinite方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::setInfinite方法的具体用法?C++ AxisAlignedBox::setInfinite怎么用?C++ AxisAlignedBox::setInfinite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::AxisAlignedBox
的用法示例。
在下文中一共展示了AxisAlignedBox::setInfinite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSkybox
void EditorApplication::createSkybox(string skybox_name) {
LibGens::Model *skybox_model=current_level->getModelLibrary()->getModel(skybox_name);
if (skybox_model) {
Ogre::SceneNode *scene_node = scene_manager->getRootSceneNode()->createChildSceneNode();
buildModel(scene_node, skybox_model, skybox_model->getName(), "", scene_manager, current_level->getMaterialLibrary(), 0, GENERAL_MESH_GROUP, false);
unsigned short attached_objects=scene_node->numAttachedObjects();
for (unsigned short i=0; i<attached_objects; i++) {
Ogre::Entity *entity=static_cast<Ogre::Entity *>(scene_node->getAttachedObject(i));
entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_SKIES_EARLY);
unsigned int attached_entities=entity->getNumSubEntities();
Ogre::AxisAlignedBox aabb;
aabb.setInfinite();
entity->getMesh()->_setBounds(aabb, false);
for (unsigned int j=0; j<attached_entities; j++) {
Ogre::SubEntity *sub_entity=entity->getSubEntity(j);
Ogre::MaterialPtr material=sub_entity->getMaterial();
Ogre::Pass *pass=material->getTechnique(0)->getPass(0);
pass->setDepthWriteEnabled(false);
}
}
}
}
示例2: setup
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
mRoot = new Ogre::Root(mPluginsCfg);
setupResources();
bool carryOn = configure();
if (!carryOn) return false;
chooseSceneManager();
createCamera();
createViewports();
// Set default mipmap level (NB some APIs ignore this)
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
// Create background material
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("Background", "General");
material->getTechnique(0)->getPass(0)->createTextureUnitState("space.jpg");
material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
// Create background rectangle covering the whole screen
rect = new Ogre::Rectangle2D(true);
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
rect->setMaterial("Background");
// Render the background before everything else
rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
rect->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Background");
node->attachObject(rect);
// Example of background scrolling
material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setScrollAnimation(-0.10, 0.0);
// Don't forget to delete the Rectangle2D in the destructor of your application:
// Create any resource listeners (for loading screens)
createResourceListener();
// Load resources
loadResources();
// Create the scene
createScene();
createFrameListener();
return true;
};
示例3: mSceneMgr
LoadingScreen::LoadingScreen(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* rw)
: mSceneMgr(sceneMgr)
, mWindow(rw)
, WindowBase("openmw_loading_screen.layout")
, mLastRenderTime(0.f)
, mLastWallpaperChangeTime(0.f)
, mFirstLoad(true)
, mProgress(0)
, mVSyncWasEnabled(false)
{
getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar");
getWidget(mBackgroundImage, "BackgroundImage");
mProgressBar->setScrollViewPage(1);
mBackgroundMaterial = Ogre::MaterialManager::getSingleton().create("BackgroundMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mBackgroundMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(false);
mBackgroundMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
mBackgroundMaterial->getTechnique(0)->getPass(0)->createTextureUnitState("");
mRectangle = new Ogre::Rectangle2D(true);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mRectangle->setMaterial("BackgroundMaterial");
// Render the background before everything else
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY-1);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(mRectangle);
mRectangle->setVisible(false);
}
示例4: mSceneMgr
Fader::Fader(Ogre::SceneManager* sceneMgr)
: mSceneMgr(sceneMgr)
, mMode(FadingMode_In)
, mRemainingTime(0.f)
, mTargetTime(0.f)
, mTargetAlpha(0.f)
, mCurrentAlpha(0.f)
, mStartAlpha(0.f)
, mFactor(1.f)
{
// Create the fading material
MaterialPtr material = MaterialManager::getSingleton().create("FadeInOutMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
Pass* pass = material->getTechnique(0)->getPass(0);
pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
pass->setDepthWriteEnabled (false);
mFadeTextureUnit = pass->createTextureUnitState("black.png");
mFadeTextureUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue(0.f, 0.f, 0.f)); // always black colour
mRectangle = new Ogre::Rectangle2D(true);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mRectangle->setMaterial("FadeInOutMaterial");
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY-1);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(mRectangle);
mRectangle->setVisible(false);
mRectangle->setVisibilityFlags (2048);
}
示例5:
const Ogre::AxisAlignedBox& Canvas::getBoundingBox() const
{
static Ogre::AxisAlignedBox box;
box.setInfinite();
return box;
}
示例6: onInitialize
void ImageDisplay::onInitialize()
{
ImageDisplayBase::onInitialize();
{
static uint32_t count = 0;
std::stringstream ss;
ss << "ImageDisplay" << count++;
img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, ss.str());
}
img_scene_node_ = img_scene_manager_->getRootSceneNode()->createChildSceneNode();
{
static int count = 0;
std::stringstream ss;
ss << "ImageDisplayObject" << count++;
screen_rect_ = new Ogre::Rectangle2D(true);
screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f);
ss << "Material";
material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
material_->setSceneBlending( Ogre::SBT_REPLACE );
material_->setDepthWriteEnabled(false);
material_->setReceiveShadows(false);
material_->setDepthCheckEnabled(false);
material_->getTechnique(0)->setLightingEnabled(false);
Ogre::TextureUnitState* tu = material_->getTechnique(0)->getPass(0)->createTextureUnitState();
tu->setTextureName(texture_.getTexture()->getName());
tu->setTextureFiltering( Ogre::TFO_NONE );
material_->setCullingMode(Ogre::CULL_NONE);
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
screen_rect_->setBoundingBox(aabInf);
screen_rect_->setMaterial(material_->getName());
img_scene_node_->attachObject(screen_rect_);
}
render_panel_ = new RenderPanel();
render_panel_->getRenderWindow()->setAutoUpdated(false);
render_panel_->getRenderWindow()->setActive( false );
render_panel_->resize( 640, 480 );
render_panel_->initialize(img_scene_manager_, context_);
setAssociatedWidget( render_panel_ );
render_panel_->setAutoRender(false);
render_panel_->setOverlaysEnabled(false);
render_panel_->getCamera()->setNearClipDistance( 0.01f );
updateNormalizeOptions();
}
示例7: createTexturedRect
Ogre::SceneNode* Terminal::createTexturedRect(std::string object_name, std::string texture_name, float left, float top, float right, float bottom)
{
MaterialPtr material = MaterialManager::getSingleton().create(object_name,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->createTextureUnitState(texture_name);
material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(true);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
// Ogre::Rectangle2D* rect = new Ogre::Rectangle2D(true);
ManualObject* manual = Entropy::getSingletonPtr()->mSceneMgr->createManualObject(object_name);
manual->setUseIdentityProjection(true);
manual->setUseIdentityView(true);
manual->begin(object_name, RenderOperation::OT_TRIANGLE_STRIP);
manual->position(left, bottom, 0.0);
manual->position(left, top, 0.0);
manual->position(right, bottom, 0.0);
manual->position(right, top, 0.0);
manual->index(0);
manual->index(1);
manual->index(2);
manual->index(3);
manual->end();
// rect->setCorners(left,top,right,bottom);
// rect->setMaterial(object_name);
manual->setRenderQueueGroup(RENDER_QUEUE_OVERLAY);
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
manual->setBoundingBox(aabInf);
Ogre::SceneNode* rect_node = Entropy::getSingletonPtr()->mSceneMgr->getRootSceneNode()->createChildSceneNode(object_name);
rect_node->attachObject(manual);
// rect->setVisible(false);
// rect_node->setPosition(0,0,0);
return rect_node;
}
示例8: init_manual
void Player::init_manual()
{
manual = Neurocaster::getSingletonPtr()->mSceneMgr->createManualObject(name);
manual->setUseIdentityView(true);
manual->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_STRIP);
double left = -0.25;
double top = 0.25;
double right = 0.25;
double bottom = -0.25;
float r = 1;
float g = 1;
float b = 1;
manual->position(Square(left,top).relative_convert());
manual->textureCoord(0,1);
manual->colour(r,g,b);
manual->position(Square(left,bottom).relative_convert());
manual->textureCoord(0,0);
manual->colour(r,g,b);
manual->position(Square(right,top).relative_convert());
manual->textureCoord(1,1);
manual->colour(r,g,b);
manual->position(Square(right,bottom).relative_convert());
manual->textureCoord(1,0);
manual->colour(r,g,b);
manual->end();
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
manual->setBoundingBox(aabInf);
manual->setRenderQueueGroup(Ogre::RENDER_QUEUE_2);
scene_node = Neurocaster::getSingletonPtr()->mSceneMgr->getRootSceneNode()->createChildSceneNode(name);
scene_node->attachObject(manual);
scene_node->setPosition(pos.convert());
}
示例9: addBillboardType
void OgreBillboardInterface::addBillboardType(const std::string& name, const std::string& material) {
billboard_types[name] = material;
billboard_sets[name] = scene->createBillboardSet(name.c_str(), 50);
billboard_sets[name]->setMaterialName(material.c_str());
billboard_sets[name]->setCommonDirection(Ogre::Vector3::UNIT_X);
billboard_sets[name]->setCommonUpVector(Ogre::Vector3::UNIT_Y);
billboard_sets[name]->setBillboardOrigin(Ogre::BBO_TOP_CENTER);
Ogre::AxisAlignedBox boundingBox;
boundingBox.setInfinite();
billboard_sets[name]->setBounds(boundingBox, 100.f);
Ogre::FloatRect textCords[]={Ogre::FloatRect(0.f, 0.f, 1.f, 1.f)};
billboard_sets[name]->setTextureCoords(textCords, 1);
node->attachObject(billboard_sets[name]);
}
开发者ID:AlexanderDzhoganov,项目名称:RIGE--RIGE-Is-A-Games-Engine-,代码行数:18,代码来源:ogre_billboard_interface.cpp
示例10: createScene
void SplashScreenState::createScene()
{
// creation image splash screen
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("SplashScreen", "General");
material->getTechnique(0)->getPass(0)->createTextureUnitState("splash_screen.jpg");
material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
// creation rect
Ogre::Rectangle2D *rect = new Ogre::Rectangle2D(true);
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
rect->setMaterial("SplashScreen");
// priorité chargement
rect->setRenderQueueGroup(Ogre::RenderQueueGroupID::RENDER_QUEUE_BACKGROUND);
// stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
rect->setBoundingBox(aabInf);
//
Ogre::SceneNode* node = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("SplashScreen");
node->attachObject(rect);
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(1, 1, 1));
}
示例11: NxEntity
NxRectangle2D::NxRectangle2D( NxNode * RectangleSceneNode, bool includeTextureCoordinates ) : NxEntity()
{
mType = NxTypeEntity;
static int index = 0;
mRectangle = new Ogre::Rectangle2D(includeTextureCoordinates);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
// Render the background before everything else
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
mNode = RectangleSceneNode->GetNxScene().GetNxSceneManager()->createSceneNode( RectangleSceneNode->GetName() + Ogre::StringConverter::toString( index ) );
mNode->attachObject( mRectangle );
mNxNodeParent = RectangleSceneNode;
mNxNodeParent->GetNxSceneNode()->addChild( mNode );
index++;
}
示例12: onInitialize
void ImageSelectionToolCustom::onInitialize()
{
move_tool_->initialize( context_ );
// Create our highlight rectangle
Ogre::SceneManager* scene_manager = context_->getSceneManager();
highlight_node_ = scene_manager->getRootSceneNode()->createChildSceneNode();
std::stringstream ss;
static int count = 0;
ss << "ImageSelectionRect" << count++;
highlight_rectangle_ = new Ogre::Rectangle2D(true);
const static uint32_t texture_data[1] = { 0xffff0070 };
Ogre::DataStreamPtr pixel_stream;
pixel_stream.bind(new Ogre::MemoryDataStream( (void*)&texture_data[0], 4 ));
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().loadRawData(ss.str() + "Texture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, pixel_stream, 1, 1, Ogre::PF_R8G8B8A8, Ogre::TEX_TYPE_2D, 0);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->setLightingEnabled(false);
//material->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME);
highlight_rectangle_->setMaterial(material->getName());
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
highlight_rectangle_->setBoundingBox(aabInf);
highlight_rectangle_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY + 4);
material->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
material->setCullingMode(Ogre::CULL_NONE);
Ogre::TextureUnitState* tex_unit = material->getTechnique(0)->getPass(0)->createTextureUnitState();
tex_unit->setTextureName(tex->getName());
tex_unit->setTextureFiltering( Ogre::TFO_NONE );
highlight_node_->attachObject(highlight_rectangle_);
}
示例13: onInitialize
void CameraDisplay::onInitialize()
{
caminfo_tf_filter_ = new tf::MessageFilter<sensor_msgs::CameraInfo>(*vis_manager_->getTFClient(), "", 2, update_nh_);
bg_scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode();
fg_scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode();
{
static int count = 0;
UniformStringStream ss;
ss << "CameraDisplayObject" << count++;
//background rectangle
bg_screen_rect_ = new Ogre::Rectangle2D(true);
bg_screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f);
ss << "Material";
bg_material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
bg_material_->setDepthWriteEnabled(false);
bg_material_->setReceiveShadows(false);
bg_material_->setDepthCheckEnabled(false);
bg_material_->getTechnique(0)->setLightingEnabled(false);
Ogre::TextureUnitState* tu = bg_material_->getTechnique(0)->getPass(0)->createTextureUnitState();
tu->setTextureName(texture_.getTexture()->getName());
tu->setTextureFiltering( Ogre::TFO_NONE );
tu->setAlphaOperation( Ogre::LBX_SOURCE1, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, 0.0 );
bg_material_->setCullingMode(Ogre::CULL_NONE);
bg_material_->setSceneBlending( Ogre::SBT_REPLACE );
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
bg_screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
bg_screen_rect_->setBoundingBox(aabInf);
bg_screen_rect_->setMaterial(bg_material_->getName());
bg_scene_node_->attachObject(bg_screen_rect_);
bg_scene_node_->setVisible(false);
//overlay rectangle
fg_screen_rect_ = new Ogre::Rectangle2D(true);
fg_screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f);
fg_material_ = bg_material_->clone( ss.str()+"fg" );
fg_screen_rect_->setBoundingBox(aabInf);
fg_screen_rect_->setMaterial(fg_material_->getName());
fg_material_->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
fg_screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
fg_scene_node_->attachObject(fg_screen_rect_);
fg_scene_node_->setVisible(false);
}
setAlpha( 0.5f );
render_panel_ = new RenderPanel();
render_panel_->getRenderWindow()->addListener( this );
render_panel_->getRenderWindow()->setAutoUpdated(false);
render_panel_->getRenderWindow()->setActive( false );
render_panel_->resize( 640, 480 );
render_panel_->initialize(vis_manager_->getSceneManager(), vis_manager_);
WindowManagerInterface* wm = vis_manager_->getWindowManager();
if( wm )
{
panel_container_ = wm->addPane(name_, render_panel_);
}
render_panel_->setAutoRender(false);
render_panel_->setOverlaysEnabled(false);
render_panel_->getCamera()->setNearClipDistance( 0.01f );
caminfo_tf_filter_->connectInput(caminfo_sub_);
caminfo_tf_filter_->registerCallback(boost::bind(&CameraDisplay::caminfoCallback, this, _1));
vis_manager_->getFrameManager()->registerFilterForTransformStatusCheck(caminfo_tf_filter_, this);
if( panel_container_ )
{
// TODO: wouldn't it be better to connect this straight to the wrapper?
connect( panel_container_, SIGNAL( visibilityChanged( bool ) ), this, SLOT( setWrapperEnabled( bool )));
}
}
示例14: updateCamera
//.........这里部分代码省略.........
ROS_DEBUG("Malformed CameraInfo on camera [%s], width = 0", getName().c_str());
img_width = texture_.getWidth();
}
if (img_height == 0)
{
ROS_DEBUG("Malformed CameraInfo on camera [%s], height = 0", getName().c_str());
img_height = texture_.getHeight();
}
if (img_height == 0.0 || img_width == 0.0)
{
setStatus(status_levels::Error, "CameraInfo", "Could not determine width/height of image due to malformed CameraInfo (either width or height is 0)");
return;
}
double fx = info->P[0];
double fy = info->P[5];
float win_width = render_panel_->width();
float win_height = render_panel_->height();
float zoom_x = zoom_;
float zoom_y = zoom_;
//preserve aspect ratio
if ( win_width != 0 && win_height != 0 )
{
float img_aspect = (img_width/fx) / (img_height/fy);
float win_aspect = win_width / win_height;
if ( img_aspect > win_aspect )
{
zoom_y = zoom_y / img_aspect * win_aspect;
}
else
{
zoom_x = zoom_x / win_aspect * img_aspect;
}
}
// Add the camera's translation relative to the left camera (from P[3]);
double tx = -1 * (info->P[3] / fx);
Ogre::Vector3 right = orientation * Ogre::Vector3::UNIT_X;
position = position + (right * tx);
double ty = -1 * (info->P[7] / fy);
Ogre::Vector3 down = orientation * Ogre::Vector3::UNIT_Y;
position = position + (down * ty);
if (!validateFloats(position))
{
setStatus(status_levels::Error, "CameraInfo", "CameraInfo/P resulted in an invalid position calculation (nans or infs)");
return;
}
render_panel_->getCamera()->setPosition(position);
render_panel_->getCamera()->setOrientation(orientation);
// calculate the projection matrix
double cx = info->P[2];
double cy = info->P[6];
double far_plane = 100;
double near_plane = 0.01;
Ogre::Matrix4 proj_matrix;
proj_matrix = Ogre::Matrix4::ZERO;
proj_matrix[0][0]= 2.0 * fx/img_width * zoom_x;
proj_matrix[1][1]= 2.0 * fy/img_height * zoom_y;
proj_matrix[0][2]= 2.0 * (0.5 - cx/img_width) * zoom_x;
proj_matrix[1][2]= 2.0 * (cy/img_height - 0.5) * zoom_y;
proj_matrix[2][2]= -(far_plane+near_plane) / (far_plane-near_plane);
proj_matrix[2][3]= -2.0*far_plane*near_plane / (far_plane-near_plane);
proj_matrix[3][2]= -1;
render_panel_->getCamera()->setCustomProjectionMatrix( true, proj_matrix );
setStatus(status_levels::Ok, "CameraInfo", "OK");
#if 0
static Axes* debug_axes = new Axes(scene_manager_, 0, 0.2, 0.01);
debug_axes->setPosition(position);
debug_axes->setOrientation(orientation);
#endif
//adjust the image rectangles to fit the zoom & aspect ratio
bg_screen_rect_->setCorners(-1.0f*zoom_x, 1.0f*zoom_y, 1.0f*zoom_x, -1.0f*zoom_y);
fg_screen_rect_->setCorners(-1.0f*zoom_x, 1.0f*zoom_y, 1.0f*zoom_x, -1.0f*zoom_y);
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
bg_screen_rect_->setBoundingBox(aabInf);
fg_screen_rect_->setBoundingBox(aabInf);
}
示例15: Display
CameraDisplaySave::CameraDisplaySave( const std::string& name, VisualizationManager* manager )
: Display( name, manager )
, transport_("raw")
, caminfo_tf_filter_(*manager->getTFClient(), "", 2, update_nh_)
, new_caminfo_(false)
, texture_(update_nh_)
, frame_(0)
, force_render_(false)
, render_listener_(this)
{
scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode();
{
static int count = 0;
std::stringstream ss;
ss << "CameraDisplaySaveObject" << count++;
screen_rect_ = new Ogre::Rectangle2D(true);
screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f);
ss << "Material";
material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
material_->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
material_->setDepthWriteEnabled(false);
material_->setReceiveShadows(false);
material_->setDepthCheckEnabled(false);
#if 1
material_->getTechnique(0)->setLightingEnabled(false);
Ogre::TextureUnitState* tu = material_->getTechnique(0)->getPass(0)->createTextureUnitState();
tu->setTextureName(texture_.getTexture()->getName());
tu->setTextureFiltering( Ogre::TFO_NONE );
tu->setAlphaOperation( Ogre::LBX_SOURCE1, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, 0.0 );
#else
material_->getTechnique(0)->setLightingEnabled(true);
material_->setAmbient(Ogre::ColourValue(0.0f, 1.0f, 1.0f, 1.0f));
#endif
material_->setCullingMode(Ogre::CULL_NONE);
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
screen_rect_->setBoundingBox(aabInf);
screen_rect_->setMaterial(material_->getName());
scene_node_->attachObject(screen_rect_);
}
setAlpha( 0.5f );
wxWindow* parent = 0;
WindowManagerInterface* wm = vis_manager_->getWindowManager();
if (wm)
{
parent = wm->getParentWindow();
}
else
{
frame_ = new wxFrame(0, wxID_ANY, wxString::FromAscii(name.c_str()), wxPoint(100,100), wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLIP_CHILDREN);
parent = frame_;
}
render_panel_ = new RenderPanel(parent, false);
render_panel_->SetSize(wxSize(640, 480));
if (wm)
{
wm->addPane(name, render_panel_);
}
render_panel_->createRenderWindow();
render_panel_->initialize(vis_manager_->getSceneManager(), vis_manager_);
render_panel_->setAutoRender(false);
render_panel_->getRenderWindow()->addListener(&render_listener_);
render_panel_->getViewport()->setOverlaysEnabled(false);
render_panel_->getViewport()->setClearEveryFrame(true);
render_panel_->getRenderWindow()->setActive(false);
render_panel_->getRenderWindow()->setAutoUpdated(false);
render_panel_->getCamera()->setNearClipDistance( 0.1f );
caminfo_tf_filter_.connectInput(caminfo_sub_);
caminfo_tf_filter_.registerCallback(boost::bind(&CameraDisplaySave::caminfoCallback, this, _1));
vis_manager_->getFrameManager()->registerFilterForTransformStatusCheck(caminfo_tf_filter_, this);
}