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 ); }
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(); }
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); }
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); }
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); }