Changeset e8c636 for src


Ignore:
Timestamp:
Jul 17, 2012, 12:17:23 PM (13 years ago)
Author:
Michael Ankele <ankele@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
585f78
Parents:
d1196d
git-author:
Michael Ankele <ankele@…> (05/04/12 14:24:06)
git-committer:
Michael Ankele <ankele@…> (07/17/12 12:17:23)
Message:

REFACTORING: moved drawDomainBox()/drawDreiBein() from GLWorldScene to GLWorldView

Location:
src/UIElements/Views/Qt4/Qt3D
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    rd1196d re8c636  
    5555{
    5656  init();
    57 
    58   //changeMaterials(false);
    59   domainBoxMaterial = new QGLMaterial;
    60   domainBoxMaterial->setAmbientColor(QColor(0,0,0,255));
    61   domainBoxMaterial->setDiffuseColor(QColor(0,0,0,255));
    62   domainBoxMaterial->setEmittedLight(QColor(150,160,200,255));
    63 
    64   dreiBeinMaterial = new QGLMaterial;
    65   dreiBeinMaterial->setAmbientColor(QColor(0,0,0,255));
    66   dreiBeinMaterial->setDiffuseColor(QColor(0,0,0,255));
    67   dreiBeinMaterial->setEmittedLight(QColor(150,200,150,255));
    6857}
    6958
     
    7261  // remove all elements
    7362  GLMoleculeObject::cleanMaterialMap();
    74 
    75   delete(domainBoxMaterial);
    76   delete(dreiBeinMaterial);
    7763}
    7864
     
    278264}
    279265
    280 void GLWorldScene::drawDomainBox(QGLPainter *painter) const
    281 {
    282   RealSpaceMatrix m = World::getInstance().getDomain().getM();
    283   painter->modelViewMatrix().push();
    284   painter->modelViewMatrix() *= QMatrix4x4(m.at(0,0), m.at(0,1), m.at(0,2), 0.0,
    285                                            m.at(1,0), m.at(1,1), m.at(1,2), 0.0,
    286                                            m.at(2,0), m.at(2,1), m.at(2,2), 0.0,
    287                                            0.0,       0.0,       0.0,       1.0);
    288 
    289   painter->setFaceMaterial(QGL::AllFaces, domainBoxMaterial);
    290   //glEnable(GL_LINE_SMOOTH);
    291   QVector3DArray array;
    292   array.append(0, 0, 0); array.append(1, 0, 0);
    293   array.append(1, 0, 0); array.append(1, 1, 0);
    294   array.append(1, 1, 0); array.append(0, 1, 0);
    295   array.append(0, 1, 0); array.append(0, 0, 0);
    296 
    297   array.append(0, 0, 1); array.append(1, 0, 1);
    298   array.append(1, 0, 1); array.append(1, 1, 1);
    299   array.append(1, 1, 1); array.append(0, 1, 1);
    300   array.append(0, 1, 1); array.append(0, 0, 1);
    301 
    302   array.append(0, 0, 0); array.append(0, 0, 1);
    303   array.append(1, 0, 0); array.append(1, 0, 1);
    304   array.append(0, 1, 0); array.append(0, 1, 1);
    305   array.append(1, 1, 0); array.append(1, 1, 1);
    306   painter->clearAttributes();
    307   painter->setVertexAttribute(QGL::Position, array);
    308   painter->draw(QGL::Lines, 24);
    309   painter->modelViewMatrix().pop();
    310 }
    311 
    312 void GLWorldScene::drawDreiBein(QGLPainter *painter) const
    313 {
    314   QGLView *view = dynamic_cast<QGLView*>(this->parent());
    315   painter->modelViewMatrix().push();
    316   painter->modelViewMatrix().translate(view->camera()->center());
    317   painter->setFaceMaterial(QGL::AllFaces, dreiBeinMaterial);
    318   QVector3DArray array;
    319   array.append(0, 0, 0); array.append(1, 0, 0);
    320   array.append(0, 0, 0); array.append(0, 1, 0);
    321   array.append(0, 0, 0); array.append(0, 0, 1);
    322   painter->clearAttributes();
    323   painter->setVertexAttribute(QGL::Position, array);
    324   painter->draw(QGL::Lines, 6);
    325   painter->modelViewMatrix().pop();
    326 }
    327 
    328266void GLWorldScene::draw(QGLPainter *painter) const
    329267{
     
    334272         meshobj->draw(painter);
    335273   }
    336 
    337    drawDomainBox(painter);
    338    drawDreiBein(painter);
    339274}
    340275
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    rd1196d re8c636  
    5656  void initialize(QGLView *view, QGLPainter *painter) const;
    5757  void draw(QGLPainter *painter) const;
    58   void drawDomainBox(QGLPainter *painter) const;
    59   void drawDreiBein(QGLPainter *painter) const;
    6058
    6159signals:
     
    9189  BondNodeMap BondsinSceneMap;
    9290  MoleculeNodeMap MoleculesinSceneMap;
    93 
    94   QGLMaterial *domainBoxMaterial;
    95   QGLMaterial *dreiBeinMaterial;
    9691};
    9792
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    rd1196d re8c636  
    4343  setOption(QGLView::CameraNavigation, false);
    4444  setCameraControlMode(Rotate);
     45
     46  //changeMaterials(false);
     47  domainBoxMaterial = new QGLMaterial;
     48  domainBoxMaterial->setAmbientColor(QColor(0,0,0,255));
     49  domainBoxMaterial->setDiffuseColor(QColor(0,0,0,255));
     50  domainBoxMaterial->setEmittedLight(QColor(150,160,200,255));
     51
     52  for (int i=0;i<3;i++){
     53    dreiBeinMaterial[i] = new QGLMaterial;
     54    dreiBeinMaterial[i]->setAmbientColor(QColor(0,0,0,255));
     55    dreiBeinMaterial[i]->setDiffuseColor(QColor(0,0,0,255));
     56    dreiBeinMaterial[i]->setEmittedLight(QColor(150,200,150,255));
     57  }
    4558
    4659  connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
     
    7285  AtomObserver::getInstance().signOff(this, AtomObservable::PositionChanged);
    7386  delete worldscene;
     87
     88  delete(domainBoxMaterial);
     89  for (int i=0;i<3;i++)
     90    delete(dreiBeinMaterial[i]);
    7491}
    7592
     
    192209void GLWorldView::paintGL(QGLPainter *painter)
    193210{
     211  drawDomainBox(painter);
     212
    194213  if (changesPresent) {
    195214    initializeGL(painter);
     
    197216  }
    198217  worldscene->draw(painter);
     218
     219  drawDreiBein(painter);
    199220}
    200221
     
    319340  // Set new eye position.
    320341  camera()->setEye(camera()->center() + d);
     342}
     343
     344void GLWorldView::drawDomainBox(QGLPainter *painter) const
     345{
     346  RealSpaceMatrix m = World::getInstance().getDomain().getM();
     347  painter->modelViewMatrix().push();
     348  painter->modelViewMatrix() *= QMatrix4x4(m.at(0,0), m.at(0,1), m.at(0,2), 0.0,
     349                                           m.at(1,0), m.at(1,1), m.at(1,2), 0.0,
     350                                           m.at(2,0), m.at(2,1), m.at(2,2), 0.0,
     351                                           0.0,       0.0,       0.0,       1.0);
     352
     353  painter->setFaceMaterial(QGL::AllFaces, domainBoxMaterial);
     354  //glEnable(GL_LINE_SMOOTH);
     355  QVector3DArray array;
     356  array.append(0, 0, 0); array.append(1, 0, 0);
     357  array.append(1, 0, 0); array.append(1, 1, 0);
     358  array.append(1, 1, 0); array.append(0, 1, 0);
     359  array.append(0, 1, 0); array.append(0, 0, 0);
     360
     361  array.append(0, 0, 1); array.append(1, 0, 1);
     362  array.append(1, 0, 1); array.append(1, 1, 1);
     363  array.append(1, 1, 1); array.append(0, 1, 1);
     364  array.append(0, 1, 1); array.append(0, 0, 1);
     365
     366  array.append(0, 0, 0); array.append(0, 0, 1);
     367  array.append(1, 0, 0); array.append(1, 0, 1);
     368  array.append(0, 1, 0); array.append(0, 1, 1);
     369  array.append(1, 1, 0); array.append(1, 1, 1);
     370  painter->clearAttributes();
     371  painter->setVertexAttribute(QGL::Position, array);
     372  painter->draw(QGL::Lines, 24);
     373  painter->modelViewMatrix().pop();
     374}
     375
     376void GLWorldView::drawDreiBein(QGLPainter *painter)
     377{
     378  painter->modelViewMatrix().push();
     379  painter->modelViewMatrix().translate(camera()->center());
     380  painter->setFaceMaterial(QGL::AllFaces, dreiBeinMaterial[0]);
     381  QVector3DArray array;
     382  array.append(0, 0, 0); array.append(1, 0, 0);
     383  array.append(0, 0, 0); array.append(0, 1, 0);
     384  array.append(0, 0, 0); array.append(0, 0, 1);
     385  painter->clearAttributes();
     386  painter->setVertexAttribute(QGL::Position, array);
     387  painter->draw(QGL::Lines, 6);
     388  painter->modelViewMatrix().pop();
    321389}
    322390
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    rd1196d re8c636  
    5858  void initializeGL(QGLPainter *painter);
    5959  void paintGL(QGLPainter *painter);
     60  void drawDomainBox(QGLPainter *painter) const;
     61  void drawDreiBein(QGLPainter *painter);
    6062
    6163  // input functions
     
    8890
    8991  QPointF lastMousePos;
     92
     93  QGLMaterial *domainBoxMaterial;
     94  QGLMaterial *dreiBeinMaterial[3];
    9095};
    9196
Note: See TracChangeset for help on using the changeset viewer.