1 /*
2  * NodeCADFace.h
3  *
4  * Copyright (C) 2009 J. "MUFTI" Scheurich
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #pragma once
23 
24 #include "Node.h"
25 #include "ProtoMacros.h"
26 #include "Proto.h"
27 #include "SFMFTypes.h"
28 
29 class ProtoCADFace : public WonderlandExportProto {
30 public:
31                     ProtoCADFace(Scene *scene);
32     virtual Node   *create(Scene *scene);
33 
getType()34     virtual int     getType() const { return X3D_CAD_FACE; }
getNodeClass()35     virtual int     getNodeClass() const
36                        { return PRODUCT_STRUCTURE_CHILD_NODE | CHILD_NODE; }
37 
isX3dInternalProto(void)38     virtual bool    isX3dInternalProto(void) { return true; }
39 
40     FieldIndex name;
41     FieldIndex shape;
42     FieldIndex bboxCenter;
43     FieldIndex bboxSize;
44     FieldIndex render;
45 };
46 
47 class NodeCADFace : public Node {
48 public:
49                     NodeCADFace(Scene *scene, Proto *proto);
50 
getProfile(void)51     virtual int     getProfile(void) const { return PROFILE_CAD_INTERCHANGE; }
getComponentName(void)52     virtual const char* getComponentName(void) const { return "CADGeometry"; }
getComponentLevel(void)53     virtual int         getComponentLevel(void) const { return 2; }
getX3dVersion(void)54     virtual int     getX3dVersion(void) const { return 1; }
copy()55     virtual Node   *copy() const { return new NodeCADFace(*this); }
56 
57     virtual void      preDraw();
58     virtual void      draw(int pass);
59 
60     virtual void      flip(int index);
61     virtual void      swap(int fromTo);
62 
63     virtual int       countPolygons(void);
64     virtual int       countPrimitives(void);
65 
66     virtual int       countPolygons1Sided(void);
67     virtual int       countPolygons2Sided(void);
68 
69     fieldMacros(SFString, name,       ProtoCADFace)
70     fieldMacros(SFNode,   shape,      ProtoCADFace)
71     fieldMacros(SFVec3f,  bboxCenter, ProtoCADFace)
72     fieldMacros(SFVec3f,  bboxSize,   ProtoCADFace)
73     fieldMacros(SFBool,   render,     ProtoCADFace)
74 };
75 
76