b311480e |
1 | // Created on: 2002-04-09 |
2 | // Created by: QA Admin |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
1cd84fee |
16 | #include <QABugs_PresentableObject.ixx> |
17 | #include <QABugs_PresentableObject.hxx> |
7fd59977 |
18 | |
19 | #include <Graphic3d_Group.hxx> |
20 | #include <Graphic3d_MaterialAspect.hxx> |
21 | #include <Prs3d_ShadingAspect.hxx> |
22 | #include <Graphic3d_AspectFillArea3d.hxx> |
2bd4c032 |
23 | #include <Graphic3d_ArrayOfTriangles.hxx> |
24 | #include <gp_Dir.hxx> |
25 | #include <gp_Pnt.hxx> |
6262338c |
26 | #include <Prs3d_Drawer.hxx> |
ec357c5c |
27 | #include <Graphic3d_Structure.hxx> |
7fd59977 |
28 | |
2bd4c032 |
29 | QABugs_PresentableObject::QABugs_PresentableObject(const PrsMgr_TypeOfPresentation3d theTypeOfPresentation3d) |
30 | :AIS_InteractiveObject(theTypeOfPresentation3d) |
7fd59977 |
31 | { |
32 | } |
33 | |
2bd4c032 |
34 | void QABugs_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& , |
35 | const Handle(Prs3d_Presentation)& thePrs, |
36 | const Standard_Integer theMode) |
7fd59977 |
37 | { |
2bd4c032 |
38 | Handle(Graphic3d_Structure) aStructure = Handle(Graphic3d_Structure)::DownCast (thePrs); |
b64d84be |
39 | Handle(Graphic3d_Group) aGroup = aStructure->NewGroup(); |
857ffd5e |
40 | Handle(Prs3d_ShadingAspect) anAspect = myDrawer->ShadingAspect(); |
2bd4c032 |
41 | Graphic3d_MaterialAspect aMat = anAspect->Aspect()->FrontMaterial(); |
42 | aMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT); |
43 | aMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE); |
44 | aMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR); |
45 | aMat.SetReflectionModeOff (Graphic3d_TOR_EMISSION); |
46 | anAspect->SetMaterial (aMat); |
47 | aGroup->SetPrimitivesAspect (anAspect->Aspect()); |
7fd59977 |
48 | |
2bd4c032 |
49 | Handle(Graphic3d_ArrayOfTriangles) aPrims |
50 | = new Graphic3d_ArrayOfTriangles (6, 0, |
51 | theMode == 1, // normals |
52 | Standard_True); // color per vertex |
53 | switch (theMode) |
54 | { |
55 | case 0: |
7fd59977 |
56 | { |
2bd4c032 |
57 | aPrims->AddVertex (gp_Pnt (0.0, 0.0, 0.0), Quantity_Color (Quantity_NOC_RED)); |
58 | aPrims->AddVertex (gp_Pnt (0.0, 5.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1)); |
59 | aPrims->AddVertex (gp_Pnt (5.0, 0.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW)); |
7fd59977 |
60 | |
2bd4c032 |
61 | aPrims->AddVertex (gp_Pnt (0.0, 5.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1)); |
62 | aPrims->AddVertex (gp_Pnt (5.0, 5.0, -1.0), Quantity_Color (Quantity_NOC_GREEN)); |
63 | aPrims->AddVertex (gp_Pnt (5.0, 0.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW)); |
7fd59977 |
64 | break; |
65 | } |
2bd4c032 |
66 | case 1: |
67 | { |
68 | aPrims->AddVertex (gp_Pnt ( 5.0, 0.0, 0.0), gp_Dir (0.0, 0.0, 1.0), Quantity_Color (Quantity_NOC_RED)); |
69 | aPrims->AddVertex (gp_Pnt ( 5.0, 5.0, 1.0), gp_Dir (1.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1)); |
70 | aPrims->AddVertex (gp_Pnt (10.0, 0.0, 1.0), gp_Dir (0.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW)); |
71 | |
72 | aPrims->AddVertex (gp_Pnt ( 5.0, 5.0, 1.0), gp_Dir (1.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1)); |
73 | aPrims->AddVertex (gp_Pnt (10.0, 5.0, -1.0), gp_Dir (0.0, 0.0, -1.0), Quantity_Color (Quantity_NOC_GREEN)); |
74 | aPrims->AddVertex (gp_Pnt (10.0, 0.0, 1.0), gp_Dir (0.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW)); |
75 | } |
76 | break; |
77 | } |
78 | |
2bd4c032 |
79 | aGroup->AddPrimitiveArray (aPrims); |
7fd59977 |
80 | } |
81 | |
2bd4c032 |
82 | void QABugs_PresentableObject::ComputeSelection(const Handle(SelectMgr_Selection)& , |
83 | const Standard_Integer ) { |
7fd59977 |
84 | } |