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));
|
||||
|
||||
// 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)
|
||||
|
||||
|
||||
|
@ -1164,56 +1164,6 @@ 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
|
||||
/* Special STEP File load function including the ability
|
||||
@ -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 <myadt.hpp>
|
||||
#include <meshing.hpp>
|
||||
#include <csg.hpp>
|
||||
@ -10,31 +9,14 @@
|
||||
|
||||
// #include <parallel.hpp>
|
||||
|
||||
#ifdef OCCGEOMETRY
|
||||
// Philippose - 30/01/2009
|
||||
// Required for OpenCascade XDE Support
|
||||
#include <occgeom.hpp>
|
||||
#endif
|
||||
|
||||
#include <visual.hpp>
|
||||
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
#ifdef OCCGEOMETRY
|
||||
// Philippose - 30/01/2009
|
||||
// Required for OpenCascade XDE Support
|
||||
extern OCCGeometry * occgeometry;
|
||||
#endif
|
||||
|
||||
|
||||
extern AutoPtr<Mesh> mesh;
|
||||
extern STLGeometry * stlgeometry;
|
||||
VisualSceneMesh vsmesh;
|
||||
|
||||
|
||||
|
||||
VisualSceneMesh :: VisualSceneMesh ()
|
||||
: VisualScene()
|
||||
{
|
||||
@ -1031,37 +1013,19 @@ namespace netgen
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OCCGEOMETRY
|
||||
// Philippose - 30/01/2009
|
||||
// OpenCascade XDE Support
|
||||
// Update the colour of each face based on the STEP File Data
|
||||
// if the advanced OpenCascade XDE Support has been enabled
|
||||
if((col == 1) && (occgeometry))
|
||||
// Philippose - 06/07/2009
|
||||
// Modified the colour system to integrate the face colours into
|
||||
// the mesh data structure, rather than limit it to the OCC geometry
|
||||
// structure... allows other geometry types to use face colours too
|
||||
if(col == 1)
|
||||
{
|
||||
TopoDS_Face face = TopoDS::Face(occgeometry->fmap(el.GetIndex()));
|
||||
Quantity_Color face_colour;
|
||||
// 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[0] = mesh->GetFaceDescriptor(el.GetIndex()).SurfColour().X();
|
||||
matcol[1] = mesh->GetFaceDescriptor(el.GetIndex()).SurfColour().Y();
|
||||
matcol[2] = mesh->GetFaceDescriptor(el.GetIndex()).SurfColour().Z();
|
||||
|
||||
matcol[3] = 1.0;
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, matcol);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool drawel = !el.IsDeleted();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user