1 /*
2  * NodeIndexedLineSet.h
3  *
4  * Copyright (C) 1999 Stephen F. White
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 "GeometryNode.h"
25 #include "ProtoMacros.h"
26 #include "Proto.h"
27 #include "Colored.h"
28 #include "SFMFTypes.h"
29 
30 class ProtoIndexedLineSet : public GeometryProto {
31 public:
32                     ProtoIndexedLineSet(Scene *scene);
33     virtual Node   *create(Scene *scene);
34 
isDeclaredInRwd_h()35     virtual bool    isDeclaredInRwd_h() { return true; }
36 
getType()37     virtual int     getType() const { return VRML_INDEXED_LINE_SET; }
getNodeClass()38     virtual int     getNodeClass() const
39                        { return LINE_SET_NODE | GEOMETRY_NODE; }
40 
41     FieldIndex attrib;
42     FieldIndex color;
43     FieldIndex coord;
44     FieldIndex colorIndex;
45     FieldIndex colorPerVertex;
46     FieldIndex coordIndex;
47     FieldIndex fogCoord;
48     x3domGeometryCommonFieldIndex()
49     FieldIndex ccw;
50     FieldIndex solid;
51 };
52 
53 class NodeIndexedLineSet : public GeometryNode, Colored {
54 public:
55                     NodeIndexedLineSet(Scene *scene, Proto *proto);
56 
57     virtual int     getProfile(void) const;
getX3dVersion(void)58     virtual int     getX3dVersion(void) const { return 0; }
copy()59     virtual Node   *copy() const { return new NodeIndexedLineSet(*this); }
60 
61     virtual void    draw();
62 
isInvalidChildNode(void)63     virtual bool    isInvalidChildNode(void) { return true; }
hasBoundingBox(void)64     virtual bool    hasBoundingBox(void)     { return true; }
65     virtual Vec3f   getMinBoundingBox(void);
66     virtual Vec3f   getMaxBoundingBox(void);
67     virtual void    flip(int index);
68     virtual void    swap(int fromTo);
69 
maySetDefault(void)70     virtual bool    maySetDefault(void) { return false; }
71 
72     Node           *toPointSet(void);
73 
canWriteAc3d()74     virtual bool    canWriteAc3d() { return true; }
75     virtual int     writeAc3d(int filedes, int indent);
76 
canWriteLdrawDat()77     virtual bool    canWriteLdrawDat() { return true; }
78     virtual int     writeLdrawDat(int filedes, int indent);
79 
getColorNode()80     virtual NodeColor *getColorNode()
81                     { return (NodeColor *)color()->getValue(); }
getColorRGBANode()82     virtual NodeColorRGBA *getColorRGBANode()
83                     { return (NodeColorRGBA *)color()->getValue(); }
getCoordinateNode(void)84     virtual NodeCoordinate *getCoordinateNode(void)
85                     { return (NodeCoordinate *)coord()->getValue(); }
getColored()86     virtual Colored *getColored() { return this; }
87 
colorPerVertexField()88     virtual int     colorPerVertexField() const
89                        { return colorPerVertex_Field(); }
colorIndexField()90     virtual int     colorIndexField() const
91                        { return colorIndex_Field(); }
92 
93     fieldMacros(MFNode,  attrib,         ProtoIndexedLineSet)
94     fieldMacros(SFNode,  color,          ProtoIndexedLineSet)
95     fieldMacros(SFNode,  coord,          ProtoIndexedLineSet)
96     fieldMacros(MFInt32, colorIndex,     ProtoIndexedLineSet)
97     fieldMacros(SFBool,  colorPerVertex, ProtoIndexedLineSet)
98     fieldMacros(MFInt32, coordIndex,     ProtoIndexedLineSet)
99     fieldMacros(SFNode,  fogCoord,       ProtoIndexedLineSet)
100     x3domGeometryCommonFieldMacros(ProtoIndexedLineSet)
101     fieldMacros(SFBool,  ccw,            ProtoIndexedLineSet)
102     fieldMacros(SFBool,  solid,          ProtoIndexedLineSet)
103 
104     void            lineDraw();
105 };
106 
107