1 /* 2 * NodeColorRGBA.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 "Node.h" 25 #include "ProtoMacros.h" 26 #include "Proto.h" 27 #include "SFMFTypes.h" 28 29 class ProtoColorRGBA : public WonderlandExportProto { 30 public: 31 ProtoColorRGBA(Scene *scene); 32 virtual Node *create(Scene *scene); 33 getType()34 virtual int getType() const { return X3D_COLOR_RGBA; } getNodeClass()35 virtual int getNodeClass() const { return COLOR_NODE; } 36 isDeclaredInRwd_h()37 virtual bool isDeclaredInRwd_h() { return true; } 38 isX3dInternalProto(void)39 virtual bool isX3dInternalProto(void) { return true; } 40 41 FieldIndex color; 42 }; 43 44 class NodeColorRGBA : public Node { 45 public: 46 NodeColorRGBA(Scene *scene, Proto *proto); getComponentName(void)47 virtual const char* getComponentName(void) const { return "Rendering"; } 48 virtual int getComponentLevel(void) const; getX3dVersion(void)49 virtual int getX3dVersion(void) const { return 0; } copy()50 virtual Node *copy() const { return new NodeColorRGBA(*this); } 51 isInvalidChildNode(void)52 virtual bool isInvalidChildNode(void) { return true; } 53 54 virtual void setField(int index, FieldValue *value, int cf = -1); 55 getColorRGBANode()56 virtual NodeColorRGBA *getColorRGBANode() { return this; } 57 58 void drawHandles(void); 59 Vec3f getHandle(int handle, int *constraint, int *field); 60 void setHandle(int handle, const Vec3f &v); 61 writeProto(int f)62 virtual int writeProto(int f) { return writeX3dProto(f); } 63 64 fieldMacros(MFColorRGBA, color, ProtoColorRGBA) 65 66 }; 67 68