コード例 #1
0
CSulIntersectionWithCamera::CSulIntersectionWithCamera( osg::Node* pNode, CSulIntersectionInfo* pIntersectionInfo )
{
	m_pos.set( 0, 0, 0 );
	m_dir.set( 1, 0, 0 );

	// render to texture (RTT)
	//m_rTexCam = new CSulTexCam( 128, 128, CSulTexCam::ZVALUE_WITH_IMAGE );
	m_rTexCam = new CSulTexCam( 128, 128, CSulTexCam::ZVALUE_FROM_DEPTH );
	
	//m_rTexCam->setDataVariance( osg::Object::DYNAMIC );
	m_rTexCam->addChild( pNode );
	addChild( m_rTexCam );

	// set a z position shader on the camera
	new CSulShaderZ( m_rTexCam );

	// the drawcallback is used to notify when the camera/intersection test has rendered a frame
	m_rDrawCallback = new CSulIntersectionDrawCallback( pIntersectionInfo, m_rTexCam->getImage() );
//	m_rTexCam->setFinalDrawCallback( m_rDrawCallback );
	m_rTexCam->setPostDrawCallback( m_rDrawCallback );

	// we need an update callback to ensure that we don't get threading problems with the drawcallback
	m_rSulIntersectionWithCameraCallback = new CSulIntersectionWithCameraCallback( m_rDrawCallback );
	addUpdateCallback( m_rSulIntersectionWithCameraCallback );

	setCullCallback( new CSulIntersectionCullCallback( m_rDrawCallback ) );
}
コード例 #2
0
ファイル: VInfoTreeWindow.cpp プロジェクト: FreeDegree/Zhang
	VInfoTreeWindow::VInfoTreeWindow(osgWidget::WindowManager* wm, const std::string& name, osgWidget::point_type size)
		:osgWidget::Canvas(name)
		, _windowManager(wm)
		, _windowSize(size)
	{
		getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.0f);
		setEventMask(osgWidget::EVENT_MASK_MOUSE_CLICK | osgWidget::EVENT_MASK_MOUSE_MOVE);
		_showCallback = new InfoTreeCallback(this);
		addUpdateCallback(_showCallback);
	}