1 // File: QADBMReflex_OCC749PrsUseVertexABV.cxx
2 // Created: Mon Oct 7 15:01:41 2002
7 #include <QADBMReflex_OCC749PrsUseVertexABV.ixx>
9 #include <Prs3d_Root.hxx>
10 #include <Graphic3d_Group.hxx>
11 #include <Graphic3d_Vertex.hxx>
12 #include <Aspect_Array1OfEdge.hxx>
13 #include <Graphic3d_AspectFillArea3d.hxx>
14 #include <Graphic3d_MaterialAspect.hxx>
15 #include <Quantity_Color.hxx>
16 #include <Graphic3d_Array1OfVertexC.hxx>
17 #include <Aspect_Edge.hxx>
20 #include <Graphic3d_Array1OfVertex.hxx>
21 #include <OSD_Timer.hxx>
23 //=======================================================================
24 //function : QADBMReflex_OCC749PrsUseVertexABV
26 //=======================================================================
28 QADBMReflex_OCC749PrsUseVertexABV::QADBMReflex_OCC749PrsUseVertexABV( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) {
31 static OSD_Timer Timer;
33 //=======================================================================
36 //=======================================================================
38 void QADBMReflex_OCC749PrsUseVertexABV::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr,
39 const Handle(Prs3d_Presentation)& aPresentation,
40 const Standard_Integer aMode )
42 Standard_Boolean BooleanTimer = GetTimer();
48 aPresentation->Clear();
49 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation);
51 Graphic3d_MaterialAspect aFlatMat;
52 Standard_Boolean BooleanMaterial = GetMaterial();
53 if (BooleanMaterial) {
54 aFlatMat = GetMaterialAspect();
57 Standard_Boolean BooleanReflection = GetReflection();
58 if (BooleanReflection) {
59 aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT);
60 aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE);
61 aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR);
62 aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
64 aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
65 aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
66 aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
67 aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
70 Quantity_Color InteriorColor = GetInteriorColor();
71 Quantity_Color EdgeColor = GetEdgeColor();
72 Standard_Integer XCOUNT = GetXCount();
73 Standard_Integer YCOUNT = GetYCount();
74 Standard_Integer BOXSIZE = GetBoxSize();
76 //Handle(Graphic3d_AspectFillArea3d) Fill3d;
77 //Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
85 //aGroup->SetPrimitivesAspect(Fill3d);
86 aGroup->BeginPrimitives();
88 Standard_Integer i,j,z1=0,z2,zmax=XCOUNT;
89 if (YCOUNT > XCOUNT) zmax = YCOUNT;
91 Standard_Integer HMAX = 100;
92 BOXSIZE = HMAX / zmax;
96 for (i=0; i < XCOUNT; i++){
97 for (j=0; j < YCOUNT; j++){
99 //Quantity_NameOfColor aColor = Quantity_Color::Name(1.,
101 // (double)i/XCOUNT);
102 Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
103 Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB),
109 //////////////////if (i == 0 && j ==0) {
110 //////////////////Fill3d->SetInteriorColor(InteriorColor);
112 aGroup->SetPrimitivesAspect(Fill3d);
114 Graphic3d_Array1OfVertex aVertexes(1, 8);
116 //////////////////z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2));
117 z2 = BOXSIZE +(i*BOXSIZE - j*BOXSIZE/2);
118 aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1);
119 aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1);
120 aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
121 aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
122 aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2);
123 aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2);
124 aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
125 aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
127 Aspect_Array1OfEdge aEdges(1, 24);
128 aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE);
129 aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE);
130 aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE);
131 aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE);
133 aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
134 aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
135 aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
136 aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
138 aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE);
139 aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
140 aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE);
141 aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE);
143 aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
144 aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE);
145 aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE);
146 aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE);
148 aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE);
149 aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
150 aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE);
151 aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE);
153 aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE);
154 aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
155 aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE);
156 aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE);
158 aGroup->QuadrangleSet(aVertexes, aEdges);
161 aGroup->EndPrimitives();