mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
* Use the new mesh level face colour functions instead of OCC function calls
* Removes dependency on OCC for mesh visualization even for meshes created from OCC Geometry * Code cleanup to remove old commented out functions
This commit is contained in:
parent
04cb56a8ff
commit
87e74276f3
@ -208,6 +208,20 @@ namespace netgen
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mesh.AddFaceDescriptor (FaceDescriptor(facenr, solidnr0, solidnr1, 0));
|
mesh.AddFaceDescriptor (FaceDescriptor(facenr, solidnr0, solidnr1, 0));
|
||||||
|
|
||||||
|
// Philippose - 06/07/2009
|
||||||
|
// Add the face colour to the mesh data
|
||||||
|
Quantity_Color face_colour;
|
||||||
|
|
||||||
|
if(!(geom.face_colours.IsNull())
|
||||||
|
&& (geom.face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour)))
|
||||||
|
{
|
||||||
|
mesh.GetFaceDescriptor(facenr).SetSurfColour(Vec3d(face_colour.Red(),face_colour.Green(),face_colour.Blue()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mesh.GetFaceDescriptor(facenr).SetSurfColour(Vec3d(0.0,1.0,0.0));
|
||||||
|
}
|
||||||
// ACHTUNG! STIMMT NICHT ALLGEMEIN (RG)
|
// ACHTUNG! STIMMT NICHT ALLGEMEIN (RG)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1162,57 +1162,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Philippose - 23/02/2009
|
|
||||||
// The LOADOCC_IGES Function has been replaced by the one
|
|
||||||
// above, which also includes support for the OpenCascade
|
|
||||||
// XDE Features.
|
|
||||||
//
|
|
||||||
//OCCGeometry * LoadOCC_IGES (const char * filename)
|
|
||||||
//{
|
|
||||||
// OCCGeometry * occgeo;
|
|
||||||
// occgeo = new OCCGeometry;
|
|
||||||
|
|
||||||
// IGESControl_Reader reader;
|
|
||||||
|
|
||||||
// Standard_Integer stat = reader.ReadFile((char*)filename);
|
|
||||||
|
|
||||||
// // pre OCC52-times:
|
|
||||||
// // Standard_Integer stat = reader.LoadFile((char*)filename);
|
|
||||||
// // reader.Clear();
|
|
||||||
|
|
||||||
|
|
||||||
// reader.TransferRoots(); // Tranlate IGES -> OCC
|
|
||||||
|
|
||||||
// // pre OCC52-times:
|
|
||||||
// // reader.TransferRoots(Standard_False); // Tranlate IGES -> OCC
|
|
||||||
|
|
||||||
// //reader.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ListByItem);
|
|
||||||
|
|
||||||
// occgeo->shape = reader.OneShape();
|
|
||||||
// occgeo->changed = 1;
|
|
||||||
// occgeo->BuildFMap();
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
|
||||||
// // sfs->Init(occgeo->shape);
|
|
||||||
// // sfs->Perform();
|
|
||||||
// // Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(occgeo->shape);
|
|
||||||
// // //sfwf->DropSmallEdgesMode() = Standard_True;
|
|
||||||
// // sfwf->FixSmallEdges();
|
|
||||||
// // sfwf->FixWireGaps();
|
|
||||||
|
|
||||||
// //
|
|
||||||
|
|
||||||
|
|
||||||
// // occgeo->BuildVisualizationMesh();
|
|
||||||
// occgeo->CalcBoundingBox();
|
|
||||||
// PrintContents (occgeo);
|
|
||||||
|
|
||||||
// return occgeo;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Philippose - 29/01/2009
|
// Philippose - 29/01/2009
|
||||||
@ -1263,9 +1213,9 @@ namespace netgen
|
|||||||
PrintMessage(4,"Number of colours in STEP File: ",all_colours.Length());
|
PrintMessage(4,"Number of colours in STEP File: ",all_colours.Length());
|
||||||
for(int i = 1; i <= all_colours.Length(); i++)
|
for(int i = 1; i <= all_colours.Length(); i++)
|
||||||
{
|
{
|
||||||
Quantity_Color col;
|
Quantity_Color col;
|
||||||
step_colour_contents->GetColor(all_colours.Value(i),col);
|
step_colour_contents->GetColor(all_colours.Value(i),col);
|
||||||
PrintMessage(4, "Colour [", i, "] = ",col.StringName(col.Name()));
|
PrintMessage(4, "Colour [", i, "] = ",col.StringName(col.Name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1285,64 +1235,6 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Philippose - 29/01/2009
|
|
||||||
// The LOADOCC_STEP Function has been replaced by the one
|
|
||||||
// above, which also includes support for the OpenCascade
|
|
||||||
// XDE Features.
|
|
||||||
//
|
|
||||||
// OCCGeometry * LoadOCC_STEP (const char * filename)
|
|
||||||
// {
|
|
||||||
// OCCGeometry * occgeo;
|
|
||||||
// occgeo = new OCCGeometry;
|
|
||||||
//
|
|
||||||
// STEPControl_Reader reader;
|
|
||||||
// Standard_Integer stat = reader.ReadFile((char*)filename);
|
|
||||||
// Standard_Integer nb = reader.NbRootsForTransfer();
|
|
||||||
// reader.TransferRoots (); // Tranlate STEP -> OCC
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// occgeo->shape = reader.OneShape();
|
|
||||||
// occgeo->changed = 1;
|
|
||||||
// occgeo->BuildFMap();
|
|
||||||
// //
|
|
||||||
// //Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
|
||||||
// //sfs->Init(occgeo->shape);
|
|
||||||
// //sfs->Perform();
|
|
||||||
// //Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(occgeo->shape);
|
|
||||||
// //sfwf->FixSmallEdges();
|
|
||||||
// //sfwf->FixWireGaps();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// // JS
|
|
||||||
// TopoDS_Compound aRes;
|
|
||||||
// BRep_Builder aBuilder;
|
|
||||||
// aBuilder.MakeCompound (aRes);
|
|
||||||
//
|
|
||||||
// for (TopExp_Explorer exp(occgeo->shape, TopAbs_SOLID); exp.More(); exp.Next())
|
|
||||||
// {
|
|
||||||
// aBuilder.Add (aRes, exp.Current());
|
|
||||||
// cout << "solid" << endl;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (TopExp_Explorer exp(aRes, TopAbs_SOLID); exp.More(); exp.Next())
|
|
||||||
// {
|
|
||||||
// cout << "compound has shapes solid" << endl;
|
|
||||||
// }
|
|
||||||
// occgeo->shape = aRes;
|
|
||||||
// occgeo->changed = 1;
|
|
||||||
// occgeo->BuildFMap();
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// occgeo->BuildVisualizationMesh();
|
|
||||||
// PrintContents (occgeo);
|
|
||||||
//
|
|
||||||
// return occgeo;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <mystdlib.h>
|
#include <mystdlib.h>
|
||||||
|
|
||||||
|
|
||||||
#include <myadt.hpp>
|
#include <myadt.hpp>
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
#include <csg.hpp>
|
#include <csg.hpp>
|
||||||
@ -10,31 +9,14 @@
|
|||||||
|
|
||||||
// #include <parallel.hpp>
|
// #include <parallel.hpp>
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
// Philippose - 30/01/2009
|
|
||||||
// Required for OpenCascade XDE Support
|
|
||||||
#include <occgeom.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <visual.hpp>
|
#include <visual.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
// Philippose - 30/01/2009
|
|
||||||
// Required for OpenCascade XDE Support
|
|
||||||
extern OCCGeometry * occgeometry;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern AutoPtr<Mesh> mesh;
|
extern AutoPtr<Mesh> mesh;
|
||||||
extern STLGeometry * stlgeometry;
|
extern STLGeometry * stlgeometry;
|
||||||
VisualSceneMesh vsmesh;
|
VisualSceneMesh vsmesh;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VisualSceneMesh :: VisualSceneMesh ()
|
VisualSceneMesh :: VisualSceneMesh ()
|
||||||
: VisualScene()
|
: VisualScene()
|
||||||
{
|
{
|
||||||
@ -1031,37 +1013,19 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
// Philippose - 06/07/2009
|
||||||
// Philippose - 30/01/2009
|
// Modified the colour system to integrate the face colours into
|
||||||
// OpenCascade XDE Support
|
// the mesh data structure, rather than limit it to the OCC geometry
|
||||||
// Update the colour of each face based on the STEP File Data
|
// structure... allows other geometry types to use face colours too
|
||||||
// if the advanced OpenCascade XDE Support has been enabled
|
if(col == 1)
|
||||||
if((col == 1) && (occgeometry))
|
{
|
||||||
{
|
matcol[0] = mesh->GetFaceDescriptor(el.GetIndex()).SurfColour().X();
|
||||||
TopoDS_Face face = TopoDS::Face(occgeometry->fmap(el.GetIndex()));
|
matcol[1] = mesh->GetFaceDescriptor(el.GetIndex()).SurfColour().Y();
|
||||||
Quantity_Color face_colour;
|
matcol[2] = mesh->GetFaceDescriptor(el.GetIndex()).SurfColour().Z();
|
||||||
// Philippose - 23/02/2009
|
|
||||||
// Check to see if colours have been extracted first!!
|
|
||||||
// Forum bug-fox (Jean-Yves - 23/02/2009)
|
|
||||||
if(!(occgeometry->face_colours.IsNull())
|
|
||||||
&&(occgeometry->face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour)))
|
|
||||||
{
|
|
||||||
matcol[0] = face_colour.Red();
|
|
||||||
matcol[1] = face_colour.Green();
|
|
||||||
matcol[2] = face_colour.Blue();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
matcol[0] = 0.0;
|
|
||||||
matcol[1] = 1.0;
|
|
||||||
matcol[2] = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
matcol[3] = 1.0;
|
||||||
matcol[3] = 1.0;
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, matcol);
|
||||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, matcol);
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool drawel = !el.IsDeleted();
|
bool drawel = !el.IsDeleted();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user