Ignore:
Timestamp:
Jul 17, 2012, 12:17:24 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:
0a6ff9
Parents:
26ed25
git-author:
Michael Ankele <ankele@…> (05/08/12 13:11:41)
git-committer:
Michael Ankele <ankele@…> (07/17/12 12:17:24)
Message:

GL: prettier domain box

File:
1 edited

Legend:

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

    r26ed25 r02b2d3  
    2828#include <Qt3D/qglsphere.h>
    2929#include <Qt3D/qglcylinder.h>
     30#include <Qt3D/qglcube.h>
    3031
    3132#include "GLWorldScene.hpp"
     
    5253  createDreiBein();
    5354  //changeMaterials(false);
    54   domainBoxMaterial = new QGLMaterial;
    55   domainBoxMaterial->setAmbientColor(QColor(0,0,0,255));
    56   domainBoxMaterial->setDiffuseColor(QColor(0,0,0,255));
    57   domainBoxMaterial->setEmittedLight(QColor(150,160,200,255));
    5855
    5956  connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
     
    116113void GLWorldView::createDomainBox()
    117114{
    118 
     115  domainBoxMaterial = new QGLMaterial;
     116  domainBoxMaterial->setAmbientColor(QColor(0,0,0,255));
     117  domainBoxMaterial->setDiffuseColor(QColor(0,0,0,255));
     118  domainBoxMaterial->setEmittedLight(QColor(150,160,200,255));
     119
     120
     121  QGLMaterial *material = new QGLMaterial;
     122  material->setAmbientColor(QColor(50,60,100,255));
     123  material->setDiffuseColor(QColor(150,160,200,180));
     124
     125  QGLBuilder builder;
     126  builder << QGL::Faceted;
     127  builder << QGLCube(-1.0); // "inverted" => inside faces are used as front.
     128  meshDomainBox = builder.finalizedSceneNode();
     129  QMatrix4x4 mat;
     130  mat.translate(0.5f, 0.5f, 0.5f);
     131  meshDomainBox->setLocalTransform(mat);
     132  meshDomainBox->setMaterial(material);
    119133}
    120134
    121135void GLWorldView::createDreiBein()
    122136{
     137  // Create 3 color for the 3 axes.
    123138  dreiBeinMaterial[0] = new QGLMaterial;
    124139  dreiBeinMaterial[0]->setColor(QColor(255,50,50,255));
     
    128143  dreiBeinMaterial[2]->setColor(QColor(50,50,255,255));
    129144
     145  // Create the basic meshes (cylinder and cone).
    130146  QGLBuilder builderCyl;
    131147  builderCyl << QGLCylinder(.15,.15,1.0,16);
     
    141157  }
    142158
     159  // Create a scene node from the 3 axes.
    143160  meshDreiBein = new QGLSceneNode(this);
    144161
     
    285302void GLWorldView::paintGL(QGLPainter *painter)
    286303{
    287   drawDomainBox(painter);
    288 
    289304  if (changesPresent) {
    290305    initializeGL(painter);
     
    294309
    295310  drawDreiBein(painter);
     311
     312  // Domain box has to be last because of its transparency.
     313  drawDomainBox(painter);
    296314}
    297315
     
    418436}
    419437
     438/**
     439 * Draw a transparent cube representing the domain.
     440 */
    420441void GLWorldView::drawDomainBox(QGLPainter *painter) const
    421442{
     443  // Apply the domain matrix.
    422444  RealSpaceMatrix m = World::getInstance().getDomain().getM();
    423445  painter->modelViewMatrix().push();
     
    427449                                           0.0,       0.0,       0.0,       1.0);
    428450
     451  // Draw the transparent cube.
     452  glCullFace(GL_BACK);
     453  glEnable(GL_CULL_FACE);
     454  glEnable(GL_BLEND);
     455  glDepthMask(0);
     456  //glDisable(GL_DEPTH_TEST);
     457  meshDomainBox->draw(painter);
     458  //glEnable(GL_DEPTH_TEST);
     459  glDepthMask(1);
     460  glDisable(GL_BLEND);
     461  glDisable(GL_CULL_FACE);
     462
     463  // Draw the outlines.
    429464  painter->setFaceMaterial(QGL::AllFaces, domainBoxMaterial);
    430465  //glEnable(GL_LINE_SMOOTH);
     
    447482  painter->setVertexAttribute(QGL::Position, array);
    448483  painter->draw(QGL::Lines, 24);
     484
    449485  painter->modelViewMatrix().pop();
    450486}
     
    454490  painter->modelViewMatrix().push();
    455491  painter->modelViewMatrix().translate(camera()->center());
    456   painter->setFaceMaterial(QGL::AllFaces, NULL);
     492  painter->setFaceMaterial(QGL::FrontFaces, NULL);
    457493  meshDreiBein->draw(painter);
    458494  painter->modelViewMatrix().pop();
Note: See TracChangeset for help on using the changeset viewer.