KiCad PCB EDA Suite
Loading...
Searching...
No Matches
writer.cpp File Reference
#include <map>
#include "writer.h"
#include "constants.h"
#include "bit_stream_writer.h"
#include "data_block.h"
#include <exporters/step/kicad3d_info.h>
#include <Standard_Failure.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Version.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_MaterialTool.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>
#include <XCAFDoc_VisMaterialPBR.hxx>
#include <TDocStd_Document.hxx>
#include <TopoDS_Compound.hxx>
#include <XCAFPrs_DocumentExplorer.hxx>
#include <RWMesh_FaceIterator.hxx>
#include <TDataStd_Name.hxx>
#include <TDF_Tool.hxx>
#include <TopoDS.hxx>
#include <BRepBndLib.hxx>
#include <wx/log.h>
#include <wx/mstream.h>
#include <wx/datstrm.h>
#include <wx/intl.h>

Go to the source code of this file.

Namespaces

namespace  SHADING_ATTRIBUTES
 
namespace  LIT_TEXTURE_SHADER_ATTRIBUTES
 
namespace  MATERIAL_ATTRIBUTES
 

Macros

#define TRACE_MASK   "U3D"
 
#define MODEL_PARENT_BOARD_NAME   "Board"
 
#define MODEL_PARENT_COMPONENTS_NAME   "Components"
 

Enumerations

enum class  ALPHA_TEST_FUNCTION : uint32_t {
  NEVER = 0x00000610 , LESS = 0x00000611 , GREATER = 0x00000612 , EQUAL = 0x00000613 ,
  NOTEQUAL = 0x00000614 , LEQUAL = 0x00000615 , GEQUAL = 0x00000616 , ALWAYS = 0x00000617
}
 
enum class  COLOR_BLEND_FUNCTION : uint32_t { ADD = 0x00000604 , MULTIPLY = 0x00000605 , ALPHA_BLEND = 0x00000606 , INV_ALPHA_BLEND = 0x00000607 }
 

Functions

static wxString getLabelName (const TDF_Label &aLabel)
 
std::string getShapeName (TopAbs_ShapeEnum aShape)
 
static int colorFloatToDecimal (float aVal)
 
static std::ostream & operator<< (std::ostream &aOStream, const Quantity_ColorRGBA &aColor)
 
static void printLabel (TDF_Label aLabel, Handle(XCAFDoc_ShapeTool) aShapeTool, Handle(XCAFDoc_ColorTool) aColorTool, const char *aPreMsg=nullptr)
 
static void dumpLabels (TDF_Label aLabel, Handle(XCAFDoc_ShapeTool) aShapeTool, Handle(XCAFDoc_ColorTool) aColorTool, int aDepth=0)
 Dumps a label and the entire tree underneath it.
 
static bool isLabelABoardMesh (const TDF_Label &aLabel)
 

Variables

constexpr uint32_t SHADING_ATTRIBUTES::MESH = 0x00000001
 
constexpr uint32_t SHADING_ATTRIBUTES::LINE = 0x00000002
 
constexpr uint32_t SHADING_ATTRIBUTES::POINT = 0x00000004
 
constexpr uint32_t SHADING_ATTRIBUTES::GLYPH = 0x00000008
 
constexpr uint32_t LIT_TEXTURE_SHADER_ATTRIBUTES::LIGHTING_ENABLED = 0x00000001
 
constexpr uint32_t LIT_TEXTURE_SHADER_ATTRIBUTES::ALPHA_TEST_ENABLED = 0x00000002
 
constexpr uint32_t LIT_TEXTURE_SHADER_ATTRIBUTES::USE_VERTEX_COLOR = 0x00000004
 
constexpr uint32_t MATERIAL_ATTRIBUTES::AMBIENT = 0x00000001
 
constexpr uint32_t MATERIAL_ATTRIBUTES::DIFFUSE = 0x00000002
 
constexpr uint32_t MATERIAL_ATTRIBUTES::SPECULAR = 0x00000004
 
constexpr uint32_t MATERIAL_ATTRIBUTES::EMISSIVE = 0x00000008
 
constexpr uint32_t MATERIAL_ATTRIBUTES::REFLECTIVITY = 0x00000010
 
constexpr uint32_t MATERIAL_ATTRIBUTES::OPACITY = 0x00000020
 

Macro Definition Documentation

◆ MODEL_PARENT_BOARD_NAME

#define MODEL_PARENT_BOARD_NAME   "Board"

Definition at line 65 of file writer.cpp.

Referenced by U3D::WRITER::generateMeshesByAssembly(), and U3D::WRITER::Perform().

◆ MODEL_PARENT_COMPONENTS_NAME

#define MODEL_PARENT_COMPONENTS_NAME   "Components"

Definition at line 66 of file writer.cpp.

Referenced by U3D::WRITER::generateMeshesByAssembly(), and U3D::WRITER::Perform().

◆ TRACE_MASK

#define TRACE_MASK   "U3D"

Definition at line 63 of file writer.cpp.

Referenced by U3D::WRITER::Perform(), and printLabel().

Enumeration Type Documentation

◆ ALPHA_TEST_FUNCTION

enum class ALPHA_TEST_FUNCTION : uint32_t
strong
Enumerator
NEVER 
LESS 
GREATER 
EQUAL 
NOTEQUAL 
LEQUAL 
GEQUAL 
ALWAYS 

Definition at line 69 of file writer.cpp.

◆ COLOR_BLEND_FUNCTION

enum class COLOR_BLEND_FUNCTION : uint32_t
strong
Enumerator
ADD 
MULTIPLY 
ALPHA_BLEND 
INV_ALPHA_BLEND 

Definition at line 82 of file writer.cpp.

Function Documentation

◆ colorFloatToDecimal()

static int colorFloatToDecimal ( float aVal)
static

Definition at line 156 of file writer.cpp.

Referenced by operator<<().

◆ dumpLabels()

static void dumpLabels ( TDF_Label aLabel,
Handle(XCAFDoc_ShapeTool) aShapeTool,
Handle(XCAFDoc_ColorTool) aColorTool,
int aDepth = 0 )
static

Dumps a label and the entire tree underneath it.

Parameters
aLabelLabel to convert
aShapeToolHandle to shape tool being used
aColorToolHandle to color tool being used
aDepthIndentation level to offset labels (used recursively by dumpLabels)

Definition at line 226 of file writer.cpp.

References dumpLabels(), and printLabel().

Referenced by dumpLabels().

◆ getLabelName()

static wxString getLabelName ( const TDF_Label & aLabel)
static

Definition at line 119 of file writer.cpp.

References Handle(), and name.

Referenced by printLabel().

◆ getShapeName()

std::string getShapeName ( TopAbs_ShapeEnum aShape)

Definition at line 137 of file writer.cpp.

Referenced by printLabel().

◆ isLabelABoardMesh()

static bool isLabelABoardMesh ( const TDF_Label & aLabel)
static

Definition at line 237 of file writer.cpp.

References BOARD, KICAD3D_INFO::GetID(), and Handle().

◆ operator<<()

static std::ostream & operator<< ( std::ostream & aOStream,
const Quantity_ColorRGBA & aColor )
inlinestatic

Definition at line 162 of file writer.cpp.

References colorFloatToDecimal().

◆ printLabel()

static void printLabel ( TDF_Label aLabel,
Handle(XCAFDoc_ShapeTool) aShapeTool,
Handle(XCAFDoc_ColorTool) aColorTool,
const char * aPreMsg = nullptr )
static

Definition at line 173 of file writer.cpp.

References getLabelName(), getShapeName(), and TRACE_MASK.

Referenced by dumpLabels().