KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sg_appearance.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2017 Cirilo Bernardo <[email protected]>
5 * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29#ifndef SG_APPEARANCE_H
30#define SG_APPEARANCE_H
31
32#include "3d_cache/sg/sg_node.h"
33
37class SGAPPEARANCE : public SGNODE
38{
39public:
40 void unlinkChildNode( const SGNODE* aNode ) noexcept override;
41 void unlinkRefNode( const SGNODE* aNode ) noexcept override;
42
43 SGAPPEARANCE( SGNODE* aParent );
44 virtual ~SGAPPEARANCE();
45
46 virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
47
48 bool SetEmissive( float aRVal, float aGVal, float aBVal );
49 bool SetEmissive( const SGCOLOR* aRGBColor );
50 bool SetEmissive( const SGCOLOR& aRGBColor );
51
52 bool SetDiffuse( float aRVal, float aGVal, float aBVal );
53 bool SetDiffuse( const SGCOLOR* aRGBColor );
54 bool SetDiffuse( const SGCOLOR& aRGBColor );
55
56 bool SetSpecular( float aRVal, float aGVal, float aBVal );
57 bool SetSpecular( const SGCOLOR* aRGBColor );
58 bool SetSpecular( const SGCOLOR& aRGBColor );
59
60 bool SetAmbient( float aRVal, float aGVal, float aBVal );
61 bool SetAmbient( const SGCOLOR* aRGBColor );
62 bool SetAmbient( const SGCOLOR& aRGBColor );
63
64 SGNODE* FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override;
65 bool AddRefNode( SGNODE* aNode ) noexcept override;
66 bool AddChildNode( SGNODE* aNode ) noexcept override;
67
68 void ReNameNodes( void ) override;
69 bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
70
71 bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
72 bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
73
74 float shininess; // default 0.2
75 float transparency; // default 0.0
76 SGCOLOR ambient; // default 0.05317 0.17879 0.01804
77 SGCOLOR diffuse; // default 0.8 0.8 0.8
78 SGCOLOR emissive; // default 0.0 0.0 0.0
79 SGCOLOR specular; // default 0.0 0.0 0.0
80
81};
82
83#endif // SG_APPEARANCE_H
Defines the generic material appearance of a scenegraph object.
Definition: sg_appearance.h:38
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override
Search the tree of linked nodes and return a reference to the first node found with the given name.
bool AddRefNode(SGNODE *aNode) noexcept override
bool SetSpecular(float aRVal, float aGVal, float aBVal)
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
SGCOLOR diffuse
Definition: sg_appearance.h:77
SGCOLOR ambient
Definition: sg_appearance.h:76
bool AddChildNode(SGNODE *aNode) noexcept override
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
float transparency
Definition: sg_appearance.h:75
bool SetEmissive(float aRVal, float aGVal, float aBVal)
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
SGCOLOR specular
Definition: sg_appearance.h:79
bool SetDiffuse(float aRVal, float aGVal, float aBVal)
bool SetAmbient(float aRVal, float aGVal, float aBVal)
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
virtual ~SGAPPEARANCE()
SGCOLOR emissive
Definition: sg_appearance.h:78
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
The base class of all Scene Graph nodes.
Definition: sg_node.h:75