1 /* 2 * NodeViewport.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 "NodeGroup.h" 28 #include "Scene.h" 29 30 #include "SFMFTypes.h" 31 32 class ProtoViewport : public ProtoGroup { 33 public: 34 ProtoViewport(Scene *scene); 35 virtual Node *create(Scene *scene); 36 getType()37 virtual int getType() const { return X3D_VIEWPORT; } getNodeClass()38 virtual int getNodeClass() const { return GROUPING_NODE | 39 BOUNDED_OBJECT_NODE; } 40 isX3dInternalProto(void)41 virtual bool isX3dInternalProto(void) { return true; } 42 43 FieldIndex clipBoundary; 44 }; 45 46 class NodeViewport : public NodeGroup { 47 public: 48 NodeViewport(Scene *scene, Proto *proto); 49 getComponentName(void)50 virtual const char* getComponentName(void) const { return "Layering"; } getComponentLevel(void)51 virtual int getComponentLevel(void) const { return 1; } copy()52 virtual Node *copy() const { return new NodeViewport(*this); } 53 preDraw()54 virtual void preDraw() 55 { 56 if (m_scene->getDrawViewports()) 57 children()->preDraw(); 58 } draw(int pass)59 virtual void draw(int pass) 60 { 61 if (m_scene->getDrawViewports()) 62 children()->draw(pass, children_Field()); 63 } 64 65 virtual void setField(int index, FieldValue *value, 66 int containerField = -1); 67 68 69 fieldMacros(MFFloat, clipBoundary, ProtoViewport); 70 }; 71 72