Пример #1
0
void Viewport::LoadSettings(SceneGraph::ViewportSettings* prefs)
{
	// apply settings for all modes that we have... 
	for(size_t i = 0; i < prefs->m_CameraPrefs.size(); ++i)
	{
		CameraSettingsPtr cameraPrefs = prefs->m_CameraPrefs[i]; 
		CameraMode mode = cameraPrefs->m_CameraMode; 
		SceneGraph::Camera* camera = GetCameraForMode(mode); 
		camera->LoadSettings(cameraPrefs); 
	}

	SetCameraMode( prefs->m_CameraMode ); 
	SetGeometryMode( prefs->m_GeometryMode ); 
	SetHighlighting( prefs->m_Highlighting ); 
	SetAxesVisible( prefs->m_AxesVisible ); 
	SetGridVisible( prefs->m_GridVisible ); 
	SetBoundsVisible( prefs->m_BoundsVisible ); 
	SetStatisticsVisible( prefs->m_StatisticsVisible ); 
}
Пример #2
0
void Viewport::SaveSettings(SceneGraph::ViewportSettings* prefs)
{
	// just blow away the previous preferences
	prefs->m_CameraPrefs.clear(); 

	for(int i = 0; i < CameraMode::Count; ++i)
	{
		CameraMode mode = static_cast< CameraMode::Enum >( i ); 
		CameraSettingsPtr cameraPrefs = new CameraSettings(); 
		cameraPrefs->m_CameraMode = mode;
		SceneGraph::Camera* camera = GetCameraForMode( mode ); 
		camera->SaveSettings(cameraPrefs); 
		prefs->m_CameraPrefs.push_back( cameraPrefs ); 
	}

	prefs->m_CameraMode = GetCameraMode(); 
	prefs->m_GeometryMode = GetGeometryMode(); 
	prefs->m_Highlighting = IsHighlighting(); 
	prefs->m_AxesVisible = IsAxesVisible(); 
	prefs->m_GridVisible = IsGridVisible(); 
	prefs->m_BoundsVisible = IsBoundsVisible(); 
	prefs->m_StatisticsVisible = IsStatisticsVisible(); 
}
Пример #3
0
template<UnsignedInt dimensions> void ForceRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::Camera<dimensions, Float>& camera) {
    _shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation<dimensions>(transformationMatrix.transformPoint(_forcePosition), _force)*MatrixTypeFor<dimensions, Float>::scaling(VectorTypeFor<dimensions, Float>{_options->scale()}))
        .setColor(_options->color());
    _mesh->draw(*_shader);
}
Пример #4
0
template<UnsignedInt dimensions> void ShapeRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>&, SceneGraph::Camera<dimensions, Float>& camera) {
    const MatrixTypeFor<dimensions, Float> projectionMatrix = camera.projectionMatrix()*camera.cameraMatrix();
    for(auto i: _renderers) i->draw(_options, projectionMatrix);
}
Пример #5
0
template<UnsignedInt dimensions> void ObjectRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::Camera<dimensions, Float>& camera) {
    _shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*MatrixTypeFor<dimensions, Float>::scaling(VectorTypeFor<dimensions, Float>{_options->size()}));
    _mesh->draw(*_shader);
}