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

#define SG_VERSION_TAG   "VERSION:2"

Definition at line 44 of file ifsg_api.cpp.

Referenced by S3D::ReadCache(), and S3D::WriteCache().

Function Documentation

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

Definition at line 47 of file ifsg_api.cpp.

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, and SGAPPEARANCE::transparency.

Referenced by S3D::GetModel().

48 {
49  float v0, v1, v2;
50 
51  app->ambient.GetColor( v0, v1, v2 );
52  mat.m_Ambient.x = v0;
53  mat.m_Ambient.y = v1;
54  mat.m_Ambient.z = v2;
55 
56  app->diffuse.GetColor( v0, v1, v2 );
57  mat.m_Diffuse.x = v0;
58  mat.m_Diffuse.y = v1;
59  mat.m_Diffuse.z = v2;
60  mat.m_Ambient.x *= v0;
61  mat.m_Ambient.y *= v1;
62  mat.m_Ambient.z *= v2;
63 
64  app->emissive.GetColor( v0, v1, v2 );
65  mat.m_Emissive.x = v0;
66  mat.m_Emissive.y = v1;
67  mat.m_Emissive.z = v2;
68 
69  app->specular.GetColor( v0, v1, v2 );
70  mat.m_Specular.x = v0;
71  mat.m_Specular.y = v1;
72  mat.m_Specular.z = v2;
73 
74  mat.m_Shininess = app->shininess;
75  mat.m_Transparency = app->transparency;
76 
77  return;
78 }
SFVEC3F m_Ambient
Definition: c3dmodel.h:39
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
void Free3DModel ( S3DMODEL aModel)

Function Free3DModel frees memory used internally by an S3DMODEL structure.

Definition at line 557 of file ifsg_api.cpp.

References S3D::FREE_S3DMODEL().

558 {
559  S3D::FREE_S3DMODEL( aModel );
560  return;
561 }
void FREE_S3DMODEL(S3DMODEL &aModel)
Definition: sg_node.cpp:420