1 /* 2 * NodeTrimmedSurface.h 3 * 4 * Copyright (C) 1999 Stephen F. White, 2004 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 "GeometryNode.h" 25 #include "ProtoMacros.h" 26 #include "Proto.h" 27 #include "SFMFTypes.h" 28 29 class ProtoTrimmedSurface : public GeometryProto { 30 public: 31 ProtoTrimmedSurface(Scene *scene); 32 virtual Node *create(Scene *scene); 33 getType()34 virtual int getType() const { return VRML_TRIMMED_SURFACE; } getNodeClass()35 virtual int getNodeClass() const 36 { return PARAMETRIC_GEOMETRY_NODE | GEOMETRY_NODE; } 37 38 FieldIndex trimmingContour; 39 FieldIndex surface; 40 }; 41 42 class NodeTrimmedSurface : public GeometryNode { 43 public: 44 NodeTrimmedSurface(Scene *scene, Proto *proto); 45 getX3dVersion(void)46 virtual int getX3dVersion(void) const { return -1; } copy()47 virtual Node *copy() const { return new NodeTrimmedSurface(*this); } 48 49 virtual void draw(); 50 hasBoundingBox(void)51 virtual bool hasBoundingBox(void) { return true; } 52 virtual Vec3f getMinBoundingBox(void); 53 virtual Vec3f getMaxBoundingBox(void); 54 55 virtual void update(void); 56 virtual void reInit(void); 57 58 virtual int countPolygons(void); 59 virtual int countPrimitives(void); 60 61 virtual int countPolygons1Sided(void); 62 virtual int countPolygons2Sided(void); 63 64 virtual void flip(int index); 65 virtual void swap(int fromTo); 66 showFields()67 virtual bool showFields() { return true; } 68 avoidProtoOnPureVrml(void)69 virtual bool avoidProtoOnPureVrml(void) { return true; } 70 virtual int writeProto(int f); 71 virtual int write(int filedes, int indent, bool avoidUse = false); 72 73 virtual Node *convert2X3d(void); 74 75 fieldMacros(MFNode, trimmingContour, ProtoTrimmedSurface) 76 fieldMacros(SFNode, surface, ProtoTrimmedSurface) 77 }; 78 79