1 /* 2 * NodePointSet.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 ProtoPointSet : public GeometryProto { 31 public: 32 ProtoPointSet(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_POINT_SET; } 38 39 FieldIndex attrib; 40 FieldIndex color; 41 FieldIndex coord; 42 FieldIndex fogCoord; 43 }; 44 45 class NodePointSet : public GeometryNode, Colored { 46 public: 47 NodePointSet(Scene *scene, Proto *proto); 48 getProfile(void)49 virtual int getProfile(void) const { return PROFILE_INTERCHANGE; } getX3dVersion(void)50 virtual int getX3dVersion(void) const { return 0; } copy()51 virtual Node *copy() const { return new NodePointSet(*this); } 52 53 virtual void draw(); 54 isInvalidChildNode(void)55 virtual bool isInvalidChildNode(void) { return true; } hasBoundingBox(void)56 virtual bool hasBoundingBox(void) { return true; } 57 virtual Vec3f getMinBoundingBox(void); 58 virtual Vec3f getMaxBoundingBox(void); 59 virtual void flip(int index); 60 virtual void swap(int fromTo); 61 maySetDefault(void)62 virtual bool maySetDefault(void) { return false; } 63 getColorNode()64 virtual NodeColor *getColorNode() 65 { return (NodeColor *)color()->getValue(); } getColorRGBANode()66 virtual NodeColorRGBA *getColorRGBANode() 67 { return (NodeColorRGBA *)color()->getValue(); } getCoordinateNode(void)68 virtual NodeCoordinate *getCoordinateNode(void) 69 { return (NodeCoordinate *)coord()->getValue(); } getColored()70 virtual Colored *getColored() { return this; } 71 colorPerVertexField()72 virtual int colorPerVertexField() const 73 { return -1; } colorIndexField()74 virtual int colorIndexField() const 75 { return -1; } 76 getValidVertex(void)77 virtual bool getValidVertex(void) { return true; } 78 drawHandles(void)79 void drawHandles(void) 80 { 81 if (coord()->getValue()) 82 coord()->getValue()->drawHandles(); 83 } 84 85 fieldMacros(MFNode, attrib, ProtoPointSet) 86 fieldMacros(SFNode, color, ProtoPointSet) 87 fieldMacros(SFNode, coord, ProtoPointSet) 88 fieldMacros(SFNode, fogCoord, ProtoPointSet) 89 90 void pointDraw(); 91 }; 92 93