KiCad PCB EDA Suite
ifsg_api.cpp File Reference
#include <iostream>
#include <sstream>
#include <fstream>
#include <wx/filename.h>
#include <wx/log.h>
#include "plugins/3dapi/ifsg_api.h"
#include "plugins/3dapi/sg_version.h"
#include "streamwrapper.h"
#include "3d_cache/sg/sg_node.h"
#include "3d_cache/sg/scenegraph.h"
#include "3d_cache/sg/sg_appearance.h"
#include "3d_cache/sg/sg_shape.h"
#include "3d_cache/sg/sg_helpers.h"

Go to the source code of this file.

Macros

#define SG_VERSION_TAG   "VERSION:2"
 

Functions

static void formatMaterial (SMATERIAL &mat, SGAPPEARANCE const *app)
 
void Free3DModel (S3DMODEL &aModel)
 Function Free3DModel frees memory used internally by an S3DMODEL structure. More...
 

Macro Definition Documentation

◆ SG_VERSION_TAG

#define SG_VERSION_TAG   "VERSION:2"

Definition at line 41 of file ifsg_api.cpp.

Function Documentation

◆ formatMaterial()

static void formatMaterial ( SMATERIAL mat,
SGAPPEARANCE const *  app 
)
static

Definition at line 44 of file ifsg_api.cpp.

45 {
46  float v0, v1, v2;
47 
48  app->ambient.GetColor( v0, v1, v2 );
49  mat.m_Ambient.x = v0;
50  mat.m_Ambient.y = v1;
51  mat.m_Ambient.z = v2;
52 
53  app->diffuse.GetColor( v0, v1, v2 );
54  mat.m_Diffuse.x = v0;
55  mat.m_Diffuse.y = v1;
56  mat.m_Diffuse.z = v2;
57  mat.m_Ambient.x *= v0;
58  mat.m_Ambient.y *= v1;
59  mat.m_Ambient.z *= v2;
60 
61  app->emissive.GetColor( v0, v1, v2 );
62  mat.m_Emissive.x = v0;
63  mat.m_Emissive.y = v1;
64  mat.m_Emissive.z = v2;
65 
66  app->specular.GetColor( v0, v1, v2 );
67  mat.m_Specular.x = v0;
68  mat.m_Specular.y = v1;
69  mat.m_Specular.z = v2;
70 
71  mat.m_Shininess = app->shininess;
72  mat.m_Transparency = app->transparency;
73 }
SFVEC3F m_Ambient
Definition: c3dmodel.h:39
VECTOR2I v2(1, 0)
Test suite for KiCad math code.
float m_Transparency
1.0 is completely transparent, 0.0 completely opaque
Definition: c3dmodel.h:44
float m_Shininess
Definition: c3dmodel.h:43
SFVEC3F m_Emissive
Definition: c3dmodel.h:41
SFVEC3F m_Diffuse
Default diffuse color if m_Color is NULL.
Definition: c3dmodel.h:40
SFVEC3F m_Specular
Definition: c3dmodel.h:42

References SGAPPEARANCE::ambient, SGAPPEARANCE::diffuse, SGAPPEARANCE::emissive, SGCOLOR::GetColor(), SMATERIAL::m_Ambient, SMATERIAL::m_Diffuse, SMATERIAL::m_Emissive, SMATERIAL::m_Shininess, SMATERIAL::m_Specular, SMATERIAL::m_Transparency, SGAPPEARANCE::shininess, SGAPPEARANCE::specular, SGAPPEARANCE::transparency, and v2.

Referenced by S3D::GetModel().

◆ Free3DModel()

void Free3DModel ( S3DMODEL aModel)

Function Free3DModel frees memory used internally by an S3DMODEL structure.

Definition at line 413 of file ifsg_api.cpp.

414 {
415  S3D::FREE_S3DMODEL( aModel );
416 }
void FREE_S3DMODEL(S3DMODEL &aModel)
Definition: sg_node.cpp:324

References S3D::FREE_S3DMODEL().